Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
times_a = list(map(int, input().split()))
times_b = list(map(int, input().split()))
read_time = 0
read_time_a = [0]
read_time_b = [0]
for i in range(len(times_a)):
    read_time_a.append(read_time_a[i]+times_a[i])
for i in range(len(times_b)):
    read_time_b.append(read_time_b[i]+times_b[i])
count = 0
for i in range(N+1):
    t = read_time_a[i]
    l = 0
    r = len(read_time_b)
    while l + 1 < r:
        c = (l + r) // 2
        if t + read_time_b[c] <= K:
            l = c
        else:
            r = c
    if read_time_a[i] + read_time_b[l] <= K:
        ans = max(ans, i + l)
print(ans)


Fixed submission:
N, M, K = map(int, input().split())
times_a = list(map(int, input().split()))
times_b = list(map(int, input().split()))
read_time = 0
read_time_a = [0]
read_time_b = [0]
for i in range(N):
    read_time_a.append(read_time_a[i]+times_a[i])
for i in range(M):
    read_time_b.append(read_time_b[i]+times_b[i])

ans = 0
for i in range(N+1):
    t = read_time_a[i]
    l = 0
    r = len(read_time_b)
    while l + 1 < r:
        c = (l + r) // 2
        if t + read_time_b[c] <= K:
            l = c
        else:
            r = c
    if read_time_a[i] + read_time_b[l] <= K:
        ans = max(ans, i + l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
b = 0
for i in range(n):
    if i == 0:
        b = int(a[i])
    else:
        b = b * int(a[i])
if b > 10 ** 18:
    print(-1)
else:
    print(int(b))

Fixed submission:
n = int(input())
a = input().split()
b = 0
is_include_zero = False
too_big = False
for i in a:
    if int(i) > 10 ** 18:
        print(-1)
        too_big = True
    if int(i) == 0:
        is_include_zero = True
if too_big:
    pass
elif is_include_zero:
    print(0)
else:
    for i in range(n):
        if b > 10 ** 18:
            break
        if i == 0:
            b = int(a[i])
        else:
            b = b * int(a[i])
    if b > 10 ** 18:
        print(-1)
    else:
        print(int(b))
Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = ""

al = ['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', 'z']

while n > 0:
    tmp = n % 26
    if tmp > 0:
        ans += al[tmp-1]
    else:
        ans += 'z'
        n -= 1
    n /= 26
    if n == 0:
        break

print(ans[::-1])


Fixed submission:
n = int(input())

ans = ""

al = ['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', 'z']

while n > 0:
    tmp = n % 26
    if tmp > 0:
        ans += al[tmp-1]
    else:
        ans += 'z'
        n = n - 1
    n = n // 26

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = ""

while(n > 0):
    tmp = n % 26
    if tmp > 0:
        ans += chr((tmp - 1) + ord('a'))
    else:
        ans += 'z'
        n -= 1
    n /= 26
    if n == 0:
        break

print(ans[::-1])


Fixed submission:
n = int(input())

ans = ""

al = ['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', 'z']

while n > 0:
    tmp = n % 26
    if tmp > 0:
        ans += al[tmp-1]
    else:
        ans += 'z'
        n = n - 1
    n = n // 26

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = ""

while(n > 0):
    tmp = n % 26
    if tmp > 0:
        ans += chr((tmp - 1) + ord('a'))
    else:
        ans += 'z'
        n -= 1
    n /= 26

print(ans[::-1])


Fixed submission:
n = int(input())

ans = ""

al = ['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', 'z']

while n > 0:
    tmp = n % 26
    if tmp > 0:
        ans += al[tmp-1]
    else:
        ans += 'z'
        n = n - 1
    n = n // 26

print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
x = 7
for i in range(1,k+1):
    if x%k==0:
        print(i)
        break
    x=int('7'*(i+1))%k
else:
    print(-1)

Fixed submission:
k = int(input())
x = 7
for i in range(1,k+1):
    if x%k==0:
        print(i)
        break
    x=(x*10+7)%k
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1

for i in a:
    ans *= i

if (ans > 1000000000000000000):
        ans = -1

print(ans)

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

for i in a:
    ans *= i

    if (ans > 1000000000000000000):
        ans = -1
        break

if(0 in a): print(0)
else: print(ans)
Buggy python submission (verdict: Runtime Error):
n,x,t=map(int,input())
if n%x==0:
  print(int(n//x)*t)
else:
  print((int(n//x)+1)*t)

Fixed submission:
n,x,t=map(int,input().split())
if n%x==0:
  print(int(n//x)*t)
else:
  print((int(n//x)+1)*t)
Buggy python submission (verdict: Runtime Error):
import sympy
n=int(input())
ans=0
for i in range(1,n+1):
    ans+=i*sympy.divisor_count(i)
    

print(ans)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i #　iを約数にもつ数の個数
    j=(1+m)*m//2 
    ans+=j*i
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
hw=list(map(int,input().split()))

for i in range(1,n+1):
    print(hw.count(i))



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

o={}
for i in range(1,n+1):
  o[i]=0
  
for p in m:
  o[p]+=1

for i in range(1,n+1):
  print(o[i])
Buggy python submission (verdict: Time Limit Exceeded):
t,n=map(int,input().split())
x=list(map(int,input().split()))
xx=[i+t for i in x]
x=x+xx
dis=[]
for i in range(2*n-1):
    dis.append(x[i+1]-x[i])

ans=[]
for j in range(2*n-2):
    ans2=dis[j:j+n-1]
    ans.append(sum(ans2))
print(min(ans))

Fixed submission:
t,n=map(int,input().split())
x=list(map(int,input().split()))
x.insert(0,x[-1]-t)
dis=[x[i+1]-x[i] for i in range(n)]
print(sum(dis)-max(dis))
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
x=n//(a+b)+1

ans=""
i=1
while i<=x:
    ans=ans+"A"*a+"B"*b
    i+=1
#ans2=[ans]
ans2=ans[:n]
print(ans2.count("A"))

Fixed submission:
n,a,b=map(int,input().split())
x=n//(a+b)
y=n%(a+b)
z=min(a,y)
print(a*x+z)
Buggy python submission (verdict: Runtime Error):
for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[0]==b3[0]==0:
    print("Yes")
elif b1[1]==b2[1]==b3[1]==0:
    print("Yes")
elif b1[2]==b2[2]==b3[2]==0:
    print("Yes")

    
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
elif b1[2]==b2[1]==b3[0]==0:
    print("Yes")
else:
    print("No")

Fixed submission:
b1=list(map(int,input().split()))
b2=list(map(int,input().split()))
b3=list(map(int,input().split()))
n=int(input())

for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[0]==b3[0]==0:
    print("Yes")
elif b1[1]==b2[1]==b3[1]==0:
    print("Yes")
elif b1[2]==b2[2]==b3[2]==0:
    print("Yes")
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
elif b1[2]==b2[1]==b3[0]==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[-1]*n
a,b=map(int,input().split())
ans[a-1]=b

for i in range(m-1):
    a,b=map(int,input().split())
    if ans[a-1]!=-1 and ans[a-1]!=b:
        print(-1)
        exit()
    else:
        ans[a-1]=b
       


if n>1 and ans[0]==0:
    print(-1)
elif n==1:
    if ans[0]==-1:
        print(0)
    else:
        print(ans[0])

elif n==2:
    for j in range(2):
        if ans[j]==-1:
            ans[j]=0
    print(10*ans[0]+ans[1])
else:
    for j in range(3):
        if ans[j]==-1:
            ans[j]=0
    
    print(100*ans[0]+10*ans[1]+ans[2])
    
          

Fixed submission:
n,m=map(int,input().split())
ans=[]

for i in range(m):
    ans.append(list(map(int,input().split())))
for j in range(10**n):
    if len(str(j))==n and all(str(j)[s-1]==str(c) for s,c in ans):
        print(j)
        break
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[-1]*n
a,b=map(int,input().split())
ans[a-1]=b

for i in range(m-1):
    a,b=map(int,input().split())
    if ans[a-1]==-1 or ans[a-1]==b:
        ans[a-1]=b
    else:
        print(-1)
        exit()


if n>1 and ans[0]==0:
    print(-1)
elif n==1:
    if ans[0]==-1:
        print(0)
    else:
        print(ans[0])

elif n==2:
    for j in range(2):
        if ans[j]==-1:
            ans[j]=0
    print(10*ans[0]+ans[1])
else:
    for j in range(3):
        if ans[j]==-1:
            ans[j]=0
    
    print(100*ans[0]+10*ans[1]+ans[2])
    
          

Fixed submission:
n,m=map(int,input().split())
ans=[]

for i in range(m):
    ans.append(list(map(int,input().split())))
for j in range(10**n):
    if len(str(j))==n and all(str(j)[s-1]==str(c) for s,c in ans):
        print(j)
        break
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=["x"]*n

for i in range(m):
    a,b=map(int,input().split())
    
    if ans[a-1]=="x" or ans[a-1]==b:
        ans[a-1]=b
    else:
        print(-1)
        exit()

if n==1 and ans[0]==0:
    print(0)
elif n>1 and ans[0]==0:
    print(-1)
elif "x" not in ans:
    print ("".join(ans))
    
else:
    for j in range(n):
        if ans[j]=="x":
            ans[j]=0
        print(ans[j], end="")
            


Fixed submission:
n,m=map(int,input().split())
ans=[]

for i in range(m):
    ans.append(list(map(int,input().split())))
for j in range(10**n):
    if len(str(j))==n and all(str(j)[s-1]==str(c) for s,c in ans):
        print(j)
        break
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n=int(input())
l=[]
for i in range(n):
    l.append(input())
l2=collections.Counter(l)


max_k_list = [kv[0] for kv in l2.items() if kv[1] == max(l2.values())]
l3=sorted(max_k_list)
print("\n".join(l3))

Fixed submission:
import collections

n=int(input())
l=[]
for i in range(n):
    l.append(input())
l2=collections.Counter(l)
max=max(l2.values())

max_k_list = [kv[0] for kv in l2.items() if kv[1] == max]
l3=sorted(max_k_list)
print("\n".join(l3))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(map(int,input().split()))

ans=1
for i in range(1,n):
    s2=s[:i+1]
    #print(max(s2))

    if s[i]<=min(s2):
        ans+=1
    
print(ans)


Fixed submission:
n=int(input())
s=list(map(int,input().split()))
 
ans=0
smin=s[0]
for i in range(n):
    if s[i]<=smin:
        ans+=1
        smin=s[i]
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions

a,b=map(int,input().split())
print(int((a * b /fraction.gcd(a, b))))

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

Buggy python submission (verdict: Runtime Error):
import fraction

a,b=map(int,input().split())
print(int((a * b /fraction.gcd(a, b))))

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

Buggy python submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())
print(int((a * b /math.gcd(a, b))))


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

l=list(map(int,input().split()))
cnt=0
for i in range(n):
	if l[i]==cnt+1:
      cnt+=1
      
if cnt==0:
  	print(-1)
else:
  print(n-cnt)
  

     
      
      

Fixed submission:
n=int(input())
 
l=list(map(int,input().split()))
cnt=0
for i in range(n):
	if l[i]==cnt+1:
	    cnt+=1
      
if cnt==0:
  	print(-1)
else:
  print(n-cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=[]

nr=int(n**0.5)


for i in range(1,nr):
    if n%i==0:
        ans.append(i+n//i)
   
ans2=sorted(ans)
print(ans2[0]-2)

Fixed submission:
n=int(input())
ans=[]

nr=int(n**0.5)


for i in range(1,nr+1):
    if n%i==0:
        ans.append(i+n//i)
   
ans2=sorted(ans)
print(ans2[0]-2)
Buggy python submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
y=0
if x<=a**2*b*0.5:
    y+=2*x/(a*b**2)
   
else:
    y+=a**3/(2*b*a**2-2*x)
   
theta=math.degrees(math.atan(y))   
print(90 - theta)    

Fixed submission:
import math
a,b,x=map(int,input().split())
y=0
if x==a**2*b:
    print(0)
    exit()
elif x<=a**2*b*0.5:
    y+=2*x/(a*b**2)
   
else:
    y+=a**3/(2*b*a**2-2*x)
   
theta=math.degrees(math.atan(y))   
print(90 - theta)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ss=list(map(int,input().split()))
s=sorted(ss)
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if s[i]+s[j]>s[k]:
                ans+=1

print(ans)


Fixed submission:
from bisect import bisect_left
n = int(input())
l = [int(_) for _ in input().split()]
l.sort()
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        cnt += max(0, bisect_left(l, l[i] + l[j]) - (j+1))
print(cnt)

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


Fixed submission:
from bisect import bisect_left
n = int(input())
l = [int(_) for _ in input().split()]
l.sort()
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        cnt += max(0, bisect_left(l, l[i] + l[j]) - (j+1))
print(cnt)

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

Fixed submission:
from bisect import bisect_left
n = int(input())
l = [int(_) for _ in input().split()]
l.sort()
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        cnt += max(0, bisect_left(l, l[i] + l[j]) - (j+1))
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

c=list(map(int,input().split()))

i=m
while i>0:
    ma=max(c)
    ind=c.index(ma)
    c[ind]=ma//2
    
    i-=1
    
print(sum(c))

Fixed submission:
import heapq
n,m=map(int,input().split())

c=list(map(lambda x: int(x)*-1,input().split()))
#heapqでは最小値しか取り出せないので最大値をとるばあには－１をかけておく

heapq.heapify(c)  #リストを優先度付きキューに
for i in range(m):
    cmin=heapq.heappop(c)  #最小値の取り出し
    heapq.heappush(c,(-1)*(-cmin//2))#最小値を2で割った商をリストに追加

print(-sum(c))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

c=sorted(list(map(int,input().split())))

i=m
while i>0:
    c[-1]=c[-1]//2
    c=sorted(c)
    i-=1

print(sum(c))

Fixed submission:
import heapq
n,m=map(int,input().split())

c=list(map(lambda x: int(x)*-1,input().split()))
#heapqでは最小値しか取り出せないので最大値をとるばあには－１をかけておく

heapq.heapify(c)  #リストを優先度付きキューに
for i in range(m):
    cmin=heapq.heappop(c)  #最小値の取り出し
    heapq.heappush(c,(-1)*(-cmin//2))#最小値を2で割った商をリストに追加

print(-sum(c))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
l=[]
for i in range(n):
    l.append(sorted(input()))

ll=sorted(l)

for j in range(n):
    for k in range(j+1,n):
        if ll[j]==ll[k]:
            ans+=1
    
print(ans)


Fixed submission:
n=int(input())
l=[]
for i in range(n):
    s = input()
    s = sorted(s)
    l.append(''.join(s))
l.sort()
sa = l[0]
cnt = 0
n = 1
for sb in l[1:]:
  if sb == sa:
    n += 1
  else:
    cnt += (n * (n-1) // 2)
    n = 1
    sa = sb
cnt += (n * (n-1) // 2)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
l=[]
for i in range(n):
    l.append(sorted(input()))

for j in range(n):
    for k in range(j+1,n):
        if l[j]==l[k]:
            ans+=1
    
print(ans)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    s = input()
    s = sorted(s)
    l.append(''.join(s))
l.sort()
sa = l[0]
cnt = 0
n = 1
for sb in l[1:]:
  if sb == sa:
    n += 1
  else:
    cnt += (n * (n-1) // 2)
    n = 1
    sa = sb
cnt += (n * (n-1) // 2)
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=input()
x=len(n)
if x==1:
    print(n)

elif x<3:
    print(9)
elif x==3:
    print(9+int(n)-100+1)
elif x<5:
    print(909)
elif x==5:
    print(9+900+int(n)-10000+1)
else:
    print(90909)

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())
l=list(map(int,input().split()))


for i in range(n):
    for k in range(1,n-i):
        if l[i]-l[i+k]>1:
            print("No")
            exit()
   
print("Yes")

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

min=0
ans=True

for i in range(n):
    if l[i]-1>=min:
        min=l[i]-1
    elif l[i]>=min:
        min=l[i]
    else:
        ans=False

        
if ans:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))

for i in range(n):
    for k in range(n-i):
        if l[i]-l[i+k]>=2:
            print("No")
            exit()
print("Yes")


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

min=0
ans=True

for i in range(n):
    if l[i]-1>=min:
        min=l[i]-1
    elif l[i]>=min:
        min=l[i]
    else:
        ans=False

        
if ans:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())

amari=[(a*(a+1)%2019)]
for i in range(a,b):
    for j in range(i+1,b+1):
        if (i*j)%2019<amari[-1]:
            amari.append((i*j)%2019)

print(amari[-1])

Fixed submission:
a,b=map(int,input().split())


amari=[(a*(a+1)%2019)]
for i in range(a,b):
    for j in range(i+1,b+1):
        x=i%2019
        y=j%2019
        if x==0 or y==0:
            print(0)
            exit()
        elif (x*y)%2019<amari[-1]:
            amari.append((x*y)%2019)

print(amari[-1])
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math


lcm=int(c*d/math.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))


Fixed submission:
a,b,c,d=map(int,input().split())
import fractions


lcm=int(c*d/fractions.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))

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

e=int(c*d/math.gcd(c,d))
x1=(a-1)//c
x2=b//c
y1=(a-1)//d
y2=b//d
z1=(a-1)//e
z2=b//e


print(int(b-a+1-(x2-x1+y2-y1-(z2-z1))))     


Fixed submission:
a,b,c,d=map(int,input().split())
import fractions


lcm=int(c*d/fractions.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))

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

e=int(c*d/math.gcd(c,d))
x1=(a-1)//c
x2=b//c
y1=(a-1)//d
y2=b//d
z1=(a-1)//e
z2=b//e


#print(a,b,c,d,e,x1,x2,y1,y2,z1,z2)

print(b-a+1-(x2-x1+y2-y1-(z2-z1)))     

Fixed submission:
a,b,c,d=map(int,input().split())
import fractions


lcm=int(c*d/fractions.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int,input().split())

s=0
for i in range(a,b+1):
    if i%c==0 or i%d==0:
        s+=1
print(b-a+1-s)


Fixed submission:
a,b,c,d=map(int,input().split())
import fractions


lcm=int(c*d/fractions.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)
#print(ans2)    
print(max(ans2))

Fixed submission:
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n-1):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
if s[n-1] in at:
    ans.append(n)
else:
    ans.append(n-1)

m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)

#print(ans)
#print(ans2)

if len(ans)==1:
    print(n)
elif len(ans2)==0:
    print(0)
else:
    print(max(ans2))

Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j])
print(ans)    
print(max(ans2)-1)

Fixed submission:
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n-1):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
if s[n-1] in at:
    ans.append(n)
else:
    ans.append(n-1)

m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)

#print(ans)
#print(ans2)

if len(ans)==1:
    print(n)
elif len(ans2)==0:
    print(0)
else:
    print(max(ans2))
Buggy python submission (verdict: Runtime Error):
import math

a,b,k=map(int,input().split())

n=math.gcd(a,b)
ans=[]
for i in range(1,n+1):
    if n%int(i)==0:
        ans.append(i)

ans1=ans[::-1]

print(ans1[k-1])

Fixed submission:
a,b,k=map(int,input().split())
A=set()
for i in range(1,a+1):
    if a%i==0:
        A.add(i)
B=set()
for j in range(1,b+1):
    if b%j==0:
        B.add(j)
ans=A & B
ans2=list(ans)
ans3=sorted(ans2, reverse=True)
#print(ans3)
print(ans3[k-1])

Buggy python submission (verdict: Runtime Error):
import math

a,b,k=map(int,input().split())

n=math.gcd(a,b)
ans=[]
for i in range(1,n+1):
    if n%int(i)==0:
        ans.append(i)

ans1=ans[::-1]

print(ans1[k-1])

Fixed submission:
a,b,k=map(int,input().split())
A=set()
for i in range(1,a+1):
    if a%i==0:
        A.add(i)
B=set()
for j in range(1,b+1):
    if b%j==0:
        B.add(j)
ans=A & B
ans2=list(ans)
ans3=sorted(ans2, reverse=True)
#print(ans3)
print(ans3[k-1])
Buggy python submission (verdict: Runtime Error):
print("Heisei" if input()<="2019/04/30" and"TBD")

Fixed submission:
ymd=input().split("/")
m=["01","02","03","04"]
if ymd[1] in m:
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Runtime Error):
n=int(input(n))
amt=0
for i in range(n):
  x,y =input().split()
  if y=="JPY":
    amt+=float(x)
  else:
    amt+=float(x)*380000.0
print(amt)
    
  

Fixed submission:
n=int(input( ))
amt=0
for i in range(n):
    x,y =input().split()
    if y=="JPY":
        amt+=float(x)
    else:
        amt+=float(x)*380000.0
print(amt)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

ps=sorted(int(i) for i in input().split())

if n>=m:
    print(0)
    exit()

dis2=sorted(ps[i+1]-ps[i] for i in range(m-1))


print(sum(dis2[:m-n]))


Fixed submission:
a,b=map(float,input().split())
print(a/b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
print("Hello World" if n==1 else int(input())+int(input())


Fixed submission:
n=int(input())

print("Hello World" if n==1 else int(input())+int(input()))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
print("Hello World" if n==1 else a+b)


Fixed submission:
n=int(input())

print("Hello World" if n==1 else int(input())+int(input()))

Buggy python submission (verdict: Runtime Error):
n=int(input())
print("Hello World" if n==1 else a+b)

Fixed submission:
n=int(input())

print("Hello World" if n==1 else int(input())+int(input()))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[111,222,333,444,555,666,777,888,999]
ans=[]
for i in range(8):
    if l[i]-n>=0:
        ans.append(i)
        
print(l[ans[0]])

Fixed submission:
n=int(input())
if n%111==0:
    print(n)
else:
    print(-((-n)//111)*111)