problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02647
|
s410386033
|
Wrong Answer
|
# coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, K = lr()
A = lr()
# ある回数から先は全ての電球にNを足す
for _ in range(min(K, 10)):
next = [0] * N
for i in range(N):
x = A[i]
for j in range(max(0, i-x), min(N-1, i+x)+1):
next[j] += 1
A = next
print(*A)
|
p02772
|
s999977244
|
Accepted
|
n = int(input())
a = list(map(int,input().strip().split()))[:n]
flag = True
for i in range(0,n):
if a[i]% 2 == 0:
if a[i]% 3 != 0 and a[i]% 5 != 0:
flag = False
if flag==True:
print("APPROVED")
else :
print("DENIED")
|
p02576
|
s317787991
|
Accepted
|
input_list = input().rstrip().split(' ')
n = int(input_list[0])
x = int(input_list[1])
t = int(input_list[2])
times = int(n / x)
if n % x != 0:
times += 1
print(times * t)
|
p02917
|
s242303967
|
Accepted
|
n = int(input())
b = list(map(int,input().split()))
a = b[0]
for i in range(1,n-1):
a += min(b[i],b[i-1])
print(a+b[-1])
|
p03910
|
s625046310
|
Accepted
|
import math
n=int(input())
k=(2*n+0.25)**0.5-0.5
k=math.ceil(k)
no=k*(k+1)/2-n
for i in range(1,k+1):
if i==no:
continue
print(i)
|
p03456
|
s564675753
|
Accepted
|
def resolve():
s = input().split()
st = s[0]+s[1]
sqN = int(st) ** 0.5
if sqN == int(sqN):
print("Yes")
else:
print("No")
resolve()
|
p02952
|
s989488857
|
Wrong Answer
|
n=int(input())
count=0
b=n
while b:
b//=10
if b:
count+=1
if count==0:
print(n)
elif count==1:
print(9)
elif count==2:
print(n-100+1+9)
elif count==3:
print(900+9)
elif count==4:
print(n-1000+1+909)
elif count==5:
print(90909)
|
p03723
|
s172400523
|
Accepted
|
cnt=0
a,s,d=map(int,input().split())
if a==s==d:
if a%2==0:print(-1)
else:print(0)
exit()
while a%2==s%2==d%2==0:
a,s,d=(s+d)//2,(a+d)//2,(a+s)//2
cnt+=1
print(cnt)
|
p03836
|
s503722465
|
Wrong Answer
|
sx, sy, tx, ty = map(int, input().split())
right_shift = tx - sx
for i in range(right_shift):
print('R', end='')
up_shift = ty - sx
for i in range(up_shift):
print('U', end='')
for i in range(right_shift):
print('L', end='')
for i in range(up_shift + 1):
print('D', end='')
for i in range(right_shift + 1):
print('R', end='')
for i in range(up_shift + 1):
print('U', end='')
for i in range(right_shift + 1):
print('L', end='')
for i in range(up_shift + 1):
print('D', end='')
print('R')
|
p02660
|
s110076049
|
Accepted
|
N=int(input())
ans=0
for i in range(2,10**6+1):
anssub=0
t=0
while N%i==0:
N=N//i
anssub+=1
while t*(t+1)//2<=anssub:
t+=1
ans+=t-1
if N!=1:
ans+=1
print(ans)
|
p02946
|
s855386680
|
Accepted
|
K, X = map(int,input().split())
num = [X]
for i in range(1, K):
num.append(X + i)
num.append(X - i)
num.sort()
print(" ".join(map(str, num)))
|
p03645
|
s283413518
|
Accepted
|
n,m = map(int,input().split())
lis = [[] for i in range(n)] #なぜか知らんけど[[]]*nじゃだめらしい
for i in range(m):
a,b = map(int,input().split())
lis[a-1].append(b-1)
lis[b-1].append(a-1)
if set(lis[-1]).isdisjoint(set(lis[0])):
print('IMPOSSIBLE')
else:
print('POSSIBLE')
|
p02916
|
s811343713
|
Accepted
|
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
X = 0
for i in range(N-1):
if A[i+1] -A[i] == 1:
X += C[A[i]-1]
print(sum(B)+X)
|
p02747
|
s843388458
|
Wrong Answer
|
S=str(input())
if "hi" in S:
print("Yes")
else:print("No")
|
p02731
|
s948097096
|
Accepted
|
L=int(input())
print(L**3/27)
|
p03379
|
s957935068
|
Wrong Answer
|
N = int(input())
X = list(map(str,input().split()))
for x in X:
X_ = sorted(X)
X_.remove(x)
print(X_[(N+1)//2-1])
|
p03289
|
s944772362
|
Wrong Answer
|
s = list(input())
if s[0] == "A" and s[2:-1].count("C") == 1 and s.count("A")==1:
s.remove("A")
s.remove("C")
if "".join(s).lower() == "".join(s):
print("AC")
else:
print("WA")
|
p02687
|
s078695632
|
Wrong Answer
|
import sys
input = sys.stdin.readline
strA = str(input())
if strA == 'ABC':
print('ARC')
elif strA == 'ARC':
print('ABC')
else:
print('')
|
p02602
|
s325496206
|
Accepted
|
#c
n,k=map(int, input().split())
a = list(map(int, input().split()))
for i in range(n-k):
if a[i] < a[i + k]:
print("Yes")
else:
print("No")
|
p02713
|
s255782361
|
Wrong Answer
|
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
N = int(input())
n = 0
for i in range(N):
for j in range(N):
for k in range(N):
n += gcd(i,j,k)
print(n)
|
p03241
|
s545288526
|
Accepted
|
n, m = map(int, input().split())
cnt = 1
for i in range(1, int(m ** 0.5) + 1):
if m % i == 0:
b = m // i
if i * n <= m:
cnt = max(cnt, i)
if b * n <= m:
cnt = max(cnt, b)
print(cnt)
|
p02882
|
s433485404
|
Accepted
|
import math
a, b, x = map(int, input().split(' '))
base = a * a * b /2
if int(base) == x:
print(math.degrees(math.atan(b/a)))
elif base > x:
ah = 2 * x / (a * b)
print(math.degrees(math.atan(b/ah)))
else:
bh = 2 * x / a ** 2 - b
c = b - bh
print(math.degrees(math.atan(c/a)))
|
p04044
|
s955348651
|
Accepted
|
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print("".join(s))
|
p02548
|
s249106908
|
Accepted
|
N = int(input())
ans = 0
for a in range(1, N):
ans += (N - 1) // a
print(ans)
|
p04034
|
s539654725
|
Accepted
|
n,m = map(int,input().split())
x_li = [0]*m
y_li = [0]*m
for i in range(m):
x_li[i],y_li[i]=map(int,input().split())
map_li = [1]*n
red = [False]*n
red[0]=True
for i in range(m):
x,y = x_li[i],y_li[i]
x,y = x-1,y-1
if red[x]:
red[y]=True
map_li[x]-=1
map_li[y]+=1
if map_li[x]==0:
red[x]=False
#print(map_li)
print(sum(red))
|
p02624
|
s897144931
|
Accepted
|
n= int(input())
ans = 0
for i in range(1, n + 1):
x = n // i
ans += x * (x + 1) * i // 2
print(ans)
|
p03721
|
s278346546
|
Wrong Answer
|
N, K = map(int, input().split())
ans = 0
while K > 0:
a, b = map(int, input().split())
K -= b
ans = a
print(a)
|
p02909
|
s321829105
|
Wrong Answer
|
w=["Sunny","Cloudy","Rainy","Sunny"]
a=input()
l=0
for i in w:
if a==i:
print(w[l+1])
else:
l+=1
|
p03449
|
s339610615
|
Accepted
|
N = int(input())
lst = [list(map(int, input().split())) for _ in range(2)]
res = 0
for i in range(N):
num = sum(lst[0][0:i+1]) + sum(lst[1][i:N])
if res < num:
res = num
print(res)
|
p03543
|
s453858376
|
Accepted
|
a,b,c,d = input()
print("Yes" if a==b==c or b==c==d else "No")
|
p03456
|
s287222621
|
Accepted
|
A,B = map (int, input ().split ())
if B < 10:
X = A*10+B
elif B < 100:
X = A*100+B
else:
X = A*1000+B
o = 1
p = 'No'
while o**2 <= X:
if o**2 == X:
p = 'Yes'
break
o += 1
print (p)
|
p03281
|
s997473933
|
Wrong Answer
|
N = int(input())
divisor_cnt = 0
num = 0
# Nは奇数と言う制約があるため、約数は奇数×奇数の組み合わせ
for i in range(1, N+1, 2):
for j in range(1, N+1, 2):
if i * j == N:
divisor_cnt += 1
if divisor_cnt % 8 == 0:
num += divisor_cnt // 8
print(num)
|
p02570
|
s322326491
|
Accepted
|
d, t, s = map(int, input().split())
print("Yes" if t*s >= d else "No")
|
p03438
|
s787554787
|
Wrong Answer
|
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
k=sum(b)-sum(a)
p=0
for i in range(n):
if a[i]>=b[i]:
p+=a[i]-b[i]
else:
p+=-(b[i]-a[i])//2*-1
print('Yes' if k>=p else 'No')
print(k)
|
p03862
|
s839672033
|
Wrong Answer
|
import sys
stdin = sys.stdin
from itertools import product
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n, x = na()
a = na()
b = list()
if n == 2:
print(max(sum(a) - 2*x, 0))
quit()
else:
for ai, aj in zip(a[:n-1], a[1:]):
b.append(max(0, ai + aj - x))
ans = 0
bpre = b[0]
for bi in b[1:]:
ans += bpre
bpre = max(0, bi - bpre)
ans += bpre
print(ans)
|
p03379
|
s088854134
|
Wrong Answer
|
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
index = n//2
for i in range(n):
print(y[-index] if x[i]<x[index] else y[-index-1])
|
p03565
|
s382987765
|
Wrong Answer
|
s,y=(input() for i in range(2))
ans="{"*len(s);pa=ans
for i in range(len(s)-len(y)):
for j in range(len(y)):
if s[i+j]!='?' and s[i+j]!=y[j]:break
else:ans=min(ans,s[:i].replace("?","a")+y+s[i+len(y):].replace("?","a"))
if pa==ans:print("UNRESTORABLE")
else:print(ans)
|
p02618
|
s185733207
|
Accepted
|
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]
heru = [0 for _ in range(26)]
for i in range(d):
print(i%26 + 1)
|
p03086
|
s764649619
|
Accepted
|
S = input()
atgc = ["A", "T", "G", "C"]
anset = set()
L = 0
for i in range(len(S)):
if S[i] in atgc:
L += 1
else:
anset.add(L)
L = 0
if i == len(S)-1:
anset.add(L)
print(max(anset))
|
p03145
|
s782785112
|
Accepted
|
a,b,_=[int(i) for i in input().split()]
print(a*b//2)
|
p03545
|
s525326167
|
Accepted
|
s = input()
n_op = len(s) - 1
for i in range(2**n_op):
op = ['-'] * n_op
for j in range(n_op):
if i>>j & 1:
op[n_op - 1 - j] = '+'
formula = ''
for p_s, p_op in zip(s, op+['']):
formula += p_s + p_op
if eval(formula) == 7:
print(formula + '=7')
break
|
p03419
|
s631142194
|
Wrong Answer
|
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
if N > M: N, M = N, M
if N == 2: print(0)
elif N == 1: print(max(0, M - 2))
else: print(max(0, (N - 2) * (M - 2)))
|
p03327
|
s023595197
|
Wrong Answer
|
N = int(input())
if N < 1000:
s = "ABC"
else:
s = "ABD"
N -= 999
n = ""
if N < 10:
n = "00"
elif N < 100:
n = "0"
print(s + n + str(N))
|
p02866
|
s615120600
|
Accepted
|
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
MOD = 998244353
ans = 1
dep = Counter(D)
if dep[0] != 1 or D[0] != 0:
print(0)
exit(0)
if max(D) == 0:
pass
else:
for i in range(1, max(D) + 1):
if dep[i] == 0:
print(0)
exit(0)
else:
ans *= dep[i-1] ** dep[i]
ans %= MOD
print(ans)
|
p02615
|
s993868228
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = a[0]
for i in range(2, n):
ans += a[i // 2]
#print(ans)
print(ans)
|
p03419
|
s196672896
|
Wrong Answer
|
N, M = map(int, input().split())
ans = 0
if N == 1 and M == 1:
ans = 1
elif N == 1 and M > 1:
ans = M - 2
else:
ans = (N - 2) * (M - 2)
print(ans)
|
p03252
|
s579085591
|
Accepted
|
import collections
S = list(input())
T = list(input())
counterS = collections.Counter(S)
counterT = collections.Counter(T)
Scou = list(counterS.values())
Tcou = list(counterT.values())
Scou.sort()
Tcou.sort()
if Scou == Tcou:
print('Yes')
else:
print('No')
|
p02596
|
s592144508
|
Accepted
|
K = int(input())
n = 1
x = 7
if (K % 2 == 0)or(K % 5 == 0):
print( -1 )
exit( 0 )
#
while 1:
if x % K == 0:
print( n )
break
x = (x * 10 + 7) % K
n += 1
#
|
p03160
|
s355609881
|
Wrong Answer
|
N = int(input())
h = list(map(int, input().split()))
dp = [float('inf') for i in range(N)]
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp)
print(dp[N-1])
|
p02767
|
s555015590
|
Wrong Answer
|
import math
N = int(input())
X = list(map(int, input().split()))
P = int(math.ceil(sum(X) / N))
print(sum((x - P)**2 for x in X))
|
p02747
|
s131947939
|
Wrong Answer
|
s = input()
flg = 0
for i in range(len(s)):
if s[i] == 'h':
if s[i+1] =='i':
print('Yes')
flg = 1
break
else:
continue
if flg == 0:
print('No')
|
p03723
|
s298966641
|
Accepted
|
a,b,c = tuple(map(int,input().split()))
if len(set((a,b,c)))==1 and a%2==1:
print(0)
exit()
ans = 0
while True:
if len(set((a,b,c)))==1:
print(-1)
exit()
if a%2==0 and b%2==0 and c%2==0:
a,b,c = b//2+c//2,c//2+a//2,a//2+b//2
ans+=1
else:
break
print(ans)
|
p03623
|
s920877396
|
Accepted
|
x,a,b = map(int,input().split())
A = abs(x-a)
B = abs(x-b)
if A<=B:
print("A")
else:
print("B")
|
p02987
|
s687404408
|
Accepted
|
import sys
input = sys.stdin.readline
S = list(input())[: -1]
for i in range(4):
if S.count(S[i]) != 2:
print("No")
exit(0)
print("Yes")
|
p02747
|
s021074264
|
Accepted
|
s = input().split("hi")
f = 0
for i in s:
if i != "":
f = 1
break
if f == 0:
print("Yes")
else:
print("No")
|
p03478
|
s962201718
|
Wrong Answer
|
n, a, b = map(int, input().split())
ans = 0
for i in range(n + 1):
if a <= sum(list(map(int, list(str(i))))) >= b:
ans += i
print(ans)
|
p03693
|
s665933552
|
Accepted
|
a, b, c = input().split()
num = int(a+b+c)
if num % 4 == 0:
print('YES')
else:
print('NO')
|
p03821
|
s241916113
|
Accepted
|
n = int(input())
a = []
b = []
for _ in range(n):
A, B = map(int, input().split())
a.append(A)
b.append(B)
x = 0
for i in range(1, n+1):
a[-i] += x
if a[-i]%b[-i] != 0: x += b[-i] - a[-i]%b[-i]
print(x)
|
p02628
|
s570039796
|
Accepted
|
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort()
# print(P)
ans = sum(P[:K])
print(ans)
|
p03799
|
s754935600
|
Accepted
|
n,m=map(int,input().split())
temp=(n*2+m)//4
print(min(temp,m//2))
|
p03759
|
s627055881
|
Accepted
|
a,b,c=map(int,input().split())
if b-a==c-b:
print('YES')
else:
print('NO')
|
p03095
|
s721127585
|
Accepted
|
from collections import Counter
N = int(input())
S = input()
d = Counter(S)
m = 10 ** 9 + 7
# print(d)
ans = 1
for k, v in d.items():
ans = ans * (v + 1) % m
print((ans - 1) % m)
|
p02712
|
s252771942
|
Accepted
|
#!/usr/bin/env python3
import sys
def solve(N: int):
print(sum([i if (i%3 != 0 and i%5 != 0) else 0 for i in range(1,N+1)]))
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
N = int(next(tokens)) # type: int
solve(N)
if __name__ == '__main__':
main()
|
p03219
|
s885624726
|
Accepted
|
A, B = [int(i) for i in input().split()]
print(A+B//2)
|
p03835
|
s240451939
|
Accepted
|
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# from fractions import Fraction
mod = int(1e9+7)
INF = 1<<29
def main():
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
for j in range(k+1):
if s-i-j<=k and s-i-j>=0:
ans += 1
print(ans)
return
if __name__=='__main__':
main()
|
p02777
|
s881112449
|
Accepted
|
col=list(map(str,input().split()))
num=list(map(int,input().split()))
U=str(input())
if U == col[0]:
num[0] = num[0]-1
elif U == col[1]:
num[1] = num[1]-1
[print(num[i],end=" ") for i in range(2)]
|
p03524
|
s325228711
|
Wrong Answer
|
import collections
s = input()
cnt = collections.Counter(s)
cnt = cnt.most_common()
# print(cnt)
if len(s) == 1:
print('NO')
exit()
if len(cnt) == 2:
if len(s) == 2:
print('YES')
else:
print('NO')
exit()
if cnt[0][1] > cnt[-1][1] + 1:
print('NO')
else:
print('YES')
|
p02712
|
s770945208
|
Wrong Answer
|
n = int(input())
s = 0
for i in range(n):
if not (i % 3 == 0 or i % 5 == 0):
s += i
print(s)
|
p02600
|
s846352742
|
Wrong Answer
|
import math
import sys
import collections
import bisect
readline = sys.stdin.readline
def main():
x = int(readline().rstrip())
li = [400, 600, 800, 1000, 1200, 1400, 1600, 1800]
for i in range(8):
if li[i] > x:
print(9 - i)
break
if __name__ == '__main__':
main()
|
p02663
|
s163944061
|
Accepted
|
h, m, H, M, K = map(int, input().split())
print(H*60 +M - ( h*60 +m + K ))
|
p03720
|
s315450923
|
Accepted
|
N, M = map(int, input().split())
D = [0]*N
for _ in range(M):
a, b = map(int, input().split())
D[a-1] += 1
D[b-1] += 1
for d in D:
print(d)
|
p02775
|
s472156577
|
Accepted
|
s=input()[::-1]
l=len(s)
dp=[[0]*2 for _ in range(l+1)]
for i in range(l):
dp[i+1][0]=min(dp[i][0]+int(s[i]),dp[i][1]+int(s[i])+1)
if i!=0:
dp[i+1][1]=min(dp[i][0]+10-int(s[i]),dp[i][1]+10-(int(s[i])+1))
else:
dp[i+1][1]=dp[i][0]+10-int(s[i])
print(min(dp[l][0],dp[l][1]+1))
|
p03556
|
s197700057
|
Accepted
|
from math import sqrt
n=int(input())
nn=int(sqrt(n))
print(nn*nn)
|
p02972
|
s153268350
|
Accepted
|
n = int(input())
nums = list(map(int, input().split()))
ans = []
for _ in range(n):
ans.append(-1)
for i in range(1, n + 1)[::-1]:
C = i*2
BALL = nums[i-1]
while C <= n:
BALL = BALL ^ ans[C-1]
C += i
ans[i-1] = BALL
print(ans.count(1))
ans2 = []
for i in range(n):
if ans[i] == 1:
ans2.append(i+1)
L=[str(a) for a in ans2]
L=" ".join(L)
print(L)
|
p03437
|
s414598692
|
Accepted
|
x,y = map(int,input().split())
if x % y == 0:
print(-1)
else:
print(x)
|
p02814
|
s846808242
|
Wrong Answer
|
from fractions import gcd
from functools import reduce
N, M = map(int, input().split())
A = list(map(int, input().split()))
def lcm_(x, y):
return x * y // gcd(x, y)
a = reduce(lcm_, map(lambda x: x//2, A))
print(M//a - M//(2*a))
|
p02694
|
s986075878
|
Wrong Answer
|
import math
x = int(input())
money = 100
cnt = 0
while money < x:
money = int(money*1.01)
cnt += 1
print(cnt)
|
p02729
|
s930636726
|
Wrong Answer
|
n,m = list(map(int,input().split()))
output = n*(n-1)/2+m*(m-1)/2
print(output)
|
p03545
|
s278598003
|
Accepted
|
from itertools import product
s=input()
for op in product(["+","-"],repeat=3):
formula =""
for i in range(3):
formula+=s[i]+op[i]
formula+=s[-1]
if eval(formula)==7:
print(formula+"=7")
exit()
|
p03161
|
s715884442
|
Accepted
|
import sys
def input():
return sys.stdin.readline().strip()
def main():
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * (N + 1)
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,N):
dp[i] = min(dp[j] + abs(h[i]-h[j]) for j in range(max(0,i-K),i))
print(dp[N-1])
if __name__ == "__main__":
main()
|
p02641
|
s305469662
|
Wrong Answer
|
X, N = list(map(int, input().split()))
p = set(map(int, input().split()))
dist = 0
if N == 0:
print(X)
dist_max = -1
else:
dist_max = max(abs(max(p) - X), abs(min(p) - X))
while dist <= dist_max:
if (X - dist in p) and (X + dist in p):
dist += 1
continue
if not (X - dist in p):
print(X - dist)
break
elif not (X + dist in p):
print(X + dist)
break
|
p03699
|
s969943325
|
Wrong Answer
|
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
ans=0
while ans==0 and len(b)!=0:
if sum(b)%10==0:
del b[0]
else:
ans=sum(b)
print(ans)
|
p02923
|
s299580368
|
Accepted
|
N = int(input())
H = list(map(int, input().split()))
maxDown = 0
count = 0
for x in range(N-1):
if H[x] >= H[x + 1]:
count += 1
else:
count = 0
if maxDown < count:
maxDown = count
print(maxDown)
|
p02717
|
s561257517
|
Wrong Answer
|
def swapper(X,Y,Z):
X=int(X)
Y=int(Y)
Z=int(Z)
b=X
X=Z
Z=b
return X, Y, Z
|
p02552
|
s836535388
|
Accepted
|
x=int(input())
if x==0:
print(1)
elif x==1:
print(0)
|
p02987
|
s592262314
|
Accepted
|
S = list(input())
if ((S[0] == S[1] and S[2] == S[3] and S[1] != S[2]) or
(S[0] == S[2] and S[1] == S[3] and S[1] != S[2]) or
(S[0] == S[3] and S[1] == S[2] and S[0] != S[1])):
print("Yes")
else:
print("No")
|
p02677
|
s865001026
|
Accepted
|
import collections
from collections import defaultdict
import math
import numpy as np
import re
import itertools
import bisect
a,b,h,m=map(int, input().split())
l = 6*m
s = 0.5*m+30*h
kakudo = min(abs(l-s),360-abs(l-s))
print(math.sqrt(a*a+b*b-2*b*a*math.cos(math.radians(kakudo))))
|
p03695
|
s268019110
|
Accepted
|
import numpy as np
from collections import Counter
input()
rates = np.array(input().split(), dtype=np.int64) // 400
over3199 = (rates >= 8).sum()
colors = len(Counter(rates[rates < 8]).keys())
print(max(1, colors), colors + over3199)
|
p03126
|
s111813616
|
Wrong Answer
|
import numpy as np
n,m = map(int, input().split())
arr = np.zeros(m)
for i in range(n):
ka = np.array([int(i) for i in input().split()])
for j in range(ka[0]):
arr[ka[j+1]-1] = 1
ans = int(arr.sum())
print(ans)
|
p03433
|
s112368883
|
Accepted
|
n = int(input())
a = int(input())
if a >= n%500:
print('Yes')
else:
print('No')
|
p03835
|
s995943175
|
Wrong Answer
|
K,S = map(int,input().split())
cnt = 0
for i in range(K+1):
for j in range(K+1):
if S-(i+j) <= K:
cnt += 1
print(cnt)
|
p03705
|
s570237831
|
Accepted
|
n,a,b=map(int,input().split())
if (n==1 and a!=b) or a>b:
print(0)
exit()
print((b-a)*(n-2)+1)
|
p03285
|
s389865224
|
Accepted
|
import heapq
N = int(input())
h = [4, 7]
heapq.heapify(h)
while True:
n = heapq.heappop(h)
if n > N:
print('No')
break
if n == N:
print('Yes')
break
heapq.heappush(h, n + 4)
heapq.heappush(h, n + 7)
|
p03075
|
s409840978
|
Wrong Answer
|
a,b,c,d,e,k=[int(input())for _ in range(6)]
if e-a >= k:
print('Yay!')
else:
print(':(')
|
p03126
|
s067751033
|
Accepted
|
N, M = map(int, input().split())
S = set(i for i in range(1, M + 1))
for i in range(N):
K, *A = map(int, input().split())
S &= set(A)
print(len(S))
|
p03284
|
s997746401
|
Accepted
|
import math
import collections
import sys
#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
a,b=MI()
if a%b==0:
print(0)
else:
print(1)
|
p04033
|
s534933930
|
Wrong Answer
|
a,b = map(int,input().split())
if a<=0 and 0<=b:
print('Zero')
elif 0<a and 0<b:
print('Posiive')
else:
ans = b-1+1
if ans%2==0:
print('Positive')
else:
print('Negative')
|
p02819
|
s320663939
|
Wrong Answer
|
x = int(input())
#def prime number discriminator
def prime_or_not(a):
b = 0
for i in range(a):
if a % (i + 1)== 0:
b += 1
else:
pass
if b >= 1:
return 1
else:
return 0
ans = 0
while ans <1:
ans += prime_or_not(x)
x += 1
print(x - 1)
|
p02924
|
s796526301
|
Accepted
|
n = int(input())
ans = n*(n-1)//2
print(ans)
|
p02582
|
s145722022
|
Wrong Answer
|
S = input()
if S[0] == 'R':
if S[1] == 'R':
if S[2] == 'R':
print("3")
else:
print("2")
else:
print("1")
else:
print("0")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.