problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02612 | s268734264 | Wrong Answer | n = int(input())
ans = 1000 - (n % 1000)
print (ans) |
p03910 | s419335269 | Accepted | n = int(input())
i = 0
while True:
if i*(i+1)//2 >= n:
break
i += 1
while True:
print(i)
n -= i
i -= 1
if n == 0:
break
if n - i <= 0:
print(n)
break
|
p02842 | s895741449 | Wrong Answer | import math
N=int(input())
x=math.ceil(N/1.08)
if x == N:
print(x)
else:
print(":(")
|
p03103 | s515871590 | Wrong Answer | n,m = map(int, input().split())
pairs = [input().split() for _ in range(n)]
pairs.sort(key = lambda x:x[0])
count = 0
ans = 0
for i in pairs:
ans += int(i[0])*int(i[1])
count += int(i[1])
if count >= m:
ans -= int(i[0])*(count - m)
break
print(ans) |
p03107 | s817512146 | Wrong Answer | s = input()
ls = list(map(int,list(s)))
lt = [0]
for i in range(1,len(s)):
lt.append(ls[i-1]+ls[i])
ans = 0
while 1 in lt:
flg = 1
n = len(ls)
for i in range(1,n):
if flg == 1 and lt[n-i] == 1:
ls = ls[:n-i-2] + ls[n-i:]
ans += 2
flg = 0
elif flg == 0:
flg = 1
lt = [0]
for i in range(1,len(ls)):
lt.append(ls[i-1]+ls[i])
print(ans) |
p02793 | s917125614 | Wrong Answer | # Hello World program in Python
def gcd(a, b):
if b == 0: return a
return gcd(b, a%b)
def lcm(a, b):
return (a*b)/gcd(a,b);
A = []
def main():
N = int(raw_input())
A = map(int, raw_input().split())
l = 1
for x in A:
l = lcm(l, x)
ans, mod = 0, 1000000007
for x in A:
ans = (ans + l/x)
ans = ans % mod
print(ans) |
p02912 | s847904489 | Accepted | import math
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
for _ in range(M):
x=math.floor(A.pop(N-1)/2)
bisect.insort(A,x)
print(sum(A))
|
p03760 | s806561299 | Wrong Answer | o=list(input())
e=list(input())
for x,y in zip(o,e):print(x+y,end="") |
p02916 | s164426614 | Wrong Answer | n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
#ここまで入力
manzoku = 0
for i in range(n):
if a[i] ==n:
manzoku += b[a[i]-1]
elif i == n-1:
manzoku += b[a[i]-1]
else:
manzoku += (b[a[i]-1]+c[a[i]-1])
print(manzoku) |
p02720 | s236648502 | Accepted | import sys
input = sys.stdin.readline
from collections import deque
K = int(input())
q = deque([])
for i in range(1, 10):
q.append(i)
cnt = 0
while q:
v = q.popleft()
cnt += 1
if cnt==K:
print(v)
exit()
for i in range(max(0, v%10-1), min(9, v%10+1)+1):
q.append(10*v+i)
|
p03493 | s558246024 | Accepted | print(input().count('1')) |
p02843 | s630350181 | Accepted | coins = [100, 101, 102, 103, 104, 105]
MAX = 100000
# 100の判定
result = list()
for i in range(MAX + 1):
if(i % coins[0] == 0) : result.append(1)
else : result.append(0)
# 101以降
for coin in coins[1:]:
for j in range(coin, MAX+1):
result[j] += result[j-coin]
X = int(input())
if(result[X] >= 1): print('1')
else : print('0')
|
p02730 | s829636477 | Accepted | def Main(S):
N = len(S)
r_S = S[::-1]
A = S[:(N-1)//2]
r_A = A[::-1]
B = S[(N+1)//2:]
r_B = B[::-1]
return "Yes" if S == r_S and A == r_A and B == r_B else "No"
def main():
S = str(input())
print(Main(S))
if __name__ == '__main__':
main() |
p02773 | s743237474 | Wrong Answer | import collections
n = int(input())
s = []
for i in range(n):
s.append(input())
s.sort()
#print(s)
c = collections.Counter(s)
#print(c.most_common())
m = c.most_common()[0][1]
l = len(c.most_common())
for i in range(l):
if c.most_common()[i][1] == m:
print(c.most_common()[i][0])
else:
break |
p02793 | s222426038 | Wrong Answer | n=int(input())
l=list(map(int,input().split()))
mod=10**9+7
import fractions
a=l[0]
for i in range(1,n):
l[i]%=mod
a=(a*l[i]//(fractions.gcd(a,l[i])))%mod
list=[(a//l[i])%mod for i in range(n)]
print(sum(list)%mod)
|
p02792 | s982928727 | Accepted | N = int(input())
from collections import defaultdict
counter = defaultdict(int)
for k in range(1,N+1):
temp = list(str(k))
counter[(int(temp[0]),int(temp[-1]))] += 1
ans = 0
for i in range(1,10):
for j in range(1,10):
ans += counter[(i,j)]*counter[(j,i)]
print(ans) |
p03698 | s445718401 | Wrong Answer | S=input()
if len(S)==len(set(S)):
print("Yes")
else:
print("No") |
p03059 | s704946312 | Accepted | a,b,t=map(int,input().split())
time=a
cnt=0
i=1
while time <= t+0.5:
cnt+=b
i +=1
time += a
print(cnt)
|
p03693 | s078437953 | Accepted | a,b,c=map(int,input().split())
if (a*100+b*10+c)%4==0:
print("YES")
else:
print("NO") |
p02548 | s799760055 | Accepted | n = int(input())
cnt = 0
for a in range(1, n):
for b in range(1, n):
if a * b < n:
cnt += 1
else:
break
print(cnt)
|
p03281 | s885903160 | Wrong Answer | N = int(input())
ans = 0
for num in range(1,N+1):
cnt = 0
for i in range(1,num):
if num%i==0:
cnt=cnt+1
if cnt==8:
ans = ans+1
print(ans) |
p02778 | s829753691 | Accepted | S=input()
L=len(S)
ans=''
for i in range(L):
ans=ans+'x'
print(ans) |
p03043 | s282142003 | Accepted | n, k = map(int, input().split())
ans = 0
for i in range(1, n + 1):
count = 0
while i * (2 ** count) < k:
count += 1
ans += 1 / n * (0.5 ** count)
print(ans) |
p02899 | s994383299 | Accepted | n = int(input())
line = list(map(int, input().split()))
ans = ['0' for i in range(n)]
for i in range(n):
ans[line[i]-1] = str(i+1)
print(' '.join(ans)) |
p03041 | s667133170 | Accepted | stdin = open(0).read().split('\n')
N, K = map(int,stdin[0].split())
S = stdin[1]
l=list(S)
l[K-1]=l[K-1].lower()
print("".join(l)) |
p03861 | s721401810 | Accepted | a,b,x = map(int, input().split())
s = (a-1)//x
if a == 0: s = -1
p = b//x
print(p - s) |
p04019 | s605401816 | Accepted | def main():
S=set(list(input()))
flag=0
if len(S)%2:
flag=1
if ('N' in S and ('W' in S or 'E' in S)) or ('S' in S and ('W' in S or 'E' in S)):
flag=1
if len(S)==4:
flag=0
print('No' if flag else 'Yes')
main() |
p03309 | s794051654 | Accepted | n = int(input())
A = list(map(int, input().split()))
B = [ A[i]-i-1 for i in range(n) ]
B.sort()
idx = n//2
print( sum( [ abs(b-B[idx]) for b in B ] ) ) |
p02988 | s252535538 | Accepted | import sys
n = int(input())
array = list(map(int,input().split()))
if not ( 3 <= n <= 20 ): sys.exit()
count = 0
for I in range(n-2):
if array[I] < array[I+1] < array[I+2]: count += 1
if array[I] > array[I+1] > array[I+2]: count += 1
print(count) |
p03371 | s887749625 | Accepted | a,b,c,x,y = map(int,input().split())
if a+b > 2*c:
if x <= y:
ans = x*c*2 + (y-x)*min(b,2*c)
elif y < x:
ans = y*c*2 + (x-y)*min(a,2*c)
else:
ans = x*a + y*b
print(ans) |
p03126 | s457438014 | Accepted | from collections import defaultdict
n,m = map(int, input().split())
dic = defaultdict(lambda:0)
for _ in range(n):
ar = list(map(int, input().split()))
for i in range(1,len(ar)):
dic[ar[i]] += 1
ans = 0
for i,v in dic.items():
if v == n:
ans += 1
print(ans) |
p03282 | s800288063 | Accepted | S = input()
K = int(input())
one = 0
for char in S:
if char == "1":
one += 1
else:
break
if K <= one:
print(1)
elif one > 0:
print(S[one])
else:
print(S[0])
|
p03161 | s393254159 | Accepted | import sys
N, K = map(int, sys.stdin.readline().split())
h = tuple(map(int, sys.stdin.readline().split()))
cost = [None]*N
cost[0] = 0
for i in range(N):
for j in range(1, K+1):
if i + j > N-1:
break
tmp = cost[i] + abs(h[i] - h[i+j])
if cost[i+j] == None or cost[i+j] > tmp:
cost[i+j] = tmp
print(cost[N-1]) |
p02548 | s582383716 | Accepted | l = int(input())
sum = 0
c = 0
for i in range(1,l):
for ii in range(i,l):
sum = i * ii
if sum >= l:
break
else:
if i != ii:
c+=2
else:
c+=1
print(c) |
p03814 | s552985425 | Accepted | s = input()
print(s.rfind("Z") - s.find("A") + 1) |
p02602 | s867209130 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
p1=0
p2=k
for i in range(k,n):
if a[p2]>a[p1]:
print('Yes')
else:
print('No')
p1+=1
p2+=1
|
p02935 | s027363207 | Wrong Answer | N=int(input())
v=list(map(int,input().split()))
v.sort()
print(v)
ans=0
for i in range(N):
ans+=(v[i])/(2**(N-i))
ans+=(v[0])/(2**N)
print(ans) |
p03417 | s637697774 | Accepted | def main():
N, M = list(map(int, input().split(' ')))
N, M = min([N, M]), max([N, M])
if N == 1:
if M == 1:
print(1)
elif M == 2:
print(0)
else:
print(M - 2)
elif N == 2:
print(0)
else:
print((N - 2) * (M - 2))
if __name__ == '__main__':
main() |
p03627 | s053847899 | Accepted | from collections import Counter
n = int(input())
A = Counter(list(map(int, input().split())))
E = [0, 0]
for k, v in A.items():
if v>=2:
E.append(k)
if v>=4:
E.append(k)
E.sort()
print(E[-1]*E[-2]) |
p03386 | s289747249 | Accepted | a,b,k=map(int,input().split())
for i in range(a,min(a+k,b+1)):
print(i)
for i in range(max(a+k,b-k+1),b+1):
print(i) |
p03998 | s443735836 | Accepted | s=[input() for i in range(3)]
l=[len(s[i]) for i in range(3)]
abc=[0,0,0]
now=0
while abc[now]!=l[now]:
s_sub=s[now][abc[now]]
abc[now]+=1
now=(0 if s_sub=="a" else 1 if s_sub=="b" else 2)
print("A" if now==0 else "B" if now==1 else "C") |
p03323 | s819224357 | Accepted | a,b=map(int,input().split())
if a>8 or b>8:
print(":(")
else:
print("Yay!") |
p02831 | s818600378 | Accepted | def gcd(a,b):
if a%b==0:
return b
return gcd(b,a%b)
A,B = map(int,input().split())
print((A*B)//gcd(A,B))
|
p04030 | s354277981 | Wrong Answer | def main():
s=input()
li=[]
for i in range(len(s)):
if(s[i]!='B'):
li.append(s[i])
else:
if(len(li)!=0):
li.pop()
for i in range(len(li)):
print(i,end='')
main()
|
p02748 | s916160140 | Accepted | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
XYC = [input().split() for _ in range(M)]
ans = min(a) + min(b)
for x, y, c in XYC:
discount_price = a[int(x) - 1] + b[int(y) - 1] - int(c)
ans = min(ans, discount_price)
print(ans) |
p02748 | s864536919 | Accepted | # 日立製作所 社会システム事業部 プログラミングコンテスト2020: B – Nice Shopping
A, B, M = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]
x, y, c = [], [], []
for k in range(M):
tmp = [int(i) for i in input().split()]
x.append(tmp[0])
y.append(tmp[1])
c.append(tmp[2])
prices = []
prices.append(min(a) + min(b))
for k in range(M):
prices.append(a[x[k] - 1] + b[y[k] - 1] - c[k])
print(min(prices)) |
p03719 | s182191265 | Accepted | A, B, C = map(int,input().split())
if (C>=A) and (C<=B):
print('Yes')
else:
print('No') |
p02759 | s965791780 | Wrong Answer | num=int(input())
i=0
while num>=2*int(i):
i=i+1
print(i) |
p02663 | s403224928 | Accepted | h1, m1, h2, m2, k = map(int, input().split(" "))
print( ((h2-h1)*60+m2-m1)-k )
|
p03719 | s742409973 | Accepted | def main():
a, b, c = map(int, input().split())
if a <= c and c <= b:
ans = 'Yes'
else:
ans = 'No'
print(ans)
if __name__ == "__main__":
main()
|
p03612 | s047115471 | Wrong Answer | N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N-1):
if i+1 == P[i]:
P[i], P[i+1] = P[i+1], P[i]
ans += 1
print(ans)
|
p02641 | s898598182 | Accepted | M,N = map(int,input().rstrip().split(" "))
if N != 0:
A = set(map(int,input().rstrip().split(" ")))
ans = -100
sa = 10 ** 5
for i in range(-1,102):
if not i in A:
if sa > abs(M - i):
sa = abs(M - i)
ans = i
print(ans)
else:
print(M) |
p02630 | s468976035 | Accepted | import collections
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
q=int(input())
x=collections.Counter(a)
for _ in range(q):
b,c=map(int,input().split())
s=s-x[b]*b+x[b]*c
print(s)
x[c]+=x[b]
x[b]=0 |
p02897 | s840769117 | Accepted | a = int(input())
if a % 2 == 1:
print((a+1)/2/a)
else:
print(0.5) |
p02971 | s188005909 | Accepted | N = int(input())
A = []
B = []
for _ in range(N):
temp = int(input())
A.append(temp)
B.append(temp)
B.sort(reverse=True)
max_first = B[0]
max_second = B[1]
for i in range(N):
if A[i] == max_first:
print(max_second)
else:
print(max_first) |
p02555 | s553786096 | Accepted | s = int(input())
MOD = 10**9 + 7
memo = [[0]*(s+1) for _ in range(s//3 + 1)]
flag = True
if s <= 2: flag = False
if flag:
memo[1] = [0] * 3 + [1] * (s-2)
for i in range(2, s//3 + 1):
for j in range(3*i-3, s+1):
memo[i][j] = memo[i][j-1] + memo[i-1][j-3]
ans = 0
for i in range(s//3 + 1):
ans += memo[i][s]
ans %= MOD
print(ans)
else: print(0) |
p02847 | s728782649 | Wrong Answer | s = input()
days = {
"SUN" : 0, "MON": 6, "TUE": 5, "WED": 4, "THU" : 3, "FRI" : 2, "SAT": 1
}
print(days[s]) |
p03994 | s285231948 | Accepted | s = input()
k = int(input())
L = []
for i in range(len(s)):
L.append((ord("z")-ord(s[i])+1))
ans = ""
i = 0
while i < len(s):
if s[i] == "a":
ans +="a"
i +=1
elif k-L[i] >= 0:
ans +="a"
k -=L[i]
i +=1
else:
ans +=s[i]
i +=1
k = k%26
ans = ans[:-1] + chr(ord(ans[-1]) + k)
print(ans) |
p02860 | s628734952 | Wrong Answer | n = int(input())
m = str(input())
if m[:n//2] == m[n//2:]:
print("yes")
else:
print("No") |
p03962 | s992658268 | Accepted | abc=list(map(int,input().split()))
print(len(set(abc))) |
p02556 | s709963035 | Accepted | n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
for i, v in enumerate(p):
x, y = v
p[i] = x-y, x+y
xm, ym = -10**9, -10**9
xw, yw = 10**9, 10**9
for x, y in p:
xm = max(xm, x)
xw = min(xw, x)
ym = max(ym, y)
yw = min(yw, y)
# print(p)
ans = max(abs(xm - xw), abs(ym - yw))
print(ans)
|
p04034 | s712693214 | Accepted | n,m=map(int,input().split())
box_l=[1]*n
red_l=[0]*n
red_l[0]=1
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if red_l[x]==1:
red_l[y]=1
if box_l[x]==1:
red_l[x]=0
box_l[x] -= 1
box_l[y] += 1
print(sum(red_l)) |
p02760 | s582771080 | Wrong Answer | import numpy as np
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = list([int(input()) for _ in range(n)])
c = [[0]*3]*3
for k in b:
for i in range(3):
for j in range(3):
if k == a[i][j]:
c[i][j]=1
c = np.array(c)
if (max(c.sum(axis=0))==3) or (max(c.sum(axis=1))==3) or \
(sum([c[i,i] for i in range(3)])==3) or (c[2,0]+c[1,1]+c[0,2]==3):
print("Yes")
else:
print("No") |
p02694 | s296317671 | Wrong Answer | x = int(input())
ans = 0
r = 1.01
ret = 100
while( x - ret > 0 ):
ret = int( ret * r )
ans += 1
print( ans ) |
p03126 | s562718730 | Accepted | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
n, m = rm()
li = [0]*m
for _ in range(n):
for i in rl()[1:]:
li[i-1]+=1
print(sum([i==n for i in li])) |
p02607 | s826737915 | Accepted | N = int(input())
a =list(map(int,input().split()))
b=[]
for i in range(N):
a1 = i % 2
a2 = a[i] % 2
if (a1==0 and a2==1):
b.append(i)
print(len(b))
|
p03241 | s299805065 | Wrong Answer | import numpy as np
def factorization(N):
a = []
for i in range(1,int(np.sqrt(N))):
if N%i == 0:
a.append(i)
for j in range(len(a)):
a.append(N//a[j])
a.sort(reverse=True)
return a
N,M = map(int,input().split())
f = factorization(M)
for i in f:
if i <= M/N:
print(i)
exit() |
p03345 | s432687663 | Accepted | def resolve():
a, b, c, k = map(int, input().split())
if k % 2 == 0:
print(a-b)
else:
print(b-a)
return
if __name__ == "__main__":
resolve()
|
p03767 | s142233345 | Wrong Answer | N = int(input())
a = list(map(int,input().split()))
a.sort()
print(sum(a[N:2*N])) |
p03997 | s123028009 | Wrong Answer | a=int(input())
b=int(input())
h=int(input())
s=(a+b)*h/2
print(s) |
p03657 | s825637691 | Accepted | a,b = map(int,input().split())
if (a*b) % 3 == 0 or (a+b) % 3 == 0:
print('Possible')
else:
print('Impossible') |
p03328 | s632550428 | Accepted | a, b = map(int, input().split())
diff = b - a
alen = ((diff-1) * diff) // 2
print(alen - a)
|
p03427 | s048416689 | Accepted | n = input()
def sumdigits(num):
cc = 0
for c in num:
cc += int(c)
return cc
if all([s == '9' for s in n]):
print(9 * len(n))
else:
print(max(9 * (len(n) - 1) + int(n[0]) - 1, sumdigits(n))) |
p03548 | s422625892 | Accepted | x, y, z = map(int, input().split())
print((x-z)//(y+z)) |
p03607 | s785676579 | Wrong Answer | import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans = 0
count = 1
num = A[0]
for i in range(1, N):
if A[i] == num:
count += 1
else:
if count % 2 == 1:
ans += 1
num = A[i]
count = 1
print(ans) |
p03943 | s768160462 | Accepted | l=list(map(int,input().split()))
if(l[0]==l[1]+l[2]):
print("Yes")
elif(l[1]==l[0]+l[2]):
print("Yes")
elif(l[2]==l[0]+l[1]):
print("Yes")
else:
print("No") |
p03419 | s963777230 | Accepted | n,m=map(int,input().split())
if n==1 and m==1:
print(1)
elif n==1 and m!=1:
print(m-2)
elif m==1 and n!=1:
print(n-2)
elif n==2:
print(0)
elif n>3:
print((m-2)*(n-2))
|
p03013 | s475996259 | Wrong Answer | import numpy as np
import math
N,M = list(map(int, input().split()))
aList = [int(input()) for _ in range(M)]
trg = np.ones(N+1, dtype = np.int64)
dp = np.zeros(N+1, dtype = np.int64)
for a in aList:
trg[a] -= 1
for i in range(1, N+1):
if(i <= 2):
dp[i] = 1 * trg[i]
else:
dp[i] = (dp[i-1] + dp[i-2]) * trg[i]
print(dp[N] % 1000000007)
|
p03106 | s561614664 | Wrong Answer | def divisor(n):
i = 1
table = []
while i * i <= n:
if n%i == 0:
table.append(i)
table.append(n//i)
i += 1
table = list(set(table))
return table
A, B, K = map(int, input().split())
ans = list(reversed(list(set(divisor(A)) & set(divisor(B)))))
print(ans[K-1]) |
p03062 | s498568987 | Wrong Answer | import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
A = list(map(int, input().split()))
neg_cnt = 0
minimum = 10**10
for num in A:
minimum = min(minimum, abs(num))
if num < 0:
neg_cnt += 1
print(minimum)
ans = 0
for num in A:
if num < 0:
ans += -num
else:
ans += num
print(ans)
print(neg_cnt)
if neg_cnt % 2 == 0:
print(ans)
else:
print(ans - minimum * 2) |
p02993 | s986813594 | Wrong Answer | code = list(input())
status = False
for x in range(1, len(code)):
if code[x] == code[x-1]:
print("Bad")
status = True
if status == False:
print("Good") |
p02618 | s615309143 | Wrong Answer | D=int(input())
*c,=map(int,input().split())
# for Greedy
ci=[(c[i-1],i) for i in range(1,27)]
ci=[(0,0)]+ci
# ci=[(0,0)]+sorted(ci,reverse=True)
last=[[0]*27]*(D+1)
S=[[0]*27]*(D+1)
DP=[[0]*27]*(D+1)
T=[0]*(D+1)
for d in range(1,D+1):
*S[d],=map(int,input().split())
S[d]=[0]+S[d]
import random
TI=26
Ts=random.sample(range(1,27),k=TI)
for t in Ts:
print(t)
|
p02595 | s206453288 | Accepted | import math
N, D = map(int, input().split())
poses = []
for i in range(N):
pos = [num for num in map(int, input().split())]
poses.append(pos)
count = 0
for pos in poses:
kyori = math.sqrt(pos[0]**2 + pos[1]**2)
if kyori <= D:
count += 1
print(count) |
p02597 | s557742828 | Accepted | n = int(input())
s = input()
white_to_red = 0
red_to_white = s.count('R')
ans = red_to_white
for i in range(n):
if s[i] == 'W':
white_to_red += 1
else:
red_to_white -= 1
ans = min(ans, max(white_to_red, red_to_white))
print(ans) |
p02897 | s264686348 | Accepted | N=int(input())
x=(N+1)//2
print(x/N) |
p03379 | s070339640 | Wrong Answer | import copy
n = int(input())
x = list(map(int,input().split()))
xx= sorted(x)
L_x = xx[n//2 - 1]
R_x = xx[n//2]
for arr in x:
print(L_x if L_x >= arr else R_x) |
p04011 | s443990833 | Accepted | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7
N = i()
K = i()
X = i()
Y = i()
print(N*X-max(0,N-K)*(X-Y)) |
p03219 | s584626779 | Wrong Answer | x, y = map(int, input().split())
z = x+y/2
print(z) |
p03150 | s597325750 | Accepted | S = input()
k = 'keyence'
for i in range(len(S)):
for j in range(i, len(S)):
# print(S[:i] + S[j:])
if S[:i] + S[j:] == k:
print('YES')
exit()
print('NO')
|
p02742 | s593307969 | Accepted | import math
h,w = map(int,input().split())
if h%2 == 0:
print(h//2 * w)
elif h==1 or w == 1:
print(1)
else:
tmp1 = math.floor(h/2)
tmp2 = math.ceil(h/2)
buf = math.floor(w/2)
print(tmp2 * (w-buf) + tmp1 * (buf))
|
p03565 | s748086994 | Accepted | import re
S = input()
Sa = S.replace("?", "a")
Sd = S.replace("?", ".")
T = input()
word_L = []
for i in range(len(S)-len(T)+1):
if re.match(Sd[i:i+len(T)], T) is not None:
s = Sa[:i] + T + Sa[i+len(T):]
word_L.append(s)
ans = "UNRESTORABLE"
if word_L:
ans = sorted(word_L)[0]
print(ans)
|
p04043 | s101800159 | Accepted | a,b,c=map(int,input().split())
a,b,c=sorted([a,b,c])
if (a,b,c)==(5,5,7):print('YES')
else:print('NO') |
p02963 | s567580312 | Accepted | S = int(input())
ans = [0, 0, 1, 10 ** 9]
if S % (10 ** 9) == 0:
ans.extend([S // (10 ** 9), 0])
else:
ans.extend([S // (10 ** 9) + 1, 10 ** 9 - S % (10 ** 9)])
print(' '.join([str(a) for a in ans])) |
p03001 | s647060210 | Accepted | #ABC130 C-Rectangle Cutting 14:59
W,H,x,y = map(int, input().split())
def func(W,H,x,y):
if x* 2 == W and y*2 == H:
return W*H/2, 1
else:
return W*H/2, 0
print(*func(W,H,x,y)) |
p02939 | s372463406 | Accepted | s = input()
s_len = len(s)
check = s[0]
if s_len == 2 and s[0] != s[1]:
print(2)
exit()
s = s+"1"
ind = 0
ans = 1
for i in range(1,s_len):
if check == s[ind+1]:
check = s[ind+1:ind+3]
ind += 1
else:
check = s[ind+1]
ind += 1
ans += 1
if ind >= s_len-1:
break
if ind == s_len and s[s_len-1] == s[s_len-2]:
ans -= 1
print(ans) |
p03087 | s251677181 | Accepted | n,Q=map(int,input().split())
s=input()
a=[0]*(n+1)
for i in range(2,n+1):
if s[i-2]=='A' and s[i-1]=='C':
a[i]=a[i-1]+1
else:
a[i]=a[i-1]
for i in range(Q):
l,r=map(int,input().split())
print(a[r]-a[l]) |
p02946 | s990064138 | Accepted | K, X = map(int, input().split())
ans = []
num = X - K
for i in range(K*2-1):
num += 1
ans.append(num)
print(*ans) |
p02747 | s009050420 | Accepted | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
S = input()
l = len(S)
if l % 2 != 0:
print('No')
elif S.count('hi') == l // 2:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
|
p02602 | s361421252 | Wrong Answer | N, K = map(int, input().split())
A = [int(i) for i in input().split()]
pre = 1
for i in range(K-1):
pre *= A[i]
for k in range(K, N):
score = (pre * A[k]) // A[k-K]
if score > pre:
print("Yes")
else:
print("No")
pre = score |
p03951 | s427811504 | Accepted | n = int(input())
s = input()
t = input()
ans = len(s) + len(t)
for i in range(1,n+1):
if s[-i:] == t[:i]:
ans = 2*n - i
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.