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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s028701209 | p03564 | u667024514 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 208 | 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())
C = N*K
if K == 0:
B=0
elif K == 1 or 2:
B=1
elif K==3:
B=2
elif K== 4 or 5 or 6 or 7 or 8:
B=3
elif K==9 or 10:
B=4
p=0
i=1
while p<B:
i=i*2
p=p+1
A=N-B
print(i+A*K)
| s133924059 | Accepted | 17 | 2,940 | 100 | a = int(input())
b = int(input())
ans = 1
for i in range(a):
ans = min(ans * 2,ans + b)
print(ans) |
s676762378 | p03759 | u230717961 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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= [int(i) for i in input().split()]
if (b - a) == (c - b):
print("Yes")
else:
print("No") | s334031593 | Accepted | 17 | 2,940 | 101 | a, b, c= [int(i) for i in input().split()]
if (b - a) == (c - b):
print("YES")
else:
print("NO") |
s737269291 | p03214 | u344959959 | 2,525 | 1,048,576 | Wrong Answer | 28 | 9,224 | 142 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | a = int(input())
b = list(map(int,input().split()))
c = sum(b)/a
d = []
for i in b:
d.append(abs(i-c))
print(d)
print(d.index(min(d))) | s927966708 | Accepted | 29 | 9,124 | 129 | a = int(input())
b = list(map(int,input().split()))
c = sum(b)/a
d = []
for i in b:
d.append(abs(i-c))
print(d.index(min(d))) |
s037996101 | p02401 | u643542669 | 1,000 | 131,072 | Wrong Answer | 20 | 5,560 | 67 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | a = input()
while not "?" in a:
print(eval(a))
a = input()
| s910093536 | Accepted | 20 | 5,548 | 72 | a = input()
while not "?" in a:
print(int(eval(a)))
a = input()
|
s097533252 | p03598 | u022215787 | 2,000 | 262,144 | Wrong Answer | 27 | 9,148 | 174 | 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... | n = int(input())
k = int(input())
x_l = list(map(int, input().split()))
th = k/2
ans = 0
for x in x_l:
if x >= th:
ans += abs(x-k)
else:
ans += x
print(ans)
| s341478594 | Accepted | 30 | 9,056 | 171 | n = int(input())
k = int(input())
x_l = list(map(int, input().split()))
th = k/2
ans = 0
for x in x_l:
if x >= th:
ans += abs(x-k)
else:
ans += x
print(ans*2) |
s443809103 | p03599 | u497952650 | 3,000 | 262,144 | Wrong Answer | 25 | 3,316 | 585 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | A,B,C,D,E,F = map(int,input().split())
MAX_SUGER = E*F/(E+100)
water = [min(A,B)*100,max(A,B)*100]
for i in range(1,31):
for j in range(1,31):
water.append(100*A*i+100*B*j)
water = sorted(list(set(water)))
suger = []
for i in range(120):
for j in range(120):
if C*i + D*j <= MAX_SUGER:
... | s135512807 | Accepted | 23 | 3,188 | 626 | A,B,C,D,E,F = map(int,input().split())
MAX_SUGER = E*F/(E+100)
water = [min(A,B)*100,max(A,B)*100]
for i in range(1,31):
for j in range(1,31):
water.append(100*A*i+100*B*j)
water = sorted(list(set(water)))
suger = []
for i in range(101):
for j in range(101):
if C*i + D*j <= MAX_SUGER:
... |
s619555102 | p03352 | u611509859 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 288 | 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. | lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
t=i*i
lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
print(listt)
a=int(input())
for i in range(300):
if a <= listt[i]:
print (listt[i-1])
break | s358881964 | Accepted | 17 | 3,064 | 336 | lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
t=i*i
lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
a=int(input())
for i in range(300):
if a < listt[i]:
print (listt[i-1])
break
elif a == listt[i]:
print(listt[i... |
s114563301 | p00480 | u352394527 | 8,000 | 131,072 | Wrong Answer | 30 | 5,604 | 444 | JOI君は小学 1 年生である.JOI君は教わったばかりの足し算,引き算がとても好きで,数字が並んでいるのを見ると最後の 2 つの数字の間に「=」を入れ,残りの数字の間に必ず「+」または「-」を入れて等式を作って遊んでいる.例えば「8 3 2 4 8 7 2 4 0 8 8」から,等式「8+3-2-4+8-7-2-4-0+8=8」を作ることができる. JOI 君は等式を作った後,それが正しい等式になっているかを計算して確かめる.ただし,JOI君はまだ負の数は知らないし,20 を超える数の計算はできない.したがって,正しい等式のうち左辺を左から計算したとき計算の途中で現れる数が全て 0 以上 20 以下の等式だけがJOI君が確かめら... |
n = int(input())
A = list(map(int,input().split()))
m = A.pop()
maxN = sum(A)
dp = [[0 for i in range(maxN + 1)] for _ in A]
for i in range(len(A)):
for j in range(maxN + 1):
if i == 0:
dp[0][A[i]] = 1
else:
if j - A[i] >= 0:
dp[i][j] += dp[i - 1][j - A[i]]
if j + A[i] <= maxN:
... | s457869038 | Accepted | 20 | 5,604 | 453 |
n = int(input())
A = list(map(int,input().split()))
m = A.pop()
maxN = min(sum(A), 20)
dp = [[0 for i in range(maxN + 1)] for _ in A]
for i in range(len(A)):
for j in range(maxN + 1):
if i == 0:
dp[0][A[i]] = 1
else:
if j - A[i] >= 0:
dp[i][j] += dp[i - 1][j - A[i]]
if j + A[i] <=... |
s295923450 | p03943 | u716530146 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 418 | 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... | #!/usr/bin/env python3
# import sys, math, itertools, heapq, collections, bisect, fractions
inf = float('inf')
ans = count = 0
a,b,c=map(int,input().split())
print(0)
# if i[0]==sum(i[1:]) or sum(i[:2])==i[2]:
# print("Yes")
# exit()
# print("No")z | s830504286 | Accepted | 37 | 5,204 | 403 | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
a,b,c=map(int,input().split())
# print(0)
for i in itertools.permutations([a,b,c],3):
if i[0... |
s564372067 | p02402 | u427219397 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 265 | 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 = int(input())
ns = list(map(int, input().split()))
min0 = 1000000
max0 = -10000000
sum0 = 0
for x in ns:
min0 = min(min0, x)
max0 = max(max0, x)
sum0 += x
print(min0,max0,sum0)
| s853138733 | Accepted | 20 | 6,580 | 88 | n = int(input())
ns = list(map(int, input().split()))
print(min(ns), max(ns), sum(ns))
|
s451679120 | p02390 | u626266743 | 1,000 | 131,072 | Wrong Answer | 20 | 7,600 | 84 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | S = (int)(input())
h = S / 3600
m = S / 60
s = S % 3600
print(h,':', m, ':', s, ':') | s223173980 | Accepted | 30 | 7,700 | 86 | S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep = ':') |
s160741257 | p03671 | u697685806 | 2,000 | 262,144 | Wrong Answer | 325 | 21,524 | 82 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | import numpy as np
a,b,c = map(int,input().split())
np.sum(np.sort([a,b,c])[0:2]) | s826469874 | Accepted | 151 | 12,388 | 99 | import numpy as np
a,b,c = map(int,input().split())
ans = np.sum(np.sort([a,b,c])[0:2])
print(ans) |
s199336359 | p03477 | u637175065 | 2,000 | 262,144 | Wrong Answer | 68 | 7,368 | 739 | 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... | 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**15
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF()... | s405084110 | Accepted | 41 | 5,460 | 739 | 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**15
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF()... |
s182346850 | p03386 | u662430503 | 2,000 | 262,144 | Wrong Answer | 2,205 | 8,984 | 147 | 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. | import math
def main():
a,b,k = list(map(int,input().split()))
for i in range(a,b+1):
if (i < a+k) or(b-k+1 < i):
print(i)
main()
| s617383369 | Accepted | 29 | 9,176 | 285 | def main():
a,b,k = list(map(int,input().split()))
minlist=[]
maxlist=[]
ans=[]
for i in range(0,k):
if b-i>=a:
minlist.append(a+i)
if b-i>=a+k:
maxlist.insert(0,b-i)
ans=minlist+maxlist
set(ans)
for i in range(0,len(ans)):
print(ans[i])
main()
|
s857170094 | p03605 | u256464928 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 59 | 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? | N = input()
if "9" in N:
print("YES")
else:
print("NO") | s040238237 | Accepted | 17 | 2,940 | 46 | N = input()
print("Yes" if "9" in N else "No") |
s066652179 | p03814 | u612721349 | 2,000 | 262,144 | Wrong Answer | 18 | 3,500 | 45 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
print(s.find("A")-s.rfind("Z")+1) | s371309584 | Accepted | 18 | 3,500 | 43 | s=input();print(s.rfind("Z")-s.find("A")+1) |
s406539602 | p02694 | u400982556 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,164 | 135 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import sys
X = int(input())
A = 100
cnt = 0
while True:
A *= 1.01
A = int(A)
cnt += 1
if A > X:
print(cnt)
sys.exit() | s519953799 | Accepted | 23 | 9,184 | 136 | import sys
X = int(input())
A = 100
cnt = 0
while True:
if A >= X:
print(cnt)
sys.exit()
A *= 1.01
A = int(A)
cnt += 1 |
s402835306 | p02936 | u748241164 | 2,000 | 1,048,576 | Wrong Answer | 1,996 | 175,012 | 958 | 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... | from collections import deque
N, Q = map(int, input().split())
child = [[i] for i in range(N)]
counter = [0] * N
graph = [deque([]) for _ in range(N + 1)]
for i in range(N - 1):
a, b = map(int, input().split())
graph[a - 1].append(b - 1)
for i in range(Q):
p, x = map(int, input().split())
counter[p - 1] += ... | s555733400 | Accepted | 1,833 | 157,120 | 931 | from collections import deque
N, Q = map(int, input().split())
counter = [0] * N
graph = [deque([]) for _ in range(N + 1)]
for i in range(N - 1):
a, b = map(int, input().split())
graph[a - 1].append(b - 1)
graph[b - 1].append(a - 1)
for i in range(Q):
p, x = map(int, input().split())
counter[p - 1] += x
... |
s904148399 | p03339 | u539517139 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,700 | 62 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | n=int(input())
s=input()
print(min(s.count('W'),s.count('E'))) | s576345169 | Accepted | 180 | 15,504 | 177 | n=int(input())
s=input()
a=[0 for _ in range(n)]
a[0]=s[1:].count('E')
for i in range(1,n):
a[i]=a[i-1]
if s[i]=="E":
a[i]-=1
if s[i-1]=="W":
a[i]+=1
print(min(a)) |
s624750091 | p02393 | u244493040 | 1,000 | 131,072 | Wrong Answer | 20 | 5,532 | 31 | Write a program which reads three integers, and prints them in ascending order. | print(sorted(input().split()))
| s272053453 | Accepted | 20 | 5,540 | 32 | print(*sorted(input().split()))
|
s984033491 | p03408 | u602715823 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 266 | 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... | d = {}
n = int(input())
for _ in range(n):
e = input()
if e not in d:
d[e] = 1
else:
d[e] += 1
m = int(input())
for _ in range(m):
e = input()
if e not in d:
d[e] = -1
else:
d[e] -= 1
print(max(d, key=d.get))
| s154375091 | Accepted | 18 | 3,060 | 272 | d = {}
n = int(input())
for _ in range(n):
e = input()
if e not in d:
d[e] = 1
else:
d[e] += 1
m = int(input())
for _ in range(m):
e = input()
if e not in d:
d[e] = -1
else:
d[e] -= 1
print(max(max(d.values()), 0))
|
s265947745 | p02865 | u920204936 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 28 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
print(n//2) | s095148132 | Accepted | 17 | 2,940 | 72 | n = int(input())
if(n%2==0):
print(int(n/2-1))
else:
print(n//2) |
s395204094 | p03761 | u698771758 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 242 | Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin... | n=int(input())
S=[input() for i in range(n)]
s=set(S[0])
for i in range(1,n):
s&=set(S[i])
ans={}
for i in sorted(s):
tmp=64
for j in S:
tmp=min(tmp,j.count(i))
ans[i]=tmp
for i,j in ans.items():
print(i*j,end="")
| s971745559 | Accepted | 18 | 3,064 | 206 | n=int(input())
S=[input() for i in range(n)]
s=set(S[0])
for i in range(1,n):
s&=set(S[i])
ans=""
for i in sorted(s):
tmp=99
for j in S:
tmp=min(tmp,j.count(i))
ans+=i*tmp
print(ans) |
s197820600 | p03457 | u540761833 | 2,000 | 262,144 | Wrong Answer | 496 | 27,380 | 310 | 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())
flag = 'Yes'
txy = [[0,0,0]]
for i in range(N):
a = list(map(int,input().split()))
txy.append(a)
td = txy[i][0] - txy[i-1][0]
xd = abs(txy[i][1] - txy[i-1][1])
yd = abs(txy[i][2] - txy[i-1][2])
if (td < xd + yd) or ((td-(xd+yd))%2 == 1):
flag = 'No'
print(flag) | s403693498 | Accepted | 386 | 3,064 | 282 | N = int(input())
now = [0,0]
tnow = 0
ans = 'Yes'
for i in range(N):
t,x,y = map(int,input().split())
dis = abs(x-now[0]) + abs(y-now[1])
if t-tnow >= dis and (t-tnow)%2 == dis%2:
tnow = t
now = [x,y]
else:
ans = 'No'
break
print(ans) |
s995628778 | p02796 | u445404615 | 2,000 | 1,048,576 | Wrong Answer | 551 | 27,720 | 304 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | n = int(input())
xl =[]
for i in range(n):
x,l = map(int,input().split())
xl.append([x-l+1,x+l-1])
xl.sort(key=lambda x: x[1])
print(xl)
arm = xl[0][1]
cnt = 1
for i in range(1,n):
x,l = xl[i][0],xl[i][1]
if arm < xl[i][0]:
arm = xl[i][1]
cnt +=1
print(cnt) | s149921026 | Accepted | 455 | 21,336 | 292 | n = int(input())
xl =[]
for i in range(n):
x,l = map(int,input().split())
xl.append([x-l,x+l])
xl.sort(key=lambda x: x[1])
arm = xl[0][1]
cnt = 1
for i in range(1,n):
x,l = xl[i][0],xl[i][1]
if arm <= xl[i][0]:
arm = xl[i][1]
cnt +=1
print(cnt) |
s172864906 | p03730 | u120691615 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 278 | 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())
i = 1
ans = "No"
modlist = []
while True:
if (B * i + C) % A == 0:
ans = "Yes"
break
else:
modlist.append((B * i + C) % A)
i += 1
if len(modlist) != len(set(modlist)):
break
print(ans)
| s034515193 | Accepted | 21 | 3,316 | 171 | A,B,C = map(int,input().split())
found = False
for i in range(1,B+1):
if A * i % B == C:
found = True
if found == True:
print("YES")
else:
print("NO")
|
s236943367 | p03079 | u619785253 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 117 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | i = input().split()
if int (int(i[0]) ==int(i[1])) and (int(i[0]) ==int(i[2])):
print('YES')
else:
print('NO')
| s963192942 | Accepted | 17 | 2,940 | 118 | i = input().split()
if (float(i[0]) ==float(i[1])) and (float(i[0]) ==float(i[2])):
print('Yes')
else:
print('No') |
s848456805 | p03854 | u293579463 | 2,000 | 262,144 | Wrong Answer | 45 | 3,188 | 327 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
div = ['dream', 'dreamer', 'erase', 'eraser']
end = 0
ans = "Yes"
while end < len(S):
isExist = False
for d in div:
if d == S[len(S) - len(d) - end: len(S) - end]:
end += len(d)
isExist = True
if isExist != True:
ans = "No"
break
prin... | s177903153 | Accepted | 45 | 3,188 | 327 | S = input()
div = ['dream', 'dreamer', 'erase', 'eraser']
end = 0
ans = "YES"
while end < len(S):
isExist = False
for d in div:
if d == S[len(S) - len(d) - end: len(S) - end]:
end += len(d)
isExist = True
if isExist != True:
ans = "NO"
break
prin... |
s259173837 | p03493 | u235905557 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 55 | 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. | print (len([num for num in list(input()) if num == 1])) | s286932453 | Accepted | 18 | 2,940 | 35 | print(sum(map(int, list(input())))) |
s208332942 | p03360 | u195210605 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 183 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | nums = list(map(int, input().split(' ')))
k = input()
k = int(k)
i = 0
while i < k:
maxindex = max(enumerate(nums), key = lambda x:x[1])[0]
nums[maxindex] *= 2
print(sum(nums))
| s344414161 | Accepted | 17 | 2,940 | 201 | nums = list(map(int, input().split(' ')))
k = input()
k = int(k)
i = 0
for i in range(k):
maxindex = max(enumerate(nums), key = lambda x:x[1])[0]
nums[maxindex] *= 2
i = i + 1
print(sum(nums))
|
s408739238 | p02928 | u117348081 | 2,000 | 1,048,576 | Wrong Answer | 588 | 3,188 | 275 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | n, k = map(int, input().split())
a = list(map(int, input().split()))
sum1 = 0
sum2 = 0
for i in range(n-1):
for j in range(i+1, n):
if a[i]>a[j]:
sum1+=1
elif a[i]<a[j]:
sum2+=1
ans = sum1*k*k+(sum2-sum1)*k*(k-1)/2
print(ans%1e9+7) | s592870100 | Accepted | 1,255 | 3,316 | 373 | INF = 1000000007
n, k = map(int, input().split())
a = list(map(int, input().split()))
sum1 = 0
sum2 = 0
for i in range(n):
for j in range(n):
if i == j:
continue
if a[i]>a[j]:
if i <j:
sum1+=1
else:
sum2 +=1
ans = sum1+sum2
x =... |
s368495759 | p03997 | u732870425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print((a+b)/2*h) | s249787865 | Accepted | 17 | 2,940 | 67 | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
|
s540090119 | p02608 | u566561426 | 2,000 | 1,048,576 | Wrong Answer | 735 | 9,324 | 257 | 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 triplets_brute(n):
counter = 0
upper = round(n**0.5)
for x in range(1, upper+1):
for y in range(1, upper+1):
for z in range(1, upper+1):
if x**2+y**2+z**2+x*y+y*z+z*x==n:
counter += 1
print(triplets_brute(int(input()))) | s316888780 | Accepted | 830 | 9,444 | 278 | N = int(input())
l = [0]*N
upper = round((N-1)**0.5-1)
for x in range(1, upper+1):
for y in range(1, upper + 1):
for z in range(1, upper + 1):
tmp = x**2+y**2+z**2+x*y+y*z+z*x
if tmp < N+1:
l[tmp-1]+=1
for x in l:
print(x) |
s398044896 | p03795 | u448655578 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 69 | 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())
if N >= 15:
print(N*800-N*20)
else:
print(N*800) | s595762671 | Accepted | 18 | 2,940 | 74 | N = int(input())
if N >= 15:
print(N*800-N//15*200)
else:
print(N*800) |
s249876952 | p03377 | u061732150 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | 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:
print("No")
elif A+B>=X:
print("Yes")
else:
print("No")
| s289628903 | Accepted | 17 | 2,940 | 108 | A,B,X = map(int, input().split())
if A>X:
print("NO")
elif A+B>=X:
print("YES")
else:
print("NO")
|
s999244413 | p03729 | u019584841 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a,b,c=input().split()
if a[-1::]==b[-1::]==c[-1::]:
print("YES")
else:
print("NO") | s942198725 | Accepted | 17 | 2,940 | 93 | a,b,c=input().split()
if a[-1::]==b[0] and b[-1::]==c[0]:
print("YES")
else:
print("NO")
|
s079182379 | p02393 | u015712946 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 122 | Write a program which reads three integers, and prints them in ascending order. | a,b,c = map(int, input().split())
if b > a:
a, b = b, a
if c > b:
c, b = b, c
if b > a:
a, b = b, a
print(a, b, c)
| s761141885 | Accepted | 20 | 5,600 | 121 | a,b,c = map(int, input().split())
if a > b:
a, b = b, a
if b > c:
c, b = b, c
if a > b:
a, b = b, a
print(a, b, c)
|
s340189246 | p02796 | u794910686 | 2,000 | 1,048,576 | Wrong Answer | 533 | 27,704 | 264 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | n = int(input())
ls = []
for i in range(n):
x,l = map(int,input().split())
ls.append([x-l,l+x])
ls = sorted(ls, key=lambda x: x[1])
ans = n
print(ls)
for i in range(1,n):
if ls[i][0] < ls[i-1][1]:
ls[i][1] = ls[i-1][1]
ans -=1
print(ans) | s113612690 | Accepted | 487 | 22,100 | 254 | n = int(input())
ls = []
for i in range(n):
x,l = map(int,input().split())
ls.append([x-l,l+x])
ls = sorted(ls, key=lambda x: x[1])
ans = n
for i in range(1,n):
if ls[i][0] < ls[i-1][1]:
ls[i][1] = ls[i-1][1]
ans -=1
print(ans) |
s649388867 | p03624 | u759412327 | 2,000 | 262,144 | Wrong Answer | 51 | 4,280 | 145 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s1 = sorted(input())
s2 = "abcdefghijklmnopqrstuvwxyz"
for s in s1:
if s in s2:
pass
else:
print(s)
break
else:
print("None")
| s120543111 | Accepted | 32 | 9,000 | 107 | S = input()
for a in "abcdefghijklmnopqrstuvwxyz":
if a not in S:
print(a)
exit()
print("None") |
s183450307 | p02743 | u396210538 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 320 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | from sys import stdin
import sys
import math
# import random
a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
print(a, b, c)
d = math.sqrt(b*a)
if d < (c-a-b)/2:
print("Yes")
else:
print("No")
| s974361471 | Accepted | 29 | 3,824 | 522 | from sys import stdin
import sys
import math
import random
a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
# print(a, b, c)
# ra = math.sqrt(a)
# rb = math.sqrt(b)
# rc = math.sqrt(c)
# if ra+rb < rc:
# print("Yes")
# else:
# print("No")
# d = math.sqrt(b*a)
e=4*a*b
f=(c-a-b)**2
if c-a-b < 0:
... |
s286869559 | p03129 | u867736259 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 94 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | a,b = map(int,input().split())
a = -(-a // 2)
print(a)
print('YES') if a >= b else print('NO') | s882829336 | Accepted | 17 | 2,940 | 85 | a,b = map(int,input().split())
a = -(-a // 2)
print('YES') if a >= b else print('NO') |
s313633428 | p02613 | u835924161 | 2,000 | 1,048,576 | Wrong Answer | 152 | 9,208 | 321 | 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())
ac=int(0)
wa=int(0)
tle=int(0)
re=int(0)
for i in range(n):
s=input()
if s=="AC":
ac+=1
if s=="WA":
wa+=1
if s=="TLE":
tle+=1
if s=="RE":
re+=1
print("AC x{}".format(ac))
print("WA x{}".format(wa))
print("TLE x{}".format(tle))
print("RE x{}".format(re)... | s723983837 | Accepted | 155 | 9,228 | 325 | n=int(input())
ac=int(0)
wa=int(0)
tle=int(0)
re=int(0)
for i in range(n):
s=input()
if s=="AC":
ac+=1
if s=="WA":
wa+=1
if s=="TLE":
tle+=1
if s=="RE":
re+=1
print("AC x {}".format(ac))
print("WA x {}".format(wa))
print("TLE x {}".format(tle))
print("RE x {}".format... |
s961541065 | p03505 | u556589653 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 129 | _ButCoder Inc._ runs a programming competition site called _ButCoder_. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The initial value of a new user's rating is 0, and a user whose rating reaches K or higher is calle... | K,A,B = map(int,input().split())
if K<=A:
print(1)
else:
if A<=B:
print(-1)
else:
S = (K-A)//(A-B)
print(2*S+1) | s855601123 | Accepted | 17 | 3,060 | 143 | K, A, B = map(int, input().split())
if A >= K:
print(1)
else:
if A-B <= 0:
print(-1)
else:
S = -(-(K-A)//(A-B))
print(S*2+1) |
s273696292 | p03861 | u886790158 | 2,000 | 262,144 | Wrong Answer | 24 | 3,192 | 125 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? |
a, b, x = list(map(int, input().split()))
ans = 0
if a == 0:
ans += 1
r = b // x
l = a // x
ans += r - l
print(ans)
| s027774142 | Accepted | 23 | 3,192 | 139 |
a, b, x = list(map(int, input().split()))
ans = 0
if a == 0 or a % x == 0:
ans += 1
r = b // x
l = a // x
ans += r - l
print(ans)
|
s791773551 | p03400 | u807772568 | 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 ... | p = int(input())
data = list(map(int,input().split()))
al = data[1]
for i in range(p):
k = int(input())
if k < data[0] +1:
al += ((data[0] - 1// k))
else:
al += 1
print(al) | s642216636 | Accepted | 17 | 3,060 | 198 | p = int(input())
data = list(map(int,input().split()))
al = data[1]
for i in range(p):
k = int(input())
if k < data[0] +1:
al += ((data[0] - 1)// k + 1)
else:
al += 1
k = 0
print(al) |
s563764451 | p03024 | u661977789 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 85 | 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 = list(input())
K, L = len(S), S.count("x")
print("Yes" if 15 >= 8 + L else "No") | s556851534 | Accepted | 18 | 2,940 | 84 | S = list(input())
K, L = len(S), S.count("x")
print("YES" if -L + 15 >= 8 else "NO") |
s846700289 | p03957 | u064408584 | 1,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | 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... | s=input()
if 'CF' in s:print('Yes')
else:print('No') | s865512490 | Accepted | 17 | 2,940 | 91 | s=input()
ans='No'
if 'C' in s:
s=s[s.index('C'):]
if 'F' in s:ans='Yes'
print(ans) |
s946659136 | p02692 | u221301671 | 2,000 | 1,048,576 | Wrong Answer | 213 | 16,996 | 1,085 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | n,a,b,c = map(int, input().split())
m = {'A':a, 'B':b, 'C':c}
ss = [input() for _ in range(n)]
if a+b+c == 0:
print('No')
exit(0)
ans = []
def _t(s0, s1):
m[s0] = m[s0] + 1
m[s1] = m[s1] - 1
ans.append(s0)
if a+b+c == 1:
for k, v in m.items():
if v == 1:
o = k
ans... | s295840939 | Accepted | 224 | 17,096 | 1,074 | n,a,b,c = map(int, input().split())
m = {'A':a, 'B':b, 'C':c}
ss = [input() for _ in range(n)]
ans = []
def _t(s0, s1):
m[s0] = m[s0] + 1
m[s1] = m[s1] - 1
ans.append(s0)
if a+b+c == 0:
print('No')
exit(0)
elif a+b+c == 1:
for k, v in m.items():
if v == 1:
o = k
f... |
s706960883 | p02608 | u230621983 | 2,000 | 1,048,576 | Wrong Answer | 824 | 9,664 | 263 | 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())
rootn = int(n**0.5) +1
ans = [0] * (n+1)
for x in range(1, rootn):
for y in range(1, rootn):
for z in range(1, rootn):
cur = x**2 + y**2 + z**2 + x*y + y*z + z*x
if cur <= n:
ans[cur] += 1
print('\n'.join(map(str, ans))) | s909802730 | Accepted | 823 | 9,696 | 267 | n = int(input())
rootn = int(n**0.5) +1
ans = [0] * (n+1)
for x in range(1, rootn):
for y in range(1, rootn):
for z in range(1, rootn):
cur = x**2 + y**2 + z**2 + x*y + y*z + z*x
if cur <= n:
ans[cur] += 1
print('\n'.join(map(str, ans[1:]))) |
s816312290 | p03827 | u125269142 | 2,000 | 262,144 | Wrong Answer | 31 | 9,108 | 113 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | n = int(input())
s = input()
i_cnt = s.count('I')
d_cnt = s.count('D')
ans = max(0, (i_cnt - d_cnt))
print(ans) | s801369389 | Accepted | 30 | 9,124 | 184 | n = int(input())
s = input()
num_list = [0]
sum = 0
for w in s:
if w == 'I':
sum += 1
else:
sum -= 1
num_list.append(sum)
num_list.sort()
ans = num_list[-1]
print(ans) |
s785288329 | p02399 | u681232780 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 98 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a,b = map(int,input().split())
x = int(a // b)
y = int(a - b*x)
z = a / b
print(x,y,f"{x:.5f}")
| s336572837 | Accepted | 20 | 5,616 | 98 | a,b = map(int,input().split())
x = int(a // b)
y = int(a - b*x)
z = a / b
print(x,y,f"{z:.5f}")
|
s218030270 | p03409 | u606146341 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 739 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | n = int(input())
lst = []
for _ in range(n):
w, h = map(int, input().split())
lst.append([w, h])
lstw = sorted(lst, key=lambda x:(x[0],x[1]))
lsth = sorted(lst, key=lambda x:(x[1],x[0]))
answ = 0
noww = 0
nowh = 0
for _ in lstw:
if noww < _[0] and nowh < _[1]:
print("FIT",_[0], _[1],'/',noww, now... | s487768217 | Accepted | 21 | 3,064 | 536 | n = int(input())
rlst = []
blst = []
for _ in range(n):
w, h = map(int, input().split())
rlst.append([w, h, 0])
for _ in range(n):
w, h = map(int, input().split())
blst.append([w, h, 0])
rlst = sorted(rlst, key=lambda x:(x[1],x[0]))
blst = sorted(blst, key=lambda x:(x[0],x[1]))
ans = 0
for b in b... |
s549883811 | p03130 | u367130284 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 139 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | l=[]
d={}
for s in range(3):
x=list(map(int,input().split()))
d[min(x)]=max(x)
r={1: 2, 2: 3, 3: 4}
print("YES") if d==r else print("NO") | s817079555 | Accepted | 17 | 3,060 | 178 | l=[]
y=set([1,1,2,2])
for s in range(3):
x=list(map(int,input().split()))
l.extend(x)
z=set([l.count(1),l.count(2),l.count(3),l.count(4)])
print("YES") if y==z else print("NO") |
s121843444 | p03573 | u470735879 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | a, b, c = map(int, input().split())
if a == b:
print(c)
elif b == c:
print(a)
else:
print(a) | s846145273 | Accepted | 20 | 2,940 | 106 | a, b, c = map(int, input().split())
if a == b:
print(c)
elif b == c:
print(a)
else:
print(b) |
s045980236 | p02842 | u213800869 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 33 | 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).... | a = int(input())
print(a / 1.08) | s735621424 | Accepted | 31 | 2,940 | 256 | import math
# math.floor(x)
N = int(input())
# Check if the price before tax is X, for X = 1, 2, 3, ..., N
ans = -1
for i in range(1, N + 1):
if int(i * 1.08) == N:
ans = i
# Print answer
if ans != -1:
print(ans)
else:
print(":(") |
s159279781 | p03369 | u033524082 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 148 | 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 ... | a = input()
b = 0
if a[0]=="o":
b = b+100
else:
b = b
if a[1]=="o":
b = b+100
else:
b = b
if a[2]=="o":
b = b + 100
else:
b = b
print(b) | s777139941 | Accepted | 18 | 2,940 | 100 | a = input()
b = 700
for i in range(len(a)):
if a[i]=="o":
b = b+100
else:
b = b
print(b) |
s826143807 | p03090 | u285891772 | 2,000 | 1,048,576 | Wrong Answer | 47 | 10,792 | 969 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | s036596007 | Accepted | 40 | 10,712 | 1,186 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... |
s527391390 | p03861 | u623516423 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x=list(map(int,input().split()))
print(b%x-a%x) | s178747185 | Accepted | 17 | 2,940 | 93 | a,b,x=list(map(int,input().split()))
if a%x==0:
print(b//x-a//x+1)
else:
print(b//x-a//x) |
s086397949 | p03448 | u903005414 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 201 | 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()), int(input()), int(input()), int(input())
ans = 0
for i in range(a + 1):
for j in range(b + 1):
k = (x - 500 * a - 100 * b) // 50
if k >= 0:
ans += 1
print(ans) | s557163757 | Accepted | 18 | 2,940 | 246 | a, b, c, x = int(input()), int(input()), int(input()), int(input())
ans = 0
for i in range(a + 1):
for j in range(b + 1):
v = x - 500 * i - 100 * j
if v < 0:
continue
if v % 50 == 0 and v // 50 <= c:
ans += 1
print(ans)
|
s963134056 | p03730 | u191635495 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 126 | 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())
res = 'No'
for _ in range(A, B*A+1):
if _ % B == C:
res = 'Yes'
break
print(res) | s306362257 | Accepted | 17 | 2,940 | 142 | A, B, C = map(int, input().split())
res = 'NO'
for _ in range(A, A*B+1, A):
if (_ % B) == C:
res = 'YES'
break
print(res)
|
s248654185 | p00017 | u519227872 | 1,000 | 131,072 | Wrong Answer | 30 | 7,408 | 631 | In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would... | from sys import stdin
def ascii2num(ascii):
return ord(ascii) - 96
def num2ascii(num):
return chr(num + 96)
def slide(word,num):
return ''.join([num2ascii((ascii2num(ascii) + num) % 26) if ascii != '.' else '.' for ascii in word])
def includekeyword(words):
for word in words:
if word in keyw... | s123944864 | Accepted | 30 | 7,372 | 650 | from sys import stdin
def ascii2num(ascii):
return ord(ascii) - 96
def num2ascii(num):
return chr(num + 96)
def slide(word,num):
return ''.join([num2ascii((ascii2num(ascii) - num) % 26 + 1) if ascii != '.' else '.' for ascii in word])
def includekeyword(words):
for word in words:
if word in ... |
s556010331 | p02742 | u975116284 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 102 | 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()))
if (h*w)%2 == 0:
print((h*w)/2)
else:
print((h*w+1)/2) | s816715124 | Accepted | 17 | 2,940 | 101 | h, w = list(map(int, input().split()))
if h == 1 or w == 1:
print(1)
else:
print((h*w+1)//2) |
s624388896 | p03574 | u687574784 | 2,000 | 262,144 | Wrong Answer | 37 | 3,700 | 618 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h,w = list(map(int, input().split()))
L = [input() for _ in range(h)]
ans=[]
for row in range(len(L)):
LINE=[]
for col in range(len(L[row])):
print('row=',row,'col=',col,L[row][col])
if L[row][col]=='.':
cnt=0
for shiftX, shiftY in [(i,j) for i in [-1,0,1] for j in [-1,0... | s306558230 | Accepted | 33 | 3,188 | 569 | h,w = list(map(int, input().split()))
L = [input() for _ in range(h)]
ans=[]
for row in range(len(L)):
LINE=[]
for col in range(len(L[row])):
if L[row][col]=='.':
cnt=0
for shiftX, shiftY in [(i,j) for i in [-1,0,1] for j in [-1,0,1] if i!=0 or j!=0]:
if 0<=row+s... |
s350461691 | p03377 | u167647458 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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 and a + b >= x:
print('Yes')
else:
print('No') | s658525047 | Accepted | 18 | 3,064 | 100 | a, b, x = map(int, input().split())
if a <= x and a + b >= x:
print('YES')
else:
print('NO') |
s407196296 | p03719 | u929461484 | 2,000 | 262,144 | Wrong Answer | 26 | 9,092 | 83 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c = map(int,input().split())
if a <= c <= b:
print('yes')
else:
print('no') | s764803543 | Accepted | 29 | 9,060 | 83 | a,b,c = map(int,input().split())
if a <= c <= b:
print('Yes')
else:
print('No') |
s566759430 | p03564 | u513081876 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | 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())
ans = 1
for i in range(N + K):
if i <= N -1:
ans *= 2
else:
ans += K
print(ans) | s513578655 | Accepted | 17 | 2,940 | 142 | N = int(input())
K = int(input())
ans = 1
for i in range(N):
if ans * 2 <= ans + K:
ans *= 2
else:
ans += K
print(ans) |
s764759048 | p03386 | u089142196 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 123 | 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())
s=set()
for i in range(K):
s.add(A+i)
s.add(B-i)
#print(s)
lis=sorted(s)
print(lis) | s270519569 | Accepted | 17 | 3,060 | 173 | A,B,K = map(int,input().split())
s=set()
for i in range(K):
if A+i<=B:
s.add(A+i)
if B-i>=A:
s.add(B-i)
#print(s)
lis=sorted(s)
for item in lis:
print(item) |
s545896414 | p02263 | u142825584 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 291 | An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106 |
def main():
l = input().split(' ')
s = []
for el in l:
print(s)
if el in ["+", "-", "*"]:
a = s.pop(-1)
b = s.pop(-1)
s.append(eval(str(b) + el + str(a)))
else:
s.append(int(el))
print(s[0])
main()
| s643747966 | Accepted | 20 | 5,608 | 274 |
def main():
l = input().split(' ')
s = []
for el in l:
if el in ["+", "-", "*"]:
a = s.pop(-1)
b = s.pop(-1)
s.append(eval(str(b) + el + str(a)))
else:
s.append(int(el))
print(s[0])
main()
|
s941760082 | p02402 | u156215655 | 1,000 | 131,072 | Wrong Answer | 20 | 7,616 | 118 | 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=int(input())
numbers=input().split()
sorted(numbers, key=int)
print(numbers[0], numbers[-1], sum(map(int, numbers))) | s152349550 | Accepted | 30 | 8,836 | 128 | n=int(input())
numbers=input().split()
numbers = sorted(numbers, key=int)
print(numbers[0], numbers[-1], sum(map(int, numbers))) |
s013564873 | p03457 | u558961961 | 2,000 | 262,144 | Wrong Answer | 500 | 11,764 | 456 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | N = int(input())
t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = x[0] = y[0] = 0
result = "YES"
def is_even(num):
return num % 2 == 0
for i in range(1, N+1):
t[i], x[i], y[i] = list(map(int, input().split()))
time = t[i] - t[i-1]
xlen = x[i] - x[i-1]
ylen = y[i] - y[i-1]
if is_even(time) ==... | s385983122 | Accepted | 448 | 11,764 | 488 | N = int(input())
t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
result = "Yes"
def is_even(num):
return num % 2 == 0
for i in range(1, N+1):
t[i], x[i], y[i] = list(map(int, input().split()))
for i in range(1, N+1):
time = t[i] - t[i-1]
xlen = abs(x[i] - x[i-1])
ylen = abs(... |
s941530714 | p03674 | u333945892 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,444 | 697 | 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... | from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]
def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, i... | s056482703 | Accepted | 345 | 33,264 | 1,003 | from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]
def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, i... |
s036552663 | p03565 | u686036872 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 225 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | import re
S=input().replace("?", ".")
T=input()
for i in range(len(S)-len(T)-1):
if re.match(S[i:i+len(T)], S):
S.replace(".", "a")
print(S[:i]+T+S[i+len(T):])
break
else:
print("UNRESTORABLE") | s341816079 | Accepted | 21 | 3,188 | 235 | import re
S=input().replace("?", ".")
T=input()
for i in range(len(S)-len(T), -1, -1):
if re.match(S[i:i+len(T)], T):
S = S.replace(".", "a")
print(S[:i]+T+S[i+len(T):])
break
else:
print("UNRESTORABLE") |
s814066859 | p03385 | u459283268 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | n = input()
print('Yes') if 'abc' in n else print('No') | s177234087 | Accepted | 17 | 2,940 | 65 | n = input()
print('Yes') if set(n) == set('abc') else print('No') |
s088857636 | p03813 | u706414019 | 2,000 | 262,144 | Wrong Answer | 27 | 9,116 | 162 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | s = input()
a=0
b=0
for i in range(len(s)):
if s[i]=='A':
a = i
break
for i in range(len(s)-1,-1,-1):
if s[i] == 'Z':
b = i
break
print(b-a+1) | s381411477 | Accepted | 24 | 8,956 | 51 | x = int(input())
print('ABC' if x<1200 else 'ARC')
|
s258137055 | p02694 | u969808621 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,156 | 102 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
a = 100
i = 0
while True:
i += 1
a = int(a * 1.01)
if(x < a):
print(i)
break
| s713248300 | Accepted | 23 | 9,156 | 114 | x = int(input())
a = 100
i = 0
while True:
i += 1
a = int(a * 1.01)
# print(a)
if(x <= a):
print(i)
break
|
s997610920 | p02663 | u084491185 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,440 | 271 | In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying? | import datetime
h1,m1,h2,m2,k=map(int, input().split())
starttime = datetime.datetime(2020, 1, 1, h1, m1)
endtime = datetime.datetime(2020, 1, 1, h2, m2) - datetime.timedelta(minutes = k)
td = endtime-starttime
ans = td.seconds / 60
if ans <= 0:
ans = 0
print(ans) | s835329843 | Accepted | 23 | 9,400 | 167 | import datetime
h1,m1,h2,m2,k=map(int, input().split())
starttime = 60 * h1 + m1
endtime = 60 * h2 + m2 -k
td = endtime - starttime
if td <= 0:
td = 0
print(td) |
s822845713 | p03610 | u252828980 | 2,000 | 262,144 | Wrong Answer | 38 | 3,188 | 86 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s = input()
ans = ""
for i in range(len(s)):
if i%2 == 1:
ans += s[i]
print(ans) | s866308218 | Accepted | 39 | 3,188 | 86 | s = input()
ans = ""
for i in range(len(s)):
if i%2 == 0:
ans += s[i]
print(ans) |
s387078635 | p02647 | u970133396 | 2,000 | 1,048,576 | Wrong Answer | 2,207 | 39,436 | 608 | We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i. Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity o... | import heapq
n, k = map(int, input().strip().split())
A = list(map(int, input().strip().split()))
for _ in range(k):
finish=True
start=[]
startInd=0
end=[]
endInd=0
for i in range(n):
if A[i]!=n:
finish=False
heapq.heappush(start,i-A[i])
heapq.heappush(end,i... | s544160090 | Accepted | 933 | 131,736 | 769 | from numba import jit
import numpy as np
n, k = map(int, input().split())
A = np.array([*map(int, input().split())],dtype=np.int64)
# for _ in range(min(k,int(math.log(n,2)))):
@jit
def loop(A):
for _ in range(k):
b=np.zeros(n,dtype=np.int64)
for i,v in enumerate(A):
# if i>... |
s223902036 | p04011 | u597436499 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 278 | 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. | def check_w(arr):
a = 0
for i in range(len(arr)-1):
a += 1
if arr[i] != arr[i+1]:
if a % 2 != 0:
return False
a = 0
return True
w = list(input())
w.sort()
if check_w(w):
print("Yes")
else:
print("No")
| s783062446 | Accepted | 17 | 2,940 | 134 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n >= k:
print(k * x + (n - k) * y)
else:
print(n * x)
|
s386854192 | p03635 | u601522790 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n,m = map(int,input().split())
print(n - 1 * m - 1) | s855963417 | Accepted | 17 | 2,940 | 55 | n,m = map(int,input().split())
print((n - 1) * (m - 1)) |
s412107205 | p03853 | u239342230 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 86 | 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 _ in range(H):
a=input().split()
print(a)
print(a) | s144162404 | Accepted | 18 | 3,060 | 78 | H,W=map(int,input().split())
for _ in range(H):
a=input()
print(a)
print(a) |
s262652006 | p03672 | u256833330 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 134 | 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... | s=input()
for i in range(len(s)):
s=s[:-1]
if len(s)%2 ==0 and s[:len(s)//2] == s[len(s)//2:]:
print(s)
break
| s981054204 | Accepted | 17 | 2,940 | 139 | s=input()
for i in range(len(s)):
s=s[:-1]
if len(s)%2 ==0 and s[:len(s)//2] == s[len(s)//2:]:
print(len(s))
break
|
s958853154 | p03352 | u957722693 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,105 | 27,032 | 152 | 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. | import math
beki=[]
beki.append(1)
x=int(input())
for i in range(int(math.sqrt(x))):
p=2
while(i**p<=x):
beki.append(i**p)
p+=1
print(beki) | s074021549 | Accepted | 21 | 3,316 | 143 | import math
beki=[]
beki.append(1)
x=int(input())
for i in range(2,x):
p=2
while(i**p<=x):
beki.append(i**p)
p+=1
print(max(beki)) |
s343024045 | p03139 | u963903527 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 116 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... |
N, A, B = map(int, input().split(" "))
n = 0
if N >= A+B:
n = 0
elif N < A+B:
n = (A+B)- N
print(max(A, B), n)
| s037968840 | Accepted | 18 | 2,940 | 154 |
N, A, B = map(int, input().split(" "))
if A == B and A == N:
print(A, A)
else:
n = 0
if A + B > N:
n = A+B-N
else:
n = 0
print(min(A, B), n)
|
s972395328 | p02866 | u013553729 | 2,000 | 1,048,576 | Wrong Answer | 369 | 14,396 | 401 | 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. | N = int(input())
D = list(map(int, input().split()))
D.sort()
print(D)
def calc(N, D):
counts = [0]
preNum = 0
for i in D:
if i == preNum:
counts[-1] += 1
elif i == preNum + 1:
counts.append(1)
else:
return 0
preNum = i
result = 1
for i in range(len(counts)-1):
result = ... | s963330523 | Accepted | 118 | 14,396 | 432 | N = int(input())
D = [int(d) for d in input().split()]
maxD = max(D)
length = [0 for _ in range(maxD+1)]
mod = 998244353
for d in D:
length[d] += 1
if D[0] != 0 or length[0] > 1:
print(0)
else:
ans = 1
for i in range(1, maxD + 1):
if length[i] == 0:
print(0)
break
... |
s032162536 | p03795 | u452015170 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | 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())
x = 800 * n
y = 200 * (n % 15)
print(x - y) | s075824795 | Accepted | 17 | 2,940 | 61 | n = int(input())
x = 800 * n
y = 200 * (n // 15)
print(x - y) |
s752615207 | p04044 | u805045107 | 2,000 | 262,144 | Wrong Answer | 19 | 3,068 | 13 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | str = input() | s165593656 | Accepted | 17 | 3,060 | 122 | N, L = map(int,input().split())
words = []
for i in range(N):
words.append(input())
words.sort()
print(''.join(words)) |
s418710910 | p03149 | u629350026 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,120 | 153 | 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". | n1,n2,n3,n4=map(int,input().split())
t=[n1,n2,n3,n4]
t.sort()
print(t)
if t[0]==1 and t[1]==4 and t[2]==7 and t[3]==9:
print("YES")
else:
print("NO") | s079439739 | Accepted | 27 | 9,152 | 144 | n1,n2,n3,n4=map(int,input().split())
t=[n1,n2,n3,n4]
t.sort()
if t[0]==1 and t[1]==4 and t[2]==7 and t[3]==9:
print("YES")
else:
print("NO") |
s707012428 | p03007 | u296150111 | 2,000 | 1,048,576 | Wrong Answer | 229 | 14,144 | 340 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | n=int(input())
a=list(map(int,input().split()))
a.sort()
minus=sum(a[0:n//2])
plus=sum(a)-minus
print(plus-minus)
if n%2==0:
s=a[0]
for i in range(1,n//2):
print(a[n-i],s)
s=a[n-i]-s
print(a[i],s)
s=a[i]-s
print(a[n//2],s)
else:
s=a[n-1]
for i in range(n//2):
print(a[i],s)
s=a[i]-s
print(a[n-(i+2)]... | s152637531 | Accepted | 255 | 14,144 | 353 | n=int(input())
a=list(map(int,input().split()))
a.sort()
plus=[a[n-1]]
minus=[a[0]]
for i in range(1,n-1):
if a[i]>=0:
plus.append(a[i])
else:
minus.append(a[i])
print(sum(plus)-sum(minus))
k=minus[-1]
for i in range(len(plus)-1):
print(k,plus[i+1])
k-=plus[i+1]
t=plus[0]
for i in range(len(minus)-1):
print(t,... |
s259720925 | p03971 | u244434589 | 2,000 | 262,144 | Wrong Answer | 76 | 9,260 | 362 | 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()
cnt = 0
for i in range(n):
if s[i] == 'a':
if cnt <a+b:
print('Yes')
cnt +=1
else:
print('No')
elif s[i] == 'b':
if cnt <a+b and i < b-1:
print('Yes')
cnt +=1
else:
... | s548515631 | Accepted | 79 | 9,244 | 380 | n,a,b =map(int,input().split())
s = input()
cnt = 0
p = 0
for i in range(n):
if s[i] == 'a':
if cnt <a+b:
print('Yes')
cnt +=1
else:
print('No')
elif s[i] == 'b':
p +=1
if cnt <a+b and p <=b:
print('Yes')
cnt +=1
... |
s634829593 | p03471 | u257541375 | 2,000 | 262,144 | Wrong Answer | 783 | 3,060 | 324 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n, y = [int(i) for i in input().split()]
flg = False
for a in range(2001):
for b in range(2000-a+1):
c = n-a-b
if a*10000 + 5000*b + 1000*c == y:
print(a,end=" ")
print(b,end=" ")
print(c)
flg = True
break
if flg:
break
if flg == False:
print("-1 -1 -1")
... | s080826920 | Accepted | 1,515 | 3,064 | 213 | n,y = map(int,input().split())
ans = [-1,-1,-1]
for i in range(0,n+1):
for j in range(0,n+1):
if i*10000 + j*5000 + (n-i-j)*1000 == y and n-i-j>=0:
ans = [i,j,n-i-j]
print(ans[0],ans[1],ans[2]) |
s751882952 | p03635 | u695079172 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | a,b = map(int,input().split())
tate = a+1
yoko = b+1
print(tate*yoko - (tate*2 + tate*2 -4)) | s415350693 | Accepted | 17 | 2,940 | 52 | a,b = map(int,input().split())
print((a-1) * (b-1)) |
s643942416 | p03698 | u823458368 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
print('Yes' if len(s) == len(set(s)) else 'No') | s929407509 | Accepted | 17 | 2,940 | 76 | s = input()
if len(s) == len(set(s)):
print('yes')
else:
print('no') |
s722095140 | p04043 | u515364861 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 162 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c = map(int,input().split())
if a == 5:
if b == 7:
if c == 5:
print('YES')
else:
print('NO')
else:
print('NO') | s869378536 | Accepted | 18 | 3,060 | 189 | n=list(map(int,input().split()))
b=[]
a=0
for i in n:
if i ==5:
a+=i
elif i==7:
a+=i
else:
print('NO')
if a == 17:
print('YES')
else:
print('NO') |
s636921599 | p03943 | u992736202 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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=list(map(int,input().split()))
sorted(a)
if a[0]+a[1]==a[2]:
print("Yes")
else:
print("No") | s233071833 | Accepted | 18 | 2,940 | 96 | a=list(map(int,input().split()))
a.sort()
if a[0]+a[1]==a[2]:
print("Yes")
else:
print("No") |
s372738215 | p02419 | u629874472 | 1,000 | 131,072 | Wrong Answer | 20 | 5,556 | 117 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | w = input()
li = list(input().split())
cnt = 0
for i in range(len(li)):
if w ==li[i]:
cnt +=1
print(cnt)
| s749175861 | Accepted | 20 | 5,564 | 134 | w=input().lower()
c=[]
s=input()
while(s!='END_OF_TEXT'):
c+=s.lower().split();
s=input()
print(len([x for x in c if x==w]))
|
s210952620 | p03486 | u703823201 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = list(input())
t = list(input())
s1= sorted(s)
t1 = sorted(t)
if s1 < t1:
print("Yes")
else:
print("No") | s733517346 | Accepted | 19 | 3,060 | 97 | s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
print("Yes" if s < t else "No") |
s475777848 | p03160 | u279670936 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 339 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | def frog_jump(n:int, stones)->int:
dp = [float('inf')] * n
jumps = (1, 2)
dp[0] = 0
for idx in range(len(dp)):
for jump in jumps:
if idx+jump < len(dp):
dp[idx+jump] = min(dp[idx]+abs(stones[idx+jump]-stones[idx]), dp[idx+jump])
return dp[-1]
frog_jump(6, [30, 1... | s471920431 | Accepted | 133 | 20,956 | 574 | import sys, os
sys.setrecursionlimit(10**8)
#resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
read = lambda : sys.stdin.readline().rstrip('\n')
tint = lambda x: [int(x) for x in x.split()]
inf = float('inf')
def main():
n = tint(read())[0]
stones = tint(read())
dp = [inf]*n
dp[0] = 0
for i i... |
s864543204 | p03386 | u198930868 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 275 | 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 = []
if (a+k) < b:
for i in range(a, a+k):
ans.append(i)
else:
for i in range(a, b):
ans.append(i)
if (b-k) > a:
for l in range(b-k+1,b+1):
ans.append(l)
else:
for l in range(a,b+1):
ans.append(l)
for a in set(ans):
print(a) | s816314839 | Accepted | 17 | 3,064 | 304 | a,b,k = map(int,input().split())
ans = []
if (a+k) < b:
for i in range(a, a+k):
ans.append(i)
else:
for i in range(a, b):
ans.append(i)
if (b-k) > a:
for l in range(b-k+1,b+1):
ans.append(l)
else:
for l in range(a,b+1):
ans.append(l)
ans = set(ans)
ans = sorted(ans)
for a in ans:
print(a) |
s876316813 | p02845 | u267718666 | 2,000 | 1,048,576 | Wrong Answer | 153 | 20,592 | 486 | N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of p... | N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
G = [0] * 3
G[0] = 1
cnt = 0
ans = 1
for i in range(1, N):
groups = []
for j, g in enumerate(G):
if g == A[i]:
groups.append(j)
if len(groups) == 0:
ans = 0
break
else:
if A[i] != 0:
... | s053684569 | Accepted | 138 | 20,864 | 301 | N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
G = [0]*3
ans = 1
for i in range(N):
x = 0
cnt = 0
for j, g in enumerate(G):
if g == A[i]:
x = j if cnt == 0 else x
cnt += 1
G[x] += 1
ans *= cnt
ans = ans % mod
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.