problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02766 | s962790965 | Accepted | def base10to(n, r):
ans = 0
while n > 0:
n //= r
ans += 1
return ans
N,R = map(int,input().split())
print(base10to(N, R)) |
p02983 | s898567950 | Accepted | a,b = map(int,input().split())
min_mod = 2018
if b-a > 2019:
min_mod=0
else:
for aa in range(a,b):
for bb in range(aa+1,b+1):
if aa < bb:
cc=aa*bb
if min_mod > cc%2019:
min_mod = cc%2019
print(min_mod)
|
p02811 | s261018238 | Wrong Answer | import sys; readline = sys.stdin.readline
from collections import deque
k, x = map(int, readline().split())
if k * 500 >= x:
print('yes')
else:
print('No') |
p02791 | s528507742 | Accepted | a=int(input())
b=list(map(int,input().split()))
b_max=b[0]
total=0
for i in range(1,a):
if b[i]<=b_max:
total+=1
b_max=b[i]
print(total+1) |
p02993 | s421208879 | Wrong Answer | print('Bad' if len(set(list(input())))<4 else 'Good') |
p03407 | s183415964 | Wrong Answer | a, b, c = map(int, input().split())
print("Yes") if a + b <= c else print("No") |
p03767 | s161423826 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = 0
for i in a[1:-n:2]:
ans += i
print(ans)
|
p02897 | s574457229 | Accepted | N = int(input())
print("0.5" if N % 2 == 0 else ((N//2)+1)/N) |
p03254 | s977479737 | Accepted | def last_alert(list_):
iter_ = iter(list_)
n = next(iter_)
for i in iter_:
yield n, False
n = i
yield n, True
N, X = map(int, input().split())
ans = 0
for i, is_last in last_alert(sorted(map(int, input().split()))):
if is_last and X != i:
break
elif X < i:
break
X -= i
ans += 1
print(ans)
|
p03860 | s179186984 | Wrong Answer | s = input()
list1 = [str(x) for x in s]
print("A" + list1[0] + "C") |
p02700 | s476913453 | Accepted | import math
a,b,c,d = map(int,input().split())
t = math.ceil(c/b)
o = math.ceil(a/d)
if t <= o:
print('Yes')
else:
print('No') |
p02786 | s836108015 | Accepted | H = int(input())
attack = 0
while(H != 1):
H = H // 2
attack = attack +1
#print(attack)
kill = 0
for i in range(attack+1):
kill = kill + 2**i
#print(i,kill)
print(kill)
|
p03338 | s133802628 | Wrong Answer | N = int(input())
S = input()
max_count = 0
for i in range(0, N-1):
X = S[0:i+1]
Y = S[i+1:]
X_set = set(X)
Y_set = set(Y)
print(X,Y,X_set)
count = len(X_set & Y_set)
if max_count < count:
max_count = count
print(max_count) |
p03069 | s612296898 | Accepted | N = int(input())
S = list(input())
a = 0
b = 0
A = []
for i in range(N):
if S[i] == '.':
a += 1
else:
b += 1
A.append(b-a)
A.sort()
ans = min(a, b, a+A[0])
print(ans) |
p02693 | s269075116 | Accepted | K = int(input())
A, B = map(int, input().split())
flag=0
for i in range(A,B+1):
if i%K==0:
print('OK')
flag=1
break
if flag==0:
print('NG') |
p03077 | s227015322 | Accepted | n,a,b,c,d,e = map(int,open(0).read().split())
m = min(a,b,c,d,e)
ans = n//m+4
if n%m == 0:
print(ans)
else:
print(ans+1) |
p03427 | s530139126 | Accepted | n=input()
k=len(n)
if k==1:
print(n);exit()
nn=int(n)
ans= nn//(10**(k-1))-1+9*(k-1)
print(max(ans, sum([int(i) for i in n]) )) |
p03815 | s026887244 | Accepted |
x=int(input())
xi=x//11
if x%11==0:
print(2*xi)
elif x%11<=6:
print(2*xi+1)
else:
print(2*xi+2)
|
p02723 | s091210205 | Wrong Answer | S = input()
if S[2] == S[3]:
print('Yes')
else:
print('No') |
p02554 | s143554476 | Wrong Answer | N=int(input())
MOD=10**9+7
MAX=N+1
def powermod(base,ind):
if ind==1:
return base
elif ind%2==0:
return (powermod(base,ind//2)**2)%MOD
else:
return ((powermod(base,ind//2)**2)*base)%MOD
print(powermod(10,N)-2*powermod(9,N)+powermod(8,N)) |
p02720 | s079892776 | Accepted | from collections import deque
K = int(input())
lunlun = deque([i for i in range(1,10)])
for i in range(K):
x = lunlun.popleft()
if x % 10 != 0:
lunlun.append(x * 10 + (x % 10) - 1)
lunlun.append(x * 10 + (x % 10))
if x % 10 != 9:
lunlun.append(x * 10 + (x % 10) + 1)
print(x) |
p03211 | s655277180 | Wrong Answer | S = input()
num_len = 999
for i in range(len(S)-2):
X = int(S[i:i+3])
print(X)
num_len = min(num_len, abs(753-X))
print(num_len) |
p03645 | s890240295 | Accepted | N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
a, b = map(lambda x: int(x)-1, input().split())
G[a].append(b)
for v in G[0]:
for nv in G[v]:
if nv == N-1:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
p02642 | s096961531 | Wrong Answer | N = int(input())
p = list(map(int, input().split()))
p.sort(reverse=True)
lst = p[:]
jdg = True
temp = p[:]
ans = 0
while temp:
lst = []
q = temp.pop()
for i in temp:
if i%q!=0: lst.append(i)
if i==q:jdg=False
if jdg:
ans += 1
temp = lst[:]
print(ans) |
p03328 | s053482168 | Accepted | a,b=map(int,input().split())
print(sum(list(range(b-a)))-a) |
p03862 | s387381262 | Accepted | N, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
if A[0] > x:
ans += A[0] - x
A[0] = x
for i in range(1, N):
if A[i]+A[i-1] > x:
ans += A[i]+A[i-1]-x
A[i] -= A[i]+A[i-1]-x
print(ans)
|
p03069 | s144106264 | Wrong Answer | n = int(input())
s = input()
array = [c for c in s]
tmp1 = 0
for i in range(len(array) - 1, 0, -1):
if array[i] == "." and array[i - 1] == "#":
array[i - 1] = "."
tmp1 += 1
array = [c for c in s]
tmp2 = 0
for i in range(len(array) - 1):
if array[i] == "#" and array[i + 1] == ".":
array[i + 1] = "#"
tmp2 += 1
print(min(tmp1, tmp2))
|
p02899 | s278957581 | Wrong Answer | N=int(input())
A=sorted(list(map(int, input().split())))
arr=[None]*N
for a in range(N):
arr[A[a]-1]=a+1
print(*arr)
|
p02621 | s093827070 | Accepted | n = int(input())
print(n + n**2 + n**3)
|
p03338 | s975007088 | Wrong Answer | n = int(input())
s = input()
t = 0
for i in range(n):
if s.count(s[i]) >= 2:
t += 1
print(t) |
p02582 | s463380739 | Accepted | s = input()
ans = 0
if s[0] == "R":
ans += 1
if s[1] == "R":
ans += 1
if s[2] == "R":
ans += 1
elif s[1] == "R":
ans += 1
if s[2] == "R":
ans += 1
elif s[2] == "R":
ans += 1
print(ans) |
p02899 | s046557632 | Wrong Answer | import sys
import numpy as np
import numba
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@jit
def main(n, a):
ans = [None]*n
for i, j in enumerate(a):
ans[j-1] = i+1
for i in a:
print(i, end=' ')
n, *a = map(int,read().split())
print(main(n, a)) |
p03250 | s871955227 | Wrong Answer | a,b,c = map(int, raw_input().split(' '))
print max(10*a + b+c, a+10*b + c) |
p02791 | s815058732 | Wrong Answer | N = int(input())
P = list(map(int, input().split()))
count = 1
for i in range(len(P)-1):
if P[i] >= P[i+1]:
count += 1
print(count) |
p02811 | s545133564 | Accepted | K, X = [int(x) for x in input().split(" ")]
print("Yes" if K*500 >= X else "No")
|
p03109 | s853569332 | Wrong Answer | s = input()
s = s.replace('/','')
print(s)
result = int(s)
if result <= 20190430:
print("Heisei")
else:
print("TBD") |
p02922 | s484860364 | Wrong Answer | a,b=map(int,input().split())
ans=1
plag=a
while plag<b:
ans+=1
plag=plag+a-1
print(ans) |
p02789 | s487826396 | Wrong Answer | m,n=map(int,input().split())
if m==n:
print('YES')
else:
print('NO') |
p03555 | s994193720 | Accepted | c1=input()
c2=input()
print('YES' if c1==c2[::-1] and c2==c1[::-1] else 'NO') |
p02880 | s597598421 | Wrong Answer | n = int(input())
ok = False
for i in range(1,n):
ans = n//i
sur = n%i
if i > 9:
break
elif sur ==0 and 1<= ans <=9:
#print(i,ans)
ok = True
break
if ok:print("Yes")
else:print("No")
|
p03681 | s152707770 | Wrong Answer | n,m=map(int,input().split())
def perm(n):
a=1
for i in range(1,n+1):
a=(a*i)%(10**9+7)
return a
if n==m:
print((perm(n)*4)%(10**9+7))
elif abs(n-m)==1:
print((perm(n)*perm(m))%(10**9+7))
else:
print(0)
|
p03474 | s115721368 | Accepted | a,b=map(int,input().split())
s=input()
keep=0
for i in range(0,a):
if not 48<=ord(s[i])<=57:
keep=1
break
if not s[a]=="-":
keep=1
for j in range(a+1,a+b+1):
if not 48<=ord(s[j])<=57:
keep=1
break
print(["No","Yes"][keep==0]) |
p03632 | s811036892 | Accepted | a,b,c,d=map(int,input().split())
if a>c:
c,d,a,b=a,b,c,d
print(max(0,min(b-c,d-c))) |
p03803 | s282851722 | Wrong Answer | a, b = map(int, input().split())
if a == b == 1:
print('Draw')
elif a == 1 or a > b:
print('Alice')
elif b == 1 or a < b:
print('Bob')
else:
print('Draw') |
p03998 | s645237351 | Accepted | S = {}
S["a"] = input()
S["b"] = input()
S["c"] = input()
s = "a"
while S[s]:
s0 = S[s][0]
S[s] = S[s][1:]
s = s0
print(s.upper()) |
p02779 | s597546315 | Accepted | import numpy as np
if __name__ == "__main__":
_n = int(input())
_l = [int(i) for i in input().split()]
check = set()
for i in _l:
if i in check:
print("NO")
exit(0)
else:
check.add(i)
print("YES")
|
p03062 | s454620387 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
for i in range(n-1):
if a[i] >= 0:
continue
else:
a[i] *= -1
a[i+1] *= -1
ans = sum(a)
print(ans)
|
p03679 | s066359537 | Accepted | x,a,b=map(int,input().split())
if b-a<=x:
if b-a<=0:
print('delicious')
else:
print('safe')
else:
print('dangerous') |
p02645 | s064830096 | Accepted | s = input().strip()
print(s[:3]) |
p02765 | s700049539 | Wrong Answer | N, R = list(map(int, input().split()))
print(R if N >= 10 else R - (100 * (10 - N))) |
p03721 | s407021732 | Accepted | N, M = input().strip().split()
N, M = [int(N), int(M)]
# 2次元配列
ab = sorted(list(map(int, input().split())) for _ in range(N))
c=0
for a,b in ab:
c+=b
if c>=M:
print(a)
break |
p03317 | s628360358 | Accepted | x, y = map(int,input().split())
li = list(map(int,input().split()))
if (x-1)%(y-1) == 0:
print((x-1)//(y-1))
else:
print((x-1)//(y-1)+1) |
p03274 | s074204987 | Wrong Answer | n, k = [int(i) for i in input().split()]
xx = [int(i) for i in input().split()]
cost = float("inf")
for i in range(n-k+1):
j = i + k - 1
cost = min(cost, abs(xx[i] - 0) + abs(xx[j] - xx[i]))
print(cost) |
p03796 | s685726351 | Wrong Answer | n = int(input())
power = 1
for i in range(1,n+1):
power *= i
print(power % (10 ^ 9 + 7)) |
p02682 | s385882978 | Accepted | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
A, B, C, K = map(int, input().split())
ans = 0
if A >= K:
print(K)
exit()
ans += A
K -= A
if B >= K:
print(ans)
exit()
K -= B
if C >= K:
ans -= K
else:
ans -= C
print(ans)
if __name__ == '__main__':
main() |
p03779 | s042421216 | Wrong Answer | def kangaru(x):
count = 0
i = 1
while count != x:
if count + (i * 2 + 1) <= x:
count += i
elif count + i == x:
count += i
i += 1
return i - 1
def main():
x = int(input())
print(kangaru(x))
if __name__ == '__main__':
main()
|
p02689 | s240604366 | Wrong Answer | n, m = map(int, input().split())
h = []
h = list(map(int, input().split()))
ans = [0]*n
for i in range(m):
a, b = map(int, input().split())
if h[a-1] > h[b-1]:
ans[b-1] = 1
if h[a-1] < h[b-1]:
ans[a-1] = 1
else:
ans[a-1] = 1
ans[b-1] = 1
print(ans.count(0)) |
p03971 | s548515631 | Accepted | n,a,b =map(int,input().split())
s = input()
cnt = 0
p = 0
for i in range(n):
if s[i] == 'a':
if cnt <a+b:
print('Yes')
cnt +=1
else:
print('No')
elif s[i] == 'b':
p +=1
if cnt <a+b and p <=b:
print('Yes')
cnt +=1
else:
print('No')
else:
print('No') |
p03282 | s122188204 | Accepted | s = input()
k = int(input())
for i in range(min(k, len(s))):
if s[i] != '1':
print(s[i])
break
else:
print('1')
|
p02695 | s689900285 | Accepted | import itertools
n, m, q = map(int, input().split())
kumi = []
for i in range(q):
kumii = list(map(int, input().split()))
kumi.append(kumii)
ans = 0
for a in itertools.combinations_with_replacement(range(1, m+1), n):
temp = 0
for i in range(q):
ai, bi, ci, di = kumi[i]
ai, bi = ai-1, bi-1
if a[bi] - a[ai] == ci:
temp += di
ans = max(ans, temp)
print(ans) |
p02628 | s732699952 | Wrong Answer | n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if k>1:
s=p[0]+p[1]+p[2]
print(s)
else:
print(p[0])
|
p02973 | s997209845 | Accepted | # -*- coding: utf-8 -*-
# E - Sequence Decomposing
import sys
from bisect import bisect_right
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,read().split()))
X = [-1]*N
for a in A:
i = bisect_right(X,a-1)-1
X[i] = a
print(N - X.count(-1)) |
p02861 | s940681272 | Accepted | import math
import itertools
N = int(input())
position = [list(map(int, input().split())) for _ in range(N)]
town = list(range(N))
distance =list2 = [[0 for i in range(N)] for j in range(N)]
average = 0
for i in range(N):
for j in range(N):
distance[i][j] = math.sqrt((position[i][0] - position[j][0])**2
+ (position[i][1] - position[j][1])**2)
for order in itertools.permutations(town, N):
for i in range(N-1):
average += distance[order[i]][order[i+1]]
average /= math.factorial(N)
print(average) |
p02916 | s333196530 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sufficient = sum(b)
# print(sufficient)
for i in range(n-1):
if a[i]+1 == a[i+1]:
# print(i, c[a[i]-1])
sufficient += c[a[i]-1]
print(sufficient)
|
p02661 | s346651283 | Accepted | n=int(input())
l=[]
r=[]
ans=0
for i in range(n):
a,b=map(int,input().split())
l.append(a)
r.append(b)
l.sort()
r.sort()
if n%2==0:
ans=int(((r[n//2]+r[n//2-1])/2-(l[n//2]+l[n//2-1])/2)*2+1)
else:
ans=r[n//2]-l[n//2]+1
print(ans) |
p02783 | s190561064 | Accepted | print((lambda x: (x[0]-1)//x[1]+1)(list(map(int,input().split())))) |
p02888 | s374290032 | Accepted | n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
def find_min_fuka_idx(lst, e1, e2):
ok = -1
ng = len(lst)
while abs(ok-ng)>1:
mid = (ok+ng)//2
e3 = lst[mid]
if e1+e2 > e3 and e2+e3>e1 and e3+e1>e2:
ok = mid
else:
ng = mid
return ng
c = 0
for i in range(n-2):
for j in range(i+1, n-1):
c += find_min_fuka_idx(a[j+1:], a[i], a[j])
print(c)
|
p02832 | s696322036 | Wrong Answer | N = int(input())
a = list(map(int,input().split()))
def solve(l, K=0):
if K+1 in l:
pos = a.index(K+1)
return solve(l[pos:],K+1)
else:
return K
def judge(x):
if x == 0:
return -1
else:
return N-x
print(judge(solve(a))) |
p03836 | s768558038 | Accepted | sx, sy, tx, ty = map(int, input().split())
y = ty - sy
x = tx - sx
u = "U" * y
r = "R" * x
d = "D" * y
l = "L" * x
offset1 = "LU"
offset2 = "RD"
print(u + r + d + l + offset1 + u + r + offset2 + offset2 + d + l + offset1) |
p02628 | s957412980 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
A = sorted(A)
for i in range(K):
ans += A[i]
print(ans)
|
p03493 | s540056625 | Wrong Answer | import random
s1 = random.randint(0,1)
s2 = random.randint(0,1)
s3 = random.randint(0,1)
masu_list = (str(s1), str(s2), str(s3))
print(masu_list.count('1')) |
p03944 | s397006834 | Accepted | w,h,n=map(int,input().split())
u,d,r,l=h,0,w,0
for _ in range(n):
x,y,a=map(int,input().split())
if a==1 and x>l: l=x
if a==2 and x<r: r=x
if a==3 and y>d: d=y
if a==4 and y<u: u=y
if u>d and r>l: print((u-d)*(r-l))
else: print(0) |
p02793 | s188565678 | Accepted | from fractions import gcd
n = int(input())
lcm = list(map(int, input().split()))
ans = [1] * n
while len(lcm) < (1 << 14):
lcm.append(1)
ans.append(0)
for i in range(13, -1, -1):
bit = 1 << i
for j in range(bit):
new = lcm[j] // gcd(lcm[j], lcm[j | bit]) * lcm[j | bit]
ans[j] = new // lcm[j] * ans[j] + new // lcm[j | bit] * ans[j | bit]
ans[j] %= 1000000007
lcm[j] = new
print(ans[0])
|
p02813 | s622727007 | Accepted | # abc150_c.py
'''
全パターン作ってソートで順番みる
'''
import itertools
N = int(input())
P = tuple(list(map(int,input().split())))
Q = tuple(list(map(int,input().split())))
l = [i+1 for i in range(N)]
target = itertools.permutations(l)
cnt=0
pcnt = 0
qcnt = 0
for i in target:
cnt += 1
if i == P:
pcnt=cnt
if i == Q:
qcnt=cnt
print(abs(pcnt-qcnt))
|
p04044 | s028548079 | Accepted | n,l = map(int,input().split())
s = [input() for i in range(n)]
s.sort()
print(''.join(s)) |
p03095 | s538451737 | Wrong Answer | from string import ascii_lowercase
from collections import defaultdict
N = int(input())
S = input().strip()
c = defaultdict(int)
for i in range(N):
c[S[i]] += 1
ans = 1
for x in ascii_lowercase:
ans *= c[x] + 1
ans -= 1
print(ans)
|
p03150 | s871091331 | Accepted | s = input()
ans = 'keyence'
cnt = 0
for i in range(7):
if s[i] != ans[i]:
break
cnt += 1
for i in range(7):
if s[len(s) - i - 1] != ans[6 - i]:
break
cnt += 1
if cnt >= 7:
ans = 'YES'
else:
ans = 'NO'
print(ans)
|
p03017 | s211660829 | Accepted | import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
N,A,B,C,D = map(int,readline().split())
S = readline().rstrip()
if C < D:#抜かさなくて良い
if "##" not in S[A-1:D]:
print("Yes")
else:
print("No")
else:#抜かす必要がある
if "..." in S[B-2:D+1] and "##" not in S[A-1:C]:
print("Yes")
else:
print("No")
|
p03161 | s308492518 | Accepted | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import sys
import numpy as np
def main():
input = sys.stdin.readline
N, K = map(int, input().split())
H = list(map(int, input().split()))
H = np.array(H)
#dp[i]:iまでくるのに最小のコスト
dp = np.zeros(N, dtype = int)
for i in range(1, N):
hi = H[i]
dp[i] = min(dp[max(0,i-K):i] + np.abs(hi-H[max(0,i-K):i]))
print(dp[-1])
if __name__=='__main__':
main()
|
p03745 | s642501602 | 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)
|
p03109 | s359910859 | Accepted | def resolve():
s=input()
nen=int(s[:4])
getu=0
if s[5]==0:
getu=int(s[6])
else:
getu=int(s[5:7])
if nen>2019:
print('TBD')
elif nen==2019 and getu>=5:
print('TBD')
else:
print('Heisei')
resolve() |
p03696 | s907698811 | Wrong Answer | input()
s=t=input()
l,r=o="()"
exec('s=s'+'.replace(o,"")'*50)
print(l*(c:=s.count)(l)+t+r*c(r)) |
p02690 | s946211381 | Wrong Answer | s = int(input())
for i in range(0, s):
for j in range(-s, s):
if i**5-j**5 ==s:
print(i, j)
break |
p02718 | s450776868 | Accepted | V=0;
o=input().rstrip().split(' ')
p=input().rstrip().split(' ')
S=0;
for i in range(0,len(p)):
S+=int(p[i])
D=(1/(4*int(o[1])))*100;
p.sort(key=int,reverse=True)
for i in range(0,int(o[1])):
G = (int(p[i])/S)*100;
if G >= D:
continue;
else:
V=1;
break;
#print(D,G)
if V==0:
print("Yes")
else:
print("No") |
p04005 | s986759089 | Wrong Answer | A,B,C = map(int,input().split(" "))
# 一番長い辺で切れば断面の数は最小
L = max(A,B,C)//2
print(abs((A*B*L)-(A*B*(C-L)))) |
p02780 | s559231416 | Accepted | N,K=map(int,input().split())
P=list(map(int,input().split()))
for i in range(N):
if i!=0:
P[i]=P[i-1]+(P[i]+1)/2
else:
P[i]=(P[i]+1)/2
ans=P[K-1]
for i in range(N-K+1):
ans=max(ans,P[i+K-1]-P[i-1])
print(ans) |
p03150 | s840332524 | Accepted | # B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
s=si()
n=len(s)
for i in range(n):
for j in range(n-i+1):
t=s
t=t[:j]+t[j+i+1:]
if t=='keyence':
print('YES')
exit()
print('NO')
|
p03103 | s824979444 | Accepted | n, m = map(int,input().split())
ans = 0
ab = []
for i in range(n):
ab.append(list(map(int,input().split())))
ab.sort()
i = 0
while m > 0:
if m > ab[i][1]:
ans = ans + ab[i][0]*ab[i][1]
else:
ans = ans + ab[i][0]*m
m -= ab[i][1]
i += 1
print(ans) |
p03106 | s083441947 | Accepted | a, b, k = map(int, input().split())
count = 0
target = min(a, b)
l = []
for i in range(1, target + 1):
if a % i == 0 and b % i == 0:
l.append(i)
print(l[len(l) - k])
|
p03761 | s464136800 | Wrong Answer | import string
import collections
alphabet = string.ascii_lowercase
alphabet = list(alphabet)
ans_dic = {}
for i in alphabet:
ans_dic[i] = float("inf")
n = int(input())
L = []
for _ in range(n):
tmp = list(input())
dic = collections.Counter(tmp)
for k in ans_dic.keys():
ans_dic[k] = min(dic[k],ans_dic[k])
ans_dic = sorted(ans_dic.items(),key=lambda x:x[1],reverse=True)
ans = ""
for k,v in ans_dic:
if v != 0:
ans += k*v
print(ans) |
p02768 | s980718835 | Accepted | import sys
import math
from collections import deque
from collections import defaultdict
def comb(n, r, mod):
X, Y = 1, 1
for i in range(r):
X = X * (n - i) % mod
Y = Y * (r - i) % mod
return X * pow(Y, mod-2, mod)
def main():
n,a,b = list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
ans = pow(2, n, mod) - 1
ans = (ans - comb(n, a, mod) - comb(n, b, mod)) % mod
print(ans)
return 0
if __name__ == "__main__":
main() |
p02717 | s254061616 | Accepted | x,y,z=map(int,input().split())
print(z,x,y) |
p02701 | s971509398 | Accepted | n = int(input())
s = []
for i in range(n):
s.append(input())
print(len(set(s))) |
p03627 | s089826254 | Wrong Answer | from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split()))).most_common()
x=[0,0]
for i in range(len(a)):
if (x[1]<a[i][0] or x[0]<a[i][0]) and a[i][1]>=2:
if x[0]<x[1]:
x[0]=a[i][0]
else:
x[1]=a[i][0]
print(x[0]*x[1])
|
p03241 | s876125821 | Accepted | N,M = map(int,input().split())
g = 0
for i in range(1,int(M**0.5)+1):
if M%i==0:
a = i
b = M//i
if a>=N:
g = max(g,b)
if b>=N:
g = max(g,a)
print(g) |
p02711 | s388972856 | Accepted | N = list(input())
if N[0] == "7" or N[1] == "7" or N[2] == "7":
print("Yes")
else:
print("No") |
p02748 | s737619085 | Wrong Answer | A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
discount = []
for i in [0]*M:
discount.append(list(map(int,input().split())))
min_comb = min(a)+min(b)
for i in range(M):
min_comb = min(min_comb,a[discount[i][0]-1]+b[discount[i][1]-1]-discount[i][2])
ans = 0
print(ans) |
p03284 | s096220916 | Wrong Answer | import math
n,k=map(int,input().split())
if n%k==0:
print(0)
else:
a=abs(n-k*(n//k))
print(a) |
p02765 | s814502375 | Accepted | N,R = map(int,input().split())
if N >= 10:
print(R)
else:
print(R+100*(10-N)) |
p02706 | s827358001 | Wrong Answer | def solve():
n, m = map(int, input().split())
a = list(map(int, input().split()))
hoge = max(0, n-sum(a))
if hoge > 0:
print(a)
else:
print(-1)
return 0
if __name__ == "__main__":
solve()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.