problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03371
|
s181881245
|
Wrong Answer
|
#pattern1:Only A-pizza/B-pizza
#pattern2:Only C-pizza
#pattern2:C-pizza & A or B-pizza
a,b,c,x,y = map(int, input().split())
price1 = x*a + y*b
price2 = max(x, y)*2*c
if x<=y:
price3 = x*2*c
price3 += (y-x)*b
else:
price3 = y*2*c
price3 += (y-x)*a
print(min(price1, price2, price3))
|
p02888
|
s599869533
|
Accepted
|
import bisect
#二分探索をするライブラリ
n = int(input())
L = sorted(map(int,input().split()))
ans = 0
# c <= b <= a とする
for i in range(n-2):
for j in range(i+1,n-1):
a = L[n-1-i]
b = L[n-1-j]
if a-b < b:
ans += (n-1-j) - bisect.bisect_left(L,a-b+1)
print(ans)
|
p03494
|
s206769866
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
i = 0
per = True
while per == True:
for index in range(n):
num = a[index]
ans = divmod(num, 2)
if num == 0 or ans[1] != 0:
per = False
break
a[index] = ans[0]
i += 1
print(i)
|
p02971
|
s211890229
|
Accepted
|
N = int(input())
nums = [int(input()) for _ in range(N)]
all_max = max(nums)
new_nums = list(nums)
new_nums.remove(all_max)
second_max = max(new_nums) # max関数はfor文の中にいれずに、先に2番目の最大値をもとめておく
for i in range(N): #indexをまわしているので、iとおく
if nums[i] == all_max:
print(second_max)
else:
print(all_max)
|
p02900
|
s515376463
|
Accepted
|
from math import gcd
a, b = map(int, input().split())
gcd = gcd(a, b)
ans = 1
n = int(gcd**0.5) + 2
for i in range(2, n):
if gcd%i == 0:
ans += 1
while gcd%i == 0:
gcd //= i
if gcd < i:
break
if gcd >= n:
ans += 1
if ans == 1 and gcd != 1:
ans = 2
print(ans)
|
p02951
|
s692757051
|
Wrong Answer
|
def divisors(n) -> list:
res = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
res.append(i)
if i != n // i:
res.append(n // i)
#res = sorted(res)
return res
|
p02832
|
s027099063
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
ans = 0
idx = 1
for i in a:
if i != idx:
ans += 1
else:
idx += 1
if ans == n:
print(-1)
else:
print(ans)
|
p03487
|
s030735477
|
Accepted
|
from collections import Counter
_ = input()
a = [int(i) for i in input().split()]
ans = 0
for k, v in Counter(a).items():
if k < v:
ans += v - k
elif v < k:
ans += v
else:
print(ans)
|
p03472
|
s440814435
|
Accepted
|
N,H=map(int,input().split())
a=[0]*N
b=[0]*N
for i in range(N):
a[i],b[i]=map(int,input().split())
amax=max(a)
n=0
total=0
b.sort(reverse=True)
for i in range(N):
if b[i] > amax:
n+=1
total+=b[i]
else:
break
if H <= total:
for i in range(n):
H-=b[i]
if H <= 0:
print(i+1)
break
else:
print(n+int((H-total-1)/amax)+1)
|
p02641
|
s212628430
|
Accepted
|
X, N = map(int, input().split())
p = list(map(int, input().split()))
k = 0
ans = 0
c = True
while c:
if (X - k) not in p:
ans = X - k
c = False
break
elif (X + k) not in p:
ans = X + k
c = False
break
else:
k += 1
print(ans)
|
p03000
|
s664011909
|
Wrong Answer
|
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 0
for i in range(1,N+1):
if D>X:
break
else:
D+=L[i-1]
count+=1
print(count)
|
p02639
|
s870259247
|
Accepted
|
List = list(map(int, input().split()))
res = 0
for i in range(len(List)):
if List[i] == 0:
res = i+1
else:
pass
print(res)
|
p03639
|
s506448047
|
Wrong Answer
|
import sys
import os
def file_input():
f = open('ARC080/input.txt', 'r')
sys.stdin = f
def main():
#ile_input()
N=int(input())
a_li=list(map(int, input().split()))
# four=0
odd=0
for i in a_li:
if i%4==0:
odd-=1
if i%2!=0:
odd+=1
else:
if odd<=1:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
|
p02820
|
s728462744
|
Accepted
|
from itertools import groupby
N, K = map(int, input().split())
R, S, P = map(int, input().split())
D = {"r":P, "s":R, "p":S}
T = list(input())
c = 0
for i in range(K):
gr = groupby(T[i::K])
for key, group in gr:
l = len(list(group))
d = D[key]
c += d*((l+1)//2)
print(c)
|
p02613
|
s348206582
|
Accepted
|
import collections
N = int(input())
S=[]
for i in range(N):
S.append(input())
c = collections.Counter(S)
print('AC x {}'.format(c['AC']))
print('WA x {}'.format(c['WA']))
print('TLE x {}'.format(c['TLE']))
print('RE x {}'.format(c['RE']))
|
p03069
|
s433476579
|
Accepted
|
N=int(input())
S=input()
B=[]
W=[]
i=0
while i<N:
if S[i]=='#':
B.append(i)
else:
W.append(i)
i+=1
X=len(B)
Y=len(W)
ans=0
i=j=0
while i<X and j<Y:
if B[i]<W[j]:
i+=1
j+=1
ans+=1
else:
j+=1
print(ans)
|
p02693
|
s603504429
|
Accepted
|
N=int(input())
A,B = map(int, input().split())
i=1
while 1:
K=N*i
if A <= K and K <= B:
print('OK')
break
if K>B:
print('NG')
break
i+=1
|
p03419
|
s174776922
|
Accepted
|
N,M=map(int,input().split())
if N==1 and M==1:
result=1
elif N==1:
result=M-2
elif M==1:
result=N-2
else:
result=(M-2)*(N-2)
print(result)
|
p03261
|
s360918672
|
Accepted
|
n = int(input())
w = [input() for i in range(n)]
ans = 'Yes'
if len(w)!= len(set(w)):
ans = 'No'
else:
for i in range(1,n):
if w[i][0]!=w[i-1][-1]:
ans = 'No'
break
print(ans)
|
p02753
|
s293460405
|
Wrong Answer
|
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
lst = input().split()
# %%
one = lst[0][0]
two = lst[0][1]
three = lst[0][2]
# %%
one_two = one == two
two_three = two == three
three_one = three == one
# %%
if any([one_two, two_three, three_one]):
print('Yes')
else:
print('No')
# %%
|
p03449
|
s125198943
|
Accepted
|
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
acount=0
bcount=0
ans=0
for i in range(n):
bcount=0
acount+=a[i]
for j in range(i,n):
bcount+=b[j]
if ans<acount+bcount:
ans=acount+bcount
print(ans)
|
p02823
|
s404059553
|
Wrong Answer
|
n,a,b = map(int,input().split())
d = b - a
if d % 2 == 0:
print(d//2)
else:
ans = min(a,n-b)+d//2
if d == 1:
ans += 1
print(ans)
|
p02797
|
s526674964
|
Accepted
|
n, k, s = [int(v) for v in input().split()]
result = [s] * k
if s == 10 ** 9:
result += [1] * (n - k)
else:
result += [10 ** 9] * (n - k)
print(' '.join(map(str, result)))
|
p02645
|
s993391781
|
Wrong Answer
|
inp = input('enter :')
inp = inp[0:3]
print(inp)
|
p03035
|
s863363541
|
Accepted
|
a, b = map(int, input().split())
if a >= 13:
print(b)
elif 6 <= a <= 12:
print(b//2)
else:
print(0)
|
p03087
|
s933757856
|
Wrong Answer
|
n, q = map(int, input().split())
s = input()
lst = [0] * n
for i in range(1, n):
lst[i] = lst[i-1]
if lst[i-1:i+1] == 'AC':
lst[i] += 1
for i in range(q):
l, r = map(int, input().split())
print(lst[r-1] - lst[l-1])
|
p02578
|
s078269767
|
Accepted
|
N=int(input())
s=[int(x) for x in input().split()]
ans=0
for i in range(N-1):
if s[i]>s[i+1]:
ans+=(s[i]-s[i+1])
s[i+1]=s[i+1]+(s[i]-s[i+1])
print(ans)
|
p03639
|
s894127556
|
Accepted
|
n=int(input())
l=list(map(int,input().split()))
c_4=0
even=0
odd=0
for i in l:
if i%4==0:
c_4+=1
elif i%2==0:
even+=1
else:
odd+=1
if even==0 and odd-1 <= c_4:
ans="Yes"
else:
ans="No"
if even>0 and odd <= c_4:
ans="Yes"
elif even>0:
ans="No"
print(ans)
|
p03565
|
s712829798
|
Accepted
|
s = input()
t = input()
found_s = False
for i in range(len(s) - len(t), -1, -1):
for c1, c2 in zip(s[i:i+len(t)], t):
if c1 == '?' or c1 == c2:
continue
else:
break
else:
found_s = True
s = s[:i] + t + s[i+len(t):]
break
if found_s:
print(s.replace('?', 'a'))
else:
print("UNRESTORABLE")
|
p03210
|
s789369137
|
Wrong Answer
|
a = int(input())
if a == 3 or a == 5 or a == 7:
print('Yes')
else:
print('No')
|
p02771
|
s791235573
|
Accepted
|
A,B,C=map(int,input().split())
answer= False
if A==B or A==C or B==C:
answer=True
if A==B and A==C and B==C:
answer=False
print('Yes' if answer else 'No')
|
p03437
|
s666625196
|
Accepted
|
a,b = map(int,input().split())
print(-1 if a % b == 0 else a)
|
p02989
|
s084152651
|
Accepted
|
N = int(input())
d = list(map(int, input().split()))
d.sort()
half = int(N/2)
print(d[half]-d[half-1])
|
p04005
|
s846571077
|
Accepted
|
import math
a = list(map(int, input().split()))
if sum(list(map(lambda x:x%2, a))) == 3:
b = a.pop(a.index(max(a)))
print(a[0]*a[1]*(math.ceil(b/2) - math.floor(b/2)))
else:
print(0)
|
p02708
|
s042111231
|
Accepted
|
n, k = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
c = 0 #combination
l = 0
h = 0
for i in range(1, n+2): #O(n)
l += i - 1
h += n + 1 - i
c = (h - l + 1) % mod
if i >= k:
ans = (ans + c) % mod
else:
pass
print(ans)
|
p03699
|
s653750660
|
Accepted
|
import sys
def input(): return sys.stdin.readline().strip()
def main():
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
ans = sum(S)
if ans % 10 != 0:
print(ans)
return
subtract = 0
for s in S:
if s % 10 != 0:
subtract = s
break
if subtract != 0:
print(ans - subtract)
else:
print(0)
if __name__ == "__main__":
main()
|
p02775
|
s108651743
|
Accepted
|
S = input()
ans = 0
flag = False #繰り上がりありならTrue
flag2 = False #前が5ならTrue
for k in range(len(S)):
n = int(S[-k-1])
if flag2:
if n < 5:
flag = False
else:
flag = True
if flag:
n += 1
if n == 5:
ans += 5
flag2 = True
flag = False
elif n < 5:
ans += n
flag2 = False
flag = False
else:
ans += 10-n
flag2 = False
flag = True
if flag:
ans += 1
print(ans)
|
p03705
|
s132615612
|
Wrong Answer
|
def answer(n, a, b):
if a > b: return 0
if n < 2: return 0
n = n-2
small = a*n
big = b*n
return big - small + 1
n, a, b = map(int, input().split())
print(answer(n, a, b))
|
p03086
|
s910137367
|
Wrong Answer
|
S = input()
tmp=0
ans=0
for s in S:
if s in 'ACGT':
tmp+=1
else:
ans = max(ans,tmp)
tmp=0
print(ans)
|
p02866
|
s793068209
|
Accepted
|
n=int(input())
d=list(map(int,input().split()))
ans=1 if d[0]<1 else 0
d.sort()
cnt=[0]*(d[-1]+1)
for i in range(n):
cnt[d[i]]+=1
if cnt[0]!=1:ans=0
mod=998244353
for i in d[1:]:
ans*=cnt[i-1]
ans%=mod
print(ans)
|
p02597
|
s024306964
|
Accepted
|
n = int(input())
C = list(input())
l, r, c = 0, n-1, 0
while l < r:
if C[l] == 'W' and C[r] == 'R':
l += 1
r -= 1
c += 1
elif C[l] != 'W': l += 1
elif C[r] != 'R': r -= 1
print(c)
|
p03435
|
s107447178
|
Accepted
|
c = [list(map(int,input().split())) for _ in range(3)]
#print(LIST)
# a1 = 0 とする
a,b= [0,0,0],[0,0,0]
for i in range(3):
b[i] = c[0][i] - a[0]
for j in range(1,3):
a[j] = c[j][0] - b[0]
for i in range(1,3):
for j in range(1,3):
#print(a,b)
if c[j][i] == a[j] + b[i]:
pass
else:
print('No')
exit()
print('Yes')
|
p02918
|
s181534197
|
Accepted
|
import itertools
N, K = map(int, input().split())
S = input()
gnum = 0
for key, elems in itertools.groupby(S):
gnum += 1
k = K
while gnum > 1 and K > 0:
if gnum != 2:
gnum -= 2
else:
gnum -= 1
K -= 1
if gnum == 1:
print(N - 1)
else:
print(N - gnum)
|
p03592
|
s473401859
|
Wrong Answer
|
# 03
import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()
INF = float('inf')
N, M, K = LI()
for i in range(N):
for j in range(M):
if i*(M-j) + j*(N-i) == K:
print('Yes')
exit()
print('No')
|
p02631
|
s184582100
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
ans = []
tmp = 0
for i in range(n):
tmp ^= a[i]
for i in range(n):
ans.append(tmp ^ a[i])
print(*ans)
|
p03284
|
s874139290
|
Accepted
|
def main():
rice_cookie, participants = map(int, input().split(" "))
if not rice_cookie % participants:
print(0)
else:
print(1)
if __name__ == '__main__':
main()
|
p03680
|
s633348668
|
Wrong Answer
|
n = int(input())
a = [0] + [int(input()) for i in range(n)]
cnt = 1
next_a = a[1]
while cnt <= 10**5:
next_a = a[next_a]
cnt += 1
if next_a == 2:
break
if cnt <= 10**5:
print(cnt)
else:
print(-1)
|
p03030
|
s224187085
|
Accepted
|
n = int(input())
l = [input().split()+[i+1] for i in range(n)]
l = sorted(l, key = lambda x:(x[0],-int(x[1])))
for i in l:
print(i[2])
|
p02771
|
s727945774
|
Accepted
|
print('Yes' if len(set(list(map(int,input().split()))))==2 else 'No')
|
p02608
|
s576057466
|
Accepted
|
n = int(input())
a = [0 for i in range(10000)]
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
w = (x+y+z)**2-z*x-z*y-x*y
if w <= 10000:
a[w-1] += 1
for i in range(n):
print(a[i])
|
p03438
|
s702804272
|
Accepted
|
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
n = inp()
a = inpl()
b = inpl()
res = 0
for x,y in zip(a,b):
if x > y:
res += x-y
elif x < y:
res -= (y-x)//2
# print(res)
print('No' if res > 0 else 'Yes')
|
p03797
|
s399502160
|
Accepted
|
n,m = map(int, input().split())
ans = 0
if n*2 <= m:
ans += n
m -= n*2
else:
ans += m//2
m %= 2
if m >= 4:
ans += m // 4
print(ans)
|
p02664
|
s337403302
|
Wrong Answer
|
S = input()
new_S = ''
for i, s in enumerate(S):
if s == '?' and i > 0:
s = 'D' if new_S[i - 1] == 'P' else 'P'
new_S += s
temp = s
print(new_S)
|
p03943
|
s769757638
|
Accepted
|
import sys
l = list(map(int,input().split()))
for i in range(3):
if l[i] == sum(l[:i]+l[i+1:]):
print('Yes')
sys.exit()
print('No')
|
p02882
|
s468060924
|
Wrong Answer
|
# -*- coding: utf-8 -*-
import math
def main():
a, b, x = map(int, input().split())
theta = None
if 2*x <= a*a*b:
theta = math.atan((a*b*b)/(2*x))
else:
theta = math.atan(2*(a*a*b-x)/(a**3))
print("ok")
print(math.degrees(theta))
if __name__ == "__main__":
main()
|
p03605
|
s284346400
|
Wrong Answer
|
N = int(input())
if N % 10 or N/10 == 9:
print("Yes")
else:
print("No")
|
p03319
|
s663663348
|
Wrong Answer
|
N,K = [int(hoge) for hoge in input().split()]
A = [int(hoge) for hoge in input().split()]
I = A.index(1)
R_Start = I - I%(K-1) + K #実質的なスタート
print(I//(K-1) + 1 + (N-R_Start+1)//(K-1))
#[AAA][AAA][AAA][AAA][BAAA]
#[AAA][AAA][AAA][AAA][ABAA]
#[AAA][AAA][AAA][AAA][AABA]
#[AAA][AAA][AAA][AAA][AAAB]
|
p03997
|
s587746823
|
Wrong Answer
|
def calculate_area(a, b, h):
return int((a + b)*h/2)
|
p03017
|
s990819007
|
Accepted
|
n, a, b, c, d = map(lambda x:int(x)-1,input().split())
n += 1
S = input()
ok = True
overtake = False
if c < d:
overtake = True
for i in range(a,d):
if S[i] == "#" and S[i+1] == "#":
ok = False
for i in range(b,min(d+1,n-1)):
if S[i] == "." and S[i-1] == "." and S[i+1] == ".":
overtake = True
if ok and overtake:
print('Yes')
else:
print('No')
|
p03486
|
s321349800
|
Accepted
|
s = input()
s_sort = ''.join(sorted(s))
t = input()
t_sort = ''.join(sorted(t, reverse=True))
if s_sort < t_sort:
print('Yes')
else:
print('No')
|
p03380
|
s978932941
|
Wrong Answer
|
from bisect import bisect_left
N = int(input())
a = list(map(int,input().split()))
a.sort()
x = a[-1]
print(x, a[bisect_left(a, x//2, hi=N-2)])
|
p03785
|
s708826160
|
Accepted
|
# coding: utf-8
import bisect
import math
N, c, k = map(int,input().split())
T = []
for i in range(N):
T.append(int(input()))
T.sort()
i=0
#print(T)
ans = 0
while True:
t=bisect.bisect_right(T, T[i]+k)
#print("i="+str(i))
if t >= i+c:
i += c
else:
i = t
ans += 1
#print(i, ans)
if i >= N:
break
print(ans)
|
p02713
|
s637470555
|
Wrong Answer
|
def gcd2(a,b):
x, y = max(a, b), min(a, b)
if x % y == 0:
return y
else:
while x % y != 0:
x, y = y, x % y
return x
K = int(input())
s = [gcd2(a, b) for a in range(1, K+1) for b in range(a+1, K+1)]
t = [2 * gcd2(a, b) for a in range(1, K+1) for b in s]
n = [gcd2(a, b) for a in range(1, K+1) for b in range(1, K+1)]
print(sum(t)+sum(n))
|
p02888
|
s490351130
|
Accepted
|
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
n = ii()
l = li()
l.sort()
ans = 0
from bisect import bisect_left
for i in range(len(l)-2):
for j in range(i+1,len(l)-1):
ab = l[i] + l[j]
r = bisect_left(l, ab)
ll = j+1
ans += max(0, r-ll)
print(ans)
|
p03000
|
s711679370
|
Accepted
|
n,x=map(int,input().split())
l=list(map(int,input().split()))
fly=0
count=1
for i in range(100):
fly+=l[i]
if fly<=x:
count+=1
else:
break
print(count)
|
p02546
|
s197283608
|
Accepted
|
s = input()
if s[-1] == "s":
print(s+"es")
else:
print(s+"s")
|
p02688
|
s654249763
|
Accepted
|
def resolve():
N, K = map(int, input().split())
C = [0] * N
for i in range(K):
input()
A = list(map(int, input().split()))
for a in A:
C[a-1] += 1
print(C.count(0))
if __name__ == '__main__':
resolve()
|
p03328
|
s175532190
|
Wrong Answer
|
a, b = map(int, input().split())
x = 0
a_count = 0
for i in range(499500):
x += i
a_count += 1
if a <= x:
break
print(x - a)
|
p03433
|
s378330631
|
Accepted
|
import sys
n = int(input())
a = int(input())
amari = n % 500
print("Yes") if amari <= a else print("No")
|
p02946
|
s298790512
|
Accepted
|
K, X = map(int, input().split(" "))
print(' '.join([str(k) for k in range(X - K + 1, X + K)]))
|
p03773
|
s799715084
|
Accepted
|
A, B = map(int, input().split())
a = A + B
if 23 < a:
a = a - 24
print(a)
|
p02629
|
s812980603
|
Accepted
|
def n2a(num):
if num <= 26:
return chr(ord("a")+num-1)
elif num % 26 == 0:
return n2a(num//26 - 1) + chr(ord("z"))
else:
return n2a(num//26) + chr(ord("a")-1 + num%26)
N = int(input())
print(n2a(N))
|
p03331
|
s135730083
|
Accepted
|
N = int(input())
def f(n):
ans = 0
for s in str(n):
ans += int(s)
return ans
ans = float("INF")
for i in range(1, N):
j = N-i
ans = min(ans, f(i) + f(j))
print(ans)
|
p02759
|
s607335261
|
Accepted
|
n = int(input())
print(n // 2 + n % 2)
|
p02645
|
s570688709
|
Accepted
|
print(input()[:3])
|
p02688
|
s912380694
|
Accepted
|
data = input().rstrip().split(" ")
people = int(data[0])
kind = int(data[1])
ans = [i+1 for i in range(people)]
for j in range(kind):
empty = input()
have = input().rstrip().split(" ")
for k in have:
if int(k) in ans:
delete = ans.index(int(k))
del ans[delete]
print(len(ans))
|
p02820
|
s570647595
|
Wrong Answer
|
import math
n, k = map(int, input().split(" "))
r, s, p = map(int, input().split(" "))
t = input()
w = {"r": p, "s": r, "p": s}
li = [0 for _ in range(n)]
for i in range(len(t)):
wp = w[t[i]]
if not (i - k >= 0 and li[i - k] == wp):
li[i] = wp
print(sum(li))
|
p03069
|
s130285718
|
Accepted
|
n=int(input())
s=list(input())
l=[[0,s.count('.')]]
for i in range(n):
if s[i]=='.':
l.append([l[-1][0],l[-1][1]-1])
else:
l.append([l[-1][0]+1,l[-1][1]])
ans=10**10
for i in range(n+1):
ans=min(ans,sum(l[i]))
print(ans)
|
p02676
|
s323177862
|
Wrong Answer
|
a = int(input())
s = input()
if len(s) > a:
print(s[:a+1]+"...")
else:
print(s)
|
p02618
|
s498994626
|
Accepted
|
for _ in range(365):
print(1)
|
p02982
|
s943608426
|
Accepted
|
import math
import itertools
def distance(start, end):
return math.sqrt(sum((x - y) ** 2 for x, y in zip(start, end)))
N, D = map(int, input().split())
Xs = []
for _ in range(N):
Xs.append(list(map(int, input().split())))
ans = 0
for p, q in itertools.combinations(Xs, 2):
d = distance(p, q)
if math.floor(d) == math.ceil(d):
ans += 1
print(ans)
|
p02747
|
s200660651
|
Accepted
|
S = input()
a = "No"
for i in range(1, 11):
if S == "hi"*i:
a = "Yes"
print(a)
|
p04012
|
s518549911
|
Accepted
|
#ABC044B
n=input()
a=[]
for i in range(len(n)):
a.append(n[i])
sum_=0
for i2 in range(len(a)):
sum_=sum_+a.count(a[i2])%2
if sum_ == 0:
print("Yes")
else:
print("No")
|
p03327
|
s957240565
|
Accepted
|
print("AB"+("C"if int(input())<1000else"D"))
|
p02682
|
s379678509
|
Accepted
|
a,b,c,k = map(int,input().split())
if k <= a:
print(k)
elif k <= a + b:
print(a)
else:
print(a-(k-a-b))
|
p03910
|
s365454169
|
Accepted
|
n = int(input())
cnts = []
i = 0
while i*(i+1)//2 <= n:
i += 1
cnts.append(i)
rm = sum(cnts) - n
for i in cnts:
if i == rm:continue
print(i)
|
p03352
|
s132824573
|
Accepted
|
x = int(input())
table = [False] * -~x
table[1] = True
for i in range(2, 32):
j = i * i
while j <= x:
table[j] = True
j *= i
print(max(i for i in range(x + 1) if table[i]))
|
p03324
|
s040000875
|
Accepted
|
import sys
def input(): return sys.stdin.readline().strip()
def resolve():
d,n=map(int, input().split())
if n!=100:
print(100**d*n)
elif n==100:
print(100**d*101)
resolve()
|
p02612
|
s903324354
|
Accepted
|
n = int(input())
import math
x = math.ceil(n/1000)*1000-n
print (x)
|
p03632
|
s705473170
|
Wrong Answer
|
a,b,c,d = map(int,input().split())
print(0 if c >= b else b-c)
|
p02633
|
s670817039
|
Accepted
|
x = int(input())
for i in range(3,361):
xk = x*i
if xk%360 == 0:
print(i)
exit()
|
p03293
|
s876613384
|
Wrong Answer
|
from collections import deque
s = deque(input())
t = deque(input())
n=len(s)
yes = False
for _ in range(n-1):
if s == t:
yes = True
break
s.rotate()
print('Yes' if yes else 'No')
|
p02572
|
s059692230
|
Accepted
|
n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
minsum += x[i]
for i in range(0,n-1):
minsum-=x[i]
sum += x[i]*minsum
if(sum>10**9+7):
sum%=(10**9+7)
print(sum)
|
p03607
|
s800375168
|
Accepted
|
from collections import Counter
n=int(input())
a=[int(input()) for _ in range(n)]
ans=0
C=Counter(a)
#print(C)
for k,v in C.items():
if v%2==1:
ans+=1
print(ans)
|
p03803
|
s198615454
|
Accepted
|
a, b = map(int, input().split())
if a == 1:
if b == 1:
print('Draw')
else:
print('Alice')
else:
if b == 1:
print('Bob')
elif a > b:
print('Alice')
elif a == b:
print('Draw')
else:
print('Bob')
|
p03145
|
s432519029
|
Accepted
|
a, b, c = map(int, input().split())
print(a*b//2)
|
p03779
|
s109433118
|
Wrong Answer
|
def sum_from_1(n):
return n * (n + 1) // 2
def main():
x = int(input())
straight = 0
while True:
if x < sum_from_1(straight):
straight -= 1
break
straight += 1
answer = straight + (x - sum_from_1(straight))
print(answer)
if __name__ == '__main__':
main()
|
p02726
|
s906136466
|
Accepted
|
N,X,Y=list(map(int,input().split()))
A=[0 for i in range(N)]
for i in range(1,N):
for j in range(i+1,N+1):
A[int(min(j-i,abs(X-i)+abs(Y-j)+1))]+=1
del A[0]
print(*A,sep=('\n'))
|
p03076
|
s671305643
|
Wrong Answer
|
X=[int(input()) for i in range(5)]
Y=[]
for x in X:
Y.append(-(-x//10)*10-x)
print(sum(Y)+sum(Y)-(max(Y)))
|
p02705
|
s207823059
|
Accepted
|
from math import pi
r=int(input())
print(2*r*pi)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.