problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02958 | s098832906 | Accepted | n=int(input())
A=list(map(int,input().split()))
P=sorted(A)
cnt=0
for i in range(len(A)):
if A[i] != P[i]:
cnt += 1
print("YES" if cnt <= 2 else "NO")
|
p03910 | s671281371 | Accepted | n=int(input())
ans=int(0)
check=int(0)
A=[]
for i in range(1,n*100):
ans+=i
A.append(i)
if ans>=n:
break
check=ans-n
for i in range(len(A)):
if i==check-1:
continue
else:
print(A[i]) |
p03592 | s437407012 | Accepted | import math
N,M,K = map(int,input().split())
list = [0 for i in range(N*M+1)]
i = 0
while i <= M:
k=0
list[N*i]=1
while k < N:
list[N*i+(M-2*i)*k]=1
k+=1
i+=1
j = 0
while j <= N:
l = 0
list[M*j]=1
while l < M:
list[M*j+(N-2*j)*l]=1
l+=1
j+=1
if list[K] ==1... |
p02847 | s947593453 | Wrong Answer | s = input()
l = ['SUN','MON','TUE','WED','THU','FRI','SAT']
ans = l.index(s)
if ans == 0:
ans = 7
print(ans) |
p03211 | s217495380 | Accepted | a=str(input())
ans=1000
for i in range(len(a)-2):
ans=min(ans,abs(int(a[i]+a[i+1]+a[i+2])-753))
print(ans) |
p03087 | s187651868 | Accepted | N, Q = map(int, input().split())
S = str(input())
l = [0]*N
count = 0
for i in range (1, N):
if S[i-1] == 'A' and S[i] == 'C':
count+=1
l[i] = count
else:
l[i] = count
for i in range(0, Q):
O, P = map(int, input().split())
print(l[P-1] - l[O-1])
|
p02995 | s143067242 | Accepted | a,b,c,d = map(int,input().split())
total_num = b-a+1
# # of x%c==0
c_num = b//c - (a-1)//c
d_num = b//d - (a-1)//d
from fractions import gcd
lcm = c*d//gcd(c,d)
cd_num = b//lcm - (a-1)//lcm
print(total_num-c_num-d_num+cd_num)
|
p03644 | s178066101 | Wrong Answer | # coding: utf-8
N = int(input())
ans_cou = 0
ans_num = 0
for i in range(N + 1):
a = i
sum = 0
while a % 2 == 0 and a != 0:
sum += 1
a = a // 2
if sum > ans_cou:
ans_cou = sum
ans_num = i
print(ans_num) |
p02598 | s691006640 | Wrong Answer | import math
N, K = map(int, input().split())
A = list(map(float, input().split()))
if K == 0:
print(int(max(A)))
exit()
if N == 1:
print(math.ceil(A[0]/K))
exit()
min_A = 0
max_A = 10**10
while( max_A - min_A > 1):
now = (min_A + max_A) // 2
temp = 0
for i in A:
if i > now:
temp += (i // n... |
p03623 | s956917096 | Accepted |
def resolve():
X, a, b = list(map(int, input().split()))
print("A" if abs(X-a) < abs(X-b) else "B")
if '__main__' == __name__:
resolve() |
p02696 | s159658255 | Accepted | a, b, n = list(map(int, input().split()))
x = min(b - 1, n) # b-1がいいけど、上限 nの制約あり
ans = int(a * x / b)
print(ans) |
p03338 | s406397411 | Accepted | N,S=int(input()),input()
ans=0
for i in range(1,N):
a,b,c=S[:i],S[i:],0
for j in range(97,123):
if chr(j)in a and chr(j)in b:c+=1
ans=max(ans,c)
print(ans) |
p04030 | s652511719 | Accepted | s=list(input())
r=[]
for x in s:
if x=="0":r.append("0")
elif x=="1":r.append("1")
elif x=="B" and len(r)>0:
r.pop()
print("".join(r)) |
p02552 | s989610090 | Wrong Answer | N = int(input())
m = 10**9 + 7
a = 10**N
a %= m
b = 9**N
b %= m
c = 8**N
c %= m
ans = a - 2*b + c
ans %= m
print(ans) |
p02691 | s863715498 | Wrong Answer | N=int(input())
a=list(map(int,input().split()))
count=0
A={}
for i,j in enumerate(a):
A[i+j]=0
#print(A)
if i-j in A.keys():
count+=1
if i+j in a:
A[i+j]+=1
else:
A[i+j]=1
count=sum(A.values())
print(count)
|
p03145 | s935226516 | Accepted | three = list(map(int, input().split()))
three.sort()
print(int(three[0] * three[1] / 2))
|
p03698 | s795077586 | Wrong Answer | s_l = list(input())
print('Yes') if len(s_l) == len(set(s_l)) else print('No') |
p03309 | s556786255 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
a[i] -= (i+1)
a.sort()
for i in range(n):
s += (a[i]-a[n//2])
print(s) |
p02726 | s350474103 | Wrong Answer | N, X, Y = map(int, input().split())
K = [0]*N
for i in range(1,N+1):
for j in range(i+1,N+1):
K[min(min(abs(X-i)+1,abs(Y-i))+abs(j-Y),abs(i-j))-1]+=1
for i in range(N):
print(K[i]) |
p02789 | s877522512 | Accepted | n, m = map(int, input().split())
print('Yes') if n == m else print('No')
|
p03239 | s942643747 | Accepted | N,T = map(int,input().split())
c = 0
for _ in range(N):
_c, _t = map(int,input().split())
if _t <= T:
if c == 0:
c = _c
elif c != 0 and _c <= c:
c = _c
print(c if c != 0 else "TLE") |
p03639 | s156974859 | Accepted | n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in range(n):
if a[i] % 2 == 1:
x += 1
elif a[i] % 4 == 0:
z += 1
elif a[i] % 2 == 0:
y += 1
if x == 0:
ans = 'Yes'
elif y == 0:
if x <= z + 1:
ans = 'Yes'
else:
ans = 'No'
else:
if x > z:
ans = 'No'
els... |
p02642 | s845454459 | Accepted | N = int(input())
A = list(map(int, input().split()))
A.sort()
C = [0] * A[-1]
for Ai in A:
if C[Ai - 1] >= 1:
C[Ai - 1] += 1
continue
i = Ai
while i <= A[-1]:
C[i - 1] += 1
i += Ai
print(sum([C[Ai - 1] == 1 for Ai in A]))
|
p03679 | s364303228 | Accepted | x,a,b=map(int,input().split())
n=b-a
if n<=0:
print("delicious")
elif n<=x:
print("safe")
else:
print("dangerous") |
p02621 | s162065353 | Accepted | a = int(input())
print(a+a**2+a**3) |
p03639 | s255674335 | Accepted |
n = int(input())
cnt2 = 0
cnt4 = 0
A = list(map(int, input().split()))
for a in A:
if a % 4 == 0:
cnt4 += 1
elif a % 2 == 0:
cnt2 += 1
odd = n - cnt2 - cnt4
if cnt2 != 0:
odd += 1
if odd - 1 > cnt4:
print("No")
else:
print("Yes")
|
p02811 | s846166580 | Accepted | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.... |
p02658 | s576143164 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in A:
ans = ans * i
if ans > 10**18:
ans = -1
break
for i in A:
if i == 0:
ans = 0
print(ans) |
p02584 | s433913761 | Accepted | x, k, d = map(int, input().split())
x = abs(x)
if x == 0:
if k % 2 == 0:
print(0)
else:
print(d)
exit()
if x - k*d >= 0:
print(abs(x) - k*d)
else:
k -= (x//d)
x -= (x//d)*d
if k % 2 == 0:
print(x)
else:
print(abs(x-d)) |
p03137 | s433327465 | Accepted | # -*- coding: utf-8 -*-
def main():
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
diff = list()
for i, j in zip(x, x[1:]):
diff.append(abs(i - j))
diff = sorted(diff, reverse=True)
print(sum(diff) - sum(diff[:n - 1]))
if __name__ == '__main__':
ma... |
p02732 | s167248189 | Accepted | N=int(input())
A=list(map(int,input().split()))
ls=[0 for _ in range(N)]
for i in range(N):
ls[A[i]-1]+=1
s=0
for i in range(len(ls)):
m=ls[i]*(ls[i]-1)//2
s+=m
for j in range(N):
print(s-(ls[A[j]-1]-1)) |
p03696 | s956830544 | Accepted | N = int(input())
S = input()
d = [0] * (N + 1)
for i in range(N):
d[i + 1] = d[i] + int(S[i] == "(") - int(S[i] == ")")
a = d[-1]
b = min(d)
print("(" * -b + S + ")" * (a - b))
|
p03239 | s525497886 | Accepted | N,T = map(int,(list(input().split())))
cost = 1001
for _ in range(N):
c,t = map(int,(list(input().split())))
if t<=T:
cost=min(cost,c)
if cost == 1001:
print('TLE')
else:
print(cost)
|
p02766 | s657187419 | Wrong Answer | n,k=map(int,input().split())
cnt=1
ans=0
if k>n:
print(1)
else:
while n>cnt:
ans+=1
cnt*=k
print(ans)
|
p03556 | s857692239 | Accepted | n = int(input())
ans = 0
for i in range(1, int(n**0.5)+1):
if i*i <= n:
ans = i*i
print(ans)
|
p02693 | s199219256 | Accepted | K=int(input())
A,B=map(int, input().split())
cnt=0
for i in range(B//K+1):
if A<=K*i and K*i<=B:
cnt+=1
print('OK' if cnt>0 else 'NG') |
p03799 | s686932575 | Accepted | n,m = map(int,input().split())
if n*2>m:
print(m//2)
else:
m -= n*2
print(n+m//4) |
p03625 | s666121459 | Accepted | from collections import Counter
def main():
n = int(input())
A = list(map(int, input().split()))
c = Counter(A)
B = sorted([(k, v) for k, v in c.items() if v >= 2], reverse = True, key = lambda x: x[0])
if len(B) < 2:
print(0)
elif B[0][1] >= 4:
print(B[0][0] ** 2)
else:
... |
p02888 | s902656689 | Accepted | import sys
from bisect import bisect_left
read=sys.stdin.buffer.readline
N=int(read())
L=list(map(int,read().split()))
L.sort()
ans=0
for i in range(N-2):
for j in range(i+1,N-1):
ans+=bisect_left(L,L[i]+L[j])-(j+1)
print(ans) |
p02608 | s858216162 | Accepted | N = int(input())
cnt = [0] * (N+1)
for x in range(1, int(N**0.5)+1):
for y in range(1, int(N**0.5)+1):
fxy = x**2 + y**2 + x*y
if N < fxy: break
for z in range(1, int(N**0.5)+1):
f = fxy + z**2 + y*z + z*x
if N < f: break
cnt[f] += 1
print(*cnt[1:], sep='\... |
p03109 | s068744731 | Accepted | _,b,c=map(int,input().split('/'));print("HTeBiDs e i"[b>4and c>0::2]) |
p02823 | s615827444 | Wrong Answer | import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7
def input():
return sys.stdin.readline()[:-1]
def mi():
return map(int, input().split())
def ii():
return int(input())
def i2(n):
tmp = [list(mi()) for i in range(n)]
return [list(i) for i in zip(*tmp)]
def main():
N, A, B = mi()
if... |
p02988 | s052633949 | Accepted | import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
n=I()
ps=LI()
compare=[]
count=0
for i in range(1,n-1):
compare=[]
compare.append(ps[i-1])
compare.append(ps[i])
... |
p02933 | s696153710 | Accepted | a = int(input())
s = input()
if a >= 3200:
print(s)
else:
print("red")
|
p03106 | s419023747 | Wrong Answer | A, B, K = map(int, input().split())
cnt = 0
for i in range(1, 101):
if A%i == 0 and B%i == 0:
cnt += 1
if cnt == K:
print(i)
break |
p03943 | s720292120 | Accepted | l=list(map(int,input().split()))
print("Yes")if(e:=sum(l))%2==0 and e//2 in l else print("No") |
p02689 | s610341069 | Accepted | #C
import numpy as np
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
G = 0
lists = np.zeros(N)
for i in range(M):
A, B = list(map(int, input().split()))
if H[A-1] < H[B-1]:
lists[A-1] = 1
elif H[A-1] == H[B-1]:
lists[A-1] = 1
lists[B-1] = 1
else:
... |
p02730 | s172898860 | Accepted | s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[(n+3)//2-1:n]
if s == s[::-1] and a == a[::-1] and b == b[::-1]:
print('Yes')
else:
print('No') |
p02862 | s996891367 | Accepted | def ncr(n, r):
return fac[n] * facinv[r] * facinv[n - r] % MOD
MOD = 10 ** 9 + 7
X, Y = map(int, input().split())
N = 10 ** 6
fac = [1, 1]
facinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
fac.append(fac[i - 1] * i % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
facinv.append((facinv[-1] *... |
p02923 | s167390217 | Accepted | #入力:[n1,n2,...nk](int:整数配列)
def input_array():
return list(map(int,input().split()))
n=int(input())
H=input_array()
ans=0
tmp_ans=0
for i in range(1,n):
if H[i-1]>=H[i]:
tmp_ans+=1
else:
if tmp_ans>ans:
ans=tmp_ans
tmp_ans=0
if tmp_ans>ans:
ans=tmp_ans
print(ans) |
p03761 | s912201014 | Accepted | from copy import deepcopy
n = int(input())
s = [input() for _ in range(n)]
cnt = []
for si in s:
tmp = [0] * 26
for i in range(len(si)):
tmp[ord(si[i])-97] += 1
if cnt == []:
cnt = deepcopy(tmp)
else:
for j in range(26):
cnt[j] = min(cnt[j], tmp[j])
ans = ''
for i i... |
p03286 | s447281448 | Wrong Answer | N = int(input())
S = ""
c = 1
while N != 0:
if N%(2**c) != 0:
N -= (-2)**(c-1)
S = "1" + S
else:
S = "0" + S
c += 1
print(S) |
p02714 | s874348763 | Accepted | N = int(input())
S = input()
cnt = S.count("R")*S.count("G")*S.count("B")
for i in range(N):
for d in range(N):
j = i+d
k = j+d
if(k >= N):
break
if(S[i] != S[j] and S[j] != S[k] and S[k] != S[i]):
cnt -= 1
print(cnt) |
p03038 | s254528565 | Wrong Answer | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, M = mapint()
As = list(mapint())
As.sort()
BC = [list(mapint()) for _ in range(M)]
BC.sort(key=lambda x: x[1])
cum = 0
for b, c in BC[::-1]:
if b<As[0]:
break
As.... |
p03206 | s802475098 | Accepted | D = int(input())
print('Christmas'+' Eve'*(25-D)) |
p02584 | s822961110 | Accepted | X,K,D=map(int,input().split())
c=[]
k=K
if X<0:
X=-X
if X-K*D>0:
print(X-K*D)
else:
a=X//D
if a%2==K%2:
print(min((X-D*a),abs(X-D*(a+2))))
else:
print(min((X-D*(a-1)),abs(X-D*(a+1))))
|
p03061 | s160093796 | Accepted | from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
r=[0]*(n+1)
for i in range(n):
l[i+1]=gcd(l[i],a[i])
for i in range(n-1,-1,-1):
r[i]=gcd(r[i+1],a[i])
ans=l[-1]
for i in range(n):
ans=max(ans,gcd(l[i],r[i+1]))
print(ans)
|
p02916 | s157772967 | Wrong Answer | n = int(input())
s = 0
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
for i in range(n):
s += b[i]
for i in range(n-1):
if a[i+1] - a[i] == 1:
s += c[a[i]-1]
print(s)
|
p02583 | s302240745 | Accepted | n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n):
for j in range(i+1,n):
for k in range(j+1,n):
if l[i]==l[j] or l[j]==l[k] or l[i]==l[k]:
continue
if abs(l[i]-l[j])<l[k]<l[i]+l[j]:
cnt+=1
print(cnt)
|
p03061 | s278257904 | Accepted | from math import gcd
N=int(input())
A=list(map(int,input().split()))
if N==2:
print(max(A))
else:
L=[0 for _ in range(N)]
R=[0 for _ in range(N)]
L[0]=A[0]
R[-1]=A[-1]
for i in range(1,N):
L[i]=gcd(A[i-1],L[i-1])
R[N-1-i]=gcd(A[N-i],R[N-i])
ans=max(L[-1],R[0])
for j in ... |
p02555 | s824253304 | Accepted | s = int(input())
p = [0]*(s+1)
mod = 10**9 + 7
p[0] = 1
if s >= 3:
for i in range(3,s+1):
p[i] = (sum(p[:i-2]))%mod
print(p[s]) |
p02861 | s806392164 | Wrong Answer | import math
n = int(input())
X = [0]*n
Y = [0]*n
for i in range(n):
X[i],Y[i] = map(int, input().split())
X.append(X[0])
Y.append(Y[0])
def length(X1, Y1, X2, Y2):
l = (X2-X1)**2 + (Y2-Y1)**2
return math.sqrt(l)
sum = 0
for i in range(n):
sum += length(X[i],Y[i],X[i+1],Y[i+1])
#print(sum)
ans = sum *... |
p03243 | s304659154 | Accepted | #k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]
n = int(input())
q, mod = divmod(n,111)
if mod == 0:
... |
p02727 | s039982794 | Accepted | x, y, a, b, c = map(int, input().split())
ps = sorted(list(map(int, input().split())), reverse=True)
qs = sorted(list(map(int, input().split())), reverse=True)
rs = sorted(list(map(int, input().split())), reverse=True)
choice_apples = sorted(ps[:x] + qs[:y])
total = 0
j = 0
for i in choice_apples:
if rs and i < r... |
p02995 | s734893413 | Accepted | import fractions
a,b,c,d=map(int,input().split())
before=(a-1)//c+(a-1)//d-(a-1)//(c*d//fractions.gcd(c,d))
after=b//c+b//d-b//(c*d//fractions.gcd(c,d))
print(before-after-a+b+1) |
p03556 | s010165513 | Accepted | n = int(input())
ans = 1
for i in range(1, n):
if i**2 > n:
ans = (i-1)**2
break
print(ans) |
p02836 | s436776047 | Accepted | S = input()
l_s = len(S)
cnt = 0
for i in range(0,l_s//2):
if S[i] != S[-i-1]:
cnt += 1
print(cnt) |
p02675 | s953356819 | Accepted | n = int(input())
a = ['pon', 'pon', 'hon', 'bon', 'hon', 'hon', 'pon', 'hon', 'pon', 'hon']
print(a[n%10])
|
p03817 | s451576645 | Accepted | n = int(input())
res = 0
res += n // 11
n %= 11
res *= 2
if n == 0:
pass
elif n < 7:
res += 1
else:
res += 2
print(res) |
p02641 | s560210495 | Accepted | X, N = map(int, input().split())
P = list(map(int, input().split()))
best = float('inf')
ans = -1
for a in range(102):
if a in P:
continue
if best > abs(X - a):
best = abs(X - a)
ans = a
print(ans)
|
p02647 | s399787219 | Accepted | N,K = map(int,(input().split()))
A = list(map(int,(input().split())))
for _ in range(min(K,100)):
s = [0]*(N+1)
for i in range(N):
l = max(i - A[i],0)
r = min(i + A[i] + 1,N)
s[l] += 1
s[r] -= 1
for i in range(1,N):
s[i] += s[i-1]
for i in range(N):
A[i] =... |
p02755 | s160261562 | Accepted | A,B=map(int,input().split())
ans=-1
for i in range(1500):
if int(i*0.08)==A and int(i*0.1)==B:
ans=i
break
print(ans) |
p02642 | s274437598 | Accepted | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
prime = [True] * (10 ** 6 + 10)
b = sorted(set(a))
for i in b:
num = i * 2
while True:
if num >= 10 ** 6 + 1:
break
prime[num] = False
num += i
ans = 0
for s in a:
if pr... |
p03817 | s170194150 | Wrong Answer | """
10**15なので,ループで割ることを考える
1 + (6, 5)
"""
x = int(input())
count = 0
if x == 1:
print(count)
exit()
else:
x -= 1
count += 1
count += (x // 11) * 2
x = x % 11
# if x == 1 or x == 8 or x == 9:
# count += 2
# elif x == 7 or x == 10:
# count += 3
# elif x == 0:
# print(count)
# exit()
# e... |
p03449 | s776037798 | Wrong Answer | n = int(input())
a = []
for _ in range(2):
a.append(list(map(int, input().split(" "))))
res = 0
for i in range(n):
res += a[0][i]
sum_row_1 = sum(a[0][i + 1:n])
sum_row_2 = sum(a[1][i + 1:n])
if sum_row_1 < sum_row_2:
res += sum(a[1][i:n])
break
elif sum_row_1 == sum_row_2 == 0... |
p02983 | s051805466 | Wrong Answer | import sys
L, R = map(int, input().split())
m = 10*100
for i in range(L, R):
for j in range(i+1, R+1):
tmp = (i*j)%2019
if tmp == 0:
print(0)
sys.exit()
else:
m = min(m, tmp)
print(m) |
p02779 | s345256668 | Accepted | n=int(input())
A=set(map(int,input().split()))
if len(A)==n:
print("YES")
else:
print("NO") |
p03672 | s053629943 | Accepted | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
S=input()
for i in range(-(... |
p03836 | s034021995 | Accepted | sx, sy, tx, ty = map(int, input().split())
ans = 'R'*(tx-sx)+'U'*(ty-sy)+'L'*(tx-sx)+'D'*(ty-sy)
ans += 'D'+'R'*(tx-sx+1)+'U'*(ty-sy+1)+'LU'+'L'*(tx-sx+1)+'D'*(ty-sy+1)+'R'
print(ans) |
p03543 | s002290408 | Accepted | n = input()
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
print('Yes')
else:
print('No') |
p02879 | s102182295 | Accepted | # from collections import Counter
# n = int(input())
# li = list(map(int, input().split()))
a, b = map(int, input().split())
# n = int(input())
print(a*b if a<10 and b<10 else -1)
|
p02576 | s809550449 | Wrong Answer | n, x, t = [int(i) for i in input().split()]
print(n // x * t) |
p03657 | s877604001 | Accepted | # クッキー枚数(A,B)を整数で入力
A,B = map(int,input().split())
# AかBかA+Bのどれかを3匹に分けれればPossible、できなければImpossible
if A%3==0 or B%3==0 or (A+B)%3==0:
print("Possible")
else:
print("Impossible") |
p03331 | s858499382 | Wrong Answer | N = int(input())
min = 10000000000000
for i in range(1, N//2):
A = str(i)
B = str(N - i)
ref = 0
for a in A:
ref += int(a)
for b in B:
ref += int(b)
if ref < min:
min = ref
print(min) |
p03474 | s392478656 | Wrong Answer | a,b = map(int, input().split())
s = input()
if ("-" not in s[:a])&("-" not in s[b:])&(s[a]=="-"):
print("Yes")
else:
print("No") |
p03038 | s620769039 | Accepted | N,M=map(int, input().split())
A=list(map(int, input().split()))
B = {}
C = {}
for i in range(M):
B[i],C[i]=map(int, input().split())
high_scores = sorted(C.items(), key=lambda x:x[1], reverse=True)
sum_b = 0
for score in high_scores:
sum_b += B[score[0]]
if N < sum_b:
A += [score[1]] * (B[score[0... |
p02724 | s420673484 | Accepted | n = int(input())
a = n // 500; b = n % 500 // 5
print(a * 1000 + b * 5) |
p03011 | s712914360 | Wrong Answer | p,q,r=map(int,input().split())
if p+q<q+r and p+q<p+r:
print(p+q)
if p+r<p+q and p+r<q+r:
print(p+r)
if q+r<p+r and q+r<p+q:
print(q+r)
if p+r==q+r and p+r<p+q:
print(p+r)
if p+q==q+r and p+q<p+r:
print(p+q)
if p+q==p+r and p+q<p+q:
print(r+q)
if p==q==r:
print(p+q) |
p02676 | s086071623 | Accepted | k = int(input())
s = input()
if len(s) > k:
s = s[:k] + '...'
print(s) |
p03475 | s224250305 | Wrong Answer | n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
ans = 0
for j in range(i, n-1):
if csf[j][1] >= ans:
ans = csf[j][0] + csf[j][1]
else:
ans += csf[j][0] + (ans - csf[j][1]) % csf[j][2]
print(ans) |
p02596 | s569925575 | Wrong Answer | k=int(input())
flag=True
seq=7
"""
これは階乗を含むのでO(klogk)で重い
for i in range(1,k):
if (7*(10**i-1)//9) % k==0:
print(i)
flag=False
break
"""
for i in range(1,k):
if seq%k==0:
print(i)
flag=False
break
seq=(seq*10+7)%k # %k(modの考え方)がなければ10**6ではO(k)は重すぎた
if flag:
print(-1) |
p03821 | s898927380 | Wrong Answer | n = int(input())
A = []
B = []
ans = 0
for _ in range(n):
a,b = map(int,input().split())
A.append(a)
B.append(b)
for _ in range(n):
a = A.pop(-1)
b = B.pop(-1)
a += ans
ans += a%b
print(ans) |
p03720 | s516867516 | Wrong Answer | n,m = map(int,input().rstrip().split(' '))
G = [[]]*n
for i in range(m):
a,b = map(int,input().rstrip().split(' '))
a-=1
b-=1
G[a].append(b)
G[b].append(a)
for i in range(n):
print(len(G[i])) |
p02598 | s094271011 | Accepted | n,k,*a = map(int,open(0).read().split())
def func(b):
c = k
for i in a:
c -= (i-1)//b
if c < 0:
return False
return True
l = 1
r = max(a)
while(r>l):
lr = (l+r)//2
if func(lr):
r = lr
else:
l = lr + 1
print(r) |
p03211 | s844625422 | Accepted | n=input()
l=[]
for i in range(len(n)-2):
l.append(int(n[i:i+3]))
l2=list(map(lambda x: abs(753-x),l))
print(min(l2)) |
p02646 | s207798754 | Accepted | A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
if V<=W:
print('NO')
else:
if abs(A-B)<=abs(V-W)*T:
print('YES')
else:
print('NO') |
p02659 | s503517345 | Accepted |
A, B = map(str, input().split())
A = int(A)
B = int(B.replace(".",""))
ans = A * B // 100
print(ans) |
p02912 | s642101483 | Wrong Answer | from math import log2
from heapq import heappop, heapify, heappush
def main():
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [-log2(a) for a in A]
heapify(A)
for _ in range(m):
a = heappop(A)
a += 1
heappush(A, a)
print(sum([int(pow(2, -a)... |
p02613 | s367148726 | Accepted | import collections
n=int(input())
l=[]
for i in range(n):
l.append(input())
c=collections.Counter(l)
for k in ['AC','WA','TLE','RE']:
if k in c.keys():
print(k+' x '+str(c[k]))
else: print(k+' x '+str(0))
|
p03416 | s182140823 | Accepted | A,B=map(int,input().split())
cnt=0
for i in range(A,B+1):
if str(i)==str(i)[::-1]:
cnt+=1
print(cnt) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.