Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
l = int(input())
s = list(map(int, input().split()))

while l > 0:
    for i in range(l-1):
        count = 1
        ss = s[i:i+l-2]
        for j in range(len(ss)-2):
            if ss[j] == ss[j+1]:
                count *= 1
            else:
                count *= 0
        if count == 1:
            print(i)
            sys.exit()
        l -= 1


Fixed submission:
S = input()
T = input()
count = 0
if S[0] == T[0]:
    count += 1

if S[1] == T[1]:
    count += 1

if S[2] == T[2]:
    count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split()
print(-(-n//(2*d+1)))

Fixed submission:
n, d = map(int, input().split())
if n/(2*d +1) == n//(2*d+1):
  print(n//(2*d+1))
else:
  print(n//(2*d+1)+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = []
for i in range(n):
  L.append(int(input()))

R = []
for i in range(n):
  R.append(L[0:i]+L[i+1:])

  
for i in range(n):
  print(max(R[i]))


Fixed submission:
n = int(input())
L = []
for i in range(n):
  L.append(int(input()))

R = sorted(L)
a = R[-2]
b = R[-1]

for i in L:
  if i == b:
    print(a)
  else:
    print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = []
for i in range(n):
  L.append(int(input()))

for i in range(n):
  R = L[0:i]+L[i+1:]
  print(max(R))


Fixed submission:
n = int(input())
L = []
for i in range(n):
  L.append(int(input()))

R = sorted(L)
a = R[-2]
b = R[-1]

for i in L:
  if i == b:
    print(a)
  else:
    print(b)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
out = 0
if (x == w/2 and y!= 0 and y != h) or (y == h/2 and x != 0 and x != w) or (h*x == w*y and x !=0 and x != w):
  out = 1
print(w*h/2, out)

Fixed submission:
x, a = map(int, input().split())
if x < a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):

def resolve():
    a, b, k = map(int, input().split())
    t = []
    for i in range(1, k+1):
        if a % i == 0 and b % i == 0:
            t.append(i)
    print(t[k-1])
resolve()    

Fixed submission:
def resolve():
    a, b, k = map(int, input().split())
    t = []
    for i in range(1, min(a,b)+1):
        if a % i == 0 and b % i == 0:
            t.append(i)
    print(t[-k])
resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    a, b, k = map(int, input().split())
    L = []
    i = 1
    while len(L) < k:
        if a%i == 0 and b%i == 0:
            L.append(i)
        i += 1
    print(L[K-1])
resolve()    

Fixed submission:
def resolve():
    a, b, k = map(int, input().split())
    t = []
    for i in range(1, min(a,b)+1):
        if a % i == 0 and b % i == 0:
            t.append(i)
    print(t[-k])
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    n = int(input())
    s = 0
    for _ in range(n):
        x, u = input().split()
        if u == 'BTC':
            s += float(x) * 380000
        else:
            s += float(x) * 1
    print(s)
resole()

Fixed submission:
def resolve():
    n = int(input())
    s = 0
    for _ in range(n):
        x, u = input().split()
        if u == 'BTC':
            s += float(x) * 380000
        else:
            s += float(x) * 1
    print(s)
resolve()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = -(-n//111)
if a = 10:
    print(1111)
else:
    print(a*111)

Fixed submission:
n = int(input())
a = -(-n//111)
if a == 10:
    print(1111)
else:
    print(a*111)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < index:
  print('1')
else:
  print(s[index])

Fixed submission:
s = input()
k = int(input())

index = 0
for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < index:
  print('1')
else:
  print(s[index])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < i:
  print(1)
else:
  print(s[index])

Fixed submission:
s = input()
k = int(input())

index = 0
for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < index:
  print('1')
else:
  print(s[index])
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(1, h+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')

Fixed submission:
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(1, w+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(i+1, h+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')

Fixed submission:
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(1, w+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
b = [input() for i in range(int(input()))]
r = [input() for i in range(int(input()))]
k = 0
for w in list(set(b)):
  k = max(o, b.count(w) - r.count(w))
print(k)

Fixed submission:
b = [input() for i in range(int(input()))]
r = [input() for i in range(int(input()))]
o = 0
for w in list(set(b)):
  o = max(o, b.count(w) - r.count(w))
  
print(o)
Buggy python submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')

Fixed submission:
a, b, c = map(int, input().split())
if b-a == c-b:
  print('YES')
else:
  print('NO')

Buggy python submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')

Fixed submission:
a, b, c = map(int, input().split())
if b-a == c-b:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')

Fixed submission:
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)-1] + e[len(e)-1])
else:
  list.append(o[len(o)-1])
  
 
print(*list, sep='')

Buggy python submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(e)] + e[len(o)])
else:
  list.append(o[len(e)])
  
 
print(*list, sep='')

Fixed submission:
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)-1] + e[len(e)-1])
else:
  list.append(o[len(o)-1])
  
 
print(*list, sep='')
Buggy python submission (verdict: Runtime Error):
N = int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
print(num2alpha(N).lower())

Fixed submission:
A = input()
if  A.islower():
  print('a')
else:
  print('A')
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = list(map(int, input().split()))
num = 1
for i in A:
  if 0 in A:
    num = 0
    break
  elif num > 1000000000000000000:
    break
  num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)


Fixed submission:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = list(map(int, input().split()))
num = 1
for i in A:
  if 0 in A:
    num = 0
    break
  elif num > 1000000000000000000:
    break
  num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Fixed submission:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = list(input().split())
num = 1
for i in A:
  if 0 in A:
    break
  num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Fixed submission:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = list(input().split())
num = 1
for i in A:
  num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Fixed submission:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Buggy python submission (verdict: Runtime Error):
N = input()
A = list(input().split())
num = 0
for i in A:
  num *= i
if num <= 1000000000000000000:
  print(-1)
else:
  print(num)

Fixed submission:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = input()

if K >= len(S):
  print(S)
else:
  print(S[0:K]+'...')


Fixed submission:
N = input()
if int(N[-1]) == 2 or int(N[-1]) == 4 or int(N[-1]) == 5 or int(N[-1]) == 7 or int(N[-1]) == 9:
  print('hon')
elif int(N[-1]) == 0 or int(N[-1]) == 1 or int(N[-1]) == 6 or int(N[-1]) == 8:
  print('pon')
elif int(N[-1]) == 3:
  print('bon')
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

if S == T[0:len(S)]:
  print('YES')
else:
  pritn('NOa')

Fixed submission:
S = input()
T = input()

if S == T[0:len(S)]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = int(input())
A = (N*100)%108
N = N*100/108

if A == 0:
  print(int(N))
else:
  print(":(")

Fixed submission:
import sys
input = sys.stdin.readline

A,B = map(int,input().split())
C,D = map(int,input().split())

if (A == 1 or A == 3 or A == 5 or A == 7 or A == 8 or A == 10 or A == 12):
  if B == 31:
    print(1)
  else:
    print(0)
elif (A == 4 or A == 6 or A== 9 or A == 11):
  if B == 30:
    print(1)
  else:
    print(0)
elif A == 2:
  if B == 28:
    print(1)
  else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

A,B = map(int,input().split())
C,D = map(int,input().split())

if (A == 1 or A == 3 or A == 5 or A == 7 or A == 8 A == 10 or A == 12):
  if B == 31:
    print(1)
  else:
    print(0)
elif (A == 4 or A == 6 or A== 9 or A == 11):
  if B == 30:
    print(1)
  else:
    print(0)
elif A == 2:
  if B == 28:
    print(1)
  else:
    print(0)

Fixed submission:
import sys
input = sys.stdin.readline

A,B = map(int,input().split())
C,D = map(int,input().split())

if (A == 1 or A == 3 or A == 5 or A == 7 or A == 8 or A == 10 or A == 12):
  if B == 31:
    print(1)
  else:
    print(0)
elif (A == 4 or A == 6 or A== 9 or A == 11):
  if B == 30:
    print(1)
  else:
    print(0)
elif A == 2:
  if B == 28:
    print(1)
  else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = int(input())
N = N-1
S = input()
s = ' '
o = ' '
n = 0
for i in range(N):
  if S[n] == S[n+1]:
    if s[-1] != S[n]:
      s = s + S[n]
    n = n + 1
  else:
    if s == o:
      s = s + S[n]
      s = s.lstrip()
    s = s + S[n+1]
    n = n + 1
print(len(s.lstrip()))

Fixed submission:
import sys
input = sys.stdin.readline

A,B = map(int,input().split())

C = B * 2

if A<C:
  print(0)
else:
  D = A - C
  print(D)
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = A[0]
K = A[1]

a = N-1
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)

Fixed submission:
N = input()

s = int(N)%2

if s == 0:
  print(0.5)
else:
  a = (int(N)+1)/(2*int(N))
  print(a)

Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = int(A[0])
K = int(A[1])

a = int(N-1)
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)

Fixed submission:
N = input()

s = int(N)%2

if s == 0:
  print(0.5)
else:
  a = (int(N)+1)/(2*int(N))
  print(a)

Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = int(A[0])
K = int(A[1])

a = int(N-1)
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)

Fixed submission:
N = input()

s = int(N)%2

if s == 0:
  print(0.5)
else:
  a = (int(N)+1)/(2*int(N))
  print(a)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a,b = map(int,input().split())

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
c = a*b%2

if c = 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a,b = map(int,input().split())

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

c = a*b%2

if c = 0:
    print("Even")
else:
    print("Odd")


Fixed submission:
a,b = map(int,input().split())

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
X,Y = map(int, input().split())
l = ['A','B','C','D','E','F']
if l.index(X)>l.index(Y):
  print('>')
elif l.index(X)<l.index(Y):
  print('<')
else:
  print('=')

Fixed submission:
X,Y = map(str, input().split())
l = ['A','B','C','D','E','F']
if l.index(X)>l.index(Y):
  print('>')
elif l.index(X)<l.index(Y):
  print('<')
else:
  print('=')
Buggy python submission (verdict: Runtime Error):
R = int(input())
G = int(input())


print(2G-R)

Fixed submission:
R = int(input())
G = int(input())


print(2*G-R)
Buggy python submission (verdict: Runtime Error):
N = input()
N = list[N[0],N[1]]
if '9' in N:
  print('Yes')
else:
  print('No')

Fixed submission:
N = input()

if N[0] == '9' or N[1] == '9':
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
A,B = map(str, input().split())
if (A + B)%3 == 0:
  print('Possible')
else:
  print('Impossible')

Fixed submission:
A,B = map(int, input().split())
if (A + B)%3 == 0 or A%3 == 0 or B%3 == 0:
  print('Possible')
else:
  print('Impossible')
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
A = A.sorted()
print(A[0]+A[1])

Fixed submission:
A = list(map(int, input().split()))
A = sorted(A)
print(A[0]+A[1])
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
D = A + B + C
if(D<=12):
  if (A == 7):
    if(B == 5):
      print('YES')
  if (B == 7):
    if(A == 5):
      print('YES')
  if (C == 7):
    if(A == 5):
      print('YES')
else:
  print('NO')

Fixed submission:
a = list(map(int, input().split()))

A = a[0] + a[1]
if(A==10 or A==12):
  if (a[0] == 7):
    if(a[2] == 5 and a[1] == 5):
      print('YES')
    else:
      print('NO')
  elif (a[1] == 7):
    if(a[2] == 5 and a[0] == 5):
      print('YES')
    else:
      print('NO')
  elif (a[2] == 7):
    if(a[0] == 5 and a[1] == 5):
      print('YES')
    else:
      print('NO')
  else:
    print('NO')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
result = 0
for i in range(N):
    for j in range(i):
        result = result + (A[i]*A[j])%1000000007
result = result % 1000000007
print(result)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 1000000007
ans = 0
res = [A[0]]
for i in range(N-1):
    res.append(res[i]+A[i+1])
for i in range(1,N):
    ans = ans + (A[i]*res[i-1])%mod
ans = ans%mod
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
S = [input() for i in range(N)]
print(len(collections.Counter(S)))

Fixed submission:
S,W = map(int,input().split())
if W>=S:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
sum = int(input())
print((sum/3)*(sum/3)*(sum/3))

Fixed submission:
import math
def comb(n,r):
    if n<2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

a, b = map(int, input().split())
print(comb(a,2)+comb(b,2))
Buggy python submission (verdict: Time Limit Exceeded):
sum = int(input())
max = 0
for i in range(sum*1000):
    a = i/1000
    for j in range(i):
        b = j/1000
        c = sum - a - b
        if a*b*c>max:
            max = a*b*c
print(max)

Fixed submission:
sum = int(input())
print((sum/3)**3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
all=0
for i in range(N):
    all += a.count(i+1)*(a.count(i+1)-1)//2
for i in range(N):
    print(all-(a.count(a[i])-1))

Fixed submission:
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
c = Counter(a)
#print(c.items())
all=0
for i,j in c.items():
    all += j*(j-1)//2
for i in range(N):
    print(all-(c[a[i]]-1))

Buggy python submission (verdict: Time Limit Exceeded):
import math
def comb(n,r):
    if n<2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
a = list(map(int, input().split()))
all=0
for i in range(N):
    all += comb(a.count(i+1),2)
for i in range(N):
    print(all-(a.count(a[i])-1))

Fixed submission:
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
c = Counter(a)
#print(c.items())
all=0
for i,j in c.items():
    all += j*(j-1)//2
for i in range(N):
    print(all-(c[a[i]]-1))
Buggy python submission (verdict: Runtime Error):
int t = 30
if (t >= 30):
  print('Yes')
else:
  print('No')

Fixed submission:
t = int(input())
if (t >= 30):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import math
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]

n = 0

for i ,index in enumerate(x[0]):
  m = math.sqrt(x[i+1]**2 + y[i+1]**2)
  if (m <= y[0]):
    n += 1

print(n)

Fixed submission:
import math
n,d  = map(int,input().split())

x =[]
y = []
for i in range(n):
    x1,y1  = map(int,input().split())
    x.append(x1)
    y.append(y1)

n = 0
 
for i ,index in enumerate(x):
  m = math.sqrt(x[i]**2 + y[i]**2)
  if m <= d:
    n += 1
 
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

num = 1 
n = 7
x = True
 
if (k%2 == 0):
  x = False
  print(-1)

while x:
  if (n%k == 0):
    print(num)
    break
  else:
    n = (n*10 + 7)%k
    num += 1


Fixed submission:
def main():
    k = int(input())

    num = 1 
    n = 7
    
    if (k%2 == 0):
        print(-1)
        return
    

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

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

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
#k = 2

num = 1 
n = 7
x = True
 
if (k%2 == 0):
  x = False
  print(-1)

while x:
  if (n%k == 0):
    print(num)
    break
  else:
    n = n*10 + 7
    num += 1





Fixed submission:
def main():
    k = int(input())

    num = 1 
    n = 7
    
    if (k%2 == 0):
        print(-1)
        return
    

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

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

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

num = 1 
n = 7
 
while True:
  if (n%k == 0):
    print(num)
    break
  else:
    n = n*10 + 7
    num += 1

Fixed submission:
def main():
    k = int(input())

    num = 1 
    n = 7
    
    if (k%2 == 0):
        print(-1)
        return
    

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

    print(-1)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
x,y,z = 0,0,0
n = 0

for i in range(K+1):
    x = i
    if x == S:
        n += 1
        break
    for j in range(K+1):
        y = j
        if x+y == S:
            n += 1
            break
        for k in range(K+1):
            z = k
            if x+y+z == S:
                n += 1

print(n)


Fixed submission:
K,S = map(int,input().split())
x,y,z = 0,0,0
n = 0

for i in range(K+1):
    x = i
    for j in range(K+1):
        y = j
        z = S-(x+y)
        if 0 <= z <=K:
            n += 1

print(n)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
x,y,z = 0,0,0
n = 0

for i in range(K+1):
    x = i
    for j in range(K+1):
        y = j
        for k in range(K+1):
            z = k
            if x+y+z == S:
                n += 1

print(n)


Fixed submission:
K,S = map(int,input().split())
x,y,z = 0,0,0
n = 0

for i in range(K+1):
    x = i
    for j in range(K+1):
        y = j
        z = S-(x+y)
        if 0 <= z <=K:
            n += 1

print(n)