problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02576 | s041548406 | Accepted | from math import ceil
N,X,T=map(int,input().split())
print(T*ceil(N/X))
|
p02699 | s673566540 | Accepted | s,w = map(int,input().split())
ans = 'unsafe' if s<=w else 'safe'
print(ans) |
p03524 | s451168389 | Accepted | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
# inputna
s = input()
d = {"a":0, "b":0, "c": 0}
for c in s:
d[c] += 1
if max(d.values()) - min(d.values())<=1:
print("YES")
else:
print("NO") |
p02571 | s885126885 | Wrong Answer | S=str(input())
T=str(input())
min_count=len(T)
for i in range(len(S)-len(T)):
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)
|
p02600 | s645388202 | Wrong Answer | X = int(input())
if (X < 599):
print('8')
elif (X < 799):
print('7')
elif (X < 999):
print('6')
elif (X < 1199):
print('5')
elif (X < 1399):
print('4')
elif (X < 1599):
print('3')
elif (X < 1799):
print('3')
elif (X < 1999):
print('1') |
p02701 | s188006793 | Accepted | N=int(input())
S=[]
for i in range(N):
S.append(input())
d=set(S)
print(len(d)) |
p02771 | s710785155 | Accepted | a = set(map(lambda x: int(x), input().split()))
if(len(a) == 2):
print('Yes')
else: print('No')
|
p02879 | s189849416 | Wrong Answer | x = list(map(str,input().split()))
if(len([0]) < 2 and len(x[1]) < 2):
print("Yes")
else:
print("No") |
p02707 | s463493000 | Accepted | n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in a:
b[i-1]+=1
print(*b) |
p03986 | s442763879 | Wrong Answer | x = 'TSSTTTSS'
while 'ST' in x:
x = x.replace('ST', '', 1)
print(len(x))
|
p03711 | s209253781 | Accepted | A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
x,y = map(int,input().split())
if x==y==2 or x in A and y in A or x in B and y in B:
print('Yes')
else:
print('No') |
p03767 | s850675564 | Accepted | N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
S=0
for i in range(2*N):
if i%2==1:
S+=a[i]
print(S)
|
p03698 | s006958767 | Wrong Answer | s=input()
print("Yes" if len(s)==len(set(s)) else "No") |
p03612 | s971977146 | Wrong Answer | n = int(input())
*p, = map(int, input().split())
ans = 0
for i in range(n-1):
if (p[i] == (i+1) or p[i+1] == (i+2)):
if p[i] == (i+2):
continue
ans += 1
p[i], p[i+1] = p[i+1], p[i]
print(ans)
|
p03324 | s552668478 | Accepted | d, n = list(map(int, input().split()))
cnt = 0
i = 1
while True:
if(d == 0 and i % 100 != 0):
cnt += 1
if(d != 0 and i % (100 ** d) == 0 and i % (100 ** (d+1)) != 0):
cnt += 1
if(cnt == n):
print(i)
exit()
i += 1 |
p03838 | s036912890 | Accepted | x,y=map(int,input().split())
count=abs(abs(x)-abs(y))
if x==-y:
print(1)
elif x*y<0:
print(count+1)
elif x<y:
print(count)
elif x*y:
print(count+2)
else:
print(count+1)
|
p03309 | s872597078 | Accepted | n = int(input())
z = list(map(int, input().split()))
a = sorted(t - i - 1 for i, t in enumerate(z))
print(sum(abs(t - a[n//2]) for t in a)) |
p03471 | s251445868 | Wrong Answer | n,y = map(int,input().split())
y = y // 1000
for a in range(n+1):
rest = y - a * 10
if rest < 0:break
for b in range(n+1):
rest = rest - b * 5
c = n - a - b
if rest < 0:break
if rest == c:
print(a,b,c);exit()
print(-1,-1,-1)
|
p03435 | s517699226 | Wrong Answer | C = [list(map(int, input().split())) for i in range(3)]
ans = [[], []]
for i in range(3):
l = []
for j in range(3):
l.append(C[j][i])
ans[1].append(min(C[i]))
ans[0].append(min(l))
for i in range(3):
for j in range(3):
if ans[0][i] + ans[1][j] != C[j][i]:
print('No')
exit()
print('Yes')
|
p02916 | s839507988 | Wrong Answer | n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))
score = 0
prev = 0
for i in dishes:
score += points[i-1]
if prev > 0:
if i == prev + 1: score += bonuses[i-2]
print(score)
prev = i
print(score) |
p02836 | s938823762 | Accepted | def resolve():
S = list(input())
if len(S)%2 == 0:
s1, s2 = S[:len(S)//2], S[len(S)//2:]
else:
s1, s2 = S[:len(S)//2], S[(len(S)//2)+1:]
s2.reverse()
cnt = 0
for i in range(len(s1)):
if s1[i] != s2[i]:
cnt += 1
print(cnt)
if '__main__' == __name__:
resolve() |
p03779 | s681550340 | Wrong Answer | x=int(input())
a=0
for i in range(x):
if a+i>=x:
print(i)
break
else:
a+=i |
p02988 | s952938507 | Accepted | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-2):
#比較する3つのpの値
buf = p[i:i+3]
#真ん中の数値
buf1 = buf[1]
buf.sort()
if buf[1] == buf1:
ans += 1
#print(buf)
print(ans) |
p03262 | s090083833 | Wrong Answer | # C - Skip
import numpy as np
import fractions
N, X = map(int, input().split())
x = list(int(x) for x in input().split())
x.append(X)
x.sort()
x = np.array(x)
x = x - x[0]
ans = 10**18
if N == 1:
print(x[1] - x[0])
else:
for i in range(N-1):
ans = min(ans, fractions.gcd(x[i], x[i+1]))
print(ans) |
p02879 | s009450587 | Accepted | n,m = map(int,input().split())
if 0 < n and n < 10 and 0 < m and m < 10:
print(n*m)
else:
print(-1) |
p02597 | s958383331 | Wrong Answer | n = int(input())
c = input()
n = len(c)//2
ans = max(c.count('W',0,n), c.count('R',n,n*2))
print(ans)
|
p02797 | s289811925 | Accepted | N,K,S = map(int,input().split())
A = [S for i in range(K)]
if S<10**9:
A += [S+1 for i in range(N-K)]
else:
A += [1 for i in range(N-K)]
print(*A) |
p02688 | s229855239 | Accepted | import sys
N, K = map(int, sys.stdin.readline().rstrip().split())
number = list(range(1, N+1))
lists = []
for i in range(K):
d = sys.stdin.readline().rstrip()
li = [int(x) for x in sys.stdin.readline().rstrip().split()]
for k in li:
if k in number:
number.remove(k)
lists.append(li)
#print(lists)
print(len(number)) |
p02772 | s162992474 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
print("APPROVED" if all(i % 6 == 0 or i % 10 == 0 for i in a) else "DENIED") |
p03339 | s755170845 | Wrong Answer |
n=int(input())
s=str(input())
e_cnt=s.count('E')
num=[0]*n
num2=[0]*n
count=0
count2=0
for i in range(n):
if s[i]=='W':
count+=1
else:
count2+=1
num[i]=count
num2[i]=e_cnt-count2
ans=[0]*n
for i in range(n):
ans[i]=abs(num[i]+num2[i])
print(min(ans))
|
p03262 | s525927563 | Accepted | from fractions import gcd
from functools import reduce
N, X = map(int,input().split())
xi = list(map(lambda x: abs(x-X), list(map(int,input().split()))))
print(reduce(gcd,xi)) |
p03160 | s750884111 | Accepted | n = int(input())
hlist = list(map(int, input().split()))
# The minimum cost to reach step i (1->n)
dp = [0]*(n+1)
dp[1] = 0 # 1->1
for i in range(2, n+1):
dp[i] = min(dp[i-1] + abs(hlist[i-2] - hlist[i-1]), (dp[i-2] + abs(hlist[i-3] - hlist[i-1]) if i>2 else 10**9))
print(dp[n]) |
p03699 | s473915707 | Accepted | import sys
N = int(input())
num = sorted([int(input()) for i in range(N)])
MAX = sum(num)
if MAX % 10 != 0:
print(MAX)
sys.exit()
else:
for i in range(N):
if num[i] % 10 != 0:
print(MAX - num[i])
sys.exit()
print(0)
|
p02555 | s978878566 | Accepted | s = int(input())
dp =[0]*2001
dp[0] = dp[1] = dp[2] = 0
dp[3] = dp[4] = dp[5] = 1
dp[6] = dp[3]+1
for i in range(7,s+1):
dp[i] = dp[i-1]+dp[i-3]
print(dp[s] % (10**9+7)) |
p03804 | s075997634 | Accepted | import sys
input = sys.stdin.readline
n,m=map(int,input().split())
A=[input().strip() for _ in range(n)]
B=[input().strip() for _ in range(m)]
for i in range(n-m+1):
for j in range(n-m+1):
flg=True
for k in range(m):
#print(A[i+k][j:j+m],B[k])
if A[i+k][j:j+m]!=B[k]:
flg=False
if flg:
print("Yes")
exit()
print("No")
|
p02900 | s118858598 | Wrong Answer | a,b = [int(x) for x in input().split()]
def sosu(n):
ret = True
for i in range(2,int((n**0.5)+1)):
if n % i == 0:
ret = False
break
return ret
def f(n):
ret = []
for i in range(1,int((n**0.5)+1)):
if n % i == 0 and sosu(i):
ret.append(i)
return ret
A = f(a)
B = f(b)
ans = set(A) & set(B)
print(len(ans)) |
p03371 | s814691283 | Wrong Answer | A,B,C,X,Y=map(int,input().split())
if A+B<=C*2:
print(A*X+B*Y)
elif min(A,B)<=C:
if X>=Y:
print(Y*2*C+(X-Y)*A)
else:
print(X*2*C+(Y-X)*B)
else:
print(2*Y*C) |
p02726 | s437396079 | Accepted | N, X, Y = map(int, input().split())
ans = [0]*(N-1)
for i in range(1, N):
for j in range(i+1, N+1):
d = min(j-i, abs(X-i)+abs(j-Y)+1)
ans[d-1] += 1
print(*ans, sep='\n') |
p03387 | s581287196 | Accepted | X = list(map(int, input().split()))
Y = sorted(X)
ans = 0
if Y[0]%2==Y[1]%2 and Y[1]%2 != Y[2]%2:
ans +=1
Y = [Y[0]+1,Y[1]+1,Y[2]]
elif Y[1]%2==Y[2]%2 and Y[2]%2 != Y[0]%2:
ans +=1
Y = [Y[0], Y[1]+1,Y[2]+1]
elif Y[2]%2==Y[0]%2 and Y[0]%2 != Y[1]%2:
ans +=1
Y = [Y[0]+1, Y[1], Y[2]+1]
A = Y[2]-Y[0]
B = Y[2]-Y[1]
C = min(A,B)
D = max(A,B)
ans += C + (D-C)//2
print(ans) |
p03408 | s250681394 | Wrong Answer | N=int(input())
s=set([input() for _ in range(N)])
M=int(input())
t=set([input() for _ in range(M)])
print(sum([1 for x in s if not x in t])) |
p03774 | s310206032 | Wrong Answer | n,m = map(int,input().split())
stds = [tuple(map(int,input().split())) for _ in range(n)]
points = [tuple(map(int,input().split())) for _ in range(m)]
def d(s,p):
return abs(s[0]-p[0]) + abs(s[1] + p[1])
for std in stds:
ans = (-1, float('inf'))
for i, pnt in enumerate(points):
dst = d(std,pnt)
#print(i, dst, ans)
if dst < ans[1]:
ans = (i, dst)
print(ans[0]+1)
|
p03254 | s684603333 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
sum =x
cnt=0
for i in range(N):
if x -a[i] >= 0:
cnt+=1
x = x-a[i]
if x >0:
if cnt >0:
cnt = cnt-1
print(cnt) |
p04033 | s348937578 | Wrong Answer | a, b = [int(x) for x in input().strip().split()]
if a <= 0 and 0 <= b:
print('Zero')
elif a > 0:
print('Positive')
else:
if a == b:
print('Netative')
elif (b - a) % 2:
print('Netative')
else:
print('Positive') |
p02760 | s307325850 | Accepted | a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = set(int(input()) for i in range(n))
def check():
for i in range(3):
if all(a[i][j] in b for j in range(3)):
return True
if all(a[j][i] in b for j in range(3)):
return True
return all(a[i][i] in b for i in range(3)) or all(a[2-i][i] in b for i in range(3))
print('Yes' if check() else 'No') |
p02748 | s831370539 | Accepted | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# ①割引券を使わない場合の最少額
ans = min(a) + min(b)
# 割引券の金額を1つずつ確認し、①よりも低い場合に入れ替える
for _ in range(M):
x, y, c = map(int, input().split())
price = a[x - 1] + b[y - 1] - c
ans = min(ans, price)
print(ans) |
p04020 | s927920671 | Accepted | n, *a = map(int, open(0).read().split())
ans = prev = 0
for i in a:
tmp, prev = divmod(i+prev, 2)
ans += tmp
if i==0: prev=0
print(ans) |
p03041 | s362394375 | Accepted | n, k = map(int, input().split())
s = input()
print(s[0:k - 1] + s[k - 1].lower() + s[k:]) |
p03796 | s894734225 | Accepted | import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N=I()
ans=1
for i in range(N):
ans*=(i+1)
ans%=mod
print(ans)
main()
|
p02602 | s125229301 | Accepted | N,K = map(int,input().split())
A = list(map(int,input().split()))
A.insert(0,0)
for i in range(K+1,N+1):
if A[i]>A[i-K]:
print("Yes")
else:
print("No") |
p02663 | s186965113 | Wrong Answer | #スペース区切りの整数の入力
h1, m1, h2, m2, k = map(int, input().split())
asa = h1 * 60 + m1 + 1
yoru = h2 * 60 + m2 -1
ans = int((yoru - asa )/k)
print(ans* k)
|
p03607 | s879331250 | Accepted | N=int(input())
A=dict()
for i in range(N):
tmp=int(input())
if not tmp in A:
A[tmp]=1
elif A[tmp]==1:
A[tmp]=0
else:
A[tmp]=1
print(sum(A.values())) |
p02900 | s948562141 | Accepted | A, B = map(int, input().split())
def prime_factorize(n):
a = [1]
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
d=set(prime_factorize(A)) & set(prime_factorize(B))
print(len(d)) |
p03962 | s445646775 | Wrong Answer | a,b,c=map(int,input().split())
cnt=3
if a==b:
cnt-=1
if b==c:
cnt-=1
if c==a:
cnt-=1
print(cnt) |
p03345 | s646007077 | Wrong Answer | a, b, c, k = map(int, input().split())
if abs(a - b) >= 10e18:
print("Unfair")
elif k//2 == 0:
print(a - b)
else:
print(b - a) |
p02584 | s955400949 | Accepted | import math
x,k,d=map(int,input().split(" "))
if x<0:
x=(-1)*x
if d<0:
d=(-1)*d
s=math.floor(x/d)
if k<s:
print(x-d*k)
else:
w=k-s
v=x-d*s
if w%2==0:
print(v)
else:
print(abs(v-d))
|
p03250 | s892241842 | Accepted | A, B, C = sorted(map(int, input().split()))
print(C * 10 + A + B) |
p03146 | s915984503 | Wrong Answer | def judge(n):
if n % 2 == 0:
return n / 2
else:
return 3*n + 1
s = int(input())
ans = 1
while s != 4:
s = judge(s)
ans += 1
print(ans+3) |
p03699 | s718100971 | Accepted | n = int(input())
s = []
for i in range(n):
s.append(int(input()))
s.sort()
ans = 0
for i in range(n):
if sum(s)%10 != 0:
ans = sum(s)
break
else:
for i in range(n):
if s[i]%10 != 0:
s.remove(s[i])
ans = sum(s)
break
print(ans) |
p02664 | s564802662 | Accepted | T = str(input())
T = T.replace('P?','PD')
T = T.replace('?','D')
print(T) |
p03071 | s862382342 | Accepted | line = input()
A,B = [int(n) for n in line.split()]
if(abs(A-B) >= 2):
res = max(A,B)+(max(A,B)-1)
else:
res = A+B
print(res)
|
p02838 | s838343706 | Accepted | n=int(input())
a=list(map(int,input().split()))
counts=[0]*60
for b in a:
for i in range(60):
counts[i]+=b%2
b//=2
ans=0
mod = 10**9+7
for i in range(60):
c=counts[i]
comb=c*(n-c)
ans=(ans+(1<<i)*comb)%mod
print(ans) |
p02572 | s280009003 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = pow(10,9)+7
B = []
x = 0
for i in range(N-1):
x += A[i]
x %= mod
B.append(x)
ans = 0
for i in range(1,N):
ans += A[i]*B[i-1]
ans %= mod
print(ans)
|
p03457 | s182919066 | Accepted | N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
t[i], x[i], y[i] = map(int, input().split())
judg = 0
for i in range(N):
if x[i]+y[i]<=t[i]:
if t[i]%2==0 and (x[i]+y[i])%2==0:
judg += 1
elif t[i]%2!=0 and (x[i]+y[i])%2!=0:
judg += 1
if judg == N:
print('Yes')
else:
print('No')
|
p02995 | s462350848 | Accepted | def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = map(int, input().split())
cnt = B - A + 1
all_range = B // C + B // D - B // lcm(C , D)
sub_end = A - 1
sub_range = sub_end // C + sub_end // D - sub_end // lcm(C , D)
print(cnt - (all_range - sub_range)) |
p03386 | s585096024 | Accepted | a, b, k = map(int, input().split())
min = [0] * k
max = [0] * k
for i in range(k):
if a+i > b:
break
min[i] = a+i
for n in range(k):
if b-n < a:
break
max[n] = b-n
ans = min + max
ans = set(ans)
ans = list(ans)
ans.sort()
for j in ans:
if j == 0:
continue
print(j) |
p02881 | s191981595 | Accepted | 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
n = int(input())
ans = 10 ** 15
div_list = make_divisors(n)
for temp in div_list:
temp2 = n//temp
ans = min( temp + temp2 - 2 ,ans )
print(ans) |
p03493 | s293895471 | Accepted | S = input()
ans = 0
for i in range(3):
if S[i]=='1':
ans += 1
print(ans)
|
p02917 | s131688867 | Accepted | n=int(input())
b=[int(x) for x in input().split()]
ans=b[0]
if len(b)==1:
print(b[0]*2)
else:
for i in range(1,n-1):
ans+=min(b[i],b[i-1])
print(ans+b[-1])
|
p04005 | s076888056 | Accepted | A = list(map(int, input().split()))
A = sorted(A)
if any([a % 2 == 0 for a in A]):
print(0)
else:
print(A[0] * A[1]) |
p03481 | s873739197 | Wrong Answer | import math
x, y = map(int, input().split())
ans = 0
#ans = int(math.log2(y/x))
while y > x:
x = x * 2
ans += 1
print(ans + 1) |
p02596 | s134611896 | Accepted | K = int(input())
N = 1000000
x = 7 % K
for i in range(1, N+1):
if x == 0:
break
x = (x * 10 + 7) % K
if i == N:
i = -1
print(i) |
p02687 | s428027611 | Accepted | #!/usr/bin/env python3
s = input()
if s == 'ABC':
print("ARC")
elif s == 'ARC':
print("ABC")
else:
print("not expection word input") |
p03285 | s322104234 | Accepted | CAKE = 4
DONUTS = 7
n = int(input())
max_cake = n//CAKE
max_donuts = n//DONUTS
flag = 0
for i in range(max_cake+1):
for j in range(max_donuts+1):
if i*CAKE+j*DONUTS == n:
flag = 1
if flag == 1 :
print('Yes')
else:
print('No')
|
p03486 | s102624911 | Accepted | s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
''.join(s)
''.join(t)
if s < t:
print("Yes")
else:
print("No") |
p03827 | s969917800 | Wrong Answer | n = int(input())
s = input()
x = 0
i = 0
for i in range(len(s)):
i = i + (s[i]=='I') - (s[i]=='D')
x = max(x,i)
print(x) |
p02572 | s240580080 | Wrong Answer | n = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
for i in range(n):
ans += A[i] * sum(A[i+1:])
print(int(ans % mod)) |
p02935 | s123019408 | Accepted | n = int(input())
v = list(map(int, input().split()))
v.sort()
value = 0
for i, x in enumerate(v):
if i < 2:
value += x
else:
value += x * (2 ** (i - 1))
print(value / 2 ** (len(v) - 1)) |
p02775 | s296461177 | Wrong Answer | n=input()
a=0
b=[0,1,2,3,4,5,5,4,3,2]
for i in range(len(n)):
a+=b[int(n[i])]
if i+1!=len(n):
if int(n[i])>5:
a-=1
print(a) |
p03815 | s112394462 | Wrong Answer | N = int(input())
num = N // 11
res = 0
k = 0
res = num * 2
k = res * 11
if N % 11 == 0:
pass
else:
res += 1
k += 5
if k < N:
res += 1
k += 6
print(res) |
p04044 | s927442365 | Accepted | n,l = map(int,input().split())
input_lines = [input() for i in range(n)]
print(''.join(sorted(input_lines))) |
p03127 | s852693375 | Accepted | import math
n = int(input())
a = [int(i) for i in input().split()]
ans = a[0]
for i in range(n-1):
ans = math.gcd(ans, a[i+1])
print(ans) |
p03472 | s272994864 | Accepted | N, H = map(int, input().split())
slash = 0
Throw = []
for _ in range(N):
a, b = map(int, input().split())
slash = max(slash, a)
if b > a: Throw.append(b)
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる
Throw = sorted([th for th in Throw if th > slash], reverse=True)
dmg, cnt = 0, 0
for throw in Throw:
if dmg >= H: break
dmg += throw
cnt += 1
if dmg < H:
from math import ceil
cnt += ceil((H-dmg)/slash)
print(cnt) |
p03817 | s991406437 | Accepted | x = int(input())
y = x % 11
if y > 0:
cnt = 1
if y > 6:
cnt += 1
else:
cnt = 0
print((x // 11) * 2 + cnt) |
p03352 | s177387521 | Accepted | x = int(input())
ans = 0
tmp = 1
for i in range(1, int(x**0.5)+1):
for j in range(2, x):
tmp = pow(i, j)
if tmp > x:
tmp = pow(i, j-1)
#print(tmp, i, j)
break
ans = max(tmp, ans)
print(ans) |
p03852 | s604512211 | Accepted | c = input()
A = ['a', 'e', 'i', 'o', 'u']
if c in A:
print('vowel')
else:
print('consonant') |
p02683 | s031393212 | Wrong Answer | import numpy as np
from itertools import product
def readlines(n):
for _ in range(n):
yield list(map(int, input().split()))
def main():
N, M, X = map(int, input().split())
books = np.array(list(readlines(N)))
ans = np.inf
for bit in product([0, 1], repeat=N):
comb_sum = np.dot(np.array(bit), books)
if all(comb_sum[1:] >= X):
ans = min(ans, comb_sum[0])
print(ans)
main() |
p03327 | s111568651 | Accepted | print('ABD') if int(input()) >= 1000 else print('ABC') |
p04011 | s323783171 | Accepted | def main():
n = int(input())
k = int(input())
x = int(input())
y = int(input())
cost = 0
if n <= k:
cost += n * x
elif n > k:
cost += k * x + (n - k) * y
print(cost)
if __name__ == '__main__':
main() |
p02924 | s553025107 | Accepted | N = int(input())
ans = ((N-1)*N)//2
print(ans)
|
p03456 | s820650089 | Accepted | a,b = input().split()
a += b
can = 0
for i in range(1,1000):
if(i*i == int(a)):
can = 1
if(can == 1):
print("Yes")
else:
print("No") |
p03262 | s569476867 | Wrong Answer | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
if len(x) == 1:
print(int(*x)-X)
else:
res = [abs(x[i+1]-x[i]) for i in range(len(x)-1)]
print(gcd(*res))
|
p03455 | s606425532 | Accepted | a, b = map(int, input().split())
prod = a * b
if prod % 2 == 0:
print('Even')
else:
print('Odd') |
p02760 | s963147105 | Accepted | A = []
for _ in range(3):
A.append(list(map(int, input().split())))
B = set()
for _ in range(int(input())):
B.add(int(input()))
checkList = list()
for i in range(3):
checkList.append(set(A[i]))
for j in range(3):
checkList.append(set([A[0][j], A[1][j], A[2][j]]))
checkList.append(set([A[0][0], A[1][1], A[2][2]]))
checkList.append(set([A[0][2], A[1][1], A[2][0]]))
flag = False
for s in checkList:
if len(s - B) == 0:
flag = True
break
if flag:
print("Yes")
else:
print("No") |
p03345 | s180223522 | Accepted | A,B,C,K=map(int,input().split())
ans=A-B
if ans>10**18:
print('Unfair')
if K%2==0:
print(ans)
else:
print(-ans) |
p02629 | s506231931 | Accepted | n=int(input())
ans=''
check='abcdefghijklmnopqrstuvwxyz'
while n!=0:
n-=1
ans+=check[n%26]
n//=26
print(ans[::-1]) |
p02732 | s611451340 | Wrong Answer | import collections
N = int(input())
A = list(map(int, input().split()))
ct = collections.Counter(A)
ret = []
total = 0
for k,count in ct.items():
if count > 1:
total += count * (count-1) // 2
for i,v in enumerate(A):
if ct[v] > 1:
count = ct[v]
adjust = (count-1) * (count-2) // 2 - (count-1) * count // 2
val = total + adjust
else:
val = 0
print(val)
|
p02707 | s177751075 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1):
b[a[i] - 1] += 1
for subordinate in b:
print(subordinate)
|
p02553 | s517234391 | Accepted | a,b,c,d=map(int, input().split())
maximum_list=(a*c,a*d,b*c,b*d)
print(max(maximum_list)) |
p02922 | s962048504 | Accepted | A,B=map(int,input().split())
C=1
if B==1:
Ans=0
else:
for i in range(20):
D=C+(A-1)*(i+1)
if D>=B:
Ans=i+1
break
else:
pass
print(Ans)
|
p02983 | s279546714 | Wrong Answer | l, r = map(int, input().split())
lsmod = []
for i in range(l, min(l + 2019, r + 1)):
lsmod.append(i % 2019)
lsmod.sort()
print((lsmod[0] * lsmod[1]) % 2019) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.