Buggy python submission (verdict: Time Limit Exceeded):
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 submission:
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 python submission (verdict: Time Limit Exceeded):
import re

def main():
    K = int(input())
    firstPlace = K % 10

    if firstPlace == 1:
        seed = 7
    elif firstPlace == 3:
        seed = 9
    elif firstPlace == 7:
        seed = 1
    elif firstPlace == 9:
        seed = 3
    else:
        return -1

    while True:
        verifiStr = str(K * seed)

        repattern = re.compile("^7+$")
        result = repattern.match(verifiStr)

        if result:
            return len(verifiStr)          

        seed = seed + 10

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

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def main():
    K = int(input())
    firstPlace = K % 10

    if firstPlace == 1:
        seed = 7
    elif firstPlace == 3:
        seed = 9
    elif firstPlace == 7:
        seed = 1
    elif firstPlace == 9:
        seed = 3
    else:
        return -1

    while True:
        verifiStr = str(K * seed)
        lenVerifiStr = len(verifiStr)

        if(verifiStr.count("7") == lenVerifiStr):
            return lenVerifiStr           

        seed = seed + 10

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

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def main():
    K = int(input())

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

    an_min = 7

    while True:
        if an_min % K == 0:
            return len(str(an_min))

        an_min = an_min * 10 + 7

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

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def main():
    K = int(input())

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

    an = ""

    while True:
        an = an + "7"

        if int(an)%K == 0:
            return len(an)

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

Fixed submission:
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)