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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s329520151 | p03556 | u411278350 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | N = int(input())
N_s = (N ** (1/2)) // 1
print(N_s ** 2) | s343515257 | Accepted | 38 | 2,940 | 131 | N = int(input())
ans = 1
for i in range(1, N):
if ans <= i ** 2 <= N:
ans = i ** 2
else:
break
print(ans) |
s195794975 | p03693 | u373047809 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | 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... | print("YENOS"[max(int(input().replace(" ",""))%4,1)::2]) | s678321021 | Accepted | 17 | 2,940 | 40 | print("YNEOS"[int(input()[::2])%4>0::2]) |
s754060924 | p03777 | u329058683 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | Two deer, AtCoDeer and TopCoDeer, are playing a game called _Honest or Dishonest_. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the input. Each of them is either `H` or `D`, and carries the following information: If a=`H`, AtCo... | L=list(input().split())
if set(L)==2:
print("H")
else:
print("D") | s883220956 | Accepted | 17 | 2,940 | 60 | A,B=input().split()
if A==B:
print("H")
else:
print("D") |
s266196609 | p00049 | u821624310 | 1,000 | 131,072 | Wrong Answer | 20 | 7,328 | 345 | ある学級の生徒の出席番号と ABO 血液型を保存したデータを読み込んで、おのおのの血液型の人数を出力するプログラムを作成してください。なお、ABO 血液型には、A 型、B 型、AB 型、O 型の4種類の血液型があります。 | import sys
A = 0
B = 0
AB = 0
O = 0
for line in sys.stdin:
if line == "\n":
break
No, b_type = line.rstrip().split(",")
print(No, b_type)
if b_type == "A":
A += 1
elif b_type == "B":
B += 1
elif b_type == "AB":
AB += 1
else:
O += 1
print(A)
print(B)
pr... | s942819132 | Accepted | 20 | 7,300 | 238 | import sys
blood = {"A": 0, "B": 0, "AB": 0, "O": 0}
for line in sys.stdin:
if line == "\n":
break
no, b = line.rstrip().split(",")
blood[b] += 1
print(blood["A"])
print(blood["B"])
print(blood["AB"])
print(blood["O"]) |
s808004082 | p04043 | u506086925 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a, b, c = map(int,input().split())
sn = [a,b,c]
if sn.count(7)==1 and sn.count(5)==2:
print("Yes")
else:
print("No") | s903411580 | Accepted | 17 | 2,940 | 124 | a, b, c = map(int,input().split())
sn = [a,b,c]
if sn.count(7)==1 and sn.count(5)==2:
print("YES")
else:
print("NO") |
s707524327 | p03698 | u640603056 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 142 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | from collections import Counter
lst = list(input())
c = sorted(Counter(lst).values(), reverse=True)
if c[0]==0: print("yes")
else: print("no") | s348450953 | Accepted | 20 | 3,316 | 142 | from collections import Counter
lst = list(input())
c = sorted(Counter(lst).values(), reverse=True)
if c[0]==1: print("yes")
else: print("no") |
s676078138 | p03998 | u827141374 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 428 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | A = [x for x in input()]
B = [x for x in input()]
C = [x for x in input()]
next = 'a'
while True:
if next == 'a':
next = A.pop(0)
if len(A) == 0:
print('A')
break
elif next == 'b':
next = B.pop(0)
if len(B) == 0:
print('B')
break
... | s997759109 | Accepted | 17 | 3,064 | 428 | A = [x for x in input()]
B = [x for x in input()]
C = [x for x in input()]
next = 'a'
while True:
if next == 'a':
if len(A) == 0:
print('A')
break
next = A.pop(0)
elif next == 'b':
if len(B) == 0:
print('B')
break
next = B.pop(0)
... |
s631602602 | p03150 | u580316619 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,084 | 142 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | s=input()
ans='No'
for i in range(1,len(s)):
for j in range(i,len(s)):
if s[:i]+s[j:]=='keyence':
ans='Yes'
break
print(ans) | s209220544 | Accepted | 29 | 8,996 | 142 | s=input()
ans='NO'
for i in range(1,len(s)):
for j in range(i,len(s)):
if s[:i]+s[j:]=='keyence':
ans='YES'
break
print(ans) |
s382831582 | p03494 | u259861571 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 293 | 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 = input()
a = list(map(int, input().split()))
count = 0
odd = ""
while True:
for i, n in enumerate(a):
if n % 2 == 0:
a[i] == n / 2
count += 1
else:
odd = "finish"
break
if odd == "finish":
break
print(count)
| s177787318 | Accepted | 20 | 2,940 | 198 | n = input()
a = list(map(int, input().split()))
ans = a[0]
for i in range(int(n)):
count = 0
while(a[i] % 2 == 0):
a[i] /= 2
count += 1
ans = min(ans, count)
print(ans)
|
s684333289 | p03494 | u814986259 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 264 | 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()))
flag = True
ans = 0
while(1):
for i in range(N):
if A[i] % 2 != 0:
flag = False
break
if flag:
A = list(map(lambda x:x/2, A))
else:
break
print(ans)
| s997863089 | Accepted | 19 | 3,060 | 281 | N = int(input())
A = list(map(int, input().split()))
flag = True
ans = 0
while(1):
for i in range(N):
if A[i] % 2 != 0:
flag = False
break
if flag:
A = list(map(lambda x:x/2, A))
ans += 1
else:
break
print(ans)
|
s920746617 | p02259 | u821624310 | 1,000 | 131,072 | Wrong Answer | 20 | 7,580 | 219 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | N = int(input())
A = list(map(int, input().split()))
n = N
while n > 0:
for i in range(N-1, 0, -1):
if A[i] < A[i-1]:
t = A[i]
A[i] = A[i-1]
A[i-1] = t
n -= 1
print(A) | s644846010 | Accepted | 20 | 7,732 | 370 | N = int(input())
A = [int(n) for n in input().split()]
flg = 1
cnt = 0
while flg:
flg = 0
for i in range(N-1, 0, -1):
if A[i] < A[i-1]:
t = A[i]
A[i] = A[i-1]
A[i-1] = t
flg = 1
cnt += 1
for i in range(N):
if i == N - 1:
print(A[i])... |
s156860191 | p03737 | u027675217 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | a,b,c = input().split()
print(a[0]+b[0]+c[0])
| s518881801 | Accepted | 17 | 2,940 | 109 | a,b,c = input().split()
a_d=a.capitalize()
b_d=b.capitalize()
c_d=c.capitalize()
print(a_d[0]+b_d[0]+c_d[0])
|
s760909041 | p03067 | u366269356 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 98 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c = map(int,input().split())
if a < c < b or b < c < a:
print('yes')
else:
print('no') | s796402402 | Accepted | 17 | 2,940 | 133 | A,B,C = map(int, input().split())
if A < C and C < B:
print('Yes')
elif A > C and C > B:
print('Yes')
else:
print('No') |
s521190140 | p03598 | u773865844 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 245 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | import sys
lines = sys.stdin.readlines()
N = int(lines[0])
K = int(lines[1])
X = lines[2].split(' ')
x =[]
y = 0
for i in range(N):
x.append(int(X[i]))
if 2*x[i] >= K:
dist = K-x[i]
else:
dist = x[i]
y = y + dist
print(y) | s144140647 | Accepted | 18 | 3,064 | 251 | import sys
lines = sys.stdin.readlines()
N = int(lines[0])
K = int(lines[1])
X = lines[2].split(' ')
x =[]
y = 0
for i in range(N):
x.append(int(X[i]))
if 2*x[i] >= K:
dist = 2*(K-x[i])
else:
dist = 2*x[i]
y = y + dist
print(y) |
s744068991 | p03698 | u509739538 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 2,587 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | import math
from collections import deque
from collections import defaultdict
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
def factorization(n):
res = []
if n%2==0:
res.append(2)
for i in range... | s416648989 | Accepted | 23 | 3,444 | 2,587 | import math
from collections import deque
from collections import defaultdict
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
def factorization(n):
res = []
if n%2==0:
res.append(2)
for i in range... |
s558048428 | p02270 | u022407960 | 1,000 | 131,072 | Wrong Answer | 20 | 7,720 | 1,428 | In the first line, two integers $n$ and $k$ are given separated by a space character. In the following $n$ lines, $w_i$ are given respectively. | # encoding: utf-8
import sys
import math
class Solution:
def __init__(self):
"""
init input array
"""
self.__input = sys.stdin.readlines()
@property
def solution(self):
product_num = int(self.__input[0].split()[0])
truck_num = int(self.__input[0].split()[... | s603226808 | Accepted | 260 | 18,596 | 1,376 | # encoding: utf-8
import sys
class Solution:
def __init__(self):
"""
init input array
"""
self.__input = sys.stdin.readlines()
@property
def solution(self):
product_num = int(self.__input[0].split()[0])
truck_num = int(self.__input[0].split()[1])
... |
s778898068 | p03680 | u494748969 | 2,000 | 262,144 | Wrong Answer | 162 | 13,460 | 219 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | n = int(input())
a = [0] * n
for i in range(n):
a.append(int(input()))
count = 0
num = 0
for i in range(n):
num = a[num]
count += 1
if num == 2:
break
if num != 2:
count = -1
print(count)
| s295551036 | Accepted | 165 | 13,044 | 217 | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
count = 0
num = 1
for i in range(n):
num = a[num - 1]
count += 1
if num == 2:
break
if num != 2:
count = -1
print(count) |
s590375864 | p03795 | u353919145 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 261 | 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())
can=n*800
p=n
des=200
if n>=15 and n<30:
total=can-200
elif n>=30 and n<45:
total=can-400
elif n>=45 and n<60:
total=can-600
elif n>=60 and n<75:
total=can-800
elif n>=75 and n<90:
total=can-1000
elif n>=90 and n<=100:
total=can-1200
| s811025024 | Accepted | 23 | 9,016 | 186 | from sys import stdin, stdout
def main() -> None:
line = int(stdin.readline())
x = line * 800
tmp = line / 15
y = int(tmp) * 200
rta = x - y
print(rta)
main() |
s816128702 | p00014 | u032662562 | 1,000 | 131,072 | Wrong Answer | 30 | 7,580 | 315 | Write a program which computes the area of a shape represented by the following three lines: $y = x^2$ $y = 0$ $x = 600$ It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can obtain an approximative area of the shape by adding up areas of many... | def integral(d):
print("d=%d" % d)
n = 600//d
print("n=%d" % n)
s = 0.0
for i in range(n):
s += (d*i)**2
return(s*d)
if __name__ == '__main__':
while True:
try:
d = int(input())
print(int(integral(d)))
except:
break | s522806639 | Accepted | 30 | 7,656 | 266 | def integral(d):
n = 600//d
s = 0.0
for i in range(n):
s += (d*i)**2
return(s*d)
if __name__ == '__main__':
while True:
try:
d = int(input())
print(int(integral(d)))
except:
break |
s823592240 | p03550 | u843135954 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 275 | We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,z,w = na()
a = na()
print(max(abs(a[-1]-w),abs(z-w))) | s460286295 | Accepted | 20 | 3,188 | 330 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,z,w = na()
a = na()
if n == 1:
print(abs(a[-1]-w))
exit()
print(max(abs(a[-1]-w),abs(a[-2... |
s733682162 | p02669 | u194472175 | 2,000 | 1,048,576 | Wrong Answer | 194 | 12,552 | 1,150 | 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 sys
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 ... | s680384983 | Accepted | 174 | 12,816 | 998 | import sys
import heapq
T = int(input())
from collections import deque
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
he... |
s498478248 | p03352 | u049354454 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 3,064 | 453 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | # coding: utf-8
# Your code here!
INPUT=int(input())
b=1
p=2
END=0
while True:
while True:
now_num = b**p
if b == 1:
end_num=now_num
break
elif p==2 and INPUT<now_num:
END = 1
break
elif INPUT < now_num:
end_num = b**(p-1)
... | s972279505 | Accepted | 18 | 3,060 | 314 | from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1
for b in range(1,sqrt_X + 1):
for p in range(2,sqrt_X+1):
now_num = b**p
if now_num <= X and ans <= now_num:
ans =now_num
print(ans) |
s321071283 | p02972 | u672220554 | 2,000 | 1,048,576 | Wrong Answer | 875 | 16,820 | 477 | 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... | n = int(input())
a = list(map(int,input().split()))
res = [0 for i in range(n)]
for i in range(n,n//2,-1):
res[i-1] = a[i-1]
for i in range(n//2,0,-1):
l = []
flag = 0
t = i*2
while t <= n:
flag = flag ^ res[t-1]
t = t+i
if a[i-1] != flag:
res[i-1] = 1
if res == [0 for ... | s518409560 | Accepted | 450 | 17,212 | 422 | def main():
n = int(input())
a = list(map(int,input().split()))
res = [0 for i in range(n)]
lres = []
for i in range(n,0,-1):
flag = 0
t = i*2
while t <= n:
flag = flag ^ res[t-1]
t = t+i
if a[i-1] != flag:
res[i-1] = 1
... |
s870342598 | p03545 | u876616721 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 579 | 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... | x = input()
#print(x)
y = [int(c) for c in x]
#print(y)
a = y[0]
b = y[1]
c = y[2]
d = y[3]
if a+b+c+d == 7:
print("a+b+c+d=",a+b+c+d,sep='')
exit()
if a+b+c-d == 7:
print("a+b+c-d=",a+b+c-d,sep='')
exit()
if a+b-c+d == 7:
print("a+b-c+d=",a+b-c+d,sep='')
exit()
if a-b+c+d == 7:
print("a-b+c+d=",a-b+c+d,s... | s424105742 | Accepted | 17 | 3,064 | 691 | x = input()
#print(x)
y = [int(c) for c in x]
#print(y)
a = y[0]
b = y[1]
c = y[2]
d = y[3]
if a+b+c+d == 7:
print(a,"+",b,"+",c,"+",d,"=",a+b+c+d, sep='')
exit()
if a+b+c-d == 7:
print(a,"+",b,"+",c,"-",d,"=",a+b+c-d, sep='')
exit()
if a+b-c+d == 7:
print(a,"+",b,"-",c,"+",d,"=",a+b-c+d, sep='')
exit()
if ... |
s872629750 | p03495 | u268516119 | 2,000 | 262,144 | Wrong Answer | 190 | 39,292 | 239 | 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. | from collections import Counter as ct
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
count=ct(A)
div=len(count)
if div<=K:print(0)
else:print(sum([i[0] for i in sorted(count.items(),key= lambda x:x[1])[:div-K]]))
| s900188916 | Accepted | 188 | 39,288 | 239 | from collections import Counter as ct
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
count=ct(A)
div=len(count)
if div<=K:print(0)
else:print(sum([i[1] for i in sorted(count.items(),key= lambda x:x[1])[:div-K]]))
|
s687409363 | p03386 | u614181788 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 177 | 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())
aa = list(range(a,min(a+k,b)))
bb = list(range(max(b-k+1,a),b+1))
aa.extend(bb)
c = set(aa)
d = list(c)
for i in range(len(d)):
print(d[i]) | s530129514 | Accepted | 17 | 3,064 | 191 | a,b,k = map(int,input().split())
aa = list(range(a,min(a+k,b)))
bb = list(range(max(b-k+1,a),b+1))
aa.extend(bb)
c = set(aa)
d = list(c)
d = sorted(d)
for i in range(len(d)):
print(d[i]) |
s550431972 | p03025 | u201234972 | 2,000 | 1,048,576 | Wrong Answer | 299 | 18,804 | 644 | Takahashi and Aoki will play a game. They will repeatedly play it until one of them have N wins in total. When they play the game once, Takahashi wins with probability A %, Aoki wins with probability B %, and the game ends in a draw (that is, nobody wins) with probability C %. Find the expected number of games that wi... | def getInv(N):
inv = [0] * (N + 1)
inv[0] = 1
inv[1] = 1
for i in range(2, N + 1):
inv[i] = (-(Q // i) * inv[Q%i]) % Q
return inv
Q = 10**9+7
N, A, B, C = map( int, input().split())
modinv = getInv( max(2*N-1, 100))
a = A*modinv[100]%Q
b = B*modinv[100]%Q
Powa = [1]*(N+1)
Powb = [1]*(N+1)
f... | s044024904 | Accepted | 296 | 18,804 | 644 | def getInv(N):
inv = [0] * (N + 1)
inv[0] = 1
inv[1] = 1
for i in range(2, N + 1):
inv[i] = (-(Q // i) * inv[Q%i]) % Q
return inv
Q = 10**9+7
N, A, B, C = map( int, input().split())
modinv = getInv( max(2*N-1, 100))
a = A*modinv[A+B]%Q
b = B*modinv[A+B]%Q
Powa = [1]*(N+1)
Powb = [1]*(N+1)
f... |
s241955345 | p03861 | u368882459 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | 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 = map(int, input().split())
print(b//x-a//x) | s589895380 | Accepted | 17 | 2,940 | 56 | a, b, x = map(int, input().split())
print(b//x-(a-1)//x) |
s262190493 | p04011 | u209619667 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 150 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
s = 0
for n in range(N):
if n <= K:
s = s + X
else:
s = s + Y
print(s) | s676883791 | Accepted | 19 | 2,940 | 154 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
s = 0
for n in range(1,N+1):
if n <= K:
s = s + X
else:
s = s + Y
print(s) |
s682862262 | p03359 | u993461026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a, b = map(int, input().rstrip().split())
print(a if a < b else a-1) | s175613052 | Accepted | 17 | 2,940 | 69 | a, b = map(int, input().rstrip().split())
print(a if a <= b else a-1) |
s829483684 | p03657 | u373593739 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | def biscoitos():
A = input()
B = input()
soma = int(A)+int(B)
if soma%3 == 0:
print('Possible')
else:
print('Impossible') | s824039851 | Accepted | 17 | 3,060 | 185 | A, B = map(int,input().split())
soma = A+B
if A%3 == 0:
print('Possible')
elif B%3 == 0:
print ('Possible')
elif soma%3 == 0:
print('Possible')
else:
print('Impossible') |
s594939669 | p00001 | u422087503 | 1,000 | 131,072 | Wrong Answer | 30 | 7,376 | 98 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | h = []
for i in range(10):
h.append(input())
h.sort(reverse=True)
for i in range(3):
print(h[i]) | s927324921 | Accepted | 20 | 7,684 | 103 | h = []
for i in range(10):
h.append(int(input()))
h.sort(reverse=True)
for i in range(3):
print(h[i]) |
s864520673 | p03860 | u782654209 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 30 | 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'+str(input())[0]+'C') | s410490992 | Accepted | 17 | 2,940 | 54 | print('A'+list(map(str,input().split(' ')))[1][0]+'C') |
s668315648 | p03644 | u819208902 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 100 | 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... | if __name__ == '__main__':
n = int()
i = 1
while i * 2 < n:
i *= 2
print(i)
| s995517123 | Accepted | 18 | 3,064 | 108 | if __name__ == '__main__':
n = int(input())
i = 1
while i * 2 <= n:
i *= 2
print(i)
|
s453040796 | p03719 | u797550216 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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 and c <= b:
print('Yes')
else:
print('No') | s590340481 | Accepted | 17 | 2,940 | 95 | a,b,c = map(int,input().split())
if c >= a and c <= b:
print('Yes')
else:
print('No') |
s199403725 | p03407 | u969190727 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c=map(int,input().split())
print("Yes" if a+b<=c else "No") | s067086011 | Accepted | 17 | 2,940 | 63 | a,b,c=map(int,input().split())
print("Yes" if a+b>=c else "No") |
s898998826 | p02608 | u664652017 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,132 | 410 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | def fx(n):
cnt = 0
for i in range(1,10000):
if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
for j in range(1, 10000):
if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
for k in range(1, 10000):
formula = (i+j+k)**2 - i*j - j*k - k*i
if formula == n:
cnt+=1
if formula >= n... | s382780078 | Accepted | 223 | 9,208 | 495 | def fx(n):
s = [0]*(n+1)
for i in range(1,10000):
if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
for j in range(1, 10000):
if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
for k in range(1, 10000):
if (1+1+k)**2 - 1*1 - 1*k - k*1 > n: break
formula = (i+j+k)**2 - i*j - j*k - k*i
i... |
s570396831 | p03698 | u969211566 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
n = len(s)
l = set(s)
m = len(l)
if n == m:
print("Yes")
else:
print("No") | s678590240 | Accepted | 17 | 2,940 | 92 | s = input()
n = len(s)
l = set(s)
m = len(l)
if n == m:
print("yes")
else:
print("no") |
s249648802 | p02261 | u357267874 | 1,000 | 131,072 | Wrong Answer | 30 | 6,352 | 1,968 | 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... | import copy
class Card:
def __init__(self, suit, number):
self.suit = suit
self.number = number
self.view = self.suit + str(self.number)
def bubble_sort(A):
count = 0
while True:
swapped = False
for i in range(len(A)-1):
if A[i+1].number < A[i].number:
... | s325942064 | Accepted | 90 | 6,360 | 1,968 | import copy
class Card:
def __init__(self, suit, number):
self.suit = suit
self.number = number
self.view = self.suit + str(self.number)
def bubble_sort(A):
count = 0
while True:
swapped = False
for i in range(len(A)-1):
if A[i+1].number < A[i].number:
... |
s695027765 | p04031 | u870297120 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 197 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | N = int(input())
nums = list(map(int, input().split(' ')))
tmp = 0
max = 10**100
for i in nums:
for j in nums:
tmp += (j-i)**2
if max > tmp:
max = tmp
tmp = 0
print(max) | s125379835 | Accepted | 25 | 3,060 | 200 | N = int(input())
nums = list(map(int, input().split(' ')))
temp = 0
cost = []
for i in range(-100, 101):
for j in nums:
temp += (j-i)**2
cost.append(temp)
temp = 0
print(min(cost)) |
s695840682 | p02866 | u038854253 | 2,000 | 1,048,576 | Wrong Answer | 85 | 14,036 | 457 | Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition: * For every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i. | divider = 998244353
num = int(input())
depths = [int(x) for x in input().split()]
max_depth = max(depths)
if depths[0] != 0:
print(0)
exit(0)
if max_depth == 0:
print(0)
exit(0)
nodes = [0] * (max_depth+1)
for depth in depths:
nodes[depth] += 1
if nodes[0] != 1 or min(nodes) == 0:
print(0)
exit(0)
... | s404585390 | Accepted | 100 | 13,892 | 450 |
divider = 998244353
num = int(input())
depths = [int(x) for x in input().split()]
max_depth = max(depths)
if depths[0] != 0:
print(0)
exit(0)
if max_depth == 0:
print(0)
exit(0)
nodes = [0] * (max_depth+1)
for depth in depths:
nodes[depth] += 1
if nodes[0] != 1 or min(nodes) == 0:
print(0)
exit(0)
... |
s105466560 | p03433 | u545334404 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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())
n_1 = n % 500
if a >= n_1:
print("YES")
else:
print("NO")
| s179056024 | Accepted | 17 | 2,940 | 84 | N=int(input())
A=int(input())
if N % 500 <= A:
print("Yes")
else:
print("No")
|
s151204364 | p03386 | u609814378 | 2,000 | 262,144 | Wrong Answer | 2,151 | 794,648 | 236 | 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())
ans = []
ans2 = []
ans3 = []
for i in range(A,B+1):
ans.append(i)
for i in ans[0:K]:
ans2.append(i)
for j in ans[-K:]:
ans3.append(j)
ans4 = ans2 + ans3
for i in ans4:
print(ans4) | s623340452 | 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)
|
s315968122 | p03853 | u088974156 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 78 | 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())
for i in range(h):
s=input()
print(s+"¥n"+s) | s777706953 | Accepted | 18 | 3,060 | 77 | h,w=map(int,input().split())
for i in range(h):
s=input()
print(s+"\n"+s) |
s203747109 | p03024 | u384261199 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 160 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | S = input()
o_, x_ = 0, 0
for s in S:
if s == "o":
o_ += 1
else:
x_ += 1
if o_ > (15-len(S)) + 7:
print("YES")
else:
print("NO") | s121077881 | Accepted | 17 | 2,940 | 160 | S = input()
o_, x_ = 0, 0
for s in S:
if s == "o":
o_ += 1
else:
x_ += 1
if o_ > 7 - (15-len(S)):
print("YES")
else:
print("NO") |
s322221495 | p03556 | u555356625 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 29 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | print(int(int(input())**0.5)) | s189238064 | Accepted | 17 | 3,060 | 34 | print((int(int(input())**0.5))**2) |
s362670868 | p03448 | u278670845 | 2,000 | 262,144 | Wrong Answer | 50 | 3,064 | 434 | 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... | import sys
a = int(input())
b = int(input())
c = int(input())
n = int(input())
count = 0
if n<100:
if c > 0:
count = 1
print(count)
sys.exit()
elif n<500:
for i in range(b+1):
for j in range(c+1):
if 100*b+50*c==n:
count += 1
print(count)
sys.exit()
else:
for i in range(a+1):
f... | s829594700 | Accepted | 50 | 3,060 | 221 | import sys
a = int(input())
b = int(input())
c = int(input())
n = int(input())
count = 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==n:
count += 1
print(count) |
s300098117 | p03369 | u731665172 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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()
print(700+s.count('o')) | s503414224 | Accepted | 19 | 3,060 | 37 | s=input()
print(700+100*s.count('o')) |
s639830425 | p03400 | u623349537 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 186 | 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())
A = [0 for i in range(N)]
for i in range(N):
A[i] = int(input())
ans = X
for a in A:
ans += ((D - 1)// A[i] + 1)
print(ans) | s629999605 | Accepted | 18 | 3,060 | 183 | N = int(input())
D, X = map(int, input().split())
A = [0 for i in range(N)]
for i in range(N):
A[i] = int(input())
ans = X
for a in A:
ans += ((D - 1)// a + 1)
print(ans) |
s223376903 | p00016 | u747479790 | 1,000 | 131,072 | Wrong Answer | 20 | 7,912 | 218 | When a boy was cleaning up after his grand father passing, he found an old paper: In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". His grand mother says that Sanbonmatsu was standing at t... | import math as m
x,y,d=0,0,90
while True:
r,t=map(int,input().split(","))
if (r,t)==(0,0):
break
x+=r*m.cos(m.radians(d))
y+=r*m.sin(m.radians(d))
d-=t
print(int(m.sqrt(x**2+y**2)))
print(d) | s918769557 | Accepted | 20 | 7,916 | 214 | # 0016
import math as m
x,y,d=0,0,90
while True:
r,t=map(int,input().split(","))
if (r,t)==(0,0):
break
x+=r*m.cos(m.radians(d))
y+=r*m.sin(m.radians(d))
d-=t
print(int(x))
print(int(y)) |
s951355384 | p03674 | u338824669 | 2,000 | 262,144 | Wrong Answer | 2,114 | 141,816 | 751 | 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... | def cmb(n, r, p):
if (r<0) or (n<r):
return 0
r=min(r, n-r)
return fact[n]*factinv[r]*factinv[n-r]%p
p=10**9+7
N=10**6
fact=[1,1]
factinv=[1,1]
inv=[0,1]
for i in range(2, N+1):
fact.append((fact[-1]*i)%p)
inv.append((-inv[p%i]*(p//i)%p))
factinv.append((factinv[-1]*inv[-1])%p)
N=int(input())
A=list(map(int... | s017222608 | Accepted | 1,621 | 132,708 | 647 | def cmb(n, r, p):
if (r<0) or (n<r):
return 0
r=min(r, n-r)
return fact[n]*factinv[r]*factinv[n-r]%p
p=10**9+7
N=10**6
fact=[1,1]
factinv=[1,1]
inv=[0,1]
for i in range(2, N+1):
fact.append((fact[-1]*i)%p)
inv.append((-inv[p%i]*(p//i)%p))
factinv.append((factinv[-1]*inv[-1])%p)
N=int(input())
A=list(map(int... |
s471836506 | p03433 | u360038884 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
if n % 500 < a:
print('No')
else:
print('Yes') | s763935233 | Accepted | 17 | 2,940 | 86 | n = int(input())
a = int(input())
if n % 500 <= a:
print('Yes')
else:
print('No') |
s894489376 | p03599 | u106778233 | 3,000 | 262,144 | Wrong Answer | 3,309 | 27,824 | 504 | 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... | water = []
a,b,c,d,e,f = map(int, input().split())
for i in range(f//a+1):
for j in range(f//b+1):
if 0<a*i+b*j<=f:
water.append(a*i+b*j)
sugar = []
for i in range(f//c+1):
for j in range(f//d+1):
if 0<c*i+d*j<=f:
sugar.append(c*i+d*j)
ans1 =0
ans2 =0
ans3 =0
for i i... | s648111610 | Accepted | 29 | 9,136 | 347 | A, B, C, D, E, F = map(int, input().split())
ans1 = A
ans2 = 0
for i in range(A, F // 100 + 1):
if any((i - A * j) % B == 0 for j in range(i // A + 1)):
x = min(E * i, F - i * 100)
e = max([C * j + (x - C * j) // D * D for j in range(x // C + 1)])
if e * ans1 > ans2 * i:
ans1 = i
ans2 = e
prin... |
s607466588 | p04043 | u897302879 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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 ... | print("YES" if sorted(list(map(int, input().split()))) == [3, 3, 5] else "NO") | s670375142 | Accepted | 17 | 2,940 | 79 | print("YES" if sorted(list(map(int, input().split()))) == [5, 5, 7] else "NO")
|
s639828226 | p04011 | u434208140 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 94 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(k*x+y*(n-x) if n>k else n*x) | s981000940 | Accepted | 17 | 2,940 | 94 | n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(k*x+y*(n-k) if n>k else n*x) |
s260487663 | p03455 | u668924588 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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())
answer = 'Even' if a * b % 2 == 0 else 'Odd' | s270875907 | Accepted | 18 | 2,940 | 94 | a, b = map(int, input().split())
answer = 'Even' if a * b % 2 == 0 else 'Odd'
print(answer) |
s408980753 | p02603 | u682271925 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,192 | 276 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n... | n = int(input())
li = list(map(int,input().split()))
money = 1000
stock = 0
for i in range(n-1):
if stock > 0:
money += stock * li[i]
if li[i] < li[i+1]:
stock = money // li[i]
money -= stock * li[i]
if stock > 0:
money += stock * li[n-1]
print(money) | s395054083 | Accepted | 30 | 9,180 | 199 | n = int(input())
li = list(map(int,input().split()))
money = 1000
stock = 0
for i in range(n-1):
if li[i] < li[i+1]:
stock = money // li[i]
money += stock * (li[i+1]-li[i])
print(money) |
s027283359 | p03605 | u617203831 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 40 | 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("Yes" if input() in "9" else "No") | s138814003 | Accepted | 17 | 2,940 | 40 | print("Yes" if "9" in input() else "No") |
s463836014 | p03862 | u064408584 | 2,000 | 262,144 | Wrong Answer | 136 | 14,132 | 301 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | n,x=map(int, input().split())
a=list(map(int, input().split()))
count=0
for i in a:
if i>x:count+=i-x
print(count)
a=[min(x,i) for i in a]
print(a)
a2=[a[0]]
for i in range(1,n):
if a2[-1]+a[i]-x>0:
count+=a2[-1]+a[i]-x
a2.append(x-a2[-1])
else:a2.append(a[i])
print(count) | s953316893 | Accepted | 126 | 14,252 | 279 | n,x=map(int, input().split())
a=list(map(int, input().split()))
count=0
for i in a:
if i>x:count+=i-x
a=[min(x,i) for i in a]
a2=[a[0]]
for i in range(1,n):
if a2[-1]+a[i]-x>0:
count+=a2[-1]+a[i]-x
a2.append(x-a2[-1])
else:a2.append(a[i])
print(count) |
s554813227 | p02390 | u592365052 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 123 | 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())
a = S / 60 / 60
h = int(a)
b = (a - h) * 60
m = int(b)
s = (b - m) * 60
print("{}:{}:{}".format(h, m, s))
| s783102504 | Accepted | 20 | 5,584 | 95 | S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print("{}:{}:{}".format(h, m, s))
|
s195557114 | p02747 | u887199039 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | hitachi = input()
if hitachi in 'hi':
print('Yes')
else:
print('No') | s141920579 | Accepted | 17 | 2,940 | 187 | S = input()
hitachi = 'hi'
i = 1
while True:
corect = hitachi * i
if S == corect:
print('Yes')
break
i += 1
if i == 20:
print('No')
break |
s330773079 | p03593 | u238510421 | 2,000 | 262,144 | Wrong Answer | 1,783 | 21,404 | 699 | We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the top and j-th column from the left. In this matrix, each a_{ij} is a lowercase English letter. Snuke is creating another H-by-W matrix, A', by freely rearranging the elements in A. Here, he wants to satisfy the following condition: * Every ... | from collections import Counter
import numpy as np
hw = input().split()
h = int(hw[0])
w = int(hw[1])
a_all = ""
for i in range(h):
a_all += input()
count = Counter(a_all)
four_num = w//2 * h//2
two_num = w%2 * h//2 + h%2 * w//2
one_num = w%2 * h*2
nums = list(count.values())
nums_array = np.array(nums)
... | s160533536 | Accepted | 1,900 | 21,528 | 860 | from collections import Counter
import numpy as np
hw = input().split()
h = int(hw[0])
w = int(hw[1])
# print(h,w)
a_all = ""
for i in range(h):
a_all += input()
count = Counter(a_all)
four_num = (w//2) * (h//2)
two_num = (w%2) * (h//2) + (h%2) * (w//2)
one_num = (w%2) * (h%2)
# print("test:",four_num,two_... |
s409830232 | p03378 | u375616706 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 251 | 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... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, X = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in reversed(range(X)):
if i in a:
ans += 1
print(ans)
| s250641177 | Accepted | 18 | 3,060 | 253 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M, X = map(int, input().split())
a = list(map(int, input().split()))
l = [0]*(N+1)
for i in a:
l[i] += 1
print(min(sum(l[0:X]), sum(l[X+1: N+1])))
|
s778250151 | p03456 | u372670441 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
a,b=map(str,input().split())
c=int(str(a)+str(b))
A=math.sqrt(c)
if int(A)==float(A):
print("yes")
else:
print("no")
| s061237325 | Accepted | 18 | 2,940 | 137 | import math
a,b=map(str,input().split())
c=int(str(a)+str(b))
A=math.sqrt(c)
if int(A)==float(A):
print("Yes")
else:
print("No")
|
s632210175 | p02608 | u927740808 | 2,000 | 1,048,576 | Wrong Answer | 123 | 9,364 | 298 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | n = int(input())
c = [0]*10001
for x in range(1,101):
if(x > n):
break
for y in range(x,101):
for z in range(y,101):
p = int(((x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x))/2)
if(n >= p):
c[p] += 1
for i in range(1,n+1):
print(c[i])
| s526901211 | Accepted | 533 | 9,432 | 297 | n = int(input())
c = [0]*10001
for x in range(1,101):
if(x > n):
break
for y in range(1,101):
for z in range(1,101):
p = int(((x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x))/2)
if(n >= p):
c[p] += 1
for i in range(1,n+1):
print(c[i])
|
s764666349 | p03493 | u213401801 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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=list(input())
result=0
for i in s:
if i=='0':
result+=1
print(result) | s874545892 | Accepted | 17 | 2,940 | 83 | s=list(input())
result=0
for i in s:
if i=='1':
result=result+1
print(result) |
s345828750 | p03693 | u882620594 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 99 | 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=list(map(int,input().split()))
if a[1]*10 + a[2] % 4 == 0:
print("YES")
else:
print("NO") | s920758331 | Accepted | 18 | 2,940 | 101 | a=list(map(int,input().split()))
if (a[1]*10 + a[2]) % 4 == 0:
print("YES")
else:
print("NO") |
s874724040 | p03544 | u440161695 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n=int(input())
a,b=2,1
for i in range(n-1):
a,b=b,(a+b)
print(a) | s702694983 | Accepted | 17 | 2,940 | 66 | n=int(input())
a,b=2,1
for i in range(n-1):
a,b=b,(a+b)
print(b) |
s151541161 | p03860 | u788856752 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | 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... | l = list(input())
print("A" + l[0] + "C")
| s064756466 | Accepted | 17 | 2,940 | 42 | l = list(input())
print("A" + l[8] + "C")
|
s906731252 | p03472 | u062147869 | 2,000 | 262,144 | Wrong Answer | 349 | 11,316 | 506 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | from bisect import bisect_right,bisect_left
import sys
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
a,b = map(int,input().split())
A.append(a)
B.append(b)
B.sort()
ama=max(A)
x = bisect_right(B,ama)
ans = 0
if x ==N:
ans = H//ama +1
print(ans)
sys.exit()
for i in range(x,N):
... | s428486890 | Accepted | 353 | 12,084 | 446 | from bisect import bisect_right,bisect_left
import sys
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
a,b = map(int,input().split())
A.append(a)
B.append(b)
B =sorted(B,reverse=True)
ama=max(A)
ans =0
for i in range(N):
if H<=0:
print(ans)
sys.exit()
elif B[i]>=ama:... |
s428885561 | p02645 | u185806788 | 2,000 | 1,048,576 | Wrong Answer | 17 | 9,020 | 37 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | S=input()
print("S[0]"+"S[1]"+"S[2]") | s072200283 | Accepted | 23 | 9,080 | 22 | S=input()
print(S[:3]) |
s058560542 | p02396 | u313600138 | 1,000 | 131,072 | Wrong Answer | 120 | 5,592 | 63 | 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... | while True:
x=int(input())
if x==0:
break
print(x)
| s386702072 | Accepted | 160 | 5,608 | 103 | i=0
while True:
x=int(input())
i=i+1
if x == 0:
break
print('Case',' ',i,':',' ',x,sep='')
|
s838358960 | p03485 | u604655161 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 121 | 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. | def ABC_82_A():
a,b = map(int, input().split())
print(int((a+b)/2)+1)
if __name__ == '__main__':
ABC_82_A() | s506819292 | Accepted | 17 | 2,940 | 121 | def ABC_82_A():
a,b = map(int, input().split())
print(int((a+b+1)/2))
if __name__ == '__main__':
ABC_82_A() |
s252661962 | p02420 | u897625141 | 1,000 | 131,072 | Wrong Answer | 30 | 7,656 | 468 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | import re
array = []
lines = []
count = 0
while True:
n = input()
if n == "-":
break
array.append(n)
for i in range(len(array)):
if re.compile("[a-z]").search(array[i]):
if count > 0:
lines.append(stt)
count += 1
stt = array[i]
else:
stt = stt[int(... | s119935485 | Accepted | 40 | 7,848 | 530 | import re
array = []
lines = []
count = 0
while True:
n = input()
if n == "-":
break
array.append(n)
for i in range(len(array)):
if re.compile("[a-z]").search(array[i]):
fuck = i+1
if count > 0:
lines.append(stt)
count += 1
stt = array[i]
else:
... |
s136697929 | p02401 | u131984977 | 1,000 | 131,072 | Wrong Answer | 30 | 6,736 | 306 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | from sys import stdin
while True:
(a, op, b) = stdin.readline().split(' ')
a = int(a)
b = int(b)
if op == "?":
break;
elif op == "+":
print(a + b)
elif op == "-":
print(a - b)
elif op == "*":
print(a * b)
elif op == "/":
print(a / b) | s950642966 | Accepted | 40 | 7,636 | 291 | while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a + b)
if op == '-':
print(a - b)
if op == '*':
print(a * b)
if op == '/':
print(a // b)
|
s805742784 | p04043 | u137228327 | 2,000 | 262,144 | Wrong Answer | 27 | 8,948 | 233 | 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 ... | lst = list(map(int,input().split()))
#print(lst)
count5 = 0
count7 = 0
for i in range(len(lst)):
if i == 5:
count5+=1
elif i == 7:
count7+=1
if count7==1 and count5 ==2:
print('YES')
else:
print('NO')
| s755623975 | Accepted | 23 | 9,032 | 257 | # coding: utf-8
# Your code here!
lst = list(map(int,input().split()))
#print(lst)
count5 = 0
count7 = 0
for i in lst:
if i == 5:
count5+=1
elif i == 7:
count7+=1
if count7==1 and count5 ==2:
print('YES')
else:
print('NO')
|
s682472624 | p02613 | u644516473 | 2,000 | 1,048,576 | Wrong Answer | 147 | 9,476 | 200 | 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`,... | from collections import defaultdict
N = int(input())
d = defaultdict(int)
for _ in range(N):
d[input()] += 1
for k in ['AC', 'WA', 'TLE', 'RE']:
v = d[k]
if v:
print(f'{k} x {v}') | s328612577 | Accepted | 146 | 9,092 | 186 | from collections import defaultdict
N = int(input())
d = defaultdict(int)
for _ in range(N):
d[input()] += 1
for k in ['AC', 'WA', 'TLE', 'RE']:
v = d[k]
print(f'{k} x {v}') |
s968863212 | p02615 | u466143662 | 2,000 | 1,048,576 | Wrong Answer | 182 | 31,440 | 210 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
score_list = [0]
for i in range(1, len(A)):
score_list.append(A[i])
score_list.append(A[i])
print(sum(score_list[:n-1])) | s994265737 | Accepted | 174 | 31,676 | 214 | n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
score_list = [0, A[0]]
for i in range(1, len(A)):
score_list.append(A[i])
score_list.append(A[i])
print(sum(score_list[:n])) |
s254549239 | p02262 | u092047183 | 6,000 | 131,072 | Wrong Answer | 30 | 7,836 | 677 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | # coding: utf-8
import math
cnt = 0
m = 0
G = []
def insertionSort(A, n, g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
return A
def shellSor... | s728849356 | Accepted | 21,910 | 118,672 | 566 | # coding: utf-8
import math
import sys
def insertionSort(a, n, g):
ct = 0
for i in range(g, n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j - g
ct += 1
a[j+g] = v
return ct
n = int(input())
a = list(map(int, sys... |
s230526527 | p03564 | u763177133 | 2,000 | 262,144 | Wrong Answer | 24 | 9,112 | 135 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | n = int(input())
k = int(input())
num = 1
count = 0
while num < k:
num *= 2
count += 1
num + (k * (n-count))
print(num) | s223041292 | Accepted | 27 | 9,124 | 133 | n = int(input())
k = int(input())
num = 1
count = 0
while count < n:
num = min(num * 2, num + k)
count += 1
print(num) |
s942489677 | p03730 | u511457539 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A, B, C = map(int, input().split())
for i in range(1000):
if A*i%B == C:
print("Yes")
exit()
print("No")
| s701510292 | Accepted | 17 | 2,940 | 127 | A, B, C = map(int, input().split())
for i in range(1000):
if A*i%B == C:
print("YES")
exit()
print("NO")
|
s809883617 | p03493 | u404240078 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | 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. | trout = input().rstrip()
count_zero = trout.count('0') | s189779579 | Accepted | 19 | 3,060 | 134 | trout = input().rstrip().lstrip()
num_list = []
for i in range(len(trout)):
num_list.append(int(trout[i]))
print(num_list.count(1)) |
s681028613 | p03474 | u679089074 | 2,000 | 262,144 | Wrong Answer | 27 | 9,196 | 308 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | #33
import sys
A,B = map(int,input().split())
S = input()
Ans = "No"
if S[A] != "-":
print(Ans)
sys.exit()
for i in range(A):
if S[i] == "-":
print(Ans)
sys.exit()
for i in range(A+1,A+B+1):
if S[i] == "-":
print(Ans)
sys.exit()
Ans = "yes"
print(Ans)
| s977879707 | Accepted | 26 | 9,196 | 308 | #33
import sys
A,B = map(int,input().split())
S = input()
Ans = "No"
if S[A] != "-":
print(Ans)
sys.exit()
for i in range(A):
if S[i] == "-":
print(Ans)
sys.exit()
for i in range(A+1,A+B+1):
if S[i] == "-":
print(Ans)
sys.exit()
Ans = "Yes"
print(Ans)
|
s171902939 | p02743 | u190905976 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 92 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a,b,c = (int(i) for i in input().split())
if a+b < c:
print("Yes")
else:
print("No") | s719801994 | Accepted | 17 | 3,060 | 140 | a,b,c = (int(i) for i in input().split())
if c-a-b <=0:
print("No")
elif 4*a*b < (c-a-b)*(c-a-b):
print("Yes")
else:
print("No") |
s378315001 | p03555 | u266768906 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 213 | 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. | s1 = input()
s2 = input()
if(s1[0] == s2[2]):
if(s1[1] == s2[1]):
if(s1[2] == s2[0]):
print("Yes")
else:
print("No")
else:
print("No")
else:
print("No") | s866753339 | Accepted | 18 | 3,060 | 213 | s1 = input()
s2 = input()
if(s1[0] == s2[2]):
if(s1[1] == s2[1]):
if(s1[2] == s2[0]):
print("YES")
else:
print("NO")
else:
print("NO")
else:
print("NO") |
s841277879 | p03957 | u970308980 | 1,000 | 262,144 | Wrong Answer | 19 | 3,188 | 67 | This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtai... | import re
s = input()
print('Yes' if re.search('CF', s) else 'No')
| s667717692 | Accepted | 19 | 3,188 | 96 | import re
s = input()
s = re.sub(r'[^CF]', '', s)
print('Yes' if re.search(r'CF', s) else 'No')
|
s879918591 | p03155 | u749770850 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 88 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | n = int(input())
h = int(input())
w = int(input())
print((n - (w + 1)) * (n - (h + 1))) | s104306912 | Accepted | 17 | 2,940 | 84 | n = int(input())
h = int(input())
w = int(input())
print((n - w + 1) * (n - h + 1)) |
s248496634 | p03997 | u486773779 | 2,000 | 262,144 | Wrong Answer | 29 | 9,060 | 62 | 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) | s224142164 | Accepted | 27 | 8,984 | 63 | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2) |
s076505387 | p03997 | u178432859 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2) | s204123989 | Accepted | 17 | 2,940 | 72 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s450086208 | p00001 | u105694406 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 149 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. |
mountain = []
for _ in range(10):
mountain.append(int(input()))
mountain.sort()
mountain.reverse()
print(mountain[0], mountain[1], mountain[2]) | s432765575 | Accepted | 20 | 7,600 | 161 |
mountain = []
for _ in range(10):
mountain.append(int(input()))
mountain.sort()
mountain.reverse()
print(mountain[0])
print(mountain[1])
print(mountain[2]) |
s138256906 | p03385 | u207799478 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 243 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | def readints():
return list(map(int, input().split()))
s = str(input())
t = ['a', 'b', 'c']
print(sorted(s))
# print(t)
sum = 0
for i in range(3):
if s[i] == t[i]:
sum += 1
if sum == 3:
print("Yes")
else:
print("No")
| s640298636 | Accepted | 17 | 2,940 | 156 | def readints():
return list(map(int, input().split()))
s = str(input())
if 'a' in s and 'b' in s and 'c' in s:
print("Yes")
else:
print("No")
|
s866921686 | p02420 | u519227872 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 213 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | import sys
cards = ""
for line in sys.stdin:
line = line.strip()
try:
#print(line)
h = int(line)
cards = cards[h:] + cards[:h]
except:
print (cards)
cards = line | s938319454 | Accepted | 20 | 7,756 | 468 | import sys
lines = [line.strip() for line in sys.stdin]
cards = lines[0]
m = int(lines[1])
lines_index = 2
while m > 0:
line = lines[lines_index]
if line == '-':
break
h = int(line)
cards = cards[h:] + cards[:h]
m -= 1
if m == 0:
print (cards)
lines_index += 1
car... |
s989025606 | p02259 | u462831976 | 1,000 | 131,072 | Wrong Answer | 20 | 7,688 | 464 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(input())
A = list(map(int, input().split()))
def bubble_sort(A):
swap_num = 0
while True:
swapped = False
for i in range(N - 1):
if A[i] > A[i + 1]:
A[i], A[i + 1] = A[i + 1], A[i]
s... | s051966584 | Accepted | 20 | 7,812 | 464 | # -*- coding: utf-8 -*-
import sys
import os
import math
N = int(input())
A = list(map(int, input().split()))
def bubble_sort(A):
swap_num = 0
while True:
swapped = False
for i in range(N - 1):
if A[i] > A[i + 1]:
A[i], A[i + 1] = A[i + 1], A[i]
s... |
s001185682 | p03408 | u442877951 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 480 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | s = []
t = []
N = int(input())
for _ in range(N):
s.append(str(input()))
M = int(input())
for _ in range(M):
t.append(str(input()))
from collections import Counter
sc = Counter(s)
tc = Counter(t)
s_keys, s_values = zip(*sc.most_common())
t_keys, t_values = zip(*tc.most_common())
ans = 0
for i in range(len(s_values... | s384471691 | Accepted | 21 | 3,316 | 546 | s = []
t = []
N = int(input())
for _ in range(N):
s.append(str(input()))
M = int(input())
for _ in range(M):
t.append(str(input()))
from collections import Counter
sc = Counter(s)
tc = Counter(t)
s_keys, s_values = zip(*sc.most_common())
t_keys, t_values = zip(*tc.most_common())
ans = 0
for i in range(len(s_values... |
s054983326 | p03607 | u346308892 | 2,000 | 262,144 | Wrong Answer | 231 | 17,160 | 253 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | N=int(input())
a=[]
for i in range(N):
a.append(int(input()))
chk={}
for sa in a:
if sa in chk:
if chk[sa]==1:
chk[sa]=0
else:
chk[sa]=1
else:
chk[sa]=1
print(chk)
print(sum(chk.values()))
| s452350054 | Accepted | 219 | 16,272 | 244 |
N=int(input())
a=[]
for i in range(N):
a.append(int(input()))
chk={}
for sa in a:
if sa in chk:
if chk[sa]==1:
chk[sa]=0
else:
chk[sa]=1
else:
chk[sa]=1
print(sum(chk.values()))
|
s237403977 | p00071 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,656 | 341 | 縦 8、横 8 のマスからなる図1 のような平面があります。その平面上に、いくつかの爆弾が置かれています。図2 にその例を示します(● = 爆弾)。 | □| □| □| □| □| □| □| □ ---|---|---|---|---|---|---|--- □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ | □| □| ... | def e(x,y):
A[y][x]='0'
for dx,dy in[[-3,0],[-2,0],[-1,0],[1,0],[2,0],[3,0],[0,-3],[0,-2],[0,-1],[0,1],[0,2],[0,3]]:
if 0<=x+dx<8 and 0<=y+dy<8 and A[y+dy][x+dx]=='1':e(x+dx,y+dy)
for i in range(int(input())):
print(f'Data {i+1}')
input()
A=[list(input())for _ in[0]*8]
e(int(input())-1,int(input())-1)
for r i... | s579799178 | Accepted | 20 | 5,632 | 273 | def b(x,y):
A[y][x]='0'
for d in range(-3,4):
0<=x+d<8and'1'==A[y][x+d]and b(x+d,y)
0<=y+d<8and'1'==A[y+d][x]and b(x,y+d)
e=input
for i in range(int(e())):
print(f'Data {i+1}:')
e()
A=[list(e())for _ in[0]*8]
b(int(e())-1,int(e())-1)
for r in A:print(*r,sep='')
|
s006046937 | p03739 | u882370611 | 2,000 | 262,144 | Wrong Answer | 229 | 14,644 | 735 | 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(int, input().split()))
cnt_1 = 0
base = 0
for i in range(n):
if ((base + a[i] >= 0) and (i % 2 == 1)) or ((base + a[i] <= 0) and (i % 2 == 0)):
cnt_1 += (1 + abs(base + a[i]))
base += (1 + abs(base + a[i])) * (-1) ** i
else:
base += a[i]
cnt_2 = 0
base =... | s307987339 | Accepted | 233 | 14,468 | 757 | n = int(input())
a = list(map(int, input().split()))
cnt_1 = 0
base = 0
for i in range(n):
if ((base + a[i] >= 0) and (i % 2 == 1)) or ((base + a[i] <= 0) and (i % 2 == 0)):
cnt_1 += (1 + abs(base + a[i]))
base += a[i] + (1 + abs(base + a[i])) * (-1) ** i
else:
base += a[i]
cnt_2 = 0... |
s536656324 | p03433 | u587213169 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if (N-A)%500==0:
print("Yes")
else:
print("No") | s942924476 | Accepted | 18 | 2,940 | 86 | N = int(input())
A = int(input())
if N%500<=A:
print("Yes")
else:
print("No") |
s202563180 | p03385 | u505420467 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 46 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | a=list(input());print("YNeos"[len(set(a))!=3]) | s513729085 | Accepted | 17 | 2,940 | 50 | a=list(input());print("YNeos"[len(set(a))!=3::2])
|
s379857860 | p04013 | u480300350 | 2,000 | 262,144 | Wrong Answer | 62 | 5,364 | 3,387 | Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection? | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter... | s637023397 | Accepted | 71 | 5,620 | 3,394 | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.