problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03264 | s576712161 | Accepted | import math
k=int(input())
print(math.ceil(k/2)*(k//2)) |
p02682 | s802515845 | Wrong Answer | A, B, C, K = map(int, input().split())
sum = 0
if K >= A:
sum = sum + A
K = K - A
else:
sum = sum + K
K = 0
if K >= B and K >= 1:
K = K - B
else:
K = 0
if K >= 1:
sum = sum - K
K = K - C
if sum >= 1:
print(sum)
else:
print(0)
|
p03069 | s966075079 | Accepted | N=int(input())
S=input()
leftblack=0
rightwhite=0
for i in range(0,N):
if S[i]==".":
rightwhite+=1
ans=leftblack+rightwhite
for i in range(0,N):
if S[i]=='.':
rightwhite-=1
else:
leftblack+=1
test=leftblack+rightwhite
if ans>test:
ans=test
print(ans)
|
p03565 | s962746957 | Accepted | s=list(list(input())[::-1])
t=list(list(input())[::-1])
s_len=len(s)
t_len=len(t)
for i in range(s_len-t_len+1):
for j in range(t_len):
if s[i+j]!="?" and t[j]!=s[i+j]:
break
else:
s[i:i+t_len]=t
for k in range(s_len):
if s[k]=="?":
s[k]="a"
print("".join(s[::-1]))
exit()
print("UNRESTORABLE") |
p02789 | s469220255 | Accepted | n,m = map(int, input().split())
if n == m:
print("Yes")
else:
print("No") |
p04012 | s149045977 | Wrong Answer | w = input()
w_set = set(w)
if len(w) / 2 == len(set(w)):
print("Yes")
else:
print("No") |
p02645 | s460565449 | Accepted | import random
def Nickname():
Name = str(input()) #入力回数を決める
num = random.randint(0, len(Name) - 3)
print(Name[num:num+3])
if __name__ == '__main__':
Nickname() |
p02641 | s012464273 | Accepted | import sys
x,N=list(map(int, input().split()))
if N==0:
print(x)
sys.exit()
p=list(map(int, input().split()))
z=float("inf")
ans_temp=[0,0]
ans=[0,0]
y=[i for i in range(-1,102) if i not in p]
for i in y:
if z>abs(x-i):
ans[0]=abs(x-i)
ans[1]=i
elif z==abs(x-i):
ans_temp[0]=abs(x-i)
ans_temp[1]=i
if ans_temp[1]<ans[1]:
ans[1]=ans_temp[1]
z=abs(x-i)
print(ans[1]) |
p03910 | s961974474 | Accepted | N = int(input())
left = 0
right = 10000
while right - left > 1:
mid = (left + right) // 2
if mid * (mid + 1) // 2 < N:
left = mid
else:
right = mid
ans = {i for i in range(1, right + 1)}
ans -= {right * (right - 1) // 2 - N + right}
print('\n'.join(map(str, ans)))
|
p02971 | s039447663 | Wrong Answer | n = int(input())
a = [0]*n
for i in range(n):
a[i] = int(input())
x = sorted(a, reverse = True)
max = x[0]
count = x.count(max)
for i in range(n):
if a[i] == max:
print(max)
else:
print(x[1])
|
p02842 | s953206106 | Wrong Answer | n = int(input())
for i in range(1, n):
if round(i * 1.08) == n:
print(i)
exit()
print(':(') |
p02622 | s899483391 | Wrong Answer | a = list(map(str,input().split()))
b = list(map(str,input().split()))
count = 0
for i in range(0,len(a)) :
if a[i] != b[i] :
count = count + 1
print(count) |
p02629 | s506447199 | Accepted | N = int(input())
lis = [0,26]
num = 26
n = 1
while lis[-1]<N:
num *= 26
lis.append(lis[-1]+num)
n += 1
c = N-lis[-2]-1
ans = ''
for i in range(n):
ans = chr(c%26+ord('a')) + ans
c //= 26
print(ans) |
p03862 | s870824655 | Accepted | n, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = max(0, a[0] - x)
a[0] -= cnt
for i in range(1, n):
cnt_now = max(0, a[i-1] + a[i] - x)
a[i] -= cnt_now
cnt += cnt_now
print(cnt)
|
p02723 | s191490987 | Accepted | s=input()
if s[2]==s[3] and s[4]==s[5]:
print("Yes")
else:
print("No") |
p03455 | s319898686 | Wrong Answer | a,b = map(lambda x:int(x) % 2, raw_input().split())
print 'Odd' if a == b else 'Even'
|
p02696 | s094138659 | Accepted | a,b,n=map(int,input().split())
if n>=b-1:
print(a*(b-1)//b)
else:
print(a*n//b) |
p03679 | s511059608 | Wrong Answer | x, a, b = map(int, input().split())
if a>b:
print("delicious")
else:
if b-a<x:
print("safe")
else:
print("dangerous")
|
p02690 | s694831792 | Accepted | X=int(input())
a=False
for i in range(10**3):
if a==False:
for j in range(-10**3,10**3):
if i**5-j**5==X:
print(i,j)
a=True
break |
p03323 | s398503333 | Accepted | A, B = map(int, input().split())
if A <= 8 and B <= 8:
print('Yay!')
else:
print(':(') |
p03087 | s365091305 | Accepted | n,q = map(int,input().split())
s = input()
t_list = [0]*n
for i in range(len(s)-1):
if (s[i] == 'A') and (s[i+1] == 'C'):
t_list[i+1] = 1+t_list[i]
else:
t_list[i+1] = t_list[i]
for i in range(q):
l,r = map(int,input().split())
print(t_list[r-1] - t_list[l-1]) |
p02601 | s734371361 | Accepted | a, b, c = map(int, input().split())
k = int(input())
cnt = 0
while b <= a:
cnt += 1
b *= 2
while c <= b:
cnt += 1
c *= 2
print("Yes" if cnt <= k else "No")
|
p03711 | s786290690 | Accepted | s1 =set([1,3,5,7,8,10,12])
s2 =set([4,6,9,11])
s3 =set([2])
a,b =map(int,input().split())
for i in [s1,s2,s3]:
if a in i and b in i:
print("Yes")
break
else:
print("No") |
p02959 | s413124425 | Accepted | N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
ans=0
for i in range(N):
if A[i]>=B[i]:
ans+=B[i]
A[i]-=B[i]
else:
temp=B[i]-A[i]
ans+=A[i]
if A[i+1]>=temp:
ans+=temp
A[i+1]-=temp
else:
ans+=A[i+1]
A[i+1]=0
print(ans) |
p02881 | s956621989 | Wrong Answer | import math
N = int(input())
a = pow(10,12)
is_not_prime = False
for k in range(2, int(math.sqrt(N)) + 1):
if N % k == 0:
is_not_prime = True
break
if is_not_prime:
for i in range(1, int(math.sqrt(N)) + 1):
print(i)
j = N/i
if j.is_integer():
if (i+int(j)) < a:
a = i+int(j)
if j < 2:
break
print(a - 2)
else:
print(N - 1) |
p02577 | s339591850 | Accepted | n=int(input())
ans=n%9
if ans==0:
print("Yes")
else:
print("No") |
p03723 | s518565881 | Wrong Answer | A,B,C = map(int,input().split())
if A == B and B == C and C == A:
print(-1)
else:
count = 0
while(A%2==0 and B%2 == 0 and C%2==0):
A_ = A
B_ = B
A = (B+C)/2
B = (A_+C)/2
C = (A_+B_)/2
count+=1
print(count) |
p02860 | s597730531 | Accepted | n = int(input())
s = input()
if s[n//2:] == s[:n//2]:
print('Yes')
else:
print('No') |
p04033 | s470756652 | Accepted | a,b = map(int,input().split())
if a > 0 or a == b:
print('Positive')
elif a <= 0 <= b:
print('Zero')
else:
print('Positive' if (b - a) % 2 == 1 else 'Negative')
|
p02819 | s691388272 | Accepted | x = int(input())
def prime(n):
flag = ''
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
break
else:
flag = 'prime_number'
return(flag)
if x == 2:
print(2)
else:
i = x + int(x % 2 == 0)
while(prime(i) != 'prime_number'):
i += 1
print(i) |
p02570 | s700155490 | Accepted | D, T, S = map(int, input().split())
t = D / S
if t <= T:
print('Yes')
else:
print('No') |
p02970 | s993811992 | Wrong Answer | import math
n,d = map(int,input().split())
math.ceil(n/(2*d+1)) |
p03284 | s625845690 | Accepted | #!python3
# input
N, K = list(map(int, input().split()))
def main():
if N % K == 0:
ans = 0
else:
ans = 1
print(ans)
if __name__ == "__main__":
main()
|
p03219 | s411477651 | Accepted | X,Y=map(int,input().split())
print(int(X+Y/2)) |
p03210 | s191644953 | Accepted | x=int(input())
if x==3 or x==5 or x==7:
print("YES")
else:
print("NO") |
p03633 | s261799473 | Accepted | from fractions import gcd
from functools import reduce
n = int(input())
t = list(int(input()) for _ in range(n))
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print(lcm_list(t)) |
p02973 | s815885270 | Accepted | import heapq
import bisect
N=int(input())
A=[]
for i in range(N):
a=int(input())
A.append(a)
h=[]
c=0
for i in range(N-1,-1,-1):
p=bisect.bisect_right(h,A[i])
if p==len(h):
h.append(A[i])
c+=1
else:
h[p]=A[i]
print(c) |
p02873 | s880065719 | Wrong Answer | import collections
s = list(input())
s_count = collections.Counter(s)
max_s = min(s_count[">"], s_count["<"])
ans = sum(range(1, max_s + 1))
print(ans)
|
p02697 | s980519170 | Wrong Answer | n, m = map(int, input().split())
if n % 2: # odd
for i in range(m):
print(i + 1, n - i)
else: # even
for i in range(m):
if 1 + 2 * i >= n - 1 - 2 * i:
break
m -= 1
print(i + 1, n - i)
for i in range(m):
print(i + 1 + m, n - i - m - 1)
|
p03012 | s500792752 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
c = 0
for hoge in a:
c += hoge
avg = c/2
t = 0
s = 0
while t < avg:
t += a[s]
s += 1
ans = min(avg-t,t+a[s]-avg)
print(int(ans*2)) |
p04031 | s705845214 | Wrong Answer | N = int(input())
a = input().split()
_max = int(max(a))
_min = int(min(a))
result = 20000 * N
start = _min
end = _max
step = 1
if _min > _max:
start = _min
end = _max -1
step = -1
else:
start = _min
end = _max +1
step = 1
for i in range(start,end,step):
_result = 0
for j in a:
_result += (i - int(j))**2
if _result <= result:
result = _result
print(result) |
p04011 | s175330176 | Accepted | n=int(input())
k=int(input())
x=int(input())
y=int(input())
ans =0
for i in range(n):
if(i+1<=k):
ans += x
if(i+1>k):
ans += y
print(ans)
|
p02600 | s828670291 | Wrong Answer | X=int(input())
if X<599:
k=8
elif 600<=X<=799:
k=7
elif 800<=X<=999:
k=6
elif 1000<=X<=1199:
k=5
elif 1200<=X<=1399:
k=4
elif 1400<=X<=1599:
k=3
elif 1600<=X<=1799:
k=2
else:
k=1
print(k) |
p03785 | s985444556 | Accepted | n, c, k = map(int, input().split())
T = sorted([int(input()) for _ in range(n)])
out = T.pop(0) + k
peo = 1
bus = 1
for t in T:
if t <= out and peo < c:
peo += 1
else:
out = t + k
peo = 1
bus += 1
print(bus) |
p03997 | s663157159 | Accepted | a=int(input())
b=int(input())
h=int(input())
print(int(((a+b)*h)/2)) |
p02713 | s155289676 | Accepted | from math import gcd
k = int(input())
cnt = 0
for i in range(1, k+1):
for j in range(1, k+1):
for k in range(1, k+1):
cnt += gcd(gcd(i, j), k)
print(cnt)
|
p02854 | s324592581 | Accepted | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
half = s / 2
cum = 0
for v in a:
if abs(half - cum) < abs(half - (cum + v)):
break
cum += v
print(abs((s - cum) - cum))
|
p02882 | s739595337 | Accepted | import math
a, b, x = map(int, input().split())
if a ** 2 * b <= 2 * x:
tan = 2 * (a **2 * b - x) / (a ** 3)
else:
tan = a * b ** 2 / (2 * x)
print(math.degrees(math.atan(tan))) |
p03109 | s990808523 | Accepted | lst = list(map(int, input().split('/')))
if lst[1] >= 5:
print('TBD')
else:
print('Heisei') |
p02783 | s584818849 | Wrong Answer | h, a = (int(i) for i in input().split())
print((h//a)+1) |
p03639 | s987504173 | Accepted | N = int(input())
A = list(map(int,input().split()))
d4 = 0
d2 = 0
d1 = 0
for a in A:
if a%4 == 0:
d4 += 1
elif a%2 == 0:
d2 += 1
else:
d1 += 1
if d4 >= d1:
print('Yes')
elif d4+1 == d1 and d2%2 == 0:
print('Yes')
else:
print('No') |
p02601 | s416323421 | Accepted | A, B, C = map(int, input().split())
K = int(input())
rest = K
while A >= B and rest > 0:
B *= 2
rest -= 1
while B >= C and rest > 0:
C *= 2
rest -= 1
if rest >= 0 and A < B and B < C:
print("Yes")
else:
print("No")
|
p02881 | s935865645 | Accepted |
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
N = int(input())
a = int(N ** .5)
for num in range(a):
num = a - num
if N % num == 0:
b = N // num
# print(b, num)
print(b + num -2)
sys.exit()
|
p03836 | s941822058 | Accepted | sx, sy, tx, ty = map(int, input().split())
ans = 'U' * (ty - sy)
ans += 'R' * (tx - sx)
ans += 'D' * (ty - sy)
ans += 'L' * (tx - sx + 1)
ans += 'U' * (ty - sy + 1)
ans += 'R' * (tx - sx + 1)
ans += 'D'
ans += 'R'
ans += 'D' * (ty - sy + 1)
ans += 'L' * (tx - sx + 1)
ans += 'U'
print(ans) |
p03544 | s009523140 | Accepted | n = int(input())
l = [2, 1]
for i in range(2, n + 1):
l.append(l[i - 2] + l[i - 1])
print(l[n]) |
p02578 | s011563356 | Accepted | N = int(input())
A = list(map(int,input().split()))
M=A[0]
ans = 0
for i in range(1,N):
if A[i]<M:
ans += M - A[i]
else:
M = A[i]
print(ans) |
p04034 | s926494276 | Wrong Answer | N,M = map(int,input().split())
a = [1]+[0]*(N-1)
b = [1]*N
sts = 0
for i in range(M):
x,y = map(int,input().split())
if x ==1 and sts == 0:
a[x-1]=0
a[y-1]=1
sts+=1
elif a[x-1]==1 and b[x-1]==1:
a[x-1]=0
a[y-1]=1
elif a[x-1]==1:
a[y-1]=1
b[x-1]-=1
b[y-1]+=1
print(sum(a)) |
p02780 | s420368088 | Accepted | # D - Dice in Line
from itertools import accumulate #累積和
n,k,*p = map(int,open(0).read().split())
ac = [0] + list(accumulate(p))
a = 0
for i in range(n-k+1): a = max(a, ac[i+k] - ac[i])
print((a+k)/2) |
p02657 | s743837047 | Accepted | a = list(map(int, input().split()))
print(a[0]*a[1])
|
p02621 | s336832397 | Wrong Answer | a =int(input())
ans = a+a**2+2**3
print(ans) |
p03284 | s760654693 | Accepted | def Atcoder_Crackers(n , k):
return 0 if n % k == 0 else 1
def main():
n , k = map(int , input().split())
print(Atcoder_Crackers(n , k))
if __name__ == '__main__':
main() |
p03011 | s471358027 | Accepted | a,b,c=map(int,input().split())
k=a+b+c
print(k-max(max(a,b),c)) |
p04019 | s314840951 | Wrong Answer | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
s = input()
if len(set(s))%2 == 1:
print("No")
exit()
if s.count('N')%2==s.count('S')%2 or s.count('W')%2==s.count('E')%2:
print('Yes')
else:
print('No')
|
p02584 | s927859059 | Accepted | X, K, D = map(int, input().split())
X = abs(X)
reach_or_before = X // D
if K <= reach_or_before:
print(X - D * K)
else:
#remaining jump
remain = K - reach_or_before
before_dist = X - D * reach_or_before #(>0)
after_dist = D * (reach_or_before + 1) - X
if remain % 2 == 0:
print(before_dist)
else:
print(after_dist)
|
p03105 | s953242151 | Accepted | a,b,c=map(int, input().split())
m=b//a
if m>=c:
print(c)
else:
print(m)
|
p03545 | s456476498 | Wrong Answer | def main():
A, B, C, D = input()
op = ['+', '+', '+']
for i in range(2**3):
for j in range(len(op)):
if (i >> j) & 1:
op[j] = '-'
if eval(A + op[0] + B + op[1] + C + op[2] + D) == 7:
print(A + op[0] + B + op[1] + C + op[2] + D + '=7')
break
if __name__ == '__main__':
main() |
p03103 | s030328117 | Wrong Answer | n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort(key=lambda x:x[0])
cnt=0
ans=0
num=0
while cnt<m:
for i in range(n):
cnt+=l[i][1]
ans+=l[i][0]*l[i][1]
num+=1
print(ans+(m-cnt)*l[num-1][0]) |
p04005 | s671675460 | Wrong Answer | A, B, C = map(int, input().split())
if C % 2 == 0:
print(0)
else:
red = (C//2+1) * A * B
blue = (C//2) * A * B
print(red - blue) |
p03698 | s738664668 | Accepted | s = input()
if len(s) == len(set(s)):
print('yes')
else:
print('no') |
p02888 | s750546960 | Accepted | import bisect
N = int(input())
L = [int(x) for x in input().split()]
L.sort()
ret = 0
# print(L)
for i in range(N-2):
for j in range(i+1, N-1):
add = bisect.bisect_left(L,L[i]+L[j]-0.01) - (j+1)
# print(f"{L[i]}, {L[j]} , add:{add}")
ret += add
print(ret)
|
p03485 | s230813707 | Accepted | import math
a,b=map(int,input().split())
ans=math.ceil((a+b)/2)
print(ans) |
p03861 | s039328144 | Accepted | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int
nl = lambda: list(map(int, readline().split())) # input multiple int to list
a, b, x = nm()
d_min = x - (a % x)
if d_min == x:
d_min = 0
d_max = b % x
min = a + d_min
max = b - d_max
if min > max:
ans = 0
else:
ans = ((max - min) // x + 1)
print(ans) |
p02683 | s010959318 | Accepted | import numpy as np
from itertools import product
N,M,X = list(map(int, input().split()))
C = [0] * N
A = []
for i in range(N):
wk = list(map(int, input().split()))
C[i] = wk[0]
A.append(wk[1:])
C = np.array(C)
A = np.array(A)
ans = -1
for pt in product([0,1], repeat = N):
p = np.array(pt)
#print(C.dot(p))
#print(p.dot(A))
rikai = p.dot(A)
if min(rikai) >= X:
ans = C.dot(p) if ans == -1 else min(ans, C.dot(p))
print(ans) |
p03160 | s299560526 | Wrong Answer | #DP カエルの奴 A 配るDP
N=int(input())
S=list(map(int,input().split()))
S.append(100010)
DP=[100000000]*100010
DP[0]=0
for i in range(N-1):
if DP[i]+abs(S[i]-S[i+1])<DP[i+1]:
DP[i+1]=DP[i]+abs(S[i]-S[i+1])
if DP[i]+abs(S[i]-S[i+2])<DP[i+2]:
DP[i+2]=DP[i]+abs(S[i]-S[i+2])
print(DP[N-1])
|
p02833 | s941439633 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(input())
if n % 2 != 0:
print(0)
exit()
L = n // 2
res = 0
while L:
res += L // 5
L //= 5
print(res)
if __name__ == '__main__':
resolve()
|
p02744 | s958012588 | Accepted | import collections
alpha=['a','b','c','d','e','f','g','h','i','j']
def a(n):
if n==1:
return ['a']
else:
box=[]
alphan=alpha[:n+1]
for i in a(n-1):
kind=collections.Counter(i)
for j in range(len(kind)+1):
box.append(i+alpha[j])
return box
for i in a(int(input())):
print(i) |
p03220 | s439886587 | Wrong Answer | N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
tmpl = 50-10**5*0.006
lst = list()
for i in range(N):
tmp = T-H[i]*0.006
tmpl= abs(T-tmp)
lst.append((tmpl,i+1))
lst.sort()
for k,j in lst:
print(j)
break |
p03495 | s645125134 | Accepted | import collections
x, y = map(int,input().split())
li = list(map(int,input().split()))
c = collections.Counter(li)
ans = 0
count = c.most_common()
if len(count) > y:
for i in range(y,len(count)):
ans += count[i][1]
print(ans) |
p02780 | s275258357 | Accepted | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n, k = map(int, readline().split())
p = list(map(int, readline().split()))
l = [i for i in range(1, 1001)]
av = np.cumsum(l) / l
tmp = [av[i - 1] for i in p]
cs = list(np.cumsum(tmp))
if n == k:
print(cs[-1])
exit()
ans = 0
for i in range(n - k):
ans = max(ans, cs[i + k] - cs[i])
print(ans) |
p02594 | s338720031 | Wrong Answer | print( 'Yes' if input() == '30' else 'No') |
p02882 | s210714553 | Accepted | import sys
from math import atan, pi
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
a, b, x = map(int, readline().split())
if x > a * a * b / 2:
angle = atan(2 * (a * a * b - x) / a ** 3)
else:
angle = atan(a * b * b / (2 * x))
print(angle / pi * 180)
return
if __name__ == '__main__':
main()
|
p03309 | s593858361 | Accepted | import numpy as np
n = int(input())
hikumono = n * (n-1)//2
A = np.array(list(map(int, input().split())))
B = np.array([i+1 for i in range(n)])
C=A-B
heikin1 = int(np.median(C))
heikin2 = heikin1 + 1
heikin3 = heikin1 - 1
ans1 = abs(C-heikin1).sum()
ans2 = abs(C-heikin2).sum()
ans3 = abs(C-heikin3).sum()
print(min(ans1, ans2, ans3)) |
p03860 | s376662879 | Accepted | print("A"+input()[8]+"C") |
p02780 | s573909598 | Accepted | n,k=map(int,input().split())
p=list(map(int,input().split()))
e=[]
for pp in p:
ex=(pp+1)/2
e.append(ex)
ans=0
for i in range(n-k+1):
if i==0:
t=sum(e[:k])
ans+=t
continue
t-=e[i-1]
t+=e[i+k-1]
ans=max(ans,t)
print(ans) |
p02688 | s487131723 | Accepted | inputlist = list(map(int, input().split()))
snum = inputlist[0]
kindofsweets = inputlist[1]
setofkind = []
for i in range(kindofsweets):
input()
setofkind += (list(map(int, input().split())))
counter = 0
for i in range(snum):
if i + 1 not in setofkind:
counter += 1
print(counter) |
p03251 | s220881831 | Accepted | N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_max = max(x)
z = min(y)
if X < z <= Y and x_max < z:
print('No War')
else:
print('War') |
p03774 | s345322749 | Accepted | n,m=map(int,input().split())
A,B,C,D=[],[],[],[]
for i in range(n):
a,b=map(int,input().split())
A.append(a)
B.append(b)
for i in range(m):
c,d=map(int,input().split())
C.append(c)
D.append(d)
for i in range(n):
ans,x=1000000000000,0
for j in range(m):
if ans>abs(A[i]-C[j])+abs(B[i]-D[j]):
ans=abs(A[i]-C[j])+abs(B[i]-D[j])
x=j
print(x+1)
|
p03625 | s945818093 | Accepted | from collections import Counter
N = int(input())
A = list(map(int,input().split()))
d = []
for key,value in Counter(A).items():
if value >=4 :
d.append(key)
d.append(key)
if value >= 2:
d.append(key)
if len(d) < 2:
print(0)
else:
d = sorted(d,reverse=True)
x = d[0]
y = d[1]
print(x*y) |
p02552 | s126217862 | Wrong Answer | a = input()
print(a) |
p02684 | s356134661 | Accepted | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = 0
if k<=n:
for i in range(k):
b = a[b]-1
print(b+1)
exit(0)
c = [0]
for i in range(n):
b = a[b]-1
c.append(b)
d = c[:-1].index(c[-1])
c = c[d:-1]
k = k-d
print(c[k%len(c)]+1)
|
p02633 | s960887080 | Accepted | X = int(input())
k = 1
while True:
cand = X*k
if cand%360==0:
break
k+=1
print(k) |
p03730 | s170154767 | Wrong Answer | A, B, C = map(int, input().split())
if A % B == 0 and C!=0:
print("NO")
else:
print("YES")
|
p03617 | s412182580 | Wrong Answer | Q,H,S,D = map(int,input().split())
N = float(input())
ans = 0
while N > 0:
div = N // 2
if N >= 2:
#print(N,div)
ans += min(8 * Q,4 * H,2 * S ,D) * div
N = N % 2
else:
#print(N)
if N >= 1:
ans += min(4 * Q,2 * H,S)
N -= 1
elif N >= 0.5:
ans += min(2 * Q,H)
N -= 0.5
else:
ans += Q
N -= 0.25
print(int(ans)) |
p03352 | s659285397 | Accepted | # -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
X=int(input())
l=[]
for i in range(1,33):
for j in range(2,11):
l.append(i**j)
l.sort()
print(l[bisect_right(l,X)-1])
if __name__ == '__main__':
main()
|
p02899 | s986849111 | Accepted | n = int(input())
A = list(map(int, input().split()))
D = {}
for i in range(1, n+1):
D[A[i-1]] = i
for k, v in sorted(D.items()):
print(v, end=" ") |
p02866 | s142632374 | Wrong Answer | #! /usr/bin/env python3
from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
ans = lambda x : x % 998244353
N = int(input())
D = [int(_) for _ in input().split()]
c = Counter(D)
bef = 1
ret = 1 * (not D[0])
for i in range(len(c)):
if c[i] == 0:
ret = 0
ret *= bef ** c[i]
bef = c[i]
print(ret)
|
p02717 | s884819066 | Accepted | a,b,c=map(int,input().split())
print(c,a,b) |
p02577 | s682923318 | Accepted | #atcoder template
def main():
import sys
imput = sys.stdin.readline
#文字列入力の時は上記はerrorとなる。
#ここにコード
#input
n = str(input())
#output
l = len(n)
mod = 0
for i in range(l):
mod += int(n[i])
mod %= 9
# %%
if mod == 0:
print("Yes")
else:
print("No")
#N = 1のときなどcorner caseを確認!
if __name__ == "__main__":
main() |
p02952 | s920396967 | Accepted | N=int(input())
n=0
for i in range(1,N+1):
list1=list(str(i))
#print(list1)
#print(len(list1))
if len(list1)%2 != 0:
n+=1
print(n)
|
p02697 | s336942827 | Accepted | def resolve():
n, m = map(int, input().split())
if n % 2 == 0:
x = (m + 1) // 2
for i in range(x):
print(x - i, x + i + 1)
x = m // 2
for i in range(x):
print(n - (x - i - 1), n - (x + i + 1))
else:
for i in range(m):
print(i + 1, n - i)
if __name__ == '__main__':
resolve()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.