Buggy python submission (verdict: Runtime Error):
k = int(input())
seven = 7
count = 0

def main():
    for i in range(1000000):
        if k % 2 == 0:
            count = -1
            return

        elif seven % k == 0:
            count += 1
            print(count)
            return
        else:
            count += 1
            seven = seven * 10 + 7
    print(-1)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
seven = 7
count = 0

for _ in range(1000000):
    if k % 2 == 0:
        count = -1
        break

    elif seven % k == 0:
        count += 1
        break
    else:
        count += 1
        seven = seven * 10 + 7

print(count)

Fixed submission:
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
seven = 7
count = 0

while True:
    if k % 2 == 0:
        count = -1
        break

    elif seven % k == 0:
        count += 1
        break
    else:
        count += 1
        seven = seven * 10 + 7

print(count)

Fixed submission:
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
k = int(input())
seven = ７
count = 0

while True:
    if k % 2 == 0:
        count = -1
        break

    elif seven % k == 0:
        count += 1
        break
    else:
        count += 1
        seven = seven * 10 + 7

print(count)

Fixed submission:
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
seven = '7'
count = 0

while True:
    if k % 2 == 0:
        count = -1
        break

    elif int(seven) % k == 0:
        count += 1
        break
    else:
        count += 1
        seven += '7'

print(count)

Fixed submission:
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()