Harryxun/stf_run huggingface dataset:
while True:
    num = [int(i) for i in input().split(" ")]
    H = num[0]
    W = [1]
    if W == H == 0:
        break
    print("#" * W, end = "\n")
    print( ( ("#" + "." * (W - 2) + "#" ) + "\n") * (H -2) )
    print("#" * W)

### FIXED CODE ###

while True:
    H, W = [int(x) for x in input().split(" ")]
    if H == W == 0:
        break
    for i in range(H):
        if i == 0 or i == (H - 1):
            print("#" * W)
        else:
            print("#" + "." * (W - 2) + "#")
    print("")
s = input()
n = int(input())
for _ in range(n):
    line = input().split()
    command, args = line[0], line[1:]
    if command == 'replace':
        s = s[:args[0]] + args[2] + s[args[1]:]
    elif command == 'reverse':
        s = s[:args[0]] + str(reversed(s[args[0]:args[1]])) + s[args[1]:]
    elif command == 'print':
        print(s)

### FIXED CODE ###

s = input()
q = int(input())
for i in range(q):
    line = input()
    if 'print' in line:
        op, a, b = line.split()
        a = int(a)
        b = int(b)
        print(s[a:b+1])
    elif 'reverse' in line:
        op, a, b = line.split()
        a = int(a)
        b = int(b)
        reversed_substring = ''.join(list(reversed(s[a:b+1])))
        s = s[:a] + reversed_substring + s[b+1:]
    elif 'replace' in line:
        op, a, b, p = line.split()
        a = int(a)
        b = int(b)
        s = s[:a] + p + s[b+1:]
# -*- coding: utf-8 -*-
N = int(input())
W_list = list(map(int, input().split()))

lr_sum = 0
pop_position = 1
for _ in range(N)
    if lr_sum <= 0:
        lr_sum += W_list[pop_position]
    else:
        lr_sum -= W_list[-pop_position]
print(lr_sum)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
W_list = list(map(int, input().split()))

lr_sum = 0
for _ in range(N):
    if lr_sum <= 0:
        lr_sum += W_list.pop(0)
    else:
        lr_sum -= W_list.pop(-1)
print(abs(lr_sum))
print(' '.join(map(str, sorted(map(int, input())))))

### FIXED CODE ###

print(' '.join(map(str, sorted(map(int, input().split()), reverse=True))))
n,x = (int(x) for x in input().split())
l=list(map(int,input().split()))
k=0
d=0

while d<=x:
   if len(l)<=k:
    break
   else:
    d=d+l[k]
    k=k+1
if d<x:
  print(k+1)
else:print(k)

### FIXED CODE ###

a,b = (int(x) for x in input().split())
if a < b:
  print(0)
else: print(10)
S = input()
count = 0
res = []
for i in range(len(S)):
    if S[i] in ["A", "C", "G", "T"]:
        count += 1
    else:
        res.append(count)
        count = 0

print(max(res))

### FIXED CODE ###

s = input()
ans=0
now=0
for a in s:
    if a in ["A", "C", "G", "T"]:
        now+=1
    else:
        now=0
    ans=max(ans,now)
print(ans)
a = input().split()
if(a[0] * a[1] % 2 == 0):
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a = input().split()
if(int(a[0]) * int(a[1]) % 2 == 0):
  print('Even')
else:
  print('Odd')
import fractions
n,m=map(int,input().split())
s=list(str(input()))
t=list(str(input()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

l=lcm(n, m)
index=fractions.gcd(n,m)
#print(indexn,indexm)
for i in range(index):
    #print(i)
    if s[n//index*i]!=t[m//index*i]:
        print(-1)
        break
else:
    print(l)

### FIXED CODE ###

import fractions
n,m=map(int,input().split())
s=list(str(input()))
t=list(str(input()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l=lcm(n, m)
index=fractions.gcd(n,m)
#print(indexn,indexm)
for i in range(index):
    #print(i)
    if s[n//index*i]!=t[m//index*i]:
        print(-1)
        break
else:
    print(l)
a, b = map(int, input().split())
l = []
for _ in range(a):
  x, y = map(int, input().split())
  if y <= b:
    l.append(x)
print(min(l))

### FIXED CODE ###

a, b = map(int, input().split())
l = []
for _ in range(a):
  x, y = map(int, input().split())
  if y <= b:
    l.append(x)
if l == []:
  print('TLE')
else:
  print(min(l))
r=input()
g=input()
a=2*g-r
print(a)

### FIXED CODE ###

r=int(input())
g=int(input())
a=2*g-r
print(a)
#!/usr/bin/env python3

#import numpy as np
#import scipy, scipy.special

# Python 3 modules: https://docs.python.org/3/library/

import sys
import math, itertools, operator
from math import *
from math import factorial as fact
from itertools import permutations, combinations
from functools import reduce
# Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
# Before Python 3.5
from fractions import gcd

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################

sys.setrecursionlimit(20000)

N, M = input_ints()

# D[i][j]: Card i has a rel. with card j
D = [[] for i in range(N)]
for i in range(M):
    x, y, z = input_ints()
    x -= 1
    y -= 1
    D[x].append(y)
    D[y].append(x)

visited = [False for i in range(N)]
def dfs(n):
    for idx in D[n]:
        if not visited[idx]:
            visited[idx] = True
            dfs(idx)

cnt = 0
for n in range(N):
    if not visited[n]:
        visited[n] = True
        dfs(n)
        cnt += 1
print(cnt)


### FIXED CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(1000000)

N, M = [int(x) for x in input().split()]

# D[i][j]: Card i has a rel. with card j
D = [[] for i in range(N)]
for i in range(M):
    x, y, z = [int(x) for x in input().split()]
    x -= 1
    y -= 1
    D[x].append(y)
    D[y].append(x)

visited = [False for i in range(N)]
def dfs(n):
    for idx in D[n]:
        if not visited[idx]:
            visited[idx] = True
            dfs(idx)

cnt = 0
for n in range(N):
    if not visited[n]:
        visited[n] = True
        dfs(n)
        cnt += 1
print(cnt)
import numpy as np
n,k=map(int,input().split())
h=list(map(int,input().split()))

# dp=[int(10e8)]*n
dp[0]=0
for i in range(1,n):
    for j in range(min(i,k)):
        dp[i]=min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))

print(dp[n-1])


### FIXED CODE ###

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

dp=[int(10e8)]*n
dp[0]=0
for i in range(1,n):
    for j in range(min(i,k)):
        dp[i]=min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))

print(dp[n-1])
a, b, k = map(int, input().split())
l = list(range(a, b+1))
print(*(l[:k] + l[-k if k < len(l)/2 else - (len(l) - k):]), sep='\n')

### FIXED CODE ###

a, b, k = map(int, input().split())
l = range(a, b+1)
for i in sorted(set(l[-k:]) | set(l[:k])):
    print(i)
S = input()

for i in range(97,26+97):
    if chr(i) not in s:
        print(chr(i))
        exit(0)
else:
    print('None')

### FIXED CODE ###

S = input()

for i in range(97,26+97):
    if chr(i) not in S:
        print(chr(i))
        exit(0)
else:
    print('None')
mod=10**9+7
MAX=10**5

g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
    num_1=g1[-1]*i%mod
    g1.append(num_1)
    g2.append(pow(num_1,mod-2,mod))
    
def cmb(n,r,MOD):
    return g1[n]*g2[r]*g2[n-r]%MOD

n=int(input())
a=list(map(int,input().split()))
data=[0]*(n+1)
for i in range(n+1):
    data[a[i]]+=1
for i in range(1,n+1):
    if data[i]==2:
        b=i
        break
l=[]
for i in range(n+1):
    if a[i]==b:
        l.append(i)
c=l[1]-l[0]+1
for k in range(1,n+3-c):
    ans=cmb(n+1,k,mod)-cmb(n+1-c,k-1,mod)
    print(ans%mod)
for k in range(n+3-c,n+2):
    ans=cmb(n+1,k,mod)
    print(ans)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n=int(input())
a=list(map(int,input().split()))
data=[0]*(n+1)
for i in range(n+1):
    data[a[i]]+=1
for i in range(1,n+1):
    if data[i]==2:
        b=i
        break
l=[]
for i in range(n+1):
    if a[i]==b:
        l.append(i)
c=l[1]-l[0]+1
for k in range(1,n+3-c):
    ans=cmb(n+1,k,mod)-cmb(n+1-c,k-1,mod)
    print(ans%mod)
for k in range(n+3-c,n+2):
    ans=cmb(n+1,k,mod)
    print(ans)
import math
(n, m) = map(int, input().split())
sm = int(math.sqrt(m)) + 1
params = {}
for i in range(1, sm + 1):
    if m % i == 0 :
        params[i] = 1
        params[m // i] = 1
params = sorted(params)
ans = 0
for param in params:
    if n > m / iparam:
        break
    ans = param
print(ans)

### FIXED CODE ###

import math
(n, m) = map(int, input().split())
sm = int(math.sqrt(m)) + 1
params = {m:1}
for i in range(1, sm + 1):
    if m % i == 0 :
        params[i] = 1
        params[m // i] = 1
params = sorted(params)
mdn = m // n
maxans = 0
for i in params:
    if n > m / i:
        break
    maxans = i
print(maxans)
from collections import deque, defaultdict
N, M = map(int, input().split())
graph = [[] for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    graph[a].append(b)
    graph[b].append(a)


visited = [False for _ in range(N)]
color = [0 for _ in range(N)]

def dfs(now, c):

    color[now] = c

    for adj in graph[now]:
        if color[adj] == c:
            return False

        if color[adj] == 0 and not dfs(adj, -c):
            return False

    return True

ans = dfs(0, 1)
white = color.count(-1)
black = N - white
if ans:
    print(black * white - M)
else:
    print(N * (N+1)//2 - M)


### FIXED CODE ###

from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10**8)
N, M = map(int, input().split())
graph = [[] for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    graph[a].append(b)
    graph[b].append(a)


visited = [False for _ in range(N)]
color = [0 for _ in range(N)]

def dfs(now, c):

    color[now] = c

    for adj in graph[now]:
        if color[adj] == c:
            return False

        if color[adj] == 0 and not dfs(adj, -c):
            return False

    return True

ans = dfs(0, 1)
white = color.count(-1)
black = N - white
if ans:
    print(black * white - M)
else:
    print(N * (N-1)//2 - M)
s = list(input())
if(len(s) > 9):
  print("NO")
  exit()

ans = "AKIHABARA"
i = 0

while(i < len(ans) and len(s) <= len(ans)):
  if("".join(s) == ans):
    print("YES")
    exit()
  
  if(i == len(ans) - 1 or s[i] != ans[i]):
    s.insert(i, "A")
  else:
    i += 1

print("NO")

### FIXED CODE ###

import re
print("YES" if re.match("^A?KIHA?BA?RA?$", input()) else "NO")
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


nnk = list(map(lambda x: int(x), input().split(" ")))
n = nnk[0]
k = nnk[1]

hs = [int(input()) for l in range(n)]
hs.sort()

num = n - k + 1

hmmm = []
for l in range(num):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-


d = input()

if d == "22":
    print("Christmas Eve Eve Eve")
elif d == "23":
    print("Christmas Eve Eve")
elif d == "24":
    print("Christmas Eve")
elif d == "25":
    print("Christmas")
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [[0 for _ in range(n)] for _ in range(n-k)]

dp[0] = [] + h

for x in range(1, n-k):
    for y in range(n):
        temp = float('inf')
        for i in range(y):
            temp = min(temp, dp[x-1][i] + max(0, h[y] - h[i]))
        dp[x][y] = temp

#for x in dp: print(x)

print(min(dp[n-k-1]))

### FIXED CODE ###

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

if k == n:
    print(0)
    exit()

dp = [[0 for _ in range(n)] for _ in range(n-k)]

dp[0] = [] + h

for x in range(1, n-k):
    for y in range(n):
        temp = float('inf')
        for i in range(y):
            temp = min(temp, dp[x-1][i] + max(0, h[y] - h[i]))
        dp[x][y] = temp

#for x in dp: print(x)

print(min(dp[n-k-1]))
n=int(input())
l=list(map(int,imput().split()))
lmax=max(l)
if lmax<sum(l)-lmax:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
lmax=max(l)
if lmax<sum(l)-lmax:
	print('Yes')
else:
	print('No')
S = input()
T = input()

if len(T)>len(S):
    ans = "UNRESTORABLE"
else:
    Slr = list(S[::-1])
    Tlr = list(T[::-1])
    
    for i in range(len(S)-len(T)+1):
        flag = True
        for j in range(len(T)):
            if Slr[i+j]==Tlr[j] or Slr[i+j]=="?":
                pass
            else:
                flag = False
                break
        if flag:
            for j in range(len(T)):
                Slr[i+j] = Tlr[j]
            for j in range(len(S)):
                if Slr[i+j]=="?":
                    Slr[i+j] = "a"
            ans = ("".join(Slr[::-1]))
            break
        else:
            if i==len(S)-len(T):
                ans = "UNRESTORABLE"
print(ans)





### FIXED CODE ###


S = input()
T = input()

if len(T)>len(S):
    ans = "UNRESTORABLE"
else:
    Slr = list(S[::-1])
    Tlr = list(T[::-1])
    for i in range(len(S)-len(T)+1):
        flag = True
        for j in range(len(T)):
            if Slr[i+j]==Tlr[j] or Slr[i+j]=="?":
                pass
            else:
                flag = False
                break
        if flag:
            for j in range(len(T)):
                Slr[i+j] = Tlr[j]
            for j in range(len(S)):
                if Slr[j]=="?":
                    Slr[j] = "a"
            ans = ("".join(Slr[::-1]))
            break
        else:
            if i==len(S)-len(T):
                ans = "UNRESTORABLE"
print(ans)
N,A=map(int,input().split())
x=sorted(list(map(int,input().split())))

xn=[x[i]-A for i in range(len(x)) if x[i]<A]
xn.reverse()
x0=[0 for i in range(len(xn),len(x)) if x[i]==A]
xp=[x[i]-A for i in range(len(xn)+len(x0),len(x)) if x[i]>A]

sxn=[0]
sxn_n=[1]
for x in xn:
  sxn_add=[]
  sxn_n_i=[]
  for j in range(len(sxn)):
    sxn_tmp=sxn[j]+x
    for k in range(j,len(sxn)):
      if sxn[k]<=sxn_tmp or k==len(sxn)-1:
        if sxn[k]==sxn_tmp:
          sxn_n_i.append([k,sxn_n[j]])
        elif sxn[k]<sxn_tmp:
          sxn_add.append([k,sxn_tmp,sxn_n[j]])
        else:
          sxn_add.append([k+1,sxn_tmp,sxn_n[j]])
        break
  for k in range(len(sxn_add)):
    sxn.insert(k+sxn_add[k][0],sxn_add[k][1])
    sxn_n.insert(k+sxn_add[k][0],1)
  for l in sxn_n_i:
    sxp_n[l[0]]+=l[1]    

sxp=[0]
sxp_n=[1]
for x in xp:
  sxp_add=[]
  sxp_n_i=[]
  for j in range(len(sxp)):

    sxp_tmp=sxp[j]+x

    for k in range(j,len(sxp)):
      if sxp[k]>=sxp_tmp or k==len(sxp)-1:

        if sxp[k]==sxp_tmp:
          sxp_n_i.append([k,sxp_n[j]])
        elif sxp[k]>sxp_tmp:
          sxp_add.append([k,sxp_tmp,sxp_n[j]])
        else:
          sxp_add.append([k+1,sxp_tmp,sxp_n[j]])
        break

  for k in range(len(sxp_add)):
    sxp.insert(k+sxp_add[k][0],sxp_add[k][1])
    sxp_n.insert(k+sxp_add[k][0],sxp_add[k][2])
  for l in sxp_n_i:
    sxp_n[l[0]]+=l[1]



an=0
for i in range(1,len(sxp)):
  for j in range(1,len(sxn)):

    if sxp[i]==-sxn[j]:
      an+=sxp_n[i]*sxn_n[j]
      break


print(2**len(x0)-1+an*2**(len(x0)))

### FIXED CODE ###

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

xn=[x[i]-A for i in range(len(x)) if x[i]<A]
xn.reverse()
x0=[0 for i in range(len(xn),len(x)) if x[i]==A]
xp=[x[i]-A for i in range(len(xn)+len(x0),len(x)) if x[i]>A]

sxn=[0]
sxn_n=[1]
for x in xn:
  sxn_add=[]
  sxn_n_i=[]
  for j in range(len(sxn)):
    sxn_tmp=sxn[j]+x
    for k in range(len(sxn)):
      if sxn[k]==sxn_tmp or k==len(sxn)-1:
        if sxn[k]==sxn_tmp:
          sxn_n_i.append([k,sxn_n[j]])
        else:
          sxn_add.append([sxn_tmp,sxn_n[j]])
        break
  for l in sxn_n_i:
    sxn_n[l[0]]+=l[1]  
  for k in sxn_add:
    sxn.append(k[0])
    sxn_n.append(k[1])
  

sxp=[0]
sxp_n=[1]
for x in xp:
  sxp_add=[]
  sxp_n_i=[]
  for j in range(len(sxp)):

    sxp_tmp=sxp[j]+x

    for k in range(j,len(sxp)):
      if sxp[k]==sxp_tmp or k==len(sxp)-1:

        if sxp[k]==sxp_tmp:
          sxp_n_i.append([k,sxp_n[j]])
        else:
          sxp_add.append([sxp_tmp,sxp_n[j]])
        break
  for l in sxp_n_i:
    sxp_n[l[0]]+=l[1]
  for k in sxp_add:
    sxp.append(k[0])
    sxp_n.append(k[1])




an=0
for i in range(1,len(sxp)):
  for j in range(1,len(sxn)):

    if sxp[i]==-sxn[j]:
      an+=sxp_n[i]*sxn_n[j]
      break


print(2**len(x0)-1+an*2**(len(x0)))
global cnt
cnt=0

def merge(A,left,mid,right):
    global cnt
    n1=mid-left
    n2=right-mid
    #L=[0 for i in range(n1+1)]
    #R=[0 for i in range(n2+1)]
    L=[]
    R=[]
    for i in range(n1):
        L.append(A[left+i])
    for i in range(n2):
        R.append(A[mid+j])
    L.append(float("inf"))
    R.append(float("inf"))
    i=0
    j=0
    for k in range(left,right):
        if L[i]<=R[j]:
            A[k]=L[i]
            i=i+1
            cnt+=1
        else:
            A[k]=R[j]
            j=j+1
            cnt+=1

def mergeSort(A,left,right):
    if left+1<right:
        mid=(int)((left+right)/2)
        mergeSort(A,left,mid)
        mergeSort(A,mid,right)
        merge(A,left,mid,right)

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


mergeSort(S,0,n)
print(*S)
print(cnt)




### FIXED CODE ###

global cnt
cnt=0

def merge(A,left,mid,right):
    L=A[left:mid]
    R=A[mid:right]
    L.append(float("inf"))
    R.append(float("inf"))
    
    i=0
    j=0
    for k in range(left,right):
        global cnt
        cnt+=1
        if L[i]<=R[j]:
            A[k]=L[i]
            i=i+1
        else:
            A[k]=R[j]
            j=j+1

def mergeSort(A,left,right):
    if left+1<right:
        mid=(int)((left+right)/2)
        mergeSort(A,left,mid)
        mergeSort(A,mid,right)
        merge(A,left,mid,right)

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

mergeSort(S,0,n)
print(*S)
print(cnt)
H,W = map(int, input().split())
A = [input() for _ in range(H)]
HMANY = [ [10**9] * W for _ in range(H)]


def dfs(h,w,A,HMANY, num):
    if HMANY[h][w] > num:
        HMANY[h][w] = num        
        if 0 <= h - 1 :
            dfs(h-1,w,A,HMANY,num+1 )
        if h+1 < H:
            dfs(h+1,w,A,HMANY,num+1 )
        if w+1 < W:
            dfs(h,w+1,A,HMANY,num+1 )
        if 0<=w-1:
            dfs(h,w-1,A,HMANY,num+1 )

for h in range(H):
    for w in range(W):
        # if HMANY[h][w] == 10**9:
            if A[h][w] == "#":
                dfs(h,w, A,HMANY, 0)

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans, HMANY[h][w])
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
from collections import deque
from heapq import heappush, heappop
def solve():
    H,W = map(int, input().split())
    A = [ list(input()) for _ in range(H)]
    HMANY = [ [10**9] * W for _ in range(H)]

    
    
    # q = deque()
    for h in range(H):
        for w in range(W):
            if A[h][w] == "#" :
                HMANY[h][w] = 0
    for w in range(W):
        for h in range(H-1):
            if HMANY[h][w]+1 < HMANY[h+1][w]:
                HMANY[h+1][w] = HMANY[h][w] + 1
        for h in range(H-1, 0, -1):
            if HMANY[h][w]+1 < HMANY[h-1][w]:
                HMANY[h-1][w] = HMANY[h][w] + 1
    
    for h in range(H):
        for w in range(W-1):
            if HMANY[h][w]+1 < HMANY[h][w+1]:
                HMANY[h][w+1] = HMANY[h][w] + 1
        for w in range(W-1, 0, -1):
            if HMANY[h][w]+1 < HMANY[h][w-1]:
                HMANY[h][w-1] = HMANY[h][w] + 1        
    #             q.append((h,w))
    #             A[h][w] = "."
    # ans = 0
    # while q:
    #     nextQ = deque()
    #     for h,w in q:
    #         A[h][w] = "#"
    #         if h+1 <H and A[h+1][w] == ".":
    #             nextQ.append( (h+1,w))
    #         if w+1 <W and A[h][w+1] == ".":
    #             nextQ.append((h,w+1))
    #         if 0<=h-1 and A[h-1][w] == ".":
    #             nextQ.append((h-1,w))
    #         if 0<=w-1 and A[h][w-1] == ".":
    #             nextQ.append((h,w-1))        
    #     ans += 1
    #     q = nextQ
        # num,h,w = q.popleft()        
        # if HMANY[h][w] > num and A[h][w] == ".":
        #     HMANY[h][w] = num
        #     A[h][w] = "#"
        #     if h+1 <H and A[h+1][w] == ".":
        #         q.append( (num+1,h+1,w))
        #     if w+1 <W and A[h][w+1] == ".":
        #         q.append((num+1,h,w+1))
        #     if 0<=h-1 and A[h-1][w] == ".":
        #         q.append((num+1,h-1,w))
        #     if 0<=w-1 and A[h][w-1] == ".":
        #         q.append((num+1,h,w-1))

    ans = 0
    for h in range(H):
        ans = max(ans, max(HMANY[h]))
    # print(ans-1)
    print(ans)

if __name__ == "__main__":
    solve()
import numpy as np
MOD = int(1e9 + 7)
N = int(1e5)
M = 13

s = input()
dp = np.zeros(N,M)
dp[0,0] = 1
m = list(range(M))
t = list(range(10))

for i in range(len(s)):
    for j in m:
        for k in t:
            if s[i] == "?" or s[i] == str(k):
                dp[i+1,(j*10 +k) % M] += dp[i,j]
                dp[i+1,(j*10 +k) % M] %= MOD


print(dp[len(s),5])


### FIXED CODE ###

MOD = int(1e9 + 7)
N = int(1e5)
M = 13

s = input()
dp = [[0 for x in range(M)] for x in range(N+10)]
dp[0][0] = 1

for i in range(len(s)):
    for j in range(M):
        for k in range(10):
            if s[i] == "?" or s[i] == str(k):
                dp[i+1][(j*10 +k) % M] += dp[i][j]
                dp[i+1][(j*10 +k) % M] %= MOD


print(dp[len(s)][5])
x=int,input()

for v in range(x):
 for i in range(100000):
  print(case i : v)

### FIXED CODE ###

i = 1

while True:

 x=int(input())
 if x==0:
  break
 print("Case {0}: {1}".format(i,x))
 i+=1
a=int(input())
b=int(input())
print(a*b (a+b)*2)


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,(a+b)*2)
import sys
def N(n):
    return (n+1)*(n+2)*(n+3)/6
for n in sys.stdin:
        n = int(raw_input())
        if n > 2000:
            n = 4000 - n
        if n < 1001:
            print N(n)
        else:
            m = n - 1000
            print N(n) - (N(2*m) - m - 1)/2

### FIXED CODE ###

import sys
def N(n):
    return (n+1)*(n+2)*(n+3)/6
for n in sys.stdin:
    n = int(n)
    if n > 2000:
        n = 4000 - n
    if n < 1001:
        print N(n)
    else:
        m = n - 1000
        print N(n) - (N(2*m) - m - 1)/2
N, K = [int(i) for i in input().split(' ')]

min1 = 0
prev = 0

while True:
  if prev < abs(N - K):
    break
  else:
    min1 = abs(N - K)
	N = abs(N - K)
	prev = min1


print(prev)
		

### FIXED CODE ###

N, K = [int(i) for i in input().split(' ')]

def res():
  if N == K:
    return 0
  elif N > K:
    return N % K if K - (N % K) > (N % K) else K - (N % K)
  else :
    return abs(N - K) if abs(N - K) < abs(abs(N-K) - K) else abs(abs(N-K) - K)

print(res())
n = int(input())
a = map(int, input().split())
print(max(a) - min(a))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))
a = input()
b = input()

count = 0
for i in range(0, len(a)):
    if a[i] != b[i];
        count+=1
      
print(count)

### FIXED CODE ###

a = input()
b = input()
 
count = 0
for i in range(0, len(a)):
    if a[i] != b[i]:
        count+=1
      
print(count)
K = int(input())
A, B = map(int, input().split())

c = A / K
b = c * K
flag = False

if b == B:
  flag = True
while b <= B:
  b += K
  elif b <= B:
    flag = True

if flag == True:
  print("OK")
else:
  print("NG")


### FIXED CODE ###

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

flag = False

if a <= int(b / k) * k:
  print("OK")
else:
  print("NG")