Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,u,v = map(int, input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    s,t = map(int, input().split())
    G[s-1].append(t-1)
    G[t-1].append(s-1)

"""
for i in range(len(G[u])):
    k=G[u][i]
    D[k]=1
"""
def expro(u):
    D=[0]*N
    D[u]=0
    S=[]
    S.append(u)
    L=[]
    while(len(S)!=0):
        l=S[0]
        for i in range(len(G[l])):
            m=G[l][i]
            if(len(G[l])==1 and l!=u):
                L.append(l)
            if(D[m]==0 and m!=u):
                D[m]=D[l]+1
                S.append(m)
        S.remove(l)
    return L,D
L,D = expro(u-1)
M,E = expro(v-1)
k=0
ans=0
#print(G)
#print(D)
#print(L)
for i in M:
    if D[i]<E[i]:
        if k<E[i]:
            k=E[i]
            ans=E[i]-1
print(ans)


Fixed submission:
N,u,v = map(int, input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    s,t = map(int, input().split())
    G[s-1].append(t-1)
    G[t-1].append(s-1)


def expro(u):
    D=[0]*N
    D[u]=0
    S=[]
    S.append(u)
    L=[]
    q=0
    while(q<N):
        l=S[q]
        for i in range(len(G[l])):
            m=G[l][i]
            if(len(G[l])==1 and l!=u):
                L.append(l)
            if(D[m]==0 and m!=u):
                D[m]=D[l]+1
                S.append(m)
        #S.remove(l)
        q+=1
    return L,D
L,D = expro(u-1)
M,E = expro(v-1)
k=0
ans=0
#print(G)
#print(D)
#print(L)
for i in M:
    if D[i]<E[i]:
        if k<E[i]:
            k=E[i]
            ans=E[i]-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
H=list(map(int,input().split()))
if(N<K):
    K=N
C=[10**9]*N
C[0]=0
C[1]=abs(H[1]-H[0])
for i in range(2,K):
    for j in range(1,i+1):
        C[i]=min(C[i-j]+abs(H[i]-H[i-j]),C[i])
for i in range(K,N):
    for j in range(1,K+1):
        C[i]=min(C[i-j]+abs(H[i]-H[i-j]),C[i])
print(C[N-1])


Fixed submission:
N,K=map(int,input().split())
H=list(map(int,input().split()))
if(N<K):
    K=N
C=[10**9]*N
C[0]=0
C[1]=abs(H[1]-H[0])
for i in range(2,K):
    for j in range(1,i+1):
        C[i]=min(C[i-j]+abs(H[i]-H[i-j]),C[i])
for i in range(K,N):
    for j in range(1,K+1):
        C[i]=min(C[i-j]+abs(H[i]-H[i-j]),C[i])
print(C[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
#N,W = map(int, input().split())
S=list(map(int,input().split()))
N=S[0]
W=S[1]

C=[[0]*(W+1) for i in range(N+1)]

for i in range(N):
    w,v=map(int, input().split())
    for j in range(W+1):
        if(j>=w):
            C[i+1][j]=max(C[i][j],C[i][j-w]+v)
        else:
            C[i+1][j]=C[i][j]
print(C[N][W])


Fixed submission:
#N,W = map(int, input().split())
S=list(map(int,input().split()))
N=S[0]
W=S[1]

C=[[0]*(W+1) for i in range(N+1)]

for i in range(N):
    w,v=map(int, input().split())
    for j in range(W+1):
        if(j>=w):
            C[i+1][j]=max(C[i][j],C[i][j-w]+v)
        else:
            C[i+1][j]=C[i][j]
print(C[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P=list(map(float,input().split()))
C=[[0.00]*(N+1) for i in range(N+1)]
C[0][0]=1.00
for i in range(1,N+1):
    for j in range(0,i+1):
        """
        #print(i-1)
        print(P[i-1])
        print(C[i-1][j-1])
        print(C[i-1][j-1]*P[i-1])
        """
        C[i][j]=float(C[i-1][j-1]*P[i-1])+float(C[i-1][j]*(1-P[i-1]))
        #print(C[i][j])
ans=float(0.00)
for i in range((N-1)//2+1):
    ans+=C[N][i]
ans=float(1.00-ans)
print(ans)


Fixed submission:
N=int(input())
P=list(map(float,input().split()))
C=[[0.00]*(N+1) for i in range(N+1)]
C[0][0]=1.00
for i in range(1,N+1):
    for j in range(0,i+1):
        """
        #print(i-1)
        print(P[i-1])
        print(C[i-1][j-1])
        print(C[i-1][j-1]*P[i-1])
        """
        C[i][j]=float(C[i-1][j-1]*P[i-1])+float(C[i-1][j]*(1-P[i-1]))
        #print(C[i][j])
ans=float(0.00)
for i in range((N-1)//2+1):
    ans+=C[N][i]
ans=float(1.00-ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while ((D<=X)and(i<(N))):
  D+=L[i]
  i+=1
print(i)
  
  

Fixed submission:
A,X= map(int, input().split())
if A<X:
  print("0")
else:
  print("10")

Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while ((D<=X)and(i!=N)):
  D+=L[i]
  i+=1
print(i)
  
  

Fixed submission:
A,X= map(int, input().split())
if A<X:
  print("0")
else:
  print("10")
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while (D<X):
  D+=L[i]
  i+=1
  if i>N:
    break
print(i)
  
  


Fixed submission:
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while (D<=X)and(i<N+1):
  if (i<N):
    D+=L[i]
  i+=1
#  if i>N:
 #   break
print(i)

Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while (D<=X):
  D+=L[i]
  i+=1
  if i>N:
    break
print(i)
  
  


Fixed submission:
N,X = map(int, input().split())
D=0
L=list(map(int, input().split()))
i=0
while (D<=X)and(i<N+1):
  if (i<N):
    D+=L[i]
  i+=1
#  if i>N:
 #   break
print(i)
Buggy python submission (verdict: Runtime Error):
ss=input().split(" ")
N=int(ss[0])
M=int(ss[1])
x=0
y=N
for i in range(M):
  tt=input().split(" ")
  if int(tt[0])>x:
    x=int(tt[0])
  if int(tt[1])<y:
    y=int(tt[1])
print(int(y-x+1)
  

Fixed submission:
ss=input().split(" ")
N=int(ss[0])
M=int(ss[1])
x=1
y=N
for i in range(M):
  tt=input().split(" ")
  if int(tt[0])>x:
    x=int(tt[0])
  if int(tt[1])<y:
    y=int(tt[1])
last=int(y-x+1)
if last>0:
  print(last)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
ss=input().split(" ")
N=int(ss[0])
M=int(ss[1])
x=0
y=N
for i in range(M):
  tt=input().split(" ")
  if int(tt[0])>x:
    x=int(tt[0])
  if int(tt[1])<y:
    y=int(tt[1])
print(int(y-x+1)
  

Fixed submission:
ss=input().split(" ")
N=int(ss[0])
M=int(ss[1])
x=1
y=N
for i in range(M):
  tt=input().split(" ")
  if int(tt[0])>x:
    x=int(tt[0])
  if int(tt[1])<y:
    y=int(tt[1])
last=int(y-x+1)
if last>0:
  print(last)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
ans=1
f=1
i=0
for i in range(n):
  ans=ans*l[i]
if f==1 and ans<=10**18:
  print(ans)
else:
  print(-1)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=1
f=1
i=0
for i in range(n):
  if ans<=10**18:
    ans=ans*l[i]
  else:
  	f=0
if f==1 and ans<=10**18:
  print(ans)
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
ans=1
for i in range(n):
  ans=ans*l[i]
if ans>10**18:
  print(-1)
else:
  print(ans)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=1
f=1
i=0
for i in range(n):
  if ans<=10**18:
    ans=ans*l[i]
  else:
  	f=0
if f==1 and ans<=10**18:
  print(ans)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
r=int(input())
print(r*2*math.pi)


Fixed submission:
import math
r=int(input())
print(r*2*math.pi)
Buggy python submission (verdict: Runtime Error):
n=input()
cnt=0
for i in range(1,n+1):
  if i%3==0 or i%5==0:
    cnt+=0
  else:
    cnt+=i
print(cnt)


Fixed submission:
n=int(input())
cnt=0
for i in range(1,n+1):
  if i%3==0 or i%5==0:
    cnt+=0
  else:
    cnt+=i
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
r=[]
g=[]
b=[]

for i in range(len(s)):
    if s[i]=='R':
        r.append(i)
    elif s[i]=='G':
        g.append(i)
    elif s[i]=='B':
        b.append(i)

def cal(l1,l2,l3):
    cnt=0
    for _l1 in range(len(l1)):
        for _l2 in range(len(l2)):
            if l1[_l1]<l2[_l2]:
                for _l3 in range(len(l3)):
                    if l2[_l2]<l3[_l3] and l3[_l3]-l2[_l2]!=l2[_l2]-l1[_l1]:
                        cnt+=1
    return cnt
        
count=0
count+=cal(r,g,b)
count+=cal(r,b,g)
count+=cal(g,r,b)
count+=cal(g,b,r)
count+=cal(b,r,g)
count+=cal(b,g,r)
print(count)



Fixed submission:
n=int(input())
s=input()
c=s.count
m=c('R')*c('G')*c('B')
for i in range(n):
  for j in range(i+2,n,2):
    if s[i]!=s[i+j>>1]!=s[j]!=s[i]:
      m-=1
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
r=[]
g=[]
b=[]

for i in range(len(s)):
    if s[i]=='R':
        r.append(i)
    elif s[i]=='G':
        g.append(i)
    elif s[i]=='B':
        b.append(i)

def cal(l1,l2,l3):
    cnt=0
    for _l1 in range(len(l1)):
        for _l2 in range(len(l2)):
            if l1[_l1]<l2[_l2]:
                for _l3 in range(len(l3)):
                    if l2[_l2]<l3[_l3]:
                        if l3[_l3]-l2[_l2]!=l2[_l2]-l1[_l1]:
                            cnt+=1
    return cnt
        
count=0
count+=cal(r,g,b)
count+=cal(r,b,g)
count+=cal(g,r,b)
count+=cal(g,b,r)
count+=cal(b,r,g)
count+=cal(b,g,r)
print(count)



Fixed submission:
n=int(input())
s=input()
c=s.count
m=c('R')*c('G')*c('B')
for i in range(n):
  for j in range(i+2,n,2):
    if s[i]!=s[i+j>>1]!=s[j]!=s[i]:
      m-=1
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
r=[]
g=[]
b=[]

for i in range(len(s)):
    if s[i]=='R':
        r.append(i)
    elif s[i]=='G':
        g.append(i)
    elif s[i]=='B':
        b.append(i)
cnt=0
for _r in r:
    for _g in g:
        for _b in b:
            if _r<_g and _g<_b and (_g-_r!=_b-_g):
                cnt+=1
            elif _r<_b and _b<_g and (_g-_b!=_b-_r):
                cnt+=1
            elif _g<_b and _b<_r and (_r-_b!=_b-_g):
                cnt+=1
            elif _g<_r and _r<_b and (_b-_r!=_r-_g):
                cnt+=1
            elif _b<_r and _r<_g and (_g-_r!=_r-_b):
                cnt+=1
            elif _b<_g and _g<_r and (_r-_g!=_g-_b):
                cnt+=1
print(cnt)



Fixed submission:
n=int(input())
s=input()
c=s.count
m=c('R')*c('G')*c('B')
for i in range(n):
  for j in range(i+2,n,2):
    if s[i]!=s[i+j>>1]!=s[j]!=s[i]:
      m-=1
print(m)
Buggy python submission (verdict: Runtime Error):
 s=input()
n=len(s)
if s=="hi"*(n//2):
  print("Yes")
else:
  print("No")



Fixed submission:
s=input()
n=len(s)
if s=="hi"*(n//2):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()+'E'
q=int(input())
for i in range(q):
  que=input().split()
  if que[0]==str(1):
    if s[-1]=='E':
      s='E'+s[:-1]
    else:
      s=s[1:]+'E'
  else:
    if que[1]==str(1):
      if s[-1]=='E':
        s=que[2]+s
      else:
        s='E'+s[1:]+que[2]
    else:
      if s[-1]=='E':
        s=s[:-1]+que[2]+'E'
      else:
        s='E'+que[2]+s[1:]
if s[-1]=='E':
  print(s[:-1])
else:
  print(s[::-1][:-1])



Fixed submission:
from collections import deque
s=deque(input())
q=int(input())
cnt=0
for i in range(q):
  t=input().split()
  if t[0]=="1":
    cnt+=1
  else:
    if (int(t[1])+cnt)%2==1:
      s.appendleft(t[2])
    else:
      s.append(t[2])
      
if cnt%2==1:
  s.reverse()
print("".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()+'E'
q=int(input())
for i in range(q):
  que=input().split()
  if que[0]==str(1):
    if s[-1]=='E':
      s='E'+s[:-1]
    else:
      s=s[1:]+'E'
  else:
    if que[1]==str(1):
      if s[-1]=='E':
        s=que[2]+s
      else:
        s='E'+s[1:]+que[2]
    else:
      if s[-1]=='E':
        s=s[:-1]+que[2]+'E'
      else:
        s='E'+que[2]+s[1:]
if s[-1]=='E':
  print(s[:-1])
else:
  s=s[::-1]
  print(s[:-1])



Fixed submission:
from collections import deque
s=deque(input())
q=int(input())
cnt=0
for i in range(q):
  t=input().split()
  if t[0]=="1":
    cnt+=1
  else:
    if (int(t[1])+cnt)%2==1:
      s.appendleft(t[2])
    else:
      s.append(t[2])
      
if cnt%2==1:
  s.reverse()
print("".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for i in range(q):
  que=input().split()
  if que[0]==str(1):
    s=s[::-1]
  else:
    if que[1]==str(1):
      s=que[2]+s
    else:
      s=s+que[2]
print(s)




Fixed submission:
from collections import deque
s=deque(input())
q=int(input())
cnt=0
for i in range(q):
  t=input().split()
  if t[0]=="1":
    cnt+=1
  else:
    if (int(t[1])+cnt)%2==1:
      s.appendleft(t[2])
    else:
      s.append(t[2])
      
if cnt%2==1:
  s.reverse()
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=input().split()
q=[]
f=1
for i in l:
  if i not in q:
    q.append(i)
  else:
    f=0
    break
if f==1:
  print('YES')
else:
  print('NO')



Fixed submission:
n=int(input())
l=input().split()
l.sort()
flag=1
for i in range(n-1):
  if l[i]==l[i+1]:flag=0
if flag==1:print("YES")
else:print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=input().split()
q=[]
for i in l:
  if i not in q:q.append(i)

if len(l)!=len(q):
  print('NO')
else:
  print('YES')


Fixed submission:
n=int(input())
l=input().split()
l.sort()
flag=1
for i in range(n-1):
  if l[i]==l[i+1]:flag=0
if flag==1:print("YES")
else:print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k,*p=map(int,open(0).read().split())
l=[]
for i in range(n-k+1):
  sums=[]
  for j in p[i:i+k]:
    sums.append(j*(j+1)/(2*j))
  l.append(sum(sums))
print(max(l))
  

Fixed submission:
n,k,*p=map(int,open(0).read().split())
s=sum(p[:k])  
l=[s]
for i in range(k,n):
  s=s-p[i-k]+p[i]
  l.append(s)
print((max(l)+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
#import time
#t1=time.time()

n=int(input())
a=list(map(int,input().split()))
count=0
flag=1
a.reverse()
l=a

for i in range(n):
  if a[-i-1]==flag:
    flag+=1
  else:
    l=l[:-1]
    count+=1

if count==n:
  print(-1)
else:
  print(count)

#t2=time.time()
#print(t2-t1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=0
flag=1

l=a
left=0
for i in range(n):
  if l[i]==flag:
    flag+=1
  else:
    count+=1
    
if count==n:
  print(-1)
else:
  print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
count=0
flag=1

l=a
for i in a:
  if i==flag:
    flag+=1
  else:
    l=a[1:]
    count+=1
if count==n:
  print(-1)
else:
  print(count)




Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=0
flag=1

l=a
left=0
for i in range(n):
  if l[i]==flag:
    flag+=1
  else:
    count+=1
    
if count==n:
  print(-1)
else:
  print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
s=0
for i in range(1,n):
  for j in range(i):
    s+=a[j]^a[i]
print(s%(10**9+7))



Fixed submission:
mod=int(1e9)+7

n=int(input())
a=[int(i) for i in input().split()]
ans=0
for b in range(60)[::-1]:
  ans<<=1
  c=sum(a[i]>>b & 1 for i in range(n))
  ans = (ans + c*(n-c)) % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
s=[]
for i in range(1,n):
  for j in range(i):
    s.append(a[j]^a[i])
print(sum(s)%(10**9+7))



Fixed submission:
mod=int(1e9)+7

n=int(input())
a=[int(i) for i in input().split()]
ans=0
for b in range(60)[::-1]:
  ans<<=1
  c=sum(a[i]>>b & 1 for i in range(n))
  ans = (ans + c*(n-c)) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
p=0

if s[0]==s[-1]:
  p+=1

l=[1]
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    l.append(1)
  else:
    l[-1]+=1
x=[i//2 for i in l]
y=sum(x)
if s[-1]==s[-2]:
  print((y-1)*k+p*k)
else:
  print(y*k+p*(k-1))



Fixed submission:
s=input()
k=int(input())
p=0
if s[0]==s[-1]:
  p+=1

if len(s)==1:
  print(k//2)
else:
  l=[1]
  for i in range(len(s)-1):
    if s[i]!=s[i+1]:
      l.append(1)
    else:
      l[-1]+=1
  x=[i//2 for i in l]
  y=sum(x)
  if len(l)>1:
    if s[0]==s[-1]:
      if (l[0]+l[-1])%2==1:
        print(y*k)
      else:
        print(y*k+p*(k-1))
    else:
      print(y*k+p*(k-1))
  else:
    print((len(s)*k)//2)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
l=[int(input()) for i in range(q)]
d=dict(zip(range(n),[k]*n))

for i in l:
  for j in d.keys():
    if i==j:
      d[i-1]+=1

for i in d.values():
  if i-q>0:
    print('Yes')
  else:
    print('No')




Fixed submission:
n,k,q=map(int,input().split())
l=[int(input()) for i in range(q)]
d=dict.fromkeys(range(n),k)

for i in l:
  d[i-1]+=1

for i in d.values():
  if i-q>0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
a=list(map(int, input().split()))
for i in range(m):
  ma=max(a)
  a.remove(ma)
  a.append(ma//2)
print(sum(a))



Fixed submission:
import heapq
n,m=map(int, input().split())
a=[-int(j) for j in input().split()]
heapq.heapify(a)
for i in range(m):
  v=heapq.heappop(a)
  heapq.heappush(a, -(-v//2))
print(-sum(a))
Buggy python submission (verdict: Runtime Error):
n=int(input())
print(s**3)

Fixed submission:
n=int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
a=[]

a.append(b[-1])
for i in range(1,n):
  if i<n-1:
    if b[-1-i]>=b[-i]:
      a.append(b[-i])
    else:
      a.append(b[-1-i])
  else:
    if b[1]>=b[0]:
      a.append(b[0])
    else:
      a.append(b[1])
print(sum(a))



Fixed submission:
n=int(input())
b=list(map(int,input().split()))
b.append(b[-1])
a=[]
a.append(b[0])
for i in range(0,n-1):
  a.append(min(b[i],b[i+1]))
print(sum(a))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
c=[]
l=0
for i in range(n-1):
  if h[i]>=h[i+1]:
    c.append(0)
    c[l]+=1
  else:
    c.append(0)
    l+=1
print(max(c))



Fixed submission:
n=int(input())
h=list(map(int,input().split()))
c=[0]
l=0
for i in range(n-1):
  if h[i]>=h[i+1]:
    
    c[l]+=1
  else:
    c.append(0)
    l+=1
print(max(c))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
a=True
for i in range(n):
  for j in range(i,n):
    if h[i]-h[j]>1:
      a=False
if a==False:
  print('No')
else:
  print('Yes')

Fixed submission:
A,B,C = map(int,input().split())
if A-B>C:
  print(0)
else:
  print(C-(A-B))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=list(map(int,input().split()))
a=True
for i in range(n):
  for j in range(i,n):
    if h[i]-h[j]>1:
      a=False
      break
if a==False:
  print('No')
else:
  print('Yes')

Fixed submission:
n=int(input())
h=list(map(int,input().split()))

for i in range(n-1):
  if h[i]<h[i+1]:
    h[i+1]-=1
if sorted(h)==h:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=list(map(int,input().split()))
a=True
for i in range(n):
  for j in range(i,n):
    if h[i]-h[j]>1:
      a=False
if a==False:
  print('No')
else:
  print('Yes')


Fixed submission:
n=int(input())
h=list(map(int,input().split()))

for i in range(n-1):
  if h[i]<h[i+1]:
    h[i+1]-=1
if sorted(h)==h:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,D=map(int, input().split())
List=[0 if (i%C==0 or i%D==0) else 1 for i in range(A,B+1)]
print(sum(List))


Fixed submission:
import fractions

A,B,C,D = map(int, input().split())

def lcm(C,D):
  return C*D // fractions.gcd(C,D)
CD=lcm(C,D)

print(int(B-A+1-((B//C + B//D - B//CD) - ((A-1)//C + (A-1)//D - (A-1)//CD))))
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
print((w*h)/2)
if (w==2*x and h!=2*y) or (w!=2*x and h==2*y) or (x==0 and y==0) or (x==w and y==0) or (x==0 and y==h) or (x==w and y==h) or (w/x==h/y and w!=2*x) or (h/y==w/(w-x) and w-x==h and w!=2*x):
  print(0)
else:
  print(1)


Fixed submission:
X,A = map(int, input().split())
if X<A:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
l=[r,g,b,n]
R=n//r
G=n//g
B=n//b
count=0
l=[r,g,b]
m=min(l)
l.sort()
a=n//l[0]
b=n//l[1]
c=n//l[2]
for _a in range(a+1):
  for _b in range(b+1):
    for _c in range(c+1):
      if _a+_b+_c<=n//m:
        if l[0]*_a + l[1]*_b + l[2]*_c == n:
          count+=1
print(count)


Fixed submission:
r,g,b,n=map(int,input().split())
l=[r,g,b,n]
count=0
for i in range(n+1):
  for j in range(n+1):
    if (n-(i*r+j*g))/b==int((n-(i*r+j*g))/b) and (n-(i*r+j*g))/b>=0:
      count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
l=[r,g,b,n]
R=n//r
G=n//g
B=n//b
count=0
l=[r,g,b]
l.sort()
a=n//l[0]
b=n//l[1]
c=n//l[2]
for _a in range(a+1):
  for _b in range(b+1):
    for _c in range(c+1):
      if _a+_b+_c<=n:
        if l[0]*_a + l[1]*_b + l[2]*_c == n:
          count+=1
print(count)

Fixed submission:
r,g,b,n=map(int,input().split())
l=[r,g,b,n]
count=0
for i in range(n+1):
  for j in range(n+1):
    if (n-(i*r+j*g))/b==int((n-(i*r+j*g))/b) and (n-(i*r+j*g))/b>=0:
      count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
l=[r,g,b,n]
R=n//r
G=n//g
B=n//b
count=0
for _r in range(R+1):
  for _g in range(G+1):
    for _b in range(B+1):
      if r*_r + g*_g +b*_b == n:
        count+=1
print(count)


Fixed submission:
r,g,b,n=map(int,input().split())
l=[r,g,b,n]
count=0
for i in range(n+1):
  for j in range(n+1):
    if (n-(i*r+j*g))/b==int((n-(i*r+j*g))/b) and (n-(i*r+j*g))/b>=0:
      count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B and B=C:
  print('Yes')
else:
  print('No')

Fixed submission:
A,B,C = map(int, input().split())
if A==B and B==C:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A=B=C:
  print('Yes')
else:
  print('No')
  

Fixed submission:
A,B,C = map(int, input().split())
if A==B and B==C:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
List = [s for s in S]
for i in List:
  if i = "o":
    count+=1
print(700+100*count)

Fixed submission:
S = input()
count = 0
List = [s for s in S]
for i in List:
  if i == "o":
    count+=1
print(700+100*count)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
count=1
for i in range(1,n+1):
  count*=i
print(count%(10**9+7))



Fixed submission:
n=int(input())
count=1
for i in range(1,n+1):
  count*=i
  count%=(10**9+7)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
count=1
for i in range(1,n+1):
  count*=i
print(count%(10**9+7))



Fixed submission:
n=int(input())
count=1
for i in range(1,n+1):
  count*=i
  count%=(10**9+7)
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
	print(0)
	return
prod = 1
for a in A:
	prod *= a
	if prod > 1000000000000000000:
		print(-1)
		return
print(prod)


Fixed submission:
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))

	if 0 in  A:
		print(0)
		return

	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return

	print(prod)

main ()

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
sum = 1
nums = list(map(int, input().strip().split()))
for i in range(a):
  sum *= nums[i]
if sum<=10**18 :  
	print(sum)
else:
  print(-1)


Fixed submission:
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))

	if 0 in  A:
		print(0)
		return

	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return

	print(prod)

main ()

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
sum = 1
nums = list(map(int,input().split()))
for i in range(a):
  sum *= nums[i]
if sum<=10**18 :  
	print(sum)
else:
  print(-1)


Fixed submission:
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))

	if 0 in  A:
		print(0)
		return

	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return

	print(prod)

main ()