### My issue

// I have checked all cases and posiblities

// like 9 to 0 it is giving 1 and also 0 to 9 it is //giving 1

// but still wrong answer

// Please can anyone find the bug in my code

for _ in range(int(input())):

n1, k = map(int, input().split())

n = input()

m = input()

if m in n:

print(0)

else:

mini = 100000000

for i in range(n1 - k + 1):

c, j = 0, 0

for k1 in range(i, i + k):

c += min( abs(int(m[j]) - int(n[k1])), min(10 - int(n[k1]), 10 - int(m[j])))

j += 1

mini = min(mini, c)

print(mini)

### My code

```
for _ in range(int(input())):
n1, k = map(int, input().split())
n = input()
m = input()
if m in n:
print(0)
else:
mini = 100000000
for i in range(n1 - k + 1):
c, j = 0, 0
for k1 in range(i, i + k):
c += min( abs(int(m[j]) - int(n[k1])), min(10 - int(n[k1]), 10 - int(m[j])))
j += 1
mini = min(mini, c)
print(mini)
```

Problem Link: LPC Problem - CodeChef