qyliang/CodeNanoFix huggingface dataset:
Buggy code:
k=int (input())
f=-1
a=7
for i in range(1000000):
    a=(a*10+7)%k
    print(a)
    if a==0:
        print(a)
        f=i+2
        break
print(f)

Fixed code:
k=int (input())
f=-1
a=7
for i in range(1000000):
    a=(a*10+7)%k
    if a==0:
        f=i+2
        break
if k==7 or k==1:
    f=1
print(f)
Buggy code:
num = 7
k = int(input())
count=1
# i=1
while(True):
    if(num%k==0):
        print(count)
        break
    if(count>k):
        print(-1)
        break
    num = num*10+7
    count+=1
    



Fixed code:
num = 7
k = int(input())
count=1
# i=1
while(True):
    if((num%k)==0):
        print(count)
        break
    if(count>k):
        print(-1)
        break
    num = (num*10+7)%k
    count+=1
Buggy code:
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()
now = 0
count = 0
while True:
    now = now * 10 + 7
    count += 1
    if now % K == 0:
        print(count)
        exit()


Fixed code:
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()
now = 0
count = 0
while True:
    now = (now * 10 + 7) % K
    count += 1
    if now % K == 0:
        print(count)
        exit()
Buggy code:
import math
K=input()

if K%7=0:
    L=9*K/7
else:
    L=9*K

if L%2=0 or L%5=0:
    print(-1)
else:
    r=10%L
    for i in range(1,10**6+1):
        if r==1:
            ans=i
            break
        else:
            r=10*r%L

print(ans)

Fixed code:
import math
K=int(input())

if K%7==0:
    L=9*K//7
else:
    L=9*K

if L%2==0 or L%5==0:
    ans=-1
else:
    r=10%L
    for i in range(1,10**6+1):
        if r==1:
            ans=i
            break
        else:
            r=10*r%L
print(ans)
Buggy code:
K = int(input())

n = 7
for i in range(1, 1000001):
  if n % K == 0:
    print(i)
    exit()
  n = (n * 10 + 7) % 7
else:
  print(-1)

Fixed code:
K = int(input())

n = 7
for i in range(1, 1000001):
    if n % K == 0:
        print(i)
        exit()
    n = (n % K) * 10 + 7
else:
    print(-1)
Buggy code:
k = int(input())
ok = [0]*k
x=7 % k
ok[x] = 1
if x == 0:
  print(1)
else:
  now = 1
  while now+=1:
    x = x*10 +7
    if ok[x] == 1:
      print(-1)
      break
    elif x == 0:
      print(now)
      break

Fixed code:
k = int(input())
ok = [0]*k
x=7 % k
ok[x] = 1
if x == 0:
  print(1)
else:
  now = 1
  while 1:
    now += 1
    x = (x*10 +7) % k
    if ok[x] == 1:
      print(-1)
      break
    elif x == 0:
      print(now)
      break
    else:
      ok[x] = 1
Buggy code:
k=int(input())
num=k%7
for i in range(1, 10**7+1):
    if num%k==0:
        print(i)
        exit()
    else:
        num=(num*10+7)%k
print(-1)


Fixed code:
k=int(input())
num=7%k
for i in range(1, 10**6+1):
    if num%k==0:
        print(i)
        exit()
    else:
        num=(10*num+7)%k
print(-1)
Buggy code:
K = int(input())

ans = 1
a = 7
i = K
while K > 0:
    m = a % K
    if m == 0:
        print(ans)
        break
    else:
        ans += 1
        a = m * 10 + 7
        i -= 1
if m != 0:
    print(-1)


Fixed code:
K = int(input())

ans = 1
a = 7
i = K
while i > 0:
    m = a % K
    if m == 0:
        print(ans)
        break
    else:
        ans += 1
        a = m * 10 + 7
        i -= 1
if m != 0:
    print(-1)
Buggy code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

k = inp()
now = 0
for i in range(k+10000):
    now += pow(10,i+1,k)*7
    now %= k
    if now%k == 0:
        print(i+1)
        quit()
print(-1)

Fixed code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

k = inp()
if k%2 == 0 or k%5 == 0:
    print(-1)
    quit()
now = 0
for i in range(k+10000):
    now += pow(10,i+1,k)*7
    # print(now)
    now %= k
    if now == 0:
        print(i+1)
        quit()
print(-1)
Buggy code:
K=int(input())

D=7
for i in range(10000000):
    if D%K==0:
        print(i)
        break
#    print(D)
    D=D*10+7
    D%=K
else:
    print(-1)


Fixed code:
K=int(input())

D=7
for i in range(1000000):
    if D%K==0:
        print(i+1)
        break
#    print(D)
    D=D*10+7
    D%=K
else:
    print(-1)
Buggy code:
K = input()
K = int(K)

def seven():
    seven_i = 0
    count = 0
    for i in range(K):
        seven_i += (10**i*7)
        seven_i %= K
        count += 1
        print(seven_i)
        if seven_i % K == 0:
            return count
    return -1

print(seven())

Fixed code:
K = input()
K = int(K)

def seven():
    seven_i = 0
    count = 0
    for i in range(K):
        seven_i = ((10*seven_i) + 7) % K
        count += 1
        if seven_i % K == 0:
            return count
    return -1

print(seven())
Buggy code:
k = int(input())
t = 7

for i in range(k):
  if t % k == 0:
    print(i + 1)
    break

  t = t * 10 + 7
  
else:
  print(-1)



Fixed code:
k=int(input())
t=7
for i in range(k):
    if t%k==0:
        print(i+1)
        break
    else:
        t=(10*t+7)%k
else:
    print(-1)
Buggy code:
import sys
k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print('-1')
  sys.exit()
s = 7
c = 1
while True:
  if s % k == 0:
    break
  s = 10 * s + 7
  c += 1
print(c)

Fixed code:
import sys
k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print('-1')
  sys.exit()
s = 7
c = 1
while True:
  if s % k == 0:
    break
  s = (10 * s + 7) % k
  c += 1
print(c)
Buggy code:
K=int(input())
a=-1
b=0
for i in range(K):
    b+=7*10**i
    if(b%K==0):
        a=i+1
        break

print(a)

Fixed code:
K=int(input())
a=-1
b=0

for i in range(K):
    b=(10*b+7)%K
    if(b==0):
        a=i+1
        break

print(a)
Buggy code:
k=int(input())
num=7%k
L=0
ans=-1


if k%7==0:
	L=(9*k)/7
else:
	L=9*k

if L%2==0 or L%5==0:
	ans=-1
else:
	for i in range(10**5):
		if (num*10)%L==1:
			ans=i
			break
		num=10**i %L
print(ans)

Fixed code:
k=int(input())
num=1
L=0
ans=-1


if k%7==0:
	L=(9*k)/7
else:
	L=9*k

# if L%2==0 or L%5==0:
# 	ans=-1

for i in range(k+1):
	if (num*10)%L==1:
		ans=i+1
		break
	num=num*10 %L
print(ans)
Buggy code:
k = int(input())
if(k%2==0):
  print("-1")
else:
  i = 1
  while True:
    m = 7
    if(m%k==0):
      ans = i
      print(ans)
      break
    if(i>1000000):
      print("-1")
      break
    m = m*10 + 7
    i += 1

  
  


Fixed code:
k = int(input())
m = 7
if(k%2==0):
  print("-1")
else:
  i = 1
  while True:
    m = m%k
    if(m==0):
      print(i)
      break  
    if(i>k):
      print("-1")
      break
    m *= 10
    m += 7
    i += 1
Buggy code:
def main():
    k = int(input())
    init = 7%k
    an = [init]
    for _ in range(k):
        a = an[-1]
        an.append((10*a+7) % k)

    for ind, a in enumerate(an):
        if a==0:
            print(ind)
            return
    print(-1)
if __name__ == '__main__':
    main()

Fixed code:
def main():
    k = int(input())
    init = 7%k
    an = [init]
    for _ in range(k):
        a = an[-1]
        an.append((10*a+7) % k)

    for ind, a in enumerate(an):
        if a==0:
            print(ind+1)
            return
    print(-1)
if __name__ == '__main__':
    main()
Buggy code:
k = int(input())
 
mx = 10**8
tmp = 7
flag = 0

for i in range(mx):
     tmp = (tmp*10 + 7)%k
     if(tmp == 0):
         print(i+2)
         flag = 1
         break

if(flag == 0):
    print(-1)

Fixed code:
k = int(input())
 
mx = 10**7
tmp = 0
flag = 0

for i in range(mx):
     tmp = (tmp*10 + 7)%k
     if(tmp == 0):
         print(i+1)
         flag = 1
         break

if(flag == 0):
    print(-1)
Buggy code:
k = int(input())
mo = 7
mo = mo % k
for i in range(k + 1):
  if mo == 0:
    print(i + 1)
    break
  if mo != 0:
    mo = (mo*10 + 7) * k
else:
  print(-1)
    
  
  

Fixed code:
k = int(input())
mo = 7
mo = mo % k
for i in range(1 , k + 1):
  if mo == 0:
    print(i)
    break
  if mo != 0:
    mo = (mo * 10 + 7) % k
else:
  print(-1)
Buggy code:
K = int(input())
i = 0
ret = -1
if K % 5 != 0 and K % 2 != 0:
  N = 1
  if K % 7 == 0:
    L = K * 9 // 7
  else:
    L = K * 9
  while True:
    if N % L == 1:
      ret = i
      break
    N = (N * 10 )% L
    i += 1
print(ret)


Fixed code:
K = int(input())
i = 1
ret = -1
if K % 5 != 0 and K % 2 != 0:
  N = 10
  if K % 7 == 0:
    L = K * 9 // 7
  else:
    L = K * 9
  while True:
    if N % L == 1:
      ret = i
      break
    N = (N * 10 )% L
    i += 1
print(ret)
Buggy code:
import sys

K = int(input())

seven = 7
for i in range(10**7):
    if seven % K == 0:
        print(i+1)
        sys.exit()
    else:
        seven = seven * 10 + 7

print(-1)

Fixed code:
import sys

K = int(input())

seven = 7
mod = 7 % K
for i in range(10**6):
    seven = seven % K
    if seven == 0:
        print(i+1)
        sys.exit()
    else:
        seven = seven * (10 % K) + mod

print(-1)
Buggy code:
K = int(input())
if(K % 2 == 0 or K % 5 == 0):
    print(-1)
N = 7
for i in range(K):
    if　N % K == 0:
        print(i + 1)
        break
    else:
        N = ((N * 10) + 7) % K

Fixed code:
K = int(input())

if K % 2 == 0 or K % 5 == 0:  print(-1)
else:
    p = 0
    for i in range(K):
        p = ((p * 10) % K + 7) % K
        if p == 0:  
            print(i + 1)
            break
Buggy code:
k = int(input())
ml = []
a = 7
m = 7
i = 0
while m>0:
  m = a%k
  a = 10*m+7
  i += 1
  if i>k : break
print(i)


Fixed code:
k = int(input())
ml = []
a = 7
m = 7
i = 0
while m>0:
  m = a%k
  a = 10*m+7
  i += 1
  if i>k :
    i=-1
    break
print(i)
Buggy code:
k=int(input())
c=7
a=0
for i in range(1,10**6):
    c%=k
    if c%k==0:
        a=i
        break
    else:
        c*=10
        c+=7
print(a)

Fixed code:
k=int(input())
c=7
a=-1
for i in range(1,10**6):
    c%=k
    if c%k==0:
        a=i
        break
    else:
        c*=10
        c+=7
print(a)
Buggy code:
a = 0
b = 0
K = int(input())
for i in range(K):
  a += 7 * 10 ** i
  if a % K == 0:
    b = 1
    break
if b == 0:
  print(-1)
else:
  print(i + 1)

Fixed code:
K = int(input())
a = 7
ans = 1
for i in range(K):
    a= a % K
    if a == 0:
        print(ans)
        break
    else:
        a = a * 10 + 7
        ans += 1
else:
    print(-1)
Buggy code:
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

ans, num = 1, 7
while 1:
    if num % k == 0:
        print(i)
        break
    ans += 1
    num = num * 10 + 7
print(ans)


Fixed code:
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

ans, num = 1, 7
while 1:
    if num % k == 0:
        print(ans)
        break
    ans += 1
    num = (num % k) * 10 + 7
Buggy code:
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 7
for i in range(10**6):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7


Fixed code:
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 7
for i in range(1,10**6):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7
Buggy code:
K=int(input())
m=0
c=0
for i in range(K):
  c+=1
  m=m*10+7
  if m%K==0:
    print(c)
    break
  if m>K:
    m-=K
if c==K:
	print(-1)

Fixed code:
K=int(input())
m=0
c=1
for i in range(K):
  m=m*10+7
  if m%K==0:
    print(c)
    break
  if m>K:
    m%=K
  c+=1    
if c==K+1:
	print(-1)
Buggy code:
k = int(input())

ans = 1
mod = 7

for i in range(k):
    if mod % 7 == 0:
        break
    ans += 1
    mod = (mod * 10 + 7) % k

if mod % k == 0:
    print(ans)
else:
    print(-1)

Fixed code:
k = int(input())

ans = 1
mod = 7

for i in range(k):
    if mod % k == 0:
        break
    ans += 1
    mod = (mod * 10 + 7) % k

if mod % k == 0:
    print(ans)
else:
    print(-1)
Buggy code:
k = int(input())
number = 7
cnt = 1
answer = -1

for i in range(k):
    if number % k == 0:
        answer = cnt
        break
    else:
        cnt += 1
        number = number + 7 * 10 ** (cnt - 1)
print(answer)


Fixed code:
k = int(input())
mod = 7 % k
cnt = 1
answer = -1

for i in range(k):
    if mod == 0:
        answer = cnt
        break
    else:
        cnt += 1
        mod = (mod * 10 + 7) % k
print(answer)
Buggy code:
import sys
k = int(input())

remainders = set()
remainder = 7 % k
remainders.add(remainder)

counter = 1
while True:
    counter += 1
    remainder = remainder * 10 % k
    if remainder in remainders:
        print('-1')
        sys.exit()
    remainders.add(remainder)
    print(remainders)
    if sum(remainders) % k == 0:
        print(counter)
        sys.exit()

Fixed code:
import sys

k = int(input())
n = 7
counter = 1
remainders = set()

while True:
    remainder = n % k
    if remainder == 0:
        print(counter)
        sys.exit()
    if remainder in remainders:
        print(-1)
        sys.exit()
    remainders.add(remainder)
    
    n = remainder * 10 + 7
    counter += 1
Buggy code:
K = int(input())

a = [0] * 1000000
a[0] = 7 % K
for i in range(1000000):
    a[i+1] = (a[i] * 10 + 7) % K 
    
    if (a[i] == 0):
        break

if(i == 999999):
    print('-1')
else:
    print(i+1)


Fixed code:
K = int(input())

a = [0] * 1000001
a[0] = 7 % K
for i in range(1000000):
    a[i+1] = (a[i] * 10 + 7) % K 
    
    if (a[i] == 0):
        break

if(i == 999999):
    print('-1')
else:
    print(i+1)
Buggy code:
k = int(input())
val = 7
visited = set()
counter = 1
while len(visited) < k:
    if val in visited:
        print(-1)
        break
    elif val % k == 0:
        print(counter)
        break
    else:
        visited.add(val)
        val = (val * 10 + 7) % k
        counter += 1

Fixed code:
k = int(input())
val = 7
visited = set()
counter = 1
while len(visited) < k:
    val %= k
    if val in visited:
        print(-1)
        break
    elif val % k == 0:
        print(counter)
        break
    else:
        visited.add(val)
        val = (val * 10 + 7) % k
        counter += 1
Buggy code:
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
  ai = a1 % K
  a1 = (a1 * 10 + 7)
  if ai == 0:
    break
else:
  i = -2 
print(i + 1)

Fixed code:
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
  if i == 0:
    ai = a1 % K
  else:
    ai = (ai * 10 + 7) % K
  if ai == 0:
    break
else:
    i = -2
print(i + 1)
Buggy code:
import sys
input = sys.stdin.readline
 
def I(): return int(input())

def main():
    
    if K%2 == 0:
        print('-1')
        sys.exit()
    
    ans = 1
    n = 7
    for i in range(K):
        
        if n%K ==0:
            print(ans)
            break
        
        n = (10*n + 7)%K  
        ans += 1

Fixed code:
import sys
input = sys.stdin.readline
 
def I(): return int(input())

def main():
    
    K = I()
    if K%2 == 0:
        print('-1')
        sys.exit()
    
    ans = 1
    n = 7
    for i in range(K):
        
        if n%K ==0:
            print(ans)
            break
        
        n = (10*n + 7)%K  
        ans += 1
    
    else:
        print('-1')

main()
Buggy code:
k = int(input())
i = 1
a = 7
while a % k != 0:
  i += 1
  a = 10*a + 7
  if i == 10**9+7:
    i = -1
    break

print(i)
  


Fixed code:
k = int(input())
i = 1
a = 7
a = a % k
while a != 0:
  i += 1
  a = (10*a + 7) % k
  if i == 10**6:
    i = -1
    break

print(i)
Buggy code:
k = int(input())

if k%2==0 or k%5==0:
    print('-1') 
else:
    a = 0
    for i in range(99983):
        a = (a*10+7) % k
        if a == 0:
            print(i+1)
            break
    else:
        print(-1)



Fixed code:
k = int(input())

if k%2==0 or k%5==0:
    print('-1') 
else:
    a = 0
    for i in range(999983):
        a = (a*10+7) % k
        if a == 0:
            print(i+1)
            break
    else:
        print(-1)
Buggy code:
K = int(input())
a = 0
for i in range(K):
    a += 7*(10**i)
    a = a % K
    if a == 0:
        print(i+1)
        exit()
print(-1)


Fixed code:
K = int(input())
a = 0
t = 1
for i in range(K):
    a += 7*t
    a = a % K
    t = t*10
    t = t%K
    if a == 0:
        print(i+1)
        exit()
print(-1)
Buggy code:
k=int(input())
ama=[0]*(k)
now=0
for _ in range(2*k):
  now+=7*(10**_)
  if now%k==0:
    print(_+1)
    exit()
  elif ama[now%k]==0:
    ama[now%k]+=1
  else:
    print(-1)
    
    

Fixed code:
k=int(input())
ama=[0]*(k)
now=7
if now%k==0:
  print(1)
  exit()
else:
  ama[now%k]+=1
for _ in range(2*k):
  now=(now*10+7)%k
  if now%k==0:
    print(_+2)
    exit()
  elif ama[now%k]==0:
    ama[now%k]+=1
  else:
    print(-1)
    exit()
Buggy code:
K = int(input())
A = 7
Flag = False
for T in range(1,K+1):
    if A%K==0:
        Flag = True
        break
    else:
        A = 10*A+7
print(['-1',T][Flag])

Fixed code:
K = int(input())
A = 7%K
Flag = False
for T in range(1,K+1):
    if A==0:
        Flag = True
        break
    else:
        A = (10*A+7)%K
print(['-1',T][Flag])
Buggy code:
k=int(input())
 
 
init=7
for i in range(k+1):
  if init%k ==0:
    print(i+1)
    break
  t = t*10+7
print(-1)

Fixed code:
k=int(input())
 
ans=-1
init=7
for i in range(k+1):
  if init%k ==0:
    ans=i+1
    break
  init = (init*10+7)%k
print(ans)
Buggy code:
k = int(input())
t = 7
ans=0
for i in range(k):
  if t%k==0:
    ans=i+1
  	break
  else:
    t = (t*10+7)%k
        
if ans >0:
  print(ans) 
else:
  print(-1)

Fixed code:
k = int(input())
t = 7
ans=0
for i in range(k):
    if t%k==0:
        ans=i+1
        break
    else:
        t = (t*10+7)%k
        
if ans >0:
    print(ans) 
else:
    print(-1)
Buggy code:
k = int(input())

if k%2 ==0:
    print(-1)
    exit(0)

n = 0

for i in range(1, 10**6):
    n += 7 *(10**(i-1))
    if n%k == 0:
        print(i)
        exit(0)

print(-1)

Fixed code:
k = int(input())

m = 0

for i in range(1, 10**6):
    n = m *10 +7
    m = n % k
    if m == 0:
        print(i)
        exit(0)

print(-1)
Buggy code:
k = int(input())
x = 7%k
s = []

for i in range(k):
  if x == 0:
    print(len(s+1))
    exit()
  s.append(x)
  x = (10*x + 7)%k

  
  
print(-1)


Fixed code:
k = int(input())
x = 7%k
s = []

for i in range(k):
  if x == 0:
    print(i+1)
    exit()
  s.append(x)
  x = (10*x + 7)%k

  
  
print(-1)
Buggy code:
from collections import defaultdict 
import sys
import math 

def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n = int(input())

start = 0
for i in range(1,n+1):
	start = start*10+7
	if start%n==0:
		print(i)
		break
else:
	print(-1)

Fixed code:
from collections import defaultdict 
import sys
import math 

def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n = int(input())

start = 0
for i in range(1,n+1):
	start = (start*10+7)%n
	if start==0:
		print(i)
		break
else:
	print(-1)
Buggy code:
K=int(input())

L=9*K/7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break
    print('-1')

Fixed code:
K=int(input())

L=9*K//7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break
Buggy code:
def main():
    K = int(input())

    if K % 2 == 0:
        return -1
    elif K % 5 == 0:
        return -1
    an = 7
    counter = 1

    while True:
        if an % K == 0:
            return counter

        an = an * 10 + 7
        counter = counter + 1

if __name__ == "__main__":
    answer = main()
    print(answer)

Fixed code:
def main():
    K = int(input())

    if K % 2 == 0:
        return -1
    elif K % 5 == 0:
        return -1

    an = 7
    counter = 1

    while True:
        modan = an % K

        if modan == 0:
            return counter

        an = modan * 10 + 7
        counter = counter + 1

if __name__ == "__main__":
    answer = main()
    print(answer)
Buggy code:
k=int(input())
mod7 = 7%k
mod10= 10%k

mod = mod7
mod10times = mod7

if mod%k==0:
    print(1)

for i in range(2,2000000):
    mod10times = mod10times*mod10%k
    mod = mod10times+mod%k
    
    if  mod%k==0:
        print(i)
        break
        
print(-1)

Fixed code:
k=int(input())
mod7 = 7%k
mod10= 10%k

mod = mod7
mod10times = mod7

if mod%k==0:
    print(1)
else:

    for i in range(2,2000000):
        mod10times = mod10times*mod10%k
        mod = mod10times+mod%k

        if  mod%k==0:
            break

    if i==1999999:
        print(-1)
    else:
        print(i)
Buggy code:
param_k = int(input())
 
#param_k = 4
    
if param_k % 2 == 0:
  print(-1)
  
elif param_k % 5 == 0:
  print(-1)
  
else:
  n=0
  for i in range(param_k + 10):
    n = 10*n + 7
    if n % 7 == 0:
      print(i+1)
      break
    if i == param_k + 10 - 1:
      print(-1)

Fixed code:
param_k = int(input())
    
if param_k % 2 == 0:
  print(-1)
  
elif param_k % 5 == 0:
  print(-1)
  
else:
  n=0
  for i in range(1000000):
    n = 10*n + 7
    if n % param_k == 0:
      print(i+1)
      break
    else:
      n = n % param_k
    #if i == param_k + 10 - 1:
    #  print(-1)
  else:
    print(-1)
Buggy code:
L = int(input())

for K in range(1, L + 1, 2):
    #  print("K = ", K)
    ans = -1
    a = 0

    if K % 2 == 0:
        ans = -1
    elif K % 5 == 0:
        ans = -1
    else:
        for i in range(0, K):
            a = (10 * a + 7) % K
            if a == 0:
                ans = i + 1
                break
    print(ans)

Fixed code:
ans = -1
a = 0
K = int(input())
if K % 2 == 0:
    ans = -1
elif K % 5 == 0:
    ans = -1
else:
    for i in range(0, K):
        a = (10 * a + 7) % K
        if a == 0:
            ans = i + 1
            break
print(ans)
Buggy code:
K=int(input())
an=0
for i in range(K):
    an=(10*an+7)%K
    if an==0:
        print(i+1)
        exit
print(-1)


Fixed code:
K=int(input())
an=0
for i in range(K):
    an=(10*an+7)%K
    if an==0:
        print(i+1)
        exit()
        
print(-1)
Buggy code:
import sys
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = t*10+7
else:
    print(-1)

Fixed code:
import sys
K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t*10+7) % K
else:
    print(-1)
Buggy code:
k = int(input())
ans = -1
a = 7
for i in range(k):
    if a % k == 0:
        ans = i + 1
        break
    a = 10*a + 7
print(ans)

Fixed code:
k = int(input())
ans = -1
a = [7%k] * k
for i in range(k - 1):
    a[i + 1] = (10*a[i] + 7) % k
for i in range(k):
    if a[i] == 0:
        ans = i + 1
        break
print(ans)
Buggy code:
k = int(input())
curr = 7
for i in range(k):
  if curr%k:
    curr *= 10
    curr += 7
  else:
    print(i+1)
	break
else:
  print(-1)

Fixed code:
k = int(input())
curr = 7
for i in range(k):
  if curr%k:
    curr *= 10
    curr += 7
    curr %= k
  else:
    print(i+1)
    break
else:
  print(-1)
Buggy code:
k = int(input())
a=7
i=1
if k%5==0 or k%2==0:
  print(-1)
  exit()
while True:
  if a%k ==0:
    print(i)
    break
  i+=1
  a = a + 7*10**(i-1)


Fixed code:
k = int(input())
a=7
i=1
if k%5==0 or k%2==0:
  print(-1)
  exit()
while True:
  if a%k ==0:
    print(i)
    break
  i+=1
  a=(a*10+7)%k
Buggy code:
k = int(input())
a=7
i=1
if k%5==0 or k%2==0:
  print(-1)
  exit()
while True:
  if a%k ==0:
    print(i)
    exit()
  i+=1
  a = a + 7*10**(i-1)

Fixed code:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1