ZhenlongDai/ACPR huggingface dataset:
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
cnt = 1
mod = 7
k = int(input())

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

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


Failing test case input:
11289

Expected output:
1365


Actual output:
-1


Fixed submission (verdict: Accepted):
cnt = 1
mod = 7
k = int(input())
for i in range(k):
    if mod % k == 0:
        break
    cnt += 1
    mod = (mod * 10 + 7) % k

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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())
ans = 7%K
A = 1
C = [0]*K
if K == 1 or K == 7:
  print(1)
  exit()
for i in range(K):
  A = (A*10)%K
  ans += (A*7)
  ans %= K
  if ans == 0:
    break
  if C[ans] == 0:
    C[ans] += 1
  else:
    break
if i == K:
  print(-1)
else:
  print(i+2)

Failing test case input:
1803846

Expected output:
-1


Actual output:
902


Fixed submission (verdict: Accepted):
K = int(input())
ans = 7%K
A = 1
C = [0]*K
if K == 1 or K == 7:
  print(1)
  exit()
for i in range(K):
  A = (A*10)%K
  ans += (A*7)
  ans %= K
  if ans == 0:
    break
  if C[ans] == 0:
    C[ans] += 1
  else:
    print(-1)
    exit()
print(i+2)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):









k = int(input())

a = 1
if k % 2 == 0:
    print(-1)
    exit()
for i in range(1,10**8+2):
    if a%k == 0:
        print(i)
        exit()
    a=a*10+1
    a=a%k
print(-1)


Failing test case input:
41797

Expected output:
426


Actual output:
2982


Fixed submission (verdict: Accepted):









k = int(input())

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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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

  
  


Failing test case input:
126901

Expected output:
6678


Actual output:
-1


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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())
n = 7
c = 0
while c <= K:
  m = n % K
  c += 1
  if m == 0:
    break
  tmp = m * 10 + 7
  if tmp == n:
    print(-1)
    exit()
  n = tmp
print(c)

Failing test case input:
1803846

Expected output:
-1


Actual output:
1803847


Fixed submission (verdict: Accepted):
K = int(input())
n = 7
c = 0
while c <= K:
  n %= K
  c += 1
  if n == 0:
    print(c)
    exit()
  n = n * 10 + 7
print(-1)
Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k = int(input())

if k==1 :
    ans=1
elif k % 2 ==0 or k%5==0:
    ans=-1
else:
    l=9*k
    v=1
    for i in range(1, l+1):
        v=(v*10) % l
        if v == 1:
            ans=i
            break
print(ans)

Failing test case input:
1208879

Expected output:
74010


Actual output:
518070


Fixed submission (verdict: Accepted):
k = int(input())

if k == 1:
    ans = 1
elif k % 2 == 0 or k % 5 == 0:
    ans = -1
else:
    l = (9*k
    v = 1
    for i in range(1, l+1):
        v = (v*10) % l
        if v == 1:
            ans = i
            break
print(ans)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

k = int(input())
ans = 0
ai = 7
for i in range(k):
    ai = ((ai * 10) + 7) % k
    if ai == 0:
        ans = i
        break
    if i == k:
        ans = -1

print(ans)



Failing test case input:
958033

Expected output:
25740


Actual output:
25738


Fixed submission (verdict: Accepted):
k = int(input())
ans = 0

ai = 0
for i in range(k+2):
    ai = ((ai * 10) + 7) % k
    if ai == 0:
        ans = i + 1
        print(ans)
        exit()

ans = -1
print(ans)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


import sys

def main():
    k = int(input())
    mod=999983
    if k % 2==0:
        print(-1)
        exit()
    sevens=7
    for i in range(1,10**6+1):
        if sevens%k%mod==0:
            print(i)
            exit()
        else:
            sevens=(sevens*10+7)%mod

if __name__ == "__main__":
    main()


Failing test case input:
23239

Expected output:
10928


Actual output:
4804


Fixed submission (verdict: Accepted):


import sys

def main():
    k = int(input())
    sevens=0
    for i in range(1,k+1):
        sevens=(sevens*10+7)%k
        if sevens==0:
            print(i)
            exit()
    print(-1)

if __name__ == "__main__":
    main()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def main():
    k = II()
    print(-1)

if __name__ == '__main__':
    main()

Failing test case input:
5513

Expected output:
444


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def main():
    k = II()
    sevens = 7%k
    for i in range(1, k+1):
        if sevens % k == 0:
            print(i)
            return
        sevens = (10*sevens + 7)%k
    print(-1)

if __name__ == '__main__':
    main()
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):




def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    k = input_int()
    t = 7
    for i in range(1000000):
        t %= k
        if t == 0:
            print(i + 1)
            exit()
        t = t * 10 + 7

    print(-1)


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


Failing test case input:
1803846

Expected output:
-1


Actual output:
-1
None


Fixed submission (verdict: Accepted):




def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    k = input_int()
    t = 7
    for i in range(1000000):
        t %= k
        if t == 0:
            print(i + 1)
            return
        t = t * 10 + 7

    print(-1)


if __name__ == "__main__":
    main()

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
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
print(ans)


Failing test case input:
5163823

Expected output:
73450


Actual output:
73450
73450


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

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k = int(input())
mod = 0
for i in range(1, k):
    mod = ((mod * 10) + 7) % 7
    if mod == 0:
        print(i)
        exit()
print(-1)        

Failing test case input:
126901

Expected output:
6678


Actual output:
1


Fixed submission (verdict: Accepted):
k = int(input())
mod = 0
for i in range(1, 10**6):
    mod = ((mod * 10) + 7) % k
    if mod == 0:
        print(i)
        exit()
print(-1)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
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 + 1) % K
        if p == 0:  
            print(i + 1)
            break

Failing test case input:
41797

Expected output:
426


Actual output:
2982


Fixed submission (verdict: Accepted):
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
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
1803846

Expected output:
-1


Actual output:
0


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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
s = 7
s = (s * 10 + 7) % k
cnt = 0
if k % 2 == 1 and not k % 5 == 0:
    while(1):
        if s == 0:
            cnt += 1
            print(cnt)
            break
        else:
            s = (s * 10 + 7) % k
            cnt += 1
else:
    print(-1)

Failing test case input:
20511

Expected output:
819


Actual output:
818


Fixed submission (verdict: Accepted):
k = int(input())
s = 7
s = s % k
cnt = 0
if k % 2 == 1 and not k % 5 == 0:
    while(1):
        if s == 0:
            cnt += 1
            print(cnt)
            break
        else:
            s = (s * 10 + 7) % k
            cnt += 1
else:
    print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
if k % 7 == 0: k 
k *= 9
i = 10 % k
cnt = 1
while i != 1:
    i = i * 10 % k
    cnt += 1
print(cnt)


Failing test case input:
1208879

Expected output:
74010


Actual output:
518070


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

i = 7 % k
cnt = 1
while i != 0:
    i = i * 10 + 7
    i %= k
    cnt += 1
print(cnt)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
K=int(input())
num=7
for i in range(100000):
  modnum=num%K
  if modnum==0:
    print(i+1)
    exit()
  num=modnum*10+7
print(-1)

Failing test case input:
1558339

Expected output:
177360


Actual output:
-1


Fixed submission (verdict: Accepted):
K=int(input())
num=7
for i in range(1000000):
  modnum=num%K
  if modnum==0:
    print(i+1)
    exit()
  num=modnum*10+7
print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

a = 7

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

Failing test case input:
1803846

Expected output:
-1


Actual output:

Fixed submission (verdict: Accepted):
K = int(input())

a = 7

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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
i = 1
a = 7
a = a % k
while a != 0:
  i += 1
  a = (10*a + 7) % k
  if i == 10**5:
    i = -1
    break

print(i)


Failing test case input:
451457

Expected output:
220458


Actual output:
-1


Fixed submission (verdict: Accepted):
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)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    K = readint()
    if not K % 2:
        print(-1)
    elif not K % 7:
        print(1)
    else:
        d = 7 % K
        s = set()
        for i in range(1, 10 ** 6 + 1):
            s.add(d)
            d = (d * 10 + 7) % K
            if not d:
                print(i + 1)
                sys.exit()
            elif d in s:
                print(-1)
                sys.exit()
        print(-1)


if __name__ == "__main__":
    main()


Failing test case input:
139909

Expected output:
286


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    K = readint()
    if not K % 2:
        print(-1)
    elif not 7 % K:
        print(1)
    else:
        d = 7 % K
        s = set()
        for i in range(1, 10 ** 6 + 1):
            s.add(d)
            d = (d * 10 + 7) % K
            if not d:
                print(i + 1)
                sys.exit()
            elif d in s:
                print(-1)
                sys.exit()
        print(-1)


if __name__ == "__main__":
    main()

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):









k = int(input())

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


Failing test case input:
5163823

Expected output:
73450


Actual output:
220350


Fixed submission (verdict: Accepted):









k = int(input())

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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
ans = 1
if n % 5 == 0 or n % 2 == 0:
    print(-1)
else:
    t = 7
    while t % n != 0:
        t = t * 10 + 7
        t %= n
        ans += 1
print(ans)

Failing test case input:
1803846

Expected output:
-1


Actual output:
-1
1


Fixed submission (verdict: Accepted):
n = int(input())
ans = 1
if n % 5 == 0 or n % 2 == 0:
    print(-1)
else:
    t = 7
    while t % n != 0:
        t = t * 10 + 7
        t %= n
        ans += 1
    print(ans)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

N = 0

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


Failing test case input:
52171

Expected output:
1792


Actual output:
1791


Fixed submission (verdict: Accepted):
K = int(input())

for i in range(K):
    if i == 0:
        N= 7%K
    else:
        N = (10*N+7)%K
    if N == 0:
        print(i+1)
        break
else:
    print(-1)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

ans = -1
num7 = 7;

for i in range(10000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = num7*10+7
        i+=1

print(ans)

Failing test case input:
136963

Expected output:
68481


Actual output:
-1


Fixed submission (verdict: Accepted):
K = int(input())

ans = -1
num7 = 7

for i in range(1000000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = (num7*10+7)%K
        i+=1

print(ans)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


import sys

def main():
    k = int(input())
    mod=999983
    if k % 2==0:
        print(-1)
        exit()
    sevens=7
    for i in range(1,10**6+1):
        if sevens%k==0:
            print(i)
            exit()
        else:
            sevens=(sevens*10+7)%mod

if __name__ == "__main__":
    main()

Failing test case input:
1041437

Expected output:
245040


Actual output:
999982


Fixed submission (verdict: Accepted):


import sys

def main():
    k = int(input())
    sevens=0
    for i in range(1,k+1):
        sevens=(sevens*10+7)%k
        if sevens==0:
            print(i)
            exit()
    print(-1)

if __name__ == "__main__":
    main()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

X = 10
ans = 1

while ans <= K:
    x = X%(9*K)
    if x == 1:
        print(ans)
        break
    else:
        ans += 1
        X = x*10 

if x != 1:
    print(-1) 

Failing test case input:
41797

Expected output:
426


Actual output:
2982


Fixed submission (verdict: Accepted):
K = int(input())

ans = 1
X = 7
cnt = K
while ans <= K:
    x = X % K
    if x == 0:
        print(ans)
        break
    else:
        ans += 1
        X = x*10 + 7 

if x != 0:
    print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())
num = 0
if K%2 == 0:
    print(-1)
else:
    for i in range(1, 100000):
        num = num*10 + 7
        num %= K
        if num == 0:
            print(i)
            break
    else:
        print(-1)

Failing test case input:
2243343

Expected output:
747780


Actual output:
-1


Fixed submission (verdict: Accepted):
K = int(input())
num = 0
if K%2 == 0:
    print(-1)
else:
    for i in range(1, 1000000):
        num = num*10 + 7
        num %= K
        if num == 0:
            print(i)
            break
    else:
        print(-1)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k = int(input())
mod = 0
for i in range(1, k):
    mod = ((mod * 10) + 7) % k
    if mod == 0:
        print(i)
        break
print(-1)

Failing test case input:
126901

Expected output:
6678


Actual output:
6678
-1


Fixed submission (verdict: Accepted):
k = int(input())
mod = 0
for i in range(1, 10**6):
    mod = ((mod * 10) + 7) % k
    if mod == 0:
        print(i)
        exit()
print(-1)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k=int(input())
if k%2==0:
    print(-1)
else:
    s='7'
    flag=0
    for _ in range(20):
        if int(s)%k==0:
            flag=1
            print(len(s))
            break
        s=s+'7'
    if flag==0:
        print(k-1)

Failing test case input:
23239

Expected output:
10928


Actual output:
23238


Fixed submission (verdict: Accepted):
k=input()
if int(k)%2==0:
    print(-1)
else:
    s=7
    count=1
    flag=0
    while 1:
        if s%int(k)==0:
            print(count)
            break
        if count>int(k):
            print(-1)
            break
        s=(s%int(k))*10+7
        count+=1

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
k=int(input())
l=[]
x=7%k
if x == 0:
  print(1)
  sys.exit()
for i in range(2,k+1):
  x=7%k
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)

Failing test case input:
726903

Expected output:
342000


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
k=int(input())
l=[]
x=7%k
if x == 0:
  print(1)
  sys.exit()
for i in range(2,k+1):
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
d1 = k % 10
mae = 0
sd = [0]*10
cnt = 0
if not d1 in (1, 3, 7, 9):
  print(-1)
  exit()
for i in range(1,10) :
  sd[d1 * i % 10] = i
print(sd)

d2 = 7 - mae % 10
s = str(sd[d2] * k)
for j in range(9):
  print("s1=",s)
  for i in range(len(s)-1, -1, -1):
    print("s[",i,"]=",s[i])
    if (s[i]) == "7":
      cnt += 1
    else:
      s = s[0:i+1]

      print("s2=",s)


      break
print("cnt=",cnt)

Failing test case input:
6957

Expected output:
1737


Actual output:
[0, 3, 6, 9, 2, 5, 8, 1, 4, 7]
s1= 6957
s[ 3 ]= 7
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
s1= 695
s[ 2 ]= 5
s2= 695
cnt= 1


Fixed submission (verdict: Accepted):
k = int(input())
d1 = k % 10
mae = 0
sd = [0]*10
cnt = 0
if not d1 in (1, 3, 7, 9):
  print(-1)
  exit()
for i in range(1,10) :
  sd[d1 * i % 10] = i


for j in range(999999):
  d2 = 7 - mae % 10
  s = str(sd[d2] * k + mae)


  for i in range(len(s)-1, -1, -1):

    if (s[i]) == "7":
      cnt += 1
    else:
      s = s[0:i+1]
      mae = int(s)

      break

    if i == 0 :
      print(cnt)
      exit()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
k = int(sys.stdin.read())
k *= 9
limit = 1000000
value = 0
index = 0
while index < limit:
  index += 1
  value = (value*10+7)%k
  if value == 0:
    print(index)
    sys.exit()

print(-1)

Failing test case input:
342119

Expected output:
169248


Actual output:
507744


Fixed submission (verdict: Accepted):
import sys
k = int(sys.stdin.read())
if k==2:
  print(-1)
  sys.exit()
value = 0
index = 0
while index < 1000000:
  index += 1
  value = (value*10+7)%k
  if value == 0:
    print(index)
    sys.exit()

print(-1)
Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
K = int(input())

tmp1 = 0
for i in range(1, 2 * K + 1):
    tmp1 += 7 * pow(10, i, K)
    if tmp1 % K == 0:
        print(i)
        exit()

print(-1)

Failing test case input:
1803846

Expected output:
-1


Actual output:
900


Fixed submission (verdict: Accepted):
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

tmp1 = 0
for i in range(1, 2 * K + 1):
    tmp1 += 7 * pow(10, i, K)
    if tmp1 % K == 0:
        print(i)
        exit()

print(-1)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
K = int(input())
mod = 0
Good = True
for k in range(K):
    mod = (mod * 10 + 7) % K
    if mod == 0:
        print(k+1)
        Good = False
if Good:
    print(-1)

Failing test case input:
1929

Expected output:
321


Actual output:
321
642
963
1284
1605
1926


Fixed submission (verdict: Accepted):
K = int(input())
mod = 0
Good = True
for k in range(K):
    mod = (mod * 10 + 7) % K
    if mod == 0:
        print(k+1)
        Good = False
        break
if Good:
    print(-1)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k = int(input())
add = 7
if k % 7 == 0:
    k 
    add = 1
ans = 0
now = add
while True:
    if ans > k:
        print(-1)
        break
    elif now == 0:
        print(ans+1)
        break
    else:
        now = (now*10 + add) % k
        ans += 1

Failing test case input:
1208879

Expected output:
74010


Actual output:
518070


Fixed submission (verdict: Accepted):
k = int(input())
ans = 0
now = 7
if k == 1 or k == 7:
    now = 0
while True:
    if ans > k:
        print(-1)
        break
    elif now == 0:
        print(ans+1)
        break
    else:
        now = (now*10 + 7) % k
        ans += 1

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K=int(input())
i=0
if K%2==0 or K%5==0:
    print('-1')
else:
    for d in range(K):
        i=(10*i+7)%K
        if i==0:
            print(i+1)
            break


Failing test case input:
139909

Expected output:
286


Actual output:
1


Fixed submission (verdict: Accepted):

K=int(input())
i=0
if K%2==0 or K%5==0:
    print('-1')

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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k, R = int(input()), 1
for i in range(1, k+10):
    if not R:
        print(i)
    R = (R * 10 % 7 + 7) % k

Failing test case input:
20987

Expected output:
5070


Actual output:

Fixed submission (verdict: Accepted):
k, R, a = int(input()), 7, -1
for i in range(1, k+10):
    if not R%k:
        a = i
        break
    R = (R * 10 + 7) % k
print(a)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
k = int(input())

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

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

Failing test case input:
451457

Expected output:
220458


Actual output:
-1


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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

L = 9*K
s = 1

for i in range(1, 9*(10**6)+1):
  s = s*10%L
  if s == 1:
    print(i)
    exit()

print("-1")

Failing test case input:
139909

Expected output:
286


Actual output:
858


Fixed submission (verdict: Accepted):
K = int(input())

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

for i in range(1, 9*(10**6)+1):
  s = s*10%L
  if s == 1:
    print(i)
    exit()

print("-1")

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())
N = 0

for i in range(10000):
    N += 7*(10**i)
    if N % K == 0:
        print(i+1)
        exit()

print(-1)

Failing test case input:
136963

Expected output:
68481


Actual output:
-1


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

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k=int(input())

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

Failing test case input:
1013603

Expected output:
1927


Actual output:
1


Fixed submission (verdict: Accepted):
k=int(input())

now=7%k
for i in range(k+10):
	if now==0:
		print(i+1)
		exit()
	now*=10
	now+=7
	now%=k
print(-1)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):






















k = int(input())

if k % 2 == 0:
    print(-1)
else:
    count = 1
    if k == 1 or k % 7 == 0:
        print(1)
    else:
        now = 7 % k
        while (1):
            count += 1
            now = ((now * 10 + 7) % k) % k
            if now == 0:
                print(count)
                exit()
            if count >= 1000000:
                print(-1)
                exit()


Failing test case input:
41797

Expected output:
426


Actual output:
1


Fixed submission (verdict: Accepted):






















k = int(input())

if k % 2 == 0:
    print(-1)
else:
    count = 1
    if k == 1 or k == 7:
        print(1)
    else:
        now = 7 % k
        while (1):
            count += 1
            now = ((now * 10 + 7) % k) % k
            if now == 0:
                print(count)
                exit()
            if count >= 1000000:
                print(-1)
                exit()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)/k
  if a == 0:
    print(i+1)
    brake
print(-1)


Failing test case input:
2243343

Expected output:
747780


Actual output:
-1


Fixed submission (verdict: Accepted):
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)%k
  if a == 0:
    print(i+1)
    quit()
print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K=int(input())
count=0
result = -1
for i in range(K):
    count =(10*count+7)%K
    if count%K==0:
        result = i+1
print(result)

Failing test case input:
86061

Expected output:
28686


Actual output:
86058


Fixed submission (verdict: Accepted):
K=int(input())
def x():
    count=0
    for i in range(K):
        count =(10*count+7)%K
        if count==0:
            return i+1
    return -1    
print(x())

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
K=int(input())
base=7%K
for i in range(K+1):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K
print(-1)


Failing test case input:
5513

Expected output:
444


Actual output:
443


Fixed submission (verdict: Accepted):
K=int(input())
base=7%K
for i in range(1,K+1):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K
print(-1)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    K = int(input())
    l = [False] * K
    ans = 1
    now = 0
    while True:
        now = now * 10 + 7
        now %= 7
        if now == 0:
            print(ans)
            break

        if l[now]:
            print(-1)
            break
        
        l[now] = True
        ans += 1

if __name__ == '__main__':
    main()

Failing test case input:
1208879

Expected output:
74010


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    K = int(input())
    l = [False] * K
    ans = 1
    now = 0
    while True:
        now = now * 10 + 7
        now %= K
        if now == 0:
            print(ans)
            break

        if l[now]:
            print(-1)
            break
        
        l[now] = True
        ans += 1

if __name__ == '__main__':
    main()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())


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


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

m = 1 % L

for i in range(k):
    m = (10 * m) % L
    if m == 1:
        print(i + 1)
        exit()
    elif i == k - 1:
        print(-1)
        exit()

Failing test case input:
316729

Expected output:
45246


Actual output:
-1


Fixed submission (verdict: Accepted):
k = int(input())
if k % 7 == 0:
    L = 9 * k / 7
else:
    L = 9 * k
 
if L % 2 == 0 or L % 5 == 0:
    print(-1)

m = 10

for i in range(k):
    m = m % L
    if m == 1:
        print(i + 1)
        exit()
    else:
        m = m * 10

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

ans = -1
num7 = 7
if K%2 != 0:
    for i in range(10000):
        if (num7 % K) == 0:
            ans = i+1
            break
        else:
            num7 = num7*10+7
            i+=1

print(ans)

Failing test case input:
999983

Expected output:
999982

Actual output:
-1


Fixed submission (verdict: Accepted):
K = int(input())

ans = -1
num7 = 7

for i in range(1000000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = (num7*10+7)%K
        i+=1

print(ans)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())


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


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

m = 1 % L

for i in range(k):
    m = (10 * m) % L
    if m == 1:
        print(i + 1)
        exit()
    elif i == k - 1:
        print(-1)
        exit()

Failing test case input:
41797

Expected output:
426


Actual output:
-1


Fixed submission (verdict: Accepted):
k = int(input())
if k % 7 == 0:
    L = 9 * k / 7
else:
    L = 9 * k
 
if L % 2 == 0 or L % 5 == 0:
    print(-1)

m = 10

for i in range(k):
    m = m % L
    if m == 1:
        print(i + 1)
        exit()
    else:
        m = m * 10
Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import random

k=int(input())
A=[1]*(10**6+1)
for i in range(1,10**6+1):
    A[i]=(A[i-1]*10)%k
ind=1
sum=1
while(sum!=0 and ind<=10**6):
    if (A[ind]+sum)%k==0:
        ans=ind
        break
    sum=(sum+A[ind])%k
    ind+=1
if k==1 or k==7:
    print(1)
elif ind==10**6+1:
    print(-1)
else:
    print(ans+1)


Failing test case input:
513023

Expected output:
18081


Actual output:
36162


Fixed submission (verdict: Accepted):
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import random

k=int(input())
A=[1]*(10**6+1)
A[0]=7%k
for i in range(1,10**6+1):
    A[i]=(A[i-1]*10)%k
ind=1
sum=A[0]
while(sum!=0 and ind<=10**6):
    if (A[ind]+sum)%k==0:
        ans=ind
        break
    sum=(sum+A[ind])%k
    ind+=1
if k==1 or k==7:
    print(1)
elif ind==10**6+1:
    print(-1)
else:
    print(ans+1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k=int(input())
cnt=1
flag=True
if k%2==0:
    print(-1)
else:
    keta=10
    tmp=0
    while cnt<=10**6:
        tmp+=pow(keta,cnt-1,k)*7
        if tmp%k==0:
            print(cnt)
            flag=False
            break
        cnt+=1
if flag:
    print(-1)

Failing test case input:
1803846

Expected output:
-1


Actual output:
-1
-1


Fixed submission (verdict: Accepted):
k=int(input())
cnt=1
flag=True
if k%2==0:
    flag=False
    print(-1)
else:
    keta=10
    tmp=0
    while cnt<=10**6:
        tmp+=pow(keta,cnt-1,k)*7
        if tmp%k==0:
            print(cnt)
            flag=False
            break
        cnt+=1
if flag:
    print(-1)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n=k()
x = len(str(n))
if n % 2==0 or n % 5 ==0:
    print(-1)
    sys.exit()

if n==101:
    print(4)
elif n == 11:
    print(2)
elif n == 7:
    print(1)
else:
    print(n-1)


Failing test case input:
5181

Expected output:
78


Actual output:
5180


Fixed submission (verdict: Accepted):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

K = k()
m = 0

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

print('-1')

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from itertools import count

K = int(input())
f = lambda x: (x*10+7)%K

a = 7%K
b = 7%K


for t in count(1):
    if a == 0:
        print(t)
        break
    if t > 1 and a == b:
        print(t,a,b)
        print(-1)
        break
    a = f(a)
    b = f(f(b))

Failing test case input:
1803846

Expected output:
-1


Actual output:
901 7 7
-1


Fixed submission (verdict: Accepted):
from itertools import count

K = int(input())
f = lambda x: (x*10+7)%K

a = 7%K
b = 7%K


for t in count(1):
    if a == 0:
        print(t)
        break
    if t > 1 and a == b:
        print(-1)
        break
    a = f(a)
    b = f(f(b))
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n=k()
x = len(str(n))
if n % 2==0 or n % 5 ==0:
    print(-1)
    sys.exit()
p = [i for i in str(n)]
p = list(set(p))
p.sort()
if p[0]=="0" and p[1]=="1":
    print(x+1)
else:
    print(n-1)


Failing test case input:
2243343

Expected output:
747780


Actual output:
2243342


Fixed submission (verdict: Accepted):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

K = k()
m = 0

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

print('-1')

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
input = stdin.readline
ri = lambda : int(input())
ril = lambda : list(map(int, input().split()))

def main():
  K = ri()
  m = 0
  ans = -1
  for i in range(K):
    m = (10 * m + 7) % K
    if m == 0:
      ans = i
      break
  print(ans)

if __name__ == '__main__':
  main()


Failing test case input:
439373

Expected output:
9802


Actual output:
9801


Fixed submission (verdict: Accepted):
from sys import stdin
input = stdin.readline
ri = lambda : int(input())
ril = lambda : list(map(int, input().split()))

def main():
  K = ri()
  m = 0
  ans = -1
  for i in range(K):
    m = (10 * m + 7) % K
    if m == 0:
      ans = i + 1
      break
  print(ans)

if __name__ == '__main__':
  main()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())
list = [7,77,777,7777,77777,777777]
for i in range(7):
    if i == 6:
        print(-1)
    elif list[i] % K == 0:
        print(i+1)
        break

Failing test case input:
172483

Expected output:
5032


Actual output:
-1


Fixed submission (verdict: Accepted):
k = int(input())
m = 0
 
for i in range(k):
    m = (m * 10 + 7) % k
    if m == 0:
        break
    elif i == k - 1:
        print(-1)
        exit()
 
print(i + 1)
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import collections


def main():
    k = int(input())
    a = 0
    ans = 0
    for i in range(10000000):
        a = 10 * a + 7
        a %= k
        if a == 0:
            ans = i
            break
    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
2243343

Expected output:
747780


Actual output:
747779


Fixed submission (verdict: Accepted):

import collections


def main():
    k = int(input())
    a = 0
    ans = -1
    for i in range(1, 2 * 10 ** 6):
        a = 10 * a + 7
        a %= k
        if a == 0:
            ans = i
            break
    print(ans)


if __name__ == '__main__':
    main()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


k = int(input())

nas = 10 % k
now = 1

if(k%2==0)or(k%5==0):
    print("-1")
else:
    for i in range(1,k):
        now = (now * nas) % k
        if now == 1:
            print("{}".format(i))
            break

Failing test case input:
20511

Expected output:
819


Actual output:
273


Fixed submission (verdict: Accepted):


k = int(input())

now = 1

if(k%2==0)or(k%5==0):
    print("-1")
else:
    past = 0
    for i in range(1,k+1):
        past = (past * 10 + 7) % k
        if past == 0:
            print("{}".format(i))
            break

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k = int(input())

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

tmp = 1
for i in range(1, k):
    tmp = (10 * tmp) % k
    if (tmp % k) == 1:
        print(i)
        break

Failing test case input:
3711

Expected output:
618


Actual output:
206


Fixed submission (verdict: Accepted):
k = int(input())

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

if k == 1:
    print(1)
    exit()

tmp = 7
for i in range(1, 10**7):
    tmp = (10 * tmp) % (9*k)
    if tmp == 7:
        print(i)
        exit()

print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

K = int(input())
count = 1
a = 7 % K

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

print (-1)

Failing test case input:
173153

Expected output:
86154


Actual output:
86153


Fixed submission (verdict: Accepted):

K = int(input())
count = 1
a = 7 % K

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

print (-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k=int(input())
ans=0
n=7
if k%2==0:
  ans=-1
cnt=0
while ans==0 and cnt<65:
  cnt+=1
  if n%k==0:
    ans=cnt
  n=n*10+7
if ans==0:
  ans=k-1
print(ans)

Failing test case input:
17097

Expected output:
690


Actual output:
17096


Fixed submission (verdict: Accepted):
k=int(input())
ans=0
n=7
for i in range(10**6+1):
  if n%k==0:
    ans=i+1
    break
  else:
    n=(n%k)*10+7
    
if ans==0:
  ans=-1
print(ans)
Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
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


Failing test case input:
751

Expected output:
125


Actual output:
124


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

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K = int(input())

flag = [0 for _ in range(K)]  

if 7%K == 0:
    print(0)
else:
    now_n = 7%K
    while True:
        flag[now_n] = 1
        next_n = (now_n*10 + 7) % K
        if next_n == 0:
            print(sum(flag))
            exit()
        elif flag[next_n] == 0:
            now_n = next_n
        else:
            print(-1)
            exit()


Failing test case input:
1676603

Expected output:
67860


Actual output:
67859


Fixed submission (verdict: Accepted):
K = int(input())

flag = [0 for _ in range(K)]  

if 7%K == 0:
    print(1)
else:
    now_n = 7%K
    flag[now_n] = 1
    while True:
        next_n = (now_n*10 + 7) % K
        if next_n == 0:
            print(sum(flag)+1)
            exit()
        elif flag[next_n] == 0:
            now_n = next_n
            flag[now_n] = 1
        else:
            print(-1)
            exit()

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


k = I()

m = k % 10
if m % 2 == 0 or m == 5:
    print(-1)
    exit()
elif k == 1:
    print(1)
    exit()
else:
    s = "1"
    rk = 1
    for i in range(1, 10 ** 6 + 1):
        rk1 = ((10 % k) * rk + 1) % k
        if rk1 * 7 == 0:
            print(i + 1)
            exit()
        rk = rk1


Failing test case input:
139909

Expected output:
286


Actual output:
858


Fixed submission (verdict: Accepted):

import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


k = I()

m = k % 10
if m % 2 == 0 or m == 5:
    print(-1)
    exit()
if k == 1 or k == 7:
    print(1)
    exit()
else:
    rk = 7
    for i in range(2, 10 ** 6 + 1):
        rk1 = ((10 % k) * rk % k + 7 % k) % k
        if rk1 == 0:
            print(i)
            exit()
        rk = rk1
Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):



import sys
K = int(input())
res = 0

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    sys.exit()

surplus = 1
while True:
    res += 1
    surplus = (10 * surplus) % (9*K)
    if surplus == 1:
        break

print(res)


Failing test case input:
1208879

Expected output:
74010


Actual output:
518070


Fixed submission (verdict: Accepted):



import sys
K = int(input())
res = 0
surplus = 1

if K % 2 == 0 or K % 5 == 0:
    res = -1
else:
    if K % 7 == 0:
        K /= 7
    while True:
        res += 1
        surplus = (10 * surplus) % (9*K)
        if surplus == 1:
            break
print(res)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K=int(input())
m=7
count=1
flag=0
for i in range(K):
  if m%K==0:
    flag=1
    break
  else:
    m*=10
    m+=7
    m%=K
    count+=1
if flag:
  print("-1")
else:
  print(count)

Failing test case input:
55133

Expected output:
3180


Actual output:
-1


Fixed submission (verdict: Accepted):
K=int(input())
m=7
count=1
flag=0
for i in range(K):
  if m%K==0:
    flag=1
    break
  else:
    m*=10
    m+=7
    m%=K
    count+=1
if not flag:
  print("-1")
else:
  print(count)

Problem: p02596
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k=int(input())
n=0
for i in range(1,k):
  n=n*10+7
  n=n%k
  if n==0:
    print(i)
    break
print(-1)
    
  

Failing test case input:
726903

Expected output:
342000


Actual output:
342000
-1


Fixed submission (verdict: Accepted):
k=int(input())
n=0
for i in range(1,k+1):
  n=n*10+7
  n=n%k
  if n==0:
    print(i)
    exit()
print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k=int(input())
l=[]
for i in range(1,k+1):
  x=7%k
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)

Failing test case input:
751

Expected output:
125


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
k=int(input())
l=[]
x=7%k
if x == 0:
  print(1)
  sys.exit()
for i in range(2,k+1):
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
K=int(input())
an=0
for i in range(K):
    an=(10*an+7)%K
    if an==0:
        print(i+1)
        exit
print(-1)


Failing test case input:
1929

Expected output:
321


Actual output:
321
642
963
1284
1605
1926
-1


Fixed submission (verdict: Accepted):
K=int(input())
an=0
for i in range(K):
    an=(10*an+7)%K
    if an==0:
        print(i+1)
        exit()
        
print(-1)

Problem: p02596
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = int(input())
n = 0
for i in range(1, k+1):
    n = (n * 10 + 7) % k
    if n == 0:
        print(i)
        break


Failing test case input:
1803846

Expected output:
-1


Actual output:

Fixed submission (verdict: Accepted):
k = int(input())
n = 0
for i in range(1, k+1):
    n = (n * 10 + 7) % k
    if n == 0:
        print(i)
        exit()
print('-1')