Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02642 (python)

Fixed submission:
import io,sys
sys.setrecursionlimit(10**6)

def main():
    import bisect
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))
    A.sort()

    ans = 0
    a_max = A[-1]
    note = [True]*(a_max+1)
    for j in range(n):
        a = A[j]
        if note[a]:
            if j != n-1 and A[j]==A[j+1]:
                ans-=1
            ans+=1
            # for i in range(a,a_max+1):
            #     if i%a==0:
            #         note[i] = False
            temp = a 
            while temp <= a_max:
                note[temp]=False
                temp+=a

        
    
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    A = list(map(int,input().split()))
    A.sort()
    A_max = A[-1]
    g = []
    table = [True]*(A_max+1)
    for i,a in enumerate(A):
        if table[i] and i!=n-1 and a != A[i+1]:
            g.append(a)
            for j in range(A_max//a):
                table[a*j] = False
    print(len(g))
main()

Buggy submission (verdict: Runtime Error):
def main():
    import bisect
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))
    A.sort()

    ans = 0
    a_max = A[-1]
    note = [True]*(a_max+1)
    for j in range(n):
        a = A[j]
        if note[a]:
            if j != n-1 and A[j]==A[j+1]:
                ans-=1
            ans+=1
            for i in range(a,a_max+1):
                if i%a==0:
                    note[i] = False

        
    
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
import io,sys
sys.setrecursionlimit(10**6)

def main():
    import bisect
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))


    A.sort()
    ans = 0
    a_max = A[-1]
    note = [True]*(a_max+1)
    for j in n:
        a = A[j]
        if note[a]:
            for i in range(a,a_max+1):
                if i%a==0:
                    note[i] = False
            ans+=1

        
    
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
import io,sys
sys.setrecursionlimit(10**6)
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    import bisect
    n = int(input())
    A = list(map(int,sys.stdin.readline().rstrip().split()))
    A.sort()

    ans = 0
    for i in range(n):

        if i == 0:
            if A[0] != A[1]:
                ans+=1
                continue
            else:
                continue

        a = A[i]
        a_last = A[i-1]
        if a == a_last or (i!=n-1 and a == A[i+1]):
            continue
        poi = A[:i]
        div = make_divisors(a)
        for d in div:
            if d > a_last:
                break
            k = bisect.bisect_left(poi,d)
            if poi[k]==d:
                ans-=1
                break
        ans+=1
    
    print(ans)
main()
Problem p02657 (python)

Fixed submission:
import io,sys
sys.setrecursionlimit(10**6)

def main():
    a,b =map(int,sys.stdin.readline().rstrip().split())
    print(a*b)
main()

Buggy submission (verdict: Runtime Error):
def prime(n):
    nums = [True]*n
    primes = []
    for i in range(2,n):
        if nums[i]:
            primes.append(i)
            for j in range(2*i,n,i):
                nums[j] = False
    return primes

def prime_fac(n):
    fac = {}
    primes = prime(int(n**0.5)+1)
    for p in primes:
        while n%p==0:
            fac[p] = fac.get(p,0)+1
            n//=p
    if n > 1:
        fac[n] = 1
    return fac

def main():
    n = int(input())
    fac = prime_fac(n)

    ans = 0
    for i in fac.values():
        ct = 1
        while i >= ct*(ct+1)//2:
            ct += 1
            ans+=1
    print(ans)
main()
Problem p02684 (python)

Fixed submission:
def main():
    from sys import stdin
    n,k = map(int,stdin.readline().rstrip().split())
    As = list(map(int,stdin.readline().rstrip().split()))
    As = [0]+As
    g = set({1})
    l = [0,1]
    now = 1
    i = 0
    while True:
        i+=1
        now = As[now]
        if now in g:
            j = l.index(now)
            print(l[j+(k-i)%(i+1-j)])
            break
            
        else:
            g.add(now)
            l.append(now)
        
        if i == k:
            print(now)
            break
main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin
    n,k = map(int,stdin.readline().rstrip().split())
    As = list(map(int,stdin.readline().rstrip().split()))
    As = [0]+As
    g = set({1})
    l = [0,1]
    now = 1
    for i in range(1,k+1):
        now = As[now]
        if now in g:
            break
            
        else:
            g.add(now)
            l.append(now)

    j = l.index(now)
    print(l[j+(k-i)%(i+1-j)])
main()
Problem p02691 (python)

Fixed submission:
def main():
    from collections import Counter
    n = int(input())
    As = list(map(int,input().split(" ")))
    
    cnts = Counter()
    dp = [0]*n
    cnts[As[0]+1]+=1
    for i in range(1,n):
        dp[i] =dp[i-1] + cnts.get(i+1-As[i],0)
        cnts[As[i]+i+1]+=1
    print(dp[n-1])
main()

Buggy submission (verdict: Runtime Error):
ef main():
    from collections import Counter
    n = int(input())
    As = list(map(int,input().split(" ")))
    
    cnts = Counter()
    dp = [0]*n
    for i in range(1,n):
        dp[i] =dp[i-1] + cnts.get(i-As[i],0)
        cnts[As[i]+i]+=1
    print(dp[n-1])
main()
Problem p02787 (python)

Fixed submission:
def ceil(x,p):
    if x%p==0:
        return x//p
    else:
        return x//p+1

def main():
    INF = 10**9
    h,n = map(int,input().split())
    spell = []
    for _ in range(n):
        spell.append(tuple(map(int,input().split())))

    dp = [[INF]*(h+1) for _ in range(n+1)]

    for i,item in enumerate(spell):
        a,b = item
        for j in range(h):
            if j-a<0:
                dp[i+1][j+1] = min(dp[i][j+1],b*ceil(j+1,a))
            else:
                dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j+1-a]+b)
        
    print(dp[n][h])
main()

Buggy submission (verdict: Runtime Error):
from math import ceil
sys.setrecursionlimit(10**6)
def main():
    INF = 10**9
    h,n = map(int,input().split())
    spell = []
    for _ in range(n):
        spell.append(tuple(map(int,input().split())))

    dp = [[INF]*(h+1) for _ in range(n+1)]

    for i,item in enumerate(spell):
        a,b = item
        for j in range(h):
            if j-a<0:
                dp[i+1][j+1] = min(dp[i][j+1],b*ceil((j+1)/a))
            else:
                dp[i+1][j+1] = min(dp[i][j+1],dp[i+1][j+1-a]+b)
        
    print(dp[n][h])
main()
Problem p03206 (python)

Fixed submission:
n=int(input())
if n==25:
    print('Christmas')
if n==24:
    print('Christmas Eve')
if n==23:
    print('Christmas Eve Eve')
if n==22:
    print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==25:
    print(Christmas)
if n==24:
    print(Christmas Eve)
if n==23:
    print(Christmas Eve Eve)
if n==22:
    print(Christmas Eve Eve Eve)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n=25:
    print(Christmas)
if n=24:
    print(Christmas Eve)
if n=23:
    print(Christmas Eve Eve)
if n=22:
    print(Christmas Eve Eve Eve)

Buggy submission (verdict: Runtime Error):
print(Christmas Eve *(25-int(input())
Problem p03231 (python)

Fixed submission:
def gcd(a,b):
    if b:
        return gcd(b,a%b)
    else:
        return a    

n,m=map(int,input().split())
s=input()
t=input()
c=0
g=gcd(n,m)
x=n*m//(gcd(n,m))
for k in range(g):
    if s[int(k*n/g)]==t[int(k*m/g)]:
        continue
    else:
        c=-1
        break
       
if c==-1:
    print(c)            
                        
else:
    print(x)

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
s=input()
t=input()
c=0
g=math.gcd(n,m)
x=n*m//(math.gcd(n,m))
for k in range(g):
    if s[int(k*n/g)]==t[int(k*m/g)]:
        continue
    else:
        c=-1
        break
       
if c==-1:
    print(c)            
                        
else:
    print(x)

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
s=input()
t=input()
c=0
for i in range(m):
    for j in range(n):
        if m*j==n*i:
            if s[j]==t[i]:
                continue
            else:
                c+=1
                break
        else:
            continue
            
if c!=0:
    print(-1)            
                        
else:
    
    print(n*m//(math.gcd(n,m)))
Problem p03260 (python)

Fixed submission:
A,B=map(int,input().split())
if A*B%2==0:
	print("No")
else:
	print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[input() for i in range(N)]
if len(set(a))!=N:
	print("No")
else:
	for i in range(1,N):
		if a[i-1][-1]!=a[i][0]:
			print("No")
			break
		print("yes")
Problem p03289 (python)

Fixed submission:
S=input()
if S[0]=="A" and S[2:-1].count("C")==1:
	index=S.index("C")
	S=S[1:index]+S[index+1:]
	if S.islower():
		print("AC")
	else:
		print("WA")	
else:
	print("WA")

Buggy submission (verdict: Runtime Error):
S=input()
if S[0]=="A" and S[2:-1].count("C")==1:
	index=s.index("C")
	S=S[1:index]+S[index+1:]
	if S.islower():
		print("AC")
	else:
		print("WA")	
else:
	print("WA")

Buggy submission (verdict: Runtime Error):
S=input()
char_list=list(S)
if char_list[0]=="A":
	j=0
	del char_list[0]
	for i in range(1,len(char_list)-2):
		if char_list[i]=="C":
			del char_list[i]
			j=j+1
		
	if j==1:
		
		k=0	
		for i in range(0,len(char_list)):	
			if char_list[i].islower():
				k=k+1
			
		if k==len(char_list):
			print("AC")
		else:
			print("WA")			
	else:
		print("WA")		
else:
	print("WA")
Problem p03324 (python)

Fixed submission:
d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1 and n!=100:
    print(n*100)
elif d==1 and n==100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000) 
elif d==2 and n==100:
    print(1010000)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1and n!=100:
    print(n*100)
elif d==1 and n==100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
elif d==2 and n==100:
    pront(1010000

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1and n!=100:
    print(n*100)
elif d==1 and n=100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
elif d==2 and n==100:
    pront(1010000)
Problem p03477 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if a+b>c+d:
    print("Left")
if a+b==c+d:
    print("Balanced")
if a+b<c+d:
    print("Right")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int(),input().split())
if a+b>c+d:
    print("Left")
if a+b==c+d:
    print("Balanced")
else:
    print("Right")
Problem p03609 (python)

Fixed submission:

x,t=map(int,input().split())
if(x-t>=0):
  print(x-t)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x=int(input())
t=int(input())
if(x-t>=0):
  print(x-t)
else:
  print(0)
Problem p03624 (python)

Fixed submission:
s=input()
a="abcdefghijklmnopqrstuvwxyz"
for i in a:
    if i not in s:
        print(i)
        exit()
print("None")

Buggy submission (verdict: Runtime Error):
s=input()
array=[]
for i in range (len(s)):
    array.append(s[i])
for i in range(len(set(s)+1)):
    if chr(97+i) in array:
        continue
    else:
        print(chr(97+i))
        exit()
print("None")
Problem p03643 (python)

Fixed submission:
n=input()
s='ABC'+str(n)
print(s)

Buggy submission (verdict: Runtime Error):
n=input()
  print('ABC'+n)
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
if(a-b>=0):
  print('delicious')
elif(b-a<=x):
  print('safe')
else:
  print('dangerous')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split)
if(a-b>=0):
  print('delicious')
elif(b-a<=x):
  print('safe')
else:
  print('dangerous')
Problem p03773 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b>=24):
    print(a+b-24)
else:
    print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b≧24):
    print(a+b-24)
else:
    print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a+b≧24:
    print(a+b-24)
else:
    print(a+b)
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)


N, M = map(int, input().split())
to = [[] for _ in range(N)]
count = 0

for _ in range(M):
    A, B = map(lambda x:int(x) - 1, input().split())
    to[A].append(B)
    to[B].append(A)


def dfs(v, to, seen):
    global count
    seen[v] = True
    count += 1
    for nv in to[v]:
        if seen[nv]:
            continue
        dfs(nv, to, seen)


def main():
    global count
    seen = [False] * N
    cnts = []
    for i in range(N):
        if not seen[i]:
            dfs(i, to, seen)
            cnts.append(count)
            count = 0
    
    print(max(cnts))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
to = [[] for _ in range(N)]
count = 0

for _ in range(M):
    A, B = map(lambda x:int(x) - 1, input().split())
    to[A].append(B)
    to[B].append(A)


def dfs(v, to, seen):
    global count
    seen[v] = True
    count += 1
    for nv in to[v]:
        if seen[nv] == True:
            continue
        dfs(nv, to, seen)


def main():
    global count
    seen = [False] * N
    cnts = []
    for i in range(N):
        if not seen[i]:
            dfs(i, to, seen)
            cnts.append(count)
            count = 0
    
    print(max(cnts))


if __name__ == "__main__":
    main()
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

now = 1
visited = []
visited_set = set()

for i in range(1, N+1):
    visited.append(now)
    visited_set.add(now)
    now = A[now]
    if now in visited_set:
        loop_start = visited.index(now)
        loop_length = i - loop_start
        break

if K >= loop_start:
    print(visited[loop_start + (K - loop_start) % loop_length])
else:
    print(visited[K])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

now = 1
visited = []
visited_set = set()
for i in range(1, K+1):
    visited.append(now)
    visited_set.add(now)
    now = A[now]
    if now in visited_set:
        loop_start = visited.index(now)
        loop_length = i - loop_start
        break

print(visited[loop_start + (K - loop_start) % loop_length])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

now = 1
visited = []
for i in range(1, K+1):
    visited.append(now)
    now = A[now]
    if now in visited:
        loop_start = visited.index(now)
        loop_length = i - loop_start
        break

print(visited[loop_start + (K - loop_start) % loop_length])
Problem p02780 (python)

Fixed submission:
def ev(n):
    return (n+1) / 2


N, K = map(int, input().split())
p = list(map(int, input().split()))
prev = ev(p[0])
ans = sum([ev(i) for i in p[:K]])
total = ans

for i in range(1, N-K+1):
    total -= prev
    total += ev(p[i+K-1])
    prev = ev(p[i])
    ans = max(ans, total)

print(ans)

Buggy submission (verdict: Runtime Error):
def f(H):
    if H == 1:
        return 1
    return 2 * f(H//2) + 1


def solve():
    H = int(input())
    print(f(H))


if __name__ == "__main__":
    solve()
Problem p02803 (python)

Fixed submission:
from collections import deque


dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

H, W = map(int, input().split())
maze = [input() for _ in range(H)]


def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if maze[i][j] == ".":
                dist = [[-1] * W for _ in range(H)]
                dist[i][j] = 0
                que = deque()
                que.append([i, j])

                while que:
                    y, x = que.popleft()
                    for k in range(4):
                        nx = x + dx[k]
                        ny = y + dy[k]
                        if nx >= W or nx < 0 or ny >= H or ny < 0:
                            continue
                        if dist[ny][nx] != -1:
                            continue
                        if maze[ny][nx] == "#":
                            continue
                        dist[ny][nx] = dist[y][x] + 1
                        que.append([ny, nx])
            else:
                continue
            ans = max(ans, max(max(steps) for steps in dist))
    print(ans)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
from collections import deque


dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

H, W = map(int, input().split())
maze = [input() for _ in range(H)]


def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if maze[i][j] == ".":
                dist = [[-1] * W for _ in range(H)]
                dist[i][j] = 0
                que = deque()
                que.append([i, j])

                while que:
                    y, x = que.popleft()
                    for k in range(4):
                        nx = x + dx[k]
                        ny = y + dy[k]
                        if nx >= W or nx < 0 or ny >= H or ny < 0:
                            continue
                        if dist[ny][nx] != -1:
                            continue
                        if maze[ny][nx] == "#":
                            continue
                        dist[ny][nx] = dist[y][x] + 1
                        que.append([ny, nx])
            
            ans = max(ans, max(max(steps) for steps in dist))
    print(ans)


if __name__ == "__main__":
    solve()
Problem p02850 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**9)


N = int(input())
to = [[] for _ in range(N)]
order = []

for _ in range(N - 1):
    a, b = list(map(lambda x:int(x) - 1, input().split()))
    to[a].append(b)
    to[b].append(a)
    order.append(b)


def solve():
    dist = [-1] * N
    # 頂点iに向かう辺をiとする
    color = [0] * N
    dist[0] = 0
    color[0] = 0
    que = deque([0])

    while que:
        v = que.popleft()
        used_color = [color[v]]
        next_color = 1
        for nv in to[v]:
            if dist[nv] == -1:
                dist[nv] = dist[v] + 1
                while next_color in used_color:
                    next_color += 1
                color[nv] = next_color
                used_color.append(next_color)
                que.append(nv)

    print(len(set(color[1:])))
    for i in range(N - 1):
        print(color[order[i]])


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def dfs(s, to, color, palette, i=0):
    seen[s] = 1
    for v in to[s]:
        if seen[v]:
            continue
        if s < v:
            color[sides.index([s, v])] = palette[i % len(palette)]
            i += 1
        dfs(v, to, color, palette, i)


N = int(input())
sides = [list(map(lambda x:int(x) - 1, input().split())) for _ in range(N - 1)]
to = [[] for _ in range(N)]
for a, b in sides:
    to[a].append(b)
    to[b].append(a)

colors_used = max(len(sub) for sub in to)
palette = [i for i in range(1, colors_used+1)]
seen = [0] * N
color = [0] * (N - 1)

dfs(0, to, color, palette)

print(colors_used)
print(*color, sep='\n')
Problem p02882 (python)

Fixed submission:
import math as m


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

if x == b * a**2:
    print(0)

elif x >= b * a**2 / 2:
    y = 2 * (b - x / (a**2))
    print(90 - m.atan(a / y) * 180 / m.pi)
else:
    y = 2 * x / (a * b)
    print(90 - m.atan(y / b) * 180 / m.pi)

Buggy submission (verdict: Runtime Error):
import math as m


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

if x >= b * a**2 / 2:
    y = 2 * (b - x / (a**2))
    print(90 - m.atan(a / y) * 180 / m.pi)
else:
    y = 2 * x / (a * b)
    print(90 - m.atan(y / b) * 180 / m.pi)
Problem p02936 (python)

Fixed submission:
import sys


sys.setrecursionlimit(300000)

to = [[] for _ in range(200005)]
ans: list


def dfs(v, p=-1):
    global ans
    for u in to[v]:
        if u == p: continue
        ans[u] += ans[v]
        dfs(u, v)
    return


def main():
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a, b = map(int, input().split())
        to[a-1].append(b-1)
        to[b-1].append(a-1)
    global ans
    ans = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        ans[p-1] += x
    dfs(0)
    print(*ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


sys.setrecursionlimit(100000)

to = [[] for _ in range(200005)]
ans: list


def dfs(v, p=-1):
    global ans
    for u in to[v]:
        if u == p: continue
        ans[u] += ans[v]
        dfs(u, v)
    return


def main():
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a, b = map(int, input().split())
        to[a-1].append(b-1)
        to[b-1].append(a-1)
    global ans
    ans = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        ans[p-1] += x
    dfs(0)
    print(*ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
to = [[] for _ in range(200005)]
ans: list


def dfs(v, p=-1):
    global ans
    for u in to[v]:
        if u == p: continue
        ans[u] += ans[v]
        dfs(u, v)
    return


def main():
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a, b = map(int, input().split())
        to[a-1].append(b-1)
        to[b-1].append(a-1)
    
    global ans
    ans = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        ans[p-1] += x
    dfs(0)
    print(*ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def partial_add(p, x, tree, value):
    value[p] += x
    if p in tree.keys():
        for root in tree[p]:
            partial_add(root, x, tree, value)
    return


N, Q = map(int, input().split())
tree = {}
value = [0] * (N+1)

for _ in range(N-1):
    a, b = map(int, input().split())
    try:
        tree[a].append(b)
    except KeyError:
        tree[a] = [b]

for i in range(Q):
    p, x = map(int, input().split())
    partial_add(p, x, tree, value)

print(*value[1:])
Problem p02995 (python)

Fixed submission:
from fractions import gcd


A, B, C, D = map(int, input().split())
lcm = C * D // gcd(C, D)
print(
    B - B//C - B//D + B//lcm
    - ((A-1) - (A-1)//C - (A-1)//D + (A-1)//lcm)
)

Buggy submission (verdict: Runtime Error):
from math import gcd


A, B, C, D = map(int, input().split())
lcm = C * D // gcd(C, D)
print(
    B - B//C - B//D + B//lcm
    - ((A-1) - (A-1)//C - (A-1)//D + (A-1)//lcm)
)