problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03206 | s040643937 | Wrong Answer | D=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')
|
p03359 | s038023483 | Accepted | a,b=map(int,input().split())
print(a if a<=b else a-1) |
p03665 | s813458485 | Accepted | N, P = map(int, input().split())
A = list(map(int, input().split()))
resZero = resOne = 0
for a in A:
if a % 2 == 0:
resZero += 1
else:
resOne += 1
if resOne == 0:
if P == 1:
print(0)
else:
print(2 ** N)
else:
print(2**(N-1)) |
p02760 | s959043878 | Accepted | A=[[int(i) for i in input().split()] for q in range(3)]
n=int(input())
tar=[]
for i in range(n):
ck=int(input())
for p in range(9):
if A[p//3][p%3] == ck:
tar.append(p)
def check(a,b,c):
if a in tar and b in tar and c in tar:
return 1
else:
return 0
res=check(0,1,2)+check(3,4,5)+check(6,7,8)+check(0,3,6)+check(1,4,7)+check(2,5,8)+check(0,4,8)+check(2,4,6)
if res == 0:
print("No")
else:
print("Yes") |
p03860 | s832728288 | Accepted | A,B,C=input().split()
print("A"+B[0]+"C") |
p04029 | s923495858 | Wrong Answer | N = 3
print(N *(N + 1) / 2)
N = 10
print(N * (N + 1) / 2)
N = 1
print(N * (N + 1) / 2) |
p03038 | s617335996 | Accepted | from operator import itemgetter
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [tuple(int(i) for i in input().split()) for _ in range(m)]
a.sort()
bc.sort(key=itemgetter(1), reverse=True)
idx = 0
b, c = bc[idx]
for i in range(n):
if a[i] >= c:
break
a[i] = c
b -= 1
if b == 0:
idx += 1
if idx >= m:
break
b, c = bc[idx]
print(sum(a))
|
p02725 | s553618271 | Wrong Answer | K,N=map(int,input().split())
A=sorted(list(map(int,input().split())))
max_a = max(A)
min_a = min(A)
diff_min = K
if max_a - min_a <= K/2:
print(max_a-min_a)
else:
if K - A[1] - min_a < max_a - min_a:
print(K - A[1] - min_a)
else:
print(max_a - min_a) |
p03331 | s732741382 | Accepted | n = input()
total = 0
for digit in n:
total += int(digit)
if total == 1:
print(10)
else:
print(total) |
p03481 | s021517532 | Accepted | def main():
x, y = (int(i) for i in input().split())
A = [x]
while A[-1]*2 <= y:
A.append(A[-1]*2)
print(len(A))
if __name__ == '__main__':
main()
|
p03067 | s672380935 | Accepted | A, B, C = map(int, input().split())
print('Yes' if A < C < B or B < C < A else 'No') |
p03721 | s694298166 | Accepted | n,k=map(int,input().split())
l=[0]*(10**5+1)
for i in range(n):
a,b=map(int,input().split())
l[a]+=b
sm=0
for i in range(1,10**5+1):
sm+=l[i]
if sm>=k:
print(i)
break |
p03474 | s353404115 | Wrong Answer | import sys
a,b=map(int,input().split())
ss=input().strip()
if len(ss) != (a+b+1):
print("No")
sys.exit()
#a 3 123-345
nums=[0,1,2,3,4,5,6,7,8,9]
for i in range(len(ss)):
if i==a:
if i!="-":
print("No")
sys.exit()
elif i not in nums:
print("No")
sys.exit()
print("Yes") |
p03555 | s147950789 | Accepted | arr = [[''] * 3 for i in range(2)]
for i in range(2):
tmp = input()
tmp = list(tmp)
arr[i] = tmp
if arr[0][0] == arr[1][2] and arr[0][1] == arr[1][1] and arr[0][2] == arr[1][0]:
print('YES')
else:
print('NO')
|
p02726 | s753319820 | Accepted | n,x,y = map(int,input().split())
dist_list = [0 for _ in range(n)]
for i in range(1,n+1):
for j in range(i+1,n+1):
if j <= x or i >= y:
distance = j-i
else:
distance = min(j-i,abs(x-i)+abs(y-j)+1)
dist_list[distance] += 1
for i,dist in enumerate(dist_list):
if i >= 1:
print(dist) |
p02796 | s922635989 | Wrong Answer | import numpy as np
N=int(input())
#A=[int(x) for x in input().split()]
XL=[]
for i in range(N):
XL.append(list(map(int,list(input().split()))))
XL=np.asarray(XL)
XLs=XL[np.argsort(XL[:,0])]
right=XLs[0][0]+XLs[0][1]
ans=1
for i in range(N-1):
if XLs[i+1][0]-XLs[i+1][1]-right>=0:
ans+=1
right=XLs[i+1][0]-XLs[i+1][1]
#ans=XLs
print(ans)
|
p03407 | s887233886 | Wrong Answer | a,b,c = map(int,input().split())
if c >= a + b:
print('Yes')
else:
print('No') |
p03323 | s600172477 | Wrong Answer | a,b = map(int,input().split())
kaku_a = 360/16 * a
kaku_b = 360/16 * b
if kaku_a < 180 and kaku_b < 180:
print('Yey!')
else:
print(':(') |
p03011 | s043752281 | Wrong Answer | a=list(map(int,input().split()))
a=sorted(a)
con=0
for i in range(1):
con+=a[i]
print(con) |
p02948 | s981321878 | Accepted | import heapq
N, M = map(int, input().split())
day_rew = {}
for _ in range(N):
a, b = map(int, input().split())
day_rew.setdefault(a,[])
day_rew[a].append(b)
ans = 0
job_rew = []
heapq.heapify(job_rew)
for i in range(1, M+1):
if i in day_rew:
for r in day_rew[i]:
heapq.heappush(job_rew, r*(-1))
if job_rew:
this_day_rew = heapq.heappop(job_rew)*(-1)
ans += this_day_rew
print(ans)
|
p03479 | s669271568 | Accepted | n,k=map(int,input().split())
c=0
s=n
while(s<=k):
c=c+1
s=s*2
print(c)
|
p02683 | s684660891 | Wrong Answer | n,m,x = map(int,input().split())
book = [list(map(int,input().split())) for _ in range(n)]
ans = 12 * (10**5) + 1
for i in range(2**n):
kingaku = 0
rikaido = [0] * m
for j in range(n):
if (i >> j) & 1:
kingaku += book[j][0]
for k in range(m):
rikaido[k] += book[j][1]
if all((a >= x for a in rikaido)):
ans = min(ans,kingaku)
if ans != 12 * (10**5) + 1:
print(ans)
else:
print("-1") |
p02948 | s245950712 | Accepted | import heapq
n,m=map(int,input().split())
t=[[] for _ in range(m+1)]
for i in range(n):
a,b=map(int,input().split())
if a>m:
continue
t[a].append(b)
ans=0
h=[]
for l in t:
for i in l:
heapq.heappush(h,-i)
if h:
ans-=heapq.heappop(h)
print(ans) |
p02958 | s711860416 | Wrong Answer | N=int(input())
p=list(map(int,input().split()))
q=sorted(p)
count=0
for i in range(N):
if p[i]!=q[i]:
count+=1
if count<=2:
print('YES')
else:
print('NO')
|
p03438 | s346470349 | Accepted | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_diffA = 0
sum_diffB = 0
for i, (ai, bi) in enumerate(zip(A,B)):
if ai == bi:
continue
elif ai > bi:
sum_diffB += (ai - bi)
elif ai < bi:
diffA = (bi - ai)
sum_diffA += diffA // 2 + diffA % 2
sum_diffB += diffA % 2
if sum_diffA >= sum_diffB:
print('Yes')
else:
print('No')
|
p03131 | s043526630 | Accepted | N,A,B = list(map(int,input().split()))
another=1+1*N
ans =A
N -= A-1
ans += N//2 * (B-A)
ans += N%2
print(max(ans,another)) |
p02699 | s843569265 | Accepted | S, W = map(int, input().split())
print("unsafe") if W >= S else print("safe")
|
p03086 | s588686127 | Accepted | S = input()
x = ['A', 'C', 'T', 'G']
i = 0
count = 0
ans = 0
while i < len(S):
if S[i] in x:
count += 1
ans = max(ans, count)
else:
count = 0
i += 1
print(ans)
|
p03075 | s080284284 | Accepted | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
m = 0
m = max(m, b-a)
m = max(m, c-a)
m = max(m, d-a)
m = max(m, e-a)
m = max(m, c-b)
m = max(m, d-b)
m = max(m, e-b)
m = max(m, d-c)
m = max(m, e-c)
m = max(m, e-d)
if m > k:
print(":(")
else:
print("Yay!") |
p03352 | s626787465 | Accepted | import math
x=int(input())
ans=1
for i in range(2,math.ceil(x**(0.5))):
j=2
tmp = i**j
while tmp<=x and x!=1:
ans = max(ans, tmp)
j+=1
tmp = i**j
print(ans) |
p02584 | s734040556 | Wrong Answer | X, K, D = map(int, input().split())
a = 1
if X < 0:
X *= -1
if X > K*D:
print(X - K*D)
else:
for i in range(K):
if X - D*i > 0:
a += 1
if -(X - D*a) > (X - D*(a - 1)):
X -= D*(a - 1)
else:
X = (X - D*a)
print(X)
break |
p02712 | s167992025 | Wrong Answer | a = list(map(int, input().split()))
b = 0
for i in range(a[0]):
if i % 15 == 0:
b = b
elif i % 3 == 0:
b = b
elif i % 5 == 0:
b = b
else:
b += i
print(b) |
p02879 | s260480847 | Wrong Answer | A,B=map(int,input().split())
print(A*B if 1<=A<=9 and 1<=B<=9 else "–1") |
p03943 | s272570447 | Accepted | L=list(map(int,input().split()))
S=sorted(L)
if S[0]+S[1]==S[2] or S[0]==S[1]+S[2]:
print("Yes")
else:
print("No") |
p03778 | s745488297 | Accepted | w,a,b = map(int, input().split())
if b>a+w:
print(b-a-w)
elif a>b+w:
print(a-b-w)
else:
print(0) |
p03481 | s576449345 | Wrong Answer | x, y = map(int, input().split())
for i in range(y):
if x * 2**i <= y:
continue
else:
print(i)
break |
p02633 | s524455914 | Wrong Answer | t=int(input())
if(360%t==0):
print(int(360/t))
else:
t=360/t
s=360%t
print(t*s)
|
p02882 | s063110155 | Wrong Answer | import sys
readline = sys.stdin.readline
A,B,X = map(int,readline().split())
bottle = (A ** 2) * B
x = -1
y = -1
import math
area = X / A
if X < bottle / 2:
y = (X * 2 / B) / A
x = B
print(90 - math.degrees(math.atan(y/x)))
else:
print("kocchi")
x = (bottle - X) * 2 / (A ** 2)
y = A
print(x,y)
if x == 0:
print(0)
else:
print(90 - math.degrees(math.atan(y/x)))
|
p02690 | s896948923 | Accepted | x=int(input())
for a in range(120):
for b in range(-99,a):
if a**5-b**5==x: print(a,b); exit() |
p02699 | s160493429 | Accepted | s,w=map(int, input().split())
if s<=w:
print('unsafe')
else:
print('safe') |
p03773 | s025084060 | Wrong Answer | a,b=map(int,input().split())
print(max(a+b,a+b-24)) |
p02660 | s231039244 | Wrong Answer | import math
N = int(input())
N1 = N
use_li = [0]*(math.ceil(math.sqrt(N))+1)
c = 0
while N!=1:
for i in range(2,math.ceil(math.sqrt(N))+1):
if(N%i==0 and use_li[i]==0):
#print(i)
use_li[i] = 1
N //= i
c += 1
break
#print(N,i,math.ceil(math.sqrt(N)))
if (i==math.ceil(math.sqrt(N))):
if((len(use_li)<=N or use_li[N] == 0) and N==N1):
c += 1
break
print(c) |
p02645 | s042092621 | Accepted | S = input()
ss = str()
for s in S:
ss = ss + s
if len(ss)==3:
print (ss)
break |
p03861 | s143378865 | Accepted | a,b,x = map(int,input().split())
if a==0 and b==0:
print(1)
elif a == 0:
print(b//x+1)
else:
print(b//x - (a-1)//x) |
p03086 | s478660369 | Accepted | S = input()
ACGT = 'ACGT'
ans = 0
temp = 0
for x in S:
if x in ACGT:
temp += 1
else:
ans = max(ans, temp)
temp = 0
ans = max(ans, temp)
print(ans) |
p02612 | s108539502 | Accepted | N = int(input())
left = N % 1000
if left == 0:
print(0)
else:
print(1000 - left) |
p02631 | s849474077 | Accepted | n, *a = map(int, open(0).read().split())
ans = 0
for i in a:
ans = ans ^ i
for j in a:
print(ans ^ j) |
p03637 | s526097550 | Wrong Answer | n = int(input())
lst = list(map(int, input().split()))
count4 = 0
count2 = 0
for i in lst:
if i%4==0:
count4+=1
elif i%2==0:
count2+=1
count1 = n-count4-count2
if count4*2>=count1:
print("Yes")
else:
print("No")
|
p03637 | s072440617 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
a =[int(i) for i in input().split()]
x = 0
y = 0
z = 0
for i in range(N) :
if a[i] % 2 != 0 :
x+=1
elif a[i] % 2 == 0 and a[i] % 4 != 0 :
y += 1
else :
z +=1
ans = "No"
if y >= 1 :
y = 1
if x <= z :
ans = "Yes"
else :
if x <= z + 1 :
ans = "Yes"
print(ans) |
p03000 | s169534109 | Accepted | import bisect
n, x = map(int, input().split())
L = list(map(int, input().split()))
D = [0]
ans = 1
for i in range(1, n+1):
d = D[i-1] + L[i-1]
D.append(d)
if d <= x:
ans += 1
else:
break
print(ans) |
p03106 | s157954776 | Wrong Answer | A,B,K = map(int,input().split())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
lstA = make_divisors(A)
lstB = make_divisors(B)
#print(lstA,lstB)
fin = []
for i in lstA:
if i in lstB:
fin.append(i)
#print(fin)
print(fin[K-1])
|
p03095 | s289913643 | Accepted | n = int(input())
s = input()
mod = 10 ** 9 + 7
dict = {ch: 0 for ch in 'abcdefghijklmnopqrstuvwxyz'}
for i in range(n):
dict[s[i]] += 1
ans = 1
for x in dict.values():
ans = ans * (x+1) % mod
print((ans - 1) % mod) |
p03077 | s141068403 | Accepted | import math
n,*l=map(int,open(0).read().split())
print(4+math.ceil(n/min(l)))
|
p03001 | s425480922 | Accepted | W, H, x, y = map(int, input().split())
print(W * H / 2, int(x + x == W and y + y == H))
|
p03041 | s752601267 | Accepted | N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))
|
p02972 | s942234118 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n, 0, -1):
if sum(b[i-1::i]) % 2 == a[i-1]:
continue
else:
b[i-1] = 1
c = []
for i in range(n):
if b[i] == 1:
c.append(i+1)
print(sum(b))
if len(c) > 0:
print(*c) |
p03162 | s412603148 | Accepted | n=int(input())
dp=[[0]*3 for i in range(n)]
happy=[]
for i in range(n):
tmp=list(map(int,input().split()))
happy.append(tmp)
dp[0][0]=happy[0][0]
dp[0][1]=happy[0][1]
dp[0][2]=happy[0][2]
for i in range(1,n):
dp[i][0] = max(dp[i-1][1],dp[i-1][2])+happy[i][0]
dp[i][1] = max(dp[i-1][0],dp[i-1][2])+happy[i][1]
dp[i][2] = max(dp[i-1][0],dp[i-1][1])+happy[i][2]
print(max(dp[n-1][0],dp[n-1][1],dp[n-1][2]))
|
p02995 | s648528627 | Wrong Answer | import fractions
A, B, C, D = [int(i) for i in input().split()]
l = (C * D) // fractions.gcd(C,D)
b_sum = B -(B//C) - (B//D) + (B//l)
a_sum = A - (A//C) - (A//D) + (A//l)
print(b_sum - a_sum) |
p02924 | s952972634 | Wrong Answer | N = int(input())
print(int((N/2) * (N - 1)))
|
p03206 | s467615460 | Accepted | c = ["Christmas"]
D = int(input())
print(" ".join(c + ["Eve" for _ in range(25-D)]))
|
p03239 | s138151479 | Accepted | n, t = map(int, input().split())
ans = 1001001001
for _ in range(n):
ci, ti = map(int, input().split())
if ti <= t:
ans = min(ans, ci)
if ans == 1001001001:
print('TLE')
else:
print(ans) |
p02761 | s160628133 | Accepted | import sys
N,M =map(int, input().split())
a = [input().split() for l in range(M)]
for i in range(1000):
flag = 1
b = str(i)
if len(b)!= N:
flag = 0
continue
for j in range(M):
if b[int(a[j][0])-1] != a[j][1]:
flag = 0
break
if flag == 1:
print(i)
sys.exit()
print("-1") |
p02835 | s913509756 | Wrong Answer | def main():
A = list(map(int, input().split()))
if sum(A) <= 22:
print('win')
else:
print('bust')
main() |
p02723 | s868805269 | Wrong Answer | # -*- coding: utf-8 -*-
s = input()
if s[2]==s[3] or s[4]==s[5]:
print('Yes')
else:
print('No') |
p02720 | s776883440 | Wrong Answer | import heapq
k = int(input())
lunlun = [1,2,3,4,5,6,7,8,9]
heapq.heapify(lunlun)
for i in range(1,10**5):
x = heapq.heappop(lunlun) #最小値
y = x % 10
if i == k :
break
if y != 0:
heapq.heappush(lunlun, x * 10 + y- 1)
heapq.heappush(lunlun,10*x+y)
if y != 9:
heapq.heappush(lunlun, x * 10 + y + 1)
#print(lunlun)
print(x)
|
p02555 | s481484769 | Accepted | S = int(input())
M = 10 ** 9 + 7
def mod_comb(n, k, mod):
ret = 1
for i in range(1, k+1):
ret = (ret * (n+1-i)) % mod
ret = (ret * pow(i, mod-2, mod)) % mod
return ret
ans = 0
for K in range(1, S // 3 + 1):
ans = (ans + mod_comb(S - 2 * K - 1, K - 1, M)) % M
print(ans)
|
p03243 | s856941610 | Accepted | n = int(input())
a = (n + 111 - 1) // 111
print(a * 111) |
p02780 | s123152807 | Accepted | n,k=map(int,input().split())
i=list(map(int,input().split()))
l=[0]*(n-k)
for j in range(n-k):
l[j]=i[j+k]-i[j]
place=0
plus=0
for j in range(n-k):
plus=plus+l[j]
if plus>0:
place=j+1
plus=0
a=0.0
for j in range(k):
a+=float(i[j+place]+1)/2
print(a) |
p02546 | s836549436 | Accepted | S = input()
if S[-1]=='s':
print(S+'es')
else:
print(S+'s') |
p02970 | s433515568 | Accepted | import sys
N, D = map(int, sys.stdin.readline().split())
print((N - 1)// (2*D+1) + 1) |
p03345 | s347923945 | Accepted | def main():
a, b, c, k = map(int, input().split())
if k % 2 == 0:
ans = a - b
if abs(ans) > 10 ** 18:
print("Unfair")
else:
print(ans)
else:
ans = b - a
if abs(ans) > 10 ** 18:
print("Unfair")
else:
print(ans)
if __name__ == "__main__":
main()
|
p02646 | s269425412 | Wrong Answer | a,v =map(int, input().split())
b,w =map(int, input().split())
t=int(input())
if a < b :
if a+v*t >= b+w*t :
print('YES')
else :
print('NO')
else :
if a+v*t <= b+w*t :
print('YES')
else :
print('NO') |
p03136 | s393071821 | Accepted | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
N = I()
L = LI()
s = sum(L)
m = max(L)
print('Yes' if m < s-m else 'No')
|
p02939 | s862971467 | Accepted | S = input()
tmp = ""
cha = ""
lst = []
for i in range(len(S)):
cha += S[i]
if(cha != tmp):
lst.append(cha)
tmp = cha
cha = ""
print(len(lst)) |
p03524 | s549014858 | Accepted | s = input()
a_cnt = s.count('a')
b_cnt = s.count('b')
c_cnt = s.count('c')
if max(a_cnt, b_cnt, c_cnt) <= min(a_cnt, b_cnt, c_cnt) + 1:
ans = 'YES'
else:
ans = 'NO'
print(ans) |
p02796 | s046500160 | Accepted | # -*- coding: utf-8 -*-
N = int(input())
U = []
for i in range(N):
x, l = (map(int,input().split()))
u = [x+l,x-l]
U.append(u)
U.sort()
ans = 1
x = U[0][0]
for i in range(N-1):
if U[i+1][1] >= x:
ans += 1
x = U[i+1][0]
print(ans) |
p02615 | s045818835 | Wrong Answer | n=int(input())
arr=sorted(list(map(int,input().split())))
t=sum(arr)
print(t-arr[0]) |
p03719 | s447224552 | Wrong Answer | a,b,c=map(int,input().split())
if a<c and b>c:
print("Yes")
else:
print("No")
|
p04011 | s667943831 | Wrong Answer | n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(x*k+y*(n-k)) |
p02571 | s328247315 | Accepted | S = input()
T = input()
change_num = 1000000000
count = 0
for i in range(len(S)):
if (len(T) + i) > len(S):
break
s = S[i:len(T) + i]
for j, k in enumerate(s):
if k != T[j]:
count += 1
if count < change_num:
change_num = count
count = 0
print(change_num)
|
p03146 | s415646798 | Accepted | s=int(input())
a=[s]
a_before=s
ans=1
while True:
buf=0
ans+=1
if a_before%2==0:
buf=a_before//2
else:
buf=3*a_before+1
if buf in a:
break
a.append(buf)
a_before=buf
print(ans) |
p02996 | s815866582 | Accepted | N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
time = 0
for A,B in AB:
time += A
if time > B:
print('No')
break
else:
print('Yes') |
p02820 | s718463296 | Wrong Answer | n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
lr, ls, lp = -n, -n, -n
ans = 0
for i in range(n):
if t[i] == "r":
if k != i+1-lr:
ans += p
lr = i+1
elif t[i] == "s":
if k != i+1-ls:
ans += r
ls = i+1
else:
if k != i+1-lp:
ans += s
lp = i+1
print(ans) |
p02835 | s032336686 | Accepted | l = list(map(int, input().split()))
if sum(l) >= 22:
print('bust')
else:
print('win')
|
p02615 | s949034444 | Wrong Answer | N = int(input())
A_i = list(map(int, input().split()))
forret = sorted(A_i)
ret = A_i[-1]
for i in range(N-2):
print('A')
print('ret', ret)
ret = ret + forret[-1-1-(i//2)]
print(ret)
|
p03730 | s722167148 | Wrong Answer | A, B, C = map(int, input().split())
for k in range(B):
if (k * A) % B == C: print("Yes"); exit()
print("No") |
p03042 | s209656904 | Wrong Answer | s = input()
s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])
if s1 == s2 == 0:
print('NA')
elif s1 <= 12 and s2 <= 12:
print('AMBIGUOUS')
elif s1 <= 12:
print('MMYY')
elif s2 <= 12:
print('YYMM')
else:
print('NA') |
p03309 | s733288471 | Accepted | import numpy as np
n = int(input())
a = [int(x) for x in input().split()]
a2 = [a[i] - i - 1 for i in range(n)]
mean = sum(a2) / len(a2)
median = np.median(np.array(a2))
b = np.floor(median)
a3 = sum([abs(a2[i] - b) for i in range(n)])
b = np.ceil(median)
a4 = sum([abs(a2[i] - b) for i in range(n)])
print(int(min(a3, a4)))
|
p02755 | s374095335 | Accepted | A,B = list(map(int,input().split()))
X = []
mA = int(100/8*A)
MA = int(100/8*(A+1))+1
mB = int(10*B)
MB = int(10*(B+1))+1
for i in range(max(mA,mB),min(MA,MB)):
X.append(i)
#print(X)
f = True
for i in X:
if int(i*0.08)==A and int(i*0.1)==B:
print(i)
f = False
break
if f:
print(-1) |
p03281 | s154314538 | Accepted | n=int(input())
count=0
ans=0
for j in range(1,n+1,2):
count=0
for i in range(1,int(j**0.5)+1):
if j%i==0:
if j//i!=i:
count+=2
else:
count+=1
if count==8:
ans+=1
print(ans)
|
p02859 | s051821274 | Accepted | r=int(input())
print(r**2) |
p02796 | s992382275 | Wrong Answer | def main():
N, *XL = map(int, open(0).read().split())
# print(N, XL)
robots = [0]*N
for i in range(N):
X, L = XL[2 * i + 0], XL[2 * i + 1]
robots[i] = (X - L, X + L)
robots.sort(key=lambda x: x[1])
# print(robots)
ans = 0
last = robots[0][0] - 1
for robot in robots:
if last <= robot[1]:
last = robot[1]
ans += 1
print(ans)
if __name__ == '__main__':
main()
|
p03241 | s828540741 | Accepted | from functools import reduce
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
n,m=map(int,input().strip().split(" "))
fact=sorted(factors(m),reverse=True)
ans=1
for i in fact:
if m//i >=n:
ans=i
break
print(ans)
|
p03455 | s471804412 | Wrong Answer | a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
print("even")
else:
print("odd") |
p02916 | s935226275 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(n-1):
if a[i+1] - a[i] == 1:
ans += c[a[i]-1]
print(ans) |
p02747 | s248265144 | Accepted | S = input()
if S == 'hi' or S == 'hihi' or S == 'hihihi' or S == 'hihihihi' or S == 'hihihihihi':
print('Yes')
else:
print('No') |
p03495 | s098962020 | Accepted | n,k = map(int,input().split())
a = [int(i) for i in input().split()]
dct = {}
for i in range(n):
if a[i] not in dct:
dct[a[i]] = 1
else:
dct[a[i]] += 1
l = len(dct)
if l <= k:
ans = 0
else:
na = sorted([int(dct[key]) for key in dct])
ans = sum(na[:l-k])
print(ans) |
p02797 | s947847295 | Accepted | n,k,s=map(int,input().split())
ans = (str(s) + ' ')*k + (str(s-1 or 8) + ' ')*(n-k)
print(ans[:-1]) |
p03437 | s491449168 | Accepted | x,y = map(int,input().split())
if x%y == 0:
print(-1)
else:
print(x) |
p02933 | s873332347 | Wrong Answer | n = int(input())
if n >= 3200:
print('red')
else:
print(input()) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.