problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03103 | s756370696 | Accepted | import numpy as np
N, M = map(int, input().split())
shop = []
for _ in range(N):
shop.append(list(map(int, input().split())))
i = 0
num = 0
ans = 0
shop = sorted(shop)
while num < M:
ans += shop[i][0] * shop[i][1]
num += shop[i][1]
i += 1
ans -= (num - M) * shop[i -1][0]
print(ans) |
p03817 | s608315819 | Wrong Answer | x=int(input())
ans=2*(x//11)
x%=11
if x<7:ans+=1
else:ans+=2
print(ans) |
p02717 | s779103024 | Accepted | x,y,z=map(int,input().split())
print(z,x,y) |
p03797 | s310583757 | Accepted | n,m = map(int,input().split())
if n*2 >= m:
print(m//2)
else:
print(n+(m-n*2)//4)
|
p03479 | s080169728 | Accepted |
X, Y = map(int, input().split())
count = 0
while X <= Y:
count += 1
X *= 2
print(count) |
p03037 | s331622248 | Wrong Answer | n, m = list(map(int, input().split()))
R, L = [], []
for i in range(m):
r, l = list(map(int, input().split()))
R.append(r)
L.append(l)
print( min(R) - max(L) + 1) |
p03721 | s592254720 | Accepted | import itertools
n,k=map(int,input().split())
bl=[0]*(10**5+1)
for i in range(n):
a,b=map(int,input().split())
bl[a]+=b
ans=list(itertools.accumulate(bl))
for i in range(len(ans)+1):
if k<=ans[i]:
print(i)
break
|
p02711 | s279389119 | Accepted | N = input()
if '7' in N:
print('Yes')
else:
print('No') |
p02706 | s580323364 | Accepted | N, M = map(int,input().split())
A = list(map(int, input().split()))
count = 0
ans = 0
for i in range(M):
count += A[i]
if(N >= count):
ans = N - count
print(ans)
else:
print('-1') |
p03434 | s699147798 | 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 = [int(input()) for _ in range(n)]
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ali = 0
bob = 0
for i in range(n):
if i % 2 == 0:
ali += a[i]
else:
bob += a[i]
print(ali-bob)
|
p03095 | s470904006 | Accepted | n = int(input())
s = input()
mod = 10 ** 9 + 7
cnt = [0] * 26 # それぞれの文字に対してfreqを数える
for i in s:
cnt[ord(i) - 97] += 1
ans = 1
for i in cnt:
ans *= i + 1
ans %= mod
print(ans - 1)
|
p03261 | s685350829 | Accepted | n = int(input())
w = input()
double_set = set()
double_set.add(w)
finish_str = w[-1]
for i in range(1, n):
w = input()
if w not in double_set and w[0] == finish_str:
double_set.add(w)
finish_str = w[-1]
else:
print("No")
break
else:
print("Yes") |
p02603 | s554017198 | Accepted | n, *a = map(int, open(0).read().split())
money = 1000
stock = 0
for i in range(n-1):
if a[i] < a[i+1]:
stock = money // a[i]
money += (a[i+1] - a[i]) * stock
print(money) |
p02553 | s112098502 | Accepted | A = list(map(int, input().split()))
print(max(A[0]*A[2], A[0]*A[3], A[1]*A[2], A[1]*A[3])) |
p02595 | s779867935 | Wrong Answer | n, d=map(int,input().split())
c = 0
for i in range(n):
s = [int(i) for i in input().split()]
if ((s[0]**2) + s[1]**2)**(1/2) >= d:
c += 1
print(c) |
p02684 | s878205530 | Wrong Answer | N,K=map(int,input().split())
a=list(map(int,input().split()))
cycle=[0]
s_cyc=set()
s_cyc.add(0)
flag=0
id=0
for i in range(N):
a[i]-=1
while N>0:
if a[id] in s_cyc:
node=cycle.index(a[id])
break
else:
cycle.append(a[id])
s_cyc.add(a[id])
id=a[id]
N-=1
if N==0:
print(a[id]+1)
else:
K-=node
cycle=cycle[node::]
q=K%len(cycle)
print(cycle[q]+1)
|
p03360 | s368336200 | Accepted | a,b,c=map(int,input().split())
k=int(input())
print(a+b+c+max(a,b,c)*(2**k-1)) |
p03252 | s816531435 | Wrong Answer | s=input()
t=input()
n=len(s)
d={}
for i in range(n):
ss=s[i]
tt=t[i]
if ss not in d:
d[ss]=tt
if ss in d and (ss,tt) not in d.items():
print("No")
exit()
print("Yes") |
p02909 | s660268036 | Accepted | Weather = ['Sunny','Cloudy','Rainy']
S = input()
for i,s in enumerate(Weather):
if s == S:
print(Weather[(i+1)%3])
|
p02775 | s119376626 | Accepted | N = input()
N = N[::-1]+"0"
ans = 0
up = 0
for i,n in enumerate(N):
d = int(n)+up
if 5 < d or (d == 5 and i < len(N)-1 and int(N[i+1]) >= 5):
ans += (10-d)
up = 1
else:
ans += d
up = 0
print(ans)
|
p03017 | s318470045 | Accepted | N,A,B,C,D=map(int,input().split())
S=input()
s=list(S.split("#"))
answer="Yes"
if "##" in S[min(A,C):max(B,D)]:
answer="No"
if C<D:
pass
else:
if "..." not in S[B-2:D+1]:
answer="No"
print(answer)
|
p02801 | s853702812 | Accepted | C = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
alp_list = list(alp)
num = alp_list.index(C)
print(alp_list[num+1]) |
p03469 | s070938332 | Accepted | import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
ans = "2018" + S[4:]
print(ans)
if __name__ == "__main__":
main()
|
p02924 | s517912694 | Accepted | # from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# import scipy as scp
# 入力の受け取り
n = int(input())
n = n-1
ans = (1+n)*n//2
print(ans)
# print("{:.10f}".format(ans))
|
p03479 | s762150549 | Wrong Answer | x, y = map(int, input().split())
al = []
a = x
al.append(a)
for i in range(int(x) - 1):
a *= 2
if a > y:
break
al.append(a)
print(len(al)) |
p03645 | s740795526 | Accepted | N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
EDGE = [[] for _ in range(N+1)]
for a,b in AB:
EDGE[a].append(b)
EDGE[b].append(a)
def dfs(p,u,d):
if u == N:
return True
if d == 0:
return False
ans = False
for v in EDGE[u]:
if v == u:
continue
ans |= dfs(u,v,d-1)
return ans
ans = dfs(-1,1,2)
s = 'POSSIBLE' if ans else 'IMPOSSIBLE'
print(s)
|
p03456 | s287781223 | Wrong Answer | a,b=map(str, input().split())
c=a+b
d=int(c)
for i in range(1,317):
if d==i**2:
print('Yes')
else:
print('No') |
p02630 | s118929265 | Accepted | from collections import Counter
N = int(input())
A = [int(i) for i in input().split(" ")]
count = Counter(A)
S = sum(A)
Q = int(input())
for i in range(Q):
B,C = map(int,input().split(" "))
n = count[B]
count[B] -= n
count[C] += n
S = S - B*n + C*n
print(S) |
p03827 | s353615037 | Accepted | #import numpy as np
N = int(input())
#x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
S= str(input())
x=0
max=0
for i in S:
if i == 'I':
x+=1
if x>=max:
max=x
elif i== 'D':
x-=1
print(max)
|
p02659 | s210832639 | Accepted | #!/usr/bin/env python
import sys
sys.setrecursionlimit(10**9)
from collections import deque,defaultdict
import heapq
from itertools import combinations
import bisect
from decimal import Decimal
a,b=map(str,input().split())
b=Decimal(b)
a=int(a)
p=list(str(a*b))
ans=''
for i in p:
if i=='.':
break
ans+=i
print(ans)
|
p02784 | s361400406 | Accepted | [H, N] = [int(x) for x in input().split()]
A = list(map(int, input().split()))
count = 0
for x in A:
count += x
print("Yes" if count >= H else "No") |
p03836 | s629223241 | Accepted | sx,sy,tx,ty=map(int,input().split())
ans='U'*(ty-sy)+'R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)
ans+='L'+'U'*(ty-sy+1)+'R'*(tx-sx+1)+'D'
ans+='R'+'D'*(ty-sy+1)+'L'*(tx-sx+1)+'U'
print(ans) |
p03471 | s899007109 | Accepted | N, Y = map(int, input().split())
man = -1
gosen = -1
sen = -1
for i in range(N+1):
for j in range(N+1):
k = N-i-j
if Y == i*10000+j*5000+k*1000 and k >= 0:
print(i, j, k)
exit()
print(-1, -1, -1) |
p02691 | s422253194 | Accepted | import bisect
N=int(input())
A=list(map(int,input().split(' ')))
A_sort = sorted([A[i]-i for i in range(N)])
ans = 0
for n,i in enumerate(A):
ans += bisect.bisect_right(A_sort,-(n+i))-bisect.bisect_left(A_sort,-(n+i))
print(ans) |
p03345 | s427672652 | Wrong Answer | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
a,b,c,k = map(int,input().split())
if (b+c)*k>10**18 or (a+c)*k > 10**18:
print("Unfair")
elif a == b == c:
print(0)
elif k % 2==0:
print(-1*((b+c)-(a+c)))
else:
print((b+c)-(a+c))
if __name__=="__main__":
main() |
p02785 | s423674704 | Accepted | n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
l=sorted(h,reverse=True)
ans=0
for i in range(k,n):
ans=ans+l[i]
print(ans)
|
p02817 | s325938358 | Wrong Answer | print(input().rstrip(" ")) |
p03778 | s603223916 | Wrong Answer | w, a, b = map(int, input().split())
print(max(0, (b - a) - w)) |
p03103 | s539992859 | Accepted | N, M=map(int, input().split())
info=[]
for _ in range(N):
a, b=map(int, input().split())
info.append([a,b])
info.sort(key=lambda x:x[0])
ans=0
for a, b in info:
if M>=b:
ans+=a*b
M-=b
elif M<b and M>0:
ans+=a*M
break
else:
break
print(ans) |
p02831 | s271179538 | Accepted | import fractions
a,b=map(int,input().split())
gcd=fractions.gcd(a,b)
print((a//gcd)*b) |
p03760 | s660644258 | Accepted | print("".join(sum(zip(input(),input()+" "),()))) |
p02761 | s916231936 | Wrong Answer | N,M=map(int,input().split())
li=[list(map(int,input().split())) for _ in range(M)]
zero=["0"]*N
for i in range(M):
order=li[i][0]-1
if zero[order]=="0" or zero[order]==li[i][1]:
zero[order]=li[i][1]
else:
print(-1)
exit()
a=[str(s) for s in zero]
a2="".join(a)
a3=int(a2)
a4=str(a3)
if len(a2)!=len(a4):
print(-1)
exit()
print(a2) |
p03012 | s054655317 | Accepted | def main():
N = int(input())
W = [int(x) for x in input().split()]
w = sum(W)
mini = w
for i in range(N):
a = sum(W[i+1:])
b = w - a
k = abs(a - b)
if mini > k:
mini = k
print(mini)
if __name__ == "__main__":
main() |
p03071 | s703469408 | Accepted | A, B = list(map(int, input().split()))
total = max(
A + A - 1,
B + B - 1,
A + B,
)
print(total)
|
p02787 | s100278322 | Wrong Answer | import sys
def main(args):
h, n = map(int,input().split())
magic = [0]*n
for i in range(n):
dam, mp = map(int,input().split())
magic[i] = (dam, mp)
damage = [float('inf')]*(2*10**4)
damage[0] = 0
for i in range(2*h):
for m in magic:
dam, mp = m
damage[i] = min(damage[i-dam]+mp, damage[i])
print(min(damage[h:]))
if __name__ == '__main__':
main(sys.argv[1:]) |
p02880 | s847532015 | Accepted | n=int(input())
for i in range(9):
a,b=divmod(n,9-i)
if a<=9 and b==0:
print("Yes")
break
else:
print("No") |
p02677 | s391746061 | Accepted | from math import*
A,B,H,M = map(int, input().split())
print((A*A+B*B-2*A*B*cos((M*11/360-H/6)*pi))**.5) |
p03493 | s843611963 | Accepted | s_nums = input()
ans = 0
for nums in s_nums:
if int(nums) == 1:
ans += 1
print(ans)
|
p02951 | s688115074 | Accepted | A, B, C = map(int, input().split())
print(C - min(A - B, C)) |
p03487 | s253976789 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
cnt = [0] * 1001
res = 0
for v in a:
if v <= 1000:
cnt[v] += 1
else:
res += 1
for i in range(1, 1001):
if cnt[i] < i:
res += cnt[i]
elif cnt[i] > i:
res += cnt[i] - i
print(res) |
p02753 | s692800981 | Accepted | s=input()
print("Yes"if s[0]!=s[1] or s[1]!=s[2] else "No") |
p02720 | s468569797 | Accepted | import collections
K = int(input())
Q = collections.deque([i for i in range(1, 10)])
for _ in range(K):
x = Q.popleft()
r = x%10
if r != 0: Q.append(x*10 + r - 1)
Q.append(x*10 + r)
if r != 9: Q.append(x*10 + r + 1)
print(x) |
p03612 | s982106910 | Accepted | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
if p[i] == i + 1:
if i != n - 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
else:
p[i], p[i - 1] = p[i - 1], p[i]
ans += 1
print(ans) |
p02988 | s941442175 | Wrong Answer | #ABC 132 B
n = int(input())
p= [int(j) for j in input().split()]
ans =0
for i in range(0,n-3+1):
if p[i:i+3][1] ==sorted(p[i:i+3])[1]:
ans+=1
print(p[i:i+3])
print(ans) |
p03434 | s454179033 | Accepted | n=int(input())
a=list(map(int,input().split()))
Alice=0
Bob=0
a.sort()
#print(a)
h=len(a)
for i in range(h):
if len(a)>0:
Alice+=a[-1]
del a[-1]
h-=1
if len(a)>0:
Bob+=a[-1]
del a[-1]
h-=1
print(Alice-Bob) |
p03815 | s528929117 | Accepted | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
X = int(input())
result = (X // 11) * 2
X %= 11
if X == 0:
print(result)
elif X <= 6:
print(result + 1)
else:
print(result + 2)
if __name__ == "__main__":
main()
|
p03696 | s626787695 | Wrong Answer | N = int(input())
S = str(input())
if ')' in S:
for i in range(N):
if S[N-1-i] == ')':
n = N-i
break
lc = S[:n].count('(')
rc = S[:n].count(')')
if rc > lc:
S = (rc-lc) * '(' + S
s = S.index('(')
l = 0
r = 0
for i in range(s, len(S)):
if S[i] == '(':
l += 1
else:
r += 1
if l > r:
S = S + (l-r) * ')'
print(S) |
p03073 | s610390343 | Wrong Answer | s = input()
z_g = 0
z_k = 0
o_g = 0
o_k = 0
for i in range(len(s)-1):
if i % 2 == 0:
if s[i] == "0":
z_g += 1
else:
o_g += 1
else:
if s[i] == "0":
z_k += 1
else:
o_k += 1
if (z_g + o_k) > (z_k + o_g):
print(z_k + o_g)
else:
print(z_g + o_k) |
p03219 | s286795482 | Accepted | X, Y = map(int, input().split())
print(X + Y // 2)
|
p02951 | s997821246 | Accepted | ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
a,b,c = mi()
ans = c - (a-b)
if ans < 0:
print(0)
else:
print(ans) |
p02676 | s402870234 | Accepted | K = int(input())
S = input()
if len(S) <= K:
print(S)
else:
print(S[:K]+"...");
|
p02723 | s594019283 | Wrong Answer | a,b,c,d,e,f = input()
if c == d or e == f:
print("Yes")
else:
print("No") |
p03986 | s034670203 | Wrong Answer | x = "T"+input()+"S"
ans = len(x)-2
s = t = 0
for i in x:
if i=="S":
ans -= min(s,t)*2
if t: s = t = 0
s += 1
else: t += 1
print(ans) |
p02847 | s937039642 | Accepted | S = input()
li = ["SU","SAT","FRI","THU","WED","TUE","MON","SUN"]
print(li.index(S)) |
p02811 | s019263777 | Wrong Answer | k,x =list(map(int, input().split()))
if [k*500>=x] :
print('yes')
exit()
else:
print('no')
|
p03681 | s095381522 | Accepted | n,m=map(int,input().split())
p=10**9+7
n,m=min(n,m),max(n,m)
if m-n>=2:
print(0)
elif m-n==1:
ans=1
for i in range(m):
ans=ans*(i+1)%p
for i in range(n):
ans=ans*(i+1)%p
print(ans%p)
else:
ans=1
for i in range(n):
ans=ans*(i+1)%p
print(2*ans*ans%p)
|
p03000 | s750784485 | Accepted | N, X = map(int, input().split())
L = list(map(int, input().split()))
ans = 1
d = 0
for l in L:
if d + l <= X:
d += l
ans += 1
else:
break
print(ans) |
p02813 | s560191671 | Accepted | N=int(input())
P=list(input().split())
Q=list(input().split())
import itertools
arr = list(map(lambda x: ('').join(list(map(str,x))),list(itertools.permutations(range(1,N+1)))))
print(abs(arr.index(('').join(P))-arr.index(('').join(Q)))) |
p02665 | s882090633 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
def solve(N, A):
if not A or A[0] != 1:
print(-1)
return
prev = 1
rt = 1
for a in A[1:]:
if a > prev * 2:
print(-1)
return
rt += (prev * 2 - a) % (prev * 2)
prev = a
print(rt) |
p03659 | s868327595 | Wrong Answer | N=int(input())
a=list(map(int,input().split()))
S=sum(a[1:])
SS=a[0]
mi=abs(S-SS)
for i in range(1,N-1):
if mi>abs((S-a[i])-(SS+a[i])):
S-=a[i]
SS+=a[i]
mi=abs(mi-2*a[i])
print(mi) |
p02829 | s907260665 | Accepted | a = int(input())
b = int(input())
print(6-a-b) |
p02793 | s744102400 | Wrong Answer | from fractions import gcd
from functools import reduce
lcm=lambda x,y:x//gcd(x,y)*y
MOD=10**9+7
n=int(input())
A=list(map(int,input().split()))
c=sum(pow(a,MOD-2,MOD) for a in A)//MOD
l=reduce(lcm,A)//MOD
print(c*l//MOD) |
p03243 | s282141643 | Accepted | N = int(input())
while True:
if len(set(str(N))) == 1:
break
N += 1
print(N) |
p03487 | s272679250 | Accepted | from collections import defaultdict
N = int(input())
if not N == 1:
counter = defaultdict(lambda: 0)
for e in list(map(int, input().split())):
counter[e] += 1
answer = 0
for i in counter:
ball_count = counter[i]
if i > ball_count:
answer += ball_count
elif i < ball_count:
answer += ball_count - i
print(answer)
else:
if not 1 == int(input()):
print(1)
else:
print(0)
|
p03565 | s404200820 | Accepted | s = input()[::-1]
t = input()[::-1]
x = ""
for i in range(0,len(s)-len(t)+1):
if x == "": x = s[i:i+len(t)]
else:x = x[1:] + s[i+len(t)-1]
flag = True
for j in range(len(t)):
if x[j] == "?" or x[j] == t[j]: continue
else: flag = False
if flag:
s = (s[:i] + t + s[i+len(t):])[::-1]
print(s.replace("?", "a"))
exit()
print("UNRESTORABLE") |
p03456 | s877766604 | Accepted | # 2020/08/10
# AtCoder Beginner Contest 086 - B
# Input
a, b = input().split()
ab = int(a + b)
# Calc
if ab ** (1/2) - int(ab ** (1/2)) == 0:
ans = 'Yes'
else:
ans = 'No'
# Output
print(ans)
|
p02622 | s826572763 | Accepted | S = input()
T = input()
print(sum(s != t for s, t in zip(S, T))) |
p02603 | s300435246 | Accepted | def main():
N = int(input())
A = [int(i) for i in input().split()]
money = 1000
for i in range(1, N):
if A[i-1] < A[i]:
v = money//A[i-1] # 株数
money -= v*A[i-1]
money += v*A[i]
print(money)
if __name__ == '__main__':
main()
|
p02882 | s736057100 | Accepted | import math
def main():
a, b, x = [int(x) for x in input().split()]
area = x / a
if area < a*b/2:
theta = math.pi/2 - math.atan(2*area/b/b)
else:
theta = math.atan((2*b-2*area/a)/a)
theta_deg = math.degrees(theta)
print(theta_deg)
if __name__ == "__main__":
main()
|
p04043 | s135759770 | Accepted | A = list(map(int, input().split()))
if A.count(5) == 2 and A.count(7) == 1:
print('YES')
else:
print('NO') |
p03327 | s400679993 | Wrong Answer | n=int(input())
if n<=999:
print("ABD")
else:
print("ABD")
|
p02603 | s775709132 | Wrong Answer | n= int(input())
a = list(map(int,input().split()))
o = {}
for i in a:
if not i in o:
o[i] = 0
a = []
for i in o:
a.append(i)
money = 1000
buy = 0
have = 0
for i in a:
if i == max(a):
money += have * i
break
if have == 0:
have = money // i
money -= i*have
buy = i
elif buy < i:
money += i*have
have = 0
print(money) |
p03665 | s768606675 | Accepted | N,P=map(int,input().split())
A=list(map(int,input().split()))
x,y=1,0
for a in A:
if a%2:
x,y=x+y,x+y
else:
x,y=x*2,y*2
print(y if P else x) |
p03639 | s680988457 | Accepted | from collections import deque
n = int(input())
a = list(map(int, input().split()))
odd = deque([])
even = deque([])
even2 = deque([])
for i in a:
if i % 4 == 0:
even2.append(i)
elif i % 2 == 0:
even.append(i)
else:
odd.append(i)
if len(odd)-1 <= len(even2) and len(even) == 0:
print("Yes")
elif len(odd) <= len(even2):
print("Yes")
else:
print("No") |
p02689 | s616889516 | Accepted | n, m = map(int, input().split())
h_lis = list(map(int, input().split()))
ab_lis = [list(map(int, input().split())) for _ in range(m)]
ans=[True]*n
for ab_li in ab_lis:
#print(ab_li)
if h_lis[ab_li[0]-1] > h_lis[ab_li[1]-1]:
ans[ab_li[1]-1] = False
elif h_lis[ab_li[0]-1] < h_lis[ab_li[1]-1]:
ans[ab_li[0]-1] = False
else:
ans[ab_li[0]-1], ans[ab_li[1]-1] = False, False
#print(ans)
print(sum(ans)) |
p02678 | s121198819 | Wrong Answer | print("Yes") |
p03241 | s693841685 | Accepted | def divisor(n):
cd = []
i = 1
while i*i <= n:
if n%i==0:
cd.append(i)
if i != n//i:
cd.append(n//i)
i += 1
return cd
N, M = map(int, input().split())
cd = divisor(M)
cd.sort(reverse=True)
for d in cd:
if M//d>=N:
print(d)
break |
p03627 | s088684310 | Accepted | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
b1 = [i[0] for i in c.items() if i[1] >= 4]
b2 = [i[0] for i in c.items() if i[1] >= 2]
b = b1 + b2 + [0,0]
b.sort()
print(b[-1]*b[-2]) |
p02730 | s152455428 | Accepted | S = input()
N = len(S)
a = (N-1)//2
def isKaibun(S):
N = len(S)
flag = 0
for i in range((N//2)+1):
if S[i] != S[N-1-i]:
flag =1
if flag == 1:
return False
else:
return True
if isKaibun(S[0:a]) == True:
if isKaibun(S[-1:-a-1:-1]) == True:
if isKaibun(S) == True:
print("Yes")
exit()
print("No") |
p03860 | s815208571 | Accepted | x, y, z = map(str, input().split())
print('A'+y[0]+'C') |
p03448 | s345719216 | Accepted | A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(A+1):
for j in range(B+1):
res = X - 500*i - 100*j
if res%50 == 0 and res//50 <= C and res >= 0:
ans += 1
print(ans) |
p02935 | s885948741 | Accepted | N = int(input())
v = list(map(int,input().split()))
v.sort()
t = (v[0] + v[1])/2
for i in range(2,N):
t = (t + v[i])/2
print(t) |
p03331 | s836168454 | Accepted | n = int(input())
if n%10==0:
print(10)
else:
ans = [char for char in str(n)]
for i in range(0, len(ans)):
ans[i] = int(ans[i])
print(sum(ans)) |
p03799 | s078296304 | Accepted | n,m=map(int,input().split())
if m<2*n:
print(m//2)
else:
print(n+(m-2*n)//4) |
p03693 | s424651100 | Accepted | R,G,B=map(str,input().split())
ans="NO"
num=int(R+G+B)
if num%4==0:
ans="YES"
print(ans) |
p02723 | s085003874 | Accepted | S = input()
if S[2] == S[3] and S[4] == S [5]:
print('Yes')
else:
print('No') |
p02682 | s474934378 | Accepted | a, b, c, k = map(int, input().split())
d = k - a - b
if k < a:
print(k)
elif a <= k <= a + b:
print(a)
elif a + b < k <= a + b + c:
print(a - d) |
p03043 | s688616528 | Accepted | N,K=map(int,input().split())
sum=0
#N面サイコロ、得点K
#K-1以下の得点ならコインを振り続ける
for i in range(1,N+1):
target=i
count=0
while(target<K):
target*=2
count+=1
sum+=(1/N)*(0.5**count)
print(sum)
|
p03407 | s350231973 | Wrong Answer | import sys
a, b, c = map(int, input().split())
if a == c or b == c or a+b == c:
print("Yes")
else:
print("No") |
p02681 | s731316646 | Wrong Answer | A = input()
B = input()
if (A in B) and (len(B)-len(A)==1) and (1<=len(A)<=10) and (A.islower()) and (B.islower()):
print("Yes")
else:
print("No") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.