problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03250 | s646404806 | Accepted | A,B,C = input().split()
ls = [int(A+B)+int(C),int(B+A)+int(C),int(A)+int(B+C),int(A)+int(C+B),int(B)+int(A+C),int(B)+int(C+A)]
print(max(ls)) |
p02836 | s476555712 | Accepted | s = input()
count = 0
for i in range(len(s)//2):
if s[i] != s[len(s)-1-i]:
count += 1
print(count) |
p03557 | s153471753 | Accepted | from bisect import bisect_left,bisect_right
n=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for i in B:
ans +=bisect_left(A,i)*(n-bisect_right(C,i))
print(ans) |
p03471 | s800947319 | Accepted | n,y=map(int,input().split())
for a in range(n+1):
for b in range(n+1):
c=(y-(a*10000+b*5000))//1000
if a+b+c==n and c>=0:
print(a,b,c)
exit()
print(-1,-1,-1) |
p02723 | s774960924 | Accepted | s = list(input())
print('Yes' if s[2] == s[3] and s[4] == s[5] else 'No') |
p03076 | s361962507 | Accepted | Value = [int(input()) for _ in range(5)]
amari = list()
for i in range(5):
if(Value[i]%10 == 0):
amari.append(10)
else:
amari.append(Value[i]%10)
min_amari = [i for i in range(5) if(min(amari)==amari[i])]
ans = 0
for i in range(5):
if(i == min_amari[0]):
ans += 0
else:
ans += (Value[i] + 10-ama... |
p02818 | s284111182 | Wrong Answer | A,B,K=map(int,input().split())
if A>=K:
A=A-K
else:
B=B-(K-A)
A=0
print(A,B) |
p02678 | s562962975 | Wrong Answer | n,m = map(int, input().strip().split())
to = [[] for _ in range(n)]
for _ in range(m):
a,b = map(int, input().strip().split())
to[a-1].append(b-1)
to[b-1].append(a-1)
stack=[0]
ans=[None]*n
while stack:
cur=stack.pop()
for nxt in to[cur]:
if ans[nxt] is not None: # visited
cont... |
p02831 | s171595344 | Wrong Answer | def gcd(a, b):
if a < b:
a, b = b, a
while b != 0 :
a, b = b, a % b
return a
def lcm(a, b):
return (a * b) / gcd(a, b)
a , b = map(int, input().split())
print(lcm(a, b)) |
p02641 | s176547137 | Wrong Answer | X,N=map(int,input().split())
p=sorted(list(map(int,input().split())))
sa_min=100
"""
sa=[]
for i in range(N):
sa.append(p[i]-X)
"""
for i in range(101):
if sa_min>abs(i-X) and (not i in p):
sa_min=abs(i-X)
ans=i
if N==0:ans=X
print(ans) |
p03644 | s815570017 | Accepted | N = int(input())
ans = 1
while ans <= N:
ans *= 2
print(int(ans/2)) |
p02795 | s408751928 | Accepted | H = int(input())
W = int(input())
N = int(input())
print(min((N-1)//H, (N-1)//W) + 1)
|
p02996 | s663052309 | Accepted | from heapq import heappush, heappop
n = int(input())
q = []
for _ in range(n):
a, b = map(int, input().split())
heappush(q, (b, a))
time = 0
while q:
deadline, cost = heappop(q)
time += cost
if deadline < time:
print('No')
break
else:
print('Yes')
|
p03338 | s765451008 | Accepted | N = int(input())
S = input()
ans = 0
for i in range(1, N):
head = set(S[:i])
tail = set(S[i:])
tmp_sum = 0
for c in head:
if c in tail:
tmp_sum += 1
ans = max(ans, tmp_sum)
print(ans)
|
p02546 | s993432698 | Accepted | S=input()
if S[-1]=='s':
print(S+'es')
else:
print(S+'s') |
p02607 | s154154442 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
ans = 0
for i, a in enumerate(a):
if i % 2 == 1:
if a % 2 == 1:
ans += 1
print(ans) |
p02935 | s782280804 | Accepted | n = int(input())
v = sorted([int(i) for i in input().split()], reverse=True)
rs = v[-1]/2**(n-1)
for i in range(n-1):
rs += v[i] /2**(i+1)
print(rs) |
p02765 | s688957605 | Wrong Answer | n,r=map(int,input().split())
if n>=10:
print(r)
else:
print(r+100*(10-r)) |
p03632 | s645125326 | Wrong Answer | a,b,c,d=map(int,input().split())
if b<c or a>d:
print(0)
elif b>=c:
print(min(abs(b-c),abs(b-d)))
else:
print(min(abs(d-a),abs(d-b)))
|
p03136 | s873549724 | Wrong Answer | # ABC117
N = int(input())
L = sorted(list(map(int, input().split())))
max_length = L[-1]
sum_length = sum(L[0:len(L)-1])
print("Yes") if max_length > sum_length else print("No")
|
p02717 | s542918729 | Accepted | a,b,c=list(map(int, input().split()))
a, b = b, a
a, c = c, a
print(a,b,c) |
p03000 | s272645392 | Accepted | n,x = map(int, input().split())
l = list(map(int, input().split()))
s = 1
d = 0
for i in l:
d += i
if d <= x:
s += 1
print(s) |
p02630 | s248781808 | Accepted | import collections as co
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int,input().split())) for i in range(q)]
c = co.Counter(a)
ans = sum(a)
for i in range(q):
ans += (c[bc[i][0]] * (bc[i][1]-bc[i][0]))
print(ans)
c[bc[i][1]] += c[bc[i][0]]
c[bc[i][0]] = 0
|
p03030 | s643742168 | Wrong Answer | N = int(input())
r = [input() + ' ' + str(i + 1) for i in range(N)]
R = []
for i in r:
R.append(i.split()[0] + ' ' + str(1000 -int(i.split()[1])) + ' ' + i.split()[2])
R = sorted(R)
for i in R:
print(i.split()[2]) |
p03127 | s075310578 | Wrong Answer | import numpy as np
n = int(input())
a = input().split(' ')
a = np.array(a).astype(int)
while a[a>0].shape[0] > 1:
not_0_a = a[a!=0]
min_ = not_0_a.min()
a = a % min_
print(min_) |
p02725 | s562322777 | Accepted | K, N = map(int, input().split())
A = list(map(int, input().split()))
diff = [0]*N
diff[N-1] = A[0] + K - A[N-1]
for i in range(N-1):
diff[i] = A[i+1] - A[i]
ans = sum(diff) - max(diff)
print(ans) |
p03797 | s725719692 | Wrong Answer | N = [int(e) for e in input().split()]
if(N[1]>=2):
ans = N[0] + (N[1] - N[0]*2)//4
print(ans)
else:
print(0) |
p03146 | s089167676 | Accepted | n = int(input())
c = 1
x = []
x.append(n)
while True:
if n%2 == 0:
n = n//2
else:
n = 3*n+1
c+=1
if n in x:
break
x.append(n)
print(c) |
p02947 | s592855817 | Wrong Answer | N = int(input())
s = [input() for i in range(N)]
word_list = []
count = 0
for word in s:
if sorted(word) in word_list:
count += 1
else:
word_list.append(sorted(word))
print(count) |
p03017 | s452087054 | Accepted | import sys
n,a,b,c,d=map(int,input().split())
s=input()
for i in range(a-1,c-2):
if s[i]=='#' and s[i+1]=='#':
print('No')
sys.exit()
for i in range(b-1,d-2):
if s[i]=='#' and s[i+1]=='#':
print('No')
sys.exit()
if d<c:
failflag=1
for i in range(b-1,d):
if s[i-1]=='.' and s[i]=='.' and s[i+1... |
p02861 | s745095920 | Wrong Answer | import math
import sys
input = sys.stdin.readline
def main():
N = int(input())
POS = [list(map(int, input().split())) for i in range(N)]
DIS = [[0]*(N) for _ in range(N)]
M = 1
for i in range(1,N+1):
M *= i
print(M)
for i in range(N):
for j in range(N):
DIS[i][j] ... |
p03478 | s164861548 | Accepted | n,a,b = map(int, input().split())
ans = sum(i for i in range(1, n+1) if a <= sum(map(int, str(i))) <= b)
print(ans) |
p02854 | s002229189 | Accepted | N=int(input())
A=list(map(int,input().split()))
total=sum(A)
cost=total
cumulative=0
for i in range(N):
cumulative+=A[i]
cost=min(cost,abs(cumulative-(total-cumulative)))
print(cost) |
p02783 | s278501388 | Accepted | H, A = list(map(int, input().split()))
print((H+A-1)//A) |
p02633 | s687436936 | Wrong Answer | from sys import stdin
def main():
input = lambda: stdin.readline()[:-1]
X = int(input())
x1, x2 = X, 180 - X
for n in range(3, 361):
s = 180 * (n - 2)
d, m = divmod(s, n)
if d == x1 or d == x2:
print(n)
break
main()
|
p02744 | s221366580 | Accepted | N = int(raw_input())
char_list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
prev = ["a"]
for i in range(1, N):
temp = []
for item in prev:
item_list = []
for j in range(len(item)):
item_list.append(item[j])
num_char = len(set(item_list))
for j in range(num_... |
p02613 | s190544813 | Accepted | n = int(input())
array = []
for i in range(n):
array.append(input())
ac = 0
wa =0
tle = 0
re = 0
for s in array:
if s=='AC':
ac += 1
elif s=='WA':
wa += 1
elif s=='TLE':
tle += 1
elif s=='RE':
re += 1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(t... |
p02829 | s578273302 | Accepted | a = int(input())
b = int(input())
lst = [1, 2, 3]
lst.remove(a)
lst.remove(b)
print(*lst) |
p03623 | s669131234 | Wrong Answer | def main():
x, a, b = map(int, input().split())
distance_a = a - x
distance_b = b - x
if distance_a < 0:
distance_a = distance_a * -1
elif distance_b < 0:
distance_b = distance_a * -1
if distance_a > distance_b:
print('B')
else:
print('A')
main() |
p03377 | s662194519 | Accepted | ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a,b,x=nm()
if a+b>=x and a<=x:
print('YES')
else:
print('NO') |
p03013 | s069122966 | Accepted | n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
mod = 10**9+7
fl = [0]*(n+1)
fl[0] = 1
for i in range(1,n+1):
if i not in a:
fl[i] = (fl[i-1] + fl[i-2])%mod
else:
fl[i] = 0
print(fl[-1]) |
p04011 | s312699625 | Accepted | N = int(input())
#print(N)
K = int(input())
#print(K)
X = int(input())
#print(X)
Y = int(input())
#print(Y)
ans = 0
for i in range(N):
if i+1 <= K:
ans += X
else:
ans += Y
print(ans) |
p03493 | s613574942 | Accepted | # -*- coding: utf-8 -*-
# 整数の入力
s = input()
number = "1"
count = s.count(number)
print(count) |
p02547 | s507763604 | Wrong Answer | import numpy as np
n = int(input(""))
a = np.zeros((n,2))
cnt = 0
for i in range(n):
a[i] = input().split()
if a[i,0] == a[i,1]:
a[i] = [0]
for i in range(n-1):
if a[i,0] == a[i+1,0]:
cnt += 1
print(cnt , i)
elif cnt >= 2:
cnt = cnt
else:
cnt = 0
if cnt ... |
p04045 | s365591903 | Accepted | from collections import deque
N,K=map(int,input().split())
D=list(map(int,input().split()))
like=list(range(1,10))
dislike0=False
for s in D:
if s==0:
dislike0=True
else:
like.remove(s)
like.sort()
q=deque(like)
if dislike0==False:
like.insert(0,0)
while q:
num=q.popleft()
if n... |
p02813 | s960878619 | Accepted | N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
from itertools import permutations as per
tuples = per(range(1, N+1))
a = 0
b = 0
for i, t in enumerate(tuples):
if t == P:
a = i
if t == Q:
b = i
print(abs(a - b))
|
p02953 | s847085634 | Accepted | # coding: utf-8
# Your code here!
import sys
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
for i in range(1, n):
if h[i] >= h[i-1] + 2:
print("No")
sys.exit()
elif h[i] == h[i-1] + 1:
h[i] -= 1
print("Yes")
|
p02696 | s150225855 | Wrong Answer | A,B,N=map(int,input().split())
#print(math.floor(A/B))
#c=[0]*N
s=0
if N<=B:
print((A*(N-1))//B-A*((N-1)//B))
else:print(A-1)
exit()
for i in range(1,N+1):
if s<(A*i)//B-A*(i//B):
s=(A*i)//B-A*(i//B)
if s==39204:print(i)
print(s) |
p02923 | s141004218 | Wrong Answer |
N = int(input())
X = list(map(int, input().split()))
ans = 0
cnt = 0
cur = X[0]
for i in range(1, N):
if cur < X[i]:
cnt += 1
else:
ans = max(ans, cnt + 1)
cnt = 0
cur = X[i]
print(ans)
|
p02957 | s152609296 | Accepted | #copy
a, b = map(int, input().split())
if (a + b) % 2 == 1:
print("IMPOSSIBLE")
else:
print((a + b) // 2) |
p02859 | s493708744 | Wrong Answer | int = int(input())
print(int*2) |
p03698 | s438369221 | Accepted | #
import sys
input=sys.stdin.readline
def main():
ab="qwertyuiopasdfghjklzxcvbnm"
S=input()
y=1
for a in ab:
if S.count(a)>1:
y=0
break
if y==1:
print("yes")
else:
print("no")
if __name__=="__main__":
main()
|
p02628 | s874125878 | Accepted | n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k])) |
p04030 | s680258104 | Accepted | S = input()
stack = []
for s in S:
if s == "B" :
if not stack:
continue
else:
stack.pop()
elif s == "0" or s=="1":
stack.append(s)
print("".join(stack)) |
p03435 | s961063048 | Accepted | c = [list(map(int,input().split())) for i in range(3)]
a = c[0][0]-c[1][0]
b = c[1][0]-c[2][0]
d = c[0][0]-c[2][0]
if (a == c[0][1]-c[1][1]) and (a==c[0][2] - c[1][2]):
if (b == c[1][1] - c[2][1]) and (b == c[1][2]-c[2][2]):
if (d == c[0][1]-c[2][1]) and (d == c[0][2]-c[2][2]):
print('Yes')
exit()
... |
p02731 | s476967268 | Wrong Answer | L=int(input())
if L%3==0:
print((L//3)**3)
elif L%3==1:
print((L/3)*(L/3)*(L/3+1))
else:
print((L/3)*(L/3+1)*(L/3+1))
|
p03161 | s473559582 | Accepted | nk = list(map(int,input().split()))
h = list(map(int,input().split()))
n,k = nk[0], nk[1] #5,3
DP = [0]
for i in range(1, n):#0~3 -> 1~4
act = float("inf")
for k_ in range(1, k+1):#0~2 -> 1~3
if i-k_ < 0 : continue
act = min(DP[-k_] + abs(h[i-k_]-h[i]), act)#
DP+= [act]#[0,20,]
print(DP[-1]) |
p02983 | s422061087 | Accepted | L, R = map(int, input().split())
ml = L // 2019
mr = R // 2019
for i in range(ml, mr+1):
if L <= 2019 * i <= R:
print(0)
exit()
L %= 2019
R %= 2019
ans = float('inf')
if L > R:
L, R = R, L
elif L == R:
R += 2019
if L == 0 or R == 0:
print(0)
exit()
for i in range(L, R+1):
for j in range(i+1, R+1)... |
p03067 | s834272413 | Wrong Answer | import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
def lcm(x, y):
return (x * y) // math.gcd(x, y)
if __name__ == '__main__':
a = [int(i) for i in input().split()]
if (a[0] < a[1] and a[0]<a[2] ... |
p03633 | s194812156 | Wrong Answer | n = int(input())
from fractions import gcd
g = 0
seki = 1
for i in range(n):
s = int(input())
g = gcd(g, s)
seki *= s
print(seki//g)
|
p02823 | s107775995 | Wrong Answer | n, a, b = map(int, input().split())
if abs(a-b) % 2 == 0:
print(abs(a-b)//2)
else:
print(min(b-1, n-a)) |
p02935 | s972333882 | Accepted | import sys
import numpy as np
n=int(sys.stdin.readline())
v=np.array(sys.stdin.readline().split(),dtype='int64')
v=np.sort(v)
for i in range(n):
if i==0:
ans=v[i]/(2**(n-i-1))
else:
ans+=v[i]/(2**(n-i))
print(ans)
|
p02791 | s142840323 | Wrong Answer | n = int(input())
da = list(map(int,input().split()))
ans = 0
now_max = 0
for i in range(n):
if now_max < da[i]:
ans += 1
now_max = da[i]
print(ans) |
p03632 | s283580763 | Wrong Answer | A, B, C, D = map(int, input().split())
alice = [1 if A <= t < B else 0 for t in range(1, 101)]
bob = [1 if C <= t < D else 0 for t in range(1, 101)]
overlap = [1 for a, b in zip(alice, bob) if a > 0 and b > 0]
print(len(overlap))
|
p02831 | s047678027 | Accepted | a,b = map(int, input().split())
for i in range(1,b+1):
if a*i%b == 0:
print(a*i)
exit() |
p02615 | s885292310 | Accepted | from collections import deque
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
if n==2:
print(a[0])
exit(0)
ans=a[0]
d=deque()
d.append(a[1])
d.append(a[1])
for i in range(2,n):
x=a[i]
ans+=d.popleft()
d.append(x)
d.append(x)
print(ans)
|
p02622 | s255347636 | Accepted | #from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10*... |
p02725 | s407117991 | Accepted | K, N = map(int, input().split())
lis_A = list(map(int, input().split()))
dif = [0]*len(lis_A)
dif[0] = K-lis_A[-1] + lis_A[0]
for i in range(1,len(lis_A)):
dif[i] = lis_A[i]-lis_A[i-1]
ans = sum(dif)-max(dif)
print(ans) |
p03262 | s674344975 | Accepted | import sys
import math
N, X = map(int, input().split())
x = list(input().split())
city = [abs(int(x[i]) - X) for i in range(N)]
MAX = min(city)
candidate = []
for i in range(int(math.sqrt(MAX)+1)):
if MAX % (i+1) == 0:
candidate.append(i+1)
candidate.append(MAX // (i+1))
candidate = list(sorted(ca... |
p02624 | s347511354 | Accepted | N = int(input())
ans = 0
for i in range(1,N+1):
k = N // i
ans += (i + i*k) * k // 2
print(ans) |
p02862 | s148171612 | Wrong Answer | X, Y = map(int, input().split())
a = 2*Y-X
b = 2*X-Y
def modinv(a, mod=10**9+7):
return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
r = min(r, n-r)
res = 1
for i in range(r):
res = res * (n - i) * modinv(i+1, mod) % mod
return res
if a%3==0 and b%3==0:
a //= 3
b //= 3
... |
p03721 | s553508364 | Wrong Answer | from collections import defaultdict
n,k=map(int,input().split())
ab=[input() for i in range(n)]
d = defaultdict(list)
[d[int(i.split()[0])].append(int(i.split()[1])) for i in ab]
sd=sorted(d.items(), key=lambda x:x[0])
c=0
for i,l in sd:
c+=sum(l)
print(i,l)
if c>=k:
print(i)
exit() |
p02988 | s069780676 | Accepted | n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range (1,n-1):
if p[i] <= p[i-1] and p[i] > p[i+1]:
cnt += 1
if p[i] <= p[i+1] and p[i] > p[i-1]:
cnt += 1
print(cnt) |
p03705 | s448936205 | Accepted | import sys
N, A, B = map(int, input().split())
if A > B:
print(0)
sys.exit(0)
if N == 1:
if A == B:
print(1)
else:
print(0)
sys.exit(0)
x = B*(N-1)+A
n = A*(N-1)+B
print(x-n+1) |
p04045 | s765342528 | Accepted | import sys
from copy import copy
N, K, *D = map(int, open(0).read().split())
candidate = sorted(list({i for i in range(10)} - set(D)))
like_integer = copy(candidate)
# 1桁の場合を判定
for j in candidate:
if j >= N:
print(j)
sys.exit()
for i in range(1, 6):
order = 10 ** i
_candidate = []
fo... |
p02556 | s748526982 | Wrong Answer | n = int(input())
array1 = []
array2 = []
for i in range(n):
x,y = map(int,input().split())
array1.append(abs(x+y))
array2.append(abs(x-y))
print(max(max(array1)-min(array1), max(array2)-min(array2))) |
p03289 | s210906383 | Accepted | s=input()
AC="AC"
if not s[0]=="A":
AC="WA"
s=s[1:]
if not s[1:-1].count("C")==1:
AC="WA"
s=s.replace("C","c")
if not s.islower():
AC="WA"
print(AC) |
p03338 | s816035261 | Accepted | n = int(input())
s = list(input())
ans = [None] * (n-1)
for i in range(1,n):
a = s[0:i]
b = s[i:n]
ans[i-1] = len(set(b))-len((set(b)-set(a)))
ans.sort(reverse = True)
print(ans[0])
|
p02723 | s602912697 | Accepted | s = str(input())
if s[2] == s[3] and s[4] == s[5]:
print('Yes')
else:
print('No')
|
p02797 | s392639616 | Accepted | n,k,s = map(int,input().split())
rem = s+1
if rem > 10**9:
rem = 1
li = []
for i in range(n):
if i < k:
li.append(s)
else:
li.append(rem)
print(*li)
|
p03524 | s333161449 | Wrong Answer | s = input()
A = 0
B = 0
C = 0
for x in s:
if x == 'a':
A += 1
elif x == 'b':
B += 1
else:
C += 1
l = sorted([A, B, C])
print('YES' if l[2] == l[1] else 'NO')
|
p02847 | s300364733 | Accepted | S = input()
if S == 'SUN':
print('7')
elif S == 'MON':
print('6')
elif S == 'TUE':
print('5')
elif S == 'WED':
print('4')
elif S == 'THU':
print('3')
elif S == 'FRI':
print('2')
elif S == 'SAT':
print('1') |
p02724 | s054417887 | Wrong Answer | x = int(input())
print(x//500*500*2+x%500) |
p02658 | s271822399 | Accepted | n = int(input())
a = sorted(list(map(int,input().split())))
u = 10**18
ans = 1
for i in a:
ans *= i
if i == 0:
print(0)
exit()
if ans > u:
print(-1)
exit()
print(ans) |
p03633 | s600510647 | Accepted | from fractions import gcd
from functools import reduce
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(nums):
return reduce(lcm_base, nums, 1)
def main():
n = int(input())
t = [int(input()) for _ in range(n)]
print(lcm_list(t))
if __name__ == '__main__':
main()
|
p02793 | s519078721 | Accepted | from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 1000000007
LCM = A[0]
for i in range(1, N):
LCM *= A[i] // gcd(LCM, A[i])
for a in A:
ans += LCM // a
print(ans%MOD)
|
p02642 | s882329756 | Accepted | N = int(input())
l = [0]*(10**6+1)
for a in map(int,input().split()) :
l[a] += 1
ans = 0
for i in range(1, 10**6 + 1) :
if l[i] == 1 :
ans += 1
if l[i] > 0 :
for j in range(i , 10**6 + 1, i) :
l[j] = 0
print(ans) |
p03705 | s601044003 | Accepted | n,a,b = list(map(int, input().split()))
print(max(0, (b-a)*(n-2)+1))
|
p03250 | s843497238 | Wrong Answer | A=''.join(input().split())
ans=0
for i in range(1, len(A)):
ans=max(ans, eval(A[:i]+'+'+A[i:]))
print(ans) |
p03695 | s629228437 | Wrong Answer | n = int(input())
a = [int(x) for x in input().split()]
b = [0] * 9
for i in range(n):
if a[i] // 400 < 8:
b[a[i] // 400] += 1
else:
b[8] += 1
minsum = 0
maxsum = 0
for i in range(8):
if b[i] > 0:
minsum += 1
maxsum = minsum
maxsum += b[8]
if maxsum == 0:
maxsum = 1
print("{} {}".format(minsum, m... |
p03605 | s461077623 | Accepted | A=input()
if "9" in A:
print("Yes")
else:
print("No") |
p02727 | s320318265 | Wrong Answer | #heapだけ?
#x<=a,y<=b
import heapq
x,y,a,b,c = map(int, input().split( ))
*p, = map(int, input().split( ))
*q, = map(int, input().split( ))
*r, = map(int, input().split( ))
#p = [(pi,0) for pi in p_]
#q = [(qi,1) for qi in q_]
#r = [(ri,2) for ri in r_]
p = p[-x:]
q = q[-y:]
e = p+q
heapq.heapify(e)
assert (len(e)==x+y)... |
p03109 | s438553329 | Wrong Answer | S = input()
if S[5:7] == 12>=5:
print("TBD")
else:
print("Heisei") |
p03071 | s828225232 | Wrong Answer | A, B = map(int, input().split(" "))
if A < B:
print(B * (B - 1))
elif A == B:
print(A * 2)
else:
print(A * (A - 1)) |
p03327 | s630898767 | Accepted | N=int(input())
if N<1000:
print('ABC')
else:
print('ABD') |
p03284 | s373075056 | Accepted | N,K = map(int,input().split())
if N%K==0:
print(0)
else:
print(1)
|
p02988 | s030223138 | Accepted | n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
if p[i-1]>p[i]>p[i+1] or p[i-1]<p[i]<p[i+1]:ans+=1
print(ans) |
p03543 | s394879939 | Accepted | N = input()
if (N[0] == N[1]) and (N[1] == N[2]):
print('Yes')
elif (N[1]==N[2]) and (N[2] == N[3]):
print('Yes')
else:
print('No')
|
p02946 | s095060591 | Accepted | K,X=map(int,input().split())
print(*[x for x in range(X-K+1,X+K)]) |
p02939 | s836490369 | Wrong Answer | def main(s: str):
ans = 1
prev = s[0]
for s in s[1:]:
if s == prev:
prev += s
else:
prev = s
ans += 1
if len(prev) == 2: ans += 1
print(ans)
if __name__ == "__main__":
s = input()
main(s)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.