Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

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

ct=0
for i in range(N):
	if min(P[:i+1])==P[i]:
		ct+=1


print(ct)

### FIXED CODE ###

import numpy as np
N=int(input())
P=list(map(int,input().split()))

ct=0
min_p=P[0]
for i in range(N):
	if P[i]<=min_p:
		min_p=P[i]
		ct+=1


print(ct)
### BUGGY CODE ###

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

dp = [0] * n

for i in range(len(h)-1):
  cnt = 0
  for j in range(i,len(h)-1):
    if h[j] < h[j+1]:
      dp[i] = cnt
      break
    cnt += 1
    dp[i] = cnt

print(max(dp))

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
cnt = 0
ans = 0
for i in reversed(range(1,len(h))):
  if h[i-1] >= h[i] :
    cnt +=1
  else:
    ans = max(ans,cnt)
    cnt = 0
  if i == 1 :
    ans = max(ans,cnt)
  
print(ans)
### BUGGY CODE ###

N=int(input())
S=list(map(int,input().split()))
if S[0]==0:
  print(0)
else:
  X=S[0]
for i in range(1,N):
  if S[i]==0:
    X=0
    print(0)
    break
  else:
    X=X*S[i]
    #print(X)   
if 0<X<=10**18:
  print(X)
else:
  if X!=0:
    print(-1)

### FIXED CODE ###

N=int(input())
S=list(map(int,input().split()))
if S[0]==0:
  print(0)
else:
  X=S[0]
for i in range(1,N):
  if S[i]==0:
    X=0
    print(0)
    break
  else:
    if X>10**18:
      continue
    else:
      X=X*S[i]
if 0<X<=10**18:
  print(X)
else:
  if X!=0:
    print(-1)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

if k > q:
    for i in range(n):
        print('Yes')
elif k == q:
    for j in range(1, n+1):
        if j in a:
            print('Yes')
        else:
            print('No')
else:
    border = q - k
    for h in range(1, n+1):
        if a.count(h) > border:
            print('Yes')
        else:
            print('No')


### FIXED CODE ###

# -*- coding: utf-8 -*-
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

if k > q:
    for i in range(n):
        print('Yes')
else:
    ans = [k-q] * n
    for j in a:
        ans[j-1] += 1
    for h in range(n):
        if ans[h] <= 0:
            print('No')
        else:
            print('Yes')
### BUGGY CODE ###

import itertools
n, k = map(int, input().split())
s = input()
temp = ""
ans = []
c = 0
for s_ in s:
    if temp != s_:
        if s_ == "0":
            ans.append(c)
            temp = "0"
            c = -1
        else:
            ans.append(c)
            temp = "1"
            c = 1
    else:
        if s_ == "0":
            c -= 1
        else:
            c += 1
ans.append(c)
ans = ans[1:]
c = []
t = [i for i in range(len(ans)) if ans[i] < 0]
aaa = []
for v in itertools.combinations(t, k):
    anst = ans.copy()
    for v_ in v:
        anst[v_] *= -1
    c_ = 0
    for s_ in anst:
        if s_ > 0:
            c_ += s_
        else:
            aaa.append(c_)
            c_ = 0
    aaa.append(c_)
if len(aaa) > 0:
    print(max(aaa))
else:
    print(len(s))

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
hand_list = []
for i in range(n):
    if i == 0:
        hand_list.append(i)
    else:
        if s[i] != s[i - 1]:
            hand_list.append(i)
hand_list.append(n)

ans_list = []
if len(hand_list) > 2 * k:
    for i in range(len(hand_list) - 2 * k):
        if s[hand_list[i]] == '1':
            ans = hand_list[min(i + 2 * k + 1, len(hand_list)-1)] - hand_list[i]
        else:
            ans = hand_list[i + 2 * k] - hand_list[i]
        ans_list.append(ans)
else:
    ans_list.append(n)
print(max(ans_list))
### BUGGY CODE ###

from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)
MOD = 10**9 + 7

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    S = list(input()[::-1][1:])
    L = len(S)
    modsum = 0
    # はじめ長さ、つぎは余り
    memo = [[ 0 for __ in range(13)] for _ in range(L)]

    # 0だけ別に
    if S[0].isnumeric():
        memo[0][int(S[0])%13] = 1
    else:
        for n in range(10):
            memo[0][n] = 1

    for i in range(1, L):
        # 数字なら以前までの余りにたす
        if S[i].isnumeric():
            mod = (int(S[i])*pow(10,i))%13
            for m in range(13):
                # 0でない余りを次に持ち越し
                if memo[max(0,i-1)][m] > 0:
                    memo[i][(m+mod)%13] = memo[max(0,i-1)][m]
        # ?なら1~10の余りのケース全てインクリメント
        else:
            for n in range(10):
                mod = (n*pow(10,i))%13
                for m in range(13):
                    # その前の数があるなら足す
                    if memo[max(0,i-1)][m] > 0:
                        cur = (m+mod)%13
                        memo[i][cur] += memo[max(0,i-1)][m]
                        memo[i][cur] %= MOD
    print(memo[L-1][5])
    # print(memo)








if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import exit, stderr, stdin
input = stdin.readline


def main():
    MOD = 10**9 + 7
    S = input()[:-1]
    L = len(S)
    # 余り
    memo = [0 for _ in range(13)]
    memo[0] = 1

    for i in range(L):
        memo_prev = [x for x in memo]
        memo = [0 for _ in range(13)]
        # 数字なら以前までの余りにたす
        if S[i].isnumeric():
            n = int(S[i])
            for m in range(13):
                cur = (10*m+n)%13
                memo[cur] += memo_prev[m]
        # ?なら1~10の余りのケース全てをためす
        else:
            for n in range(10):
                for m in range(13):
                    cur = (10*m+n)%13
                    memo[cur] += memo_prev[m]
            for m in range(13):
                memo[m] %= MOD
    print(memo[5])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

from heapq import heapify, heappop, heappush
import sys

input = sys.stdin.readline

n, m = map(int, input().split())
A = list(map(int, input().split()))
heapify(A)

for _ in range(m):
    b, c = map(int, input().split())
    for _ in range(b):
        min_num = heappop(A)
        if min_num < c:
            heappush(A, c)
        else:
            heappush(A, min_num)
            break

total = sum(A)
print(total)


### FIXED CODE ###

from heapq import heapify, heappop, heappush
import sys

input = sys.stdin.readline

n, m = map(int, input().split())
A = list(map(int, input().split()))
heapify(A)

BC = [tuple(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: x[1], reverse=True)

for i in range(m):
    for _ in range(BC[i][0]):
        min_num = heappop(A)
        if min_num < BC[i][1]:
            heappush(A, BC[i][1])
        else:
            heappush(A, min_num)
            break

total = sum(A)
print(total)
### BUGGY CODE ###

from itertools import groupby
def calc():
  s = 0
  for i in range(h):
    gr = groupby(g[i])
    j = 0
    for key,it in gr:
      if key==-1: continue
      l = len(list(it))
      if l >= K:
        g[i][j:j+l] = [-1]*l
        # for k in range(l):
        #   g[i][j+k] = -1
        # # print("s", key, l, key*l)
        s += key*l
      j += l
      # print("j", j)

  return s

def flatten():
  for j in range(w):
    lst = []
    for i in range(h-1, -1, -1):
      if g[i][j] > 0:
        lst.append(g[i][j])

    lst += [-1] * (h - len(lst))

    for i in range(h-1, -1, -1):
      g[i][j] = lst[h-i-1]

h,w,K = map(int,input().split())
mat = [ [int(e) for e in list(input())] for _ in range(h) ]

res = 0
for i in range(h):
  for j in range(w):
    score = 0
    g = [ [ mat[n][m] for m in range(w) ] for n in range(h) ]
    g[i][j] = -1
    time = 0
    flatten()
    while True:
      s = calc()
      if s > 0:
        score += 2**time * s
      else:
        break
      flatten()
      time += 1
    res = max(res, score)

print(res)

### FIXED CODE ###

from itertools import groupby

def calc(time):
  t = 0
  for i in range(h):
    gr = groupby(g[i])
    lst = []
    p = 0
    for key,it in gr:
      j = len(list(it))
      lst.append([p,key,j])
      p += j
    for j in range(len(lst)):
      if lst[j][1] == -1:
        continue
      if lst[j][2] >= K:
        t += (2**time)*lst[j][1]*lst[j][2]
        for k in range(lst[j][0],lst[j][0]+lst[j][2]):
          g[i][k] = 0

  return t

def flatten():
  for j in range(w):
    lst = []
    for i in range(h-1, -1, -1):
      if g[i][j] > 0:
        lst.append(g[i][j])

    lst += [-1] * (h - len(lst))

    for i in range(h-1, -1, -1):
      g[i][j] = lst[h-i-1]

h,w,K = map(int,input().split())
mat = [ [int(e) for e in list(input())] for _ in range(h) ]

res = 0
for i in range(h):
  for j in range(w):
    score = 0
    g = [ [ mat[n][m] for m in range(w) ] for n in range(h) ]
    g[i][j] = -1
    time = 0
    flatten()
    while True:
      s = calc(time)
      if s==0: break
      score += s
      flatten()
      time += 1
    res = max(res, score)

print(res)
### BUGGY CODE ###

import numpy as np
import collections

def main():
    S = str(input())
    n = len(S)

    T = [-1 for i in range(n+1)]
    T[-1] = 0
    for i in range(n):
        #print(S[i:])
        T[i] = int(S[i:]) % 2019
    #print(T)
    C = collections.Counter(T)
    #print(C) # dict 型のサブクラス，Counter
    ans = 0
    for value, count in C.items():
        ans += int(count*(count-1)/2)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
import collections

def main():
    S = str(input())
    n = len(S)

    T = [-1 for i in range(n+1)]
    T[-1] = 0
    # for i in range(n):
    #     #print(S[i:])
    #     T[i] = int(S[i:]) % 2019
    # print(T)
    b = [1 for i in range(n)]
    for i in reversed(range(n-1)):
        b[i] = b[i+1]*10 % 2019
    #print(b)

    # for i in reversed(range(n)):
    #     T[i] = (int(S[i])*10**(n-1 -i) + T[i+1]) % 2019
    # print(T)

    for i in reversed(range(n)):
        T[i] = (b[i]*int(S[i]) + T[i+1]) % 2019
    #print(T)


    C = collections.Counter(T)
    #print(C) # dict 型のサブクラス，Counter
    ans = 0
    for value, count in C.items():
        ans += int(count*(count-1)/2)
    print(ans)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int,input().split())

neighbor = {}
dp = [{} for _ in range(n+1)]
dp_prod = [-1]*(n+1)
for i in range(1,n+1):
    neighbor[i] = []

for i in range(n-1):
    x, y = map(int,input().split())
    dp[x][y] = -1
    dp[y][x] = -1

def calc_dp(x, y):
    if(dp[x][y] != -1):
        return(dp[x][y])

    if(len(dp[y]) == 1):
        dp[x][y] = 2
        return(dp[x][y])

    if((dp_prod[y] != -1) & (dp[y][x] != -1)):
        dp[x][y] = 1 + dp_prod[y]//dp[y][x]
        return(dp[x][y])

    temp = 1
    for i in dp[y].keys():
        if(i == x):
            continue

        temp = temp * (calc_dp(y,i))

    if(dp[y][x] != -1):
        dp_prod[y] = temp * dp[y][x]

    dp[x][y] = temp + 1
    return(dp[x][y])

for i in range(1,n+1):
    ans = 1
    for j in dp[i].keys():
        ans = ans * calc_dp(i,j)
    print(ans % m)

### FIXED CODE ###

n,m = map(int,input().split())
mod = m
# mod = 10**9+7

# 前準備
import sys
input = sys.stdin.readline
from collections import deque

graph = [[] for _ in range(n+1)]
for _ in range(n-1):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

ini = 1

def calc(a,b):
    p = a * b % mod
    return p

# calc1 の定義
def calc1(c,p):
    p_num = ini
    for i in graph[c]:
        if i == p:
            continue
        p_num = calc(p_num, dp1[i])
    p_num += 1
    dp1[c] = p_num % mod

# calc2 の定義
def calc2(p):
    arr = [dp1[c] if c != parent[p] else dp2[p] for c in graph[p]]

    left = [ini]
    for i in arr[:-1]:
        left.append( calc(left[-1], i ) )
    right = [ini]
    for i in arr[:0:-1]:
        right.append( calc(right[-1], i) )
    right = right[::-1]

    prod = []
    for a,b in zip(left,right):
        prod.append(calc(a,b))

    for c,x in zip(graph[p], prod):
        if(c != parent[p]):
            dp2[c] = (x + 1)%mod



# 根から探索して親と探索順を記録
root = 1
order = []
parent = [0] * (n+1)
stack = deque()
stack.append(root)
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        stack.append(y)
        parent[y] = x

# 親→子の値を算出
dp1 = [None] * (n+1)
for i in order[::-1]:
    calc1(i, parent[i])

# 子→親の値を算出　累積和チックにすることでうに対策。
dp2 = [None] * (n+1)
dp2[root] = ini
for i in order:
    calc2(i)

for i in range(1,n+1):
    ans = calc(dp1[i]-1, dp2[i])
    print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
d = {}
ans = []
for i in range(n):
    if a[i] in d.keys():
        d[a[i]] += 1
    else:
        d[a[i]] = 1
    if d[a[i]]==4:
      ans.append(a[i])
    elif d[a[i]]==2:
      ans.append(a[i])
    if len(ans)> 1:
      break
ans.append(0)
ans.append(0)
print(ans[0]*ans[1])

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
d = 0
ans = []
ap = 0
for i in range(n):
    if ap == a[i]:
        d += 1
        if d == 2:
            ans.append(a[i])
        elif d == 4:
            ans.append(a[i])
    else:
        d = 1
        ap = a[i]    
    if len(ans)> 1:
      break
ans.append(0)
ans.append(0)
print(ans[0]*ans[1])
### BUGGY CODE ###

x,k,d=map(int,input().split())
x=abs(x)
for i in range(k):
    if x>0:
        x-=d
    else:
        x+=(k-i)%2*d
        
print(abs(x))

### FIXED CODE ###

x,k,d=map(int,input().split())
x=abs(x)
if k>x//d:
    X=x%d
    X-=(k-x//d)%2*d
else:
    X=x-k*d
       
print(abs(X))
### BUGGY CODE ###

N = int(input())
s = input()
mn=N
for i in range(N):
    lw=s[:i].count("W")
    re=s[i+1:].count("E")
    sm=lw+re
    mn=min(mn,sm)

print(mn)
    

### FIXED CODE ###

N = int(input())
s = input()
mn=N
lw=0
re=s[1:].count("E")
for i in range(N):
    if i-1>=0 and s[i-1]=="W":
        lw+=1
    if i-1>=0 and s[i]=="E":
        re-=1
    
    sm=lw+re
    if mn>sm:
        mn=sm
print(mn)
### BUGGY CODE ###

def main():
    n = int(input())
    A = list(map(int, input().split()))

    res = 1

    for num in A:
        res = res * num
    
    if res > 10 ** 18:
        print(-1)
    else:
        print(res)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    A = list(map(int, input().split()))

    res = 1

    if 0 in A:
        res = 0
    else:
        for num in A:
            res = res * num
            if res > 10**18:
                res = -1
                break
    print(res)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,k,q=map(int,input().split())
arr=list(map(int,input().split()))
arr2=sorted(arr)
ans=10**18
m=arr2[0]
for val in arr:
  tmp=[]
  vals=[]
  l=0
  if val==m:
    tmp=[arr2[:]]
  else:
    for i in range(n):
      if arr[i]<val:
        tmp.append(arr[l:i])
        l=i+1
  for i in range(len(tmp)):
    tmp=sorted(tmp)
  for arrs in tmp:
    if len(arrs)<k:
      continue
    else:
      vals+=arrs[:len(arrs)-k+1]
  vals=sorted(vals)
  if len(vals)<q:
    continue
  else:
    ans=min(ans,vals[q-1]-val)
print(ans)

### FIXED CODE ###

n,k,q=map(int,input().split())
arr=list(map(int,input().split()))
ans=10**18
for val in arr:
  tmp=[]
  vals=[]
  for i in range(n):
    if arr[i]>=val:
      tmp.append(arr[i])
    else:
      if len(tmp)>=k:
        tmp=sorted(tmp)
        vals.extend(tmp[:len(tmp)-k+1])
      tmp=[]
  if len(tmp)>=k:
    tmp=sorted(tmp)
    vals.extend(tmp[:len(tmp)-k+1])
  if len(vals)<q:
    continue
  else:
    vals=sorted(vals)
    ans=min(ans,vals[q-1]-vals[0])
print(ans)
### BUGGY CODE ###

import heapq
def SME(start,end):
    A = []
    if end > N : end = N
    count = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] == 0:
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count > N * parameter : break
    for i in range(L):
        if ANS[i] == 0 : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] == 0 : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
if N == 10**5 :
    parameter = 0.9999
else :
    parameter = 0.995
ANS = [0]*N
ANS = SME(0, N)
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

import bisect
n=int(input())
cnt=0
l= list(map(int, input().split()))
l.sort(reverse=True)
k=[[0 for i in range(n-2)] for j in range(n-2)]
for i in range(n-2):
    for j in range(i,n-2):
        k[i][j-i]=-l[i+1]-l[j+2]
#print(k)
for i in range(n-1):
    x=i
    while x<n-2:
        cnt+=bisect.bisect_left(k[x],-l[i])
        #print(l[i],bisect.bisect_left(k[x],-l[i]))
        x+=1
print(cnt)


### FIXED CODE ###

import bisect
n=int(input())
cnt=0
l= list(map(int, input().split()))
l.sort(reverse=True)
k=[[0 for i in range(n-2)] for j in range(n-2)]
for i in range(n-2):
    for j in range(i,n-2):
        k[i][j-i]=-l[i+1]-l[j+2]
#print(k)
for i in range(n-1):
    x=i
    while x<n-2:
        cnt+=bisect.bisect_left(k[x],-l[i])
        #print(l[i],bisect.bisect_left(k[x],-l[i]))
        x+=1
print(cnt)
### BUGGY CODE ###

N,W=map(int,input().split())
wv = [tuple(map(int,input().split())) for _ in range(N)]

V = sum([wv[i][1] for i in range(N)])

dp = [W+1] * (V + 1)
dp[0] = 0
for i in range(N):
  w,v=wv[i]
  for j in range(V, v-1, -1):
    dp[j] = min(dp[j-v] + w, dp[j])
    
print(max(i for i in range(V+1) if dp[i] <= W))

### FIXED CODE ###

N,W=map(int,input().split())
wv = [tuple(map(int,input().split())) for _ in range(N)]

V = sum([wv[i][1] for i in range(N)])

dp = [W+1] * (V + 1)
dp[0] = 0
for i in range(N):
  w,v=wv[i]
  for j in range(V, v-1, -1):
    dp[j] = min(dp[j-v] + w, dp[j])
    
print(max(i for i in range(V+1) if dp[i] <= W))
### BUGGY CODE ###

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

i = 0
ans = 0
while i < n:
    if b[i]-b[(i-1)%n]-b[(i+1)%n] >= a[i]:
        b[i] =  b[i]-b[(i-1)%n]-b[(i+1)%n]
        ans += 1
        i = 0
    else:
        i += 1
if a==b:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
i = 0
ans = 0
chg = 1
mul = 0
while chg == 1:
    chg = 0
    for i in range(n):
        if b[i]-b[i-1]-b[(i+1)%n] >= a[i]:
            mul = (b[i]-a[i])//(b[i-1]+b[(i+1)%n])
            b[i] -= (b[i-1]+b[(i+1)%n])*mul
            ans += mul
            chg = 1
print(ans if a==b else -1)
### BUGGY CODE ###

n, k = map(int, input().split())
mod = 998244353
list_s = []
for _ in range(k):
    l, r = map(int, input().split())
    list_s.extend(range(l, r + 1))

dp = [0] * (n+1)
sdp = [0] * (n+1)
dp[1] = 1
for i in range(2,n+1):
    for s in list_s:
        if s < i:
            dp[i] += dp[i-s]
print(dp[n] % mod)

### FIXED CODE ###

n, k = map(int, input().split())
mod = 998244353
list_s = []
for _ in range(k):
    l, r = map(int, input().split())
    list_s.append((l, r))
dp = [0] * (n + 1)
sdp = [0] * (n + 1)
dp[1] = 1
sdp[0] = 0
sdp[1] = 1

for i in range(2, n + 1):
    for l, r in list_s:
        dl = max(0, i - r - 1)
        dr = max(0, i - l)
        dp[i] += sdp[dr] - sdp[dl]
        sdp[i] = (sdp[i - 1] + dp[i]) % mod
print(dp[n] % mod)
### BUGGY CODE ###

import sys
inf=1000002
sys.setrecursionlimit(inf)
from collections import deque
h,w,k=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
c=[input() for i in range(h)]
dp=[[inf]*w for i in range(h)]
now=deque()
now.append([x1-1,y1-1])
def bfs(d):
    global h,w,k,x1,y1,x2,y2,c,dp,now
    l=len(now)
    if l==0:
        return
    for i in range(l):
        x,y=now.popleft()
        for j in range(1,min(k+1,w-y)):
            if c[x][y+j]==".":
                if dp[x][y+j]==inf:
                    dp[x][y+j]=d
                    now.append([x,y+j])
            else:
                break
        for j in range(1,min(k+1,y+1)):
            if c[x][y-j]==".":
                if dp[x][y-j]==inf:
                    dp[x][y-j]=d
                    now.append([x,y-j])
            else:
                break
        for j in range(1,min(k+1,h-x)):
            if c[x+j][y]==".":
                if dp[x+j][y]==inf:
                    dp[x+j][y]=d
                    now.append([x+j,y])
            else:
                break
        for j in range(1,min(k+1,x+1)):
            if c[x-j][y]==".":
                if dp[x-j][y]==inf:
                    dp[x-j][y]=d
                    now.append([x-j,y])
            else:
                break
    bfs(d+1)
bfs(1)
print(dp[x2-1][y2-1] if dp[x2-1][y2-1]!=inf else -1)

### FIXED CODE ###

import sys
inf=1000002
sys.setrecursionlimit(inf)
from collections import deque
h,w,k=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
c=[input() for i in range(h)]
dp=[[inf if c[i][j]=="." else -1 for j in range(w)] for i in range(h)]
now=deque()
now.append([x1-1,y1-1])
dp[x1-1][y1-1]=0
#kの更新が遅い
def bfs(d):
    global h,w,k,dp,now,x2,y2
    l=len(now)
    if l==0:
        return
    dp_sub=deque()
    cand=set()
    for i in range(l):
        x,y=now.popleft()
        for j in range(1,min(k+1,w-y)):
            if dp[x][y+j]==inf:
                dp_sub.append([x,y+j,d])
                #dp[x][y+j]=d
                cand.add((x,y+j))
                #now.append([x,y+j])
            else:
                break
        for j in range(1,min(k+1,y+1)):
            if dp[x][y-j]==inf:
                dp_sub.append([x,y-j,d])
                #dp[x][y-j]=d
                cand.add((x,y-j))
                #now.append([x,y-j])
            else:
                break
        for j in range(1,min(k+1,h-x)):
            if dp[x+j][y]==inf:
                dp_sub.append([x+j,y,d])
                #dp[x+j][y]=d
                cand.add((x+j,y))
                #now.append([x+j,y])
            else:
                break
        for j in range(1,min(k+1,x+1)):
            if dp[x-j][y]==inf:
                dp_sub.append([x-j,y,d])
                #dp[x-j][y]=d
                cand.add((x-j,y))
                #now.append([x-j,y])
            else:
                break
    while dp_sub!=deque([]):
        e=dp_sub.popleft()
        dp[e[0]][e[1]]=e[2]
    for i in cand:
        now.append(i)
    bfs(d+1)
bfs(1)
print(dp[x2-1][y2-1] if dp[x2-1][y2-1]!=inf else -1)
### BUGGY CODE ###

a, b, k = map(int, input().split())
lst = [x for x in range(a, b + 1)]
lst_small = lst[:k]
lst_large = lst[-k:]
ans = list(set(lst_small) | set(lst_large))
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])


### FIXED CODE ###

a, b, k = map(int, input().split())
if b - a > k:
    lst_small = [x for x in range(a, a + k)]
    lst_large = [x for x in range(b - k + 1, b + 1)]
    ans = list(set(lst_small) | set(lst_large))
    ans = sorted(ans)
else:
    ans = [x for x in range(a, b + 1)]

for i in range(len(ans)):
    print(ans[i])