Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!

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

# dp = [float('inf') for i in range(len(h))]
dp = [0] * n
dp[0] = 0
# dp[1] = abs(h[0] - h[1])
# print(dp)

for i in range(1, n):
    # for j in range(1, min(k + 1, n - i)):
    #     dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))
    dp[i] = min([dp[j] + abs(h[j] - h[i]) for j in range(max(0, i - k), i)])
            
        # print(dp)
        
print(dp[-1])

### FIXED CODE ###

# coding: utf-8
# Your code here!

n = int(input())
height = list(map(int, input().split()))
# print(height)
l = []

for i in range(n):
    if i == 0:
        l.append(0)
    elif i == 1:
        a = height[0]
        b = height[1]
        l.append(abs(a - b))
    else:
        c = height[i - 2]
        # print(c)
        d = height[i]
        # print(d)
        a = l[i - 2] + abs(c - d)
        # print(a)
        b = l[i -1 ] + abs(height[i - 1] - height[i])
        # print(b)
        l.append(min(a, b))
    
# print(len(l))
print(l[len(l) - 1])
N,M = list(map(int, input().split()))
s = []
c = []
for i in range(M):
  inputs = list(map(int, input().split()))
  s.append(inputs[0])
  c.append(inputs[1])

res = [0 for i in range(N)]
for digit, number in zip(s,c):
  digit -= 1
  res[digit] = number

convert = list(map(str, res))
res = int("".join(convert))
if len(str(res)) == N:
  print(res)
else:
  print(-1)

### FIXED CODE ###

n = int(input())
def main(n):
  return n // 2 + n % 2
print(main(n))
N=input()
ans=0
for i in range(N):
  ans+=N
print(ans)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(N):
  ans+=i+1
print(ans)
k=int(input())
s=input()

U=2*10**5
mod=10**9+7

fact=[1]*(U+1)
fact_inv=[1]*(U+1)

for i in range(1,U+1):
    fact[i]=(fact[i-1]*i)%mod
fact_inv[U]=pow(fact[U],mod-2,mod)

for i in range(U,0,-1):
	fact_inv[i-1]=(fact_inv[i]*i)%mod

def comb(n,k):
    if k<0 or k>n:
        return 0
    x=fact[n]
    x*=fact_inv[k]
    x%=mod
    x*=fact_inv[n-k]
    x%=mod
    return x
m=len(s)
ans=0
for i in range(k+1):
    ans=(ans+pow(25,i,mod)*comb(m+i-1,m-1)*pow(26,k-i,mod))%mod
print(ans)

### FIXED CODE ###

k=int(input())
s=input()

U=2*10**6+1
mod=10**9+7

fact=[1]*(U+1)
fact_inv=[1]*(U+1)

for i in range(1,U+1):
    fact[i]=(fact[i-1]*i)%mod
fact_inv[U]=pow(fact[U],mod-2,mod)

for i in range(U,0,-1):
	fact_inv[i-1]=(fact_inv[i]*i)%mod

def comb(n,k):
    if k<0 or k>n:
        return 0
    x=fact[n]
    x*=fact_inv[k]
    x%=mod
    x*=fact_inv[n-k]
    x%=mod
    return x
m=len(s)
ans=0
for i in range(k+1):
    ans=(ans+pow(25,i,mod)*comb(m+i-1,m-1)*pow(26,k-i,mod))%mod
print(ans)
num_bags, congr_factor = list(map(int, input().split()))
bags = list(map(int, input().split()))
odd = len([a for a in bags if (a % 2 == 1]))

if congr_factor == 0 and odd == 0:
  print(2 ** num_bags)
elif congr_factor == 1 and odd == 0:
  print(0)
else:
  print(2 ** (num_bags-1))


### FIXED CODE ###

num_bags, congr_factor = list(map(int, input().split()))
bags = list(map(int, input().split()))
odd_bags = len([bag for bag in bags if (bag % 2 == 1)])

if congr_factor == 0 and odd_bags == 0:
  print(2 ** num_bags)
elif congr_factor == 1 and odd_bags == 0:
  print(0)
else:
  print(2 ** (num_bags-1))
import sys
import math
sys.setrecursionlimit(1000000)
mod=1000000007
def power_func(a,b,p):
    """a^b mod p を求める"""
    if b==0: 
        return 1
    if b%2==0:
        d=power_func(a,b//2,p)
        return d*d %p
    if b%2==1:
        return (a*power_func(a,b-1,p ))%p
class Node:
    def __init__(self):
        self.next=[]
    def get_data(self,new_next,weight=1):
        self.next.append(new_next)
def BFS(i,depth,K):  
    depth+=1
    tmp=i
    seki=1
    num=len(tmp)
    if depth==1:
        calc=K-1
        diff=0

        
    else:
        calc=K-2
        diff=1
    #for i in range(calc,calc-(num-diff),-1):
    #    seki*=i%1000000007
    if num-diff>0:
        fac=math.factorial(calc-(num-diff))%mod
        seki*=((math.factorial(calc)%mod)*power_func(fac,mod-2,mod))%mod
            
    for each in tmp:
        if not check_node[each]:
            check_node[each]=True
            seki*=BFS(node[each].next,depth,K)%mod
    return seki


N,K=list(map(int,input().split()))
node=[Node() for _ in range(N)]
check_node=[False for _ in range(N)]
check_node[0]=True
for i in range(N-1):
    p,n=list(map(int,input().split()))
    node[n-1].get_data(p-1)
    node[p-1].get_data(n-1)
start=0
d=0

com=K*BFS(node[0].next,d,K)
print(int(com)%mod)

### FIXED CODE ###

import sys
import math
sys.setrecursionlimit(1000000)
mod=1000000007
class Node:
    def __init__(self):
        self.next=[]
    def get_data(self,new_next,weight=1):
        self.next.append(new_next)
def BFS(i,depth,K):  
    depth+=1
    tmp=i
    seki=1
    num=len(tmp)
    if depth==1:
        calc=K-1
        loop=range(calc,calc-num,-1)
        for i in loop:
            seki*=i%1000000007

        
    else:
        calc=K-2
        num-=1
        if calc>=num:
            seki=cache[num]
        else:
            print(0)
            exit()

            
            
    for each in tmp:
        if not check_node[each]:
            check_node[each]=True
            seki*=BFS(node[each].next,depth,K)%mod
    return seki


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

if K>2:
    cache=[0 for i in range(K-2)]
    cache[0]=1
    for i in range(1,K-2):
        cache[i]=cache[i-1]*(K-1-i)%mod
    cache.append(cache[-1])
else:
    cache=[1,1]
node=[Node() for _ in range(N)]
check_node=[False for _ in range(N)]
check_node[0]=True
for i in range(N-1):
    p,n=list(map(int,input().split()))
    node[n-1].get_data(p-1)
    node[p-1].get_data(n-1)
start=0
d=0

com=K*BFS(node[0].next,d,K)
print(int(com)%mod)
N = int(input())
S = input()
res = ""
for s in S:
    res += chr((ord(s) - ord("A") + n) % 26)
print(res)

### FIXED CODE ###

N = int(input())
S = input()
res = ""
for s in S:
    res += chr((ord(s) - ord("A") + N) % 26 + ord("A"))
print(res)
import numpy as np
N,M = (int(x) for x in input().split())
H   = np.array([int(x) for x in input().split()])
Way = np.zeros((N,N),dtype=bool)
for T in range(0,M):
    A,B = (int(x) for x in input().split())
    Way[A-1,B-1] = True
    Way[B-1,A-1] = True
    
Count = 0
#for TT in range(0,N): 
#    TrueIndex = [n for n,v in enumerate(Way[TT,:]) if v==True]
#    if np.all(H[TT]>H[TrueIndex]):
#        Count = Count+1
print(Count)

### FIXED CODE ###

N,M = (int(x) for x in input().split())
H   = [int(x) for x in input().split()]
Way = [[] for I in range(N)]
for T in range(0,M):
    A,B = (int(x) for x in input().split())
    Way[A-1].append(B)
    Way[B-1].append(A)
    
Count = 0
for TT in range(0,N): 
    if all(H[TT]>Ele for Ele in [H[I-1] for I in Way[TT]]):
        Count = Count+1
print(Count)
N, Q, *D = map(int, open(0).read().split())
val = [0 for _ in range(N+1)]
E = [[] for _ in range(N+1)]
for i in range(N+Q-1):
  l, r = D[2*i], D[2*i+1]
  if i < N - 1:
  	E[l].append(r)
  	E[r].append(l)
  else:
    val[l] += r
visited = [False for _ in range(N+1)]
def dfs(c):
  visited[c] = True
  for ch in E[c]:
    if not visited[ch]:
      val[ch] += val[c]
      dfs(ch)
dfs(1)
print(' '.join(map(str, val[1:])))

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
N, Q, *D = map(int, open(0).read().split())
val = [0 for _ in range(N+1)]
E = [[] for _ in range(N+1)]
D = list(zip(*[iter(D)]*2))
assert(len(D) == N+Q-1)
for i in range(N+Q-1):
  l, r = D[i][0], D[i][1]
  if i < N - 1:
  	E[l].append(r)
  	E[r].append(l)
  else:
    val[l] += r
visited = [False for _ in range(N+1)]
def dfs(c):
  visited[c] = True
  for ch in E[c]:
    if not visited[ch]:
      val[ch] += val[c]
      dfs(ch)
dfs(1)
print(' '.join(map(str, val[1:N+1])))
n=int(input())
k=int(input())
l=[int(x) for x in input().split()]
s=0
for i in range(n):
  if abs(l[i]-k)>abs(l[i]):
    s+=abs(l[i])
  else:
    s+=abs(l[i]-k)
print(s*2)
  


### FIXED CODE ###

n,a=(int(input()) for _ in range(2))
print(n**2-a)
N = input()
A = input()

if N % 500 < A:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

N =int(input())
A = int(input())

if N % 500 <= A:
	print('Yes')
else:
	print('No')
N = int(input())
S =list(input())
count = N

for i in xrange(N):
    count = min(S[0:i].count('W') + S[i+1:N].count('E'), count)
print(count)

### FIXED CODE ###

N = int(input())
S =list(input())
ans = N
W = 0
E = S.count('E')

for i in range(N):
    if S[i] =='E':
        E -= 1
    ans = min(ans, W+E)
    if S[i] == 'W':
        W += 1
print(ans)
a, b, c = map(int,input()split())
ans = c - (a - b)
if(ans < 0):
  print(0)
else:
  print(ans)

### FIXED CODE ###

a, b, c = map(int,input().split())
ans = c - (a - b)
if(ans < 0):
  print(0)
else:
  print(ans)
from collections import deque
import copy

swap = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 5], [1, 4, 6], [2, 5, 7], [3, 6]]


def bfs():
    ia = list(range(8))
    count = {str(ia): 0}
    que = deque()
    que.append((ia, 0))
    while len(que) != 0:
        state, cnt = que.popleft()
        # pos:0?????????
        pos = state.index(0)
        swap_target = swap[pos]
        for i in swap_target:
            tmp_state = copy.copy(state)
            tmp_state[i], tmp_state[pos] = tmp_state[pos], tmp_state[i]
            if str(tmp_state) not in count:
                count[str(tmp_state)] = cnt + 1
                que.append((tmp_state, cnt + 1))
    return count


if __name__ == '__main__':
    count = bfs()
    while True:
        prob = list(map(int, input().split()))
        print(count[str(prob)])

### FIXED CODE ###

from collections import deque
import copy

swap = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 5], [1, 4, 6], [2, 5, 7], [3, 6]]


def bfs():
    ia = list(range(8))
    count = {str(ia): 0}
    que = deque()
    que.append((ia, 0))
    while len(que) != 0:
        state, cnt = que.popleft()
        # pos:0?????????
        pos = state.index(0)
        swap_target = swap[pos]
        for i in swap_target:
            tmp_state = copy.copy(state)
            tmp_state[i], tmp_state[pos] = tmp_state[pos], tmp_state[i]
            if str(tmp_state) not in count:
                count[str(tmp_state)] = cnt + 1
                que.append((tmp_state, cnt + 1))
    return count


if __name__ == '__main__':
    count = bfs()
    while True:
        try:
            prob = list(map(int, input().split()))
            print(count[str(prob)])
        except:
            break
import numpy as np
import sys
# def input(): return sys.stdin.readline().rstrip()
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
A = np.array(list(map(int, (input().split()))))
nd = np.zeros((N,N), dtype=bool)
# print(*A)
for i in range(min(K,N)):
    for j in range(N):
        nd[j, max(j-A[j],0):min(j+A[j]+1,N)] = True
    # print(nd)
    A = np.count_nonzero(nd, axis=0)
    # print(*A)

print(*A)

### FIXED CODE ###

import numpy as np
from numba import njit
import sys
# import copy
# def input(): return sys.stdin.readline().rstrip()
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
# A = np.array(list(map(int, (input().split()))))
A = np.array(input().split(), dtype=np.int64)
# A = list(map(int, (input().split())))
# nd = np.zeros((N,N), dtype=bool)
# print(*A)

# @njit('(i8[::1],)', cache=True)
@njit(cache=True)
def loop(A):
    for i in range(K):
        # cnt = [0]*N
        cnt = np.zeros_like(A)
        for j, x in enumerate(A):
            # nd[j, max(j-A[j],0):min(j+A[j]+1,N)] = True
            l = max(j-x,0)
            r = min(j+x+1,N)
            cnt[l] += 1
            if r<N:
                cnt[r] -= 1
            # for k in range(max(j-A[j],0), min(j+A[j]+1,N)):
            #     cnt[k] += 1
        # print(nd)
        # A = np.count_nonzero(nd, axis=0)
        # print(cnt)
        A = np.cumsum(cnt)
        if A[0] == A[N-1] == N:
            break
        # print(*A)
    return A

A = loop(A)
print(*A)
a, b, c = input().split()
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
print(’YES’)
else:
print(’NO’)


### FIXED CODE ###

def solve():
    a, b, c = map(str, input().split())
    if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
        ans = "YES"
    else:
        ans = "NO"

    print(ans)

if __name__ == '__main__':
   solve()
a, b, c = map(int, input().split())
if a == 5 and b == 7 and c = 5:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a, b, c = map(int, input().split())
if a + b + c == 17:
  print("YES")
else:
  print("NO")
from functools import lru_cache
n = int(input())
inf = 10**10
h = list(map(int, input().split())) + [inf] * 10


@lru_cache
def dp(i):
    if i == 0:
        return 0
    if i >= 2:
        return min(dp(i-2) + abs(h[i] - h[i-2]), dp(i-1) + abs(h[i] - h[i-1]))
    if i == 1:
        return dp(i-1) + abs(h[i] - h[i-1])


print(dp(n-1))


### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
import numpy as np
dp = np.zeros(N+1, dtype=int)
dp[2] = abs(h[0]-h[1])
for i in range(2, N):
    dp[i+1] = min(
        dp[i] + abs(h[i-1]-h[i]),
        dp[i-1] + abs(h[i-2]-h[i])
    )
print(dp[N])
A, B, N = map(int, input().split())

mx = 0

if N < B:
    print(A * N)//B
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))

### FIXED CODE ###

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

if N < B:
    print((A * N)//B)
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))
A, B = map(str, input().split())
 
B = str(int(float(B)*100+0.00001))
 
#print(B)
ans = []
p = [[]for k in range(len(B))]
for k in range(len(B)):
    for j in range(k):
        p[k].append(0)
for k in range(1, len(B)+1):
    a = 0
    for j in range(1, len(A)+1):
        if a > 9:
            a = int(str(a)[0]) + int(B[-k])*int(A[-j])
        else:
            a = int(B[-k])*int(A[-j])
        #print(a)
 
        p[k-1].append(int(str(a)[-1]))
        if j == len(A) and a >9:
            p[k-1].append(int(str(a)[0]))
 
for k in range(len(B)):
    for j in range(len(p[-1]) - len(p[k])):
        p[k].append(0)
 
#print(p)
a = 0
for k in range(len(p[0])): 
    if int(a) > 9: 
        a = int(str(a)[0])
    else:
        a =0
    for j in range(len(p)):
        a += p[j][k]
    ans.append(str(a)[-1])
    if k ==  len(p[0]-1) and a >9:
        ans.append(str(a)[0])
 
p
 
#print(ans)
op = ""
for k in range(1, len(ans)-1):
    op += ans[-k]
if len(ans)<3:
    print("0")
else:
    print(op)


### FIXED CODE ###

A, B = map(str, input().split())
 
B = str(int(float(B)*100+0.00001))
 
#print(B)
ans = []
p = [[]for k in range(len(B))]
for k in range(len(B)):
    for j in range(k):
        p[k].append(0)
for k in range(1, len(B)+1):
    a = 0
    for j in range(1, len(A)+1):
        if a > 9:
            a = int(str(a)[0]) + int(B[-k])*int(A[-j])
        else:
            a = int(B[-k])*int(A[-j])
        #print(a)
 
        p[k-1].append(int(str(a)[-1]))
        if j == len(A) and a >9:
            p[k-1].append(int(str(a)[0]))
 
for k in range(len(B)):
    for j in range(len(p[-1]) - len(p[k])):
        p[k].append(0)
 
#print(p)
a = 0
for k in range(len(p[0])): 
    if int(a) > 9: 
        a = int(str(a)[0])
    else:
        a =0
    for j in range(len(p)):
        a += p[j][k]
    ans.append(str(a)[-1])
    if k ==  len(p[0])-1 and a >9:
        ans.append(str(a)[0])

 
#print(ans)
op = ""
for k in range(1, len(ans)-1):
    op += ans[-k]
if len(ans)<3 or int(op) < 1:
    print("0")
else:
    print(op)
N,M=map(int,input().split(' '))
S = [list(map(int,input().split(' '))) for i in range(N)]
C = [list(map(int,input().split(' '))) for i in range(M)]
for i in range(N):
  l = [abs(S[i][0]-C[i][0])+abs(S[i][1]-C[i][1]) for i in range(M)]
  print(l.index(min(l))+1)

### FIXED CODE ###

N,M=map(int,input().split(' '))
S = [list(map(int,input().split(' '))) for i in range(N)]
C = [list(map(int,input().split(' '))) for i in range(M)]
for i in range(N):
  l = [abs(S[i][0]-C[j][0])+abs(S[i][1]-C[j][1]) for j in range(M)]
  print(l.index(min(l))+1)
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
        break
    elif x => y:
        print (y,x)
    else
        print (x,y)

### FIXED CODE ###

while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0 :
        break
    elif x <= y :
        print (x,y)
    else :
        print (y,x)
n = int(input())
red =[]
for i in range(n):
  l = str(input())
  red.append(l)

m = int(input())
blue =[]
for i in range(m):
  l = str(input())
  blue.append(l)
  
import collections

cr = collections.Counter(red)
red_name = cr.most_common()[0][0]
red_count = cr.most_common()[0][1]
cb = collections.Counter(blue)
blue_name = cb.most_common()[0][0]
blue_count = cb.most_common()[0][1]

if blue_name == red_name:
  if red_count - blue_count < 0:
    if len(red)==1:
      print(0)
    else:
      if cr.most_common()[1][0]==cb.most_common()[1][0]:
        if cr.most_common()[1][1]-cb.most_common()[1][1] > 0:
          print(cr.most_common()[1][1]-cb.most_common()[1][1])
      else:
        print(cr.most_common()[1][1])
  else:
    print(red_count - blue_count)
else:
  print(red_count)

### FIXED CODE ###

n = int(input())
red =[]
for i in range(n):
  l = str(input())
  red.append(l)

m = int(input())
blue =[]
for i in range(m):
  l = str(input())
  blue.append(l)
  
import collections

cr = collections.Counter(red)
crs = list(cr.most_common())
cb = collections.Counter(blue)
cbs = list(cb.most_common())

result =[]

for i in range(len(cbs)):
  for j in range(len(crs)):
    if cbs[i][0]==crs[j][0]:
      result.append(crs[j][1]-cbs[i][1])
    else:
      flag = False
      count = 0
      for k in range(len(cbs)):
        if cbs[k].count(crs[j][0]) == 0:
          count+=1
      if count == len(cbs):
        result.append(crs[j][1])
        flag = False
        count = 0

if max(result)>0:
  print(max(result))
else:
  print(0)
# -*- coding: utf-8 -*-

import numpy as np

N, M, C = map(int, input().split())
B = np.ndarray([M, 1])
B = list(map(int, input().split()))
A = np.ndarray([N, M])
for i in range(N):
    A[i, :] = list(map(int, input().split()))

ans = sum((A @ B + C) > 0)

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-

import numpy as np

N, M, C = map(int, input().split())
B = np.ndarray([M, 1])
B = list(map(int, input().split()))
A = np.ndarray([N, M])
for i in range(N):
    A[i, :] = list(map(int, input().split()))

ans = sum((np.dot(A,B) + C) > 0)

print(ans)
N, M = map(int, input())
print(abs((N2-)*(M-2)))

### FIXED CODE ###

N, M = map(int, input().split())
print(abs(N-2)*abs(M-2))
H, W = map(int, input().split())
HW = [0] * H
for i in range(H):
  HW[i] = str(input())
#print(HW)
visited = [[0] * W for i in range(H)]
def bfs(x, y, strock):
  #now = HW[x][y]
  if visited[x][y] == 1:
    return 0
  visited[x][y] = 1
  
  if HW[x][y] == ".":
    return 0
  
  strock += 1
  queue = [[0, 1], [0, -1], [1, 0], [-1, 0]]
  tt = 0
  for i, j in queue:
    if (0 <= x + i < H) and (0 <= y + j < W):
      if HW[x + i][y + j] == "#":
        tt = 1
        bfs(x + i, y + j, strock)
  if tt == 0:
    return strock
  return 0
  
for i in range(H):
  for j in range(W):
    st = bfs(i, j, 0)
    #print(st)
    if st == 1:
      print("No")
      quit()
      
print("Yes")
  
  
      
  
  
  

### FIXED CODE ###

H, W = map(int, input().split())
HW = [0] * H
for i in range(H):
  HW[i] = str(input())
#print(HW)
visited = [[0] * W for i in range(H)]
def bfs(x, y):
  #now = HW[x][y]
  if visited[x][y] == 1:
    return 0
  visited[x][y] = 1
  
  if HW[x][y] == ".":
    return 0
    
  queue = [[0, 1], [0, -1], [1, 0], [-1, 0]]
  tt = 0
  for i, j in queue:
    if (0 <= x + i < H) and (0 <= y + j < W):
      if HW[x + i][y + j] == "#":
        tt = 1
        #print(x, y, x + i, y + j, strock)
  if tt == 0:
    return 1
  return 0
  
for i in range(H):
  for j in range(W):
    #print(i, j)
    st = bfs(i, j)
    #print(st)
    if st == 1:
      print("No")
      quit()
      
print("Yes")
I=input;n,q=map(int,I().split());s=' %s '%I();l,r=0,n+1
for t,_,d in eval('I(),'*q)[::-1]:L,R=d<'R',d>'L';l+=t==s[l+1]*L-(t==s[l])*R;r+=t==s[r]*L-(t==s[r-1])*R
print(max(0,r-l-1))

### FIXED CODE ###

def solve(mid,g):
    for t,d in zip(z[::2],z[1::2]):
        if s[mid]==t:
            mid-=(d<'R')or-1
    return mid==g
n,q,s,*z=open(0).read().split()
n,q=int(n),int(q)
s=' %s '%s
ok=0
ng=n+1
while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if solve(mid,0):
        ok=mid
    else:
        ng=mid
a=ok
ok=n+1
ng=0
while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if solve(mid,n+1):
        ok=mid
    else:
        ng=mid
print(max(0,ok-a-1))
a,b,c =int(input().split())

if a=<b:
  ans=c
else:
  ans=c-(a-b)
  if ans<0:
    ans=0
    
  
print(ans)

### FIXED CODE ###

a,b,c = map(int,input().split())
ans = 0

if a <= b:
    ans = c
else:
	ans = c-(a-b)
	if ans < 0:
		ans = 0
    
print(ans)
n,m = map(int,input().split())
a_arr = []
b_arr = []
c_arr = []
 
dic = {0:0}
 
 
for i in range(m):
  a,b = map(int,input().split())
  a_arr.append(a)
  b_arr.append(b)
  tmp_arr = list(map(int, input().split()))
  
  arr = []
  for j in range(1, n+1):
    if j in tmp_arr:
      arr.append('1')
    else:
      arr.append('0')
  
  c_arr.append(int(''.join(arr),2))
  
  dic2 = dic.copy()
  
  for k,v in dic.items():
    if (k|c) in dic.keys():
      dic2[k|c] = min(dic2[k|c],a+v)
    else:
      dic2[k|c] = a+v
 
  dic = dic2
 
if ((2**n)-1) in dic.keys():
  print(dic[(2**n) -1])
else:
  print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
 
dic = {0:0}
 
for i in range(m):
  a,b = map(int,input().split())
  tmp_arr = list(map(int, input().split()))
  
  arr = []
  for j in range(1, n+1):
    if j in tmp_arr:
      arr.append('1')
    else:
      arr.append('0')
  
  c = int(''.join(arr),2)
  
  dic2 = dic.copy()
  
  for k,v in dic.items():
    if (k|c) in dic2.keys():
      dic2[k|c] = min(dic2[k|c],a+v)
    else:
      dic2[k|c] = a+v
 
  dic = dic2
 
if ((2**n)-1) in dic.keys():
  print(dic[(2**n) -1])
else:
  print(-1)
N = int(input())
str_list = [str(input()) for _ in range(N)]
count_ac = 0
count_wa = 0
count_tle = 0
count_re = 0

for s in str_list:
    if s == 'AC':
        count_ac = count_ac + 1
    elif s == 'WA':
        count_wa = count_wa + 1
    elif s == 'TLE':
        count_tle = count_tle + 1
    elif s == 'RE':
        coun_re == count_re + 1

print('AC x ' + str(count_ac))
print('WA x ' + str(count_wa))
print('TLE x ' + str(count_tle))
print('RE x ' + str(count_re))


### FIXED CODE ###

N = int(input())
num = -(-N // 1000)
print(num * 1000 - N)
print(' '.swap())

### FIXED CODE ###

s = input()
print(s.swapcase())
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]+ a+ [N+1]
def combination(n, k):
    result = 1
    for i in range(n - k + 1, n + 1):
        result *= i
    for i in range(1, k + 1):
        result /= i
    return result

def fibonacci(k):
    k = k + 1
    result = 0
    for i in range(1, int(math.ceil(k / 2.0) + 1)):
        result += combination(k, 2 * i - 1) * pow(5, i - 1)
    return int(result / pow(2, k - 1))

def combi(d):
    if d < 0:
        return 0
    elif 0 <= d <= 1:
        return 1
    else:
        return fibonacci(d)
ans = 1
for i in range(len(b)-1):
    ans= (ans*combi(b[i+1]-b[i]-2))%1000000007
print(ans)

### FIXED CODE ###

import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]+ a+ [N+1]
fib = [0,1]
for i in range(10**5):
    fib.append((fib[-1]+fib[-2])%1000000007)
ans = 1
for i in range(len(b)-1):
    ans= (ans*fib[b[i+1]-b[i]-1])%1000000007
print(ans)