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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s605068439 | p03149 | u744517446 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 245 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | clist = list(map(int,input().split()))
clist.sort()
ans = "No"
if min(clist) == 1 and max(clist) == 9 :
clist.pop(0)
clist.pop()
if min(clist) == 4 and max(clist) == 7 :
ans = "Yes"
else:
ans = "No"
else:
ans = "No"
print(ans) | s665386036 | Accepted | 17 | 3,064 | 110 | clist = list(map(int,input().split()))
clist.sort()
if clist == [1,4,7,9] :
print("YES")
else:
print("NO") |
s584616087 | p03636 | u699944218 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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()
a = len(s)-2
print(a) | s769184472 | Accepted | 17 | 2,940 | 61 | s = input()
a = len(s)-2
print(s[0] + str(a) + s[len(s) - 1]) |
s631275499 | p00219 | u546285759 | 1,000 | 131,072 | Wrong Answer | 150 | 9,580 | 233 | テンアイスクリームという名前のアイスクリーム屋さんがあります。このお店では常に 10 種類のアイスクリームが店頭に並ぶようにしています。お店の店長は商品開発の参考にするために、アイスクリームの売れ具合を表すグラフを毎日作成しています。 そんな店長のために、あなたは各アイスクリームの販売数をグラフで表示するプログラムを作成することになりました。 一日に販売されるアイスクリームの総数と売れたアイスクリームの番号を入力とし、アイスクリームの種類ごとに販売した数だけ * (半角アスタリスク) を出力するプログラムを作成してください。ただし、アイスクリームの種類を 0 から 9 までの整数で表わします。また、販売個数がゼロのアイスクリーム... | while True:
n = int(input())
if n == 0:
break
d = {k: 0 for k in range(n)}
for _ in range(n):
x = int(input())
d[x] += 1
for k in range(n):
print("*"*d[k] + "-"*(d[k]==0)) | s845608423 | Accepted | 110 | 7,712 | 197 | while True:
n = int(input())
if n == 0:
break
ice = [int(input()) for _ in range(n)]
for i in range(10):
nums = ice.count(i)
print("*"*nums + "-"*(nums==0)) |
s986812704 | p02678 | u811436126 | 2,000 | 1,048,576 | Wrong Answer | 935 | 65,944 | 651 | 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
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
graph = [[] for _ in range(n + 1)]
for i in range(m):
a = ab[i][0]
b = ab[i][1]
graph[a].append(b)
graph[b].append(a)
inf = 100100100
ans = [[inf, inf] for _ in range(n + 1)]
ans[0]... | s258709824 | Accepted | 838 | 65,776 | 664 | from collections import deque
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
graph = [[] for _ in range(n + 1)]
for i in range(m):
a = ab[i][0]
b = ab[i][1]
graph[a].append(b)
graph[b].append(a)
inf = 100100100
ans = [[inf, inf] for _ in range(n + 1)]
ans[0]... |
s132710025 | p03565 | u565149926 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 362 | 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()
ans = []
for i in range(len(S) - len(T) + 1):
c = ""
for j in range(len(T)):
if S[i+j] != "?" and S[i+j] != T[j]:
break
c += T[j]
if len(c) == len(T):
print(S[:i], c, S[i+len(T):])
ans.append((S[:i] + c + S[i+len(T):]).replace("?", "a"))
p... | s191182297 | Accepted | 18 | 3,060 | 324 | S = input()
T = input()
ans = []
for i in range(len(S) - len(T) + 1):
c = ""
for j in range(len(T)):
if S[i+j] != "?" and S[i+j] != T[j]:
break
c += T[j]
if len(c) == len(T):
ans.append((S[:i] + c + S[i+len(T):]).replace("?", "a"))
print(min(ans) if ans else "UNRESTORABL... |
s751276825 | p03854 | u122231433 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 517 | 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`. | # coding: utf-8
# Your code here!
S = input()
flag = False
st_match = ["erase",'dream']
while len(S)>0:
for st in st_match:
if(S.startswith(st)):
S=S[len(st):]
if(S.startswith('er') and S.startswith('era')==False):
S=S[2:]
elif(S.startswith('r')):
... | s400281855 | Accepted | 214 | 4,084 | 477 | def rev (s):
_re=''.join(list(reversed(s)))
return _re
name = ['dream','dreamer','eraser','erase']
S = input()
S_re = rev(S)
i=0
can = True
while i < len(S_re):
for div in name:
can2 = False
if len(S_re[i:]) >= len(div):
if S_re[i:i+len(div)]==rev(div) :
i+=len(di... |
s109936800 | p03712 | u813387707 | 2,000 | 262,144 | Wrong Answer | 26 | 8,976 | 126 | 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 = [int(x) for x in input().split()]
s = "*" * (w + 2)
print(s)
for _ in range(h):
print("*" + input() + "*")
print(s) | s330993110 | Accepted | 24 | 9,060 | 128 | h, w = [int(x) for x in input().split()]
c = "#"
s = c * (w + 2)
print(s)
for _ in range(h):
print(c + input() + c)
print(s) |
s611973251 | p03371 | u419535209 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 306 | "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... | def C():
A, B, C, nA, nB = map(int, input().split())
minAB = min(nA, nB)
# 3, 2 --> 1, 0
ns = [nA - minAB, nB - minAB]
print(ns)
amounts = [
A * nA + B * nB,
minAB * 2 * C + ns[0] * A + ns[1] * B,
max(nA, nB) * 2 * C
]
return min(amounts)
print(C()) | s185613378 | Accepted | 17 | 3,060 | 293 | def C():
A, B, C, nA, nB = map(int, input().split())
minAB = min(nA, nB)
# 3, 2 --> 1, 0
ns = [nA - minAB, nB - minAB]
amounts = [
A * nA + B * nB,
minAB * 2 * C + ns[0] * A + ns[1] * B,
max(nA, nB) * 2 * C
]
return min(amounts)
print(C())
|
s677743610 | p04030 | u288087195 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 353 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = input()
data =[]
for i in range(len(s)):
data.append(s[i])
array = []
for i in range(1, len(data)):
if data[i] == "0":
array.append("0")
elif data[i] == "1":
array.append("1")
elif (len(array) != 0 and data[i]== "B"):
array.pop(-1)
else:
pass
mojiretu = ''
for x in array:
mojiretu +=... | s406642147 | Accepted | 17 | 3,064 | 336 | s = input()
data =[]
for i in range(len(s)):
data.append(s[i])
array = []
for i in range(len(data)):
if data[i] == "0":
array.append("0")
elif data[i] == "1":
array.append("1")
elif (len(array) != 0 and data[i]== "B"):
array.pop(-1)
else:
pass
mojiretu = ''
for x in array:
mojiretu += x
... |
s895264113 | p02268 | u548155360 | 1,000 | 131,072 | Wrong Answer | 20 | 7,632 | 429 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | def BinarySearch(A, c):
left = 0
right = len(A)-1
while(left < right):
mid = (left + right) // 2
print(mid)
if A[mid] == c:
return mid
elif (A[mid] < c):
left = mid + 1
else:
right = mid
else:
return 0
N = int(input())
S = list(map(int, input().split()))
Q = int(input())
T = list(map... | s446932353 | Accepted | 280 | 18,800 | 411 | def BinarySearch(A, c):
left = 0
right = len(A)
while(left < right):
mid = (left + right) // 2
if A[mid] == c:
return True
elif (A[mid] < c):
left = mid + 1
else:
right = mid
else:
return False
N = int(input())
S = list(map(int, input().split()))
Q = int(input())
T = list(map(int, input()... |
s930267267 | p03448 | u248670337 | 2,000 | 262,144 | Wrong Answer | 45 | 8,016 | 129 | 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,b,c,x=[int(input()) for _ in range(4)]
print([500*i+100*j+50*k for i in range(a) for j in range(b) for k in range(c)].count(x)) | s968063318 | Accepted | 46 | 8,276 | 135 | a,b,c,x=[int(input()) for _ in range(4)]
print([500*i+100*j+50*k for i in range(a+1) for j in range(b+1) for k in range(c+1)].count(x)) |
s964302451 | p03605 | u392319141 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | 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? | print('YNeos'[input().count('9')>0::2]) | s374723616 | Accepted | 20 | 2,940 | 41 | print('YNeos'[input().count('9')==0::2])
|
s667949802 | p03836 | u898967808 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 238 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx,sy,tx,ty = map(int,input().split())
yl = ty - sy
xl = tx - sx
ans = ''
ans += 'U'*yl
ans += 'R'*xl
ans += 'D'*yl
ans += 'L'*xl
ans += 'R'*(yl+1)
ans += 'R'*(xl+1)
ans += 'DR'
ans += 'D'*(yl+1)
ans += 'L'*(xl+1)
ans += 'U'
print(ans) | s210896720 | Accepted | 17 | 3,064 | 242 | sx,sy,tx,ty = map(int,input().split())
yl = ty - sy
xl = tx - sx
ans = ''
ans += 'U'*yl
ans += 'R'*xl
ans += 'D'*yl
ans += 'L'*(xl+1)
ans += 'U'*(yl+1)
ans += 'R'*(xl+1)
ans += 'DR'
ans += 'D'*(yl+1)
ans += 'L'*(xl+1)
ans += 'U'
print(ans) |
s233787884 | p02795 | u455533363 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 2,940 | 158 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | h = int(input())
w = int(input())
n = int(input())
count = n//h
bit = w - count
while count<n:
if count>=n:
print(count)
break
count += bit
| s377139378 | Accepted | 18 | 3,060 | 187 | h = int(input())
w = int(input())
n = int(input())
num = n//max(h,w) if (n//max(h,w)+1)==n else (n//max(h,w)+1)
if (n%max(h,w)==0):
print((n//max(h,w)))
else:
print((n//max(h,w)+1)) |
s721201517 | p03962 | u296150111 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | a,b,c=map(int,input().split())
ans=1
if a==b:
ans+=1
if b==c:
ans+=1
if a==c:
ans+=1
if ans==4:
ans=3
print(ans)
| s614129133 | Accepted | 17 | 2,940 | 111 | a,b,c=input().split()
if a!=b and b!=c and c!=a:
print(3)
elif a!=b or b!=c or c!=a:
print(2)
else:
print(1) |
s721914966 | p02288 | u207394722 | 2,000 | 131,072 | Wrong Answer | 40 | 6,556 | 1,089 | A binary heap which satisfies max-heap property is called max-heap. In a max- heap, for every node $i$ other than the root, $A Write a program which reads an array and constructs a max-heap from the array based on the following pseudo code. $maxHeapify(A, i)$ move the value of $A[i]$ down to leaves to make a sub-tr... | import pprint as pp
class Main():
def exchange(self, n1, n2):
tmp = self.A[n1]
self.A[n1] = self.A[n2]
self.A[n2] = tmp
def left(self, i):
return i * 2
def right(self, i):
return i * 2 + 1
def maxHeapify(self, i):
l = self.left(i)
r = self.righ... | s159633791 | Accepted | 1,830 | 62,628 | 1,109 | import pprint as pp
class Main():
def exchange(self, n1, n2):
tmp = self.A[n1]
self.A[n1] = self.A[n2]
self.A[n2] = tmp
def left(self, i):
return i * 2
def right(self, i):
return i * 2 + 1
def maxHeapify(self, i):
l = self.left(i)
r = self.righ... |
s712651017 | p02415 | u506705885 | 1,000 | 131,072 | Wrong Answer | 20 | 5,540 | 40 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | sentence=input()
print(sentence.upper()) | s231953290 | Accepted | 20 | 5,540 | 25 | print(input().swapcase()) |
s220845882 | p03151 | u983918956 | 2,000 | 1,048,576 | Wrong Answer | 143 | 19,560 | 381 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
if sum(A) < sum(B):
print(-1)
exit()
d = [A[i]-B[i] for i in range(N)]
print(d)
d.sort()
neg = 0
count = 0
for e in d:
if e < 0:
neg += e
count += 1
continue
break
for e in d[::-1]:
if neg ... | s306898172 | Accepted | 133 | 19,496 | 372 | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
if sum(A) < sum(B):
print(-1)
exit()
d = [A[i]-B[i] for i in range(N)]
d.sort()
neg = 0
count = 0
for e in d:
if e < 0:
neg += e
count += 1
continue
break
for e in d[::-1]:
if neg >= 0:
... |
s936829087 | p03378 | u264508862 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 123 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | n,m,x=map(int,input().split())
a=map(int,input().split())
print(min(len([i for i in a if x<i]),len([i for i in a if x>i]))) | s269386909 | Accepted | 17 | 3,060 | 155 | n,m,x=map(int,input().split())
a=map(int,input().split())
b,c=[],[]
for i in a:
if i>x:
b.append(i)
else:
c.append(i)
print(min(len(b),len(c))) |
s615081023 | p03997 | u196182810 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 150 | 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. | string_list = [input() for i in range(3)]
a = int(string_list[0])
b = int(string_list[1])
h = int(string_list[2])
answer = (a+b)*h/2
print(answer)
| s483182828 | Accepted | 17 | 2,940 | 151 | string_list = [input() for i in range(3)]
a = int(string_list[0])
b = int(string_list[1])
h = int(string_list[2])
answer = (a+b)*h//2
print(answer)
|
s980523028 | p02390 | u980683323 | 1,000 | 131,072 | Wrong Answer | 20 | 7,472 | 75 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | S=int(input())
s=S%60
S/=60
m=S%60
h=S/60
print("{}:{}:{}".format(h, m, s)) | s118707084 | Accepted | 50 | 7,660 | 66 | S=int(input())
print("{}:{}:{}".format(S//3600, (S//60)%60, S%60)) |
s467125239 | p02659 | u776134564 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,092 | 74 | Compute A \times B, truncate its fractional part, and print the result as an integer. | import math
a,b=map(float,input().split())
z=int(math.ceil(a*b))
print(z)
| s381622738 | Accepted | 25 | 9,104 | 92 | import math
x,y=input().split()
a=int(x)
y=y.replace('.','')
b=int(y)
z=(a*b)//100
print(z)
|
s456881686 | p03067 | u849433300 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 83 | 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 abs(a-b)> c:
print("yes")
else:
print("no") | s373096137 | Accepted | 17 | 2,940 | 112 | a,b,c=map(int, input().split())
if a > c > b:
print("Yes")
elif a < c < b:
print("Yes")
else:
print("No") |
s702720517 | p03548 | u244836567 | 2,000 | 262,144 | Wrong Answer | 31 | 9,092 | 64 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
print((a-c)//b) | s401432463 | Accepted | 29 | 9,032 | 68 | a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
print((a-c)//(b+c)) |
s002229161 | p03457 | u572122511 | 2,000 | 262,144 | Wrong Answer | 373 | 3,060 | 183 | 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())
can = True
for i in range(N):
t, x, y = list(map(int, input().split()))
if not t%2 == (x+y)%2 or (x+y) > t:
can = False
break
print(can) | s543964714 | Accepted | 370 | 3,060 | 231 | N = int(input())
can = True
for i in range(N):
t, x, y = list(map(int, input().split()))
if not t%2 == (x+y)%2 or (x+y) > t:
can = False
break
if can:
s = "Yes"
else:
s = "No"
print(s) |
s926359921 | p03471 | u956836108 | 2,000 | 262,144 | Wrong Answer | 1,058 | 9,096 | 463 | 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... | # -*- coding: utf-8 -*-
n, y = map(int, input().split())
judge = "no value"
for i in range(n+1):
if judge == "Found it!":
break
for j in range(n+1):
value = i * 1000 + j * 5000 + (n - i - j) *10000
if value == y:
print(i, j, n - i - j)
judge = "Found it!"
... | s956561196 | Accepted | 1,239 | 9,184 | 308 | n, y = map(int, input().split())
for i in range(n+1):
for j in range(n+1):
z = n - i - j
value = z * 10000 + i * 5000 + j *1000
if value == y and z >= 0:
print(z, i , j)
break
else:
continue
break
else:
print(-1, -1, -1) |
s779177571 | p02601 | u589361760 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,200 | 308 | 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())
c = c * 2 ** k
i = 1
if a < b:
if b < c:
print("Yes")
else:
print("No")
else:
while i <= k:
if a < i * b and i * b < c:
print("Yes")
break
else:
b = b * 2
i += 1
if i > k:
print("No")
print(a, b, c, i) | s158651788 | Accepted | 26 | 9,192 | 302 | a, b, c = map(int, input().split())
k = int(input())
c = c * 2 ** k
i = 1
if a < b:
if b < c:
print("Yes")
else:
print("No")
else:
while i <= k:
if a < b and b < c:
print("Yes")
break
else:
b = b * 2
c = int(c / 2)
i += 1
if i > k:
print("No") |
s758087927 | p02844 | u493520238 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,188 | 452 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? ... | n = int(input())
s = input()
print(s)
cnt = 0
for s1 in range(10):
s1_ind = s.find(str(s1))
if s1_ind == -1 or s1_ind >= len(s)-2 : continue
for s2 in range(10):
s2_ind = s[s1_ind+1: ].find(str(s2)) + s1_ind + 1
if s2_ind <= s1_ind or s2_ind >= len(s)-1: continue
for s3 in range(10):... | s323596788 | Accepted | 20 | 3,064 | 443 | n = int(input())
s = input()
cnt = 0
for s1 in range(10):
s1_ind = s.find(str(s1))
if s1_ind == -1 or s1_ind >= len(s)-2 : continue
for s2 in range(10):
s2_ind = s[s1_ind+1: ].find(str(s2)) + s1_ind + 1
if s2_ind <= s1_ind or s2_ind >= len(s)-1: continue
for s3 in range(10):
... |
s187951870 | p02613 | u606374450 | 2,000 | 1,048,576 | Wrong Answer | 138 | 16,296 | 212 | 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())
A = [input() for i in range(N)]
print('AC × {}'.format(A.count('AC')))
print('WA × {}'.format(A.count('WA')))
print('TLE × {}'.format(A.count('TLE')))
print('RE × {}'.format(A.count('RE')))
| s249133975 | Accepted | 143 | 16,276 | 168 | N = int(input())
A = [input() for i in range(N)]
print('AC x', A.count('AC'))
print('WA x', A.count('WA'))
print('TLE x', A.count('TLE'))
print('RE x', A.count('RE'))
|
s892966111 | p03380 | u026155812 | 2,000 | 262,144 | Wrong Answer | 2,105 | 14,920 | 558 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | from bisect import bisect_left, bisect_right
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
lim = len(a)//2
ans = []
for i, x in enumerate(a[::-1]):
if i == lim:
break
... | s305662509 | Accepted | 127 | 14,348 | 214 | from itertools import combinations
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ai = a[-1]
aj = -1
for i in range(n-1):
if abs(a[i] - ai/2) <= abs(aj - ai/2):
aj = a[i]
print(ai, aj) |
s924981184 | p02646 | u966891144 | 2,000 | 1,048,576 | Wrong Answer | 19 | 9,184 | 224 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
kyori = abs(a - b)
sokudo = abs(v-w)
if (a > b and v < w) and (a < b and v > w) and kyori < t * sokudo:
print('YES')
else:
print('NO')
| s149406778 | Accepted | 24 | 9,168 | 172 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
kyori = abs(a - b)
sokudo = v-w
if kyori<=t*sokudo:
print('YES')
else:
print('NO')
|
s567408826 | p03140 | u021548497 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,096 | 101 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | n=open(0).read()
p=int(n[0])
ans=0
for i in range(p):
ans+=len({n[i],n[p+i],n[p*2+i]})-1
print(ans) | s857115692 | Accepted | 28 | 9,156 | 215 | n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
if a[i] == b[i] == c[i]:
continue
if a[i] == b[i] or b[i] == c[i] or c[i] == a[i]:
ans += 1
else:
ans += 2
print(ans) |
s127031473 | p02261 | u603049633 | 1,000 | 131,072 | Wrong Answer | 20 | 7,592 | 716 | 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())
A1 = list(map(str,input().split()))
A2 = A1[:]
def bubbleSort(A, N):
flag = 0
i = 0
while flag == 0:
flag = 1
for j in range(N-1, i, -1):
if A[j][1] < A[j-1][1]:
A[j], A[j-1] = A[j-1], A[j]
flag = 0
i += 1
return A
def selectSort(A, N):
for i in range(N):
minj = i
for j in r... | s119974412 | Accepted | 30 | 7,764 | 716 | N = int(input())
A1 = list(map(str,input().split()))
A2 = A1[:]
def bubbleSort(A, N):
flag = 0
i = 0
while flag == 0:
flag = 1
for j in range(N-1, i, -1):
if A[j][1] < A[j-1][1]:
A[j], A[j-1] = A[j-1], A[j]
flag = 0
i += 1
return A
def selectSort(A, N):
for i in range(N):
minj = i
for j in r... |
s736295679 | p03385 | u456879806 | 2,000 | 262,144 | Wrong Answer | 30 | 8,972 | 66 | 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 = input()
if S == "abc":
print("Yes")
else:
print("No") | s769224022 | Accepted | 27 | 9,080 | 90 | S = list(input())
S.sort()
if S == ['a', 'b', 'c']:
print("Yes")
else:
print("No") |
s155438649 | p03469 | u727067903 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | 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... | str = input()
ans = '2018'+str[4:7]
print(ans) | s622488496 | Accepted | 18 | 3,064 | 47 | str = input()
ans = '2018'+str[4:10]
print(ans) |
s776016752 | p02613 | u511824539 | 2,000 | 1,048,576 | Wrong Answer | 144 | 9,116 | 209 | 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())
n_apperances = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for i in range(n):
s = input()
n_apperances[s] += 1
for key in n_apperances:
print('{} × {}'.format(key, n_apperances[key]))
| s890766293 | Accepted | 148 | 9,060 | 208 | n = int(input())
n_apperances = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for i in range(n):
s = input()
n_apperances[s] += 1
for key in n_apperances:
print('{} x {}'.format(key, n_apperances[key]))
|
s851672607 | p03450 | u189023301 | 2,000 | 262,144 | Wrong Answer | 1,048 | 76,596 | 780 | There are N people standing on the x-axis. Let the coordinate of Person i be x_i. For every i, x_i is an integer between 0 and 10^9 (inclusive). It is possible that more than one person is standing at the same coordinate. You will given M pieces of information regarding the positions of these people. The i-th piece of... | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(n + 1)]
q = deque([])
visited = set()
dist = [None] * (n + 1)
for i in range(m):
a, b, k = map(int, input().split())
g[a].append((b, k))
g[b].append((a, -k))
def dfs(u):
q.append(u)
while q:
v = q.pop()
... | s585034809 | Accepted | 1,058 | 76,512 | 752 | from collections import deque
n, m = map(int, input().split())
g = [[] for _ in range(n + 1)]
q = deque([])
visited = set()
dist = [None] * (n + 1)
for i in range(m):
a, b, k = map(int, input().split())
g[a].append((b, k))
g[b].append((a, -k))
def dfs(u):
q.append(u)
while q:
v = q.pop()
... |
s269757353 | p02534 | u883983516 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,072 | 18 | You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`. | "ACL"*int(input()) | s946404346 | Accepted | 24 | 9,108 | 25 | print("ACL"*int(input())) |
s473344107 | p03700 | u203900263 | 2,000 | 262,144 | Wrong Answer | 2,109 | 55,704 | 506 | You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called _health_ , and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below. Fortunately, you are a skilled magician, capable of causing e... | import math
import numpy as np
N, A, B = map(int, input().split())
h = []
for i in range(N):
h.append(int(input()))
def enough(T):
h2 = list(map(lambda x: x - B * T, h))
print(h2)
return sum(map(lambda x: max(0, math.ceil(x / (A - B))), h2)) <= T
def solver(mi, ma):
print(mi, ma)
mid = (m... | s936016396 | Accepted | 1,939 | 11,036 | 457 | import math
N, A, B = map(int, input().split())
h = []
for i in range(N):
h.append(int(input()))
def enough(T):
h2 = list(map(lambda x: x - B * T, h))
return sum(map(lambda x: max(0, math.ceil(x / (A - B))), h2)) <= T
def solver(inf, sup):
mid = (inf + sup) // 2
if inf == sup:
return mi... |
s791280556 | p03577 | u331464808 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 24 | Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | s= input()
print(s[:-6]) | s301607721 | Accepted | 17 | 2,940 | 24 | s= input()
print(s[:-8]) |
s144068895 | p03228 | u948416555 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 190 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | a,b,k = map(int,input().split())
for i in range(k):
if i%2 == 0:
if a%2 != 0 :
a -=1
a /= 2
b += a
else :
if b%2 != 0:
b -= 1
b /= 2
a += b
print(a,b) | s914706410 | Accepted | 17 | 3,060 | 200 | a,b,k = map(int,input().split())
for i in range(k):
if i%2 == 0:
if a%2 != 0 :
a -=1
a /= 2
b += a
else :
if b%2 != 0:
b -= 1
b /= 2
a += b
print(int(a),int(b)) |
s051923285 | p02972 | u549383771 | 2,000 | 1,048,576 | Wrong Answer | 841 | 14,124 | 524 | 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... | m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
if num_list[m-i-1] == 0:
continue
elif num_list[m-i-1] == 1:
cnt = 0
for j in range(2**10):
if (j+1)*(m-i) > m:
break
else:
... | s983747796 | Accepted | 691 | 14,460 | 621 | m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
if num_list[i-1] == 0:
cnt = 0
for j in range(2,m//i+1):
cnt += ans_list[i*j-1]
if cnt % 2 == 1:
ans_list[i-1] = 1
print_list.append(i)
... |
s157946404 | p03672 | u969708690 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 191 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | import sys
S=input()
for i in range(1,len(S)):
S=S[:-1]
if len(S)%2==0:
c=len(S)
print(S[c//2+1:])
print(S[:c//2])
if S[:c//2]==S[c//2+1:]:
print(i)
sys.exit() | s919135136 | Accepted | 17 | 3,060 | 147 | import sys
S=input()
for i in range(1,len(S)):
S=S[:-1]
if len(S)%2==0:
c=len(S)
if S[:c//2]==S[c//2:]:
print(c)
sys.exit() |
s795726977 | p03679 | u160659351 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 163 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | #65
X, A, B = map(int, input().rstrip().split())
if A-B >= 0:
print("delicious")
elif X+A-B >= 0:
print("Safe")
elif X+1+A-B <= 0:
print("dangerous") | s895727231 | Accepted | 17 | 2,940 | 163 | #65
X, A, B = map(int, input().rstrip().split())
if A-B >= 0:
print("delicious")
elif X+A-B >= 0:
print("safe")
elif X+1+A-B <= 0:
print("dangerous") |
s079687132 | p03140 | u936985471 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 163 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
if len(set([a,b,c]))==3:
ans+=2
elif len(set([a,b,c]))==2:
ans+=1
print(ans)
| s160634913 | Accepted | 17 | 2,940 | 122 | n=int(input())
a=input()
b=input()
c=input()
ans=0
for i in range(n):
ans+=len(set([a[i],b[i],c[i]]))-1
print(ans)
|
s869217810 | p03971 | u703890795 | 2,000 | 262,144 | Wrong Answer | 84 | 4,016 | 191 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | N, A, B = map(int, input().split())
S = input()
for s in S:
if s == "a" and A > 0:
print("Yes")
A -= 1
elif s == "b" and B > 0:
print("Yes")
B -= 1
else:
print("No") | s706202581 | Accepted | 91 | 4,016 | 246 | N, A, B = map(int, input().split())
S = input()
for s in S:
if s == "a" and A > 0:
print("Yes")
A -= 1
elif s == "a" and B > 0:
print("Yes")
B -= 1
elif s == "b" and B > 0:
print("Yes")
B -= 1
else:
print("No") |
s917772970 | p03796 | u414877092 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 36 | 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. | import math
print(math.factorial(5)) | s417709928 | Accepted | 230 | 3,984 | 61 | import math
N=int(input())
print(math.factorial(N)%(10**9+7)) |
s878632554 | p03693 | u275861030 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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... | a, b, c = map(int, input().split())
if int(a + b + c) % 4 == 0:
print('YES')
else:
print('NO') | s211618930 | Accepted | 17 | 2,940 | 89 | a, b, c = input().split()
if int(a + b + c) % 4 == 0:
print('YES')
else:
print('NO')
|
s711297843 | p02841 | u007263493 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 102 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | a, b = map(int,input().split())
c, d = map(int,input().split())
if a == b:
print(0)
else:
print(1) | s141250007 | Accepted | 18 | 2,940 | 102 | a, b = map(int,input().split())
c, d = map(int,input().split())
if a == c:
print(0)
else:
print(1) |
s571516450 | p03759 | u060505280 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = map(int, input().split())
print('Yes' if b - a == c - a else 'No') | s417029104 | Accepted | 17 | 2,940 | 80 | a, b, c = map(int, input().split())
print('YES' if (b - a) == (c - b) else 'NO') |
s460784840 | p02409 | u256874901 | 1,000 | 131,072 | Wrong Answer | 20 | 7,640 | 359 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | #coding:utf-8
apartment = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]
N = int(input())
for i in range(N):
data = [int(x) - 1 for x in input().split()]
apartment[data[0]][data[1]][data[2]] = data[3] + 1
for x in range(4):
for y in range(3):
for z in range(10):
print(apartment[x][y][z], end=""... | s508537228 | Accepted | 20 | 7,796 | 520 | #coding:utf-8
apartment = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]
N = int(input())
data = [[int(x) - 1 for x in input().split()] for y in range(N)]
for x in data:
apartment[x[0]][x[1]][x[2]] += x[3] + 1
if apartment[x[0]][x[1]][x[2]] > 9:
apartment[x[0]][x[1]][x[2]] = 9
elif apartment[x[0]]... |
s560693745 | p03545 | u995062424 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 496 | 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... | Num = input()
op = -1
A = int(Num[0])
B = int(Num[1])
C = int(Num[2])
D = int(Num[3])
sign = [0]*3
for i in range(2):
for j in range(2):
for k in range(2):
if(A+B*op**(i+1)+C*op**(j+1)+D*op**(k+1) == 7):
sign[0] = i
sign[1] = j
sign[2] = k
... | s481942109 | Accepted | 17 | 3,188 | 467 | Num = input()
op = -1
A = int(Num[0])
B = int(Num[1])
C = int(Num[2])
D = int(Num[3])
sign = []
for i in range(2):
for j in range(2):
for k in range(2):
if(A+B*op**i+C*op**j+D*op**k == 7):
sign.append(i)
sign.append(j)
sign.append(k)
for n in ran... |
s689318354 | p03044 | u392029857 | 2,000 | 1,048,576 | Wrong Answer | 928 | 115,972 | 761 | 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... | import sys
sys.setrecursionlimit(4100000)
input = sys.stdin.readline
def main():
def Dfs(G, v, cur=0):
color[v] = cur % 2
for next_v in G[v]:
if color[next_v[0]] != -1:
continue
Dfs(G, next_v[0], cur+next_v[1])
n = int(input())
e = [[0, 0, 0]] + [lis... | s475339280 | Accepted | 806 | 113,444 | 745 | import sys
sys.setrecursionlimit(4100000)
input = sys.stdin.readline
def main():
def Dfs(G, v, cur=0):
color[v] = cur % 2
for next_v in G[v]:
if color[next_v[0]] != -1:
continue
Dfs(G, next_v[0], cur+next_v[1])
n = int(input())
e = [[0, 0, 0]] + [lis... |
s513177973 | p03792 | u271539660 | 2,000 | 262,144 | Wrong Answer | 502 | 11,380 | 1,670 | There is a square-shaped grid with N vertical rows and N horizontal columns. We will denote the square at the i-th row from the top and the j-th column from the left as (i,\ j). Initially, each square is either white or black. The initial color of the grid is given to you as characters a_{ij}, arranged in a square sha... | def paint(row,col):
#print("--> paint:",row, col)
temp = list(ar[row])
for i in range(N):
ar[i][col] = temp[i]
def paintsCompletely(row,col):
for i in range(N):
if ar[i][col] == '.' and ar[row][i] == '.':
return False
return True
N = int(input().strip())
ar = [N*[] for _ in range(N)]
for... | s111284040 | Accepted | 99 | 3,316 | 734 | N = int(input().strip())
ar = [N*[] for _ in range(N)]
for row in range(N):
ar[row] = input().strip()
fullestRows = []
maxCount = 0
for row in range(N):
count = 0
for col in range(N):
if ar[row][col] == '#':
count += 1
if count > maxCount:
maxCount = count
fullestRows = [row]
elif count == ... |
s977007354 | p03485 | u570612423 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 49 | 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())
print(-(-a+b//2)) | s360092378 | Accepted | 17 | 2,940 | 51 | a,b = map(int,input().split())
print(-(-(a+b)//2)) |
s609263456 | p03494 | u964665290 | 2,000 | 262,144 | Wrong Answer | 29 | 9,156 | 284 | 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())
li = list(map(int, input().split()))
count = 0
def calc_half(n):
return n/2
for i in range(N):
for i in li:
if i%2 == 0:
flag = True
else:
flag = False
break
if flag == True:
li = map(calc_half, li)
count += 1
print(count) | s379297718 | Accepted | 29 | 9,068 | 186 | N = int(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a/2 for a in A]
count += 1
print(count) |
s704157460 | p03196 | u519968172 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 9,336 | 258 | There are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P. Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N. | n,p=map(int,input().split())
from collections import Counter
a=[]
while p%2==0:
a.append(2)
p//=2
f=3
while f<=p:
if p%f==0:
a.append(f)
p//=f
else:
f+=2
c=Counter(a)
ans=1
print(c)
for k,v in c.items():
if v>=n:
ans*=k
print(ans) | s866555092 | Accepted | 88 | 9,436 | 297 | n,p=map(int,input().split())
from collections import Counter
a=[]
while p%2==0:
a.append(2)
p//=2
f=3
while f<=p:
if p%f==0:
a.append(f)
p//=f
elif f*f>p:
a.append(p)
break
else:
f+=2
c=Counter(a)
ans=1
for k,v in c.items():
if v>=n:
ans*=k**(v//n)
print(ans) |
s278522306 | p03739 | u489108157 | 2,000 | 262,144 | Wrong Answer | 173 | 14,468 | 837 | You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ... | n=int(input())
a=list(map(lambda x: int(x), input().split()))
a.sort()
cnt=[]
val=[]
last=-1
for i in a:
if i == last:
cnt[-1]+=1
else:
cnt.append(1)
val.append(i)
last = i
low_val=-10
low_cnt=0
mid_val=0
mid_cnt=0
ans=0
for i, v in enumerate(val):
if v>=low_val+3:
a... | s497193193 | Accepted | 140 | 14,332 | 930 | n=int(input())
a=list(map(lambda x: int(x), input().split()))
ans_plus=0
tmp=0
if a[0]<=0:
ans_plus=1-a[0]
tmp=1
else:
tmp=a[0]
plus_flag=False
for i in a[1:]:
tmp+=i
if plus_flag==True and tmp>0:
pass
elif plus_flag==True and tmp<=0:
ans_plus+=1-tmp
tmp=1
elif plus_... |
s789433118 | p03863 | u733321071 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 118 | There is a string s of length 3 or greater. No two neighboring characters in s are equal. Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first: * Remove one of the characters in s, excluding both ends. However, a character cannot... | # -*- coding: utf-8
s = input()
if (s[0] == s[-1]) ^ (len(s) % 2 == 0):
print('First')
else:
print('Second') | s878495982 | Accepted | 18 | 3,316 | 118 | # -*- coding: utf-8
s = input()
if (s[0] == s[-1]) ^ (len(s) % 2 == 0):
print('Second')
else:
print('First') |
s785668968 | p03964 | u030726788 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 195 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... | n=int(input())
t,a=map(int,input().split())
for i in range(1,n):
c,d=map(int,input().split())
e,f=c,d
times=1
while(e<t and f<a):
times+=1
e,f=c*times,d*times
t,a=e,f
print(t+a) | s627126888 | Accepted | 21 | 3,060 | 278 | n=int(input())
t,a=map(int,input().split())
for i in range(1,n):
c,d=map(int,input().split())
if(t/c>a/d):
if(t%c==0):times=t//c
else:times=t//c+1
else:
if(a%d==0):times=a//d
else:times=a//d+1
#print(times)
t,a=c*times,d*times
#print(t,a)
print(t+a)
|
s601035109 | p03455 | u607680583 | 2,000 | 262,144 | Wrong Answer | 29 | 9,156 | 96 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = [int(x) for x in input().split()]
if (a+b) % 2 == 0:
print("Even")
else:
print("Odd") | s244369196 | Accepted | 24 | 9,096 | 96 | a,b = [int(x) for x in input().split()]
if (a*b) % 2 == 0:
print("Even")
else:
print("Odd") |
s056331140 | p03637 | u595633284 | 2,000 | 262,144 | Wrong Answer | 54 | 11,096 | 572 | 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. | import sys
def main():
args = sys.stdin.readline().split()
N = int(args[0])
A = map(int, input().split())
non_factor_cnt = 0
factor_of_two_cnt = 0
factor_of_four_cnt = 0
for num in A:
remainder = num % 4
if remainder != 0:
if remainder == 2:
fac... | s798219175 | Accepted | 55 | 11,096 | 712 | import sys
def main():
args = sys.stdin.readline().split()
N = int(args[0])
A = map(int, input().split())
non_factor_cnt = 0
factor_of_two_cnt = 0
factor_of_four_cnt = 0
for num in A:
remainder = num % 4
if remainder != 0:
if remainder == 2:
fac... |
s692658944 | p02276 | u940395729 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 361 | Quick sort is based on the Divide-and-conquer approach. In QuickSort(A, p, r), first, a procedure Partition(A, p, r) divides an array A[p..r] into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q], which is, inturn, less than or equal to each element of A[q+1..r]. I... | def partition(A, p, r):
x = A[r]
i = p-1
for j in range(p, r):
if A[j] <= x:
i = i+1
tmpA = A[i]
A[i] = A[j]
A[j] = tmpA
tmpB = A[i+1]
A[i+1] = A[r]
A[r] = tmpB
return i+1
n = int(input())
A = list(map(int, input().split()))
r = len... | s855980945 | Accepted | 80 | 16,388 | 306 | def partition(A, p, r):
x = A[r]
i = p-1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i+1], A[r] = A[r], A[i+1]
A[i+1] = "[{}]".format(A[i+1])
n = int(input())
A = list(map(int, input().split()))
partition(A, 0, n-1)
print(*A)
|
s295733072 | p03636 | u696449926 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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. | chr = input()
chr_list = list(chr)
length = len(chr_list)
a, z = chr_list[0], chr_list[length - 1]
print(a, length, z, sep = '') | s316971395 | Accepted | 17 | 2,940 | 135 | chr = input()
chr_list = list(chr)
length = len(chr_list)
a, z = chr_list[0], chr_list[length - 1]
print(a, length - 2, z, sep = '') |
s187338438 | p03971 | u566968132 | 2,000 | 262,144 | Wrong Answer | 137 | 4,708 | 608 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | l=list(map(int,input().split()))
participant=list(input())
passnum=l[1]+l[2]
b=0
for i in range(l[0]):
if participant[i]=='a' and passnum>0:
participant[i]='Yes'
passnum-=1
elif passnum==0:
break
if passnum>0:
for i in range(l[0]):
if participant[i]=='b' and passnum>0 and b<l... | s398901938 | Accepted | 123 | 4,712 | 483 | l=list(map(int,input().split()))
participant=list(input())
passnum=l[1]+l[2]
b=0
for i in range(l[0]):
if participant[i]=='a' and passnum>0:
participant[i]='Yes'
passnum-=1
elif participant[i]=='b' and passnum>0 and b<l[2]:
participant[i]='Yes'
passnum-=1
b+=1... |
s285766341 | p04029 | u989851123 | 2,000 | 262,144 | Wrong Answer | 27 | 8,988 | 34 | 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? | print(sum(range(1, int(input())))) | s310404824 | Accepted | 27 | 9,072 | 36 | print(sum(range(1, int(input())+1))) |
s779126614 | p02842 | u932368968 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 155 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | IN = list(map(int, input().split()))
N = IN[0]
price = round(N/1.08)
price1 = (int)(1.08 * price)
if N == price1:
print(price1)
else:
print(":(") | s341560388 | Accepted | 31 | 2,940 | 171 | import math
N = int(input())
ans = -1
for x in range(N+1):
if math.floor(x * 1.08) == N:
ans = x
break
if ans == -1:
print(":(")
else:
print(ans) |
s030504986 | p04030 | u556161636 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 189 | 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... | arg=input()
ans=[]
for char in arg:
if char=='1' or char=='0':
ans.append(char)
print(ans)
elif char=='B':
if ans!=[]:
del ans[-1]
print(ans)
print(''.join(ans)) | s370638626 | Accepted | 17 | 2,940 | 157 | arg=input()
ans=[]
for char in arg:
if char=='1' or char=='0':
ans.append(char)
elif char=='B':
if ans!=[]:
del ans[-1]
print(''.join(ans)) |
s545932754 | p02393 | u009101629 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 76 | Write a program which reads three integers, and prints them in ascending order. | lis = [int(x) for x in input().split()]
lis.sort()
lis.reverse()
print(lis)
| s904379736 | Accepted | 20 | 5,604 | 113 | lis = [int(x) for x in input().split()]
lis.sort()
for i in range(2):
print(lis[i],end = " ")
print(lis[-1])
|
s339205553 | p03455 | u291766461 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 447 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | def is_even(int_num):
if int_num % 2 == 0:
return True
else:
return False
def main():
inputs = input("input two integers for this problem: ")
temp = inputs.split()
if len(temp) != 2:
print("input is invalid. input two integers.")
exit(1)
a, b = int(temp[0]), in... | s024228955 | Accepted | 17 | 3,060 | 368 | def is_even(int_num):
if int_num % 2 == 0:
return True
else:
return False
def main():
# start = time.time()
inputs = input().split()
a, b = int(inputs[0]), int(inputs[1])
if is_even(a * b):
print("Even")
else:
print("Odd")
# print((time.time() - start) ... |
s761822514 | p03845 | u888512581 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 162 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | N = int(input())
T = list(map(int, input().split()))
M = int(input())
for i in range(M):
P, X = map(int, input().split())
print(sum(T) - (T[P-1] - X) + X) | s010365174 | Accepted | 18 | 3,060 | 158 | N = int(input())
T = list(map(int, input().split()))
M = int(input())
for i in range(M):
P, X = map(int, input().split())
print(sum(T) - (T[P-1] - X)) |
s280559859 | p02927 | u620755587 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 239 | 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())
cnt = 0
for i in range(1, m + 1):
for j in range(1, d + 1):
if (j % 10) * (j // 10) == i and j % 10 >= 2 and j // 10 >= 2:
print(i, j, j % 10, j // 10)
cnt += 1
print(cnt) | s299374438 | Accepted | 18 | 2,940 | 198 | m, d = map(int,input().split())
cnt = 0
for i in range(1, m + 1):
for j in range(1, d + 1):
if (j % 10) * (j // 10) == i and j % 10 >= 2 and j // 10 >= 2:
cnt += 1
print(cnt) |
s082842885 | p03943 | u996307903 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | 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 = input().split()
b = max(a)
c =0
for i in a:
if int(i) < int(b):
c += int(i)
if c == int(b):
print('YES')
else:
print('NO') | s623682962 | Accepted | 17 | 2,940 | 90 | a, b, c= sorted(map(int, input().split()))
if a+b == c:
print('Yes')
else:
print('No') |
s199790053 | p02669 | u521866787 | 2,000 | 1,048,576 | Wrong Answer | 233 | 13,212 | 1,132 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | import heapq
from collections import deque
T = int(input())
for t in range(T):
N,A,B,C,D = map(int,input().split())
q = [(0,N)]
heapq.heapify(q)
seen = set()
while q:
cost, n = heapq.heappop(q)
if n in seen:
continue
seen.add(n)
if n == 0:
pri... | s625491470 | Accepted | 177 | 12,868 | 1,103 | import heapq
T = int(input())
for t in range(T):
N,A,B,C,D = map(int,input().split())
q = [(0,N)]
heapq.heapify(q)
seen = set()
while q:
cost, n = heapq.heappop(q)
if n in seen:
continue
seen.add(n)
if n == 0:
print(cost)
break
... |
s376989878 | p01416 | u509278866 | 2,000 | 131,072 | Wrong Answer | 60 | 9,044 | 3,091 | ICPC で良い成績を収めるには修行が欠かせない.うさぎは ICPC で勝ちたいので,今日も修行をすることにした. 今日の修行は,流行りのパズルをすばやく解いて,瞬発力を鍛えようというものである.今日挑戦するのは,色とりどりのタイルが並んでいてそれらを上手く消していくパズルだ 初期状態では,グリッド上のいくつかのマスにタイルが置かれている.各タイルには色がついている.プレイヤーはゲーム開始後,以下の手順で示される操作を何回も行うことができる. 1. タイルが置かれていないマスを 1 つ選択し,そのマスを叩く. 2. 叩いたマスから上に順に辿っていき,タイルが置かれているマスに至ったところでそのタイルに着目する.タイルが... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.... | s000886069 | Accepted | 90 | 11,204 | 3,132 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.... |
s045904254 | p03548 | u703890795 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | X, Y, Z = map(int, input().split())
print((X-Y)//(Y+Z)) | s056208297 | Accepted | 17 | 3,064 | 55 | X, Y, Z = map(int, input().split())
print((X-Z)//(Y+Z)) |
s018224568 | p03477 | u964665290 | 2,000 | 262,144 | Wrong Answer | 25 | 9,044 | 136 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a, b, c, d = map(int, input().split())
R = a+b
L = c+d
if R > L:
print('Right')
elif R < L:
print('Left')
else:
print('Balanced')
| s335190655 | Accepted | 26 | 9,072 | 135 | a, b, c, d = map(int, input().split())
L = a+b
R = c+d
if R > L:
print('Right')
elif R < L:
print('Left')
else:
print('Balanced') |
s075898236 | p02472 | u536089081 | 1,000 | 262,144 | Wrong Answer | 20 | 5,588 | 39 | Given two integers $A$ and $B$, compute the sum, $A + B$. | sum([int(i) for i in input().split()])
| s864019487 | Accepted | 230 | 5,936 | 46 | print(sum([int(i) for i in input().split()]))
|
s505658918 | p03378 | u284848973 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 287 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | N, M, X = map(int, input('N M X = ').split())
A = map(int, input('A_{i}(i=1,2,…,M)= ').split())
setA = set(A)
s1 = range(0, X)
s2 = range(X, N+1)
a1 = set(s1) & (setA)
a2 = set(s2) & (setA)
cost1 = len(a1)
cost2 = len(a2)
if cost1 >= cost2:
print(cost2)
else:
print(cost1) | s241981820 | Accepted | 17 | 3,064 | 254 | N, M, X = map(int, input().split())
A = map(int, input().split())
setA = set(A)
s1 = range(0, X)
s2 = range(X, N+1)
a1 = set(s1) & (setA)
a2 = set(s2) & (setA)
cost1 = len(a1)
cost2 = len(a2)
if cost1 >= cost2:
print(cost2)
else:
print(cost1) |
s236595454 | p02742 | u948233576 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 94 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H,W=list(map(int,input().split()))
c=H*W/2
if H%2==1 and W%2==1:
print(c+1)
else:
print(c) | s161556537 | Accepted | 17 | 3,060 | 131 | H,W=list(map(int,input().split()))
c=int(H*W/2)
if H==1 or W==1:
print("1")
elif H%2==1 and W%2==1:
print(c+1)
else:
print(c) |
s432496779 | p03494 | u443630646 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | 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 = input().split(' ')
print(min(int(i) for i in a)//2) | s656257950 | Accepted | 31 | 3,060 | 295 | N = int(input())
a = input().split(' ')
c = 0
def check(a):
global c
for i in a:
if int(i) % 2 == 1:
return
for i in a:
a[a.index(i)] = int(i)/2
if int(i)/2 == 1:
c += 1
return
c += 1
check(a)
check(a)
print(c) |
s745357280 | p03150 | u673101577 | 2,000 | 1,048,576 | Wrong Answer | 26 | 8,944 | 360 | 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. | # from pprint import pprint
# import math
# import collections
# n = int(input())
s = input()
# a = list(map(int, input().split(' ')))
K = 'keyence'
if K in s:
splitted = s.split(K)
if len([spl for spl in splitted if len(spl) > 0]) > 1:
print('NO')
else:
print('YES')
else:
print('NO... | s922070771 | Accepted | 32 | 9,068 | 509 | # from pprint import pprint
# import math
# import collections
# n = int(input())
s = input()
# a = list(map(int, input().split(' ')))
K = 'keyence'
for i in range(len(s)):
for j in range(len(s)):
s1 = s[0:i]
s2 = s[i:i + j]
s3 = s[i + j:]
# print(s1,s2,s3)
if s1 == K o... |
s024000326 | p02388 | u564707955 | 1,000 | 131,072 | Wrong Answer | 20 | 7,648 | 74 | Write a program which calculates the cube of a given integer x. | print("????????°????????\?????????????????????>",)
print(int(input())**3) | s448605277 | Accepted | 20 | 7,576 | 22 | print(int(input())**3) |
s404091359 | p03563 | u237702300 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | i1 = int(input())
i2 = int(input())
print(int((i1+i2)/2)) | s816224297 | Accepted | 17 | 2,940 | 50 | i1 = int(input())
i2 = int(input())
print(i2*2-i1) |
s098059877 | p03377 | u802772880 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A,B,X=map(int,input().split())
if A<=X<=(A+B):
print('Yes')
else:
print('No') | s644079572 | Accepted | 17 | 2,940 | 85 | A,B,X=map(int,input().split())
if A<=X<=(A+B):
print('YES')
else:
print('NO') |
s450799493 | p02742 | u745812846 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 263 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h, w = map(int, input().split())
ans = []
if h % 2 == 0:
ans = h / 2 * w
else:
if w % 2 == 0:
h_a = h//2 + 1
ans = (h_a * 2 - 1) * w/2
else:
h_a = h // 2 + 1
ans = (h_a * 2 - 1) * (w//2) + h_a
print(ans)
| s856251145 | Accepted | 17 | 3,060 | 292 | h, w = map(int, input().split())
if h == 1 or w == 1:
ans = 1
elif h % 2 == 0:
ans = h // 2 * w
else:
if w % 2 == 0:
h_a = h//2 + 1
ans = (h_a * 2 - 1) * w//2
else:
h_a = h // 2 + 1
ans = (h_a * 2 - 1) * (w//2) + h_a
print(ans)
|
s246709130 | p02388 | u286033857 | 1,000 | 131,072 | Wrong Answer | 20 | 7,612 | 33 | Write a program which calculates the cube of a given integer x. | x = int(input("num"))
print(x**3) | s567522725 | Accepted | 30 | 7,536 | 28 | x = int(input())
print(x**3) |
s337780768 | p02402 | u725841747 | 1,000 | 131,072 | Wrong Answer | 30 | 7,648 | 105 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | n = input()
a = list(map(int,input().split(" ")))
del(a[0])
print("{0} {1}".format(min(a),max(a),sum(a))) | s077285241 | Accepted | 30 | 8,628 | 99 | n = input()
a = list(map(int,input().split(" ")))
print("{0} {1} {2}".format(min(a),max(a),sum(a))) |
s894711372 | p03567 | u525117558 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ... | S=input()
if(S in 'AC'):
print('Yes')
else:
print('No') | s155184645 | Accepted | 17 | 2,940 | 56 | S=input()
if 'AC' in S:
print('Yes')
else:
print('No') |
s719977352 | p03495 | u408375121 | 2,000 | 262,144 | Wrong Answer | 133 | 32,184 | 249 | 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()))
dic = {}
B = []
for a in A:
if a in dic:
dic[a] += 1
else:
dic[a] = 1
for v in dic.values():
B.append(v)
B.sort()
if len(B) <= K:
print(0)
else:
print(sum(B[K:])) | s631293806 | Accepted | 132 | 33,312 | 251 | N, K = map(int, input().split())
A = list(map(int, input().split()))
dic = {}
B = []
for a in A:
if a in dic:
dic[a] += 1
else:
dic[a] = 1
for v in dic.values():
B.append(v)
B.sort()
if len(B) <= K:
print(0)
else:
print(sum(B[:-K]))
|
s754838203 | p03759 | u779830746 | 2,000 | 262,144 | Wrong Answer | 28 | 9,000 | 115 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. |
a, b, c = map(int, input().split())
if b-a == c-b:
print('Yes')
else:
print('No') | s334758680 | Accepted | 28 | 9,132 | 115 |
a, b, c = map(int, input().split())
if b-a == c-b:
print('YES')
else:
print('NO') |
s544192860 | p04030 | u417014669 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | 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... | words="010B"
s=""
for word in words:
if word=="B":
s=s[:-1]
else:
s=s+word
print(s) | s035871247 | Accepted | 19 | 2,940 | 108 | words=input()
s=""
for word in words:
if word=="B":
s=s[:-1]
else:
s=s+word
print(s) |
s313181201 | p02936 | u504836877 | 2,000 | 1,048,576 | Wrong Answer | 2,116 | 143,192 | 653 | 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())
edge = [[int(e) for e in input().split()] for _ in range(N-1)]
question = [[int(q) for q in input().split()] for _ in range(Q)]
L = [[] for _ in range(N)]
for i in range(N-1):
L[edge[i][0]-1].append(edge[i][1]-1)
L[edge[i][1]-1].append(edge[i][0]-1)
qlist = [0]*N
for i in r... | s726462531 | Accepted | 1,735 | 75,340 | 511 | N,Q = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(N-1):
a,b = map(int, input().split())
E[a-1].append(b-1)
E[b-1].append(a-1)
C = [0]*N
for _ in range(Q):
p,x = map(int, input().split())
C[p-1] += x
from collections import deque
q = deque()
q.append((0, C[0]))
ans = [-1]*N
a... |
s560830797 | p03434 | u584317622 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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 = input()
a = sorted(map(int,input().split()))
print(sum(a[::2]) - sum(a[1::2])) | s504269124 | Accepted | 17 | 2,940 | 96 | N = input()
a = sorted(map(int,input().split()),reverse=True)
print(sum(a[0::2]) - sum(a[1::2])) |
s945858561 | p02927 | u338929851 | 2,000 | 1,048,576 | Wrong Answer | 25 | 3,064 | 527 | 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... | # -*- coding: utf-8 -*-
if __name__ == '__main__':
M, D = map(int, input().split())
#D10 = int(D[0])
#D1 = int(D[1])
count = 0
for m in range(1,M+1):
for d in range(1,D+1):
if d>=10:
d_ = str(d)
D10 = int(d_[0])
D1 = int(d_[1])
... | s843895387 | Accepted | 24 | 3,060 | 495 | # -*- coding: utf-8 -*-
if __name__ == '__main__':
M, D = map(int, input().split())
#D10 = int(D[0])
#D1 = int(D[1])
count = 0
for m in range(1,M+1):
for d in range(1,D+1):
if d>=10:
d_ = str(d)
D10 = int(d_[0])
D1 = int(d_[1])
... |
s935486531 | p03415 | u944209426 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | a = input()
b = input()
c = input()
print(a[0],b[1],c[2]) | s437397393 | Accepted | 17 | 2,940 | 57 | a = input()
b = input()
c = input()
print(a[0]+b[1]+c[2]) |
s126549436 | p03385 | u360515075 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print ("YES" if len(set(input())) == 3 else "NO")
| s880462605 | Accepted | 17 | 2,940 | 50 | print ("Yes" if len(set(input())) == 3 else "No")
|
s075749706 | p02742 | u608493167 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 99 | 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... | a,b = map(int,input().split())
if (a*b)%2 == 1:
print(int(a*b)/2+1)
else:
print(int(a*b)/2) | s718111863 | Accepted | 17 | 2,940 | 139 | a,b = map(int,input().split())
if a == 1 or b == 1:
print(1)
elif (a*b)%2 == 1:
print(int((a*b)/2+1))
else:
print(int((a*b)/2)) |
s466075867 | p02600 | u252016853 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,056 | 113 | 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... | x = int(input())
sum = 600
for i in range(8, 0, -1):
if x < sum:
print(i)
break
sum += 20 | s743300201 | Accepted | 29 | 8,972 | 114 | x = int(input())
sum = 600
for i in range(8, 0, -1):
if x < sum:
print(i)
break
sum += 200 |
s196724274 | p03386 | u306142032 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 159 | 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())
list = []
for i in range(k):
print(i+a)
for i in range(k):
list.append(b-i)
for x in list:
print(x)
| s412368356 | Accepted | 17 | 3,060 | 214 | a, b, k = map(int, input().split())
t = []
for i in range(k):
if i+a <= b:
t.append(i+a)
for i in range(k):
if b-i >= a:
t.append(b-i)
y = list(set(t))
for x in sorted(y):
print(x)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.