Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
lScope = []
rScope = []
ans = 0
for i in range(m):
    l,r = map(int,input().split())
    lScope.append(l)
    rScope.append(r)
# k in keyScope[i] (i= 0~m) を確かめたい
for key in range(1,n+1):
    if max(lScope) <= key <= min(rScope):
        ans += 1
print(ans)

Fixed submission:
n,m = map(int,input().split())
lScope = []
rScope = []
ans = 0
for i in range(m):
    l,r = map(int,input().split())
    lScope.append(l)
    rScope.append(r)
# k in keyScope[i] (i= 0~m) を確かめたい
if min(rScope) >= max(lScope):
    print(min(rScope) - max(lScope) + 1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
keyScope = []
ans = 0
for i in range(m):
    l,r = map(int,input().split())
    keyScope.append([j for j in range(l,r+1)])
# k in keyScope[i] (i= 0~m) を確かめたい
for k in range(1,n+1):
    gate = 0
    while k in keyScope[gate]:
        if gate == m-1:
            ans += 1
            break
        else:
            gate += 1
print(ans)

Fixed submission:
n,m = map(int,input().split())
lScope = []
rScope = []
ans = 0
for i in range(m):
    l,r = map(int,input().split())
    lScope.append(l)
    rScope.append(r)
# k in keyScope[i] (i= 0~m) を確かめたい
if min(rScope) >= max(lScope):
    print(min(rScope) - max(lScope) + 1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
ans = ''
for i in len(s):
  if i == k:
    ans = ans + s[i].lower()
  ans = ans + s[i]
print(ans)

Fixed submission:
n,k = map(int,input().split())
s = input()
ans = ''
for i in range(n):
    if i == k-1:
        ans = ans + s[i].lower()
    else:
        ans = ans + s[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input('N='))
A = list(map(int,input().split()))
times = 0
while True:
  for i in A:
    amari += i%2
  if amari == 0:
    times += 1
    for j in A:
      j = j/2
  else:
    break
print(times)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
amari = 0
ans = 0
while True:
    for i in A:
        amari += i%2
    if amari != 0:
        break
    elif amari == 0:
        for j in range(len(A)):
            A[j] = A[j]/2
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k and x+y+z == s :
            ans += 1
print(ans)

Fixed submission:
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                ans += 1
print(ans)

Fixed submission:
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i%x == 0:
    ans += 1
print(ans)

Fixed submission:
a,b,x = map(int,input().split())
b = b//x
if a%x==0 or a==0:
  a=a//x -1
else:
  a=a//x
print(b-a)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[str(input()) for _ in range(n)]
l=[s[0]]
for i in range(n):
  if s[i] not in l:
    l.append(s[i])
print(len(l))


Fixed submission:
n=int(input())
s=[input() for _ in range(n)]
t=list(set(s))
print(len(t))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[list(input()) for _ in range(n)]
t=list(set(s))
print(len(t))


Fixed submission:
n=int(input())
s=[input() for _ in range(n)]
t=list(set(s))
print(len(t))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[list(map(str,input().split())) for _ in range(n)]
t=list(set(s))
print(len(t))


Fixed submission:
n=int(input())
s=[input() for _ in range(n)]
t=list(set(s))
print(len(t))
Buggy python submission (verdict: Runtime Error):
def f(x):
  return x==x[::-1]
S=str(input())
N=len(S)
S1=S[:(N-3)/2]
S2=S[(N+1)/2:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')
  

Fixed submission:
S=str(input())
def f(x):
  return x==x[::-1]
N=len(S)
S1=S[:(N-1)//2]
S2=S[(N+1)//2:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S=str(input())
N=len(S)
X=(int(N)-1)/2
Y=(int(N)+3)/2
T=S[1,X]
U=S[Y,N]
if str(S)==str(S)[::-1] and str(T)==str(T)[::-1] and str(U)==str(U)[::-1]:
  print("Yes")
else:
  print("No")
  

Fixed submission:
S=str(input())
def f(x):
  return x==x[::-1]
N=len(S)
S1=S[:(N-1)//2]
S2=S[(N+1)//2:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S=list()
N=len(S)
X=(int(N)-1)/2
Y=(int(N)+3)/2
T=S(range(1,X))
U=S(range(Y,N))
if str(S)==str(S)[::-1] and str(T)==str(T)[::-1] and str(U)==str(U)[::-1]:
  print("Yes")
else:
  print("No")
  

Fixed submission:
S=str(input())
def f(x):
  return x==x[::-1]
N=len(S)
S1=S[:(N-1)//2]
S2=S[(N+1)//2:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
X=(int(N)-1)/2
Y=(int(N)+3)/2
T=S(range(1,X))
U=S(range(Y,N))
if str(S)==str(S)[::-1] and str(T)==str(T)[::-1] and str(U)==str(U)[::-1]:
  print("Yes")
else:
  print("No")
  

Fixed submission:
S=str(input())
def f(x):
  return x==x[::-1]
N=len(S)
S1=S[:(N-1)//2]
S2=S[(N+1)//2:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split)
ans=N//(A+B)*A
rem=N%(A+B)
ans=ans+min(rem,A)
print(ans)

Fixed submission:
N,A,B=map(int,input().split())
ans=(N//(A+B))*A
rem=N%(A+B)
ans=ans+min(rem,A)
print(ans)
Buggy python submission (verdict: Runtime Error):
N=input()
1<=N<=100
ans=(N+1)//2
print(ans)


Fixed submission:
N=int(input())
import math
ans=math.ceil(N/2)
print(ans)

Buggy python submission (verdict: Runtime Error):
N=input()
ans=(N+1)//2
print(ans)

Fixed submission:
N=int(input())
import math
ans=math.ceil(N/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=0
for i in range(n):
  if a[i]%2==0:
    l.append(a[i])
for j in range(len(l)):
  if l[j]%3==0 or l[j]%5==0:
    l.remove(l[j])
if len(l)==0:
  print('APPROVED')
else:
  print('DENIED')
  
  

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      pass
    else:
      count+=1
if count==0:
  print('APPROVED')
else:
  print('DENIED')
Buggy python submission (verdict: Runtime Error):
S,T=map(int,input().split())
A,B=map(int,input().split())
U=input()
if U=S:
  print("{} {}".format(A-1,B))
if U=T:
  print("{} {}".format(A,B-1))
  

Fixed submission:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
if U==S:
  print(A-1,B)
else:
  print(A,B-1)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K=map(int,input().split())
for i in range(1,K+1):
  if A>=1:
    A-=1
  elif A<1 and B>=1:
    B-=1
  else:
    pass
print(A,B,end=' ')


Fixed submission:
A,B,K=map(int,input().split())
print(max(A-K,0),min(max(B-K+A,0),B),end=' ')
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
g=math.gcd(a,b)
print(a*b//g)


Fixed submission:
import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
ans=a*b//math.gcd(a,b)
print(ans)


Fixed submission:
import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
print(math.gcd(a,b))


Fixed submission:
import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
l=[]
for x in range(1,a*b+1):
  if x%a==0 and x%b==0:
    l.append(x)
print(min(l))


Fixed submission:
import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
for i in range(n):
  for j in range(n):
    if i!=j:
      sum+=d[i]*d[j]
print(sum//2)


Fixed submission:
n=int(input())
d=list(map(int,input().split()))
sum=0
for i in range(n):
  for j in range(n):
    if i!=j:
      sum+=d[i]*d[j]
print(sum//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(int(input()))
sum=0
i=0
while i<=N-1:
  sum+=1/A[i]
  i+=1
rev=1/sum
print(rev)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
sum=0
i=0
while i<=N-1:
  sum+=1/A[i]
  i+=1
rev=1/sum
print(rev)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(int,input())
sum=0
i=0
while i<=N-1:
  sum+=1/A[i]
  i+=1
rev=1/sum
print(rev)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
sum=0
i=0
while i<=N-1:
  sum+=1/A[i]
  i+=1
rev=1/sum
print(rev)
Buggy python submission (verdict: Runtime Error):
P,Q,R=map(int,input().split())
print(min(A+B,B+C,C+A))


Fixed submission:
P,Q,R=map(int,input().split())
print(min(P+Q,Q+R,R+P))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=str(input())
print(S.replace(S[K-1],S[K-1].lower())
      

Fixed submission:
N,K=map(int,input().split())
S=list(input())
S[K-1]=S[K-1].lower()
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
b=str(input())
if b="A":
  print("T")
elif b="C":
  print("G")
elif b="G":
  print("C")
else:
  print("A")
  

Fixed submission:
b=str(input())
if b=="A":
  print("T")
elif b=="C":
  print("G")
elif b=="G":
  print("C")
else:
  print("A")
Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
ans=[]
i=1
for i in range(1,101):
  if A%i==0 and B%i==0:
    ans.append(i)
    i+=1
print(ans[1])


Fixed submission:
A,B,K=map(int,input().split())
ans=[]
i=1
for i in range(1,101):
  if A%i==0 and B%i==0:
    ans.append(i)
    i+=1
ans.reverse()
print(ans[K-1])
Buggy python submission (verdict: Runtime Error):
|AB|,|BC|,|CA|=map(int,input().split())
print(|AB|*|BC|*1/2)


Fixed submission:
l=list(map(int,input().split()))
print(l[0]*l[1]//2)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[input() for _ in range(n)]
p.sort()
s=0
for i in range(n-1):
  s+=p[i]
ans=s+(p[n-1]//2)
print(ans)


Fixed submission:
n=int(input())
p=[int(input()) for _ in range(n)]
p.sort()
s=0
for i in range(n-1):
  s+=p[i]
ans=s+(p[n-1]//2)
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
p=list(map(int,input().split()))
half=max(p)
sum=0
i=0
for i in range(N):
  sum+=p[i]
  i+=1
all=sum-half
print(half//2+all)


Fixed submission:
n=int(input())
p=[int(input()) for _ in range(n)]
p.sort()
s=0
for i in range(n-1):
  s+=p[i]
ans=s+(p[n-1]//2)
print(ans)
Buggy python submission (verdict: Runtime Error):
S=str(input())
M=len(S)
list=[]
i=0
for i in range(N-2):
  list.append(S[i:i+3])
  i+=1
N=len(list)
new_list=[]
j=0
for j in range(N):
  new_list.append(abs(int(list[j])-753))
print(min(new_list))


Fixed submission:
S=str(input())
M=len(S)
list=[]
i=0
for i in range(M-2):
  list.append(S[i:i+3])
  i+=1
N=len(list)
new_list=[]
j=0
for j in range(N):
  new_list.append(abs(int(list[j])-753))
print(min(new_list))
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N==1:
  print("Hello World")
else:
  A,B=map(int,input().split())
  print(A+B)
  

Fixed submission:
N=int(input())
if N==1:
  print("Hello World")
else:
  A=int(input())
  B=int(input())
  print(A+B)
Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
c,t=[list(map(int,input().split())) for _ in range(n)]
l=[]
for i in range(n):
  if t[i]<=t:
    l.append([c[i],t[i]])
    if len(l)==0:
      print('TLE')
    else:
      l.sort()
      print(l[0][0])
      

Fixed submission:
n,T=map(int,input().split())
ans=1001
for i in range(n):
  c,t=map(int,input().split())
  if t<=T:
    ans=min(ans,c)
if ans==1001:
  print('TLE')
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
N,i=map(int,iput().split())
print(N-i+1)


Fixed submission:
N,i=map(int,input().split())
print(int(N)-int(i)+1)
Buggy python submission (verdict: Runtime Error):
S=str(input())
count==0
for i in range(4):
  if S[i]=='+':
    count+=1
  else:
    count-=1
  i+=1
print(count)


Fixed submission:
S=str(input())
count=0
i=0
for i in range(4):
  if S[i]=='+':
    count+=1
  else:
    count-=1
  i+=1
print(count)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A<=8 and B<=8:
  print("Yay!")
ekse:
  print(":(")
  

Fixed submission:
A,B=map(int,input().split())
if A>8 or B>8:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
m=[list(map(int,input().split())) for _ in range(n)]
y=x-sum(m)
print(n+y//min(m))


Fixed submission:
n,x=map(int,input().split())
m=[int(input()) for _ in range(n)]
y=x-sum(m)
print(n+y//min(m))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a*b)%2==0:
  print(Odd)
else:
  print(Even)
  

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
l=[]
for i in range(1,n+1):
  s=sum(list(map(int,str(i))))
  if s>=a s<=b:
    l.append(i)
print(sum(l))


Fixed submission:
n,a,b=map(int,input().split())
x=[]
y=[]
for i in range(1,n+1):
  x.append(i)
for j in range(n):
  s=sum(list(map(int,str(x[j]))))
  if s>=a and s<=b:
    y.append(x[j])
print(sum(y))
Buggy python submission (verdict: Runtime Error):
s=str(input())
print(s.count(1))


Fixed submission:
s=str(input())
print(s.count("1"))

Buggy python submission (verdict: Runtime Error):
s1s2s3=str(input())
print(s1s2s3.count(1))


Fixed submission:
s=str(input())
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
n=str(input())
f=0
for i in range(len(l)):
  f+=n[i]
if int(n)%f==0:
  print('Yes')
else:
  print('No')
  

Fixed submission:
n=int(input())
f=sum(list(map(int,str(n))))
if n%f==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n=str(input())
f=0
for i in range(len(n)):
  f+=n[i]
if n%f==0:
  print('Yes')
else:
  print('No')
  

Fixed submission:
n=int(input())
f=sum(list(map(int,str(n))))
if n%f==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
f=0
for i in range(len(n)):
  f+=i
if n%f==0:
  print('Yes')
else:
  print('No')
  

Fixed submission:
n=int(input())
f=sum(list(map(int,str(n))))
if n%f==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
R=int(input())
G=int(input())
print(2G-R)


Fixed submission:
R=int(input())
G=int(input())
print(2*G-R)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
  l[i],r[i]=map(int,input().split())
  ans+=r[i]-l[i]+1
print(ans)


Fixed submission:
n=int(input())
ans=0
for i in range(n):
  l,r=map(int,input().split())
  ans+=r-l+1
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C=map(str,input().split())
x=len(A)
y=len(B)
if A[x-1]==B[1] and B[y-1]==C[1]:
  print("YES")
else:
  print("NO")
  

Fixed submission:
A,B,C=map(str,input().split())
x=len(A)
y=len(B)
if A[x-1]==B[0] and B[y-1]==C[0]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s=list(map(int,input().split()))
x=s[0]
y=s[1]
z=s[2]
small=x[0]+y[0]+z[0]
print(small.upper())


Fixed submission:
s=list(map(str,input().split()))
x=s[0]
y=s[1]
z=s[2]
small=x[0]+y[0]+z[0]
print(small.upper())
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=str(input())
x=0
l=[0]
for i in range(n):
  if s[i]=='I':
    x+=1
    l.append(x)
  else:
    x-=1
    l.append(x)
print(max(x))


Fixed submission:
n=int(input())
s=str(input())
x=0
l=[0]
for i in range(n):
  if s[i]=='I':
    x+=1
    l.append(x)
  else:
    x-=1
    l.append(x)
print(max(l))
Buggy python submission (verdict: Runtime Error):
A op B=map(str,input().split())
if op=="+":
  print(int(A)+int(B))
else:
  print(int(A)-int(B))
  

Fixed submission:
A,op,B=map(str,input().split())
if op=="+":
  print(int(A)+int(B))
else:
  print(int(A)-int(B))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[]
ansl=[]
for i in range(n):
    s.append(input())
counter = Counter(s)
max=counter.most_common(1)[0][1]
for w in counter.most_common():
    if w[1]==max:
        ansl.append(w[0])
ansl.sort()
for i in range(len(ansl)):
    print(ansl[i])

Fixed submission:
from collections import Counter
n=int(input())
s=[]
ansl=[]
for i in range(n):
    s.append(input())
counter = Counter(s)
max=counter.most_common(1)[0][1]
for w in counter.most_common():
    if w[1]==max:
        ansl.append(w[0])
ansl.sort()
for i in range(len(ansl)):
    print(ansl[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
max=0
sump=0
ans=0
for i in range(n-k+1):
    sump=sum(p[i:i+k])
    if sump>max:
        max=sump
ans=(max+k)/2
print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
sump=sum(p[0:k])
max=sump
ans=0
for i in range(n-k):
    sump=sump-p[i]+p[i+k]
    if sump>max:
        max=sump
ans=(max+k)/2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))
max=0
sump=0
ans=0
for i in range(n-k+1):
    sump=sum(p[i:i+k])
    if sump>max:
        max=sump
ans=(max+k)/2
print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
sump=sum(p[0:k])
max=sump
ans=0
for i in range(n-k):
    sump=sump-p[i]+p[i+k]
    if sump>max:
        max=sump
ans=(max+k)/2
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(a*b//math.gcd(a, b))

Fixed submission:
import fractions
a,b=map(int,input().split())
print(a*b//fractions.gcd(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n=int(input())
    ans=0
    bit=[0]*60
    seki=10**9+7
    a=list(map(int,input().split()))
    for i in range(n):
        for j in range(60):
            if a[i]%2==1:
                bit[j]+=1
            a[i]=a[i]>>1
    for i in range(60):
        ans+=(bit[i]*(n-bit[i]))*(2**i)
    print(ans%seki)
main()


Fixed submission:
def main():
    n=int(input())
    ans=0
    bit=[0]*60
    seki=10**9+7
    a=list(map(int,input().split()))
    for i in range(n):
        for j in range(60):
            if a[i]%2==1:
                bit[j]+=1
            a[i]=a[i]>>1
    for i in range(60):
        ans+=(bit[i]*(n-bit[i]))*(2**i)
    print(ans%seki)
main()
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
a=list(map(int,input().split()))
ans=9999999999
hidari=sum(a)
migi=0
for i in range(n):
    hidari-=a[i]
    migi+=a[i]
    sa=math.abs(hidari-migi)
    if sa<ans:
        ans=sa
print(ans)


Fixed submission:
import math
n=int(input())
a=list(map(int,input().split()))
ans=9999999999
hidari=sum(a)
migi=0
for i in range(n):
    hidari-=a[i]
    migi+=a[i]
    sa=math.fabs(hidari-migi)
    if sa<ans:
        ans=sa
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
for i in range(n):
    ans+=i
print(ans)


Fixed submission:
n=int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
a=a-1
x=(c*d)//math.gcd(c,d)
n=b//c-a//c
m=b//d-a//d
o=b//x-a//x
ans=b-a-n-m+o
print(ans)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
a=a-1
x=(c*d)//fractions.gcd(c,d)
n=b//c-a//c
m=b//d-a//d
o=b//x-a//x
ans=b-a-n-m+o
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
scnt=s.count("#.")
ans=0
while scnt>0:
    ans+=scnt
    s=s.replace("#.","")
    scnt=s.count("#.")
print(ans)

Fixed submission:
n=int(input())
s=input()
sirocnt=s.count('.')
kurocnt=0
ans=[sirocnt]
for i in range(n):
    if s[i]=='.':
        sirocnt-=1
    else:
        kurocnt+=1
    ans.append(sirocnt+kurocnt)
print(min(ans))
Buggy python submission (verdict: Runtime Error):
abc=[]
answer=0
for i in range(5):
    d=int(input())
    if d%10==0:
        answer+=d
    else:
        answer+=(int(d/10+1))*10
        abc.append(d%10)
answer-=10-min(abc)
print(answer)

Fixed submission:
abc=[]
answer=0
for i in range(5):
    d=int(input())
    if d%10==0:
        answer+=d
    else:
        answer+=(int(d/10+1))*10
        abc.append(d%10)
if len(abc)>0:
    answer-=10-min(abc)
print(answer)
Buggy python submission (verdict: Runtime Error):
s=input()
cnt=0
cntlen=[]
for i in range(len(s)):
    if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
        cnt+=1
    else:
        cntlen.append(cnt)
        cnt=0
print(max(cntlen))

Fixed submission:
s=input()
cnt=0
cntlen=[]
for i in range(len(s)):
    if s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T':
        cnt+=1
    else:
        cntlen.append(cnt)
        cnt=0
cntlen.append(cnt)
print(max(cntlen))
Buggy python submission (verdict: Runtime Error):
import math
li = list(map(int,input().split()))
a=li[0]
b=li[1]
k=li[2]
saidai=math.gcd(a,b)
yakusuu=[]
for i in range(100):
    if saidai%(i+1)==0:
        yakusuu.append(i+1)
yakusuu.sort()
yakusuu.reverse()
print(yakusuu[k-1])

Fixed submission:
import fractions
li = list(map(int,input().split()))
a=li[0]
b=li[1]
k=li[2]
saidai=fractions.gcd(a,b)
yakusuu=[]
for i in range(100):
    if saidai%(i+1)==0:
        yakusuu.append(i+1)
yakusuu.sort()
yakusuu.reverse()
print(yakusuu[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
takahashi=[]
aoki=[]
gohan=[]
kouhuku_t=0
kouhuku_a=0
for i in range(n):
    a,b=map(int,input().split())
    takahashi.append(a)
    aoki.append(b)
    gohan.append(a+b)
for i in range(n):
    if i%2==0:
        count=np.argmax(gohan)
        kouhuku_t+=takahashi.pop(count)
        del aoki[count]
    else:
        count=np.argmax(aoki)
        kouhuku_a+=aoki.pop(count)
        del takahashi[count]
    del gohan[count]
print(kouhuku_t-kouhuku_a)

Fixed submission:
n = int(input())
c = []#料理Nに対する高橋くんと青木さんの幸福度の和？
bs = 0#全ての料理を青木さんが食べたと仮定した時の青木さんの幸福度
for i in range(n):
    a,b = map(int,input().split())
    bs += b
    c.append(a+b)

c.sort()#Cを昇順ソート
c.reverse()#降順に直す

ans = -bs
for i in range(n):
    if i%2==0: ans += c[i]#高橋くんが食べる時、引いた青木さんの幸福度(食べてないのでいらない)と高橋くんの幸福度を足す
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n=1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Fixed submission:
n=int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
import sys
import os
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
m=list(map(int,input().split()))
k=lcm_list(m)
answer=0
for i in range(n):
    answer=answer+(m[i]%k)
print(answer-n)


Fixed submission:
#coding: UTF-8
import sys
import os
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
m=list(map(int,input().split()))
k=lcm_list(m)
k=k-1
answer=0
for i in range(n):
    answer=answer+(k%m[i])
print(answer)