Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]

def count_step(n):
    num=n//2
    count=0
    for i in range(num+1):
        N=n-i
        if i==0:
            count+=1
        elif i==1:
            count+=N
        else:
            nume=1
            denom=1
            for j in range(i):
                nume*=(N-j)
                denom*=(j+1)
            count+=nume/denom
    return count

if M!=0:
    a2=[a[0]-1]
    
    for i in range(M-1):
        p=a[i+1]-a[i]-2
        
        a2.append(p)
    
    a2.append(N-a[M-1]-1)

p=1
for i in range(M-1):
    if a[i]+1==a[i+1]:
        p=0
        break

if p==0:
    pattern=0
else:
    if M==0:
        pattern=count_step(N)
    else:
        pattern=1
        for i in range(len(a2)):
            pattern*=count_step(a2[i])

print(int(pattern%1000000007))

### FIXED CODE ###

N,M=map(int,input().split())
a=[0]
for _ in range(M):
    a.append(int(input()))

b=[]
num=0
if len(a)>1:
    b.append(a[1]-a[0]-1)
    for i in range(1,M):
            b.append(a[i+1]-a[i]-2)
    b.append(N-a[M]-1)
else:
    b.append(N)

num=max(b)


mod=1000000007

def fib(n,num):
    fib=[0 for i in range(num+10)]
    fib[0]=1
    fib[1]=1
    for i in range(2,num+1):
        fib[i]=fib[i-1]+fib[i-2]
    return fib[n]

if -1 in b:
    print(0)
else:
    p=1
    for j in range(M+1):
        p*=fib(b[j],num)
    print(p%mod)
n, l=map(int, input().split())
s=[input() for i in range(n)]
s.sort()
print("".join(s))

### FIXED CODE ###

List = input().split()
if List.count("5") == 2 and List.count("7") == 1:
  print("YES")
else:
  print("NO")
def main():
    n,a,b,c,d = map(int,input().split()) 
    s=list(input())
    for i in range(max(c,d)-a-1):
        if s[a+i-1]=="#" and s[a+i]=="#":
            print("No")
            return
    if c<d:
        print("Yes")
        return
    else:
        for i in range(c-b-2):
            if s[b+i]==s[b+i+1] and s[b+i]==".":
                print("Yes")
                return
        if s[b]=="." and s[b-2]==".":
            print("Yes")
            return
        if s[c]=="." and s[c+2]==".":
            print("Yes")
            return
        print("No")
main()

### FIXED CODE ###

def main():
    n,a,b,c,d = map(int,input().split()) 
    s=list(input())
    for i in range(max(c,d)-a-1):
        if s[a+i-1]=="#" and s[a+i]=="#":
            print("No")
            return
    if c<d:
        print("Yes")
        return
    else:
        for i in range(d-b+1):
            if s[b+i-2]==s[b+i-1] and s[b+i-1] == s[b+i] and s[b+i]==".":
                print("Yes")
                return
        print("No")
main()
=S=input()
h,m,s=1,1,0.0
h=S/3600
m=(S-h*3600)/60
s=(S-h*3600-m*60) 
print ':'.join(map(str,[h,m,s]))

### FIXED CODE ###

S=input()
h,m,s=1,1,0.0
h=S/3600
m=(S-h*3600)/60
s=(S-h*3600-m*60) 
print ':'.join(map(str,[h,m,s]))
# -*- coding: utf-8 -*-

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    maxi = []

    for i in range(0,len(l)):
        if i == piv:
            continue
        elif l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    #mini = qui(mini)
    maxi = qui(maxi)
    return mini+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))

### FIXED CODE ###

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

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    middlei = []
    maxi = []

    for i in range(0,len(l)):
        if l[i] == l[piv]:
            middlei.append(l[i])
        elif l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    mini = qui(mini)
    maxi = qui(maxi)
    return mini+ middlei+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))
import numpy as np
n = int(input())
arr = []
for i in range(n-1):
    arr.append([int(s) for s in input().split(" ")])

mmk = np.zeros([n+1,n+1],dtype=int)

childNodeNums = [0 for i in range(n)]
childNodeStatus = [-1 for i in range(n)]
nodeLines = [0 for i in range(n - 1)]


def prepare(n, arr):
    s = [[] for i in range(n)]
    for ar in arr:
        s[ar[0] - 1].append(ar[1] - 1)
        s[ar[1] - 1].append(ar[0] - 1)
    return s


# x为记录入边的颜色
def dfs(currentNode, arr, x):
    childNodes = arr[currentNode]
    if len(childNodes) == 0:
        return

    childNodeNums[currentNode] = childNodeNums[currentNode] + len(arr[currentNode])
    childNodeStatus[currentNode] = 1

    kk = 0
    for i, childNodeIndex in enumerate(childNodes):

        if childNodeStatus[childNodeIndex] == -1:
            kk = kk + 1
            if x == kk:
                kk = kk + 1
            mmk[currentNode+1][childNodeIndex+1] = kk
            dfs(childNodeIndex, arr, kk)

data = prepare(n, arr)
dfs(0, data, -1)

print(max(childNodeNums))

for ar in arr:
    a0 = ar[0]
    a1 = ar[1]
    print(mmk[a0][a1])


### FIXED CODE ###

from sys import setrecursionlimit


def genid(a, b):
    if b < a:
        a, b = b, a
    return a * 100000 + b


def paint(currentNode, usedColor, parentNode, edges, colors):
    color = 1
    for childNode in edges[currentNode]:
        if childNode == parentNode:
            continue
        if color == usedColor:
            color += 1
        colors[genid(currentNode, childNode)] = color
        paint(childNode, color, currentNode, edges, colors)
        color += 1


setrecursionlimit(100000)

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N - 1)]

edges = [[] for _ in range(N)]
for a, b in ab:
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

colors = {}
paint(0, -1, -1, edges, colors)

print(max(len(e) for e in edges))
for a, b in ab:
    print(colors[genid(a - 1, b - 1)])
N,M=map(int,input().split())
L=[-1]*M
R=[-1]*M
for i in range(M):
  L[i],R[i] =map(input().split())
  
print(min(R)-max(L)+1)


### FIXED CODE ###

N,M=map(int,input().split())
L=[-1]*M
R=[-1]*M
for i in range(M):
  L[i],R[i] =map(int,input().split())
if min(R) >= max(L):
  print(min(R)-max(L)+1)
else:
  print(0)
import heapq
from collections import defaultdict

read = lambda: map(int, raw_input())
n, m = read()
jobs = [read() for _ in xrange(n)]
jobs_by_time = defaultdict(list)
for (a, b) in jobs:
  jobs_by_time[a].append(b)

ans = 0
q = [] # heapq
for t in xrange(0, m):
  day = t+1
  for job in jobs_by_time[day]:
    heapq.heappush(q, -job)
  
  if q:
    val = -heapq.heappushpop(q)
    ans += val
print ans
   

### FIXED CODE ###

import heapq
from collections import defaultdict

read = lambda: map(int, raw_input().strip().split())
n, m = read()
jobs = [read() for _ in xrange(n)]
jobs_by_time = defaultdict(list)
for (a, b) in jobs:
  jobs_by_time[a].append(b)

ans = 0
q = [] # heapq
for t in xrange(0, m):
  day = t+1
  for job in jobs_by_time[day]:
    heapq.heappush(q, -job)
  
  if q:
    val = -heapq.heappop(q)
    ans += val
print ans
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
c = [0]*(N+1)
c[0] = 1
c[1] = 1
c[2] = 2
ans = 1
a = []
for i in range(3,N+1):
    c[i] = c[i-1]+c[i-2]
for i in range(M):
    ai = int(input())
    a.append(ai)
for i in range(1,M-1):
    if a[i+1]-a[i] == 1:
        print(0)
        exit()
for i in range(M):
    if i == 0:
        ans *= c[a[i]-1]
        ans %= mod
    if i == M-1:
        ans *= c[N-a[i]-1]
        ans %= mod
    else:
        ans *= c[a[i+1]-a[i]-2]
        ans %= mod
print(ans)

### FIXED CODE ###

from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
c = [0]*(N+1)
c[0] = 1
c[1] = 1
ans = 1
a = []
al = 0
for i in range(2,N+1):
    c[i] = c[i-1]+c[i-2]
    c[i] %= mod
for i in range(M):
    ai = int(input())
    if i == 0:
        a.append(ai)
    else:
        if ai - al == 1:
            print(0)
            exit()
        else:
            a.append(ai)
    al = ai
if M == 0:
    print(c[N])
    exit()
for i in range(M):
    if i == 0:
        ans *= c[a[i]-1]
        ans %= mod
    if i == M-1:
        ans *= c[N-a[i]-1]
        ans %= mod
    else:
        if a[i+1] != a[i]:
            ans *= c[a[i+1]-a[i]-2]
            ans %= mod
print(ans)
a, b, c, x, y =map(int,input().split())
if a + b <= 2*c :
  print(a*x +b*y)
else:
  if x <= y :
    print(min(2*x*c+(y-x)*b,2*y*c)
  else :
    print(min(2*y*c+(x-y)*a,2*x*c)

### FIXED CODE ###

a, b, c, x, y =map(int,input().split())
if a + b <= 2*c :
  print(a*x +b*y)
else:
  if x <= y :
    print(min(2*x*c+(y-x)*b,2*y*c))
  else :
    print(min(2*y*c+(x-y)*a,2*x*c))
N = input()
A = list(map(int, input().split()))
print(int(max(A)) - int(min(A)))

### FIXED CODE ###

N = int(input())
 
if N % 2 == 0:
  print(int(N))
else:
  print(int(2*N))
N,M=map(int,input().split())
a=list(map(int,input().split()))

def gcd(a,b):
  if a==b:
    return a
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
  
def lcm(a,b):
  return a*b//gcd(a,b)
  
for i in range(N-1):
  if i==0:
    tmp=lcm(a[i]//2,a[i+1]//2)
  else:
    tmp=lcm(tmp,a[i+1]//2)
v=M//tmp
if v%2==1:
  print(v//2+1)
else:
  print(v//2)

### FIXED CODE ###

import sys
N,M=map(int,input().split())
a=list(map(int,input().split()))

def gcd(a,b):
  if a==b:
    return a
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
  
def lcm(a,b):
  return a*b//gcd(a,b)

if N==1:
  v=M//int(a[0]*0.5)
  if v%2==0:
    print(v//2)
  else:
    print(v//2+1)
  sys.exit()
  
for i in range(N-1):
  if i==0:
    tmp=lcm(a[i]//2,a[i+1]//2)
    devider=min(a[i]//2,a[i+1]//2)
    if (tmp//devider)%2==0:
      print(0)
      sys.exit()
  else:
    tmp=lcm(tmp,a[i+1]//2)
    devider=min(tmp,a[i+1]//2)
    if (tmp//devider)%2==0:
      print(0)
      sys.exit()

v=M//tmp
if v%2==1:
  print(v//2+1)
else:
  print(v//2)
S=map(int,input().replace(" ",""))
if S%4==0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

S=int(input().replace(" ",""))
if S%4==0:
    print("YES")
else:
    print("NO")
n=int(input())
c=list(input())
t=0
i=0
j=n-1
while c[i]=='R':
    i += 1
    if i>n-1:
        print(0)
        exit()
while c[j]=='W':
    j -= 1
    if j<0:
        print(0)
if i<j:
    i += 1
    j -= 1
    t += 1
while i<j:
    while c[i]=='R':
        i += 1
    while c[j]=='W':
        j -= 1
    i += 1
    j -= 1
    t += 1
print(t)


### FIXED CODE ###

n=int(input())
c=list(input())
w=c.count('W')
ans=0
for i in range(n-w):
    if c[i]=='W':
        ans += 1

print(ans)
s = sorted(set(input()))
x = [chr(i) for i in range(ord("a"), ord("z")+1)]
for i in range(len(x)):
    if x[i] != s[i]:
        print(x[i])
        exit()
print("None")

### FIXED CODE ###

S = input()
l = sorted(list(set(S)))

ans = ""
for i in range(len(l)):
  if ord(l[i]) !=  97 + i:
    ans = chr(97+i)
    break
  elif i == 25 and l[i] == "z":
    ans = "None"

if ans != "":
 print(ans)
else:
  print(chr(ord(l[-1])+1))
import sys

def check_ans(s,x):
  if len(s)==0 and x!=0:
    return False
  elif len(s)==0 and x==0:
    return True
  dp=[[False] * 8001] *(len(s)+1)
  dp[1][s[0]]=True
  for i in range(1,len(s)):
    for j in range(0,8002):
      if dp[i][j]:
        res=abs(j+s[i])
        res2=abs(j-s[i])
        dp[i+1][res]=True
        dp[i+1][res2]=True
  return dp[len(s)][x]

S = sys.stdin.readline().strip()
X,Y=map(int,input().split())
d=1
while S and S[0]=='F':
  S=S[1:]
  X-=1
if len(S)==0:
  if X==0:
    print("Yes")
  else:
    print("No")
  sys.exit()

nx=[]
ny=[]
X=abs(X)
Y=abs(Y)

while S:
  step=0
  while S and S[0]=='T':
    d*=-1
    S=S[1:]
  while S and S[0]=='F':
    step+=1
    S=S[1:]
  if d==1:
    nx.append(step)
  else:
    ny.append(step)

if check_ans(nx,X) and check_ans(ny,Y):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys

def check_ans(s,x):
  res=[0]
  for i in s:
    res = set([x + i for x in res]) | set([x - i for x in res])
  return x in res

S = sys.stdin.readline().strip()
X,Y=map(int,input().split())
d=1
while S and S[0]=='F':
  S=S[1:]
  X-=1
if len(S)==0:
  if X==0 and Y==0:
    print("Yes")
  else:
    print("No")
  sys.exit()

nx=[]
ny=[]
X=abs(X)
Y=abs(Y)

while S:
  step=0
  while S and S[0]=='T':
    d*=-1
    S=S[1:]
  while S and S[0]=='F':
    step+=1
    S=S[1:]
  if step==0:
    break
  if d==1:
    nx.append(step)
  else:
    ny.append(step)

if check_ans(nx,X) and check_ans(ny,Y):
  print("Yes")
else:
  print("No")
S = list(input())
T = list(input())
cnt = 0
for t in range(0,int(len(S))-1):
  if S[t] != T[t]:
    cnt++
print(cnt)

### FIXED CODE ###

S = list(input())
T = list(input())
cnt = 0
for t in range(0,int(len(S))):
  if S[t] != T[t]:
    cnt += 1
print(cnt)
N = input()
S = input()
K = int(input())

char = S[K]

for s in S:
    print('*',end='') if s != char else print(s,end='')

### FIXED CODE ###

N = input()
S = input()
K = int(input())
 
char = S[K-1]
 
for s in S:
    print('*',end='') if s != char else print(s,end='')
import math
ans=0
c=0
N = int(input())
A = [int(i) for i in input().split()] 
L=[1]*N
R=[1]*N
L[0]=1
L[1]=A[0]
R[N-1]=1
R[N-2]=A[N-1]
for i in range(2,N):
    L[i]=math.gcd(L[i-1],A[i-1])
    R[N-i-1]=math.gcd(R[N-i],A[N-i])
for i in range(N):
    if i==0 or i==N-1:
        c=max(L[i],R[i])
        if c>=ans:
            ans=c
    else:
        c=math.gcd(L[i],R[i])
        if c>=ans:
            ans=c
print(ans)
    
    






### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
left,right = [a[0]]+[0]*(n-1),[0]*(n-1)+[a[n-1]]
arr = [0]*n
for i in range(0,n-1):
  left[i+1] = gcd(left[i],a[i+1])
  right[n-2-i] = gcd(right[n-1-i],a[n-2-i])
arr[0] = right[1]
arr[n-1] = left[n-2]
for i in range(1,n-1):
  arr[i] = gcd(left[i-1],right[i+1])
print(max(arr))
s=[int(input()) for i in range(3)]
a=0
if i[1]-i[0]==i[2]-i[1]:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a,b,c=(int(i) for i in input().split())
if b-a==c-b:
    print("YES")
else:
    print("NO")
from collections import deque

def bfs(): #幅優先探索
  #入力のグラフを初期化
  #d = [[float("inf")] * w for i in range(h)] 
  #d == mazeリストの"."を"inf"に変えたリスト
  lead = 0
  dx = [-1,0,0,1]
  dy = [0,-1,1,0]
  
  #que = deque([])
  #que.append((sx,sy))
  #d[sx][sy] = 0
  
  while que:
    lead_h,lead_w = que.popleft()
    lead = d[lead_h][lead_w]
    #lead == queの先頭にある要素を取り出す
    for i in range(4):
      nx = lead_w + dx[i]
      ny = lead_h + dy[i]
      if ny<0 or h<=ny or nx<0 or w<=nx:
        continue
      if d[nx][ny]==float("inf"):
        d[nx][ny] = lead + 1
        que.append((nx,ny))
  return lead

h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]

d = [[float("inf")] * w for i in range(h)] 

que = deque([])
for i in range(h):
  for j in range(w):
    if maze[i][j] == "#":
      que.append((i,j))
      d[i][j] = 0

print(bfs())

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

# '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            black_cells.append((h, w))
            dist[h][w] = 0

def bfs(black_cells, dist):
    d = 0
    while black_cells:
        # キューとして使うのでpop()ではなくpopleft()
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:  # セルが白('.')であるのと同義
                dist[new_h][new_w] = d+1
                black_cells.append((new_h, new_w))
    return d

d = bfs(black_cells, dist)
print(d)
S=list(input())
T=list('keyence')
A=[]
B=[]
C=[]
a=0
for i in range(len(S)):
    if S[i]==T[a]:
        A.append(i)
        a+=1
if len(A)!=7:
    print('NO')
elif A==[0,1,2,3,4,5,6]:
    print('YES')
else:
    for i in range(0,A[len(A)-1]+1):
        B.append(i)
    for i in range(len(B)):
        if B[i] not in A:
            C.append(B[i])
    if C[len(C)-1]-C[0]==len(C)-1:
        print('YES')
    else:
        print('NO')

### FIXED CODE ###

u=str(input())
S=u.replace(' ','z')
A=[]
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if i<=j:
            A.append(S.replace(S[i-1:j],'',1))
if 'keyence' in A:
    print('YES')
else:
    print('NO')
N, Y = list(map(int, input().split()))
for i in range(N + 1):
    for j in range(n + 1 - i):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == Y:
            print(i, j, n - i - j)
            exit()
else:
    print('-1 -1 -1')


### FIXED CODE ###

n, Y = list(map(int, input().split()))
for i in range(n + 1):
    for j in range(n + 1 - i):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == Y:
            print(i, j, n - i - j)
            exit()
else:
    print('-1 -1 -1')
K = int(input())
A,B = map(int, input().split())

if A%K==0 or B%K==0 or ABS(B-A)>=K:
  print('OK')
else:
  print('NG')


### FIXED CODE ###

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

for num in range(A, B+1, 1):
  if num % K == 0:
    print('OK')
    break
else:
  print('NG')
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  if b*d>a*c
    print(b*d)
  else:
    print(a*c)
else:
  if a*c>b*d:
    print(a*c)
  else:
    print(b*d)

### FIXED CODE ###

a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  if d>0:
    print(b*d)
  else:
    print(a*d)
else:
  if b>0:
    if d>0:
      if b*d>a*c:
        print(b*d)
      else:
        print(a*c)
    else:
      print(a*c)
  else:
    if c>0:
      print(b*c)
    else:
      print(a*c)
from collections import deque
from sys import exit
def Fi():
    print('First')
    exit()

N = int(input())
dim = [0]*N
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    dim[a-1] += 1
    dim[b-1] += 1
    Edge[a-1].append(b-1)
    Edge[b-1].append(a-1)
par = [None] + [0]*(N-1)
stack = [0]
visited = set([0])
while stack:
    vn = stack.pop()
    for vf in Edge[vn]:
        if vf in visited:
            continue
        visited.add(vf)
        par[vf] = vn
        stack.append(vf)

L = [i for i in range(1,N) if dim[i] == 1]
used = set()
stack = deque(L)
while stack:
    vn = stack.pop()
    vp = par[vn]
    dim[vp] -= 1
    if vp in used:
        Fi()
    used.add(vp)
    pvp = par[vp]
    if dim[pvp] == 1 and pvp is not None:
        stack.appendleft(pvp)
print('Second')

### FIXED CODE ###

from sys import exit
def Fi():
    print('First')
    exit()

N = int(input())
dim = [-1]*N
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    dim[a-1] += 1
    dim[b-1] += 1
    Edge[a-1].append(b-1)
    Edge[b-1].append(a-1)
par = [None] + [0]*(N-1)
stack = [0]
visited = set([0])
while stack:
    vn = stack.pop()
    for vf in Edge[vn]:
        if vf in visited:
            continue
        visited.add(vf)
        par[vf] = vn
        stack.append(vf)

L = [i for i in range(1,N) if dim[i] == 0]
used = set(L)
stack = L[:]
mat = [0]*N
dim[0] += 2
while stack:
    vn = stack.pop()
    pv = par[vn]
    if pv is None:
        break
    if mat[vn] == 0:
        mat[vn] += 1
        mat[pv] += 1
    dim[pv] -= 1
    if dim[pv] == 0:
        stack.append(pv)
print('Second' if all(m == 1 for m in mat) else 'First')
import itertools
n=input()
c=[0,0,6,36,150,540,1806,5796,18150]
b=len(list(a for a in itertools.product(["3","5","7"],repeat=len(n))if len(set(a))==3 and int("".join(a))<int(n)))
print(sum(c[:l-1])+b)

### FIXED CODE ###

import itertools
n=input()
c=[0,0,6,36,150,540,1806,5796,18150]
b=len(list(a for a in itertools.product(["3","5","7"],repeat=len(n))if len(set(a))==3 and int("".join(a))<=int(n)))
print(sum(c[:len(n)-1])+b)
import numpy as np
        
    n = int(input())
    S = np.asarray([])
    St = np.zeros(4) # None,B,A,BA
    count = 0
     
    for i in range(n):
        S=np.append(S,input())
        tmp = 0
        count += S[i].count("AB")
        if S[i][0] == "B":
            tmp += 1
        if S[i][-1] == "A":
            tmp += 2
        St[tmp]+=1
     
    if (St[1] == 0)&(St[3]>0):
        St[1]+=1
        St[3]-=1
     
    if (St[2] == 0)&(St[3]>0):
        St[2]+=1
        St[3]-=1
     
    print(int(count+min(St[1],St[2])+St[3]))

### FIXED CODE ###

import numpy as np

n,k=list(map(int,input().split()))
print(n-k+1)