problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03103 | s568579042 | Wrong Answer | N, M = map(int, input().split())
S = []
for i in range(N):
a, b = map(int, input().split())
S.append([a, b])
S.sort(key=lambda x: x[0])
ans = 0
for s in S:
if ans + s[0] * s[1] < M:
ans += s[0] * s[1]
else:
q = (M - ans + s[0] - 1) // s[0]
ans += s[0] * q
break
print(ans) |
p02754 | s111117106 | Wrong Answer | import math
N,A,B = map(int,input().split())
c = N%(A+B)
p = math.floor(N/(A+B))
print((A*p)+c) |
p03435 | s189744462 | Wrong Answer | l = [list(map(int,input().split())) for i in range(3)]
ans = 0
for i in l:
ans += sum(i)
print("Yes" if ans%3==(l[0][0]+l[1][1]+l[2][2]) else "No")
|
p03548 | s910534102 | Accepted | x,y,z=map(int,input().split())
count=1
x -= 2*z+y
count += x //(y+z)
print(count) |
p03672 | s582413000 | Wrong Answer | A= [i for i in input()]
while True:
A.pop()
A.pop()
B=len(A)//2
if A[:B]==A[B+1:]:
print(len(A))
break |
p03672 | s296443866 | Accepted | S = input()
s = S
for i in range(len(S)):
s = s[:-1]
if s[:len(s)//2] == s[len(s)//2:]:
print(len(s))
exit() |
p02677 | s369127130 | Accepted | import math
A, B, H, M = map(int, input().split())
degree = abs((H * 60 + M) / 2 - M * 6)
d = A**2 + B**2 - 2 * A * B * math.cos(math.radians(degree))
ans = d**0.5
print(ans)
|
p02756 | s328007407 | Accepted | from collections import deque
s = deque(input())
q = int(input())
flip = 0
for _ in range(q):
com, *query = input().split()
if com == "1":
flip ^= 1
else:
f, c = query
f = int(f)-1
if f ^ flip == 1:
s.append(c)
else:
s.appendleft(c)
s = "".join(s)
print(s if not flip else s[::-1])
|
p03030 | s751856802 | Wrong Answer |
D=[]
for i in range(int(input())):
INPUT = [(j) for j in input().split()]
D.append([INPUT[0],INPUT[1],i+1])
D.sort(key=lambda x:x[1],reverse=True)
D.sort(key=lambda x:x[0])
for d in D:
print(d[2]) |
p02661 | s583362508 | Accepted | import sys
input = sys.stdin.buffer.readline
n = int(input())
tank = []
dg = 10**10
mi = []
ma = []
for _ in range(n):
a,b = map(int,input().split())
tank.append(a*dg + b)
mi.append(a)
ma.append(b)
mi.sort()
ma.sort(reverse = True)
if n % 2 == 1:
c = mi[n//2]
d = ma[n//2]
print(d-c+1)
else:
c = (mi[(n//2) - 1] + mi[n//2])
d = (ma[(n//2) - 1] + ma[n//2])
print(d-c+1)
|
p02789 | s328498835 | Accepted | N, M = map(int, input().split())
if N == M:
print('Yes')
else:
print('No') |
p03637 | s046755209 | Accepted | n = int(input())
lst1 = list(map(int,input().split()))
amount = 0
sub = 0
for i in lst1:
if i%4 == 0:
amount += 1
elif i%2 == 0:
sub += 1
if amount + sub//2 >= len(lst1)//2:
print("Yes")
else:
print("No") |
p03745 | s035592505 | Accepted | import sys
N = int(input())
A = list(map(int, input().split()))
i = 0
cnt = 0
while i < N:
while i < N - 1 and A[i + 1] == A[i]:
i += 1
if i >= N - 1:
cnt += 1
print(cnt)
sys.exit()
if A[i + 1] < A[i]:
while i < N - 1 and A[i + 1] <= A[i]:
i += 1
else:
while i < N - 1 and A[i + 1] >= A[i]:
i += 1
cnt += 1
i += 1
print(cnt)
|
p03962 | s085726724 | Accepted | data = [int(i) for i in input().split(" ")]
print(len(set(data))) |
p02946 | s675849134 | Wrong Answer | K, X = map(int, input().split())
print([i for i in range(X-K+1, X+K)]) |
p03543 | s670101789 | Wrong Answer | import collections
s = input()
c = collections.Counter(s)
if len(c) == 1:
print("Yes")
elif len(c) == 2:
if (list(c.values())[0] == 1) | (list(c.values())[0] == 3):
print("Yes")
else:
print("No")
else:
print("No") |
p03543 | s801783531 | Wrong Answer | N = input()
for n in N:
if N.count(n) >= 3:
print('Yes')
else:
print('No') |
p03474 | s082410240 | Accepted | a,b=list(map(int,input().split()))
l=['1','2','3','4','5','6','7','8','9','0']
s=input()
if len(s)!=a+b+1:
print("No")
exit()
for i in range(a+b+1):
if i==a:
if s[a]!='-':
print("No")
exit()
else:
continue
if s[i] not in l:
print("No")
exit()
print("Yes") |
p02836 | s606524060 | Accepted | def main():
s = input()
s_l = len(s)
cnt = 0
for i in range(s_l//2):
if s[i] != s[::-1][i]:
# if s[i] != s[s_l-i-1]:
cnt += 1
print(cnt)
if __name__ == '__main__':
main() |
p02743 | s773063708 | Wrong Answer | from math import sqrt
a, b, c = map(int, input().split())
ab = a*b
bc = b*c
ca = c*a
if 2*(ab+bc+ca) < a**2 + b**2 + c**2:
print('Yes')
else:
print('No') |
p02618 | s279570754 | Accepted | d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
lastd = [0] * 26
for i in range(1, d + 1):
ans = 0
tmp = 0
for j in range(26):
if tmp < s[i - 1][j] + (i - lastd[j]) * c[j]:
tmp = s[i - 1][j] + (i - lastd[j]) * c[j]
ans = j + 1
lastd[ans - 1] = i
print(ans) |
p03041 | s723895644 | Wrong Answer | n,m = map(int, input().split())
s = list(input())
abc = ['a','b','c']
s[m-1] = abc[m % 3 - 1]
print(*s, sep='')
|
p04044 | s072069174 | Accepted | #!/usr/bin/env python3
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(''.join(S))
|
p02767 | s212359494 | Accepted | import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
print('0')
sys.exit()
for i in range(min(X), max(X) + 1):
ans = 0
for j in X:
ans += (j - i) ** 2
ans_list.append(ans)
print(min(ans_list))
|
p03644 | s807989722 | Accepted | n = int(input().strip())
if n == 1:
print(1)
elif 2 <= n < 4:
print(2)
elif 4 <= n < 8:
print(4)
elif 8 <= n < 16:
print(8)
elif 16 <= n < 32:
print(16)
elif 32 <= n < 64:
print(32)
elif 64 <= n <= 100:
print(64)
|
p03438 | s202545723 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count_a = 0
count_b = 0
for i in range(n):
count_a += max(0,(b[i]-a[i]+1)//2)
count_b += max(0,a[i]-b[i])
if sum(b)>=sum(a) and sum(b)-sum(a)>=max(count_a,count_b):
print("Yes")
else:
print("No") |
p02793 | s240884967 | Accepted | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(input())
A=list(map(int,input().split()))
def gcd(a, b):
while(b != 0):
a, b = b, a % b
return a
def lcm(m,n):
return (m*n)//gcd(m,n)
for ai in A:
pro=lcm(pro,ai)
for ai in A:
count+=pro//ai
print(count%mod)
|
p02624 | s837227493 | Wrong Answer | N = int(input())
ans = 0
for j in range(1,N+1):
num = int(N/j)
ans += num*(num-1)/2*j
print(int(ans)) |
p02627 | s447656954 | Accepted | from string import ascii_uppercase
x = input()
print('A' if x in ascii_uppercase else 'a') |
p02783 | s749839622 | Accepted | h,a=map(int, input().split())
print((h-1)//a+1)
|
p02546 | s944161654 | Wrong Answer | s = input("Enter Input:")
if s[len(s) - 1] != "s":
s += "s"
elif s[len(s) - 1] == "s":
s += "es"
print(s)
|
p03548 | s723914524 | Accepted | x,y,z=map(int,input().split())
print((x-z)//(y+z)) |
p04012 | s384902323 | Wrong Answer | w = input()
lower = w.lower()
if w == lower:
print('Yes')
else:
print('No') |
p02658 | s256716860 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
print(0)
else:
ans = 1
for i in a:
ans *= i
if ans > 10**18:
print(-1)
break
else:
print(ans) |
p03161 | s803251675 | Accepted | INFTY = 10**9
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [INFTY] * N
dp[0] = 0
for i in range(1,N):
j = 1
while j <= K and i-j >= 0:
dp[i] = min(dp[i], dp[i-j]+abs(H[i-j]-H[i]))
j += 1
print(dp[N-1]) |
p02973 | s589477593 | Accepted | n=int(input())
m=[]
m.append(int(input()))
count=1
for i in range(n-1):
k=int(input())
if k<=m[-1]:
m.append(k)
count+=1
else:
r=count-1
l=0
while l+1<r:
try1=(r+l)//2
if m[try1]>=k:
l=try1
else:
r=try1
if m[l]>=k:
m[r]=k
else:
m[l]=k
print(count) |
p03475 | s157011806 | Accepted | N=int(input())
CSF=[list(map(int,input().split())) for _ in range(1,N)]
for i,csf in enumerate(CSF):
c,s,f=csf[0],csf[1],csf[2]
ans=c+s
for j in range(i+1,N-1):
csf_=CSF[j]
c_,s_,f_=csf_[0],csf_[1],csf_[2]
if ans<s_:
ans=s_
elif ans%f_!=0:
ans=ans+f_-ans%f_
ans+=c_
print(ans)
print(0) |
p02556 | s439510147 | Wrong Answer | import numpy as np
n = int(input())
xy = np.array([list(map(int,input().split())) for _ in range(n)],int)
x = xy[:,0]
y = xy[:,0]
a = x+y
b = -x+y
ans = max(a.max() - a.min(), b.max()-b.min())
print(ans) |
p02603 | s598976119 | Accepted | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
# 株は変えるだけ買うほうがよさそう
dp = defaultdict(int)
dp[0] = 1000
for a in A:
key, val = zip(*dp.items())
for k, v in zip(key, val):
# 株売る
dp[0] = max(dp[0], v + k * a)
# 株買う
buy = v // a
dp[k + buy] = max(dp[k + buy], v - buy * a)
print(dp[0]) |
p03719 | s862620787 | Wrong Answer | a=list(map(int,input().split()))
if a[2]>=a[0] and a[2]<=a[1]:
print('YES')
else:
print('NO') |
p02742 | s016421557 | Accepted |
H,W = map(int,input().split())
if min(H,W)==1:
print(1)
else:
print((H*W+1)//2) |
p03219 | s333755358 | Accepted | x, y = map(int, input().split())
print(x + y//2)
|
p03720 | s369331484 | Wrong Answer | N, M = map(int, input().split())
a_lis = [0]*M
b_lis = [0]*M
for i in range(M):
a_lis[i], b_lis[i] = map(int, input().split())
new_lis = a_lis + b_lis
set_new_lis = sorted(set(new_lis))
set_new_lis
for i in set_new_lis:
print(new_lis.count(i)) |
p03680 | s394331550 | Wrong Answer | N = int(input())
A = []
for i in range(N):
A.append(int(input()))
i = 0
l = len(A)
n = 1
while True:
i = A[i] - 1
n += 1
if A[i] == 2:
print(n)
break
if n == l:
print(-1)
break
|
p02664 | s669001882 | Accepted | import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split()) #空白あり
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
T = LS2()
for i in range(len(T)):
if T[i] == '?':
T[i] = 'D'
ans = ''
for i in range(len(T)):
ans += T[i]
print(ans) |
p02873 | s711306172 | Accepted | s = list(input())
ans = [0]*(len(s)+1)
for i in range(len(s)) :
if s[i] == '<' :
ans[i+1] = ans[i]+1
for i in range(len(s),0,-1) :
if s[i-1] == '>' :
ans[i-1] = max(ans[i-1],ans[i]+1)
print(sum(ans)) |
p03605 | s960173083 | Accepted | import math
n=input()
for i in range(0,2):
if(n[i]=="9"):
print("Yes")
exit()
print("No") |
p03827 | s972086797 | Wrong Answer | """
author : halo2halo
date : 31, Jan, 2020
"""
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = readline().decode('utf8')
ans = 0
cnt=0
for i in S:
if i == 'I':
cnt += 1
else:
cnt -= 1
ans=max(ans, cnt)
|
p02556 | s791890053 | Accepted | n=int(input())
zmi=wmi=int(1e+10)
zma=wma=int(-1e+10)
for i in range(n):
xi,yi=map(int,input().split())
zma=max(xi+yi,zma)
wma=max(xi-yi,wma)
zmi=min(xi+yi,zmi)
wmi=min(xi-yi,wmi)
print(max(zma-zmi,wma-wmi))
|
p03860 | s177225199 | Accepted | s = input().replace("AtCoder ","").replace(" Contest","")
print("A" + s[0] + "C")
|
p02681 | s011042665 | Wrong Answer | S=input()
T=input()
if (S in T):
print("Yes")
else:
print("No") |
p03106 | s731696353 | Accepted | import fractions
A,B,K=map(int,input().split())
base=fractions.gcd(A,B)
answers=[]
for i in range(1,base+1):
if base%i==0:
answers.append(i)
print(answers[-K]) |
p02694 | s211043125 | Accepted | import math
x = int(input())
k = 100
ans = 0
while k < x:
ans += 1
k = math.floor(k * 101/100)
print(ans) |
p03293 | s237984117 | Accepted | s=input()
t=input()
ans=0
for i in range(len(s)):
s=s[1:]+s[0]
if s==t:
ans+=1
if ans:
print('Yes')
else:
print('No') |
p03943 | s324143506 | Wrong Answer | a, b, c = map( int, input().split())
if a == b+c or a + b == c or a + c == b:
print('Yes') |
p03075 | s881579503 | Accepted | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
antenas=[a,b,c,d,e]
teste = 1
for i in range(len(antenas)):
for j in range(len(antenas)):
if antenas[j]-antenas[i] > k:
teste = 0
break
if teste:
print("Yay!")
else:
print(":(") |
p03106 | s008754787 | Accepted | # -*- coding: utf-8 -*-
a,b,k = map(int,input().split())
ans = []
for i in range(1, min(a, b) + 1):
if a % i == 0 and b % i == 0:
ans.append(i)
ans.sort()
print(ans[len(ans) - k])
|
p02727 | s161338216 | Wrong Answer | from collections import deque
import heapq
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
lis = p[len(p)-x:] + q[len(q)-y:] + r
lis = sorted(lis)
print(sum(lis[len(r):])) |
p02694 | s251679519 | Accepted | X = int(input())
v = 100
for i in range(1, 3761):
v *= 1.01
v = int(v)
if v>=X:
print(i)
break |
p02691 | s490501771 | Accepted | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = []
C = []
for i, a in enumerate(A):
B.append(i+1+a)
C.append(i+1-a)
cb = Counter(B)
cc = Counter(C)
ans = 0
for k, v in cb.items():
ans += v*cc[k]
print(ans) |
p02594 | s875791231 | Wrong Answer | print('室温(-40℃から40℃まで)を整数値で入力してください。')
X = int(input())
if X>=30:
print('yes')
else:
print('no') |
p02615 | s219825409 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A_rev = sorted(A, reverse=True)
print(sum(A_rev[:-1]))
|
p02917 | s810113917 | Wrong Answer | n=int(input())
B=list(map(int,input().split()))
B.append(float('inf'))
A=[min(B[i],B[i+1]) for i in range(n-1)]
print(sum(A)) |
p02959 | s249792613 | Accepted | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
a=min(A[i],B[i])
B[i]-=a
b=min(A[i+1],B[i])
A[i+1]-=b
ans+=a+b
print(ans) |
p03274 | s482035449 | Accepted | n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9
for i in range(n-k+1):
if x[k-1+i]*x[i] < 0:
if x[k-1+i] <= abs(x[i]) :
temp = 2*x[k-1+i] - x[i]
elif abs(x[i]) < x[k-1+i]:
temp = x[k-1+i] - 2*x[i]
elif (0 <= x[i]):
temp = x[k+i-1]
elif (x[k+i-1] <= 0):
temp = -x[i]
if temp < ans:
ans = temp
print(ans) |
p02951 | s803475484 | Accepted | A,B,C=map(int,input().split())
if C-(A-B)<0:
print(0)
else:
print(C-(A-B))
|
p02784 | s519465771 | Accepted | import math
H,N = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) >= H:
print("Yes")
else:
print("No") |
p02953 | s088860320 | Accepted | n = int(input())
h = list(map(int, input().split()))
for i in range(n-1):
if h[i] - h[i+1] < 0:
h[i+1] -= 1
if h[i] - h[i+1] > 0:
print("No")
exit()
print("Yes") |
p03293 | s392214883 | Accepted | #!/usr/bin/env python
# coding: utf-8
# In[1]:
S = input()
T = input()
# In[4]:
for i in range(len(S)):
tmp = S[i:] + S[:i]
if tmp == T:
print("Yes")
break
else:
print("No")
# In[ ]:
|
p03433 | s822572897 | Accepted | n = int(input())
a = int(input())
if n % 500 <= a:
print("Yes")
else:
print("No") |
p02701 | s196915819 | Accepted | from collections import Counter
n=int(input())
l=[input() for i in range(n)]
c=Counter(l)
print(len(c))
|
p03136 | s200637476 | Accepted | import sys
import math
import itertools
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
max=l.pop(0)
for i in range(len(l)-1):
l[i+1]=l[i]+l[i+1]
if max<l[-1]:
print("Yes")
else :
print("No") |
p02582 | s448362381 | Wrong Answer | S=input()
if (S=="RRS" or S=="SRR"):
print (2)
elif S=="RRR":
print (3)
else:
print (0) |
p02829 | s913765241 | Wrong Answer | a=int(input())
b=int(input())
for i in range(4):
if i!=a and i!=b:
print(i)
|
p02933 | s935343636 | Accepted | a = int(input())
s = input()
print(s if a >= 3200 else 'red')
|
p02665 | s443901482 | Accepted | *a,=map(int,[*open(s:=0)][1].split())
c=sum(a)
b=1
for a in a:
if b<a:
s=-1
break
s+=b
c-=a
b=min(c,(b-a)*2)
print(s) |
p02683 | s549454567 | Accepted | N,M,X=map(int,input().split())
ls=[list(map(int,input().split())) for i in range(N)]
ls_c=[]
for i in range(1,2**N):
ls_al=[0]*M
c=0
for j in range(N):
if (i>>j)&1==1:
c+=ls[j][0]
for k in range(M):
ls_al[k]+=ls[j][k+1]
if min(ls_al)>=X:
ls_c.append(c)
if ls_c!=[]:
print(min(ls_c))
else:
print(-1) |
p04030 | s856509440 | Accepted | s = input()
result = ''
for i in range(len(s)):
if s[i] == '0':
result += '0'
elif s[i] == 'B':
if result != '':
result = result[:-1]
else:
result += '1'
print(result) |
p04020 | s889663121 | Accepted | n = int(input())
ans = 0
tmp = 0
for i in range(n):
k = int(input())
if k:
tmp += k
else:
ans += tmp // 2
tmp = 0
print(ans + tmp // 2)
|
p02784 | s947395989 | Wrong Answer | H, N = map(int,input().split())
special_move = list(map(int,input().split()))
if H < sum(special_move):
result = 'Yes'
else:
result = 'No'
print(result) |
p03657 | s135906831 | Wrong Answer | a, b = map(int, input().split())
if a // 3 > 0 or b // 3 > 0 or (a + b) // 3 > 0:
print("Possible")
else:
print("Impossible")
|
p03243 | s094718534 | Wrong Answer | N=int(input())
for i in range(N,999):
n=str(i)
if all(x==n[0] for x in n):
print(n)
break |
p02882 | s784406272 | Accepted | import math
a, b, x = map(int, input().split())
if a ** 2 * b / 2 <= x:
theta = math.atan(2 * b / a - 2 * x / (a ** 3))
else:
theta = math.pi / 2 - math.atan(2 * x / (a * b * b))
print(math.degrees(theta)) |
p02665 | s823193619 | Accepted | N, *A = map(int, open(0).read().split())
s = sum(A)
ans = 1
cur = 1
for a in A:
s -= a
if (cur := min(2 * (cur - a), s)) < 0:
print(-1)
quit()
ans += cur
print(ans) |
p03745 | s634955849 | Accepted | n = int(input())
a = list(map(int,input().split()))
flag = 0
cnt = 0
for i in range(n-1):
if flag == 0:
if a[i] > a[i+1]:
flag = -1
if a[i] < a[i+1]:
flag = 1
if flag == 1:
if a[i] > a[i+1]:
flag = 0
cnt += 1
if flag == -1:
if a[i] < a[i+1]:
flag = 0
cnt += 1
print(cnt+1) |
p02618 | s301523567 | Accepted | import random
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
for i in range(D):
print(S[i].index(max(S[i]))+1) |
p03274 | s970419009 | Accepted | n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=10**18
for i in range(n-k+1):
l=x[i]
r=x[i+k-1]
ans=min(ans,min(abs(l)+abs(r-l),abs(r)+abs(l-r)))
print(ans) |
p03076 | s247365943 | Accepted | a = [int(input()) for i in range(5)]
mn = a[0] % 10
for i in a:
if i % 10 == 0:
continue
mn = min(mn, i % 10)
for i in a:
if i % 10 == mn:
mn = i
break
ans = 0
for i in a:
if i == mn:
ans += i
mn = -1
continue
t = ((i + 9) // 10) * 10
ans += t
print(ans)
|
p02982 | s809601527 | Wrong Answer | import math
n, d = map(int, input().split())
x = [list(map(int, input().split()))for _ in range(n)]
cnt = 0
for i in range(n-1):
for j in range(i+1,n-1):
s = 0
for k in range(d):
s += (x[i][k] - x[j][k])**2
if math.sqrt(s) % 1 == 0:
cnt += 1
print(cnt) |
p03254 | s705767672 | Wrong Answer | # A - Candy Distribution Again
count = 0
N, x = map(int, input().split())
A = input().split()
A.sort()
A_i = [int(s) for s in A]
if(sum(A_i) == x):
print(N)
else:
for i in range(N):
if(i != N-1):
x -= A_i[i]
if(x >= 0):
count += 1
print(count) |
p03448 | s658370355 | Wrong Answer | a=int(input())
b=int(input())
c=int(input())
d=int(input())
count=0
for i in range(a+1):
for j in range(b+1):
for z in range(c+1):
if a*500+b*100+c*50 == d:
count+=1
print(count)
|
p02933 | s239654834 | Accepted | a = int(input())
s = input()
if a >= 3200:
print(s)
else:
print('red') |
p02583 | s912506248 | Accepted | import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque
def r():
return int(input())
def rm():
return map(int,input().split())
def rl():
return list(map(int,input().split()))
n = r()
a = rl()
ans = 0
a.sort()
for i in range(n-2):
for j in range(i+1,n-1):
for k in range(j+1,n):
if a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i] and a[i]+a[j]>a[k]:
ans+=1
print(ans) |
p02642 | s619228563 | Accepted | n = int(input())
A = list(map(int,input().split()))
A.sort()
B = [0]*(A[-1]+1)
ans = 0
for i,a in enumerate(A):
if B[a]:
continue
else:
if i+1 == n or A[i+1] != a:
ans += 1
x = a
while x <= A[-1]:
B[x] = 1
x += a
print(ans)
|
p03998 | s494166430 | Accepted | a = list(input())
b = list(input())
c = list(input())
next = a.pop(0)
while True:
if next == "a":
if a == []:
print("A")
break
else:
next = a.pop(0)
elif next == "b":
if b == []:
print("B")
break
else:
next = b.pop(0)
else:
if c == []:
print("C")
break
else:
next =c.pop(0) |
p03699 | s889602361 | Accepted | N = int(input())
S = []
for i in range(N):
s = int(input())
S.append(s)
a = sum(S)
ans = 0
if a % 10 != 0:
ans = a
else:
T = [s for s in S if s%10!=0]
if len(T) == 0:
ans = 0
else:
ans = a-min(T)
print(ans) |
p03627 | s350942072 | Accepted | from collections import Counter
N=int(input())
A=Counter(sorted(list(map(int,input().split()))))
A=[[i,A[i]] for i in A if A[i]>=2]
A.sort(reverse=True)
try:
if A[0][1]>=4:
print(A[0][0]**2)
else:
print(A[0][0]*A[1][0])
except:
print(0)
|
p02646 | s850613430 | Accepted | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if abs(A - B) <= (V - W) * T:
print('YES')
else:
print('NO') |
p02785 | s941300100 | Accepted | n, k = list(map(int,input().split()))
h = sorted(list(map(int,input().split())),reverse = True)
h = h[k:]
if n >= k:
print(sum(h))
else:
print(0) |
p04030 | s183516573 | Wrong Answer | S = input()
Z = []
X = len(S)
i = 0
while i < X :
if S[i] == "0":
Z.insert(0,0)
elif S[i] == "1":
Z.insert(0,1)
elif S[i] == "B":
if len(Z)== 0:
pass
else:
Z.pop(0)
i += 1
i = 0
X = len(Z)
while i < X:
print(Z[i] , end ="")
i +=1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.