problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02802 | s476093347 | Accepted | n,m=map(int,input().split())
cnt1=[0]*(n+1)
cnt2=[0]*(n+1)
for _ in range(m):
p,s=map(str,input().split())
p=int(p)
if cnt1[p]==1:
continue
else:
if s=='AC':
cnt1[p]=1
else:
cnt2[p]+=1
ans1=0
ans2=0
for i in range(1,n+1):
if cnt1[i]==1:
ans1+=1
ans2+=cnt2[i]
print(ans1,ans2) |
p03109 | s515166489 | Wrong Answer | import re
s=input()
a=re.search('([0-9]{4})/([0-9]{2})/([0-9]{2})',s)
if int(str(a.group(2)))<=4:
print('Heosei')
else:
print('TBD') |
p03241 | s722270768 | 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()
divisors.reverse()
return divisors
n, m = map(int, input().split())
l = make_divisors(m)
for i in l:
if m / n >= i:
print(i)
exit()
print(1) |
p02972 | s992071598 | Wrong Answer | import sys,math,collections,itertools
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
a.insert(0,0)
b = []
c = [0 for _ in range(N+1)]
for i in range(N,0,-1):
cnt = 0
for j in range(2*i,N,i):
if c[j] == 1:
cnt +=1
if (cnt%2==1 and a[i] == 0) or (cnt%2==0 and a[i] == 1):
b.append(i)
c[i] = 1
print(len(b))
print(*b) |
p03126 | s041139250 | Accepted | n,m=map(int,input().split())
ans=0
b=[0]*m
for _ in range(n):
aa=list(map(int,input().split()))
aa=aa[1:]
for i in aa:
b[i-1]+=1
for i in b:
if i==n:
ans+=1
print(ans) |
p03494 | s656821551 | Accepted | import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans)) |
p02727 | s108574265 | Accepted | x,y,A,B,C=map(int,input().split())
pa=list(map(int,input().split()))
qb=list(map(int,input().split()))
rc=list(map(int,input().split()))
pa.sort()
qb.sort()
temp=0
pa=pa[-x:]
qb=qb[-y:]
paa=pa+rc
paa.sort()
paa1=paa[-x:]
paa2=paa[:-x]
qbb=qb+paa2
qbb.sort()
qbb1=qbb[-y:]
print(sum(paa1)+sum(qbb1)) |
p02790 | s029750966 | Wrong Answer | def main():
a,b = map(int,input().split())
ans = check(a,b)
print(ans)
def check(n,m):
num = ""
if n < m:
for i in range(m):
num = str(num) + str(n)
return num
elif n > m:
for i in range(n):
num = str(num) + str(m)
return num
main() |
p03146 | s953747573 | Accepted | s = int(input())
a = s
l = [a]
for i in range(100000):
if a % 2 == 0:
a = a // 2
else:
a = 3 * a + 1
if a in l:
print(i + 2)
break
l.append(a) |
p03639 | s285069896 | Accepted | n = int(input())
cnt4 = 0
cnt2 = 0
a = list(map(int, input().split()))
for num in a:
if num % 4 == 0:
cnt4 += 1
elif num % 2 == 0:
cnt2 += 1
if cnt4 >= n // 2:
print("Yes")
exit()
elif cnt4 >= (n - cnt2 + 1) // 2:
print("Yes")
exit()
print("No") |
p03679 | s326675261 | Wrong Answer | a,b,c=map(int,input().split())
if b>c:
print("delicious")
elif a+b >c:
print("safe")
else:
print("dangerous") |
p03073 | s402171984 | Wrong Answer | S = list(input())
ans = len(S)
for i in range(2):
cnt = 0
for j in range(ans):
if j % 2 == 0 and S[j] != str(i): cnt += 1
if j % 2 == 1 and S[j] == str(i): cnt += 1
ans = min(ans,cnt)
print(ans) |
p04044 | s544091988 | Accepted | n, l = map(int,input().split())
a = []
for i in range(n):
a.append(input())
a.sort()
print(''.join(a)) |
p03013 | s654590748 | Accepted | n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
a = set(a)
d = [1] + [1]*n
for i in range(1, n):
if i in a:
d[i] = 0
d[i+1] = d[i-1]
else:
d[i+1] = d[i] + d[i-1]
print(d[n]%1000000007) |
p03210 | s430640643 | Accepted | X = int(input())
if X == 3 or X == 5 or X == 7:
print('YES')
else:
print('NO') |
p02813 | s140461145 | Accepted | import itertools
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
w = 0
x = 0
S = []
T = []
for i in range(N):
S.append(i+1)
for j in itertools.permutations(S):
T.append(list(j))
a = T.index(P)
b = T.index(Q)
print(abs(a-b))
|
p02720 | s045170433 | Wrong Answer | k = int(input())
anss = [1,2,3,4,5,6,7,8,9]
for i in range(12):
if len(anss) > k:
print(anss[k-1])
break
new_anss = []
for ans in anss:
if ans % 10 != 0:
new_anss += [ans*10+ans-1]
new_anss += [ans*10+ans]
if ans % 10 != 9:
new_anss += [ans*10+ans+1]
k -= len(anss)
anss = new_anss |
p02553 | s117597702 | Accepted | a, b, c, d = map(int, input().split())
ans = max(a * c, b * c, a * d, b * d)
print(ans)
|
p02935 | s358962210 | Wrong Answer | n = int(input())
v = sorted(list(map(int,input().split())))
for _ in range(n-1):
x = v[0]
y = v[1]
num = (x+y)/2
del v[0]
v[0] = num
print(int(v[0])) |
p03329 | s855741876 | Wrong Answer | import sys
n=int(input())
l=[1,6,36,6**4,6**5,6**6,9,9**2,9**3,9**4,9**5]
dp=[float("inf")]*(n+1)
dp[0]=0
dp[1]=1
if n==1:
print(1)
sys.exit()
for i in range(2,n+1):
for j in l[::-1]:
if i-j>=0:
dp[i]=min(dp[i],dp[i-j]+1)
print(dp[n]) |
p03095 | s663044296 | Accepted | from itertools import groupby as gb
n,s=open(0)
n=int(n)
s=sorted(s[:-1])
ans=1
mod=10**9+7
for i,x in gb(s):
ans=ans*(len(list(x))+1)%mod
print(ans-1)
|
p02608 | s166240828 | Wrong Answer | import math
N = int(input())
#Nは6以上
for n in range(1,N):
r_n = math.floor(math.sqrt(n))
count = 0
for x in range(1,r_n):
for y in range(1,r_n):
for z in range(1,r_n):
if (x*x + y*y + z*z + x*y + y*z + z*x) == n:
count+=1
print(count) |
p02747 | s733264471 | Wrong Answer | n = input()
l = n.replace("hi","a")
print("No" if len(set(l)) != 1 else "Yes") |
p03543 | s341852168 | Accepted | a,b,c,d=map(int,input())
if a==b==c or b==c==d:
print('Yes')
else:
print('No') |
p04029 | s429896669 | Accepted | N = int(input())
print(N*(N+1)//2) |
p02688 | s665245438 | Accepted | N, K = map(int, input().split())
A = []
for i in range(K):
di = int(input())
Ai = list(map(int, input().split()))
A.extend(Ai)
print(N - len(set(A)))
|
p03719 | s782831404 | Accepted | # 061_a
A, B, C = map(int, input().split())
if (-100 <= A <= 100) and (-100 <= B <= 100) and (-100 <= C <= 100):
if A <= C and C <= B:
print('Yes')
else:
print('No')
|
p03624 | s144611969 | Accepted | s=input()
count=0
for i in range(97,97+26):
if chr(i) not in s:
print(chr(i))
count+=1
break
if count==0:
print("None") |
p02595 | s542997116 | Wrong Answer | N,D = [int(x) for x in input().split()]
count = 0
for x in range(N):
x,y = [int(x) for x in input().split()]
if x**2 + y**2 <= D:
count += 1
print(count) |
p02779 | s366538731 | Accepted | def checker(arr):
d = {}
for x in arr:
if x not in d:
d[x] = 1
else:
return "NO"
return "YES"
n = int(input())
arr = list(map(int, input().split()))
print(checker(arr)) |
p03565 | s076526702 | Accepted | S = input()
T = input()
def solve(i):
flag = True
for j in range(len(T)):
if i+j < len(S) and (S[i+j] == "?" or S[i+j] == T[j]):
continue
else:
flag = False
break
return flag
anslist = []
for i in range(len(S)):
if solve(i):
anstmp = S[:i] + T + S[i+len(T):]
anstmp = anstmp.replace("?", "a")
anslist.append(anstmp)
if len(anslist) > 0:
anslist.sort()
ans = anslist[0]
else:
ans = "UNRESTORABLE"
print(ans) |
p02577 | s312338408 | Wrong Answer | N=int(input());tt=0
while(N):
tt+=(N%10);N//=10
if tt>81:break
print("No" if tt%9 else "Yes") |
p02615 | s257255982 | Accepted | N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
p = a[0]
for i in range(N-2): #-1は上記a[0]分、もう-1は最初の要素挿入は加点されないため。
p += a[(i//2)+1]
print(p) |
p03994 | s635324541 | Wrong Answer | alphabet = 'abcdefghijklmnopqrstuvwxyz'
s = input()
K = int(input())
ans = ''
for i in range(len(s)):
s_i = alphabet.index(s[i])
if (26 - s_i < K) & (s_i != 0):
K -= 26 - s_i
s_i = 0
ans += alphabet[s_i]
if K > 0:
s_i = (alphabet.index(s[-1]) + K) % 26
ans = ans[:-1] + alphabet[s_i]
print(ans)
|
p03163 | s647984456 | Accepted | N,W = [int(x) for x in input().split()]
l = []
for i in range(N):
l.append([int(x) for x in input().split()])
DP = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,W+1):
for j in range(1,N+1):
if l[j-1][0] > i:
DP[j][i] = DP[j-1][i]
else:
DP[j][i] = max(DP[j-1][i],DP[j-1][i-l[j-1][0]]+l[j-1][1])
print(DP[N][W]) |
p02818 | s701525943 | Accepted | A,B,K = map(int,input().split())
if A-K>=0:
print(A-K,B)
else:
K-=A
if B-K>=0:
print(0,B-K)
else:
print(0,0) |
p03289 | s335340479 | Wrong Answer | s = input()
n = len(s)
res = []
ans = 0
for i in s:
if i == 'A' or i == 'C':
res.append(i)
if s[0] == 'A':
ans += 1
if s.find('C') >= 2 and s.find('C') < n-2:
ans += 1
if res == ['A', 'C']:
ans += 1
if ans == 3:
print('AC')
else:
print('WA') |
p03210 | s340443395 | Accepted | x = int(input())
if x == 3 or x == 5 or x == 7:
print('YES')
else:
print('NO') |
p02577 | s440724813 | Accepted | N = int(input())
result = sum(list(map(int, str(N))))
if result%9==0:
print("Yes")
else:
print("No") |
p02899 | s831093970 | Accepted | N = int(input())
alist = list(map(int, input().split()))
b = [(alist[i], i+1) for i in range(N)]
b.sort()
ans = [b[i][1] for i in range(N)]
print(*ans)
|
p02687 | s617435447 | Accepted | S = input()
if S == 'ABC':
print('ARC')
else:
print('ABC') |
p03943 | s646176267 | Accepted | a, b, c = map(int, input().split())
if max(a, b, c) == a + b + c - max(a, b, c):
print("Yes")
else:
print("No")
|
p02597 | s198919925 | Wrong Answer | N=int(input())
c=input()
r=c.count("R")
w=c.count("W")
if w==0 or r==0:
print(0)
else:
ans=w
cnt=0
for i in range(N-1,N-w,-1):
cnt+=(c[i]=="W")
test=i-cnt+w-i
ans=min(ans,test)
print(ans)
|
p02773 | s647105693 | Accepted | import collections
N = int(input())
S = [None] * N
for i in range(N):
S[i] = input()
count = collections.Counter(S)
max_n = max(count.values())
# print(max_n)
keys = [k for k, v in count.items() if v == max_n]
keys.sort()
for s in keys:
print(s)
|
p02791 | s743787017 | Accepted | a = int(input())
array = list(map(int, input().strip().split()))
out = 0
min_num = array[0]
for i in array:
min_num = min(min_num, i)
out = out + 1 if i == min_num else out
print(out) |
p02777 | s156734227 | Accepted | s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
print(str(a-1)+" "+str(b))
else:
print(str(a)+" "+str(b-1)) |
p02820 | s073649194 | Accepted | N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
for i in range(N):
if i >= K and T[i-K] == T[i]:
T[i] = 'a'
ans = 0
for i in T:
if i == 'r':
ans += P
elif i == 's':
ans += R
elif i == 'p':
ans += S
print(ans) |
p02659 | s102381033 | Wrong Answer | a, b = map(float, input().split())
ans = int(a * b)
print(ans) |
p03723 | s497702484 | Accepted | A, B, C = map(int, input().split())
if A % 2 == 0 and A == B and B == C:
print(-1)
exit()
count = 0
while (A % 2, B % 2, C % 2) == (0, 0, 0):
A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
count += 1
print(count)
|
p02584 | s377650343 | Wrong Answer | X,K,D = map(int,input().split())
if X > 0 and X-K*D > 0:
print(abs(X-K*D))
elif X < 0 and X+K*D < 0:
print(abs(X+K*D))
else:
if X > 0:
A = X//D
B = X%D
if (K-A)%2 == 1:
print(abs(B-D))
else:
print(abs(B))
if X < 0:
A = (-X)//D
B = (X%D)-D
if (K-A)%2 == 1:
print(abs(B+D))
else:
print(abs(B))
|
p02682 | s782109315 | Accepted | a, b, c, k = map(int, input().split())
if k <= a :
print(k)
elif k <= a+b:
print(a)
else:
print(a+a+b-k) |
p02725 | s602045427 | Wrong Answer | import numpy as np
##get int
first_input = list(map(lambda x:int(x), input().split(" ")))
second_input = list(map(lambda x:int(x), input().split(" ")))
##get float
#first_input = list(map(lambda x:float(x), input().split(" ")))
#second_input = list(map(lambda x:float(x), input().split(" ")))
##get string
#first_input = input().split(" ")
K = first_input[0]
N= first_input[1]
A_list = second_input
A_list.append(K+A_list[0])
dist_list = np.array(A_list)[1:]-np.array(A_list)[:-1]
print(A_list)
print(dist_list)
print(sum(dist_list)-max(dist_list))
|
p02787 | s230862330 | Accepted | import numpy as np
h, n = map(int, input().split())
ab = np.array([list(map(int, input().split())) for _ in range(n)])
a = ab[:, 0]
b = ab[:, 1]
dp = np.zeros(10**5, dtype=np.int)
for i in range(1, h+1):
dp[i] = min(dp[i-a]+b)
print(dp[h]) |
p02795 | s309616773 | Accepted | h = int(input())
w = int(input())
n = int(input())
if h >= w:
print(-(-n//h))
elif w > h:
print(-(-n//w)) |
p03838 | s110606577 | Wrong Answer | x, y = map(int, input().split())
ans = 0
if x > 0:
if y >= x:
ans = y - x
elif 0 <= y < x:
ans = 1 + abs(x) + y
elif -x <= y < 0:
ans = 1 + abs(x) - abs(y)
else:
ans = 1 + abs(y) - abs(x)
else:
if y >= -x:
ans = 1 + abs(y) + abs(x)
elif 0 <= y < -x:
ans = 1 + abs(y) - abs(x)
elif x <= y < 0:
ans = abs(y) - abs(x)
else:
ans = 1 + abs(y) - abs(x) + 1
print(ans) |
p02947 | s540164317 | Accepted | import math
def comb(n, r):
if n-r>=0:
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
else:
return 0
n=int(input())
l=[]
for i in range(n):
s=sorted(input())
l.append(s)
l.sort()
cnt=1
ans=0
for i in range(n-1):
if l[i]==l[i+1]:
cnt+=1
else:
ans+=comb(cnt,2)
cnt=1
ans+=comb(cnt,2)
print(ans) |
p03221 | s048375123 | Accepted | from operator import itemgetter
N, M = map(int, input().split())
PY = sorted(((i, tuple(map(int, input().split()))) for i in range(M)), key=itemgetter(1))
L = []
prev, x = 0, 1
for i, (p, _y) in PY:
if p == prev:
x += 1
else:
prev = p
x = 1
L.append((i, "{:06d}{:06d}".format(p, x)))
L.sort()
print(*[l for _, l in L], sep="\n") |
p03162 | s220031653 | Wrong Answer | import numpy as np
n = int(input())
l = []
for i in range(n):
l.append(list(map(int , input().split())))
#arr = np.array(l)
maxc = max(l[0])
#print(maxc)
ind = l[0].index(maxc)
for r in range(1,n):
max1 = 0
for i in range(3):
if(ind != i):
max1 = max(max1,l[r][i])
ind = l[r].index(max1)
#print(max1)
maxc += max1
print(maxc)
|
p04005 | s280843408 | Accepted | a = list(map(int,input().split()))
a.sort()
if a[2]%2==0:
print(0)
else:
print(a[0]*a[1]) |
p03324 | s780178823 | Accepted | D,N=map(int,input().split())
num=N*100**D
if N==100:
num+=100**D
print(num) |
p02600 | s679203443 | Accepted | x=input()
x=int(x)
if x>=400 and x<600:
rank=8
elif 600<=x and x<800:
rank=7
elif 800<=x and x<1000:
rank=6
elif 1000<=x and x<1200:
rank=5
elif 1200<=x and x<1400:
rank=4
elif 1400<=x and x<1600:
rank=3
elif 1600<=x and x<1800:
rank=2
elif 1800<=x and x<2000:
rank =1
print(rank)
|
p02702 | s236403214 | Accepted | from collections import defaultdict
S = input()
n = len(S)
N = defaultdict(int)
x = 0
for i in reversed(range(n)):
x += int(S[i])*pow(10,(n-i-1),2019)
x %= 2019
N[x] += 1
ans = N[0]
for j in N.values():
ans += j*(j-1)//2
print(ans) |
p03264 | s067108680 | Accepted | def main():
n = int(input())
a = n // 2
b = (n + 1) // 2
print(a*b)
if __name__ == "__main__":
main() |
p03434 | s308590433 | Wrong Answer | s=[[int(j) for j in input().split()] for i in range(2)]
n=s[0][0]
a=s[1]
print(a[0])
alice=0
bob=0
max=0
for i in range(len(a)-1):
if a[i]<=a[i+1]:
temp=a[i]
a[i]=a[i+1]
a[i+1]=temp
for i in range(len(a)):
if i % 2==0:
alice+=a[i]
else:
bob+=a[i]
print(alice-bob) |
p02546 | s886697396 | Accepted | s = input()
if s[-1:] == 's':
print(s + 'es')
else:
print(s + 's') |
p02912 | s756131180 | Wrong Answer | import bisect
n, m = map(int, input().split())
a = map(int, input().split())
a = sorted(a)[::-1]
for i in range(m):
a[0] = int(a[0] / 2)
p = bisect.bisect_left(a[1:], a[0])
a = a[1:p] + [a[0]] + a[p:]
print(sum(a)) |
p02784 | s060854855 | Wrong Answer |
H, N = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
print("yes" if H <= S else "no") |
p03696 | s390815476 | Wrong Answer | n = int(input())
si = input()
s = list(si)[::-1]
ln = 0
rn = 0
l = ""
r = ""
for i in range(n):
if s[i] == ')':
ln += 1
rn -= 1
else:
rn += 1
if ln == 0 and rn > 0:
l += ")"
rn -= 1
r = "(" * (rn*-1)
print(r + si + l) |
p02755 | s754221968 | Accepted | a, b = map(int, input().split())
start = b * 10
flg = True
for i in range(10):
tmp = start + i
if int(tmp*0.08) == a:
flg = False
break
if flg:
print('-1')
else:
print(int(tmp)) |
p03438 | s432971922 | Accepted |
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for a, b in zip(A, B):
if a > b:
cnt -= a - b
if a < b:
cnt += (b - a) // 2
if cnt < 0:
print("No")
else:
print("Yes")
|
p03206 | s510464175 | Wrong Answer | n = int(input())
nokori = n-25
eve = ' Eve'*nokori
print('Christmas'+eve) |
p02958 | s969855704 | Accepted | #import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys
ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n = int(input())
p = list(map(int,ipti().split()))
cnt = 0
for i in range(n):
if (i + 1) != p[i]:
cnt += 1
if cnt < 3:
print('YES')
else:
print('NO')
if __name__ == '__main__':
main() |
p02603 | s105997393 | Accepted | n = int(input())
a = list(map(int,input().split()))
ans = 1000
cnt = 0
for i in range(0,len(a)-1):
if a[i]<a[i+1]:
cnt = ans//a[i]
ans = ans-a[i]*cnt
ans = ans+a[i+1]*cnt
print(ans) |
p02933 | s958637417 | Accepted | a = int(input())
s = input()
if a>=3200:
print(s)
else:
print("red") |
p03721 | s458559687 | Wrong Answer | N, K = map(int, input().split())
l = []
for i in range(N):
a, b = map(int, input().split())
l.append([a, b])
c = 0
q = []
for r in l:
c += r[1]
if c >= K:
q.append(r[0])
print(q[0]) |
p03910 | s813719143 | Wrong Answer | n = int(input())
if n==1:
print(1)
exit()
if n%2==0:
print(n//2+1)
print(n-(n//2+1))
else:
print(n//2,)
print(n-(n//2)) |
p03455 | s335521608 | Accepted | a,b=map(int,input().split())
ans="Odd"
product=a*b
if product%2==0:
ans="Even"
print(ans) |
p02953 | s865814807 | Accepted | n = int(input())
h = list(map(int, input().split()))
h.reverse()
pflag = True
for i in range(n - 1):
if h[i] < h[i + 1]:
h[i + 1] -= 1
if h[i] < h[i + 1]:
pflag = False
break
if pflag == True:
print('Yes')
else:
print('No') |
p02833 | s019781655 | Wrong Answer | from math import floor
def main():
result = 0
N = int(input())
if N % 2 == 0:
N /= 2
while N > 0:
# Nは偶数,かつ5の倍数 ∴10の倍数
result += floor(N / 5)
N = floor(N / 5)
print(result)
else:
print(0)
if __name__ == '__main__':
main()
|
p03680 | s964376778 | Accepted | N = int(input())
a = []
for _ in range(N):
a.append(int(input()) - 1)
i, count = 0, 0
success = False
for _ in range(N):
i = a[i]
count += 1
if i == 1:
success = True
break
if not success:
count = -1
print(count) |
p02711 | s481482344 | Accepted | N = input()
r = False
for n in N:
if n == "7":
r = True
if r:
print("Yes")
else:
print("No")
|
p03038 | s015316578 | Accepted | from collections import Counter
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
num, seta = Counter(a), set(a)
for b, c in bc:
num[c] += b
seta.add(c)
sorta = sorted(list(seta), reverse=True)
cnt, ans = n, 0
for i in sorta:
ans += i * min(num[i], cnt)
cnt -= num[i]
if cnt <= 0:
break
print(ans)
|
p02987 | s156572815 | Accepted | S = list(input())
for x in S:
if S.count(x) != 2:
print('No')
exit()
print('Yes') |
p03250 | s734091920 | Accepted | nSorted = sorted(list(map(int,input().split())),reverse=True)
print(nSorted[0]*10+nSorted[1]+nSorted[2])
|
p03086 | s359379260 | Accepted | s=list(input())
#print(s)
ans = -1
counter = 0
for i in range(len(s)):
if s[i] == "A" or s[i] == "T" or s[i] == "G" or s[i] == "C":
#print("ATGC")
counter += 1
else:
counter = 0
ans = max(ans,counter)
print(ans)
|
p02959 | s699949366 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cnt = 0
for i in range(n):
if b[i] >= a[i]:
cnt += a[i]
b[i] = b[i] - a[i]
if b[i] >= a[i+1]:
cnt += a[i+1]
a[i+1] = 0
else:
a[i+1] = a[i+1]-b[i]
cnt += b[i]
else:
cnt += b[i]
print(cnt) |
p03639 | s422486741 | Accepted | N=int(input())
A = map(int,input().split(' '))
o = 0
s = 0
f = 0
for a in A:
if a % 2 == 0:
if a % 4 == 0:
f += 1
else:
s += 1
else:
o += 1
if s == 0:
if f >= o-1:
print("Yes")
else:
print("No")
else:
if f >= o:
print("Yes")
else:
print("No")
|
p03211 | s856744819 | Accepted | s = input()
ans = []
for i in range(len(s)-2):
x = int(s[i:i+3])
ans.append(abs(x -753))
print(min(ans))
|
p02633 | s580079860 | Accepted | from math import gcd
x = int(input())
lcm = (x * 360)/gcd(x, 360)
print(int(lcm/x))
|
p03778 | s614040037 | Accepted | w, a, b = map(int, input().split())
if abs(a - b) <= w:
print("0")
else:
print(abs(a-b) - w)
|
p02730 | s336342222 | Accepted | s = list(input())
n = len(s)
if s == s[::-1] and s[:(n-1)//2] == s[:(n-1)//2][::-1] and s[(n+3)//2-1:n] == s[(n+3)//2-1:n][::-1]:
print('Yes')
else:
print('No') |
p02861 | s364298765 | Accepted | #abc 145 C
n = int(input())
coor = [] # 各町の座標
dis_ij = []# 各町の距離を格納
for i in range(n):
x,y = map(int, input().split())
coor.append((x,y))
def dis_2point(s,k):
return ((s[0] -k[0])**2 + (s[1] - k[1])**2)**0.5
for i in range(n):
for j in range(i):
dis_ij.append(dis_2point(coor[i], coor[j]))
print(sum(dis_ij) * 2/n) |
p02691 | s027795981 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
ans = 0
dp = dict()
dm = dict()
for i,ai in enumerate(a):
dp[i+ai] = dp.get(i+ai,0)+1
dm[i-ai] = dm.get(i-ai,0)+1
for wa,i in dm.items():
ans += i*dp.get(wa,0)
print(ans)
|
p02796 | s106483664 | Accepted | from operator import itemgetter
def solve():
N = int(input())
X = []
for i in range(N):
xx, ll = map(int, input().split())
X.append((xx-ll, xx+ll))
X.sort(key=itemgetter(1))
count = 0
cur = -float('inf')
for i in range(N):
c, d = X[i]
if cur <= c:
count += 1
cur = d
return count
print(solve())
|
p02948 | s815385106 | Accepted | from heapq import heapify, heappop, heappush
N,M = map(int, input().split())
AB = []
for i in range(N):
a,b = map(int, input().split())
AB.append((a,-b))
AB.sort()
Q = []
ans = 0
i = 0
for day in range(M):
while i<N and AB[i][0] == day+1:
heappush(Q, AB[i][1])
i+=1
if Q:
ans -= heappop(Q)
print(ans) |
p02784 | s831921087 | Wrong Answer | #153b
#値を受け取る
H, N = map(int, input().split())
A = list(map(int, input().split()))
#listの合計で倒せるか判断
if H < sum(A):
print('Yes')
else:
print('No') |
p02838 | s872355067 | Wrong Answer | import itertools
n = int(input())
a = list(map(int,input().split()))
aas = list(itertools.combinations(a,2))
m = len(aas)
x = 0
for i in range(m):
x += ((aas[i][0] ^ aas[i][1]) % (10**7 + 9))
x %= 10**7 + 9
print(x)
|
p03943 | s575726961 | Accepted | a, b, c = map(int, input().split())
if (a+b==c) or (b+c==a) or (c+a==b):
print('Yes')
else:
print('No') |
p02823 | s980274769 | Accepted | def solve():
N, A, B = [int(i) for i in input().split()]
if (B - A) % 2 == 0:
print((B - A) // 2)
else:
print(min(N - B, A - 1) + 1 + (B - A - 1) // 2)
if __name__ == "__main__":
solve() |
p02576 | s784941833 | Accepted | x, n, t = list(map(int, input().split()))
result = (-(-x // n)) * t
print(result) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.