problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02595 | s444904707 | Accepted | N, D = list(map(int, input().split()))
ans = 0
for i in range(N):
X, Y = list(map(int, input().split()))
if (X**2 + Y**2) ** 0.5 <= D: ans += 1
print(ans)
|
p03073 | s749481603 | Accepted | s=input()
cnt=0
for i in range(len(s)):#白黒白黒...
if i%2==0:
if s[i]=="0":
cnt+=1
else:
if s[i]=="1":
cnt+=1
print(min(cnt,len(s)-cnt)) |
p03317 | s977621902 | Wrong Answer | def main():
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 10**10
for k in range(K):
v = 0
if k > 0:
v += 1
v += (N - k) // (K - 1)
if (N - k) % K > 1:
v += 1
if v < ans:
ans = v
print(ans)
if _... |
p02911 | s299219999 | Wrong Answer | n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k-q]*n
for i in range(q):
p[a[i]-1] += 1
print(p)
for n in p:
if n>0:
print("Yes")
else:
print("No")
|
p03386 | s501656592 | Accepted | a, b, k = map(int, input().split())
for i in range(k):
if a + i > b:
break
print(a + i)
start = max(a+k, b-k+1)
for i in range(start, b+1):
print(i)
|
p02630 | s438796316 | Accepted | N = int(input())
A = list(map(int,input().split()))
num_count = [0]*(10**5+1)
tmp_sum = sum(A)
for i in A:
num_count[i] += 1
for q in range(int(input())):
B,C = map(int,input().split())
gain = C*(num_count[B])
loss = B*(num_count[B])
num_count[C] += num_count[B]
num_count[B] = 0
tmp_sum = ... |
p03657 | s217746491 | Accepted | a, b = map(int, input().split())
print(("Impossible", "Possible")[a % 3 * b % 3 * (a + b) % 3 == 0]) |
p03319 | s686953344 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = int((N-1)/(K-1))
if (N-1)%(K-1) == 0:
print(ans)
else:
print(ans+1) |
p03827 | s229129758 | Accepted | n = int(input())
l = list(input())
ans =[0]
for i in range(n):
if l[i] == "D":
ans.append(ans[i] - 1)
else:
ans.append(ans[i] + 1)
print(max(ans))
|
p02689 | s499688111 | Accepted | n,m = map(int,input().split())
h = [int(x) for x in input().split()]
mem = [[] for _ in range(n)]
for i in range(m):
a, b = map(int,input().split())
mem[a-1].append(b-1)
mem[b-1].append(a-1)
ans = 0
for j in range(n):
flag = 1
for k in range(len(mem[j])):
if h[j] <= h[mem[j][k]]:
... |
p03252 | s223275560 | Accepted | s=input()
t=input()
ar1=[0]*26
ar2=[0]*26
for i in s:
ar1[ord(i)-97]+=1
for i in t:
ar2[ord(i)-97]+=1
ar1.sort()
ar2.sort()
if ar1==ar2:
print("Yes")
else:
print("No") |
p02597 | s527508144 | Wrong Answer | n=int(input())
a=list(input())
c=a.count("W")
b=a[:n-c]
d=b.count("W")
print(d)
print(b) |
p03555 | s374392789 | Accepted | C=[list(input()) for i in range(2)]
if C[0][0]==C[1][2] and C[0][1]==C[1][1] and C[0][2]==C[1][0]:
print('YES')
else:
print('NO') |
p03695 | s442576551 | Accepted | with open(0) as f:
N, *a = map(int, f.read().split())
Set = set()
free = 0
for x in a:
x //= 400
if x < 8:
Set.add(x)
else:
free += 1
Ans = [max(1, len(Set)), len(Set)+free]
print(*Ans)
|
p02819 | s151854720 | Accepted | X=int(input())
while(1):
if all(X%i for i in range(2,int(X**0.5)+1)):
print(X)
break
X+=1 |
p03380 | s080911846 | Wrong Answer | n = int(input())
A = list(map(int, input().split()))
A = list(sorted(A))
a = A[-1]
b = A[n//2]
# print(a, b)
if n == 2:
print(a, A[0])
else:
print(a, A[n//2]) |
p03438 | s216421519 | Accepted | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ab = [0] * N
for i in range(N):
ab[i] = B[i] - A[i]
m = sum(ab)
ab = sorted(ab, reverse=True)
import math
f, g = 0, 0
for c in ab:
if c > 0:
f += math.ceil(c/2)
elif c < 0:
g += -c
if max(f, g) <= m:
... |
p03071 | s452076209 | Wrong Answer | x,y=map(int,input().split())
print(max(max(x,y)*2-1,x*2)) |
p02760 | s581723593 | Wrong Answer | bingo = []
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
N = int(input())
for i in range(N):
n = int(input())
if n in a:
a[a.index(n)] = 0
elif n in b:
b[b.index(n)] = 0
elif n in c:
c[c.index(n)] = 0
if sum(a) == 0 or... |
p02861 | s875953985 | Accepted | n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]
from itertools import permutations
count = 0
dist = 0
for l in list(permutations(xy)):
tmp = 0
for i in range(len(l)-1):
tmp += ((l[i+1][0]-l[i][0])**2+(l[i+1][1]-l[i][1])**2)**0.5
dist += tmp
count += 1
print(dist/count)
... |
p02647 | s751423685 | Wrong Answer | import copy
n, k = map(int, input().split())
a = list(map(int, input().split()))
while k > 0:
b = [0 for i in range(n)]
for i in range(n):
for j in range(n):
if j - a[j] - 0.5 < i and i < j + a[j] + 0.5:
b[i] += 1
a = copy.copy(b)
k -= 1
for i in range(n):
print(b[i], ',', end = ... |
p03352 | s889191702 | Wrong Answer | a = int(input())
print(max(j ** i for j in range(32) for i in range(2, 10) if j ** i >= a)) |
p03644 | s916757147 | Accepted | N = int(input())
if N<2:
print(1)
elif N>=2 and N<4:
print(2)
elif N >=4 and N<8:
print(4)
elif N>=8 and N<16:
print(8)
elif N>=16 and N<32:
print(16)
elif N>=32 and N<64:
print(32)
elif N>= 64:
print(64) |
p03627 | s036297326 | Accepted | N = int(input())
A = [int(a) for a in input().split()]
A.sort(reverse=True)
a = 0
b = 0
i = 1
while i < N:
if A[i] == A[i-1] and a == 0:
a = A[i]
i += 2
elif A[i] == A[i-1] and b == 0:
b = A[i]
i += 2
else:
i += 1
print(a*b) |
p03644 | s370627433 | Wrong Answer | N=int(input());result=0
for i in range(N+1):
if 2**i < N:
result = 2**i
print(result) |
p02793 | s828932995 | Wrong Answer | # = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]
from fractions import gcd
n = int(input())
p = list(map(int, input().split()))
if n == 1:
print(1)
exit()
MOD = 10 ** 9 + 7
#def gcd(a, b):
# whil... |
p03767 | s536881983 | Accepted | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
A = sorted(iil(),reverse=True)[1::2]
print(sum(A[:n]))
|
p02917 | s912530683 | Accepted | n = int(input())
b = list(map(int, input().split()))
a = [0] * n
a[0] = b[0]
for i in range(1, n):
a[i] = b[i-1]
if a[i - 1] > b[i - 1]:
a[i - 1] = b[i - 1]
print(sum(a))
|
p02861 | s751086977 | Accepted | from itertools import permutations
from math import factorial
def d(a, b):
x1, y1 = a
x2, y2 = b
return ((x1-x2)**2 + (y1-y2)**2)**0.5
cnt = 0
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
for l in permutations(XY):
for i in range(n-1):
cnt += d(l[i], l[i+1])
cnt /= factorial(n)... |
p02772 | s676895856 | Accepted | N = int(input())
A = list(map(int, input().split()))
temp_list = []
flag = 1
for i in range(N):
if A[i] % 2 == 0:
temp_list.append(A[i])
for i in range(len(temp_list)):
if not (temp_list[i] % 3 == 0 or temp_list[i] % 5 == 0):
flag = 0
if flag == 1:
print('APPROVED')
else:
print('DENIED') |
p03427 | s507263522 | Accepted | #!/usr/bin/env python3
s = input()
digit = len(s)
if s[1:] == "9"*(digit-1):
print(int(s[0])+9*(digit-1))
else:
print(int(s[0])+9*(digit-1)-1) |
p02681 | s256865190 | Accepted | s = input()
t = input()
if len(s) >= 1 and len(s) <= 10 and len(t) == len(s) + 1 and t.startswith(s):
print("Yes")
else:
print("No") |
p03637 | s097770425 | Accepted | """import sys
input = sys.stdin.readline"""
n=int(input())
a=list(map(int,input().split()))
cnt2=0
cnt4=0
for i in a:
if i%4==0:
cnt4+=1
elif i%2==0:
cnt2+=1
if cnt2>1:
ans=n-cnt4*2-cnt2
if cnt2<=1:
ans=n-cnt4*2-1
print("Yes" if ans<=0 else "No")
|
p02729 | s612892716 | Accepted | def bikkuri(n):
if n <= 0:
return 1
else:
return n * bikkuri(n - 1)
nm = input().split(" ")
print(bikkuri(int(nm[0])) // (bikkuri(int(nm[0]) - 2) * 2) * (0 if int(nm[0]) < 2 else 1) + bikkuri(int(nm[1])) // (bikkuri(int(nm[1]) - 2) * 2) * (0 if int(nm[1]) < 2 else 1)) |
p03284 | s645086538 | Accepted | n, k = map(int, input().split())
if n % k == 0:
print(0)
else:
print(1)
|
p02963 | s727489669 | Wrong Answer | s = int(input())
div, mod = divmod(s, 10 ** 9)
ans = [0, 0, 10 ** 9, 1, 0, div]
if mod != 0:
ans[5:] = [10 ** 9 - mod, div + 1]
print(*ans)
|
p02600 | s417381470 | Accepted | x = int(input())
if x < 600:
print(8)
elif x < 800:
print(7)
elif x < 1000:
print(6)
elif x < 1200:
print(5)
elif x < 1400:
print(4)
elif x < 1600:
print(3)
elif x < 1800:
print(2)
elif x < 2000:
print(1)
|
p03815 | s860037863 | Wrong Answer | x=int(input())
a=x%11
b=x//11
if 0<a<6:
ans=2*b+1
elif a==0:
ans=2*b
else:
ans=2*(b+1)
print(ans) |
p02843 | s341130057 | Wrong Answer | x = int(input())
n = x%100
if x < 100:
print(0)
exit()
if n%5:
if 100*(n//5+1) < x-n:
print(1)
else:
print(0)
else:
if 100*(n//5) < x-n:
print(1)
else:
print(0)
|
p03821 | s183990048 | Accepted | N=int(input())
AB=[tuple(map(int, input().split()))for _ in range(N)]
ans=0
for i in range(N-1,-1,-1):
a,b=AB[i]
ans+=b-(a+ans-1)%b-1
print(ans) |
p02618 | s262079331 | Accepted | d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
s.append(list(map(int,input().split())))
last=[0]*26
for day in range(d):
co=[]
dla=[]
down=0
for (i,j) in zip(last,c):
down+=i*j
for (i,j) in zip(last,c):
dla.append(down-(j*(day-i)))
for con in range(26):
co.append(s[da... |
p02633 | s719677536 | Accepted | x=int(input())
i=1
while True:
y=i*360/x
i+=1
if y%1==0:
break
print(int(y)) |
p03071 | s102239207 | Accepted | A, B = map(int, input().split(' '))
large = max(A, B)
small = min(A, B)
total = large
large -= 1
total += max(large, small)
print(total)
|
p03339 | s208133379 | Accepted | n=int(input())
s=input()
t=[0]*n
if s[0]=="W":
t[0]=-1
else:
t[0]=1
for i in range(1,n):
if s[i]=="W":
t[i]=-1+t[i-1]
else:
t[i]=1+t[i-1]
max1=max(t)
a=t.index(max1)
ans=0
ans+=s[:a].count("W")
ans+=s[a+1:].count("E")
print(ans)
|
p02860 | s154268896 | Accepted | n = int(input())
s = input()
count = 0
if n % 2 == 0:
for i in range(n//2):
if s[i] != s[i+n//2]:
count += 1
else:
count +=1
if count == 0:
print("Yes")
else:
print("No") |
p03495 | s388188617 | Wrong Answer | str = input().split(" ")
num = input().split(" ")
goal = int(str[1])
arr = {}
for i in num:
i = int(i)
if arr.get(i, False):
arr[i] += 1
else:
arr[i] = 1
arr = dict(sorted(arr.items(), key=lambda d: d[1], reverse=True))
count = 0
for index, (i, key) in enumerate(arr.items()):
if (index + 1) > goal:
count... |
p02578 | s509566040 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
step = [0] * N
for i, a in enumerate(A[1:], 1):
step[i] = -min(0, A[i - 1] + step[i - 1] - a)
print(sum(step)) |
p02836 | s282548531 | Wrong Answer | def actual(s):
N = len(s)
count_operation = 0
for i in range(N):
head = s[i]
tail = s[N - 1 - i]
if head != tail:
count_operation += 1
return count_operation / 2
s = input()
print(actual(s)) |
p02639 | s572770956 | Wrong Answer | x = [int(x) for x in input().split()]
for i in range(len(x)):
if(x[i]==0):
print(i)
|
p02742 | s345214948 | Accepted | # coding: utf-8
import math
h, w = map(int, input().split())
m = (h * w)
if h == 1:
print(1)
exit()
if w == 1:
print(1)
exit()
if m % 2 == 0:
print(int(m / 2))
else:
print(math.floor(m / 2) + 1)
|
p02664 | s742365622 | Accepted | T = str(input())
A = T.replace('?','D')
print(A) |
p02972 | s355465885 | Accepted | import math
N = int(input())
A = [0] + list(map(int, input().split( )))
B = [0]*(N+1)
s = 0
for i in reversed(range(1, N+1)):
ball = 0
for j in range(i,N+1,i):
ball += B[j]
if ball%2 != A[i]:
B[i] = 1
s += 1
print(s)
print(*[i for i, b in enumerate(B) if b == 1], sep=' ') |
p02814 | s268434378 | Accepted | from fractions import gcd
from math import ceil
def f(x):
cnt=0
while x%2==0:
x//=2
cnt+=1
return cnt
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[a[i]//2 for i in range(n)]
g=b[0]
for i in range(1,n):
g=g*b[i]//gcd(g,b[i])
t=f(a[0])
for i in range(n):
if t!=f(a[i]):
print(0)
... |
p02755 | s254564316 | Accepted | a,b = input().split()
a = int(a)
b = int(b)
c = 0
for i in range(1001):
d = c*0.08
e = c*0.1
d = int(d)
e = int(e)
if d == a and e == b:
print(c)
break
elif c == 1000:
print('-1')
break
else:
c += 1 |
p03943 | s740025450 | Wrong Answer | a, b, c = map(int, input().split())
if a == b + c or b == a + c or c == a + b:
print("YES")
else:
print("NO") |
p03041 | s114841454 | Accepted | n,k = map(int, input().split())
s = list(str(input()))
s[k-1] = s[k-1].lower()
print(''.join(s))
|
p03637 | s697858845 | Accepted | N = int(input())
a = [int(x) for x in input().split()]
cnt4 = 0
cnt2 = 0
for x in a:
if x % 4 == 0:
cnt4 += 1
continue
if x % 2 == 0:
cnt2 += 1
cnt2 = cnt2//2*2
if N-cnt2 > 2*cnt4+1:
print('No')
else:
print('Yes') |
p02700 | s252998559 | Accepted | A,B,C,D = map(int, input().split())
THP = A
AHP = C
while(True):
#高橋のターン
AHP -= B
if(AHP <= 0):
print("Yes")
break
#青木のターン
THP -= D
if(THP <= 0):
print("No")
break |
p03637 | s592415957 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
count2 = 0
count4 = 0
for i in range(n):
#2の倍数だが4の倍数でない
if a[i]%2 == 0 and a[i]%4 != 0:
count2 += 1
#4の倍数
elif a[i]%4 == 0:
count4 += 3
#print(count2,count4)
#2の倍数が奇数か偶数か判定
if count2 >= 2 and count2%2 == 0:
count4 += count2
elif c... |
p02796 | s717639998 | Accepted | N = int(input())
X = []
for i in range(N):
x,l = list(map(int,input().split()))
X.append([x-l,x+l])
X.sort(key = lambda x: x[1])
count = 0
prev = -10**27
for i in range(N):
if prev<=X[i][0]:
prev = X[i][1]
count+=1
print(count)
|
p03059 | s822255143 | Accepted | A,B,T = map(int,input().split())
time = 0
bis = 0
while (time + A <= T+0.5):
bis += B
time += A
print(bis)
|
p02570 | s642948902 | Accepted | d,t,s = map(int,input().split())
if s*t - d >=0:
print("Yes")
else:
print("No") |
p02720 | s659738668 | Wrong Answer | lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
k = int(input())
index = 0
while True:
if len(lun_luns) >= k:
break
num = lun_luns.pop(index)
lun_luns.insert(index, num)
mod = num % 10
n = num * 10
if mod == 9:
lun_luns.extend([n+mod-1, n+mod])
else:
lun_luns.extend([n+mod-1, n+mod, n+mod+1])
index += 1
print(lun_... |
p02819 | s745285828 | Accepted | import math
def prim(x):
for i in range(2,math.floor(math.sqrt(x))):
if not x%i:
return 0
return 1
def np(x):
while(1):
if prim(x):
return x
else:
x+=1
print(np(int(input()))) |
p03160 | s040554217 | Accepted | N = int(input())
H = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
for n in range(1,N):
dp[n] = min(dp[n], dp[n-1]+abs(H[n]-H[n-1]))
if n >= 2:
dp[n] = min(dp[n], dp[n-2]+abs(H[n]-H[n-2]))
print(dp[-1]) |
p02623 | s320126274 | Wrong Answer | ##C
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
##print(A+B)
C = A+B
##print(C)
i = 0
j = 0
goukei = 0
if K >= sum(C):
print(N+M)
else:
A = A+[10**9]
B = B+[10**9]
while goukei <= K:
if A[i] <= B[j]:
goukei += A[i]
... |
p02899 | s959998508 | Wrong Answer | n = int(input())
A = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
ans[i] = A.index(i+1) + 1
print(ans) |
p02790 | s612021062 | Wrong Answer | a, b = map(int, input().split())
if a < b:
print(a * int(b))
else:
print(b * int(a)) |
p03380 | s478978999 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
N = max(a)
res = 10**10
k = []
for i in range(n):
if abs(a[i]-N/2) <= res:
res = abs(a[i] -N/2)
k.append(a[i])
k.sort()
print(N,k[0])
|
p03043 | s380433795 | Wrong Answer | def abc126c():
import math
n, k = map(int, input().split())
ans = 0.0
for i in range(1, min(k, n + 1)):
v = math.ceil(math.log2(k / i))
ans += math.pow(0.5, v)
if n > k:
ans += n - k + 1
print((1 / n) * ans)
abc126c() |
p03943 | s837045630 | Accepted | a,b,c=sorted(map(int,input().split()))
print("Yes" if a+b==c else "No") |
p02711 | s716135504 | Accepted | # -*- coding: utf-8 -*-
input_line = input()
N = list(input_line)
for i in N:
if i=='7':
print('Yes')
quit()
print('No')
|
p02777 | s163870876 | Accepted | a,b = input().split()
A,B = input().split()
c = input()
a = str(a)
b = str(b)
A = int(A)
B = int(B)
c = str(c)
d = A - 1
D = B - 1
if c == a:
print(d,B)
elif c == b:
print(A,D) |
p02554 | s096837205 | Accepted | N=int(input())
MOD=10**9+7
ans=10**N %MOD
ans=ans-2*9**N %MOD
ans=ans+8**N %MOD
print(ans%MOD) |
p02768 | s782325382 | Accepted | n, a, b = map(int,input().split())
mod = 10**9+7
def combi(n,r):
x, y = 1,1
for i in range(n-r+1,n+1):
x *= i
x %= mod
for j in range(1,r+1):
y *= j
y %= mod
yinv = pow(y,mod-2,mod)
return x*yinv%mod
def main():
nca = combi(n,a)
ncb = combi(n,... |
p02789 | s109685911 | Accepted | n,m=map(int,input().split())
if n==m:
print("Yes")
else:
print("No") |
p02675 | s383923065 | Accepted | n = int(input())
if n%10 == 2 or n%10 ==4 or n%10 ==5 or n%10 ==7 or n%10 ==9:
print('hon')
elif n % 10 == 0 or n%10 ==1 or n%10 ==6 or n%10 == 8:
print('pon')
else:
print('bon') |
p02743 | s158474091 | Accepted | a,b,c = [int(s) for s in input().split()]
r = (c-a-b)**2
l = 4*a*b
if (c-a-b)<0:
print('No')
elif l<r:
print('Yes')
else:
print('No') |
p02582 | s444487217 | Accepted | from sys import stdin
input = stdin.readline
s = input()
a = b = c = 0
a = (s[0] == 'R') * 1
b = (s[1] == 'R') * (1 + a)
c = (s[2] == 'R') * (1 + b)
print(max(a, b, c))
|
p02832 | s365173220 | Accepted | import sys
input = sys.stdin.readline
# D - Brick Break
n = int(input())
a = list(map(int, input().split()))
i = 1
bricks = 0
for ai in a:
if ai == i:
bricks += 1
i += 1
if bricks == 0:
print(-1)
else:
print(n - bricks) |
p03241 | s611075191 | Accepted | def make_divisors(m,n):
divisors = []
ans = 0
for i in range(1, int(n**0.5)+1):
if n % i == 0 and m <= n//i and ans < i:
ans = i
if i != n//i and m <= i and ans < n//i:
ans = n//i
print(ans)
n,m = map(int, input().split())
make_divisors(n,m)
|
p03433 | s576015994 | Accepted | import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N = int(input())
A = int(input())
print("Yes" if N % 500 <= A else "No") |
p03323 | s897828108 | Accepted | A,B = map(int,input().split())
print("Yay!" if A <= 8 and B <= 8 else ":(")
|
p02935 | s102781214 | Wrong Answer | import numpy as np
N = int(input())
M = np.fromiter(input().split(), dtype=int)
K = (0.5) ** np.arange(1, N+1)
K[-1] = K[-2]
print(np.dot(M, K)) |
p03434 | s983486573 | Wrong Answer | N = int(input())
M = map(int,input().split())
M = sorted(M)
alice = 0
bob = 0
for i in range(N):
if i % 2 == 0:
alice += M[i]
else:
bob += M[i]
print(alice - bob) |
p02983 | s919019030 | Accepted | MOD = 2019
l, r = map(int, input().split())
if r - l >= 2019:
print(0)
exit()
lst = []
for num in range(l, r + 1):
lst.append(num % MOD)
ans = 2020
ll = len(lst)
for i in range(ll):
for j in range(i + 1, ll):
tmp = (lst[i] * lst[j]) % MOD
ans = min(ans, tmp)
print(ans) |
p02777 | s580367566 | Accepted | S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())
if S == U:
A -=1
elif T == U:
B -=1
print(A, B)
|
p02813 | s211118960 | Accepted | f=lambda:tuple(map(int,input().split()))
n=int(input())
tp,tq=f(),f()
import itertools as it
l=list(it.permutations(range(1,n+1)))
print(abs(l.index(tp)-l.index(tq))) |
p02714 | s629943973 | Accepted | N=int(input())
S=input()
r=S.count('R')
g=S.count('G')
b=S.count('B')
count=r*g*b
for i in range(N):
for d in range(N):
j=i+d
k=j+d
if k>=N:
break
if S[i] != S[j] and S[j] !=S[k] and S[k] != S[i]:
count -=1
print(count)
|
p02848 | s689923671 | Wrong Answer | n = int(input())
s = input()
l = len(s)
ans = ""
z = ord("Z") - 1
for i in range(l):
k = ord(s[i]) + n
if k > z:
k = k - z + ord("A")
ans = ans + chr(k)
print(ans) |
p02848 | s665539002 | Accepted | '''input
2
ABCXYZ
'''
# A coding delight https://ideone.com/m98Hht
from sys import stdin
input = stdin.readline
# main starts
n = int(input().strip())
string = list(input().strip())
for i in range(len(string)):
if ord(string[i]) + n > 90:
string[i] = chr(64 + n - (90 - ord(string[i])))
else:
string[i] = chr(ord... |
p02982 | s810345258 | Wrong Answer | N, D = map(int, input().split())
X=[]
f=0
for i in range(N):
X.append(list(map(int,input().split())))
for i in range(N-1):
for j in range(i+1, N):
ans=0
print(X[i] , X[j])
for k in range(D):
ans = ans + (X[i][k] - X[j][k])**2
ans = (ans)**0.5
print(ans)
... |
p02676 | s297122480 | Accepted | def main():
K = int(input())
S = str(input())
if len(S) <= K:
print(S)
else:
print(S[0:K] + "..." )
if __name__ == "__main__":
main()
|
p02843 | s427730188 | Accepted | X = int(input())
c = X // 100
d = X - 100 * c
for _ in range(c):
if (d == 0):
break
elif (d >= 5):
d -= 5
else:
d -= d
if (d == 0):
print(1)
else:
print(0)
|
p02577 | s184738178 | Wrong Answer | def is_sum_nine(str_N):
if str_N == "0" or str_N == "9":
return True
sum = 0
for i in range(len(str_N)):
sum += int(str_N[i])
if len(str(sum)) < 5:
if sum % 9 == 0:
return True
else:
return False
else:
is_sum_nine(str(sum))
def main()... |
p02552 | s091368358 | Accepted | n=int(input())
if n:
print(0)
else:
print(1) |
p03328 | s394106614 | Accepted | a,b = map(int,input().split())
c = b-a
cnt =0
for i in range(c):
cnt += (i+1)
print(cnt-b) |
p02743 | s955869663 | Accepted | def main():
a,b,c = map(int,(input().split()))
if c-a-b <0:
print('No')
elif 4*a*b - (c-a-b)**2 < 0:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
|
p02900 | s192941662 | Accepted | import fractions
A, B = map(int, input().split())
def factorize(n):
b = 2
fct = []
while b * b <= n:
while n % b == 0:
n //= b
fct.append(b)
b = b + 1
if n > 1:
fct.append(n)
return fct
g=fractions.gcd(A, B)
#print(g)
lst=factorize(g)
#print(lst)
pri... |
p02793 | s689107898 | Accepted | from fractions import gcd
N=int(input())
A=list(map(int,input().split(' ')))
L = 1
def lcm(x,y):
return x//gcd(x,y)*y
for a in A:
L = lcm(L,a)
ans=0
for a in A: ans+=L//a
print(ans%(10**9+7)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.