TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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)

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(param_k + 10):
    n = 10*n + 7
    if n % param_k == 0:
      print(i+1)
      break
    else:
      n = n % param_k
  
  print(-1)

param_k = int(input())
 
#param_k = 999983
    
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
    print(n)
    if n % param_k == 0:
      print(i+1)
      break
    if i == param_k + 10 - 1:
      print(-1)

param_k = int(input())

if param_k % 2 == 0:
  print(-1)
  
elif param_k %  == 0:
  print(-1)
  
else:
  n=0
  for i in range(param_k + 10):
    n = 10n + 7
    if n % 7 == 0:
      print(i+1)
      break
    if i == param_k + 10 - 1:
      print(-1)

param_k = int(input())
 
#param_k = 999983
    
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
    print(n)
    if n % param_k == 0:
      print(i+1)
      break
    if i == param_k + 10 - 1:
      print(-1)

param_k = int(input())
 
#param_k = 999983
    
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
    print(n)
    if n % param_k == 0:
      print(i+1)
      break
    
    #  print(-1)
  else:
    print(-1)

param_k = int(input())
 
#param_k = 999983
    
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
    print(n)
    if n % param_k == 0:
      print(i+1)
      break
    else:
      n = n % param_k
    
    #  print(-1)
  else:
    print(-1)

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(param_k + 10):
    n = 10*n + 7
    if n % param_k == 0:
      print(i+1)
      break
    else:
      n = n % param_k
  
  else:
    print(-1)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())

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

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


k = int(input())

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

print(-1)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
print(-1)

k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    i = 1
    m = 7 % k
    while True:
        if m == 0:
            print(i)
            break
        m = (10 * m + 7) % k
        i += 1


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k=int(input())
ans=-1
s="7"
cnt=1
if k%2!=0 and k%5!=0:
  if k%3!=0:
    ans=k-1
  else:
    while int(s)%k!=0:
      s+="7"
      cnt+=1
    ans=cnt
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k, R = int(input()), 1
for i in range(1, k+10):
    if not R:
        print(i)
    R = (R * 10 % 7 + 7) % k

k, R = int(input()), 1
for i in range(1, k+10):
    if R % k == 0:
        print(i)
    R = R * 10 + 7

k, R, a = int(input()), 7, -1
for i in range(1, k+1):
    if not R%k:
        a = i
        break
    R = (R * 10 + 7) % k
print(a)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
N=int(input())
num=0
if (N%2==0)or(N%5==0):
    print(-1)
else:
    for i in range(1,N):
        num+=i*7
        if num%N==0:
            break
    print(i)

N=int(input())
num = 7
plus = 70
i=1
a=[]
if (N%2==0)or(N%5==0):
    print(-1)
else:
    while num%N!=0:
        if num%N in a:
            i=-1
            break
        a.append(num%N)
        num+=plus
        plus*=10
        i+=1
        print(num)
        if i>N:
            i=-1
            break
    print(i)

N=int(input())
num = 7
plus = 70
i=1
a=[]

while num%N!=0:
    b=num//N
    print(b*N,num%N)
    if num%N in a:
        i=-1
        break
    a.append(num%N)
    num+=plus
    plus*=10
    i+=1
    if i>N:
        i=-1
        break
print(i)

N=int(input())
num = 7
plus = 70
i=1
a=[]

while num%N!=0:
    if num%N in a:
        i=-1
        break
    a.append(num%N)
    num+=plus
    plus*=10
    i+=1
    print(num)
    if i>N:
        i=-1
        break
print(i)

N=int(input())
num = 7
plus = 70
i=1
if (N%2==0)or(N%5==0):
    print(-1)
else:
    s=str(N)
    array = list(map(int, s))
    keta=sum(array)
    while num%N!=0:
        num+=plus
        plus*=10
        i+=1
        print(num)
        if i>N:
            i=-1
            break
    print(i)

N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
x = int(input())

ng = np.array([2,4,5,6,8])

import numpy as np

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = prime_factorize(x)

if len(set(a) & set(ng))>0:
    print(-1)
elif len(set(a))== 1 and len(str(x))>3:
    nana = "7"*(x)
    while True:
        nana = nana[:len(nana)-1]
        if int(nana)%x ==0:
            break
    print(len(nana))
else:
    nana = "7"*(len(str(x)))
    while True:
        nana += "7"
        if int(nana)%x ==0:
            break
    print(len(nana))

k = int(input())
if k==1 or k==7:
  print(1)
elif k%2==0:
  print(-1)
else:
  cnt = 1
  pre = 7
  while(True):
    surp = (pre*10+7)%k
    cnt += 1
    if surp==0:
      break
    if cnt>1000000:
      cnt = -1
      break
    pre = surp
  print(cnt)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())
if(K%2==0):
    print(-1)
    exit()
check=list(str(K))
if(check[-1]=='5'):
    print(-1)
    exit()
else:
    seven=7
    if(int(''.join(['7']*(K-1)))%K==0):
        print(K-1)
        exit()
    while True:
        if(seven%K==0):
            print(len(str(seven)))
            break
        else:
            seven=seven*10+7



k = int(input())
if(k%2==0 or k%5==0):
    print(-1)
    exit()
else:
    i=1
    seven=7%k
    while seven!=0:
        seven = (seven*10+7)%k
        print(seven)
        i+=1
    print(i)

k = int(input())
if(k%2==0 or k%5==0):
    print(-1)
    exit()
else:
    i=1
    seven=7%k
    while seven!=0:
        seven = (seven*10+7)%k
        i+=1
    print(i)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):

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()



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()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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)
    
  
  

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

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)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())
n = 0
frag = 0
sevens = ""

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

while frag==0:
    sevens = sevens + "7"
    n+=1
    if int(sevens)%k==0 or n>1000000:
        frag=1
print(n)

k = int(input())

x = 7

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
num=int(input())
a=7
flag=0
for i in range(num):
    a=(a*10+7)
    if a%num==0:
        print(i)
        flag=1
        break
    
if flag==0:
    print("-1")

num=int(input())
a=7
flag=0
for i in range(num):
    if a%num==0:
        print(i+1)
        flag=1
        break
    a=(a*10+7)%num
if flag==0:
    print(-1)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())

if k % 2 == 0:
  print(-1)
elif k % 5 == 0:
  print(-1)
else:
  if k % 7 == 0:
    l = k * 9 / 7
  else:
    l = k * 9
    
  tmp = 1
  for i in range(l):
    tmp = tmp * 10 % l
    if tmp == 1:
      flg == 1
      print(i+1)
      break
  
  if flg != 1
  	print(-1)

k = int(input())

if k % 2 == 0:
  print(-1)
elif k % 5 == 0:
  print(-1)
else:
  if k % 7 == 0:
    l = k * 9 / 7
  else:
    l = k * 9
    
  tmp = 1
  for i in range(l):
    tmp = tmp * 10 % l
    if tmp == 1:
      print(i+1)
      break
  print(-1)

K = int(input())
mod = 7
index = 1
flag = 0

if K % 2 == 0:
  print(-1)
elif K % 5 == 0:
  print(-1)
else:  
  while(index<=K):
      mod=mod%K
      if mod==0:
          print(index)
          flag=1
          break
      mod=mod*10+7
      index+=1
  if flag==0:
      print(-1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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)


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


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


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k=int(input())
i=k
if(k%2==0 or k%5==0):
    print(-1)
while(1):
    if(7*(10**i-1)%(9*k)==0):
        break
    i-=1
print(i)

k=int(input())
i=1
while(1):
  if(7*(10**i-1)%9k==0):
    break
  i++
print(i)

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)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())
sieve = [True] * 10**6
for i in range(2, 10**6):
  if i <= 10**3 and sieve[i]:
    for j in range(i*i, 10**6, i):
      sieve[j] = False

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  if k == 7 or k == 1:
    print(1)
  else:
    if k % 7 == 0:
      k //= 7
    if sieve[k]:
      print(k-1)
    else:
      state = 10
      cnt = 1
      while True:
        if state % k == 1:
          print(cnt)
          break
        state *= 10
        cnt += 1
        

k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  state = 7
  state %= k
  cnt = 1
  while True:
    if state == 0:
      print(cnt)
      break
    state = state * 10 + 7
    state %= k
    cnt += 1


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    K = int(input())
    if K % 2 == 0 or K % 5 == 0:
        print(-1)
        return True
    ans = 1
    K1 = K % 10
    t = K
    while t:
        # print(ans)
        for i in range(10):
            if (t + K1 * i) % 10 == 7:
                break
        else:
            ans = -1
            break
        t = t + K * i
        while t % 10 == 7:
            t //= 10
            ans += 1
            
    print(ans)

if __name__ == '__main__':
    main()

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    K = int(input())
    if K % 2 == 0 or K % 5 == 0:
        print(-1)
        return True
    ans = 0
    K1 = K % 10
    t = K
    while t:
        # print(ans)
        for i in range(10):
            if (t + K1 * i) % 10 == 7:
                break
        else:
            ans = -1
            break
        t = t + K * i
        while t % 10 == 7:
            t //= 10
            ans += 1
            
    print(ans)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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())

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())

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
else:
    while(seven % K != 0):
        count += 1
        seven += 7 * (10 ** count)
        print(count)

    if(count >= 1): 
        print(count + 1)

K = int(input())
seven = 0
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
else:
    while(seven % K != 0):
        seven = (seven * 10 + 7) % K
        count += 1

        
        # count += 1
        # seven = seven + 7 * (10 ** count)

if(count >= 1): 
    print(count)

K = int(input())
seven = 7
count = 0

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

        
        # count += 1
        # seven = seven + 7 * (10 ** count)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k=int(input())
ans=1
s_1=7%k
s_2=10%k
m=0
j=0
if k%2==0 or k%5==0:
  print(-1)
elif k==1 or k==7:
  print(1)
else:
  i=0
  while j==0:
    m=(m+(s_1*(((s_2)**i)%k)))%k
    if m==0:
      j==1
    else:
      ans+=1
      i+=1
  print(ans)


k=int(input())
ans=2
s_1=7%k
s_2=10%k
m=0
j=0
if k%2==0 or k%5==0:
  print(-1)
elif k==1 or k==7:
  print(1)
elif k%7==0:
  l=9*k/7
  s=10%l
  while j==0:
    m=(m+s_1*(s-1))%l
    if m==0:
      j==1
    else:
      ans+=1
      s=(s*10)%l
  print(ans)
else:
  l=9*k
  i=0
  while j==0:
    m=(m+s_1*(s-1))%l
    if m==0:
      j==1
    else:
      ans+=1
      s=(s*10)%l
  print(ans)


k=int(input())
ans=2
s_1=7%k
m=0
j=0
if k%2==0 or k%5==0:
  print(-1)
elif k==1 or k==7:
  print(1)
elif k%7==0:
  l=9*k/7
  i=0
  while j==0:
    m=(m+s_1*(((s_2**i)%l-1)%l))%l
    if m==0:
      j==1
    else:
      i+=1
      ans+=1
  print(ans)
else:
  l=9*k
  s=10%k
  while j==0:
    m=(m+s_1*s)
    if m==0:
      j==1
    else:
      i+=1
      ans+=1
      s=(10*s)%k
  print(ans)


k=int(input())
ans=1
s_1=7%k
s_2=10%k
m=0
j=0
if k%2==0 or k%5==0:
  print(-1)
elif k==1 or k==7:
  print(1)
elif k%7==0:
  l=9*k/7
  i=0
  while j==0:
    m=(m+s_1*(((s_2**i)%l-1)%l))%l
    if m==0:
      j==1
    else:
      i+=1
      ans+=1
  print(ans)
else:
  l=9*k
  i=0
  while j==0:
    m=(m+s_1*(((s_2**i)%l-1)%l))%l
    if m==0:
      j==1
    else:
      i+=1
      ans+=1
  print(ans)

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)


Verdicts: Time Limit Exceeded

Runtime Error

Runtime Error

Time Limit Exceeded

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
import sys
k = int(input())
for i in range(k+1):
  d = 7
  d = (10*d) + 7
  d %= k
  if d == 0:
    print(i+1)
    sys.exit()
print(-1)

k = int(input())
i = 1
if a%2 ==1:
    while True:
        s = 0
        for j in range(i):
            s += (10**j)*7
        if s % k == 0:
            print(i)
            break
        i += 1
else:
    print(-1)

import sys
k = int(input())
d = 0
for i in range(k+1):
  d = (10*d) + 7
  d %= k
  if d == 0:
    print(i+1)
    sys.exit()
print(-1)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())
a = 0
for i in range(10**6):
    a += 7*(10**i)
    if a%k == 0:
        print(i)
        exit()

  
print(-1)

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
        ai = a1 % K
        a1 = (a1 * 10 + 7)
    if ai == 0:
        break
 
print(i + 1)

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)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
N = int(input())
seven = 7
while N % 2 == 1:
    print(seven)
    if seven % N == 0:
        print(len(str(seven)))
        exit()
    seven = seven * 10 + 7
print(-1)

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

start = j = 7 % K
count = 1


while True:
    
    if j == 0:
        print(count)
        exit()
        
    j = 10 * j + 7
    j = j % K
    count += 1
    
    
    if j == start:
        print(-1)
        exit()

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
pos = 0
curr = 7
k = int(input())
while true:
  pos += 1
  if curr % k == 0:
    break
  else : 
    k *= 10
    k += 7
print(pos)

pos = 1
curr = 7
k = int(input())
while curr % k != 0:
  pos += 1
  k *= 10
  k += 7
print(pos)

pos = 0
curr = 7
k = int(input())
while true:
  pos += 1
  if curr % k == 0:
    break
  else : 
    k = k*10 
    k += 7
print(pos)

k=int(input())
x=7
for i in range(1,k+1):
  if x%k==0:
    print(i)
    break
  x=(x*10+7)%k
else:
  print(-1)

Verdicts: Runtime Error

Time Limit Exceeded

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
def main(h):
  count = 1
  n = 0
  if i in range (k):
    n = (n * 10 + 7) % k  
    if n == 0:
      break 
      print(count)
      return 0
    count += 1
  print(-1)
  
if __name__ == '__main__':
	k = int(input())
    main(k)

def main(h):
  count = 1
  n = 0
  for i in range (k):
    n = (n * 10 + 7) % k  
    if n == 0: 
      print(count)
      return 0
    count += 1
  print(-1)
  
if __name__ == '__main__':
  k = int(input())
  main(k)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())
S = 7

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

    if i >= K:
        print('-1')


K = input()
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:
        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        else:
            print(i)
            break

        if i > K:
            print('-1')
            break

K = input()
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:
        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        else:
            print(i)
            break

        if i > K:
            print(-1)
            break

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())

powlis = [pow(10, i, K) for i in range(K)]
for i in range(K-1):
    powlis[i+1] = (powlis[i] + powlis[i+1]) % K
    
print(lis[0:10])
if 0 in lis:
    print(lis.index(0)+1)
else:
    print(-1)

K = int(input())

powlis = [pow(10, i, K) for i in range(K)]
for i in range(K-1):
    powlis[i+1] = (powlis[i] + powlis[i+1]) % K

lis = [(7 *powlis[i])%K  for i in range(K) ]

if 0 in lis:
    print(lis.index(0))
else:
    print(-1)

K = int(input())

powlis = [7*pow(10, i, K) for i in range(K)]
for i in range(K-1):
    powlis[i+1] = (powlis[i] + powlis[i+1]) % K
powlis[0] %= K


try:
    print(powlis.index(0) + 1)
except:
    print(-1)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):

K= int(input(" "))

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B%K==0:
            print(i)
            break
        else:
            B = 10 * B + 7
            i = i + 1



K= int(input(" "))

B= 7

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    i = 1
    while 1:
        i= i+1
        B = 10*B + 7
        if B%K==0:
            print(i)
            break


K= int(input(" "))
#B= 7
i= 1

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    while 1:
        i = i + 1
        C= 10**i-1
        #B = 10 * B + 7

        if C%(9*K)==0:
            print(i)
            break


K= int(input())

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B==0:
            print(i)
            break
        else:
            B = (10 * B + 7) % K
            i = i + 1

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())

ans = -1
memo = 7 % k

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


k = int(input())

ans = -1
memo = 7 % k

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


k = int(input())

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



Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())
n = 0
for i in range(1, k+1):
    n = (n * 10 + 7) % k
    if n == 0:
        print(i)
        break
print('-1')


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')

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
n = int(input())
st = input()

r = st.count("R")

count = 0

for i in range(r):
    if st[i]=="W":
        count += 1

print(count)
            

        


n = int(input())
st = input()

r = st.count("R")

count = 0

for i in range(r):
    if st[i]=="W":
        count += 1

print(count)
            

        


k = int(input())
m = 7%k

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

print(-1)
        
    


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k=int(input())
mod7 = 7%k
mod10= 10%k

mod = mod7
mod10times = mod7

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

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

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)

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)
        

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
import sys
input - sys.stdin.readline
def main():
    K = int(input())
    
    if K%2==0:
        print(-1)
        return
    
    if K % 7:
        L = 9*K
    else:
        L = 9*K//7
    a = 1
    for i in range(1,K+10):
        a = (a * 10) % L
        if a == 1:
            print(i)
            return
    print(-1)
main()

import sys
input = sys.stdin.readline

def main():
    K = int(input())
    
    if K%2==0 or K%5==0:
        print(-1)
        return
    
    if K % 7:
        L = 9*K
    else:
        L = 9*K//7
    a = 1
    for i in range(1,K+10):
        a = (a * 10) % L
        if a == 1:
            print(i)
            return
    print(-1)
main()


Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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)

k=int(input())
f=-1
for i in range(1,1000):
    s=k*i
    l=len(str(s))
    d=0
    for i in range(l):
        if str(s)[i]!=7:
            d=d+1
            break
    if d<=0:
        f=l
print(f)

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K =  int(input())

a = [0]*1000001
ans = -1
a[1] = 7%K

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


K =  int(input())

a = [0]*1000001
ans = -1
a[1] = 7%K

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


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
#C
import sys
k=int(input())
a=7
for i in range(k):
    if a%k==0:
        print(i)
        sys.exit()
    a=a*10+7
print(-1)

#C



import sys
k=int(input())
if k%7==0:
    k//=7
k*=9
a=10%k
for i in range(k):
    a=a%k
    if a==1:
        print(i+1)
        sys.exit()
    a*=10
print(-1)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())
a = 0
num=[7,77,777,7777,77777,777777]
for i in num:
  if i%K==0:
    print(i)
    a = 1
    break

if a==0:
  print(-1)

K = int(input())
if K==7 or K==1:
  print(1)
else:
  count = 1
  for i in range(K):
    x = (x % K) * 10 + 7
    count += 1
    if x==0:
      print(count)
  if x!=0:
    print(-1)

K = int(input())
if K==7 or K==1:
  print(1)
else:
  count = 1
  x = 7%K
  for i in range(K):
    x = (x*10+7)%K
    count += 1
    if x==0:
      print(count)
      break
  if x!=0:
    print(-1)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())
ans = -1

if K % 7 == 0:
  for i in range(K):
    if 10 ** i % (9 * K / 7) == 1:
      ans = i
      break
else:
  for i in range(K):
    if 10 ** i % (9 * K) == 1:
      ans = i
      break
  
print(ans)

import sys
K=int(input())
L=9*K
if L%7==0:
  L = L//7
n = 1
for i in range(1,K+1):
  n = n * 10 % L
  if n == 1:
    print(i)
    sys.exit()
print(-1)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())

num = 0
cnt = 0
ans = False

for i in range(K):
    num = num*10+7
    cnt += 1
    if num % K == 0:
        print(cnt)
        ans = True

if ans == False:
    print(-1)  

K = int(input())

num = 0
cnt = 0
ans = -1

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
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)


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)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
if __name__ == '__main__':

	k = int(input())
	x = 1
	for i in range(10**6):
		if x == 0:
			print(i)
			exit()
		x = (10 * x + 7) % k


if __name__ == '__main__':

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


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())
x = 7%k
i = 1
for i in range(0,k+1):
    if x==0:
        print(i)
        break    
        
    l.append(x)
    x = (x*10+7)%k
    i += 1

k = int(input())
x = 7%k
i = 1
for i in range(0,k+1):
    if x==0:
        break    
    x = (x*10+7)%k
    i += 1
    
if x == 0:
    print(i)
else:
    print('-1')

k = int(Input)
x = 7%k
l = []
i = 1
while(True):
    if x in l:
        print('-1')
        break
    if x==0:
        print(i)
        break    
        
    l.append(x)
    x = (x*10+7)%k
    i += 1

k = int(input())
x = 7%k
i = 1
for i in range(1,k+1):
    if x==0:
        break    
    x = (x*10+7)%k
    i += 1
    
if x == 0:
    print(i)
else:
    print('-1')

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())

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

k = int(input())

t = 7
flag = True
for i in range(k):
  if t % k == 0:
    print(i + 1)
    flag = False
    break
  else:
    t = (t * 10 + 7) % k
if flag:
  print('-1')

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K = int(input())

n = 1
x = 7


if K % 2 == 0:
  peint( -1 )
  exit( 0 )
#

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x % K) * 3 + 7
  n += 1
#


K = int(input())

n = 1
x = 7


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

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x % K) * 3 + 7
  n += 1
#


K = int(input())

n = 1
x = 7


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

while 1:
  if x % K == 0:
    print( n )
    break
  x = (x * 10 + 7) % K
  n += 1
#


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())
i = 1
a = 7
if k % 2 == 0:
  print("-1")
  return
while a % k != 0:
  i += 1
  a = 10*a + 7
  if i == 10**9+7:
    i = -1
    break

print(i)
  


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)


Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
N = int(input())

n7 = 0
 
for i in range(6):
  n7 += 7*(10**(i))
  print(n7)
  if n7 % N == 0:
    print(i+1)
    break
  if i == 5:
    print(-1)
    


N = int(input())

n7 = 0
 
for i in range(6):
  n7 += 7*(10**(i))
  print(n7)
  if n7 % N == 0:
    print(i+1)
    break
  if i == 5:
    print(-1)
    break
    


N = int(input())

N = 2
 
n7 = 0
 
for i in range(6):
  n7 += 7*(10**(i))
  if n7 % N == 0:
    print(i+1)
    break
  
  if i == 6:
    print(-1)
    


K = int(input())

x = []
x.append(7%K)
for i in range(1,K):
  x.append((x[i-1]*10+7)%K)
  
for i in range(K):
  if x[i]==0:
    print(i+1)
    exit()
    
print(-1)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
k = int(input())

import fractions

flag = False

for i in range(n):
    f = fractions.gcd(k,(10**n-1)/9*7)
    if f == k:
        flag = True
        break

if flag:
    print(i+1)
else:
    print(-1)

k = int(input())

flag = False

resid  = 7
if resid%k==0:
    i = -1
    flag = True
else:
    for i in range(k):
        resid = (resid*10+7)%k
        if resid == 0:
            flag = True
            break

if flag:
    print(i+2)
else:
    print(-1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
N = int(input())
rw = list(input())

rw_after=sorted(rw)

count=0
for i in range(N):
    if rw[i] != rw_after[i]:
        count+=1
print(int(count/2))


K = int(input())
rest = 7%K
count=1
while (count<=K):
    if rest == 0:
        print(count)
        exit()
    count +=1
    rest = (rest%K*10 + 7)%K
print(-1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves the number 7 and multiples of K.  Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.)  If the sequence contains no multiples of K, print `-1` instead.

Submission attempts (in order):
K=int(input())
x=0
if k%2==0:
  print(-1)
  exit
for i in range(1000000):
  x=(10*x+7)%K
  if x==0:
    print(i+1)
    exit
if x!=0:
  print(-1)

from math import gcd
K=int(input())
if K%7==0:
  K=K//7
if gcd(10,K)!=1:
  print(-1)
  return
x=1%K
cnt=1
while x!=0:
  x=(10*x+1)%K
  cnt+=1
print(cnt)

K=int(input())
x=0
if k%2==0:
  print(-1)
  exit
for i in range(1000000):
  x=(10*x+7)%K
  if x==0:
    print(i+1)
    break
if x!=0:
  print(-1)

K=int(input())
x=0
if K%2==0:
  print(-1)
  exit
for i in range(1000000):
  x=(10*x+7)%K
  if x==0:
    print(i+1)
    exit
if x!=0:
  print(-1)

from math import gcdnbv
K=int(input())
if K%7==0:
  K=K//7
if gcd(10,K)!=1:
  print(-1)
  return
x=1%K
cnt=1
while x!=0:
  x=(10*x+1)%K
  cnt+=1
print(cnt)


K=int(input())
cnt=0
ans=0
while cnt<1000001:
  cnt+=1
  ans=(ans*10+7)%K
  if ans==0:
    print(cnt)
    break
else:
  print(-1)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted