problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02939 | s277983687 | Accepted | def solve():
S = input()
N = len(S)
dp1,dp2 = [0]*(N+1),[0]*(N+1)
dp1[1] = 1
for i in range(2,N+1):
dp1[i] = dp2[i-1]+1
if S[i-1]!=S[i-2]:
dp1[i] = max(dp1[i-1]+1,dp1[i])
dp2[i] = dp1[i-2]+1
if i<4 or S[i-2:i]!=S[i-4:i-2]:
dp2[i] = max(dp2[i],dp2[i-2]+1)
ans = max(dp1[-1],dp2[-1]... |
p02771 | s241251108 | Wrong Answer | a, b, c = map(int, input().split())
if a == b and a == c:
print('No')
elif a != b and a != c:
print('No')
else:
print('Yes') |
p03456 | s775645588 | Accepted | a,b = input().split()
c = int(a+b)
print("Yes" if c**0.5 == int(c**0.5) else "No") |
p03486 | s752065002 | Accepted | s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
s = "".join(s)
t = "".join(t)
if s == t:
print("No")
exit()
ans = [s,t]
ans2 = sorted(ans)
if ans == ans2:
print("Yes")
else:
print("No")
|
p03495 | s889275188 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
C = list(set(A))
B = len(C)
x = B - K
d = {}
for i in A:
if i in d:
d[i] += 1
else:
d[i] = 1
d = sorted(d.items(), key=lambda x:x[1])
ans = 0
count = 0
if x<=0:
print('0')
else:
for key, value in d:
ans... |
p03219 | s591942343 | Accepted | def main():
from sys import stdin
r = stdin.readline()[:-1]
#r = stdin.readlines()
x, y = map(int, r.split())
print(x+y//2)
if __name__ == '__main__':
main()
|
p03329 | s836804618 | Accepted | n = int(input())
INF = 10 ** 8
dp = [INF] * 100010
dp[0] = 0
for i in range(1, n + 1):
p = 1
while p <= i:
dp[i] = min(dp[i], dp[i - p] + 1)
p *= 6
p = 1
while p <= i:
dp[i] = min(dp[i], dp[i - p] + 1)
p *= 9
print(dp[n])
|
p02972 | s119961839 | Accepted | import sys
input = sys.stdin.readline
def main():
N = int(input())
b = list(map(int, input().split()))
lst = b[:]
for i in range(N,0,-1):
j = i
a = 0
while j <=N: a, j = a^lst[j-1], j+i
lst[i-1] = a
ans = [i+1 for i in range(N) if lst[i]]
print(len(ans))
prin... |
p02633 | s241504730 | Accepted | import numpy as np
import math
import collections
if __name__ == '__main__':
n = int(input())
print(int(np.lcm(360,n)/n)) |
p03665 | s113388543 | Accepted | n, p = map(int, input().split())
a = list(map(int, input().split()))
odd = [i for i in a if i % 2 == 1]
even = [i for i in a if i % 2 == 0]
ecnt = pow(2, len(even))
ocnt = pow(2, max(len(odd)-1,0))
print(0 if (len(odd) == 0 and p == 1) else ecnt * ocnt)
|
p03486 | s238806735 | Wrong Answer | a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
k = sorted([aa, bb])
if k[0] == aa:
print('Yes')
else:
print('No') |
p02829 | s913266842 | Accepted | A = int(input())
B = int(input())
l = [1,2,3]
l.remove(A)
l.remove(B)
print(l[0]) |
p02629 | s174149644 | Accepted | alfa=['z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y']
n = int(input())
ans=''
while n>0:
ans+=alfa[n%26]
n=n-1
n=n//26
print(ans[::-1])
|
p03699 | s437398754 | Wrong Answer | n= int(input())
List = []
for i in range(n):
x = int(input())
List.append(x)
List = sorted(List)
total = sum(List)
for item in List:
if total % 10 == 0:
total -= item
else:
break
print(total) |
p02879 | s732374024 | Wrong Answer | a, b = map(int, input().split())
print(-1 if (([a, b] < [1, 1]) or ([a, b] > [9, 9])) else a * b) |
p03105 | s657700043 | Accepted | a, b, c = map(int, input().split())
print(min(c, b // a)) |
p03951 | s185800291 | Accepted | n=int(input())
s=input()
t=list(input())
import re
ans=s
k=-1
for i in range(n):
tmp=''.join(t[:i+1])
if tmp in ans:
k=i
if k<n-1:
ans+=''.join(t[k+1:])
print(len(ans))
|
p03699 | s317268021 | Accepted | N = int(input())
A = [int(input())for _ in range(N)]
A.sort()
ans = sum(A)
if ans % 10 == 0:
for a in A:
if a % 10 != 0:
ans -= a
break
else:
ans = 0
print(ans) |
p02628 | s296166006 | Accepted | n, k = map(int, input().split())
*p, = sorted(map(int, input().split()))
ans = sum(p[:k])
print(ans) |
p03723 | s998848904 | Accepted | a,b,c = map(int, input().split(" "))
pr=True
count=0
while(a%2==0 and b%2==0 and c%2==0):
ta,tb,tc=a,b,c
a=tb/2+tc/2
b=ta/2+tc/2
c=ta/2+tb/2
count += 1
if ta == a and tb == b and tc == c:
print(-1)
pr=False
break
if pr:
print(count) |
p02988 | s716806735 | Accepted | n = int(input())
s = list(map(int,input().split()))
c = 0
for i in range(n-2):
if s[i+1] != min(s[i],s[i+1],s[i+2]) and s[i+1] != max(s[i],s[i+1],s[i+2]):
c += 1
print(c) |
p02861 | s664836738 | Accepted | import math
n=int(input())
m = [list(map(int, input().split())) for _ in range(n)]
ans=0
for i in range(n):
for j in range(i+1,n):
ans+=math.sqrt((m[i][0]-m[j][0])**2 + (m[i][1]-m[j][1])**2)
print(ans*2/n) |
p02880 | s736303071 | Accepted | n = int(input())
print("Yes" if any([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No") |
p02695 | s444190015 | Wrong Answer | n,m,q = [int(i) for i in input().split()]
p = []
for i in range(q):
p.append([int(i) for i in input().split()])
dmax = 0
a = [1 for i in range(n)]
while True:
d = 0
for i in range(q):
if a[p[i][1]-1]-a[p[i][0]-1] == p[i][2]:
d += p[i][3]
if d > dmax:
dmax = d
if a[0] == 10:
break
c = 1
l... |
p02723 | s824315268 | Accepted | s = input()
if s[2] == s[3] and s[4] == s[5]:
print("Yes")
else:
print("No") |
p03136 | s341858606 | Accepted | n = int(input())
l = list(map(int, input().split()))
l.sort()
max_num = l.pop(-1)
if max_num < sum(l):
print('Yes')
else:
print('No') |
p02818 | s354136575 | Accepted | A, B, K = [int(i) for i in input().split()]
if (A + B) <= K:
print(0, 0)
elif A <= K:
print(0, B - (K - A))
else:
print(A - K, B) |
p03035 | s026963485 | Wrong Answer | a,b = map(int,input().split())
if a <=5:
print("0")
elif 12 >= a >= 6:
print("50")
else:
print(b) |
p03607 | s265835152 | Wrong Answer | N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans = 0
a = A[0]
n = 0
for i in range(N):
if a == A[i]:
n += 1
else:
if n % 2 == 1:
ans += 1
n = 0
a = A[i]
print(ans) |
p03607 | s520357759 | Wrong Answer | n=int(input())
num=[]
l=[]
count=0
for _ in range(n):
a=int(input())
l.append(a)
l=sorted(l)
print(l)
for i in l:
if num==[]:
num.append(i)
elif num[0]!=i:
if len(num)%2!=0:
count+=1
num=[i]
else:
num.append(i)
print(count) |
p03105 | s578084143 | Accepted | A,B,C = list(map(int,input().split()))
count = B // A
if count < C:
print(count)
else:
print(C) |
p03239 | s847582384 | Wrong Answer | N,T=map(int,input().split())
cost=10001
ans=0
for i in range(N):
c,t=map(int,input().split())
if t<T and c<cost:
cost=c
ans=cost
if ans==0:
print('TLE')
else:
print(ans) |
p02838 | s489565401 | Accepted | N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
sum_all = 0
p = 1
for i in range(60):
ones = 0
zeros = 0
x = 1 << i
for a in A:
if a & x:
ones += 1
else:
zeros += 1
sum_all += p * ones * zeros % MOD
p *= 2 % MOD
print(sum_all % M... |
p02982 | s510308013 | Accepted | N,D = map(int,input().split())
P = []
for i in range (N):
P.append(list(map(int, input().split())))
Pi = 0
for i in range(N):
for j in range(i+1, N):
Di = 0
for k in range (D):
Di += (P[i][k]-P[j][k])**2
if int(Di**0.5) == Di**0.5:
Pi += 1
print(Pi) |
p02766 | s487454779 | Accepted | N, K = map( int, input().split() )
import math
print( math.floor( math.log( N, K ) ) + 1 ) |
p02576 | s197177460 | Wrong Answer | import math
n,x,t = map(float,input().split())
if n%x == 0:
c = n/x
else:
c = math.ceil(n/x)
a = c*t
print(a) |
p03293 | s661390412 | Accepted | s = input()
t = input()
l = len(s)
for i in range(l):
temp = s[i:]+s[:i]
if temp == t:
print("Yes")
exit()
print("No") |
p03339 | s286254547 | Wrong Answer | N = int(input())
S = input()
l = S
r = S[::-1]
w = [0]*(N+1)
e = [0]*(N+1)
for i in range(N):
if l[i] == "W":
w[i+1] = 1
if r[i] == "E":
e[i+1] = 1
for i in range(N-1):
w[i+1] += w[i]
e[i+1] += e[i]
ans = N
for i in range(N):
d = w[i-1] + e[N-i-1]
ans = min(ans,d)
prin... |
p02647 | s146783641 | Wrong Answer | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, K = mapint()
now = list(mapint())
from itertools import accumulate
iteration = min(N.bit_length()*2, K)
for k in range(iteration):
nx = [0]*N
for i, a in enumerate(now):
... |
p03545 | s674537925 | Accepted | A,B,C,D = input()
op = ["+","-"]
for i in op:
for j in op:
for k in op:
ans = A+i+B+j+C+k+D
if eval(ans)==7:
print(ans+"=7")
exit() |
p03136 | s746445185 | Accepted | n=int(input())
l=list(map(int,input().split()))
l_max=max(l)
print('Yes' if l_max<sum(l)-l_max else 'No') |
p02948 | s271688523 | Wrong Answer | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = []
for _ in range(N):
u, v = map(int, input().split())
a.append((u, v))
a.sort(key = lambda x: (-x[1], -x[0]))
res = 0
day = 0
for i in range(N):
u, v = a[i]
if day + u <= M:
day += 1
res += v
print(res) |
p03555 | s892367564 | Accepted | C=[0,0]
C[0]=list(map(str,input()))
C[1]=list(map(str,input()))
ans="NO"
X=C[0][::-1]
if C[1]==X:
ans="YES"
print(ans) |
p03106 | s318766266 | Accepted | # solution
import io
n,m,k=map(int, input().split())
data=n
while k:
if n%data==m%data==0:
k-=1
data-=1
print(data+1) |
p03625 | s261181961 | Accepted | from collections import *
n=int(input())
l=list(map(int,input().split()))
d=defaultdict(int)
for i in l:
d[i]+=1
x=[]
for i in d:
if(d[i]>=4):
x.append(i)
x.append(i)
elif(d[i]>=2):
x.append(i)
x.sort(reverse=True)
if(len(x)<2):
print(0)
else:
print(x[0]*x[1]) |
p03665 | s856584658 | Wrong Answer | N,P = list(map(int, input().split()))
a = list(map(int, input().split()))
num_odd = sum([i%2== 1 for i in a])
num_even = N - num_odd
ce = 2 ** num_even
co = 2 ** (num_odd - 1)
if P==1:
if num_odd == 0:
co = 0
print(co * ce) |
p02789 | s194025182 | Accepted | a,b = input().split()
a = int(a)
b = int(b)
if a==b:
print("Yes")
else:
print("No")
|
p03862 | s434922501 | Accepted | n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0
t=l[0]
for a in l[1:]:
d=t+a-x
if d>0:
if a<d:
a=0
else:
a-=d
c+=d
t=a
print(c) |
p02706 | s231226775 | Wrong Answer | n, m = map(int, input().split())
a = list(map(int, input().split()))
x = n - sum(a)
print(x if x > 0 else -1) |
p02702 | s662168952 | Accepted | S=input()
ans,n=0,len(S)
dp=[0]*(2019)
s,dp[0],k=0,1,1
for i in S[::-1]:
s=(s+int(i)*k)%2019
k=(k*10)%2019
ans+=dp[s]
dp[s]+=1
print(ans) |
p03000 | s000474410 | Accepted | n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]
for i in range(n):
d.append(d[i]+l[i])
if d[i+1]>x:
print(i+1)
break
else:
print(n+1) |
p02847 | s910321583 | Wrong Answer | if input() == "SUN":
print(7) |
p02835 | s765411782 | Accepted | A1,A2,A3=map(int,input().split())
if(A1+A2+A3>=22):
print("bust")
else:
print("win")
|
p02631 | s468337402 | Wrong Answer | n = int(input())
a=list(map(int,input().split()))
forward = []
back = []
result = ''
t = 0
for i in range(n):
t ^= a[i]
forward.append(t)
t = 0
for i in range(n-1, -1, -1):
t ^= a[i]
back.append(t)
print(forward, back)
for i in range(n):
if i == 0:
t = back[n-2]
elif i == n-1:
t... |
p02987 | s586992119 | Accepted | import collections
S = list(input())
c = collections.Counter(S)
if all([cs == 2 for cs in c.values()]):
print('Yes')
else:
print('No')
|
p03163 | s528072081 | Accepted | N,W=map(int,input().split())
DP=[[0 for j in range(W+1)]for i in range(N+1)]
for i in range(N):
w,v=map(int,input().split())
for j in range(1,W+1):
if j>=w:
DP[i+1][j]=max(DP[i][j-w]+v,DP[i][j])
else:
DP[i+1][j]=DP[i][j]
print(DP[N][W])
|
p03821 | s188982467 | Accepted | n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n-1, -1, -1):
a = li[i][0]
b = li[i][1]
a += ans
if a%b == 0:
continue
s = b - a%b
ans += s
print(ans) |
p03524 | s672679497 | Accepted | #同じ文字の間隔を2文字以上空ける abcabcabc,,,,,
s=input()
if len(s)==1:
print("YES")
exit()
c=[0,0,0]
for i in range(len(s)):
if s[i]=="a":
c[0]+=1
elif s[i]=="b":
c[1]+=1
elif s[i]=="c":
c[2]+=1
if max(c)-min(c)>=2:
print("NO")
else:
print("YES") |
p02712 | s984981237 | Accepted | input = raw_input
n = int(input())
q3 = n // 3
q5 = n // 5
q15 = n // 15
out = n * (n+1) // 2 - ( 3 * q3 * (q3+1) // 2 + 5 * q5 * (q5+1) // 2) + 15 * q15*(q15+1) // 2
print(out) |
p03126 | s986915730 | Accepted | import numpy as np
n, m = map(int, input().split())
k = [0] * n
for i in range(n):
k[i] = list(map(int, input().split()))
b = np.zeros((n, m))
for i in range(n):
w = k[i]
for j in range(1, len(w)):
b[i, int(w[j])-1] = 1
print(sum(b.sum(axis=0) == n))
|
p03136 | s494479815 | Accepted | N = int(input())
L = sorted(list(map(int, input().split())))
print("Yes" if L[-1] < sum(L[:-1]) else "No")
|
p02583 | s092250183 | Accepted | n=int(input())
l=list(map(int, input().split()))
l.sort()
cnt=0
for i in range(n):
for j in range(i+1,n):
for k in range(j+1,n):
if l[i]<l[j] and l[j]<l[k]:
if l[i]+l[j]>l[k]:
cnt+=1
print(cnt) |
p03672 | s589860066 | Accepted | S = input()
for i in range(2,len(S)+1,2):
if S[:(len(S)-i)//2-1] == S[(len(S)-i)//2:len(S)-i-1]:
print(len(S)-i)
break |
p03555 | s813557366 | Accepted | C1 = input()
C2 = input()
if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] ==C2[0]:
print("YES")
else:
print("NO")
|
p02646 | s025010240 | Accepted | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if (V - W) * T >= abs(A - B):
print("YES")
else:
print("NO") |
p02613 | s952273993 | Accepted | n=int(input())
k=[]
for i in(range(n)):
k.append(str(input()))
ac=k.count('AC')
wa=k.count('WA')
tle=k.count('TLE')
re=k.count('RE')
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re) |
p02823 | s914521309 | Accepted | n,a,b=map(int,input().split())
if abs(a-b)%2==0:
print(abs(a-b)//2)
else:
temp=min(min(a-1,b-1),min(n-a,n-b))+1
print(min(temp+(abs(a-b)-1)//2,min(max(a-1,b-1),max(n-a,n-b)))) |
p03448 | s127236486 | Accepted |
import math
import itertools
import statistics
#import numpy as np
import collections
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i + 100*j + 50*k == x:
count += 1
print(co... |
p02818 | s575703660 | Accepted | A,B,K=map(int,input().split())
if A-K>=0:
print(A-K,B)
else:
B=B-(K-A)
if B<=0:
print(0,0)
else:
print(0,B)
|
p03377 | s153540440 | Wrong Answer | a,b,x = map(int,input().split())
if x - a < 0:
print("No")
else:
print(("NO","YES")[x-a<=b]) |
p02597 | s549165896 | Accepted | #coding:utf-8
N = int(input())
C = str(input())
Lis = [0,0] #["R","W"]
for i in C:
if i == "R":
Lis[0] += 1
else:
Lis[1] += 1
D = "R" * Lis[0] + "W" * Lis[1]
Lis = [0,0]
for s,t in zip(C,D):
if (s != t) and (s == "R"):
Lis[0] += 1
elif (s != t) and (s == "W"):
Lis[... |
p02873 | s537374804 | Wrong Answer | S = list(input())
len_S = len(S)
a = [0]*(len_S+1)
for i, s in enumerate(S):
if s == '<':
a[i+1] = a[i]+1
for i, s in enumerate(S[::-1]):
inv_i = len_S-1-i
if s == '>':
a[inv_i] = max(a[inv_i+1]+1, a[inv_i])
print(a)
|
p02727 | s648818433 | Accepted | x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
eat=p[:x]+q[:y]+r
eat.sort(reverse=True)
ans=sum(eat[:x+y])
print(ans)
|
p03543 | s492500691 | Accepted | N = list(input())
ok = False
if N[0]==N[1] and N[1]==N[2]:
ok =True
if N[1]==N[2] and N[2]==N[3]:
ok = True
print("Yes" if ok else "No") |
p02727 | s246700109 | Accepted | x,y,a,b,c=map(int,input().split())
taste=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]
red=taste[0][:x]
green=taste[1][:y]
noclo=taste[2]
print(sum(sorted(red+green+noclo)[-(x+y):])) |
p02880 | s093245316 | Accepted | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 01:45:52 2020
@author: Kanaru Sato
"""
n = int(input())
flag = 0
for i in range(1,10):
if n%i == 0 and n//i <= 9:
flag = 1
if flag == 0:
print("No")
else:
print("Yes") |
p03695 | s607613544 | Wrong Answer | n = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x//400, A))
#print(A)
import collections
c = collections.Counter(A)
#print(c)
f1 = f2 = 0
for k in c.keys():
if k >= 8:
f1 += 1
f2 += c[k]
if f1 == 0:
min_ = max_ = len(c.keys())
else:
min_ = len(c.keys()) -f1
... |
p02602 | s868989365 | Accepted | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n, k = map(int, readline().split())
a = list(map(int, readline().split()))
for i in range(k, n):
if a[i - k] < a[i]:
print("Yes")
else:
print("... |
p02911 | s640627545 | Accepted | N, K, Q = [int(s) for s in input().split()]
A = [0] * N
for i in range(Q):
A[int(input()) - 1] += 1
for a in A:
print('Yes' if (K - Q + a) > 0 else 'No') |
p03150 | s824463924 | Accepted | S = input()
for i in range(8):
if S[0:i] + S[i+(len(S)-7):len(S)] == "keyence":
print("YES")
exit()
print("NO") |
p03012 | s008182633 | Wrong Answer | n = int(input())
a = [int(i) for i in input().split()]
myline = sum(a)//2
for i in range(1,n):
if myline <= sum(a[:i]):
print(abs(sum(a)-min(sum(a[:i]),sum(a[:i-1]),key=lambda x:abs(sum(a)-x))*2))
break |
p03086 | s016664453 | Wrong Answer | s = input()
ans = 0
for l in range (len(s)-1):
for r in range(l+1, len(s)):
cnt = 0
for str in s[l:r]:
if str not in ['A','C','G','T']:
cnt = 0
break
else:
cnt += 1
ans = max(ans, cnt)
print(ans)
|
p03773 | s681528345 | Accepted | A, B = map(int, input().split())
print((A+B) % 24) |
p03011 | s343814836 | Accepted | P, Q, R = map(int,input().split())
ride_time = [P, Q, R]
ride_time.sort()
answer = ride_time[0] + ride_time[1]
print(answer) |
p02701 | s926034466 | Accepted | n = int(input())
s = {}
for i in range(n):
temp = input()
s.setdefault(temp, 0)
s[temp] += 1
print(len(s)) |
p02777 | s526937912 | Accepted | #A
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
A -= 1
else:
B -= 1
print(A, B) |
p02683 | s437356749 | Accepted | N,M,X=map(int,input().split())
L=[]
ans=[0]*(M+1)
A=float("inf")
for i in range(N):
L.append(list(map(int,input().split())))
for i in range(N):
for j in range(1,M+1):
ans[j]+=L[i][j]
if min(ans[1:M+1])<X:
print(-1)
exit()
for i in range(1,2**N+1):
ans=[0]*(M+1)
i+=8192
for j in range(N):
if ((i>>j)&1):
fo... |
p03043 | s648030265 | Accepted | n, k = map(int, input().split())
a = 0
for i in range(1, n+1):
for j in range(100):
if i*2**j>= k:
a += 0.5**j
break
print((1/n)*a) |
p03495 | s530221520 | Accepted | from collections import Counter
N, K = map(int, input().split())
A = Counter(list(map(int,input().split()))).most_common()
repeat = len(set(A))-K
ans = 0
num = 0
while num < repeat:
ans += A.pop(-1)[1]
num += 1
print(ans) |
p02900 | s505271930 | Accepted | import math
from fractions import gcd
a, b = map(int, input().split())
g = gcd(a, b)
sqrt = math.floor(g ** 0.5)
factors = [1]
z = g
for i in range(2, sqrt + 1):
if not z % i:
factors.append(i)
while z % i == 0:
z //= i
if z > 1:
factors.append(z)
print(len(factors))
|
p04020 | s204165738 | Wrong Answer | N = int(input())
pre = int(input())
ans = 0
for _ in range(N - 1):
i = int(input())
if pre <= i:
ans += pre
pre = i - pre
else:
ans += i + (pre - i) // 2
pre = 0
print(ans)
|
p04020 | s271802624 | Wrong Answer | N = int(input())
cnt = 0
tmp = 0
for i in range(N):
a = int(input())
cnt += a//2
tmp2 = a%2
if tmp ==1 and tmp2==1:
cnt +=1
tmp = 0
else:
tmp = tmp2
print(cnt)
|
p02645 | s951564284 | Accepted | str = input()
print(str[0:3]) |
p02697 | s090389302 | Wrong Answer | n, m = map(int, input().split())
if n % 2 == 1:
for i in range(m):
print(str(i+1)+" "+str(2*m - i))
else:
for i in range(m):
print(str(i+1)+" "+str(2*m - i + 1)) |
p02779 | s528668613 | Accepted | def has_duplicates(seq):
return len(seq) != len(set(seq))
N = input().rstrip().split(' ')[0]
print('NO') if has_duplicates([int(i) for i in input().rstrip().split(' ')]) else print('YES')
|
p03633 | s340197618 | Wrong Answer | import fractions
n = int(input())
t = [0]*n
for i in range(n):
t[i] = int(input())
ans = t[0]
for i in range(n-1):
ans = ans * t[i+1] / fractions.gcd(ans,t[i+1])
print(int(ans)) |
p02802 | s143532952 | Accepted | from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
P,S=input().split()
p.append(int(P))
s.append(S)
pena=0
cnt_ac=defaultdict(lambda :0)
cnt_wa=defaultdict(lambda :0)
for x,y in zip(p,s):
if cnt_ac[x]==0:
if y=='AC':
cnt_ac[x]=1
... |
p03797 | s838385472 | Accepted | n,m=map(int,input().split())
if 2*n>=m:
print(m//2)
else:
x=m-2*n
print(n+x//4)
|
p02912 | s603889307 | Wrong Answer | import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(M):
x = heapq.heappop(A)
heapq.heappush(A, x//2)
print(sum(A)*(-1)) |
p04019 | s234862446 | Wrong Answer | S=input()
t=set()
ans='No'
for i in range(len(S)):
t.add(S[i])
if len(t)==4:
print('Yes')
exit()
elif len(t)==3:
print('No')
exit()
elif len(t)==2:
if 'N' and 'S' in t:
print('Yes')
exit()
elif 'W' and 'E' in t:
print('Yes')
exit()
else:
print('No'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.