qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
A = []
for i in range(N):
	l = list(map(int,input().split()))
	A.append([i-1 for i in l])
match_num = [0 for i in range(N)]
match_dict = {}
idx = 0
for i in range(N-1):
	for j in range(i+1, N):
		match_dict[(i,j)] = idx
		idx += 1
M = idx
edge = [[] for i in range(M)]
parent = [[] for i in range(M)]
for i in range(N):
	for j in range(N-2):
		a = A[i][j]
		a_nxt = A[i][j+1]
		x,y = min(i,a), max(i,a)
		z,w = min(i,a_nxt), max(i,a_nxt)
		m1 = match_dict[(x,y)]
		m2 = match_dict[(z,w)]
		edge[m1].append(m2)
		parent[m2].append(m1)
finish = [False for i in range(M)]
candidate = [i for i in range(M) if len(parent[i]) == 0]
depth = [-1 for i in range(M)]


day = 0
while len(candidate) > 0:0
	new_candidate = []
	for c in candidate:
		finish[c] = True
		for e in edge[c]:
			parent[e].remove(c)
			if len(parent[e]) == 0:
				new_candidate.append(e)
		edge[c] = []
	candidate = new_candidate
	day += 1
print(day if all(finish) else -1)

Fixed code:
N = int(input())
A = []
for i in range(N):
	l = list(map(int,input().split()))
	A.append([i-1 for i in l])
match_num = [0 for i in range(N)]
match_dict = {}
idx = 0
for i in range(N-1):
	for j in range(i+1, N):
		match_dict[(i,j)] = idx
		idx += 1
M = idx
edge = [[] for i in range(M)]
parent = [[] for i in range(M)]
for i in range(N):
	for j in range(N-2):
		a = A[i][j]
		a_nxt = A[i][j+1]
		x,y = min(i,a), max(i,a)
		z,w = min(i,a_nxt), max(i,a_nxt)
		m1 = match_dict[(x,y)]
		m2 = match_dict[(z,w)]
		edge[m1].append(m2)
		parent[m2].append(m1)
finish = [False for i in range(M)]
candidate = [i for i in range(M) if len(parent[i]) == 0]
depth = [-1 for i in range(M)]


day = 0
while len(candidate) > 0:
	new_candidate = []
	for c in candidate:
		finish[c] = True
		for e in edge[c]:
			parent[e].remove(c)
			if len(parent[e]) == 0:
				new_candidate.append(e)
		edge[c] = []
	candidate = new_candidate
	day += 1
print(day if all(finish) else -1)
Buggy code:
import sys, time
def input():
	return sys.stdin.readline()[:-1]

n = int(input())
a = [list(map(int, input().split()))[::-1] for _ in range(n)]
#print(*a, sep="\n")
opponent = [-1 for _ in range(n)]
played = []
match = 0
day = 0
while match < n*(n-1)//2:
	approved = False
	for i in played:
		if a[i] != []:
			opponent[i] = a[i].pop()-1
	#print(opponent)
	for i in range(n):
		if opponent[i] != -1 and opponent[opponent[i]] == i:
			approved = True
			match += 1
			played.append(i, opponent[i])
			opponent[opponent[i]] = -1
			opponent[i] = -1
	#print(opponent)
	if not approved:
		print(-1)
		sys.exit()
	day += 1
print(day)

Fixed code:
import sys, time
def input():
	return sys.stdin.readline()[:-1]

n = int(input())
a = [list(map(int, input().split()))[::-1] for _ in range(n)]
#print(*a, sep="\n")
opponent = [-1 for _ in range(n)]
played = list(range(n))
match = 0
day = 0
while match < n*(n-1)//2:
	approved = False
	for i in played:
		if a[i] != []:
			opponent[i] = a[i].pop()-1
	played_next = []
	#print(opponent)
	for i in played:
		if opponent[i] != -1 and opponent[opponent[i]] == i:
			approved = True
			match += 1
			played_next += [i, opponent[i]]
			opponent[opponent[i]] = -1
			opponent[i] = -1
	#print(opponent)
	if not approved:
		print(-1)
		sys.exit()
	day += 1
	played = played_next
print(day)
Buggy code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]

A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        cand1.add(A[n][-1])
    return len(can_use),cand1

answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

print(answer)



Fixed code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [[-1] + [int(x)-1 for x in row.split()][::-1] for row in sys.stdin.readlines()]

A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        if A[n][-1] != -1:
            cand1.add(A[n][-1])
    return len(can_use),cand1

answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x,cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

print(answer)
Buggy code:
m,d = map(int,input().split())
ans = 0
for i in range(1,d+1):
  a = i%10
  b = i//10
  if a >= 2 and b >= 2 and a*b == m:
    ans += 1
print(ans)

Fixed code:
m,d = map(int,input().split())
ans = 0
for i in range(1,d+1):
  a = i%10
  b = i//10
  if a >= 2 and b >= 2 and a*b <= m:
    ans += 1
print(ans)
Buggy code:
m,d=map(int,input().split())
ans=0
for i in range(1,m+1):
  for j in range(22,d+1):
    if j%10>=2 and (j/10)*(j%10)==i:
      ans=ans+1
print(ans)

Fixed code:
m,d = map(int,input().split())
ans = 0
for i in range(1,m+1):
    for j in range(10,d+1):
        d1 = j%10
        d2 = j//10
        if d1 >= 2 and d2 >= 2 and d1*d2 == i:
            ans += 1
print(ans)
Buggy code:
m,d = map(int, input().split())
res = 0
for i in range(1,m+1):
  for j in range(1,d+1):
    if j >= 22 and j%10 >= 2 and int(str(j)[0]) *int(str(j)[1]) == m:
      res += 1
print(res)

Fixed code:
m,d = map(int, input().split())
res = 0
for i in range(1,m+1):
  for j in range(1,d+1):
    if j >= 22 and j % 10 >= 2 and int(str(j)[0]) * int(str(j)[1]) == i:
      res += 1
print(res)
Buggy code:
import math

def resolve():
    M,D=map(int,input().split())

    cnt=0
    for m in range(M):
        for d in range(D):
            if(d<22):
                continue
            if(d%10 * d//10 == m):
                cnt+=1

    print(cnt)


resolve()

Fixed code:
import math

def resolve():
    M,D=map(int,input().split())

    cnt=0
    for m in range(1,M+1):
        for d in range(1,D+1):
            if(d//10 < 2 or d%10 <2):
                continue
            if((d%10) * (d//10) == m):
                cnt+=1

    print(cnt)


resolve()
Buggy code:
m, d  = map(int, input().split())

cnt = 0

if m <= 3 or d <= 21:
	print(0)
else:
	for i in range(22,d+1):
			d10 = int(i/10)
			d1 = int(i%10)
			# print(d1)
			# print(d10)
			if d1 >= 2 and d10 >= 2 and d1*d10  <= m:
				cnt += 1

print(cnt)


Fixed code:
m, d  = map(int, input().split())

cnt = 0

if m <= 3 or d <= 21:
	print(0)
else:
	for i in range(22,d+1):
			d10 = int(i/10)
			d1 = int(i%10)
			# print(d1)
			# print(d10)
			if d1 >= 2 and d10 >= 2 and d1*d10  <= m:
				cnt += 1

	print(cnt)
Buggy code:
M, D = map(int, input().split())
cnt = 0
for m in range(1, M + 1):
    for d in range(22, D + 1):
        d1, d10 = int(str(d)[1]), int(str(d)[0])
        if d1 >= 2 and d1 * d10 == m:
            print(m, d)
            cnt += 1
print(cnt)

Fixed code:
M, D = map(int, input().split())
cnt = 0
for m in range(1, M + 1):
    for d in range(22, D + 1):
        d1, d10 = int(str(d)[1]), int(str(d)[0])
        if d1 >= 2 and d1 * d10 == m:
            cnt += 1
print(cnt)
Buggy code:
m,d = map(int, input().split())

ans = 0
for month in range(4, m):
  for day in range(22, d):
    sday = str(day)
    if int(sday[1]) < 2:
      continue
    if int(sday[0]) * int(sday[1]) == month:
      ans += 1

print(ans)

Fixed code:
m,d = map(int, input().split())

ans = 0
for month in range(4, m+1):
  for day in range(22, d+1):
    sday = str(day)
    if int(sday[1]) < 2:
      continue
    if int(sday[0]) * int(sday[1]) == month:
      ans += 1

print(ans)
Buggy code:
m,d = map(int,input().split())
ans = 0
if d < 10:
    print(ans)
else:
    for month in range(1,m+1):
        for day in range(1,d+1):
            if int(str(day)[0])*int(str(day)[1]) == month:
                if int(str(day)[1]) >= 2 and int(str(day)[0]) >= 2:
                    ans += 1
    print(ans)

Fixed code:
m,d = map(int,input().split())
ans = 0
if d < 10:
    print(ans)
else:
    for month in range(1,m+1):
        for day in range(10,d+1):
            if int(str(day)[0])*int(str(day)[1]) == month:
                if int(str(day)[1]) >= 2 and int(str(day)[0]) >= 2:
                    ans += 1
    print(ans)
Buggy code:
import math
def main():
  M,D = map(int,input().split())
  if D < 22:
       print(0)
       print(D)
       return
  cnt = 0
  for i in range(D):
      if 2 <= (i/10) and 2 <= (i%10) and math.floor(i/10)*(i%10) <= M:
          cnt += 1
  print(cnt)
  
main()

Fixed code:
import math
def main():
  M,D = map(int,input().split())
  if D < 22:
       print(0)
       return
  cnt = 0
  for i in range(D + 1):
      if 2 <= (i/10) and 2 <= (i%10) and math.floor(i/10)*(i%10) <= M:
          cnt += 1
  print(cnt)
  
main()
Buggy code:
import sys
inputs = sys.stdin.readlines()

M, D = map(int, inputs[0].split())

good_dates = []
for date in range(D):
	d10 = (date+1) // 10
    d1 = (date+1) % 10
    if d1 >= 2 and d10 >= 2:
        if d1*d10 <= M:
            good_dates.append((d1*d10, date))
print(len(good_dates))

d10 = (date+1) // 10
    d1 = (date+1) % 10

Fixed code:
import sys
inputs = sys.stdin.readlines()

M, D = map(int, inputs[0].split())

good_dates = []
for date in range(D):
    d10 = (date+1) // 10
    d1 = (date+1) % 10
    if d1 >= 2 and d10 >= 2:
        if d1*d10 <= M:
            good_dates.append((d1*d10, date))
print(len(good_dates))
Buggy code:
a,b = map(int,input().split())
A = list(range(a+1))
count = 0
if b < 10:
  print(0)
else:
  for i in range(2,b+1):
    q = i % 10
    p = i // 10
    if q*p in A and p >= 2 and q >= 2:
      count += 1
print(count)
        

Fixed code:
a,b = map(int,input().split())
A = list(range(a+1))
count = 0
if b < 10:
  print(0)
else:
  for i in range(2,b+1):
    q = i % 10
    p = i // 10
    if q*p in A and p >= 2 and q >= 2:
      count += 1
  print(count)
Buggy code:
M, D   = map(int, input().split())ans=0
for i in range(M):
    m=i+1
    for j in range(D):
        d=j+1
        d1=d%10
        d10=d//10
        if d1>=2 and d10>=2 and m==d10*d1:
            ans+=1
#             print(m,d)
print(ans)

Fixed code:
M, D   = map(int, input().split())
ans=0
for i in range(M):
    m=i+1
    for j in range(D):
        d=j+1
        d1=d%10
        d10=d//10
        if d1>=2 and d10>=2 and m==d10*d1:
            ans+=1
#             print(m,d)
print(ans)
Buggy code:
M,D = list(map(int, input().strip().split()))
count = 0
for m in range(2,M+1):
    for d in range(22, D+1):
        if m == (d / 10) % 10 * (d % 10):
            count += 1
print(count)


Fixed code:
M,D = list(map(int, input().strip().split()))
count = 0
for m in range(2,M+1):
    for d in range(22, D+1):
        if ((d%10) >= 2) and (int(d/10) >= 2) and (m == int(d/10) * (d%10)):
            count+=1
print(count)
Buggy code:
M,D = list(map(int, input().strip().split()))
count = 0
for m in range(2,M+1):
    for d in range(11, D+1):
        if ((d % 10) >= 2) and (round(d / 10) >= 2) and (m == round(d / 10) * (d % 10)):
            count += 1
print(count)


Fixed code:
M,D = list(map(int, input().strip().split()))
count = 0
for m in range(2,M+1):
    for d in range(11, D+1):
        if ((d%10) >= 2) and (int(d/10) >= 2) and (m == int(d/10) * (d%10)):
            count+=1
print(count)
Buggy code:
m,d=map(int,input().split())
month = [i for i in range(1,m+1)]
ct=0
if d<10:
  print(0)
  exit()
for i in range(11,d+1):
  a=int(str(i)[0])
  b=int(str(i)[1])
  if a*b in month:
    ct+=1
print(ct)

Fixed code:
m,d=map(int,input().split())
month = [i for i in range(1,m+1)]
ct=0
if d<10:
  print(0)
  exit()
for i in range(11,d+1):
  a=int(str(i)[0])
  b=int(str(i)[1])
  if a*b in month and a>=2 and b>=2:
    ct+=1
print(ct)
Buggy code:
# coding: utf-8
M, D = map(int, input().split())
ans = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        if len(str(d)) == 1:
            continue
        else:
            d1 = int(str(d)[0])
            d2 = int(str(d)[1])
            if d1*d2 == m and d1 >= 2 and d2 >= 2:
                ans += 1
                print(m, d1*d2, d1, d2)
print(ans)

Fixed code:
# coding: utf-8
M, D = map(int, input().split())
ans = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        if len(str(d)) == 1:
            continue
        else:
            d1 = int(str(d)[0])
            d2 = int(str(d)[1])
            if d1*d2 == m and d1 >= 2 and d2 >= 2:
                ans += 1
print(ans)
Buggy code:
x = list(map(int, input().split()))
M = x[0]
D = x[1]
result = 0
print(M,D)

if M <= 3 or D < 22:
    print(result)
else:
    if M > 81:
        M = 81
    for i in range(3, M):
        i += 1
        for j in range(21, D):
            j += 1
            D1 = j % 10
            D10 = j // 10
            if i == D1 * D10:
                result += 1
    print(result)

Fixed code:
x = list(map(int, input().split()))
M = x[0]
D = x[1]
result = 0

if M <= 3 or D < 22:
    print(result)
else:
    if M > 81:
        M = 81
    for i in range(3, M):
        i += 1
        for j in range(21, D):
            j += 1
            D1 = j % 10
            D10 = j // 10
            if D1 < 2:
                continue
            if i == D1 * D10:
                result += 1
    print(result)
Buggy code:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    m, d = map(int, readline().rstrip().split())
    if d < 10:
        print(0)

    cnt = 0
    for k in range(1, m + 1):
        for i in range(10, d + 1):
            d1, d10 = int(str(i)[1]), int(str(i)[0])
            if d1 * d10 == k and d1 > 1 and d10 > 1:
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()


Fixed code:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    m, d = map(int, readline().rstrip().split())
    if d < 10:
        print(0)
        return

    cnt = 0
    for k in range(1, m + 1):
        for i in range(10, d + 1):
            d1, d10 = int(str(i)[1]), int(str(i)[0])
            if d1 * d10 == k and d1 > 1 and d10 > 1:
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()
Buggy code:
M,D=[int(i) for i in input().split()]

if D<20:
  print(0)
else :
  count = 0
  for i in range(1,M+1):
    for id in list(range(20, D+1)):
      if int((str(id))[1]) >= 2 and ( int(str(id)[0]))*int((str(id))[1]) == i :
         print(i, id)
         count += 1
  print(count)


Fixed code:
M,D=[int(i) for i in input().split()]

if D<20:
  print(0)
else :
  count = 0
  for i in range(1,M+1):
    for id in list(range(20, D+1)):
      if int((str(id))[1]) >= 2 and ( int(str(id)[0]))*int((str(id))[1]) == i :
         count += 1
  print(count)
Buggy code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

M, D = map(int, input().split())

count=0
for i in range(4, M+1):
    for j in range(22, D+1):
        str_j = str(j)
        if str_j[0] <= 1:
            continue
        if (int(str_j[0]) * int(str_j[1])) == i:
            count += 1
print(count)


Fixed code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

M, D = map(int, input().split())

count=0
for i in range(4, M+1):
    for j in range(22, D+1):
        str_j = str(j)
        if int(str_j[1]) <= 1:
            continue
        if (int(str_j[0]) * int(str_j[1])) == i:
            count += 1
print(count)
Buggy code:
M, D = map(int, input().split())

result = 0

if D < 22:
    print(0)
else:
    for m in range(1, M+1):
        for d in range(22, D+1):
            d1 = d%10
            d10 = d//10
            if d1 > 1 and d1*d10 == m:
                result += 1

print(result)

Fixed code:
M, D = map(int, input().split())

result = 0

if D < 22:
    print(0)
else:
    for m in range(1, M+1):
        for d in range(22, D+1):
            d1 = d%10
            d10 = d//10
            if d1 > 1 and d1*d10 == m:
                result += 1
    print(result)
Buggy code:
import sys


def solve():
    M, D = input().split()
    ans = 0
    m, d_1, d_2 = int(M), int(D[0]), int(D[1])

    if int(M) < 4 or d_1 < 2 and d_2 < 2:
        print(0)
        sys.exit()

    for i in range(4, m+1):
        for j in range(2, d_1+1):
            for k in range(2, 10):
                if j == d_1 and k > d_2:
                    break
                if i == j * k:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

Fixed code:
import sys


def solve():
    M, D = input().split()
    ans = 0
    
    if int(D) < 22:
        print(0)
        sys.exit()
    
    m, d_1, d_2 = int(M), int(D[0]), int(D[1])

    if int(M) < 4 or d_1 < 2 and d_2 < 2:
        print(0)
        sys.exit()

    for i in range(4, m+1):
        for j in range(2, d_1+1):
            for k in range(2, 10):
                if j == d_1 and k > d_2:
                    break
                if i == j * k:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    solve()
Buggy code:
m,d = int(input().split())
f = []
d1,d10,cout = 0,0,0
for i in range(m):
  for j in range(d):
    if d+1 >= 10:
      f = list(str(d+1))
      d10 = int(f[0])
      d1 = int(f[1])
    if d1*d10 == i+1:
      cout += 1
print(cout)
      


Fixed code:
m,d = map(int,input().split())
f = []
d1,d10,cout = 0,0,0
for i in range(m):
  for j in range(d):
    if j+1 >= 10:
      f = list(str(j+1))
      d10 = int(f[0])
      d1 = int(f[1])
    if d1 >=2 and d10 >= 2:
      if d1*d10 == i+1:
        cout += 1
  d10,d1 = 0,0
print(cout)
Buggy code:
m,d=map(int, input().split())
ans=0
if d<=21:
    print(0)
else:
    for i in range(1,m+1):
        for j in range(22,d+1):
            if int(str(j)[0])*int(str(j)[1])==i and int(str(j)[1])>=2:
                print(i,j)
                ans+=1
    print(ans)

Fixed code:
m,d=map(int, input().split())
ans=0
if d<=21:
    print(0)
else:
    for i in range(1,m+1):
        for j in range(22,d+1):
            if int(str(j)[0])*int(str(j)[1])==i and int(str(j)[1])>=2:
                ans+=1
    print(ans)
Buggy code:
M, D = map(int, input().split())
m_list = {m for m in range(1, M + 1)}
ans = 0

for d in range(11, D+1):
  d_10 = int(d/10)
  d_1 = d - (d_10 * 10)
  if (d_10 < 2) or (d_1 < 2):
    continue
  elif:
    if (d_10 * d_1) in m_list:
      ans += 1
      
print(ans)
      

Fixed code:
M, D = map(int, input().split())
m_list = {m for m in range(1, M + 1)}
ans = 0
 
for d in range(11, D+1):
  d_10 = int(d/10)
  d_1 = d - (d_10 * 10)
  if (d_10 < 2) or (d_1 < 2):
    continue
  else:
    if (d_10 * d_1) in m_list:
      ans += 1
      
print(ans)
Buggy code:
M, D = map(int, input().split())
cnt = 0

if M < 4:
    print('0')
else:
    for i in range(4, M+1):
        for j in range(22, D+1):
            j = str(j)
            jli = list(j)
            if jli[1] == 0 or jli[1] == 1:
                continue
            else:
                if int(jli[0])*int(jli[1]) == i:
                    cnt += 1

print(cnt)



Fixed code:
M, D = map(int, input().split())
cnt = 0

if M < 4:
    print('0')
else:
    for i in range(4, M+1):
        for j in range(22, D+1):
            j = str(j)
            jli = list(j)
            if jli[1] == '0' or jli[1] == '1':
                pass
            else:
                if int(jli[0])*int(jli[1]) == i:
                    # print(i, jli)
                    cnt += 1

    print(cnt)
Buggy code:
m, d = map(int, input().split())
c = 0
for i in range(1, m+1):
    for j in range(1, d+1):
        d1 = j%10
        d10 = j//10
        if d1 > 1 and d10 > 1 and (d1 * d10 == i):
            print(i, j)
            c += 1
print(c)

Fixed code:
m, d = map(int, input().split())
c = 0
for i in range(1, m+1):
    for j in range(1, d+1):
        d1 = j%10
        d10 = j//10
        if d1 > 1 and d10 > 1 and (d1 * d10 == i):
            c += 1
print(c)
Buggy code:
months, d = map(int, input().split())
 
ans_count = 0
 
for month in range(4, months + 1):
    for i in range(1, d + 1):
        if i <= 9:
            continue
 
        a, b = map(int, str(i))
 
        if a <= 1 and b <= 1:
            continue
 
        if a * b == month:
            ans_count += 1
 
print(ans_count)

Fixed code:
months, d = map(int, input().split())

ans_count = 0

for month in range(4, months + 1):
    for i in range(1, d + 1):
        if i <= 9:
            continue

        a, b = map(int, str(i))

        if a >= 2 and b >= 2 and a * b == month:
            ans_count += 1

print(ans_count)
Buggy code:
childs = list(map(int, input().split()))

A=childs[0]
B=childs[1]
res=0
if A<=3 or B<=21:
    print(0)
else:
    for n in range(4, A+1):
        for i in range(2, int(n**0.5)+1):
            if n % i == 0:
                if 10*i+n//i <= B and 10*i+n//i >= 22:
                    res+=1
                if i != n // i:
                    if 10*(n//i)+i <= B and  10*(n//i)+i >= 22:
                        res+=1
print(res)

Fixed code:
import sys

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

A=childs[0]
B=childs[1]
res=0
if A<=3 or B<=21:
    print(0)
    sys.exit()
else:
    for n in range(4, A+1):
        for i in range(2, int(n**0.5)+1):
            if n % i == 0:
                if 10*i+n//i <= B and 10*i+n//i >= 22 and n//i >=2 and n//i <= 9 and i<=9:
                    res+=1
                if i != n // i:
                    if 10*(n//i)+i <= B and  10*(n//i)+i >= 22:
                        res+=1
print(res)
Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 21:04:16 2019

@author: Toroi0610
"""

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

M, D = map(int, "15 40".split())
#d_1, d_10 = int(D[0]), int(D[1])
day = [str(d) for d in range(1, D)]
cnt = 0
for m in range(1, M+1):
    s = make_divisors(m)
    length = len(s)
    if length == 1:
        continue
    if length%2 == 0:
        for l, r in zip(s[:int(length/2)], s[int(length/2):][::-1]):
            if (l > 10) or (r > 10) or (l==1):
                continue
            else:
                if str(l)+str(r) in day:
                    print(m, l, r)
                    cnt += 1
                if str(r)+str(l) in day:
                    print(m, r, l)
                    cnt += 1
    else:
        for l, r in zip(s[:int(length/2)+1], s[int(length/2):][::-1]):
            if (l > 10) or (r > 10) or (l==1):
                continue
            else:
                if str(l)+str(r) in day:
                    print(m, l, r)
                    cnt += 1
                if l != r:
                    if str(r)+str(l) in day:
                        print(m, r, l)
                        cnt += 1
        


Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 21:04:16 2019

@author: Toroi0610
"""

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

M, D = map(int, input().split())
day = [str(d) for d in range(1, D+1)]
cnt = 0
for m in range(1, M+1):
    s = make_divisors(m)
    length = len(s)
    if length == 2:
        continue
    if length%2 == 0:
        for l, r in zip(s[:int(length/2)], s[int(length/2):][::-1]):
            if (l > 10) or (r > 10) or (l==1):
                continue
            else:
                if str(l)+str(r) in day:
                    cnt += 1
                if str(r)+str(l) in day:
                    cnt += 1
    else:
        for l, r in zip(s[:int(length/2)+1], s[int(length/2):][::-1]):
            if (l > 10) or (r > 10) or (l==1):
                continue
            else:
                if str(l)+str(r) in day:
                    cnt += 1
                if l != r:
                    if str(r)+str(l) in day:
                        cnt += 1
print(cnt)