problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03944
|
s910779091
|
Wrong Answer
|
W,H,N = map(int,input().split())
grid = []
for i in range(N):
array = list(map(int, input().strip().split()))
grid.append(array)
left = 0
right = W
up = H
down = 0
for i in range(N):
if grid[i][2] == 1:
left = grid[i][0]
elif grid[i][2] == 2:
right = grid[i][0]
elif grid[i][2] == 3:
down = grid[i][1]
elif grid[i][2] == 4:
up = grid[i][1]
print((right-left)*(up-down))
|
p03163
|
s198586929
|
Accepted
|
N, W = map(int, input().split())
import numpy as np
dp = np.zeros(W + 1, dtype='int64')
for i in range(1, N + 1):
w, v = map(int, input().split())
dp[w:W+1] = np.maximum(dp[w:W+1], dp[:W-w+1] + v)
print(dp[-1])
|
p03611
|
s866115200
|
Wrong Answer
|
import bisect
n = int(input())
al = list(map(int,input().split()))
al.sort()
if n == 1:
print(1)
exit()
elif n == 2:
if abs(al[0] - al[1]) <= 2:
print(2)
else:
print(1)
ans = 0
for i in range(n):
idx = bisect.bisect_right(al,al[i]+2)
if idx == n:
idx -= 1
tmp = idx - i
ans = max(ans,tmp)
print(ans)
|
p02989
|
s909249248
|
Accepted
|
n = int(input())
d = sorted(list(map(int, input().split())))
t = n//2
if d[t-1] == d[t]:
print(0)
else:
print(d[t]-d[t-1])
|
p03565
|
s756588726
|
Wrong Answer
|
s = input()
t = input()
for i in range(len(s) - len(t) + 1)[::-1]:
for j, (ns, nt) in enumerate(zip(s[i:i+len(t)], t)):
print(j, ns, nt)
if ns != nt and ns != '?':
break
if j == len(t) -1:
ans = s[:i] + t + s[i+len(t):]
print(ans.replace('?', 'a'))
exit()
print('UNRESTORABLE')
|
p03730
|
s331171852
|
Wrong Answer
|
a, b, c = map(int, input().split())
l = [i for i in range(a, 101, a)]
ans = "NO"
for i in l:
if i % b == c:
ans = "YES"
print(ans)
|
p03472
|
s846163131
|
Accepted
|
N, H = map(int, input().split())
a = []
b = []
for i in range(N):
a1, b1 = map(int, input().split())
a.append(a1)
b.append(b1)
am = max(a)
bm = []
for i in range(N):
if b[i] > am:
bm.append(b[i])
bm.sort()
ans = 0
while len(bm) > 0:
attack = bm.pop()
H -= attack
ans += 1
if H <= 0:
print(ans)
exit()
print(ans + -(-H//am))
|
p03556
|
s013828063
|
Accepted
|
n=int(input())
keep=1
while keep**2<=n:
keep+=1
print((keep-1)**2)
|
p03360
|
s382233759
|
Accepted
|
# -*- coding: utf-8 -*-
A, B, C = map(int, input().split())
K = int(input())
print((max(A, B, C) * 2 ** K) + A + B + C - max(A, B, C))
|
p02688
|
s469437787
|
Accepted
|
N, K = map(int, input().split())
ans = [True]*N
for i in range(K):
d = int(input())
l = list(map(int, input().split()))
for a in l:
ans[a-1] = False
print(sum(ans))
|
p02730
|
s215788795
|
Accepted
|
S=input()
A=S[0:int((len(S)-1)/2)]
B=S[int((len(S)+3)/2):-1]
def kaibun(s):
a,b="",""
for i in range(len(s)):
a = a+s[i]
b = s[i]+b
return a==b
print('Yes' if (kaibun(S) and kaibun(A) and kaibun(B)) else 'No')
|
p03103
|
s538110667
|
Accepted
|
from collections import defaultdict
N, M = map(int,input().rstrip().split())
d = defaultdict(lambda: 0)
for _ in range(N):
A, B = map(int,input().rstrip().split())
d[A] += B
ans=0
for k in sorted(d.keys()):
if d[k]<=M:
ans += k*d[k]
else:
ans += k*M
M -= d[k]
if M<=0:break
print(ans)
|
p02688
|
s086018361
|
Accepted
|
N, K = list(map(int, input().split()))
a = []
for i in range(K):
d = int(input())
A = list(map(int, input().split()))
a.extend(A)
print(N - len(set(a)))
|
p03493
|
s829697684
|
Wrong Answer
|
s = input()
s[0] + s[1] + s[2]
|
p03962
|
s136520117
|
Accepted
|
a = [int(i) for i in input().split()]
ans = set()
for i in a:
ans.add(i)
print(len(ans))
|
p02767
|
s970715383
|
Accepted
|
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n = int(input())
xs = list(map(int,input().split()))
min_x = sum(xs) / n
x_z = Decimal(str(min_x)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
ans = 0
for i in xs:
ans += (x_z - i)**2
print(ans)
|
p03625
|
s856654840
|
Accepted
|
N = int(input())
lista = list(map(int, input().split()))
lista.sort(reverse= True)
count = 0
area = 1
for i in range(len(lista)- 1):
if(lista[i] == lista[i+ 1]):
del lista[i]
area*= lista[i]
count+= 1
if(count == 2):
break
if(count == 2):
print(area)
else:
print(0)
|
p02797
|
s253892850
|
Accepted
|
n, k, s = map(int, input().split())
sub = []
if s == 10**9:
for i in range(n):
if i < k:
sub.append(s)
else:
sub.append(1)
else:
for i in range(n):
if i < k:
sub.append(s)
else:
sub.append(s+1)
print(*sub)
|
p03759
|
s938726715
|
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)
INF = 10**9
mod = 10**9+7
a,b,c = I()
if b-a == c-b:
print('YES')
else:
print('NO')
|
p03069
|
s206382618
|
Wrong Answer
|
n = int(input())
s = input()
l = s.find('#')
r = s.rfind('.')
if l<0 or r<0:
print(0)
exit()
a = len(list(filter(lambda x: x == '.', s[l:])))
b = len(list(filter(lambda x: x == '#', s[r::-1])))
print(min([a, len(s[l:])-a, b]))
|
p04005
|
s774918475
|
Accepted
|
a, b, c = map(int, input().split())
if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
print(0)
elif (a and b and c) % 2 != 0 :
print(min(a * b, b * c, c * a))
|
p03324
|
s240269053
|
Accepted
|
d,n=map(int,input().split())
li = [i * 10 ** (2*d) for i in range(2*n) if i % 100 != 0]
print(li[n-1])
|
p03210
|
s929673742
|
Accepted
|
X = int(input())
if (X == 3 or X == 5 or X == 7):
print("YES")
else:
print("NO")
|
p03795
|
s005989659
|
Accepted
|
N = int(input())
div, mod = divmod(N, 15)
x = N * 800
y = div * 200
print(x - y)
|
p02640
|
s206554263
|
Wrong Answer
|
def main():
x, y = map(int, input().split())
if x * 4 <= y or y % 2!=0:
print('No')
else:
print('Yes')
if __name__ == "__main__":
main()
|
p03220
|
s258390287
|
Accepted
|
n=int(input())
t,a=map(int,input().split())
h=[abs(a-(t-int(i)*0.006)) for i in input().split()]
print(h.index(min(h))+1)
|
p02691
|
s408799760
|
Wrong Answer
|
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(2,n-1):
for j in range(n-i):
if a[j]<i and a[j]+a[j+i]==i:
count+=1
print(count)
|
p03852
|
s909824649
|
Wrong Answer
|
p = ["a", "e", "i", "o", "u"]
c = input()
if c in p:
print("vowel")
else:
print("consolant")
|
p03127
|
s516714744
|
Accepted
|
from fractions import gcd
from functools import reduce
input()
print(reduce(gcd, map(int, input().split())))
|
p02748
|
s731756205
|
Accepted
|
a, b, m = list(map(int, input().split()))
refrigerator = list(map(int, input().split()))
microwave = list(map(int, input().split()))
min_price = min(refrigerator) + min(microwave)
for i in range(m):
x, y, c = list(map(int, input().split()))
min_price = min(min_price, refrigerator[x-1]+microwave[y-1]-c)
print(min_price)
|
p02922
|
s962409075
|
Accepted
|
#template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#template
A,B = inputlist()
ans = 0
count = 1
while True:
if count >= B:
break
count += A-1
ans +=1
print(ans)
|
p03041
|
s829174046
|
Wrong Answer
|
N = 7
K = 4
S = 'ABACBAC'
print(S[ : K-1]+ S[K-1].lower() + S[K : ])
|
p02767
|
s456577131
|
Accepted
|
n=int(input())
x=list(map(int,input().split()))
ans=10**9
for i in range(1,101):
s=0
for j in x:
s+=(i-j)**2
ans=min(s,ans)
print(ans)
|
p02725
|
s942481018
|
Wrong Answer
|
k,n=map(int,input().split())
hoge=list(map(int,input().split()))
ans=hoge[0]+k-hoge[-1]
for i in range(n-1):
ans=max(ans,hoge[i+1]-hoge[i])
print(ans)
|
p02598
|
s093392948
|
Wrong Answer
|
n,k = map(int,input().split())
A = list(map(int,input().split()))
if sum(A)-n <= k:
print(1)
exit()
elif k == 0:
print(max(A))
exit()
top = 10**9
bottom = 1
def ok(x):
res = 0
for a in A:
res += a//x
return res <= k
while top - bottom > 1:
mid = (top + bottom)//2
if ok(mid):
top = mid
else:
bottom = mid
print(top)
|
p02973
|
s935699489
|
Accepted
|
# https://atcoder.jp/contests/abc134/tasks/abc134_e
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
from collections import deque
from bisect import bisect_left
N = INT()
A = []
for _ in range(N):
A.append(INT())
t = deque([A[0]])
for a in A[1:]:
i = bisect_left(t, a) - 1
if i == -1:
t.appendleft(a)
else:
t[i] = a
print(len(t))
|
p02952
|
s621049569
|
Wrong Answer
|
N=int(input())
ans=0
for i in range(N) :
if len(str(i))%2==0 :
ans+=0
else :
ans+=1
print(ans-1)
|
p03617
|
s012959622
|
Wrong Answer
|
q,h,s,d = map(int,input().split())
n = int(input())
h = min(q*2,h)
s = min(h*2,s)
d = min(s*2,d)
ans = 0
a_list = [2,1,0.5,0.25]
a = []
for i in a_list:
a.append(n//i)
n = n%i
print(int(a[0]*d+a[1]*s+a[2]*h+a[3]*q))
|
p03557
|
s265741792
|
Accepted
|
import bisect
N = int(input())
A = sorted(map(int,input().split()))
B = sorted(map(int,input().split()))
C = sorted(map(int,input().split()))
print(sum(bisect.bisect_left(A,b)*(N-bisect.bisect_right(C,b)) for b in B))
|
p03827
|
s584363206
|
Wrong Answer
|
n=int(input())
s=input()
x=0
a=[]
for i in range(n):
if s[i]=="I":
x+=1
else:
x-=1
a.append(x)
print(max(a))
|
p02689
|
s249200542
|
Accepted
|
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
#低いやつを引いていく感じ
Hlist = list(int(x) for x in input().split())
flag = [1]*N
for i in range(M):
A,B = map(int, input().split())
A -= 1
B -= 1
if(Hlist[A] == Hlist[B]) :
flag[A] = 0
flag[B] = 0
elif(Hlist[A] > Hlist[B]) :
flag[B] = 0
else:
flag[A] = 0
print(sum(flag))
|
p03059
|
s405724533
|
Accepted
|
A, B, T = map(int, input().split())
print(B*(T//A))
|
p02552
|
s983833180
|
Wrong Answer
|
x = input("x:")
if x == 0:
print(1)
if x == 1:
print(0)
|
p02743
|
s698864247
|
Accepted
|
a, b, c = map(int, input().split())
if (c - a - b) ** 2 - (4 * a * b) > 0 and c - a - b > 0:
print("Yes")
else:
print("No")
|
p02683
|
s425231194
|
Accepted
|
n,m,x=map(int,input().split())
l=[]
for i in range(n):
l.append(list(map(int,input().split())))
s=[]
a=[0]*(m+1)
s.append(a)
for i in range(n):
newl=[]
for j in s:
new=[j[k]+l[i][k] for k in range(m+1)]
newl.append(new)
s.extend(newl)
ans=float('inf')
for i in s:
for j in range(m):
if i[j+1]<x:break
else:
ans=min(ans,i[0])
if ans==float('inf'):
print(-1)
else:
print(ans)
|
p03493
|
s089778546
|
Wrong Answer
|
from sys import stdin
list(stdin.readline())
|
p02959
|
s440801263
|
Accepted
|
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=0
for i in range(N):
cnt+=min(A[i]+A[i+1],B[i])
A[i+1]=max(0,min(A[i]+A[i+1]-B[i],A[i+1]))
print(cnt)
|
p02946
|
s379286296
|
Accepted
|
K, X = map(int, input().split())
ans = ''
for i in reversed(range(-K+1,K)):
if i != -K+1:
ans += str(X-i) + ' '
else:
ans += str(X-i)
print(ans)
|
p02957
|
s797504221
|
Accepted
|
A, B = map(int, input().split())
if (A + B) & 1 == 1:
print('IMPOSSIBLE')
else:
print((A + B) // 2)
|
p02661
|
s560083321
|
Accepted
|
n=int(input())
low=[]
high=[]
for i in range(n):
a,b=map(float,input().split())
low.append(a)
high.append(b)
low.sort()
high.sort()
if n%2==0:
low_avg=(low[n//2-1]+low[n//2])/2
high_avg=(high[n//2-1]+high[n//2])/2
ans=(high_avg-low_avg)*2+1
else:
ans=high[(n-1)//2]-low[(n-1)//2]+1
print(int(ans))
|
p03997
|
s653860471
|
Accepted
|
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
|
p03281
|
s734934573
|
Wrong Answer
|
N = int(input())
res = 0
for i in range(1,N+1):
if N % i == 0:
if i % 2 == 1:
res += 1
print(res)
|
p03699
|
s153620984
|
Accepted
|
import sys
N = int(input())
S = [int(input()) for _ in range(N)]
t = sum(S)
if t % 10 != 0:
print(t)
sys.exit()
res = 0
for s in S:
if (t - s) % 10 != 0:
res = max(res, t - s)
print(res)
|
p02688
|
s517632798
|
Accepted
|
N,K=map(int,input().split())
d=[]
a=[]
for i in range(K):
d.append(int(input()))
a.append(list(map(int,input().split())))
aa=[0]*N
counts=0
for k in a:
for j in k:
aa[j-1]+=1
for x in aa:
if x==0:
counts+=1
print(counts)
|
p02623
|
s945181623
|
Wrong Answer
|
N,M,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a,b = [0],[0]
for i in range(N):
a.append(a[i]+A[i])
for j in range(M):
b.append(b[j]+B[j])
ans = 0
#print(a,b,N+1)
for i in range(N+1):
if a[i] > K:
break
j = 0
while K - a[i] >= b[j]:
if j >= M:
break
j = j+1
j = j-1
ans = max(ans,i+j)
print(ans)
|
p03329
|
s611232470
|
Wrong Answer
|
N = int(input())
A = []
for i in range(20):
if 6**i<=N:
A.append(6**i)
for i in range(1,20):
if 9**i<=N:
A.append(9**i)
AA = sorted(A,reverse=True)
INF = float("inf")
dp=[INF]*(N)
dp[0]=1
for i in range(N):
for j in AA:
dp[i]=min(dp[i-j]+1,dp[i])
#print(dp)
print(dp[-1])
|
p03548
|
s683820231
|
Wrong Answer
|
x,y,z=map(int,input().split())
print((x-1)//(y+z))
|
p02595
|
s686507510
|
Accepted
|
N, D = list(map(int, input().split()))
XY = [tuple(map(int, input().split())) for _ in range(N)]
count = 0
for x, y in XY:
if x**2 + y**2 <= D**2:
count += 1
print(count)
|
p03623
|
s835040128
|
Wrong Answer
|
a,b,c=map(int,input().split())
print("A" if abs(a-b)>abs(a-c) else "B")
|
p04045
|
s504498252
|
Wrong Answer
|
from itertools import product
n,k = map(int, input().split())
d = list(map(int, input().split()))
nums = []
for i in range(10):
if i not in d: nums.append(i)
m = str(n)
for i in range(len(m), len(m)+1):
for j in product(nums, repeat=i):
ans = ""
for k in j: ans += str(k)
if int(ans) >= n:
print(ans)
exit()
|
p02771
|
s730431621
|
Accepted
|
a,b,c=(int(x) for x in input().split())
if a==b:
if a==c:
print("No")
else:
print("Yes")
else:
if a==c:
print("Yes")
elif b==c:
print("Yes")
else:
print("No")
|
p03799
|
s814621196
|
Wrong Answer
|
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
n,m=mp()
if m<2:
print(0)
exit()
if n>=2*m:
print(m//2)
exit()
print(n+(m-2*n)//4)
|
p03221
|
s150069476
|
Accepted
|
n,m = map(int,input().split())
pre = [[] for _ in range(n)]
num=[]
for i in range(m):
p,y = map(int,input().split())
pre[p-1].append([i,y])
for i in range(n):
pre[i].sort(key=lambda x:x[1])
for j in range(len(pre[i])):
num.append([pre[i][j][0],('0'*5+str(i+1))[-6:]+('0'*5+str(j+1))[-6:]])
num.sort(key=lambda x:x[0])
for k in num:
print(k[1])
|
p02983
|
s884099677
|
Accepted
|
l,r = map(int,input().split())
ans = 2018
if r - l >= 2019:
ans = 0
else:
for i in range(l,r):
for j in range(i+1,r+1):
temp = (i*j) % 2019
if ans > temp:
ans = temp
print(ans)
|
p02714
|
s725714887
|
Accepted
|
n = int(input())
s = input()
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
ans = r_cnt * g_cnt * b_cnt
for i in range(n):
for d in range(n):
j = i + d
k = j + d
if k >= n:
break
if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
ans -= 1
print(ans)
|
p02755
|
s985112151
|
Accepted
|
from math import floor as fl
A,B =map(int,input().split())
for i in range(10000):
if fl(i * 8 / 100) == A and fl(i / 10) == B:
print(i)
break
else:
print(-1)
|
p02996
|
s009658943
|
Accepted
|
import sys
N = int(input())
BA = []
for _ in range(N):
a, b = map(int, input().split())
BA.append([b, a])
BA.sort()
time=0
for i in range(N):
time+=BA[i][1]
if time>BA[i][0]:
print("No")
sys.exit()
print("Yes")
|
p02946
|
s906361103
|
Accepted
|
k,x = map(int,input().split())
a = []
for i in range(x-k+1,x+k):
a.append(i)
print(*a)
|
p02584
|
s745332971
|
Wrong Answer
|
X, K, D = map(int, input().split())
cnt = X // D
ans1 = X - cnt * D
ans2 = abs(ans1 - D)
if cnt < K:
if (K - cnt)%2 == 0:
print(ans1)
else:
print(ans2)
else:
if X >= 0:
print(X - K * D)
else:
print(X + K * D)
|
p03106
|
s312879654
|
Wrong Answer
|
A,B,K = map(int,input().split())
ans =[]
for i in range(1,100):
if A%i == 0 and B%i == 0:
ans.append(i)
print(ans[K-1])
|
p03408
|
s341761995
|
Accepted
|
import collections as ct
n = int(input())
s_c = ct.Counter([input() for i in range(n)])
m = int(input())
t_c = ct.defaultdict(int, ct.Counter([input() for i in range(m)]))
ans = max([s_c[k] - t_c[k] for k in s_c])
print(max(ans, 0))
|
p02819
|
s758042153
|
Accepted
|
# 2020/07/01
# AtCoder Beginner Contest 149 - C
# Input
x = int(input())
slist = [0] * 100005
for i in range(2, 100000):
if slist[i] == 0:
j = i + i
while(j < 100004):
slist[j] = 1
j = j + i
sidx = x
while(x < 100004):
if slist[x] == 0:
ans = x
break
x = x + 1
# Output
print(ans)
|
p02862
|
s693326338
|
Accepted
|
x,y = map(int,input().split())
mod = 10**9 + 7
move = x+y
if move %3 !=0:
print(0)
exit()
move //= 3
x,y = x-move, y-move
if x < 0 or y < 0:
print(0)
exit()
ans = 1
for i in range(min(x,y)):
ans *= (x+y-i)
ans *= pow(i+1,mod-2,mod)
ans %= mod
print(ans)
|
p03254
|
s367074734
|
Wrong Answer
|
N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]
lst.sort(reverse = True)
cnt = 0
for i in range(0,N):
if x >= lst[i]:
x -= lst[i]
cnt += 1
else:
break
print(cnt)
|
p02923
|
s518046503
|
Accepted
|
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 10:13:10 2020
@author: Kanaru Sato
"""
N = int(input())
H = list(map(int, input().split()))
record = 0
count = 0
for i in range(0,N-1):
if H[i] >= H[i+1]:
count += 1
else:
record = max(count,record)
count = 0
ans = max(record,count)
print(ans)
|
p02880
|
s417360837
|
Wrong Answer
|
N = int(input())
num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
x = 0
for i in range(8):
if N/(9-i) in num:
x += 1
else:
x += 0
if x!= 0:
print("Yes")
else:
print("No")
|
p03252
|
s658947100
|
Wrong Answer
|
from collections import Counter
s = Counter(input())
t = Counter(input())
if len(s) != len(t):
print("No")
exit()
for x,y in zip(s.values(), t.values()):
if x != y:
print("No")
exit()
print("Yes")
|
p03281
|
s069026102
|
Wrong Answer
|
N = int(input())
if N >= 105 and N % 2 == 1:
print(1)
else:
print(0)
|
p02664
|
s700362994
|
Accepted
|
T = input()
print(T.replace('?', 'D'))
|
p02761
|
s236244049
|
Accepted
|
def get_ints():
return list(map(int, input().split()))
n, m = get_ints()
digits = [-1 for i in range(n)]
for i in range(m):
s, c = get_ints()
s -= 1
if digits[s] >= 0 and digits[s] != c:
print(-1)
exit(0)
digits[s] = c
if digits[0] == 0:
if n == 1:
print(0)
else:
print(-1)
exit(0)
if n > 1 and digits[0] == -1:
digits[0] = 1
print(''.join(map(lambda x: str(max(0, x)), digits)))
|
p02911
|
s570738118
|
Wrong Answer
|
n, k, q = map(int, input().split())
points = [k] * n
a = []
for i in range(q):
a.append(int(input())-1)
for cand in a:
points[cand] += 1
points = [i-q for i in points]
ans = ["YES" if i > 0 else "NO" for i in points]
print(*ans, sep="\n")
|
p02639
|
s268074177
|
Wrong Answer
|
l = list (map (int, input().strip().split()))
for i in l:
if i==0:
print(i+1)
|
p02767
|
s104219080
|
Accepted
|
N = int(input())
L = list(map(int,input().split()))
P = round(sum(L) / N)
A = []
for i in L:
x = (i - P)*(i-P)
A.append(x)
print(sum(A))
|
p02848
|
s058677529
|
Accepted
|
N = int(input())
S = list(input())
print("".join(chr(65+(ord(s)-65+N)%26) for s in S))
|
p03799
|
s108894810
|
Accepted
|
n,m=map(int,input().split())
if n*2>m:
print(m//2)
else:
print(n+(m-n*2)//4)
|
p02836
|
s138626599
|
Accepted
|
S = input()
res = 0
for i in range((len(S)//2)):
if S[i] != S[len(S)-i-1]:
res += 1
print(res)
|
p03785
|
s536184476
|
Accepted
|
n,c,k=map(int,input().split())
T=[int(input()) for i in range(n)]
T.sort()
ans=0; now=0; nowc=0
for ii in range(n):
if now>=T[ii] and nowc<c: nowc+=1; continue
now=T[ii]+k
nowc=1
ans+=1
print(ans)
|
p02772
|
s427190657
|
Accepted
|
from sys import exit
N = int(input())
for i in input().split():
if int(i) % 2 == 0:
if int(i) % 3 != 0 and int(i) % 5 != 0:
print('DENIED')
exit()
print('APPROVED')
|
p03455
|
s020868591
|
Wrong Answer
|
# 問題文
# シカのAtCoDeerくんは二つの正整数 a,bを見つけました。
# aとbの積が偶数か奇数か判定してください。
# 制約
# 1 <= a,b <= 10000
# a,bは整数
a, b = map(int, input() .split())
# 積が奇数なら、0dd と偶数なら Even と出力
if a * b % 2 == 0:
print('Even')
else:
print('0dd')
|
p03817
|
s489140307
|
Wrong Answer
|
import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()
def main():
x=II()
q,r=divmod(x,11)
ans=2*q+1+(r>6)
print(ans)
if __name__ == "__main__":
main()
|
p03695
|
s061118738
|
Wrong Answer
|
N = int(input())
rate = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
p = [0] * 9
A = [int(a) for a in input().split(" ")]
A.sort()
j = 0
for i in range(len(A)):
while j < 8:
if rate[j] <= A[i] < rate[j + 1]:
p[j] = 1
break
else:
j += 1
if j == 8:
p[8] = len(A[i:])
break
print(str(sum(p[:8])) + " " + str(sum(p)))
|
p02881
|
s089398862
|
Accepted
|
n=int(input())
import math
l= n-1
for i in range (1,int(math.sqrt(n))+1):
if n % i ==0 and i+ n/i -2<l:
l = i + n/i -2
print(int(l))
|
p02578
|
s138648444
|
Wrong Answer
|
a=input()
b=input()
c=b.split()
d=map(int,c)
main=list(d)
sum=0
print(main)
for i in range(len(main)-2):
stool=main[i]-main[i+1]
if stool>0:
main[i+1]+=stool
sum+=stool
stool=main[len(main)-2]-main[len(main)-1]
if stool>0:
sum+=stool
main[len(main)-1]+=stool
print(sum)
|
p03206
|
s146639833
|
Accepted
|
D = int(input())
if D == 25:
print("Christmas")
if D == 24:
print("Christmas Eve")
if D == 23:
print("Christmas Eve Eve")
if D == 22:
print("Christmas Eve Eve Eve")
|
p03774
|
s893964314
|
Wrong Answer
|
N, M = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(N)]
c = [list(map(int, input().split())) for _ in range(M)]
for i in range(N):
m = 0
for j in range(M):
if abs(s[i][0]-c[m][0]) + abs(s[i][1]-c[m][1]) > abs(s[i][0]-c[j][0]) + abs(s[i][1]-c[j][1]):
m = j
print(j+1)
|
p03035
|
s688490427
|
Wrong Answer
|
a,b = map(int, input().split())
if a<5:
print(0)
elif 6<=a<13:
print(int(b/2))
elif a>=13:
print(int(b))
|
p04045
|
s718063059
|
Accepted
|
N,K=map(int,(input().split()))
li=[]
m=set(input())
for j in range(N,100000):
if len(set(m & set(str(j))))==0:
print(j)
break
|
p02598
|
s077469338
|
Accepted
|
N, K = map(int, input().split())
*A, = map(int, input().split())
def f(t):
if t!=0:
c = 0
for i in A:
c += i//t if i!=t else 0
return c<=K
else:
return all(i<=t for i in A)
left, right = -1, 10**10
while right-left>1:
m = (right+left)//2
if f(m):
right = m
else:
left = m
print(right)
|
p03109
|
s509818736
|
Accepted
|
S=list(input())
s=S[:4]+S[5:7]+S[8:]
print("Heisei" if int(''.join(s))<=20190430 else "TBD")
|
p02994
|
s871366277
|
Accepted
|
n,m=map(int, input().split())
a = [(int(i)) for i in range(m, m+n)]
t=100000
ne = False
for i in range(len(a)):
if t>abs(a[i]):
inde = i
t=abs(a[i])
a[inde]=0
print(sum(a))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.