problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02578 | s493544802 | Accepted | n = int(input())
aa = list(map(int, input().split()))
amax = aa[0]
total = 0
for a in aa:
amax = max(amax,a)
total += (amax - a)
print(total)
|
p02578 | s890563300 | Accepted | n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n):
if a[i-1]>a[i]:
cnt+=(a[i-1]-a[i])
a[i]=a[i-1]
print(cnt) |
p02910 | s499169023 | Accepted | S = input()
k = False
for i, s in enumerate(S):
if (i+1) % 2 == 0:
if s == "L" or s == "U" or s == "D":
k = True
else:
k = False
break
else:
if s == "R" or s == "U" or s == "D":
k = True
else:
k = False
break
if k:
print("Yes")
else:
print("No")
|
p02766 | s670915836 | Accepted | n, k = map(int, input().split())
a = 1
ans = 1
while n >= k**a:
ans += 1
a += 1
print(ans) |
p02693 | s850051774 | Accepted | K = int(input())
A, B = map(int, input().split())
"""
if(B-A+1 >= K):
print("OK")
else:
print("NG")
"""
flag = False
for i in range(A, B+1):
if i%K == 0:
flag = True
if flag:
print("OK")
else:
print("NG") |
p03433 | s719189452 | Wrong Answer | N = int(input())
A = int(input())
_, m = divmod(N, 500)
print('Yes' if m < A else 'No') |
p03345 | s460348111 | Wrong Answer | a,b,c,k=map(int,input().split())
d=(b+c)-(c+a)
print(d if d<10**18 else "unfair") |
p03761 | s628814874 | Accepted | alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
key = dict()
for a in alphabet:
key[a] = 50
n = int(input())
for i in range(n):
x = input()
for a in alphabet:
key[a] = min(key[a], x.count(a))
for k, v in key.items():
for _ in range(v):
print(k, end="")
print() |
p03319 | s049038929 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 1
N -= K
if N > 0:
ans += -(-N // (K - 1))
print(ans) |
p03524 | s389135392 | Accepted | s = input()
a = s.count("a")
b = s.count("b")
c = s.count("c")
print("YES" if max(a, b, c) - min(a, b, c) <= 1 else "NO")
|
p03328 | s849121233 | Accepted | d=[i*(i+1)//2 for i in range(1,1000)]
a,b=map(int,input().split())
for j in range(998):
if d[j+1]-d[j]==b-a:
print(d[j]-a)
break |
p02792 | s164223331 | Wrong Answer | import numpy as np
N = int(input())
counter = 0
lead = np.zeros((9, 9))
for i in range(N):
if (i % 10 != 0):
moji = str(i)
lead[int(moji[0]) - 1][int(moji[-1]) - 1] += 1
for i in range(N):
if (i % 10 != 0):
moji = str(i)
tmp = moji[-1]
counter += lead[int(moji[-1]) - 1][int(moji[0]) - 1]
print(int(counter))
|
p03557 | s529584115 | Accepted | import bisect
n = int(input())
alist=list(map(int,input().split()))
blist=list(map(int,input().split()))
clist=list(map(int,input().split()))
alist.sort()
blist.sort()
clist.sort()
ans = 0
for i in blist:
a = bisect.bisect_left(alist,i)
b = len(clist) - bisect.bisect_right(clist,i)
ans += a*b
print(ans) |
p03625 | s434989182 | Accepted | import sys
n, *a = map(int, sys.stdin.read().split())
def main():
a.sort()
y = x = 0
i = n - 1
while i > 0:
if a[i] == a[i-1]:
if not y:
y = a[i]
i -= 1
else:
x = a[i]
break
i -= 1
print(y * x)
if __name__ == '__main__':
main() |
p03698 | s977316626 | Accepted | #ABC063
s = input()
print("yes" if len(set(s))==len(s) else "no") |
p03433 | s109447321 | Wrong Answer | N = int(input())
A = int(input())
if N % 500 < A:
print('YES')
else:
print('NO')
|
p02995 | s423283971 | Accepted | from fractions import gcd
a, b, c, d = [int(x) for x in input().split()]
c_num = b // c - (a - 1) // c
d_num = b // d - (a - 1) // d
c_d_lcm = c * d // gcd(c, d)
c_d_num = b // c_d_lcm - (a - 1) // c_d_lcm
ans = b - a + 1 - c_num - d_num + c_d_num
print(ans) |
p02724 | s616314190 | Wrong Answer | X = int(input())
happiness = (X//500)*1000+((X%100)//5)*5
print (happiness) |
p03042 | s289276840 | Wrong Answer | s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
print("AMBIGUOUS")
elif n1 > 12 and 1 <= n2 <= 12:
print("YYMM")
elif 1 <= n1 <= 12 and n2 > 12:
print("MMYY")
else:
print("NA")
|
p02555 | s388969308 | Accepted | import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
S = int(input())
mod = 10 ** 9 + 7
if S < 3:
print(0)
exit()
res = 1
for i in range(2, S+1):
if i * 3 > S:
continue
n = S - i * 3 + (i-1)
r = i - 1
res += combinations_count(n, r)
print(res % mod)
|
p02791 | s577662598 | Wrong Answer | N = int(input())
P = list(map(int, input().split()))
ans = 0
maximum = 0
for p in P:
if p >= maximum:
maximum = p
ans += 1
print(ans) |
p03293 | s902891273 | Wrong Answer | s=input()
t=input()
a=0
while(s!=t):
s =s[-1]+s[:-1]
a+=1
if a==len(s):
print("NO")
break
if s==t:
print("YES") |
p02987 | s851541289 | Accepted | s = input()
u = list(set(list(s)))
if len(u) == 2 and s.count(u[0]) == 2 and s.count(u[1]) == 2:
print("Yes")
else:
print("No") |
p02848 | s866905528 | Accepted | ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N, S = int(input()), input()
newline = ""
for s in S:
idx = (ALPHABET.index(s) + N) % 26
newline += ALPHABET[idx]
print(newline) |
p03721 | s824019913 | Accepted | n, k = map(int, input().split())
query = [tuple(map(int, input().split())) for _ in range(n)]
count = [0] * (10 ** 5 + 2)
for a, b in query:
count[a] += b
for i, c in enumerate(count):
k -= c
if k <= 0:
print(i)
exit() |
p02661 | s600090207 | Accepted | n = int(input())
a, b = [], []
for _ in range(n):
tmp = list(map(int, input().split()))
a.append(tmp[0])
b.append(tmp[1])
a.sort()
b.sort()
if n%2:
print(b[(n+1)//2-1]-a[(n+1)//2-1]+1)
else:
print(b[n//2-1]+b[n//2]-a[n//2-1]-a[n//2]+1) |
p03625 | s574651854 | Wrong Answer | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
li2 = [0,0]
li4 = [0]
for key,value in c.items():
if value>=4:
li4.append(key)
elif value>=2:
li2.append(key)
li2.sort()
li4.sort()
ans1 = li2[-1]*li2[-2]
ans2 = li4[-1]**2
print(max(ans1,ans2))
|
p02683 | s749784767 | Wrong Answer | import numpy as np
N, M, X = map(int, input().split())
D = np.array([])
for i in range(N):
D = np.append(D,list(map(int, input().split())))
D = D.reshape(N,M+1)
S = D.sum(axis=0)
if all(s >= X for s in S[1:]):
D = D[np.argsort(D[:, 0])[::-1]]
for i in range(N):
newS = S - D[i]
if all(j>=X for j in newS[1:]):
S = newS
print(int(S[0]))
else:
print(-1) |
p04031 | s364339680 | Wrong Answer | N = int( input() )
s = input()
numbers = s.split()
def getCost(target):
cost = 0
for n in numbers:
number = int(n)
cost += (number - target)**2
return cost
minCost = 0
for i in range(-100, 101):
cost2 = getCost(i)
if( cost2 < minCost ):
minCost = cost2
print(minCost) |
p02665 | s511279262 | Accepted | N = int(input())
A = list(map(int,input().split()))
cap = [1]*(N+1)#0-N
if A[0] > 1 or (A[0]==1 and N !=0):
print(-1)
exit()
for i in range(1,N+1,1):#1-N
cap[i]=cap[i-1]*2 - A[i]
if cap[i] < 0 or (cap[i]==0 and i!=N):
print(-1)
exit()
T = [0]*(N+1)
T[N]=A[N]#ここのキャパオーバーは上ではじけるはず
for i in range(N-1,-1,-1):
T[i]=A[i]+min(T[i+1],cap[i])
print(sum(T))
|
p02993 | s786283242 | Wrong Answer | s = input()
n = len(s) - 1
i = 1
while i != n:
if s[i] == s[i - 1]:
print('bad')
exit()
i += 1
print('Good') |
p02660 | s119927905 | Accepted | n = int(input())
ans = 0
d = 2
while d * d <= n:
if n % d != 0:
d +=1
z = d
while n % z ==0:
n = n/z
z *=d
ans+=1
while n%d == 0: #残った素因数を消化
n /= d
if n !=1:
ans+=1
print(ans) |
p03136 | s892330630 | Accepted | n=int(input())
l=list(map(int,input().split()))
print('Yes'if max(l)<sum(l)-max(l) else 'No')
|
p02957 | s729842973 | Wrong Answer | a,b = map(int,input().split())
if (b-a)%2==0:
print(int((b-a)/2))
else:
print('IMPOSSIBLE') |
p03627 | s079869050 | Accepted | import collections as c
n = int(input())
co = c.Counter(list(map(int, input().split())))
cm = sorted(co.items(), key=lambda x:x[0], reverse=True)
a = 0
b = 0
for v,m in cm:
if m >= 4:
if a == 0:
a = b = v
else:
b = v
break
elif m >= 2 and a == 0:
a = v
elif m >= 2 and a != 0:
b = v
break
print(a*b) |
p03328 | s947079504 | Wrong Answer | a,b=input().split()
a=int(a)
b=int(b)
print((b-a)*(b-a-1)/2-a) |
p03659 | s784034555 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
S1 = A[0]
S2 = sum(A)-A[0]
B = [S1-S2]
for i in range(N-2):
S1 += A[i+1]
S2 -= A[i+1]
B.append(abs(S1-S2))
print(min(B)) |
p02909 | s238045584 | Wrong Answer | S = str(input())
if S == 'Sunny':
my_result = 'Cloudy'
elif S == 'Clouudy':
my_result = 'Rainy'
else:
my_result = 'Sunny'
print(my_result) |
p03785 | s635727609 | Wrong Answer | n,c,k = map(int,input().split())
t = []
for i in range(n):
t.append(int(input()))
t = sorted(t)
ans = 1
passenger = 0
first = 0
for i in range(n):
if first == 0:
first = t[i]
if passenger < c and t[i] < first + k:
passenger +=1
if i == n-1:
ans +=1
else:
passenger = 0
first = 0
ans +=1
print(ans) |
p04019 | s150888675 | Wrong Answer | S=input()
a=set()
for s in S:
a.add(s)
a=list(a)
if len(a)==4:
print('Yes')
elif len(a)==2:
if (a[0]=='N' or a[0]=='S') and (a[1]=='N' or a[1]=='S'):
print('Yes')
elif (a[0]=='E' or a[0]=='W') and (a[1]=='E' or a[1]=='W'):
print('Yes')
else:
print('No') |
p02987 | s576174048 | Accepted | S = input()
LS = list(S)
if len(set(LS)) == 2:
print("Yes")
else:
print("No") |
p03627 | s049549057 | Accepted | import heapq
import collections
N = int(input())
A = list(map(int, input().split()))
table = collections.defaultdict(int)
hq = [0, 0]
for x in A:
table[x] += 1
if table[x] == 2:
heapq.heappush(hq, -x)
table[x] = 0
print(heapq.heappop(hq) * heapq.heappop(hq))
|
p03011 | s270863475 | Accepted | s = list(map(int, input().split()))
s.sort()
print(s[0] + s[1]) |
p02879 | s442214723 | Accepted | num = input()
num1,num2 = num.split(' ')
num1 = int(num1)
num2 = int(num2)
if num1 > 9 or num2 > 9:
print('-1')
else:
print (num1 * num2) |
p02972 | s680726123 | Wrong Answer | print(-1) |
p03324 | s718807503 | Accepted | D, N = map(int, input().split())
if N == 100:
ans = 100 ** D * (N+1)
else:
ans = 100 ** D * N
print(ans) |
p02675 | s137832243 | Wrong Answer | import sys
n = sys.stdin.readline().rstrip()[-1]
d = {
'0': 'pon',
'1': 'pon',
'2': 'hon',
'3': 'bon',
'4': 'hon',
'5': 'hon',
'6': 'pon',
'7': 'hon',
'8': 'pon',
'9': 'hon',
}
print(n, d[n])
|
p03001 | s549367436 | Wrong Answer | w,h, x,y = map(int,input().split())
a = 0
b = 0
a = (w)*(h-y)
b = (w)*y
ans = 0
ans = min(a,b)
ans2 = 0
a = h*(w-x)
b = h*(x)
ans2 = min(a,b)
if ans<ans2:
print(ans2, 0)
elif ans2<ans:
print(ans, 0)
else:
print(ans, 1) |
p03000 | s545349605 | 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 k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
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)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
N, X = I()
L = [0] + l()
l = list(itertools.accumulate(L))
for i in l:
if i <= X:
count += 1
print(count)
|
p02866 | s207468268 | Accepted | mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
print(0)
exit()
l = [0 for i in range(n)]
for i in d:
l[i] += 1
cou = 1
if 0 in l:
a = l.index(0)
if sum(l[a:])!=0:
print(0)
exit()
for i in range(n-2):
if l[i+1]!=0:
a = l[i]
b = l[i+1]
cou *= (a**b)%mod
print(cou%mod) |
p03146 | s573086689 | Accepted | S = int(input())
L =[]
for _ in range(10**6):
L.append(0)
for i in range(10**6):
L[S-1] += 1
#print(L)
if L[S-1] > 1:
print(i+1)
break
if S%2 == 0:
S = S//2
else :
S = S*3 + 1 |
p02987 | s521848984 | Wrong Answer | S = input()
word = ""
i = 0
while i < len(S):
if S[i] in word:
print("Yes")
exit()
word = word + S[i]
i += 1
print("No") |
p02835 | s536492764 | Wrong Answer | a, b, c=(int(x) for x in input().split())
print('bust'if a+b+c >=21 else'win') |
p03799 | s480293838 | Wrong Answer | n, m = map(int, input().split())
if n * 2 >= m:
print(n // 2)
else:
print(n + (m - 2 * n) // 4) |
p03448 | s690149413 | Accepted | #!/usr/bin/env python3
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
value = 500*i+100*j+50*k
if value == x:
ans += 1
print(ans)
|
p02766 | s221393160 | Wrong Answer | N,K=map(int,input().split())
ans=0
temp=1
while temp<N:
temp*=K
ans+=1
print(ans) |
p02642 | s847929974 | Accepted | from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
a.sort()
d = defaultdict(int)
for ai in a:
d[ai] += 1
m = a[-1]
x = [True for _ in range(m + 1)]
ans = 0
c = defaultdict(bool)
for ai in a:
if x[ai] and d[ai] == 1:
ans += 1
if not c[ai]:
c[ai] = True
for j in range(2 * ai, m + 1, ai):
x[j] = False
print(ans)
|
p03693 | s447295780 | Accepted | print(["NO","YES"][int(input()[2::2])%4==0]) |
p02779 | s935726525 | Wrong Answer | N = int(input())
A = [int(x) for x in input().split()]
if len(A) != len(set(A)):
print("NO")
else:
if A.count(N) > 0:
print("YES")
else:
print("NO") |
p02719 | s492622689 | Accepted | n, k = map(int, input().split())
a = n%k
b = abs(a - k)
print(min(a, b)) |
p03449 | s327209757 | Accepted | n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
result = 0
for i in range(n):
cnt = sum(a1[:i+1]) + sum(a2[i:])
result = max(result, cnt)
print(result) |
p02993 | s671123044 | Accepted | S=input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
print("Bad")
else:
print("Good") |
p02693 | s586168435 | Wrong Answer | inp = [input() for i in range(2)]
K = int(inp[0])
A,B = inp[1].split()
A,B = int(A),int(B)
c,bbb = 0,0
if 1<= A <= B <= 1000 and 1<= K <= 1000:
for h in range(A,B,1):
c = h % K
if c == 0:
bbb += 1
if bbb > 0:
print('OK')
else:
print('NG') |
p03328 | s305987693 | Accepted | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
# 等差数列の和
h_b = sum(range(1, b - a + 1))
print(h_b - b) |
p02708 | s820578331 | Accepted | mod = 10**9 + 7
n,k = map(int,input().split())
tot = []
cur = 0
for i in range(n+1):
cur += i
tot.append(cur)
cnt = 0
for i in range(k, n+2):
if n > i:
max_ = tot[n] - tot[n - i]
else:
max_ = tot[n]
min_ = tot[i - 1]
cnt += max_ - min_ + 1
cnt %= mod
print(cnt) |
p02571 | s372588828 | Accepted | S=str(input())
T=str(input())
min_count=len(T)
for i in range((len(S)-len(T))+1):
count=0
for j in range(len(T)):
if S[i+j]!=T[j]:
count+=1
min_count=min(count,min_count)
print(min_count)
|
p03657 | s470843578 | Accepted | a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
print('Possible')
else:
print('Impossible') |
p02663 | s253297650 | Wrong Answer | [h1,m1,h2,m2,k] = [int(i) for i in input().split()]
print((h2 - h1) * 60 + (m1 - m2) - k)
|
p02688 | s213930983 | Accepted | n,k = map(int,input().split())
person = set(range(1,n+1))
for i in range(k):
d = int(input())
a = list(map(int,input().split()))
for j in range(d):
if a[j] in person:
person.discard(a[j])
print(len(person)) |
p03472 | s408059312 | Wrong Answer | (n,h),*ab = [list(map(int, s.split())) for s in open(0)]
mxa = max([a for a, b in ab])
bb = sorted([b for a, b in ab if b>mxa],reverse=True)
ans = 0
for b in bb:
h-=b
ans += 1
if h<=0:
break
if h>0:
ans += (1--h//mxa)
print(ans) |
p03076 | s136056967 | Accepted | from itertools import permutations
import math
menu=5
times=[int(input()) for i in range(menu)]
orders=list(permutations(times))
minimum=sum(math.ceil(time/10)*10 for time in times)
for order in orders:
total=order[0]
for i in range(1,menu):
total+=math.ceil(order[i]/10)*10
minimum=min(minimum,total)
print(minimum) |
p03385 | s043998643 | Accepted | s=input()
print('Yes' if len(set(s))==3 else 'No')
|
p03042 | s101103080 | Accepted | # B - YYMM or MMYY
s = str(input()) # 長さ4の数字列
def check(n):
if n > 0 and n <= 12:
return True
else:
return False
mae = check(int(s[0:2]))
ato = check(int(s[2:4]))
if mae and ato:
print('AMBIGUOUS')
elif mae and not ato:
print('MMYY')
elif not mae and ato:
print('YYMM')
else:
print('NA') |
p02754 | s609280789 | Accepted | n,a,b = map(int, input().split())
if n % (a+b) <= a:
print(n//(a+b)*a + n % (a+b))
else:
print(n//(a+b)*a + a) |
p02556 | s751335575 | Accepted | n=int(input())
D=0
d=10**10
f=10**10
F=-10**10
for i in range(n):
x,y=[int(x) for x in input().split()]
l=x+y
d=min(d,l)
D=max(D,l)
if y-x<f:
m=[x,y]
f=y-x
if y-x>F:
M=[x,y]
F=y-x
e=abs(m[0]-M[0])+abs(m[1]-M[1])
ans=max(D-d,e)
print(ans) |
p03495 | s782063266 | Wrong Answer | n,k = map(int, input().split())
al = list(map(int, input().split()))
res =0
for i in range(n):
if al[i] > k:
res +=1
print(res) |
p03289 | s918697828 | Wrong Answer | S=input()
if S[0]=="A":
c=0
d=0
for x in range(2,len(S)-1):
if S[x].islower():
d+=1
if S[x]=="C":
c+=1
if c==1 and d==len(S)-4 and S[1].islower():
print("AC")
else:
print("WA")
else:
print("WA")
|
p03627 | s411183794 | Accepted | from collections import Counter
N=int(input())
A=[int(i) for i in input().split()]
A=Counter(A)
e1=0
e2=0
for key,value in A.items():
if value<2:
continue
elif value>=4:
e1=max(e1,key)
e2=max(e2,key)
else:
if key>e1:
e2=e1
e1=key
else:
e2=max(e2,key)
print(e1*e2) |
p03309 | s211754907 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
b = [x[1] - x[0] for x in enumerate(A,1)]
mean1 = sum(b) // N
mean2 = mean1 - 1
mean3 = mean1 + 1
c1 = [abs(x-mean1) for x in b]
c2 = [abs(x-mean2) for x in b]
c3 = [abs(x-mean3) for x in b]
print(min(sum(c1),sum(c2),sum(c3))) |
p02847 | s660580014 | Accepted | mydict = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
S = input()
print(mydict[S]) |
p03309 | s483492668 | Accepted | from functools import lru_cache
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
left = -10**9
right = 10**9
@lru_cache(maxsize=100000)
def cal(num):
tmp = 0
for i in range(n):
tmp += abs(a[i]-(num+(i+1)))
return tmp
while abs(right-left)>1:
mid = (right+left)//2
if cal(mid-1)<cal(mid+1):
right = mid
else:
left = mid
print(min(cal(left),cal(right)))
|
p02831 | s577976592 | Wrong Answer | a, b = map(int, input().split())
gcd = 1
for i in range(1, a+1):
if a % i == b % i == 0:
gcd *= i
print(int(a * b / gcd))
|
p02595 | s597196920 | Accepted | import sys
input = sys.stdin.readline
N, D = map(int, input().split())
ans = 0
for _ in range(N):
X, Y = map(int, input().split())
if X**2+Y**2<=D**2:
ans += 1
print(ans) |
p03943 | s716930910 | Accepted | a, b, c = map(int, input().split())
flag = any([
a + b == c,
b + c == a,
c + a == b
])
print('Yes' if flag else 'No') |
p03817 | s286853241 | Accepted | x = int(input())
if x%11 > 6:
ans = x//11 *2 +2
elif x %11==0:
ans = x//11 *2
else:
ans = x//11 *2 +1
print(ans) |
p02618 | s186949091 | Accepted | import random
D = int(input())
c_list = list(map(int, input().split()))
s_list = [list(map(int, input().split())) for _ in range(D)]
for i in range(D):
print(random.randint(1,26)) |
p03487 | s871085110 | Accepted | N=int(input())
A=list(map(int,input().split()))
T={}
for a in A:
if a in T:
T[a]+=1
else:
T[a]=1
K=0
for b in T:
if T[b]<b:
K+=T[b]
elif b<T[b]:
K+=T[b]-b
print(K)
|
p03778 | s963084244 | Accepted | icase=0
if icase==0:
w,a,b=map(int,input().split())
if a+w<b:
print(b-(a+w))
elif b<=a+w and a<=b+w:
print(0)
else:
print(a-(b+w))
|
p02911 | s322887712 | Wrong Answer | """
- N players, K points each player has, Q correct answers
- Substruct Q from K and add score to each players
"""
N,K,Q = map(int,input().split())
A = (int(x) for x in input().split())
score = [K-Q] * (N+1)
for x in A:
score[x] += 1
ans = '\n'.join('No' if x <= 0 else 'Yes' for x in score[1:])
print(ans) |
p03639 | s143046383 | Accepted | a = int(input())
ar = list(map(int,input().split(" ")))
k = 0
g = 0
f = 0
for r in ar:
if r % 4 == 0:
f += 1
elif r % 2 == 0:
g += 1
else:
k += 1
if k - f > 1:
print("No")
elif k - f == 1:
if g == 0:
print("Yes")
else:
print("No")
else:
print("Yes") |
p03612 | s604078447 | Wrong Answer | N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N):
if P[i] == i + 1:
ans += 1
print(max(ans - 1, 0))
|
p02700 | s303385961 | Accepted | A,B,C,D = map(int,(input().split()))
i=0
while(A>0 and C>0):
if(i%2==0):
C-=B
else:
A-=D
i+=1
if(A>0):
print("Yes")
else:
print("No") |
p02717 | s053595013 | Accepted | a, b, c = map(int, input().split())
a_ = b
b_ = a
a__ = c
c_ = a_
print(a__, b_, c_) |
p02583 | s600180459 | Accepted | N=int(input())
X = list(map(int,input().split()))
Y=set(X)
Z=list(Y)
NN=len(Z)
AA=0
for i in range(NN-2):
for ii in range(NN-2-i):
for iii in range(NN-2-i-ii):
A=[Z[i], Z[ii+i+1], Z[iii+ii+i+2]]
if max(A)<Z[i]+Z[ii+i+1]+Z[iii+ii+i+2]-max(A):
AA+=X.count(Z[i])*X.count(Z[ii+i+1])*X.count(Z[iii+ii+i+2])
if N<3:
print(0)
else:
print(AA) |
p03208 | s572779226 | Accepted | n, k = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]
h.sort()
s = h[-1] - h[1]
for i in range(n-k+1):
s = min(s, h[i+k-1]-h[i])
print(s)
|
p03011 | s584385933 | Wrong Answer | import sys
import numpy as np
import itertools
p,q,r = input().split()
p = int(p)
q = int(q)
r = int(r)
dest_min = p + q + r
dest = np.array(list(itertools.combinations([p,q,r],2)))
print(dest)
for dest_sample in dest:
dest_min = min(dest_min, np.sum(dest_sample))
print(dest_min) |
p03617 | s891290508 | Accepted | Q,H,S,D=map(int,input().split())
N=int(input())
one=min (4*Q,2*H,S)
if N==1:
print(one)
else :
if 2*one<=D:
print(N*one)
else:
if N%2==0:
print((N//2)*D)
else:
print((N//2)*D+one) |
p02972 | s448783725 | Wrong Answer | N = int(input())
a = list(map(int,input().split()))
b = [0 for i in range(N//2)]+a[N//2:]
for i in range(N//2-1,-1,-1):
if sum(b[i::i+1])%2 == 0:
b[i] = a[i]
else:
b[i] = 1-a[i]
ans = []
for i in range(N):
if b[i] == 1:
ans.append(i)
print(len(ans))
print(' '.join(map(str,ans)))
|
p02742 | s484381482 | Wrong Answer | import math
h, w = list(map(int,input().split()))
ans = math.ceil((h*w)/2)
print(int(ans))
|
p02742 | s758873797 | Accepted | h,w = map(int, input().split())
if h==1 or w==1:
print(1)
elif h%2 and w%2:
print((h*w+1)//2)
else:
print(h*w//2)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.