Harryxun/stf_run huggingface dataset:
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

ans = 0
#s = []
b = []
temp = 0
for i, x in enumerate(a):
    temp = (temp + x) % k
    c = (temp - (i % k) + k) % k
    b.append(c)
    #if x % k == 1:
    #    ans += 1

#print(s)
#print(b)

m = [0] * k

for i in range(min(k, n+1)):
    ans += m[b[i]]
    m[b[i]] += 1

#print(m)

for i in range(k, n+1):
    m[b[i-k]] -= 1
    ans += m[b[i]]
    m[b[i]] += 1
    #print(m)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

n += 1
ans = 0
m = dict()
temp = 0
b = []
for i in range(min(n, k)):
    temp = (temp + a[i]) % k
    c = (temp - (i % k) + k) % k
    b.append(c)
    if c in m.keys():
        ans += m[c]
        m[c] += 1
    else:
        m[c] = 1

for i in range(k, n):
    x = i % k
    m[b[x]] -= 1
    temp = (temp + a[i]) % k
    c = (temp - (i % k) + k) % k
    b[x] = c
    if c in m.keys():
        ans += m[c]
        m[c] += 1
    else:
        m[c] = 1

print(ans)
N = int(input())
A = sorted((map(int,input().split())))
A_Max = A[-1]
B = [True]*A_Max

for i in range(N):
    if B[A[i]]:
        for j in range(2, A_Max//A[i]+1):
            B[A[i]*j] = False

ans = 0
for i in range(N-1):
    if B[A[i]]:
        if A[i] == A[i+1]:
            B[A[i]] = False
        else:
            ans += 1

print(ans)



### FIXED CODE ###

N = int(input())
A = sorted((map(int,input().split())))
a_Max = A[-1]
B = [0]*a_Max

for a in A:
    if B[a-1] == 0:
        B[a-1] = 1
        for j in range(2,a_Max+1):
            if a*j > a_Max:
                break
            B[a*j-1] = 2
    elif B[a-1] == 1:
        B[a-1] = 2
            
ans = 0
for b in B:
    if b == 1:
        ans += 1

print(ans)
a,b = list(map(int,input().split()))
s = input()
num = s[:a] + s[a+1]
print('Yes' if s[a+1] == '-' and len(s) == a+b+1 and ('-' not in num) else 'No')


### FIXED CODE ###

m = int(input())
print(48-m)
n,r = input()
n,r = input().split()
n = min(10,int(n))
r = int(r)
r = r+100*(10-n)
print(r)


### FIXED CODE ###

n,r = input().split()
n = min(10,int(n))
r = int(r)
r = r+100*(10-n)
print(r)
i = 1
while True:
    input = int(input())
    if input == 0:
        break
    print("Case {}: {}", i, input)
    i += 1

### FIXED CODE ###

import sys, itertools
  
for count, input in zip(itertools.count(1), sys.stdin):
    if int(input) == 0: break
    print('Case {0}: {1}'.format(count, input), end='')
s = input()
K = int(input())
head = [h for h in s]

head = set(head)
head = list(head)
head.sort()

cnt = 0
ans = []
idx = 0
while cnt <= K:
    for i in range(len(s)):
        if s[i] == head[idx]:
            for k in range(i+1, len(s)+1):
                ans.append(s[i:k])
                cnt += 1
    idx += 1
ans = set(ans)
ans = list(ans)
ans.sort()
print(ans[K-1])

### FIXED CODE ###

s = input()
K = int(input())
head = [h for h in s]

head = set(head)
head = list(head)
head.sort()

cnt = 0
ans = []
idx = 0
while cnt < K:
    for i in range(len(s)):
        if s[i] == head[idx]:
            for k in range(i+1, min(len(s)+1, i+6)):
                ans.append(s[i:k])
        ans = set(ans)
        ans = list(ans)
        cnt = len(ans)
    idx += 1
ans = set(ans)
ans = list(ans)
ans.sort()
print(ans[K-1])
a,b = map(input().split())
print(math.ceil(((b-1)/(a-1)))

### FIXED CODE ###

import math
a,b = map(int, input().split())
print(math.ceil(((b-1)/(a-1))))
map(int,input().split()).sort()

### FIXED CODE ###

print(*sorted(input().split()))
s=input()
if s[2]=s[3]ands[4]=s[5]:
    print("Yes")
else:
    print("No")    

### FIXED CODE ###

s=input()
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")
N = int(input())
S = input()
R, G, B = [],[],[]
for i,s in enumerate(S):
    if s=='R':
        R.append(i)
    elif s=='G':
        G.append(i)
    else:
        B.append(i)

R.sort()
G.sort()
B.sort()

from fractions import gcd
from math import ceil
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
 
ans = len(R)*len(G)*len(B)
for r in R:
    for g in G:
        for p in [r*2-g,g*2-r,(r+g)/2]:
            if p<=B[-1] and p>=B[0]:
                ind = bisect_left(B,p)
                if p == B[ind]:
                    ans -= 1

print(ans)



### FIXED CODE ###

N = int(input())
S = input()
R, G, B = [],[],[]
for i,s in enumerate(S):
    if s=='R':
        R.append(i)
    elif s=='G':
        G.append(i)
    else:
        B.append(i)

R.sort()
G.sort()
B.sort()

from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
 
ans = len(R)*len(G)*len(B)
if ans > 0:
    for r in R:
        for g in G:
            for p in [r*2-g,g*2-r,(r+g)/2]:
                if p<=B[-1] and p>=B[0]:
                    ind = bisect_left(B,p)
                    if p == B[ind]:
                        ans -= 1

print(ans)
from sys import stdin
import fractions

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

def gcd_all(list):
    return gcd_all([fractions.gcd(*list[:2])] + list[2:]) if len(list) > 1 else list[0]

ma = 0
for i in range(n):
    lin = [li[s] for s in range(n) if s != i]
    ma = max(ma,gcd_all(lin))

print(ma)

### FIXED CODE ###

from fractions import gcd

N = int(input())
A = list(map(int,input().split()))

M = [0]*N

#漸化式を作る
L = [0]*N
R = [0]*N

for i in range(1,N):
    L[i] = gcd(L[i-1],A[i-1])
    R[N-1-i] = gcd(R[N-i],A[N-i])

for j in range(N):
    M[j] = gcd(L[j],R[j])

print(max(M))
import math

r = int(input())
print(math.pi*r**2 + " "+  2*math.pi*r**2)


### FIXED CODE ###

import math
x = math.pi

r = float(input())
print("{} {}".format(x*r*r,2*x*r))
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    if gcd == 1:
        print(1)
    else:
        ls = [True] * (gcd + 1)
        ls[0] = False
        ls[1] = False
        c = 1
        for i in range(int(len(ls) ** 0.5) + 2):
            if ls[i]:
                if a % i == 0 and b % i == 0:
                    c += 1
                for j in range(i, len(ls), i):
                    ls[j] = False
        print(c)


if __name__ == '__main__':
    slove()


### FIXED CODE ###

def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    cnt = 1
    for i in range(2, int(gcd ** 0.5) + 1):
        if gcd % i == 0:
            cnt += 1
            while True:
                if gcd % i == 0:
                    gcd //= i
                else:
                    break
    if gcd != 1:
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()
mport itertools

n,m = map(int, input().split())
print(len(list(itertools.combinations(range(m),2))) + len(list(itertools.combinations(range(n),2))))

### FIXED CODE ###

import itertools

n,m = map(int, input().split())
print(len(list(itertools.combinations(range(m),2))) + len(list(itertools.combinations(range(n),2))))
def gaiseki(x1,y1,x2,y2,x3,y3,x4,y4):
    if ((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3)) < 1e-10:
        print("YES")
    else:
        print("NO")
a = int(input())

for i in range(a):
    g=(map(float,raw_input().split()))
    
    x1=g[0]
    y1=g[1]
    x2=g[2]   
    y2=g[3]
    x3=g[4]
    y3=g[5]
    x4=g[6]
    y4=g[7]
    gaiseki(x1,y1,x2,y2,x3,y3,x4,y4)

### FIXED CODE ###

n = int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
    print("YES" if abs((y2-y1)*(x4-x3)-(x2-x1)*(y4-y3)) < 1e-10 else "NO")
L, R = [int(input()) for i in input().split()]
diff = R - L
ans = 2 * (10 ** 9)
if diff == 1:
    print((L * (L + 1)) % 2019)
else:
    for i in range(diff):
        for j in range(i + 1, diff):
            x = ((L + i) * (L + j)) % 2019
            ans = min(x, ans)
            if x == 0:
                break
    print(ans)


### FIXED CODE ###

L, R = [int(i) for i in input().split()]
R = min(R, L + 4038)
ans = 2018
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        if x == 0:
            ans = 0
            break
        ans = min(ans, x)
print(ans)
n, k = list(map(int, input().split()))

def kaijou(a):
    ret = 1
    for i in range(a):
        ret *= i + 1
    return ret


def comb(n, k):
    if k == 0:
        return 1

    return kaijou(n) / (kaijou(k) * kaijou(n - k))

TEISU = 10 ** 9 + 7

for i in range(k):
    print(int(comb(n - k + 1, i + 1) * comb(k - 1, i)) % TEISU)


### FIXED CODE ###

n, k = list(map(int, input().split()))


from functools import reduce
from operator import mul

def cmb(n, r):
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    # なんでn + 1じゃないのか？
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

TEISU = 10 ** 9 + 7

for i in range(k):
    print(int(cmb(n - k + 1, i + 1) * cmb(k - 1, i)) % TEISU)
A, V = map(int, input().split())
B, W = map(int, input().split())
T=int(input())

if(A<B):
  if(B+W*T <= A+V*T):
    print("YES")
  else:
    print("NO")
elif(B<A):
    if(A-V*T <= B-W*T):
    print("YES")
  else:
    print("NO")

### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T=int(input())

if(A<B):
  if(B+W*T <= A+V*T):
    print("YES")
  else:
    print("NO")
elif(B<A):
  if(A-V*T <= B-W*T):
    print("YES")
  else:
    print("NO")
N, D = input().split()

x = [0] * N
y = [0] * N

for i in range(N):
  x[i], y[i] = map(int, input().split())
  
counter = 0

for i in range(N):
  dist = x[i] * x[i] + y[i] * y[i]
  if dist <= D:
    counter += 1

print(counter)

### FIXED CODE ###

N, D = map(int, input().split())

x = [0] * N
y = [0] * N

for i in range(N):
  x[i], y[i] = map(int, input().split())
  
counter = 0

for i in range(N):
  dist = x[i] * x[i] + y[i] * y[i]
  if dist <= D*D:
    counter += 1

print(counter)
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    ranks[math.floor(i/399)] = True

lows = min(len([i for i in ranks if i == True]), 8) 

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)


### FIXED CODE ###

import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    if i >= 1 and i <= 399:
        ranks[0] = True
    elif i >= 400 and i <= 799:
        ranks[1] = True
    elif i >= 800 and i <= 1199:
        ranks[2] = True
    elif i >= 1200 and i <= 1599:
        ranks[3] = True
    elif i >= 1600 and i <= 1999:
        ranks[4] = True
    elif i >= 2000 and i <= 2399:
        ranks[5] = True
    elif i >= 2400 and i <= 2799:
        ranks[6] = True
    elif i >= 2800 and i <= 3199:
        ranks[7] = True
lows = len([i for i in ranks if i == True])

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)
l,r = map(int, input().split())

r = min(r, l = 4038);
ans = 2018
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        x = i * j % 2019
        ans = min(ans, x)

print(ans)

### FIXED CODE ###

n,a,b = map(int, input().split())

print(min(n*a, b))
a = int(input())
b = int(input())
if b % a == 0:
  print(a + b)
else:
  print(b-a)

### FIXED CODE ###

x = input().split()
a = int(x[0])
b = int(x[1])
if b % a == 0:
  print(a + b)
else:
  print(b-a)
# B - Bounding
N, X = map(int,input().split())
L = list(map(int, input().split()))
D = 0
count = 0

for i in range(N+1):
    if D <= X:
        D += L[i]
        count += 1
    else:
        break
print(count)

### FIXED CODE ###

# B - Bounding
N, X = map(int,input().split())
L = list(map(int, input().split()))
D = 0
count = 1

for i in range(N):
    D += L[i]
    if D <= X:
        count += 1
    else:
        break

print(count)
import sys
n,m = map(int,input().split())

if m > 0:
    broken = set(map(int,sys.stdin))
else:
    broken = set()
    
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1 if 1 not in broken else 0

MOD = 10**9 + 7

for i in range(2,n+1):
    if i in broken:
        continue
    dp[i] =　(dp[i-1]+dp[i-2])% MOD
    
print(dp[-1])

### FIXED CODE ###

c=list(map(int, input().split()))

c.remove(max(c))

print(sum(c))
S = input()
N = len(S)
l = []
temp = 0
index = 0
for i in range(N):
    l.append(int(''.join(S[i:N])))

ans = 0
for i in range(N-1):
    for j in range(i,N):
        if (l[i] - l[j])/(10**(N-j)) % 2019 == 0 and l[i]-l[j] != 0:
            ans += 1

if ans == 0:
    print(0)
else:
    print(ans+1)

### FIXED CODE ###

S, W = map(int, input().split())

if W >= S:
    print('unsafe')
else:
    print('safe')
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

import numpy as np
def main():
    S,T = input().split()
    A,B = MAP()
    U = INT()

    if S == U:
        print(A-1,B)
    else:
        print(A,B-1)

    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
# input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    S,T = input().split()
    A,B = MAP()
    U = input()

    if S == U:
        print(A-1,B)
    else:
        print(A,B-1)

    return

if __name__ == '__main__':
    main()
ACGT = ["A", "C" ,"G", "T"]
s = input()
ans = 0, temp = 0
for i in s:
  ok = False
  for j in ACGT:
    if i == j:
      ok = True
      temp += 1
  if ok == False:
    ans = max(ans, temp)
    temp = 0
ans = max(ans, temp)
print(ans)

### FIXED CODE ###

ACGT = ["A", "C" ,"G", "T"]
s = input()
ans = 0
temp = 0
for i in s:
  ok = False
  for j in ACGT:
    if i == j:
      ok = True
      temp += 1
  if ok == False:
    ans = max(ans, temp)
    temp = 0
ans = max(ans, temp)
print(ans)
if __name__ == '__main__':
  x = input().split(' ')
  W = x[0]
  H = x[1]
  x = x[2]
  y = x[3]
  r = x[4]
  if x - r < 0 or x + r > W:
    print('No')
  if y - r < 0 or y + r > H:
      print('No')
  else:
    print('Yes')
      
	

   



### FIXED CODE ###

line = input().split(" ")
w = int(line[0])
h = int(line[1])
x = int(line[2])
y = int(line[3])
r = int(line[4])
if x - r < 0:
    print("No")
elif w < x + r:
    print("No")
elif y - r < 0:
    print("No")
elif h < y + r:
    print("No")
else:
    print("Yes")
A = int(input())
B = int(input())
B-=1
print((A+B-1)/B)

### FIXED CODE ###

A, B = list(map(int, input().split()))
for i in range(20):
    if B<=1+i*(A-1):
        print(i)
        break
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    sA = 0
    AA = []
    for a in A:
        sA += a
        if sA > K:
            break
        AA.append(sA)

    sB = 0
    BB = []
    for b in B:
        sB += b
        if sB > K:
            break
        BB.append(sB)

    AA = AA[::-1]

    M = max(len(AA), len(BB))

    for i in range(len(AA)):
        for j in range(len(BB)):
            if AA[i] + BB[i] <= K:
                m = len(AA) - i + j + 1
                if m > M:
                    M = m
    print(M)

main()


### FIXED CODE ###

import numpy as np

from numba import njit


@njit("i8[:](i8, i8[:], i8[:])", cache=True)
def cumsum(K, A, cA):
    for i, a in enumerate(A):
        cA[i] += cA[i - 1] + A[i]
        if cA[i] > K:
            break

    cA = cA[cA != 0]
    cA = np.append(0, cA)
    return cA


@njit("i8(i8, i8[:], i8[:])", cache=True)
def solve(K, cA, cB):
    ans = np.searchsorted(cA, K - cB, side="right") - 1
    ans += np.arange(len(cB))
    return ans.max()


N, M, K = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)

cA = np.zeros(N, dtype=np.int64)
cB = np.zeros(M, dtype=np.int64)

# np.cumsumだとoverflowする
cA = cumsum(K, A, cA)
cB = cumsum(K, B, cB)

ans = solve(K, cA, cB)
print(ans)
import sys
N=int(input())
a=[int(i) for i in input().split()]
t=0
while True:
  for i in range(N):
    if a[i]%2==0:
      a[i]//=2
    else:
      print(t)
      sys.exit()
  t+=1
      

### FIXED CODE ###

a=input()
print(a.count('1'))
n, x = map(int, input().split())
don = [int(stdin[i]) for i in range(n)]
dst = (x - sum(don)) // min(don) + n
print(dst)


### FIXED CODE ###

n, x = map(int, input().split())
don = [int(input()) for i in range(n)]
dst = (x - sum(don)) // min(don) + n
print(dst)
N,K = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
g = gcd(A[0],A[1])
for i in range(2,N):
    g = gcd(g,A[i])
if K <= max(A) and K%g==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000000)
N,K = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
if N ==1:
    g = A[0]
else:
    g = gcd(A[0],A[1])
    if N > 2:
        for i in range(2,N):
            g = gcd(g,A[i])
if K <= max(A) and K%g==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    a,b = list(map(int, input().split()))
    if a * b == 0 or (a < 0 && b > 0):
        return 'Zero'
    if b < 0 and (a+b) % 2 == 0
        return 'Negative'
    return 'Positive'

print(f())


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    a,b = list(map(int, input().split()))
    if a * b == 0 or (a < 0 and b > 0):
        return 'Zero'
    if b < 0 and (a+b) % 2 == 0:
        return 'Negative'
    return 'Positive'

print(f())
n,k=map(int, input().split())
l = list(map(int, input().split()))
l.sort(reversed=True)
print(sum(l[:k]))

### FIXED CODE ###

n,k=map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(sum(l[:k]))
def main():
    n = [int(i) for i in input().split()]
    bridge = [0 for i in range(n[0]-1)]
    reqs = [[int(j) for j in input().split()] for i in range(n[1])]
    reqs.sort(key=lambda x:(x[1]-x[0]))

    for req in reqs:
        if 1 not in bridge[req[0]-1:req[1]-1]:
            bridge[req[1] - 2] = 1
    print(bridge.count(1))

main()

### FIXED CODE ###

def main():
    cost_list = input().split()
    for i in range(len(cost_list)):
        cost_list[i] = int(cost_list[i])
    cost_list.sort()
    counter = 0
    for i in range(len(cost_list) - 1):
        counter += cost_list[i+1] - cost_list[i]
    print(counter)

main()
a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d 'Left' if a+b>c+d else 'Right')

### FIXED CODE ###

a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d else 'Left' if a+b>c+d else 'Right')
a, b, c, d = input().split(" ")
return abs(a - c) >= d || (abs(a - b) >= d && abs(b - c) >= d)

### FIXED CODE ###

a, b, c, d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")
N, A,B = map(int, input().split())

if A==0 and B==0:
    print('0')

else:

    list_ab = []
    list_b = ['b']*A
    list_ab+=(list_b)
    list_a = ['a']*B
    list_ab+=list_a

    count = (N//(A+B))+1
    str = list_ab*count

    str = str[:N]
    print(str)
    print(str.count('b'))


### FIXED CODE ###

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

count = N//(A+B)
if (N-count*(A+B))>A:
    print(count*A+A)
else:
    print(count*A+(N-count*(A+B)))
Not found

### FIXED CODE ###

a1,a2,a3=sorted(map(int,input().split()))
print(a3-a1)
a,b,c=map(int,input().split())
k=int(input())
print(sum(a,b,c)-max(a,b,c)+max(a,b,c)**k)

### FIXED CODE ###

A=list(map(int,input().split()))
k=int(input())
print(sum(A)-max(A)+max(A)*(2**k))
N,M = map(int,input().split())
score = list(map(int,input().split()))
score = sorted(score,reverse=True)
if score[M]*4*M < sum(score):
    print("No")
else:
    print("Yes")


### FIXED CODE ###

N,M = map(int,input().split())
score = list(map(int,input().split()))
score = sorted(score,reverse=True)
if score[M-1]*4*M < sum(score):
    print("No")
else:
    print("Yes")
n = int(input())
s = input()
import itertools
state = itertools.product(list(range(10)),repeat = 3)
#print(list(state))
def lucky_pin(i):
    spot = -1
    for j in i:
        
        if str(j) in s[spot +1 : ]:
            spot = s[spot +1 : ].find(str(j)) +spot +1
            
        else:
            return 0
    return 1
print(lucky_pin(i))        
counter = 0
for i in state:
    if 1 ==  lucky_pin(i):
        
        counter +=1
print(counter)


### FIXED CODE ###

n = int(input())
s = input()
import itertools
state = itertools.product(list(range(10)),repeat = 3)
#print(list(state))
def lucky_pin(i):
    spot = -1
    for j in i:
        
        if str(j) in s[spot +1 : ]:
            spot = s[spot +1 : ].find(str(j)) +spot +1
            
        else:
            return 0
    return 1
      
counter = 0
for i in state:
    counter += lucky_pin(i)
        
print(counter)
N=input();print(N*(N%2+1))

### FIXED CODE ###

N = int(input())
if N%2==0:
    print(N)
else:
    print(N*2)
N = int(input())
A = list(map(int, input().split()))
def solve(N,A):
    liss = []
    lis = []
    lis.append(A[0])
    a = A[0]
    for i in range(1,N):
        if len(lis)==1 or prev==0:
            if A[i]>a:
                prev = 1
            elif A[i]<a:
                prev = -1
            else:
                prev = 0
        elif ((A[i]-a)*prev<0:
            liss.append(lis)
            lis = []
        lis.append(A[i])
        a = A[i]
    liss.append(lis)
    ans = len(liss)
    return ans
print(solve(N,A))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
def solve(N,A):
    liss = []
    lis = []
    lis.append(A[0])
    a = A[0]
    for i in range(1,N):
        if len(lis)==1 or prev==0:
            if A[i]>a:
                prev = 1
            elif A[i]<a:
                prev = -1
            else:
                prev = 0
        elif ((A[i]>a)+(A[i]>=a)-1)*prev<0:
            liss.append(lis)
            lis = []
        lis.append(A[i])
        a = A[i]
    liss.append(lis)
    ans = len(liss)
    return ans
print(solve(N,A))
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>10000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
N=int(input())
A=list(map(int,input().split()))
if 0 in A: print(0)
else:
    A.sort()
    ans=A.pop(-1)
    for i in range(N-1):
        ans=ans*A[N-(i+2)]
        if ans > (10**18): break
        if ans == 0: break
print(ans if ans<=10**18 else -1)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=A.pop(-1)
if 0 in A:
    print(0)
else:
    for i in range(N-1):
        ans=ans*A[N-(i+2)]
        if ans > (10**18): break
        if ans == 0: break
    print(ans if ans<=10**18 else -1)
N = input()
a = []
s = ""
for i in range(N):
    b = raw_input()
    a.append(b)
a.sort()
for i in range(N):
    s += a[i] 
print s 

### FIXED CODE ###

N,L = map(int, raw_input().split())
a = []
s = ""
for i in range(N):
    b = raw_input()
    a.append(b)
a.sort()
for i in range(N):
    s += a[i] 
print s
import math
A,B,N=map(int,input().split())
x=min(B-1,N)
ans=math.ceil(A*x/B)-A*math.ceil(x/B)
print(int(ans))



### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    break
  if i==B:
    print("NG")