problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02787 | s153526040 | Wrong Answer | import bisect
H,N = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [[10**18]*10**4 for _ in range(N+1)]
for i in range(N+1):
dp[i][0]=0
mi=10**9
for i in range(N):
for w in range(10**4):
dp[i+1][w]=min(dp[i+1][w],dp[i][w])
if w-AB[i][0]>=0:
dp[i+1][w]=min(dp[i+1][w],dp[i + 1][w - AB[i][0]] + AB[i][1])
for i in range(H,10**4):
mi = min(mi,dp[N][i])
print(mi)
|
p03103 | s418525057 | Accepted | N, M = map(int, input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()
onedan = 0
for ab in AB:
buy = min(ab[1], M)
onedan += buy * ab[0]
M -= buy
print(onedan) |
p02723 | s219437125 | Wrong Answer | S = input()
if S[2]==S[3] and S[4]==S[5]:
print('True')
else:
print('No')
|
p03745 | s322086225 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
prev = A[0]
isUp = True
isDown = True
ans = 0
for a in A[1:]:
if prev == a:
pass
elif prev < a:
isDown = False
if not isUp:
isUp = True
ans += 1
elif a < prev:
isUp = False
if not isDown:
isDown = True
ans += 1
prev = a
print(ans+1)
|
p02972 | s321214878 | Wrong Answer | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n = int(input())
a = list( map(int, input().split()))
b=[]
ans = 0
for i in reversed(range(n)):
if a[i] > 1:
print(-1)
exit()
cnt = n // (i+1)
tmp = 0
for j in range(2,cnt):
tmp += a[(i+1) * j]
tmp2 = (tmp%2+a[i])%2
ans += tmp2
if tmp2 == 1:
b.append(i+1)
print(ans)
print(*b, sep=' ')
|
p03624 | s161079364 | Wrong Answer | import string
s = input()
lall = [chr(i) for i in range(97, 97+26)]
#print(lall)
for x in lall:
if x not in s:
print(x)
break
print("None")
|
p04043 | s857873262 | Accepted | a,b,c=map(int,input().split())
d=[a,b,c]
if d.count(5)==2 and d.count(7)==1:
print("YES")
else:
print("NO")
|
p02759 | s192768150 | Accepted | print(-(-int(input())//2)) |
p03380 | s669225195 | Accepted | n = int(input())
a = list(map(int,input().split()))
M = max(a)
a = sorted(a)
a = [a[i] for i in range(n-1)]
b = 0
for i in range(n-1):
if abs(a[i]-M/2) <= abs(b-M/2):
b = a[i]
print('{} {}'.format(M,b)) |
p02645 | s092171187 | Accepted | S = input()
print(S[0:3])
|
p03408 | s484230081 | Wrong Answer | N = int(input())
s = sorted([input() for i in range(N)])
M = int(input())
t = sorted([input() for i in range(M)])
a = 0
for i in range(N):
for j in range(M):
if a < s.count(s[i])-t.count(j):
a = s.count(s[i])-t.count(j)
print(a) |
p02917 | s137847361 | Wrong Answer | #52 1日かかった
N = int(input())
b = list(map(int,input().split()))
a = [0 for i in range(N)]
for i in range(N-2):
a[i] = min(b[i],b[i+1])
a[-1] = b[-1]
print(sum(a)) |
p03644 | s426265613 | Accepted | N = int(input())
c = 0
ans = 1
for i in range(1, N + 1):
n = i
for t in range(N + 1):
if n % 2 != 0:
if c < t:
c = t
ans = i
break
n //= 2
print(ans)
|
p03261 | s176952245 | Accepted | import sys
N = int(input())
W = [input() for _ in range(N)]
if len(set(W)) == len(W):
for i in range(1, len(W)):
if W[i-1][-1] != W[i][0]:
print('No')
sys.exit()
else:
print('No')
sys.exit()
print('Yes') |
p03456 | s316905412 | Wrong Answer | a,b=map(int, input().split())
ab=int(str(a)+str(b))
if ab^0.5.is_integer():
print('Yes')
else:
print('No') |
p02683 | s892388296 | Accepted | import itertools
import numpy as np
n, m, x = map(int, input().split())
temp = [list(map(int, input().split())) for _ in range(n)]
ans = []
for li in itertools.product([0,1], repeat=n):
cnt = 0
check = np.zeros(m, np.int)
for i in range(n):
if li[i] == 1:
check += np.array(temp[i][1:])
cnt += temp[i][0]
if min(check) >= x:
ans.append(cnt)
print(min(ans) if len(ans) !=0 else -1)
|
p02645 | s446513230 | Accepted | from sys import stdin
input = stdin.readline
a=input()
print(a[:3]) |
p03274 | s766644572 | Accepted | n,k=map(int,input().split())
x=list(map(int,input().split()))
l=[]
for i in range(n-k+1):
l.append(x[i+k-1]-x[i]+min(abs(x[i+k-1]),abs(x[i])))
print(min(l)) |
p02548 | s502478376 | Accepted | n = int(input())
ans = 0
for i in range(1, n):
ans += (n-1) // i
print(ans) |
p03293 | s811950982 | Accepted | S = list(map(str, input()))
T = list(map(str, input()))
def judge(S, T):
for _ in range(len(S)):
S.insert(0, S.pop(-1))
if S == T:
return "Yes"
return "No"
print(judge(S, T)) |
p03475 | s937301144 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n = int(input())
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)
for i in range(n-1):
c[i], s[i], f[i] = map(int, input().split())
def dfs(eki,t):
if eki == n-1:
return t
cc = c[eki]
ss = s[eki]
ff = f[eki]
if t < ss:
return dfs(eki+1, ss+cc)
else:
return dfs(eki+1, -(-t//ff)*ff+cc)
for i in range(n):
print(dfs(i,0))
|
p03681 | s023054698 | Wrong Answer | n,m = map(int,input().split())
if abs(n-m)>=2:
print(0)
elif abs(n-m) ==1:
x =max(n,m)
for i in range(1,min(n,m)+1):
x = x*i**2%(10**9+7)
print(x)
else:
x =2
for i in range(1,n+1):
x = x*i**2%(10**9+7)
print(x) |
p03437 | s093415966 | Wrong Answer | X,Y = map(int, input().split())
if X%Y==0:
print(-1)
exit()
for i in range(2,10**18):
X=X*i
if X>10**18:
print(-1)
exit()
if X%Y != 0:
print(X)
exit()
X=X/i |
p02640 | s341731269 | Accepted | X, Y= map(int, input().split())
ans = 'No'
for a in range(X + 1):
b = X - a
if 2 * a + 4 * b == Y:
ans = 'Yes'
print(ans)
|
p02773 | s210249731 | Wrong Answer | N=int(input())
l={}
for i in range(N):
s=input()
if s in l:
l[s]+=1
else:
l[s]=1
l=sorted(l.items(),key=lambda x: x[1],reverse=True)
ma=max(l)
ans=[]
for i in l:
if i[1]==ma[1]:
ans.append(i[0])
ans.sort()
for i in ans:
print(i)
|
p03696 | s541061015 | Accepted | def main():
n = int(input())
s = input()
l, r, c = 0, 0, 0
for a in s:
if a == '(':
c += 1
elif c:
c -= 1
else:
l += 1
r = c
print("("*l + s + ")"*r)
if __name__ == "__main__":
main()
|
p03137 | s565835779 | Accepted | N,M= map(int,input().split())
X=list(map(int,input().split()))
X.sort()
L=[0]*(M-1)
for i in range(M-1):
L[i] = X[i+1]-X[i]
list.sort(L,reverse=True)
print(sum(L[N-1:])) |
p03162 | s895867124 | Wrong Answer | from sys import stdin
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def lsi():
x=list(stdin.readline())
x.pop()
return x
def si(): return stdin.readline()
############# CODE STARTS HERE #############
n=ii()
a, b, c=mi()
for _ in range(n-1):
x, y, z=mi()
a+=max(y, z)
b+=max(x, z)
c+=max(y, z)
print(max(a, b, c)) |
p03637 | s867049683 | Accepted | n = int(input())
lst = list(map(int, input().split()))
count4 = 0
count2 = 0
for i in lst:
if i%4==0:
count4+=1
elif i%2==0:
count2+=1
count1 = n-count4-count2
if count2==0 and count4>=count1-1:
print("Yes")
elif count2!=0 and count4>=count1:
print("Yes")
else:
print("No")
|
p03043 | s671273346 | Accepted | from math import log2
from math import ceil
n,k=map(int,input().split())
p=0
for i in range(1,n+1):
if i>=k:
p+=1/n
else:
cnt=ceil(log2(k)-log2(i))
p+=(1/n)*((1/2)**cnt)
print(p)
|
p03861 | s723354930 | Accepted | A, B, X = map(int, input().split())
P, r = divmod(A, X)
if r:
P += 1
Q, r = divmod(B, X)
#print(P, Q)
print(max(0, Q-P+1)) |
p02600 | s778323795 | Accepted | x=int(input())
if 400<=x<=599:
print(8)
elif 600<=x<=799:
print(7)
elif 800<=x<=999:
print(6)
elif 1000<=x<=1199:
print(5)
elif 1200<=x<=1399:
print(4)
elif 1400<=x<=1599:
print(3)
elif 1600<=x<=1799:
print(2)
elif 1800<=x<=1999:
print(1) |
p03548 | s618604190 | Wrong Answer | X, Y, Z = map(int, input().split())
result = X // (Y + Z) - 1
while X < result * Y + (result + 1) * Z:
result += 1
print(result) |
p02820 | s184223971 | Accepted | N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
ans = [0] * N
for i in range(N):
if T[i] == 'r':
if i > K-1 and T[i-K] == T[i] and ans[i-K]>0:
pass
else:
ans[i] += P
elif T[i] == 's':
if i > K-1 and T[i-K] == T[i] and ans[i-K]>0:
pass
else:
ans[i] += R
else:
if i > K-1 and T[i-K] == T[i] and ans[i-K]>0:
pass
else:
ans[i] += S
print(sum(ans)) |
p03659 | s208115338 | Accepted | n = int(input())
l = list(map(int,input().split()))
kuma = sum(l)-l[0]
snuke = l[0]
gap = abs(snuke-kuma)
for i in range(1,n-1):
snuke += l[i]
kuma -= l[i]
gap = min(gap,abs(snuke-kuma))
print(gap)
|
p03379 | s736614679 | Wrong Answer | from copy import deepcopy
N = int(input())
X = list(map(int,input().split()))
Y = deepcopy(X)
Y.sort()
med1 = Y[N//2]
med2 = Y[N//2-1]
print("med1:",med1,"med2",med2)
for i in range(N):
if i == N//2 -1 or i == N//2:
print(med2)
else:
print(med1) |
p03109 | s795618063 | Accepted | s=input()
t=s[:4]
u=s[5:7]
v=s[8:]
w=int(t+u+v)
if w<=20190430:
print('Heisei')
else:
print('TBD') |
p03360 | s049859648 | Accepted | lst = list(map(int, input().split()))
k = int(input())
lst = sorted(lst)
for i in range(k):
lst[-1] = lst[-1] * 2
print(sum(lst)) |
p03986 | s895054117 | Wrong Answer | s = input()
s_cnt, t_cnt = 0, 0
ans = 0
for i in range(len(s)):
if s[i] == "S":
s_cnt += 1
else:
t_cnt += 1
if i == len(s) - 1 or s[i + 1] == "S":
ans += min(t_cnt, s_cnt)
t_cnt = 0
c_cnt = 0
print(len(s) - ans * 2) |
p04031 | s223529129 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 1e9
for p in range(-100, 101):
sub = 0
for q in a:
sub += pow(p - q, 2)
ans = min(ans, sub)
print(ans)
|
p03061 | s257269023 | Accepted | from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
'''
res = 0
for i in range(N):
tmp = A[i+1:] + A[:i]
ans = tmp[0]
for i in range(1,N-1):
ans = gcd(ans,tmp[i])
res = max(ans,res)
print(res)
'''
L = [0] * (N+1)
R = [0] * (N+1)
for i in range(N):
L[i+1] = gcd(L[i],A[i])
R[N-i-1] = gcd(R[N-i],A[N-i-1])
ans = 0
for i in range(N):
ans = max(ans,gcd(L[i],R[i+1]))
print(ans) |
p03719 | s556947780 | Accepted | a,b,c = map(int,input().split())
if a <= c <= b:
print("Yes")
else:
print("No") |
p03854 | s860862631 | Accepted | s = input()
import re
output ="NO"
s = re.sub('dreameraser', 'A', s)
s = re.sub('dreamerase', 'A', s)
s = re.sub('dreamer', 'A', s)
s = re.sub('eraser', 'A', s)
s = re.sub('erase', 'A', s)
s = re.sub('dream', 'A', s)
if s.isupper() :
output = "YES"
print(output) |
p02792 | s010934205 | Wrong Answer | N = int(input())
A = [[0]*10 for i in range(10)]
for i in range(1, N+1):
A[int(str(i)[0])][int(str(i)[-1])] = 1
ans = 0
for i in range(10):
for j in range(10):
ans += A[i][j] * A[j][i]
print(ans) |
p03455 | s340978308 | Accepted | a,b = map(int, input().split())
if a * b % 2 == 0:
print("Even")
else:
print("Odd") |
p03069 | s816891926 | Accepted | n = int(input())
s = input()
white = s.count(".")
black = s.count("#")
min_num = min(black, white)
black_num = 0
for i, color in enumerate(s, start = 1):
if color == "#":
black_num += 1
min_num = min(min_num, black_num + white - (i - black_num))
print(min_num) |
p02789 | s218443961 | Accepted | n, m = map(int, input().split())
if n==m:
print("Yes")
else:
print("No")
|
p03434 | s719769238 | Accepted | n = int(input())
al = list(map(int, input().split()))
al.sort(reverse=True)
a = 0
b = 0
for i in range(n):
if i%2==0:
a += al[i]
else:
b += al[i]
print(a-b) |
p03774 | s178523785 | Accepted | N,M = map(int,input().split())
a = [0]*N
b = [0]*N
for i in range(N):
a[i],b[i] = map(int,input().split())
c = [0]*M
d = [0]*M
for i in range(M):
c[i],d[i] = map(int,input().split())
ans = []
for i in range(N):
for j in range(M):
tmp = abs(a[i]-c[j])+abs(b[i]-d[j])
ans.append(tmp)
print(ans.index(min(ans))+1)
ans = []
|
p03261 | s959828114 | Wrong Answer | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(input())
l=[input() for i in range(n)]
ll=[]
ans='Yes'
for j in range(n-1):
if l[j][-1]==l[j+1][0] and l[j] not in ll:
ll.append(l[j])
else:
ans='No'
break
print(ans)
resolve() |
p02584 | s411569178 | Wrong Answer | X , K , D = map(int, input().split())
first_ct = int(X/D)
second_posi = X - D*first_ct
leave_ct = K - first_ct
x = second_posi
for trans in range(leave_ct):
foward_X = x + D
back_X = x - D
if abs(foward_X) > abs(back_X):
x = back_X
else:
x = foward_X
print(abs(x)) |
p03416 | s233455326 | Wrong Answer | import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7
def main():
A, B = map(int, readline().split())
ans = 0
for i in range(A,B+1):
s = str(i)
if s[:2]==s[3:]:
ans += 1
print(ans)
if __name__ == '__main__':
main() |
p02602 | s034165671 | Accepted | n,k = map(int,input().split())
a_li = list(map(int,input().split()))
for i in range(k,n):
if a_li[i-k] < a_li[i]:
print("Yes")
else:
print("No") |
p03838 | s676941326 | Wrong Answer | x,y = map(int,input().split())
ans = abs(abs(x)-abs(y))
print(ans if x * y > 0 else ans + 1)
|
p02909 | s965303800 | Accepted | S = input().strip()
if S=="Sunny":
print("Cloudy")
elif S=="Cloudy":
print("Rainy")
else:
print("Sunny") |
p03243 | s789423612 | Wrong Answer | N = input()
l = []
l.append(N[0])
l.append(N[1])
l.append(N[2])
print(max(l)*3) |
p02678 | s674515054 | Wrong Answer | N, M = map(int, input().split())
e = [[] for _ in range(N)]
for i in range(M):
a, b = map(int, input().split())
e[a-1].append(b-1)
e[b-1].append(a-1)
visited = [0]*N
visited[0] = 1
que = [0]
while que:
x = que.pop()
for i in e[x]:
if visited[i] == 0:
visited[i] = x+1
que.append(i)
print("Yes")
print(*visited[1:], sep="\n") |
p02570 | s471520281 | Accepted | d,t,s=map(int,input().split())
if d-t*s<=0 :
print('Yes')
else :
print('No') |
p03796 | s969848260 | Accepted | ans=1
N=int(input())
mod=1000000007
for i in range(1,N+1):
ans*=i
ans=ans%mod
print(ans) |
p02601 | s947177287 | Accepted | A,B,C=map(int,input().split())
X=int(input())
while X>0:
if B<=A:
B=2*B
elif C<=B:
C=2*C
X-=1
if A<B and B<C:
print("Yes")
else:
print("No") |
p02664 | s892474080 | Accepted | #B
T=input()
ans=T.replace("?", "D")
print(ans) |
p02714 | s615505095 | Accepted | n=int(input())
s=input()
r,g,b=map(s.count,'RGB')
print(r*g*b-len([1for i in range(n)for j in range(i,n,2)if s[i]!=s[j]!=s[i+j>>1]!=s[i]])) |
p02959 | s269011683 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
monster = 0
hero = 0
for i in range(N):
allhero = B[i] + hero
if allhero<=A[i]:
monster += B[i]
hero = 0
else:
monster += A[i]
minus = 0
if hero>A[i]:
minus = hero-A[i]
hero = allhero-minus-A[i]
#print(monster,allhero,hero)
if hero>0:
monster += min(hero,A[N])
print(monster) |
p02723 | s283354479 | Accepted |
S = input()
if S[2]==S[3] and S[4]==S[5]:
print("Yes")
else:
print("No")
|
p03814 | s279110582 | Wrong Answer | s=input()
print(s.find("Z")-s.find("A")+1) |
p03087 | s385692142 | Accepted | N, Q = map(int, input().split())
S = input()
C = [0 for _ in range(N)]
count = 0
prev = S[0]
for i, s in enumerate(S[1:]):
now = s
if prev + now == 'AC':
count += 1
C[i+1] = count
prev = now
C
for j in range(Q):
l, r = map(int, input().split())
print(C[r-1] - C[l-1]) |
p02629 | s515614850 | Accepted | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(input())
ans=''
while n>0:
n-=1
a,b=divmod(n,26)
n//=26
ans+=chr(ord('a')+b)
for i in ans[::-1]:
print(i,end='')
print()
resolve()
|
p03548 | s771210205 | Wrong Answer |
x,y,z = map(int,input().split())
ans = int((x-1)//(y+z))
print(ans)
|
p03607 | s289953240 | Wrong Answer | import collections
n = int(input())
a = [int(input()) for i in range(n)]
x = collections.Counter(a)
y = x.most_common()
ans = 0
for i in range(len(y)):
if y[i][1]%2==1:
ans+=y[i][1]
print(ans) |
p02899 | s893389583 | Accepted | N = int(input())
A = list(map(int,input().split()))
B = [0]*N
for i in range(N):
B[A[i]-1] = i + 1
print(' '.join(map(str, B))) |
p02582 | s111922463 | Wrong Answer | s = input()
print(len(s.replace('S', ''))) |
p02618 | s723112409 | Accepted | d = int(input())
cs = list(map(int, input().split()))
sm = [list(map(int, input().split())) for _ in range(d)]
import random
for _ in range(d):
t = random.choice(range(26)) + 1
print(t)
|
p03001 | s408346615 | Accepted | def main():
W, H, x, y = map(int, input().split())
pat = 0
if x == W/2 and y == H/2:
pat = 1
print((W*H)/2.0, pat)
if __name__ == "__main__":
main() |
p04029 | s811146482 | Wrong Answer | number = int(input())
print(number * (number + 1) / 2)
|
p02765 | s227566606 | Accepted | n, r = map(int, input().split())
if n >= 10:
print(r)
else:
print(r+100*(10-n))
|
p02615 | s822758206 | Accepted | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
syugo = [0]*N
syugo[0] = A[0]
syugo[1] = A[1]
flg = False
ans = A[0]
idx = 1
for i in range(2, N):
if flg:
ans += A[idx]
flg = False
idx += 1
else:
ans += A[idx]
flg = True
print(ans)
|
p03208 | s684518263 | Accepted | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
h = [0] * N
for i in range(N):
h[i] = int(input())
h.sort()
ans = float("inf")
for i in range(N - (K - 1)):
diff = h[i + (K - 1)] - h[i]
if diff < ans:
ans = diff
print(ans)
if __name__ == "__main__":
main()
|
p02924 | s206467907 | Accepted | n = int(input())
ans = (n-1)*n//2
print(ans)
|
p02900 | s253577647 | Accepted | import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)
def prime_factorization(n):
i=2
prime=[]
while i*i<=n:
if n%i:
i+=1
else:
n//=i
prime.append(i)
while n%i==0:
n//=i
if n>1:
prime.append(n)
return prime
print(len(prime_factorization(gcd))+1)
#print(prime_factorization(gcd)) |
p02993 | s556479344 | Wrong Answer | S = input("Please enter password :")
flag =0
for i in range(len(S)-1):
if S[i] == S[i+1]:
flag =1
if flag == 1:
print("bad")
else:
print("good") |
p02621 | s741619714 | Wrong Answer | a = int(input())
print(1+ a**2 + a**3) |
p03556 | s285468511 | Wrong Answer | n=int(input())
for i in range(n):
if i**2 == n:
print(i**2)
break
if i**2 > n:
print((i-1)**2)
break |
p03592 | s685109785 | Wrong Answer | from math import gcd
n, m, k = map(int, input().split())
if gcd(gcd(n, m), k) == gcd(n, m):
print('No')
else:
('Yes')
|
p03163 | s288016272 | Accepted | N, W = map(int, input().split())
wv_array = [list(map(int, input().split())) for _ in range(N)]
ans_array = [[0] * (W + 1) for _ in range(N + 1)]
for n in range(1, N + 1):
for w in range(W + 1):
if wv_array[n - 1][0] > w:
ans_array[n][w] = ans_array[n - 1][w]
else:
ans_array[n][w] = max(
ans_array[n - 1][w], ans_array[n - 1][w - wv_array[n - 1][0]] + wv_array[n - 1][1])
print(ans_array[N][W])
|
p02660 | s634893359 | Accepted | import math
n = int(input())
d = n
m = {}
for i in range(2, int(math.sqrt(n)) + 1):
m[i] = 0
while (d % i == 0):
d //= i
m[i]+=1
res = 0
for i in m.values():
res+=int(math.sqrt(i*2+0.25)-0.5)
if d > 1:
res += 1
print(res)
|
p02600 | s214846314 | Wrong Answer | n = int(input())
ans = n//100
if ans< 5:
print(8)
exit()
elif ans >= 6 and ans <= 7:
print(7)
exit()
elif ans >= 8 and ans <= 9:
print(6)
exit()
elif ans >= 10 and ans <= 11:
print(5)
exit()
elif ans >= 12 and ans <= 13:
print(4)
exit()
elif ans >= 14 and ans <= 15:
print(3)
exit()
elif ans >= 16 and ans <= 17:
print(2)
exit()
elif ans >= 18 and ans <= 19:
print(1)
exit()
|
p03137 | s794274268 | Wrong Answer | n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
if n >= m:
print(0)
exit()
ans = x[m-1]-x[0]
x = sorted([x[i] - x[i - 1] for i in range(1,m)])
print(ans - sum(x[-n + 1:]))
|
p02701 | s501434512 | Accepted | n = int(input())
counter = 0
s = "TEMP"
list = []
temp = ''
while n > 0:
s = input()
list.append(s)
n = n - 1
list.sort()
for item in list:
if item == temp:
counter = counter - 1
counter = counter + 1
temp = item
print(counter) |
p02730 | s531657876 | Accepted | # ABC 159: B – String Palindrome
S = input()
N = len(S)
conds1 = (N - 1) // 2
conds2 = (N + 3) // 2
S1 = S[:conds1]
S2 = S[conds2 - 1:]
print('Yes' if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1] else 'No') |
p02729 | s759632930 | Wrong Answer | n,m = map(int,input().split())
print(n*(n-1) / 2 + m*(m-1) / 2)
#選んだ 2 つのボールに書かれている数の和が偶数になるのは、
#2つのボールに書かれた数が共に偶数or共に奇数である場合に限ります。
#そのようなボールの選び方の数を求めればよいです。これは、
# nC2 + mC2通りです。 |
p02631 | s950789725 | Wrong Answer | def main():
N = int(input())
a = list(map(int, input().split()))
# 自分以外全体のxorがわかっている状態
ans = a
for i in range(10):
c0,c1 = 0,0
for j in range(N):
if (a[j]>>i)&1:
c1+=1
if c1%2==0:
ans[j] += (a[j]>>i)*pow(2,i)
print(*ans)
main()
|
p03835 | s956944647 | Accepted | K, S = map(int, input().split())
result = 0
for i in range(K+1):
for j in range(K+1):
if S-i-j<0:
break
else:
if (S-i-j)>K:
pass
else:
result += 1
print(result) |
p02988 | s470894565 | Accepted | n = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
tmp_P = P[i-1:i+2]
a = tmp_P[1]
tmp_P.sort()
if a == tmp_P[1]:
ans += 1
print(ans) |
p03220 | s968722827 | Accepted | N = int(input())
[T, A] = list(map(int, input().split()))
list_H0 = list(map(int, input().split()))
list_H1 = []
for i in list_H0:
list_H1.append(T - i*0.006)
list_HA = []
for k in list_H1:
list_HA.append(abs(A - k))
Min = min(list_HA)
print(list_HA.index(Min) + 1) |
p02995 | s649979893 | Accepted | import math
import fractions
A,B,C,D=map(int,input().split())
E=C*D//(fractions.gcd(C,D))
def P(A,B,Q):
if A%Q==0:
return B//Q-A//Q+1
else:
return B//Q-A//Q
print(B-A+1-(P(A,B,C))-(P(A,B,D))+(P(A,B,E))) |
p02823 | s540315456 | Accepted | n,a,b=map(int,input().split())
if (a-b)%2==0:
print((b-a)//2)
else:
print(min(a-1,n-b)+1+(b-a-1)//2)
|
p03623 | s389392037 | Accepted |
import numpy as np
x,a,b=map(int,input().split())
a=abs(a-x)
b=abs(b-x)
if(a<b):
print("A")
else:
print("B") |
p02861 | s390718257 | Accepted | from math import sqrt
from itertools import combinations
N = int(input())
points = tuple(tuple(map(int,input().split())) for _ in range(N))
print(sum(sqrt((x1-x2)**2+(y1-y2)**2) for (x1,y1),(x2,y2) in combinations(points,2))*2/N) |
p02702 | s625077708 | Wrong Answer | s = input()
mul = set(str(2019*i) for i in range(1,100))
ans = 0
for m in mul:
ans += s.count(m)
print(ans) |
p03720 | s001726071 | Accepted | N, M = map(int, input().split())
ab = [[int(i) for i in input().split()] for i in range(M)]
ans = [0] * N
for a, b in ab:
ans[a-1] += 1
ans[b-1] += 1
for i in ans:
print(i) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.