problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02706 | s243675869 | Wrong Answer | #cording:utf-8
import math
N,M=map(int,input().split())
s = [int(M) for M in input().split()]
print(N,M)
print(s)
sum(s)
Pr=N-sum(s)
if Pr<= N:
print(Pr)
else:
print(-1)
|
p03617 | s978671990 | Wrong Answer | Q, H, S, D = list(map(int, input().split()))
Q *= 8
H *= 4
S *= 2
A = min(Q, H, S, D)
B = min(Q, H, S) / 2
N = int(input())
print(int(N//2*A+N%2*B)) |
p03150 | s574073926 | Wrong Answer | import copy
s=input()
check="keyence"
tmp=6
for i in reversed(s):
if i == check[tmp]:
tmp-=1
else:
break
if tmp == -1:
print("YES")
exit()
tmp2=len(s)-(6-tmp)-1
for i in reversed(s[:tmp2+1]):
if i != check[tmp]:
tmp2-=1
else:
break
if tmp2 == 0:
print("YES")
exit()
tmp3=0
for i in range(tmp2,-1,-1):
if s[i] == check[tmp]:
tmp-=1
else:
print("NO")
exit()
if tmp == -1:
tmp3=i
break
if tmp3 == 0:
print("YES")
else:
print("NO") |
p02711 | s493705514 | Wrong Answer | N = input()
flag = False
for char in N:
if char == '7':
print('Yes')
flag = True
if flag == False:
print('No') |
p03434 | s644646468 | Wrong Answer | N = int(input())
card = list(map(int,input().split()))
sorted_card = sorted(card)
Alice = 0
Bob = 0
for i in range(N):
if i == 0 or i % 2 == 0:
Alice += sorted_card[i]
else:
Bob += sorted_card[i]
print(Alice - Bob) |
p02712 | s842443218 | Wrong Answer | n = int(input())
ans = 0
for i in range(1, n):
if i % 15 == 0:
ans = ans + 0
elif i % 3 == 0:
ans = ans + 0
elif i % 5 == 0:
ans = ans + 0
else:
ans += i
print(ans)
|
p03163 | s579713702 | Wrong Answer | import numpy as np
n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]
dp = np.zeros((n+1, w), np.int64)
for i in range(n):
for sum_w in range(w):
wi = wv[i][0]
vi = wv[i][1]
if sum_w - wi >= 0:
dp[i+1][sum_w] = dp[i][sum_w - wi] + vi
dp[i+1][sum_w] = max(dp[i][sum_w], dp[i+1][sum_w])
print(dp[n][w-1]) |
p02705 | s745882931 | Accepted | import math
R = int(input())
p = math.pi
print(2*R*p)
|
p02760 | s925628347 | Accepted | a=[list(map(int,input().split()))for _ in range(3)]
for i in range(int(input())):
b=int(input())
for j in range(3):
for k in range(3):
if a[j][k]==b:a[j][k]=0
ans="No"
for i in range(3):
if a[i][0]==a[i][1]==a[i][2]==0:ans="Yes"
if a[0][i]==a[1][i]==a[2][i]==0:ans="Yes"
if a[0][0]==a[1][1]==a[2][2]==0:ans="Yes"
if a[2][0]==a[1][1]==a[0][2]==0:ans="Yes"
print(ans) |
p03380 | s164261914 | Accepted | import sys
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = [-1, 0, 0]
import bisect
i = a[-1]
idx = [bisect.bisect_left(a, i / 2), bisect.bisect_left(a, i / 2) - 1]
if abs(i / 2 - a[idx[0]]) < abs(i // 2 - a[idx[1]]):
print(i, a[idx[0]])
else:
print(i, a[idx[1]])
|
p02988 | s677620699 | Accepted | def main():
n = int(input())
p = list(map(int, input().split(" ")))
result = 0
for i in range(1, n - 1):
if p[i - 1] < p[i] < p[i + 1] or p[i + 1] < p[i] < p[i - 1]:
result += 1
print(result)
if __name__ == '__main__':
main() |
p03407 | s321047144 | Accepted | A, B, C = map(int, input().split())
if A + B >= C:
print("Yes")
else:
print("No")
|
p03785 | s823050412 | Wrong Answer | n,c,k = map(int,input().split())
t_tmp = 10**9+1
cnt = 0
buses = 0
for i in range(n):
t = int(input())
cnt +=1
if t >= t_tmp+k or cnt >= c:
buses += -(-cnt//c)
cnt = 0
t_tmp = t
t_tmp = min(t_tmp,t)
# print(i,t,t_tmp+k,cnt,buses)
buses += -(-cnt//c)
print(buses) |
p02861 | s780908372 | Accepted | from itertools import permutations
import math
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
m = math.factorial(n)
p = list(permutations(l))
d = 0
for i in range(m):
for j in range(n-1):
x = p[i][j][0] - p[i][j-1][0]
y = p[i][j][1] - p[i][j-1][1]
d += math.sqrt(x**2 + y**2)
print(d/m) |
p03633 | s286527074 | Accepted | import math
N = int(input())
T = []
for i in range(N):
T.append(int(input()))
ans = T[0]
for i in range(1, N):
ans = ans * T[i] // math.gcd(ans, T[i])
print(ans)
|
p04045 | s173131870 | Accepted | n,k=map(int,input().split())
d=list(map(int,input().split()))
x=list(range(1,100001))
y=[0]*100000
for i in range(100000):
s=str(i)
S=len(s)
for j in range(S):
if int(s[j]) in d:
y[i-1]=1
break
for i in range(100000):
if i>=n-1:
if y[i]==0:
print(i+1)
break |
p03289 | s035014423 | Accepted | S = list(input())
if S[0] != "A":
print("WA")
elif S[2:-1].count("C") != 1:
print("WA")
else:
S.remove("A")
S.remove("C")
S = "".join(S)
if S.islower():
print("AC")
else:
print("WA") |
p03556 | s708074650 | Accepted | n = int(input())
while True:
if (n**0.5).is_integer():
print(n)
break
else:
n-=1 |
p03434 | s946330491 | Wrong Answer | N=int(input())
numbers=list(map(int,input().split()))
for i in range(N):
for k in range(i+1):
if numbers[k]<numbers[i]:
temp=numbers[k]
numbers[k]=numbers[i]
numbers[i]=temp
break
Alice=0
Bob=0
for i in range(N//2+N%2):
Alice+=numbers[2*i]
for i in range(N//2):
Bob+=numbers[2*i+1]
print(Alice-Bob) |
p02848 | s927452274 | Wrong Answer | N = int(input())
S = list(input())
for i in range(len(S)):
if ord(S[i])+2 <= 90:
S[i] = chr(ord(S[i])+N)
else:
S[i] = chr(ord(S[i])+N-26)
for j in S:
print(j,end = "") |
p03795 | s215056471 | Accepted | N = int(input())
print(N*800-(N//15)*200) |
p03633 | s988416333 | Wrong Answer | from fractions import gcd
n = int(input())
l = list(int(input()) for _ in range(n))
def lcm_base(x,y):
return x*y/gcd(x,y)
ans =1
for i in l:
ans = lcm_base(ans,i)
print(int(ans)) |
p02759 | s534286105 | Accepted | print(-1*(-int(input())//2)) |
p02918 | s857922250 | Accepted | n,k = map(int,input().split())
s = input()
cnt = 0
for i in range(len(s)):
if s[i] == 'L':
if i == 0:
continue
if s[i-1] == 'L' :
cnt += 1
else:
if i == len(s) - 1:
continue
if s[i+1] == 'R' :
cnt += 1
print(min(n-1,cnt + k*2)) |
p03472 | s459841079 | Wrong Answer | import math
N, H = map(int, input().split())
max_swing = 0
throw = []
for _ in range(N):
a, b = map(int, input().split())
max_swing = max(max_swing, a)
throw.append(b)
throw.sort(reverse=True)
min_cnt = int(math.ceil(H / max_swing))
throw_cnt = 0
for t in throw:
H -= t
throw_cnt += 1
cnt = throw_cnt + int(math.ceil(H / max_swing))
if H <= 0:
min_cnt = min(throw_cnt, cnt)
break
min_cnt = min(cnt, min_cnt)
print(min_cnt)
|
p03103 | s620267259 | Accepted | n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
cnt = 0
ans = 0
for a,b in ab:
cnt += b
ans += a * b
if cnt >= m:
if cnt > m: ans -= a * (cnt-m)
break
print(ans) |
p02630 | s833487583 | Accepted | from collections import Counter
N = int(input())
A = [int(i) for i in input().split()]
Q = int(input())
B, C = [], []
for i in range(Q):
b, c = map(int, input().split())
B.append(b)
C.append(c)
dic = Counter(A)
ans = 0
for k, v in dic.items():
ans += k*v
for i in range(Q):
b, c = B[i], C[i]
dic[c] += dic[b]
ans += - b*dic[b] + c*dic[b]
del dic[b]
print(ans)
|
p03944 | s626885961 | Wrong Answer | w,h,n = map(int,input().split())
xya = [list(map(int,input().split())) for i in range(n)]
minx = 0
maxx = w
miny = 0
maxy = h
for i in range(n):
if xya[i][2] == 1:
minx = xya[i][0]
if xya[i][2] == 2:
maxx = xya[i][0]
if xya[i][2] == 3:
miny = xya[i][1]
if xya[i][2] == 4:
maxy = xya[i][1]
if minx >= maxx or miny >= maxy:
print(0)
else:
print((maxx-minx)*(maxy-miny))
|
p03286 | s061055178 | Accepted | import sys
def I():
return int(sys.stdin.readline().rstrip())
N = I()
if N == 0:
print(0)
exit()
ans = ''
r = 0
while N != 0:
if N % 2 == 1:
ans = '1' + ans
N -= (-1)**r
else:
ans = '0' + ans
N //= 2
r += 1
print(ans) |
p03681 | s485807559 | Accepted | def fac(n, p):
ret = 1
for i in range(2, n + 1):
ret = ret * i % p
return ret
N, M = [int(x) for x in input().split()]
p = 10 ** 9 + 7
if abs(N - M) >= 2:
ans = 0
elif N == M:
ans = 2 * fac(N, p) * fac(M, p) % p
else:
ans = fac(N, p) * fac(M, p) % p
print(ans) |
p03284 | s831777269 | Accepted | n, k = map(int, input().split())
if n % k == 0:
print(0)
else:
print(1)
|
p03076 | s798257871 | Wrong Answer | A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
dishes = [A, B, C, D, E]
tens = 0
ones = 9
muda = 0
for d in dishes:
if d % 10 == 0:
tens += d // 10
else:
tens += d // 10 + 1
if d % 10 < ones:
muda = d
ones = d % 10
#%%
ans = tens * 10 - (10 -muda % 10)
print(ans) |
p02772 | s109522447 | Accepted | def main():
n = int(input())
*a, = map(int, input().split())
bool_ = any(x for x in a if (x % 2 == 0) and not (x % 3 == 0 or x % 5 == 0))
print('DENIED' if bool_ else 'APPROVED')
if __name__ == '__main__':
main()
|
p02552 | s943528905 | Accepted | x = int(input(''))
if x == 0:
x = 1
else:
x = 0
print(x) |
p03327 | s947424106 | Accepted | print("ABC" if int(input())<1000 else "ABD") |
p03077 | s627181156 | Accepted | #!/usr/bin/env python3
from math import ceil
n, a, b, c, d, e = map(int, open(0).read().split())
s = min(a, b, c, d, e)
print(4 + ceil(n/s))
|
p03243 | s426438210 | Accepted | N = int(input())
for i in range(1,10):
tmp = i * 111
if (N <= tmp):
print(tmp)
break
|
p02813 | s590272727 | Wrong Answer | N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
from itertools import permutations
p,q=0,0
for i,R in enumerate(permutations(range(1,N+1))):
if P==R:
p=i
elif Q==R:
q=i
print(abs(p-q)) |
p03013 | s985621667 | Accepted | N, M = map(int, input().split())
dp = [0 for _ in range(N+1)]
skip = {}
for _ in range(M):
skip[int(input())] = 1
dp[1] = 1
if N >= 2:
dp[2] = 2
if 1 in skip:
dp[1] = 0
if N >= 2:
dp[2] = 1
if 2 in skip:
if N >= 2:
dp[2] = 0
for i in range(3, N+1):
if i in skip:
continue
dp[i] = (dp[i-1] + dp[i-2]) % 1000000007
print(dp[N])
|
p03803 | s913648137 | Accepted | a,b=map(int,input().split())
print("Draw" if a==b else "Bob" if (a+13)%15<(b+13)%15 else "Alice") |
p03681 | s002180071 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()
INF = float('inf')
MOD = 10 ** 9 + 7
n, m = LI()
if abs(n - m) > 1:
print(0)
sys.exit()
ans = 1
for i in range(1, n + 1):
ans = ans * i % MOD
for i in range(1, m + 1):
ans = ans * i % MOD
if n == m:
ans = ans * 2 % MOD
print(ans % MOD)
|
p03317 | s939460286 | Accepted | import math
n,k=map(int,input().split());a=list(map(int,input().split()))
print([math.ceil((n-k)/(k-1))+1,1][n==k]) |
p02935 | s976739615 | Wrong Answer | N = int(input())
V = list(map(int, input().split()))
C = sorted(V)
print(C)
ans = 0
a = C[0]
for i in range(1, N):
a = (a + C[i]) / 2
ans = max(ans, a)
print(ans) |
p02933 | s663797591 | Wrong Answer | a = int(input())
s = input()
print("red" if a >= 3200 else "s")
|
p02993 | s612273757 | Accepted | # ABC131
# A Security
S = input()
sl = len(S)
for i in range(sl-1):
if S[i] == S[i+1]:
print('Bad')
exit()
print('Good')
|
p03645 | s784332812 | Wrong Answer | import sys
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
numa,numb=map(int,input().split())
a.append(numa)
b.append(numb)
bb=[]
aa=[]
if not 1 in a or not n in b:
print("IMPOSSIBLE")
sys.exit()
for j in range(len(a)):
if 1==a[j]:
bb.append(b[j])
for k in range(len(b)):
if n==b[k]:
aa.append(a[k])
print(aa)
print(bb)
list=set(aa) & set(bb)
print("IMPOSSIBLE" if len(list)==0 else "POSSIBLE")
|
p04019 | s313713629 | Accepted | S = input()
if (S.count('S') > 0) == (S.count('N') > 0) and (S.count('E') > 0) == (S.count('W') > 0):
print('Yes')
else:
print('No') |
p03371 | s391348655 | Wrong Answer | A, B, C, X, Y = map(int, input().split())
a = A*X+B*Y
if 2*C < A+B:
b = max(X,Y)*C*2
else:
b = min(X, Y) * C * 2
if X > Y:
b += A * (X-Y)
elif X < Y:
b += B * (Y-X)
print(min(a, b)) |
p02771 | s362268591 | Accepted | i = list(map(int, input().split()))
A = i[0]
B = i[1]
C = i[2]
if A == B != C :
print('Yes')
elif A != B == C :
print('Yes')
elif A == C != B :
print('Yes')
else :
print('No') |
p02645 | s598751685 | Accepted | S = input()
print(S[:3]) |
p02707 | s835350852 | Accepted | N = int(input())
A = list(map(int, input().split()))
d = {x:0 for x in range(1, 1+N)}
for x in A:
d[x] += 1
print('\n'.join(map(str,d.values()))) |
p02689 | s087475601 | Accepted | import copy
n, m = map(int, input().split())
H = list(map(int, input().split()))
ANS = copy.deepcopy(H)
for i in range(m):
a, b = map(int, input().split())
if H[a-1] > H[b-1]:
ANS[b-1] = 0
elif H[a-1] == H[b-1]:
ANS[a-1] = 0
ANS[b-1]= 0
else:
ANS[a-1] = 0
ans = 0
for i in range(n):
if ANS[i] != 0:
ans += 1
print(ans) |
p03817 | s284915415 | Accepted | # 大きくなるように取る
# 1 -> 5 -> 6 -> 5かな
# 1 6 12 17 23
N = int(input())
cnt = 0
a = N // 11
amari = N % 11
cnt += a*2
# print(a, amari)
if amari == 0:
cnt += 0
elif amari <= 6:
cnt += 1
else:
cnt += 2
print(cnt) |
p03107 | s402264678 | Accepted | ## C - Unification
S = list(input())
cnt1 = len([i for i in range(len(S)) if S[i] == '1'])
cnt0 = len([i for i in range(len(S)) if S[i] == '0'])
print(min(cnt0,cnt1)*2) |
p02916 | s381211499 | Accepted | N = int(input())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))
total = 0
for a in A_list:
total += B_list[a-1]
for i in range(N-1):
if A_list[i] + 1 == A_list[i + 1]:
total += C_list[A_list[i]-1]
print(total) |
p02836 | s644248939 | Wrong Answer | #--Palindrome-philia
S = input()
s_str = list(S)
s_rev = s_str[::-1]
print(s_str)
print(s_rev)
num = len(s_str)
j = 0
for i in range(num):
if (s_str[i] == s_rev[i]):
pass
else:
j = j + 1
print (j/2)
|
p03127 | s389941372 | Accepted | import fractions
from functools import reduce
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
N = int(input())
nums = [int(i) for i in input().split()]
print(gcd_list(nums)) |
p02947 | s398736463 | Accepted | import collections
import math
n=int(input())
s=[]
for i in range(n):
sl=list(input())
sl.sort()
s.append("".join(sl))
l=list(collections.Counter(s).values())
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
c=0
for i in range(len(l)):
k=int(l[i])
if k!=1:c+=combinations_count(k,2)
print(c) |
p02952 | s153610901 | Wrong Answer | n = input()
if len(n) == 6: print("90909")
if len(n) == 5: print(909 + int(n) - 9999)
if len(n) == 4: print("909")
if len(n) == 3: print(9 + int(n) - 99)
if len(n) == 2: print("9")
else: print(int(n)) |
p02899 | s206130550 | Accepted | N=int(input())
L=list(map(int,input().split()))
S=[0]*N
c=1
for i in L:
S[i-1]=c
c+=1
for i in range(N):
print(S[i],end=' ') |
p02724 | s021856675 | Accepted | # coding: utf-8
X = int(input())
f = X // 500
ans = 0
ans += 1000 * f
X -= f * 500
f = X // 5
ans += 5 * f
print(ans) |
p02767 | s714491405 | Accepted | N = int(input())
X = sorted(list(map(int, input().split(" "))))
min = -1
for i in range(X[0], X[-1]+1):
s = sum((x - i) ** 2for x in X)
if min == -1:
min = s
if s < min:
min = s
print(min) |
p02700 | s941725846 | Accepted | a,b,c,d = map(int,input().split())
while(a>=0 or c>=0):
c-=b
if c<=0:
print("Yes")
break
a-=d
if a<=0:
print("No")
break |
p02696 | s189637831 | Accepted | import math
A,B,N=map(int,input().split())
x=min(B-1,N)
print(math.floor(A*x/B) - A*math.floor(x/B)) |
p03309 | s982675232 | Accepted | n = int(input())
A = sorted([a-i-1 for i, a in enumerate(map(int, input().split()))])
med_A = A[n//2]
ans = sum([abs(a-med_A) for a in A])
print(ans) |
p03657 | s632813458 | Wrong Answer | import sys
input = sys.stdin.readline
a,b=map(int,input().split())
if a%3==0 or b%3--0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible")
|
p02598 | s796701104 | Accepted | import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))
n,k=I()
l=I()
lo=1;hi=max(l)
while lo<hi:
md=(lo+hi)//2
ct=0
for i in range(n):
ct+=l[i]//md-(l[i]%md==0)
if ct<=k:
hi=md
else:
lo=md+1
print(lo) |
p03160 | s257869174 | Accepted | n = int(input())
h = list(map(int, input().split()))
dp = [0]*n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])
|
p03493 | s109806385 | Wrong Answer | s = int(input())
ans = 0
if s%10==1:
ans += 1
s = s//10
if s%10==1:
ans += 1
s = s//10
if s==1:
ans += 1
print(ans+1) |
p02663 | s768581279 | Accepted | h, m, h2, m2, k = map(int, input().split())
print(max(0, (h2*60+m2)-(h*60+m)-k)) |
p03126 | s862666467 | Accepted | n,m=map(int,input().split())
l=set(range(1,m+1))
for i in range(n):
k,*a=map(int,input().split())
l&=set(a)
print(len(l)) |
p02657 | s445393517 | Wrong Answer | # スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())
if N > 0:
A = 1
for O in d:
A = A * O
print(O)
if A >= 10 ** 18:
A = -1
break
else:
A = 0
print(A) |
p02689 | s334138255 | Wrong Answer | n, m = map(int,input().split())
h = list(map(int,input().split()))
temp_h = h.copy()
for _ in range(m):
x1, x2 = map(int,input().split())
temp_h[x1 - 1] = max([temp_h[x1 - 1], temp_h[x2 - 1]])
temp_h[x2 - 1] = max([temp_h[x1 - 1], temp_h[x2 - 1]])
res = [1 if x - y else 0 for x, y in zip(h, temp_h)]
print(sum(res)) |
p03324 | s847114137 | Accepted | D,N=map(int,input().split())
print(((100**D)*N) if N<100 else ((N+1)*(100**D))) |
p03673 | s859204484 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b = [-1] * (n + 2)
mid = n // 2
left = mid - 1
right = mid + 1
b[mid] = a[0]
for i in range(1, n):
if i % 2 != 0:
b[left] = a[i]
left -= 1
else:
b[right] = a[i]
right += 1
for i in b:
if i < 0:
continue
print(i) |
p02795 | s465389235 | Accepted | #!/usr/bin/env python3
def main():
h = int(input())
w = int(input())
n = int(input())
if h > w:
h, w = w, h
for y in range(h):
n -= w
if n <= 0:
break
print(y + 1)
if __name__ == "__main__":
main()
|
p03013 | s539567686 | Wrong Answer | # C - Typical Stairs
MOD = (10 ** 9) + 7
N, M = map(int, input().split())
A = [False] * (N + 1)
for _ in range(M):
A[int(input())] = True
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in A:
dp[1] = 1
for i in range(2, N + 1):
if A[i]:
dp[i] = 0
else:
dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
print(dp[N])
|
p03107 | s182398004 | Accepted | S = input()
zero_count = int(S.count('0'))
one_count = int(S.count('1'))
print(min(zero_count, one_count)*2)
|
p02705 | s880396912 | Accepted | r = int(input())
p = 3.141592653589793
print(2*r*p) |
p02933 | s076843459 | Wrong Answer | a = int(input())
s = input()
if a > 3200:
print("red")
else:
print(s) |
p03471 | s119730647 | Wrong Answer | #N枚のお金N,合計金額Y
N, Y = map(int, input().split())
"""
a = 0 #1000円札の枚数
b = 0 #5000円札の枚数
c = 0 #10000円札の枚数
X = 0 #合計金額
"""
for a in range(N+1):
for b in range(N-a+1):
X = 1000*a + 5000*b + 10000*(N-a-b)
if X == Y:
print(a, b, N-a-b)
exit()
print("-1 -1 -1") |
p02660 | s315776841 | Accepted | def factorize(n):
b = 2
fct = []
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b = b + 1
if n > 1:
fct.append(n)
return fct
def getpattern(x):
pattern = 0
d = 0
for i in range(1, 1000000):
d += i
if x < d:
break
pattern += 1
return pattern
n = int(input())
f = factorize(n)
fu = set(factorize(n))
r = 0
for fui in fu:
r += getpattern(f.count(fui))
print(r) |
p03910 | s504806584 | Wrong Answer | n = int(input())
ans = 0
s = 0
for i in range(1,n+1):
if s >= n:
break
s += i
ans += 1
ans -= 1
a = n
for i in range(ans):
if a >= ans+1-i:
print(ans+1-i)
a -= ans+1-i
elif a == 0:
break
else:
print(a)
break
if n == 1:
print(1)
|
p02718 | s749481543 | Accepted | import numpy as np
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
A=A>=np.sum(A)/(4*M)
if np.sum(A)>=M:
print('Yes')
else:print('No') |
p02848 | s520859370 | Wrong Answer | N = int(input())
S = input()
strs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for s in S:
ind = strs.index(s) + N
if ind >= 26:
ind = ind - 26
print(strs[ind])
|
p03264 | s550411446 | Wrong Answer | K = int(input())
count = 0
i = 0
j = 0
if K == 2:
count = 1
elif K == 3:
count = 2
elif K > 3:
while i < K:
i += 1
j = i + 1
while j <= K:
count += 1
j += 2
print(count)
print(count) |
p02699 | s739292919 | Accepted | S, W = map(int, input().split())
if S <= W:
print('unsafe')
else:
print('safe') |
p02608 | s118133844 | Accepted | n = int(input())
a = int(n**0.5+1)
ans = [0]*n
for x in range(1, a):
for y in range(1, a):
for z in range(1, a):
if x**2 + y**2 + z**2 + x*y + y*z + z*x <= n:
ans[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1
[print(i) for i in ans] |
p03379 | s399899788 | Accepted | def main():
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
for i in range(n):
if a[i] <= b[n // 2 - 1]:
print(b[n // 2])
elif a[i] > b[n // 2 - 1]:
print(b[n // 2 - 1])
if __name__ == '__main__':
main() |
p02627 | s776791644 | Accepted | s = input()
if s.islower():
print('a')
else:
print('A') |
p03146 | s099560080 | Accepted | s = int(input())
a = [s]
for i in range(10000):
if a[i] %2 == 0:
b = a[i]//2
if b in a:
print(i+2)
exit()
a.append(b)
else:
b = 3*a[i]+1
if b in a:
print(i+2)
exit()
a.append(b) |
p02786 | s409000404 | Wrong Answer | n = int(input())
num = n // 2
ans = 1
for i in range(num+1):
ans = ans * 2
print(ans-1) |
p03137 | s108488988 | Wrong Answer | import sys
N, M = map(int, input().split())
X = list(map(int, input().split()))
X = sorted(X)
anslis = []
if M <= N:
print(0)
sys.exit()
for i in range(M-1):
ans = abs(X[i+1] - X[i])
anslis.append(ans)
ans = 0
anslis = sorted(anslis)
print(sum(anslis[0:N-1]))
|
p04044 | s723208205 | Accepted | n,l=map(int,input().split())
s=sorted([input() for _ in range(n)])
print(*s, sep="") |
p03264 | s673480530 | Accepted | K = int(input())
if K % 2 == 0:
print((K // 2) ** 2)
else:
print((K//2 + 1) * (K//2)) |
p04011 | s437185145 | Accepted | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N > K:
print(X*K + Y*(N-K))
else:
print(X*N) |
p03607 | s610521416 | Accepted | n = int(input())
a = sorted([int(input()) for i in range(n)])
ans = 0
s = 1
for i in range(n - 1):
if a[i] != a[i + 1]:
ans += s % 2
s = 1
else:
s += 1
ans += s % 2
print(ans)
|
p03861 | s138677382 | Accepted | a, b, x = map(int, input().split())
def solve(a,b,x):
ans = b//x - (a-1)//x
# print(ans)
return ans
print(solve(a,b,x)) |
p03407 | s601161976 | Wrong Answer | a, b, c = map(int, input().split())
print("Yes" if c < a + b else "No") |
p03345 | s019578924 | Accepted | def main():
a, b, c, operation = map(int, input().split())
answer = a - b
if abs(answer) > 10 ** 18:
print("Unfair")
else:
if operation % 2:
print(answer * -1)
else:
print(answer)
if __name__ == '__main__':
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.