problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02760 | s216938335 | Accepted | a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
lst=[a,b,c,d,e,f,g,h,i]
for i in range(int(input())):
x=int(input())
for j in range(9):
if x==lst[j]:
lst[j]=0
a,b,c,d,e,f,g,h,i=lst
tf=0
for k in [a+b+c,d+e+f,g+h+i,a+d+g,b+e+h,c+f+i,a+e+i,c+e+g]:
if not k:
... |
p03162 | s153804558 | Wrong Answer | n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]
dp=[[0]*3 for _ in range(n+1)]
for i in range(0,n):
for j in range(0,3):
for k in range(0,3):
if j!=i:
dp[i+1][k]=max(dp[i+1][k],dp[i][j]+abc[i][j])
res=0
for j in range(0,3):
res=max(res,dp[n][j])
print(res) |
p02947 | s115946317 | Wrong Answer | import numpy as np
n = int(input())
x = []
for _ in range(n):
x.extend(sorted([ord(i) - 97 for i in input()]))
x = np.array(x).reshape(n,10)
count = 0
for i in x:
count += (len(np.where(x == i)[0])/10) - 1
print(int(count/2)) |
p02720 | s052195394 | Wrong Answer | K=int(input())
import queue
a=queue.Queue()
if K<=9:
print(K)
else:
for i in range(1,10):
a.put(i)
n=K
while n>1:
x=a.get()
if x%10!=0:
a.put(10*x-1)
a.put(10*x)
if x%10!=9:
a.put(10*x+1)
n-=1
ans=a.get()
print(ans) |
p02701 | s832191304 | Wrong Answer | s=list(input())
x=0
if len(s)<=3:
x=0
print(x)
else :
for j in range(len(s)):
count=0
for i in range(len(s)-j):
a="".join(s[j:j+count+1])
if int(a) % 2019 ==0:
x+=1
count+=1
else:
count+=1
print(x) |
p02554 | s804451918 | Accepted | N = int(input())
ans = (10**N - 2*9**N + 8**N) % (10**9 +7)
print(ans) |
p03352 | s294555318 | Wrong Answer | import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) fo... |
p03000 | s743562111 | Wrong Answer | N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
D_a = 0
D_b = 0
for i in range(N):
D_a = D_b + L[i]
D_b = D_a
if D_a > X:
print(cnt)
else:
cnt += 1
|
p02676 | s219453808 | Accepted | K = int(input())
S = input()
S_len = len(S)
if len(S)<=K:
print(S)
else:
print(S[0:K]+'...') |
p03250 | s373575147 | Accepted | a,b,c=[int(i)for i in input().split()]
x=max(a,b,c)
print(9*x+a+b+c) |
p02897 | s114743446 | Accepted | def main():
N = int(input())
ans = (N + 1) // 2
ans /= N
print(ans)
if __name__ == '__main__':
main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
# while abs(ok - ng)... |
p02847 | s640800592 | Wrong Answer | S=input()
if S == 'SUN':
print(7)
elif S == 'MON':
print(6)
elif S == 'TUE':
print(5)
elif S == 'WED':
print(4)
elif S == 'THS':
print(3)
elif S == 'FRI':
print(2)
elif S == 'SAT':
print(1) |
p02595 | s660141104 | Wrong Answer | import numpy as np
temp = input().split()
s = [input().split() for i in range(int(temp[0]))]
cnt = 0
for i in range(int(temp[0])):
if np.sqrt(int(s[i][0])*int(s[i][0]) + int(s[i][1])*int(s[i][1])) > int(temp[1]):
cnt += 1
print(cnt) |
p02659 | s002469599 | Wrong Answer | A, B = input().split()
A = int(A)
B = float(B)
B *= 100
ans = A * B / 100
print(int(ans)) |
p02725 | s916575993 | Wrong Answer | k, n = map(int, input().split())
#print(k)
#print(n)
a = input().split()
l_si_i = [int(s) for s in a]
#print(l_si_i)
for i in reversed(range(0, n)):
if l_si_i[i] == 0:
l_si_i.pop(i)
#print(l_si_i)
minIndex = l_si_i.index(min(l_si_i))
#print(minIndex)
if minIndex != 0:
temp = l_si_i.pop(minIndex)
l_si_i.i... |
p02996 | s067100147 | Wrong Answer | n=int(input())
x=[]
for _ in range(n):
a,b=map(int,input().split())
x.append([a,b,b-a])
x.sort(key=lambda x:x[2])
t=0
ans='Yes'
for i in range(n):
if t<=x[i][2]:
t+=x[i][0]
else:
ans='No'
break
print(ans) |
p02820 | s302536454 | Wrong Answer | N,K = map(int,input().split())
R,S,P = map(int,input().split())
score_dic = {"r":R,"s":S,"p":P}
win_dic = {"r":"p","s":"r","p":"s"}
T = list(input())
score = 0
for i in range(0,N,1):
if i >= K and T[i-K] == T[i]:
T[i]="m"
print(0)
else:
score+=score_dic[win_dic[T[i]]]
print(score... |
p02995 | s771712780 | Accepted | import fractions
a,b,c,d = map(int,input().split())
lcm = c * d // fractions.gcd(c, d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
warikireru = x+y - (b//lcm - (a-1)//lcm)
print(b-a+1-warikireru) |
p02621 | s492160175 | Wrong Answer | a=int(input())
ans=a+a**2+a**3
print("ans") |
p04005 | s280406578 | Accepted | l = list(map(int,input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]
if a%2 == 0 or b%2 == 0 or c%2 == 0:
print(0)
exit(0)
vmax,vmin = 0,0
v = a*b*c
vmin = (c//2)*a*b
vmax = v - vmin
print(vmax-vmin)
|
p02702 | s213408394 | Accepted | def main():
n, mods = 0, [1]+[0]*2019
for i, j in enumerate(reversed(input())):
n = (n+int(j)*pow(10, i, 2019))%2019
mods[n] += 1
print(sum([i*(i-1)//2 for i in mods]))
main() |
p03557 | s187117254 | Wrong Answer | n = int(input())
X = sorted(list(map(int,input().split())), reverse=True)
Y = sorted(list(map(int,input().split())), reverse=True)
Z = sorted(list(map(int,input().split())), reverse=True)
print(sum((n-bisect.bisect_right(X,b)) * (bisect.bisect_left(Z,b))) for b in Y) |
p03633 | s199633405 | Accepted |
n = int(input())
t = []
for i in range(n):
t.append(int(input()))
# 最大公約数(greatest_common_divisor)
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
# 最小公倍数(lowest_common_multiple)
def lcm(a, b):
return a*b//gcd(a,b)
# 最小公倍数と、比べていない数字を比べ、最小公倍数を更新する
alcm = t[0]
for i in t[1:]:
alcm = lcm(alcm, i)... |
p02645 | s516032039 | Accepted | # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
s = input()
#開業されたN個要素を受け付ける
#input_list = [list(map(int, input().split())) for i in range(N)]
print(s[0:3])
|
p02600 | s633749892 | Wrong Answer | a = int(input())
arr = list(range(400,1801,200))
arr2 = [8,7,6,5,4,3,2,1]
res = 8
for i in range(1,len(arr)):
if (a >= arr[i]):
res = arr2[i]
else:
print(res)
break |
p03086 | s449913846 | Accepted | a="".join(["1" if s in ["A","C","G","T"] else "0" for s in input()])
ans=[len(s) for s in a.split("0")]
print(max(ans)) |
p02818 | s884882545 | Accepted | a,b,k = list(map(int, input().split()))
if a+b <= k:
print('0 0')
else:
t = a-k if a-k > 0 else 0
ao = b-(k-a) if t == 0 else b
print('{} {}'.format(t, ao))
|
p03456 | s522224282 | Accepted | a,b = map(int,input().split())
x = str(a)+str(b)
y = int(x)**0.5
if y.is_integer():
print('Yes')
else:
print('No') |
p02628 | s031196020 | Accepted | n,k=map(int,input().split())
p=list(map(int,input().split()))
s=0
p.sort()
for i in range(k):
s+=p[i]
print(s) |
p02582 | s291471056 | Accepted | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(input())
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
s = input()
if s == "RRR":
print(3)
elif "RR" in s:
print(2)
elif "R" in s:
print(1)
else:
... |
p03000 | s446544856 | Accepted | import sys
read=sys.stdin.buffer.readline
N,X=map(int,read().split())
L=list(map(int,read().split()))
ans=1
res=0
for l in L:
res+=l
if res<=X:
ans+=1
else:
break
print(ans) |
p02678 | s618851221 | Wrong Answer | from collections import deque
n,m = map(int,input().split())
path = []
net = [[] for _ in range(n+1)]
for _ in range(m):
a,b = map(int,input().split())
net[a].append(b)
net[b].append(a)
a = [-1] * (n+1)
d = deque()
d.append(1)
while d:
u = d.popleft()
for child in net[u]:
if a[child] != -... |
p02924 | s690115806 | Accepted | n = int(input())
print(n*(n-1)//2) |
p03075 | s191379416 | Accepted | L = [int(input()) for i in range(5)]
k = int(input())
if L[4]-L[0] > k:
print(":(")
else:
print("Yay!")
|
p03037 | s849336630 | Accepted | #!/usr/bin/env python3
def main():
N, M = map(int, input().split())
L =[0 for i in range(M)]
R = [0 for i in range(M)]
for i in range(0, M):
L[i], R[i] = map(int, input().split())
print(max(min(R) - max(L) + 1, 0))
main() |
p02797 | s957091967 | Wrong Answer | n,k,s = map(int, input().split())
res = [s]*k
if s > 10:
for i in range(n - k):
res.append(0)
print(*res)
else:
for i in range(n - k):
res.append(100)
print(*res) |
p02729 | s235401088 | Wrong Answer | n,m=map(int,input().split())
print((n//2)+(m//2)) |
p02989 | s232804950 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
print(a[n//2]-a[n//2-1]) |
p03457 | s900601174 | Accepted | N=int(input())
x=0
y=0
t=0
for i in range(N):
tt,xx,yy=map(int,input().split())
if abs(xx-x)+abs(yy-y)<=tt-t:
if (abs(xx-x)+abs(yy-y))%2!=(tt-t)%2:
print("No")
exit()
else:
print("No")
exit()
t,x,y=tt,xx,yy
print("Yes") |
p03711 | s880255965 | Accepted | x, y = map(int, input().split())
list2 = [4, 6, 9, 11]
if x == 2 or y == 2:
print('No')
else:
if x in list2 and y in list2:
print('Yes')
else:
if x not in list2 and y not in list2:
print('Yes')
else:
print('No') |
p03038 | s023371850 | Accepted | n,m = map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for _ in range(m)]
bc.sort(key=lambda x:x[1], reverse=True)
for b,c in bc:
a.extend([c]*b)
if len(a) > n*2:
break
a.sort(reverse=True)
print(sum(a[:n])) |
p03645 | s266112923 | Accepted | n,m=map(int,input().split())
edge=[[] for _ in range(n)]
for i in range(m):
x,y=map(int,input().split())
edge[x-1].append(y-1)
edge[y-1].append(x-1)
for i in edge[0]:
if n-1 in edge[i]:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
p03545 | s210759204 | Wrong Answer | s = input()
def dfs( i, sums, s1 ):
if i == 3:
if sums == 7:
print(s1)
return s1
else:
dfs( i + 1, sums + int( s[i+1] ), "{}+{}".format( s1, s[ i + 1 ] ))
dfs( i + 1, sums - int( s[i+1] ), "{} -{}".format( s1, s[ i + 1 ] ))
dfs(0, int( s[0]), s[0])
|
p03699 | s342460355 | Accepted | n = int(input())
s = [int(input()) for _ in range(n)]
score = sum(s)
ans = float('inf')
if score % 10 == 0:
for i in s:
if i%10 != 0:
ans = min(ans, i)
if ans == float('inf'):
ans = 0
score = 0
score -= ans
print(score)
|
p02695 | s196066685 | Wrong Answer | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, M, Q = mapint()
abcd = [list(mapint()) for _ in range(Q)]
from itertools import combinations_with_replacement
lis = range(1, 11)
ans = 0
for l in combinations_with_replacement(li... |
p02624 | s407718825 | Wrong Answer | import math
N=int(input())
ans=0
for i in range(1,N):
Y=math.ceil(N/i)
ans+=(Y*(Y+1)*i)//2
print(ans)
|
p03555 | s194594258 | Accepted | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
x = input()
y = input()
if x == y[::-1]:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
|
p02689 | s181965203 | Accepted | N, M = map(int, input().split())
H = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
g[a-1].append(b-1); g[b-1].append(a-1)
ans = 0
for i in range(N):
neighbors = g[i]
h = H[i]
res = True
for node in neighbors:
res *= h > H[node]
ans += r... |
p02882 | s907179145 | Accepted | # import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
import math
# mod = 10**9 + 7
#
# n = int(input())
# a = list(map(int, input().split()))
a,b,x = map(f... |
p03103 | s820257241 | Accepted | n,m = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
x = sorted(x)
cost = 0
for i in range(n):
cost += x[i][0] * min(m, x[i][1])
m -= x[i][1]
if m < 1: break
print(cost) |
p02917 | s701294550 | Wrong Answer | n=int(input())
l=[int(x) for x in input().split()]
sum=0
n=len(l)
for i in range(0,n):
if(i==0):
sum=sum+(l[i]*2)
elif(i==n-1):
sum=sum+l[i]
else:
if(l[i]<=l[i+1]):
sum=sum+l[i]
else:
sum=sum+l[i+1]
print(sum) |
p04029 | s645328513 | Accepted | input_num = int(input())
# 取得した Nから必要なキャンディーの個数を算出し出力する
i = 1
result = 0;
while i <= input_num:
result = result + i
i = i + 1
print(result) |
p03339 | s699574266 | Accepted | n = int(input())
s = input()
e_count = [0]*(n+1)
w_count = [0]*(n+1)
for i in range(n):
if s[i] == "E":
e_count[i+1] = e_count[i] + 1
w_count[i+1] = w_count[i]
else:
w_count[i+1] = w_count[i] + 1
e_count[i+1] = e_count[i]
#print(w_count)
#print(e_count)
ans = n+1
for i in range(1... |
p03434 | s493229503 | Accepted | n = int(input())
ais = input().split()
ais_int = [int(a) for a in ais]
ais_sort = ais_int.sort()
alice = 0
bob = 0
if n % 2 == 0:
for i in range(n):
if i % 2 == 1:
alice += int(ais_int[i])
else:
bob += int(ais_int[i])
else:
for j in range(n):
if j % 2 == 0:
alice += int(ais_int[j])
... |
p02801 | s589711320 | Accepted | print(chr(ord(input())+1)) |
p02948 | s294087948 | Wrong Answer | from collections import deque
n,m = map(int,input().split())
hq = []
for _ in range(n):
a,b = map(int,input().split())
hq.append((-b,a))
hq.sort(key = lambda x:(x[0],-x[1]))
q = deque(hq)
day = 0
cnt = 0
while day <=m and q:
b,a = q.popleft()
b = -b
if a+day<=m:
cnt += b
day += 1
pri... |
p02714 | s653220583 | Wrong Answer | N = int(input())
S = list(input())
r , g, b = S.count("R"), S.count("G"), S.count("B")
ans = r * g * b
for i in range(N-2):
for j in range(i+1, N-1):
k = 2*(j+1) - (i+1)
if k >= N: break
if S[i] != S[j] and S[j] != S[k-1] and S[k-1] != S[i]:
ans -= 1
print(ans) |
p03221 | s367496375 | Accepted | import bisect
from collections import defaultdict
n, m = map(int, input().split())
dic = defaultdict(lambda : [])
cities = []
for _ in range(m):
p, y = map(int, input().split())
cities.append((p, y))
dic[p].append(y)
for key, vals in dic.items():
dic[key] = sorted(vals)
for p, y in cities:
pos = bis... |
p02553 | s671533643 | Wrong Answer | a, b, c, d = map(int, input().split())
ab = a
cd = c
ab_flag = 0
cd_flag = 0
if abs(a) < abs(b):
ab = b
ab_flag = 1
if abs(c) < abs(d):
cd = d
cd_flag = 1
ans = ab * cd
if ans < 0:
if a > 0:
ans = a * d
elif c > 0:
ans = b * c
print(str(ans)) |
p02952 | s129702922 | Wrong Answer | N = int(input()) #文字列にするとlen()関数が使用可能
ans = 0
for i in range(1, N+1):
if len(str(N))%2 == 1:
ans += 1
print(ans) |
p02683 | s989482472 | Accepted | N, M, X = map(int, input().split())
INF = 30
ans = 1 << INF
data = []
for i in range(N):
c = list(map(int, input().split()))
data.append(c)
for i in range(1, 2**N):
tmp = 0
skill = [0] * M
for j in range(N):
if i >> j & 1:
tmp += data[j][0]
for k in range(M):
... |
p03659 | s011043531 | Accepted | N = int(input())
a = list(map(int,input().split()))
ans = 2*10**9
allsum = sum(a)
snukesum = 0
for n in range(1,N):
snukesum += a[n-1]
ans_candidate = abs(2*snukesum- allsum)
if ans > ans_candidate:
ans = ans_candidate
print(ans)
|
p03035 | s502285078 | Wrong Answer | a,b=map(int,input().split())
if a>=13:
print(b)
elif 6<=a<=12:
print(b/2)
else:
print(0) |
p02705 | s037575479 | Accepted | import math
R = int(input())
Ans = 2 * R * math.pi
print(Ans) |
p03680 | s138178936 | Accepted | n=int(input())
a=[]
for i in range(n):
a.append(int(input()))
i=0
count=1
frag=-1
for j in range(n):
if a[i]==2:
frag=count
break
else:
i=a[i]-1
count+=1
print(frag) |
p03211 | s786367687 | Accepted | S = input()
ans = 9999
for i in range(len(S) - 2):
v = int(S[i:i + 3])
ans = min(ans, abs(753 - v))
print(ans) |
p03371 | s948975707 | Wrong Answer | a,b,c,x,y=map(int,input().split())
ans=0
if a+b<=c*2:
print(a*x+b*y)
exit()
elif x>=y:
ans+=c*y*2
x-=y
if a>=c*2:
ans+=c*2*x
else:
ans+=a*x
elif y>x:
ans+=c*x*2
y-=x
if b>=c*2:
ans+=c*2*y
else:
ans+=b*x
print(ans)
|
p02688 | s371233021 | Wrong Answer | # 166 B
n, k = map(int, input().split())
l = []
for i in range(k):
d = int(input())
a = list(map(int, input().split()))
l.append(a)
print(n - (len(set(a)))) |
p02861 | s974030159 | Accepted | import math
n = int(input())
coo = [list(map(int,input().split())) for i in range(n)]
sum = 0
for i in range(n):
for j in range(i,n):
sum += math.sqrt((coo[i][0]-coo[j][0])**2 + (coo[i][1]-coo[j][1])**2)
ans = 2 * sum / float(n)
print(ans) |
p03345 | s124831876 | Accepted | A, B, C, K = map(int, input().split())
if K % 2 == 0:
if abs(A-B) > 10**18:
print("Unfair")
else:
print(A-B)
else:
if abs(B-A) > 10**18:
print("Unfair")
else:
print(B-A) |
p02743 | s079246271 | Accepted | #C
a,b,c = map(int,input().split())
if (c-a-b)**2 > 4*a*b and (c-a-b) > 0:
print("Yes")
else:
print("No")
|
p02910 | s243913084 | Wrong Answer | s = input()
for i in range(len(s)):
if i % 2 == 1:
if s[i] not in ['R','U','D']:
print('No')
exit()
else:
if s[i] not in ['L','U','D']:
print('No')
exit()
print('Yes') |
p02683 | s194300011 | Accepted | import itertools
n,m,x = (int(i) for i in input().split())
A = []
for i in range(n):
A.append([int(i) for i in input().split()])
ans = float('inf')
for p in itertools.product(range(2), repeat=n):
knowledges = [0 for _ in range(m)]
tmp = 0
for i,a in zip(p,A):
if i == 0: continue
tmp ... |
p02983 | s794048465 | Wrong Answer | L, R = map(int, input().split())
if R - L >= 2018:
print(0)
exit()
lst = []
for i in range(L,R+1):
lst.append(i%2019)
lst.sort()
print(lst[0]*lst[1]%2019) |
p02924 | s761247980 | Accepted | N = int(input())
print(N*(N-1)//2)
|
p02756 | s855450179 | Wrong Answer | from collections import deque
S=deque([input()])
q=int(input())
rev=False
for i in range(q):
s=input()
if s=="1":
rev= not rev
else:
t,f,c=s.split()
if (rev==False and f=="1") or (rev==True and f=="2"):
S.appendleft(c)
else:
S.append(c)
if rev==False:
print("".join(... |
p02811 | s801253909 | Accepted | x, k = map(int, input().split())
if x*500 >= k:
print('Yes')
else:
print('No') |
p03360 | s260183111 | Wrong Answer | a = [int(i) for i in input().split()]
K=int(input())
ans = 0
for i in range(K):
a[-1] = a[-1]**2
print(sum(a)) |
p02772 | s845639679 | Accepted | #!/usr/bin/env python3
def main():
# Failed to predict input format
n = int(input())
a = list(map(int, input().split()))
if all([i%3 == 0 or i%5 == 0 for i in a if i%2 == 0]):
print('APPROVED')
else:
print('DENIED')
if __name__ == '__main__':
main()
|
p02730 | s098070440 | Wrong Answer | s=input();print('YNeos'[s[:2]!=s[-2:]::2]) |
p03220 | s708228259 | Wrong Answer | n = int(input())
T,A = map(int,input().split())
h = list(map(int,input().split()))
#print(h)
l =[]
for i in range(n):
a = T - h[i]*0.006
# print(a)
b = int(abs(a-A))
l.append(b)
#print(l)
c = h.index(h[l.index(min(l))])
print(c+1) |
p03665 | s510391123 | Wrong Answer | N,P=map(int,input().split())
A=list(map(int,input().split()))
for i in range(N):
A[i]%=2
odds=sum(A)
evens=N-odds
if odds>0:
ans=2**evens
ans+=2**(odds-1)
print(ans)
else:
if P==0:
print(2**evens)
else:
print(0) |
p03161 | s988026341 | Wrong Answer | import numpy as np
N,K=map(int,input().split())
listH=list(map(int,input().split()))
cost=np.array([10**5]*N)
cost[0]=0
for i in range(1,N):
for k in range(1,min(i+1,K+1)):
cost[i]=min(abs(listH[i-k]-listH[i])+ cost[i-k],cost[i])
ans=cost[-1]
print(ans) |
p03625 | s158975538 | Accepted | from collections import Counter
input()
angles = sorted(((key, value) for key, value in Counter(map(int, input().split())).items() if value > 1), key=lambda t: t[0])
try:
square = angles[-1][0] ** 2 if angles[-1][1] > 3 else angles[-1][0] * angles[-2][0]
except:
square = 0
print(square) |
p03695 | s109059967 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
L = set()
cnt = 0
for a in A:
c = a//400
if c >= 8:
cnt += 1
else:
L.add(a//400)
print(len(L),len(L)+cnt)
|
p02916 | s782646856 | Accepted | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
print(sum(B)+sum(C[A[i]-1] for i in range(N-1) if A[i]==(A[i+1]-1)))
|
p03627 | s514569767 | Wrong Answer | import sys
import collections
n = int(input())
a = collections.Counter(list(map(int, sys.stdin.readline().split())))
q = [0, 0]
for i in a:
if a[i] >= 4:
q = [i, i]
elif a[i] >= 2:
q[0] = i
q.sort()
print(q[-1]*q[-2]) |
p04029 | s708276352 | Wrong Answer | def factorial(n):
if n == 1:
return 1
else:
return n * factorial(n-1)
a = int(input())
print(factorial(a)) |
p03126 | s738887255 | Accepted | n,m=map(int,input().split())
ans=list(map(int,input().split()))
ans=set(ans[1:])
for i in range(n-1):
t=list(map(int,input().split()))
t=set(t[1:])
ans=ans&t
print(len(ans)) |
p02819 | s310924180 | Wrong Answer | def primelist(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in range(n + 1) if is_prime[i]]
x = i... |
p03544 | s590659638 | Accepted | n = int(input())
l0 = 2
l1 = 1
cnt = 2
l2 = l0 + l1
while cnt < n:
l2, l1, l0 = l2 + l1, l2, l1
cnt += 1
if n == 1:
print(1)
else:
print(l2) |
p03835 | s238111040 | Accepted | k,s = map(int, input().split())
ans = 0
for right in range(max(s-k, 0), min(s+1, 2*k+1)):
lower = max(0, right-k)
upper = min(k, right)
if right % 2 != 0:
ans += upper - lower + 1
else:
ans += upper - lower + 1
print(ans) |
p02677 | s275651342 | Wrong Answer | import math
def colon(a, b, h, m):
hour = 0.5 * (h * 60 + m)
minute = 6 * m
angle = abs(hour - minute)
angle = min(360 - angle, angle)
rad = angle*0.0174533
#print(angle, rad)
ans = math.sqrt(a**2+b**2-(2*a*b*(math.cos(rad))))
return ans
a, b, h, m = map(int, input().split())
print(colon(a,b,h, m))... |
p02987 | s397700309 | Accepted | print("Yes" if len(set(input())) == 2 else "No") |
p03285 | s080049110 | Wrong Answer | a = int(input())
b = a % 28
c = b % 7
d = b % 4
if c % 4 ==0:
print('Yes')
exit()
elif d % 7 ==0:
print('Yes')
exit()
print('No') |
p02601 | s168650668 | Wrong Answer | A,B,C=map(int,input().split())
K=int(input())
i=0
while B<A:
for i in range(K):
B*=2
while C<B:
for j in range(K-i):
C*=2
if A<B and B<C:
print("Yes")
else:
print("No")
|
p02983 | s867120503 | Wrong Answer | l , r = map(int,input().split())
lt = l % 2019
rt = r % 2019
if rt - lt <= 0:
print(0)
else:
print(min(lt*(lt+1),(2019-rt)*(2020-rt))) |
p03862 | s279223311 | Wrong Answer |
n,x=map(int,input().split())
a=list(map(int,input().split()))
asum=sum(a)
for i in range(n-1):
if a[i]+a[i+1]>x:
a[i+1]=x-a[i]
asum=asum-sum(a)
print(asum)
|
p03408 | s556088536 | Accepted | import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.std... |
p02888 | s739542417 | Wrong Answer | n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
for a in range(n):
for b in range(a + 1, n):
if l[a] == l[b]:
continue
for c in range(b + 1, n):
if l[b] == l[c]:
continue
if l[a] < l[b] + l[c]:
ans ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.