Harryxun/stf_run huggingface dataset:
N,K = map(int,input().split())
A = list(map(int,input().split()))

one = A.index(1)

ans = None
if one == 0 or one == N-1:
  ans = -(-(N-1) // (K-1))
else:
  left = -(-i // (K-1))
  right = -(-(N - i - 1 - (i % (K-1)))//(K-1))
  ans = left + right
  
print(ans)
  
  

### FIXED CODE ###

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

ans = -(-(N-1) // (K-1))
  
print(ans)
N = int(input())
A = [0]+list(map(int,input().split()))
for i in range(1,N+1):
  A[i] = A[i]+A[i-1]
ans = float('inf')
for i in range(1,N):
  ans = min(ans, ans(A[N]-2*A[i]))
print(ans)

### FIXED CODE ###

N = int(input())
A = [0]+list(map(int,input().split()))
for i in range(1,N+1):
  A[i] = A[i]+A[i-1]
ans = float('inf')
for i in range(1,N):
  ans = min(ans, abs(A[N]-2*A[i]))
print(ans)
S = input()

import re

li = ['dream','dreamer','erase','eraser']


while len(list(S)) > 8: 
    if S[0] == 'd':
        if S[0:5] == 'dream':
            if S[5:10] == 'erase':
                S = S[5:]
                print(S)
            elif S[5:10] == 'dream':
                S = S[5:]
                print(S)
            elif S[5:7] == 'er':
                if S[7:12] == 'dream':
                    S = S[7:]
                    print(S)
                elif S[7:12] == 'erase':
                    S = S[7:]
                    print(S)
            else:break

    else:
        if S[0:6] == 'eraser':
            S = S[6:]
            print(S)
        elif S[0:5] == 'erase':
            if S[5:10] == 'erase':
                S = S[5:]
                print(S)
            elif S[5:10] == 'dream':
                S = S[5:]
                print(S)
        else:break
k = 0 
for l in li:
    if S == l:k = 1
if k == 0:print('No')
else:print('Yes')

### FIXED CODE ###

S = input()
li = ['dream','dreamer','erase','eraser']
li_len=[5,7,5,6]

while S:
    for i,moji in enumerate(li):
        if S[-li_len[i]:] == moji:
            S = S[:-li_len[i]]
            break
    else:
        print('NO')
        break
if not S:print('YES')
n=int(input())
s=[]
d=[]
i=0
while i!=n:
    s=list(map(int,input().split()))
    d.append(s)
    i+=1
#print(d)
i=0
f=[]
s=[]
j=0
while i!=n:
    while j!=n:
        if i!=j:
            f.append(d[i][0]-d[j][0])
            f.append(d[i][1] - d[j][1])
            s.append(f)
            f=[]

        j += 1
    i+=1
    j=0


#print(s)
i=0
f=[]
while i!=len(s):
    f.append(s.count(s[i]))
    i+=1
#print(f)
print(n-max(f))


### FIXED CODE ###

n=int(input())
s=[]
d=[]
i=0
while i!=n:
    s=list(map(int,input().split()))
    d.append(s)
    i+=1
#print(d)
i=0
f=[]
s=[]
j=0
while i!=n:
    while j!=n:
        if i!=j:
            f.append(d[i][0]-d[j][0])
            f.append(d[i][1] - d[j][1])
            s.append(f)
            f=[]

        j += 1
    i+=1
    j=0


#print(s)
i=0
f=[]
while i!=len(s):
    f.append(s.count(s[i]))
    i+=1
#print(f)
try:
    print(int(n-max(f)))
except:
    print(1)
for i in range(n-1):
    if h[i] < h[i+1]:
        h[i+1] -= 1

    elif h[i] > h[i+1]:
        print('No')
        exit()

print('Yes')

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
h[0] -= 1
for i in range(n-1):
    if h[i] < h[i+1]:
        h[i+1] -= 1

    elif h[i] > h[i+1]:
        print('No')
        exit()

print('Yes')
n=iny(input())
a=set(list(input().split()))
if len(a)==3:
    print("Three")
else:
    print("Four")


### FIXED CODE ###

n=int(input())
a=set(list(input().split()))
if len(a)==3:
    print("Three")
else:
    print("Four")
def main():
  s=input()
  q=[0]
  m=len(s)
  l=["dream","dreamer","erase","eraser"]
  while q:
    i=q.pop()
    if i==n:
      print("YES")
      return
    for j in l:
      nj=len(j)
      if i+nj<=m and s[i:i+nj]==j:
        q.append(i+nj)
  print("NO")

main()

### FIXED CODE ###

import re;print("YNEOS"[re.match(r"^(dream|dreamer|erase|eraser)+$",input())==None::2])
s = int(input())
if s[1] == 'B':
  print('ARC')
else:
  print('ABC')

### FIXED CODE ###

s = input()
if s[1] == 'B':
  print('ARC')
else:
  print('ABC')
from itertools import combinations

N = int(input())
s = [sorted(input(i)) for i in range(N)]

c = len([i for i in combinations(s, 2) if i[0] == i[1]])
print(c)


### FIXED CODE ###

A, B = [int(i) for i in input().split()]

print(max(A+B, A-B, A*B))
th,ts,ah,ae=map(int,input().split())
while(th>0 && ah>0):
  ah=ah-ts
  if(ah<=0):
    break
  else:
    th=th-ae
if(th>0):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

th,ts,ah,ae=map(int,input().split())
while(th>0 and ah>0):
  ah=ah-ts
  if(ah<=0):
    break
  else:
    th=th-ae
if(th>0):
  print("Yes")
else:
  print("No")
N,A,B = [int(i) for i in input().split(" ")]


def check(N,A,B):
    if A == 0:
        return 0
    text = ("b"*A)+("r"*B)
    text =  (text*((A+B)*N))
    return text[:N].count("b")
    
print(check(N,A,B))

### FIXED CODE ###

N,A,B = [int(i) for i in input().split(" ")]


def check(N,A,B):
    if A == 0:
        return 0
    r  = N//(A+B)
    x = N-r*(A+B)
    if x > A:
        return r*A+A
    else:
        return r*A+x
print(check(N,A,B))
from collections import deque

def solve(S, s):
    if S[s[0]][s[1]] != ".":
        return -1
    queue = deque([s])
    visited = [[-1 for _ in range(W)] for _ in range(H)]
    visited[s[0]][s[1]] = 0
    while queue:
        y, x = queue.popleft()
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y + j, x + k
            if new_x in range(W) and new_y in range(H) and S[new_y][new_x] == "." and visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
    #    for v in visited:
    #        print(v)
    return max(max(visited))

H, W = map(int, input().split())
S = [input() for _ in range(H)]
ans = -1
for i in range(W):
    for l in range(H):
        ans = max(ans, solve(S, [i, l]))
print(ans)

### FIXED CODE ###

c = input()
print(chr(ord(c[0]) + 1))
N = int(input())

dp = [100000] * (10**5)
dp[0] = 0

for n in range(N):
  count = 1
  while(True):
    if count > N:
      break

    dp[n+count] = min(dp[n+count], dp[n]+1)
    count *= 6

  count = 1
  while(True):
    if count > N:
      break

    dp[n+count] = min(dp[n+count], dp[n]+1)
    count *= 9

print(dp[N])

### FIXED CODE ###

N = int(input())

dp = [10000] * (N+1)

dp[0] = 0

for n in range(N+1):
  count = 1
  while(True):
    if count > N:
      break

    if n - count < 0:
      break

    dp[n] = min(dp[n], dp[n-count]+1)
    count *= 6

  count = 1
  while(True):
    if count > N:
      break

    if n - count < 0:
      break

    dp[n] = min(dp[n], dp[n-count]+1)
    count *= 9

print(dp[N])
h,w = map(int , input().split(" "))

if h == 1 or w == 1;
    a = 1
elif h % 2 == 0:
    a = int(h * w / 2)
else:
    a = int(w * (h+1)/2) - int(w/2)

print(a)

### FIXED CODE ###

h,w = map(int , input().split(" "))

if h == 1 or w == 1:
    a = 1
elif h % 2 == 0:
    a = int(h * w / 2)
else:
    a = int(w * (h+1)/2) - int(w/2)

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

print("win" if sum((a, b, c)) < 21 else "bust")
a, b, c = map(int, input().split())

print("win" if sum((a, b, c)) < 22 else "bust")


### FIXED CODE ###

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

print("win" if sum((a, b, c)) < 22 else "bust")
n = int(input())
h = list(map(int,input().split())))
ans = 0
b = 10 ** 9
temp = 0

for i in h:
    if i <= b
        temp += 1
    else:
        temp = 0
    b = i
    ans = max(ans,temp)
print(ans)
    

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
ans = 0
b = 0
temp = 0

for i in h:
    if i <= b:
        temp += 1
    else:
        temp = 0
    b = i
    ans = max(ans,temp)
print(ans)
N = int(input())
h = list(map(int,input().split()))

memo = [-1]*N
# iをわたすとiにおける最小のコストを返す
# N-1を渡した時が答え
def calc_cost(i):
  if memo[i] != -1:
    return memo[i]
  # 初期値は条件分岐
  if i == 0:
    return 0
  elif i == 1:
    return abs(h[0]-h[1])
  
  a = calc_cost(i-1)+abs(h[i]-h[i-1])
  b = calc_cost(i-2)+abs(h[i]-h[i-2])
  memo[i] = min(a,b)
  return(memo[i])

print(calc_cost(N-1))

### FIXED CODE ###

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

dp_num = []
dp_num.append(0)
dp_num.append(abs(h[1]-h[0]))
for i in range(2,N):
  tmp = min(dp_num[i-2]+abs(h[i]-h[i-2]),dp_num[i-1]+abs(h[i]-h[i-1]))
  dp_num.append(tmp)
print(dp_num[N-1])
import re

a = input()
if re.match('(.*)keyence', a):
  print("YES")
else:
  if re.match('k(.*)eyence', a)
    print("YES")
  else:
    if re.match('ke(.*)yence', a)
      print("YES")
    else:
      print("NO")


### FIXED CODE ###


ll = [1, 9, 7, 4]

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

if ( a in ll ):
  ll.remove(a)
  if ( b in ll ):
    ll.remove(b)
    if ( c in ll ):
      ll.remove(c)
      if ( d in ll ):
        print("YES")
      else:
        print("NO")
    else:
      print("NO")
  else:
    print("NO")
else:
  print("NO")
n = int(input())
for i in range(1,10):
  for j in range(i, 10):
    if i*j==n:
      print('Yes')
      return
print('No')

### FIXED CODE ###

n = int(input())
for i in range(1,10):
  for j in range(i, 10):
    if i*j==n:
      print('Yes')
      exit()
print('No')
A = input()
if A[1]=='B' :
  print('先週開催されたコンテストはABCなので、今週はARCが開催されます。')
elif:A[1]=='R':
  print('先週開催されたコンテストはARCなので、今週はABCが開催されます。')

### FIXED CODE ###

a=input()
if a[1] =='B' :
  print('ARC')
elif a[1] == 'R':
  print('ABC')
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

if N=>K:
  print(N*X)
else:
  print(K*X + (N-K)*Y)


### FIXED CODE ###

N=int(input())
K=int(input())
X=int(input())
Y=int(input())

if N > K:
  print(K*X+(N-K)*Y)
else:
  print(N*X)
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int, readline().split()))

counter = [0 for _ in range(n + 1)]
for i in a:
    counter[i] += 1


MAX = 10 ** 5
MOD = 10 ** 9 + 7
fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod
comInit(MOD)

total = 0 
diff = [0 for _ in range(n + 1)]
for i, c in enumerate(counter):
    x = com(c, 2, MOD)
    total += x
    y = com(c - 1, 2, MOD)
    diff[i] = x - y

for i in range(n):
    print(total - diff[a[i]])

### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int, readline().split()))

counter = [0 for _ in range(n + 1)]
for i in a:
    counter[i] += 1

total = 0 
diff = [0 for _ in range(n + 1)]
for i, c in enumerate(counter):
    x = c * (c - 1) // 2
    total += x
    if c - 1 <= 0:
        diff[i] = x
    else:
        y = (c - 1) * (c - 2) // 2
        diff[i] = x - y

for i in range(n):
    print(total - diff[a[i]])
s = int(input())

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans = 0
for i in range(x):
    Box = i + 1
    Nokori = s - 3 * Box
    ans_ = cmb(Nokori + Box - 1, Box - 1) 
    ans += ans_
print(ans % (10 ** 9 + 7))

### FIXED CODE ###

s = int(input())

x = s // 3

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans = 0
for i in range(x):
    Box = i + 1
    Nokori = s - 3 * Box
    ans_ = cmb(Nokori + Box - 1, Box - 1) 
    ans += ans_
print(ans % (10 ** 9 + 7))
a, b, k = map(int, input().split())
c = 0
for i in range(min(a, b), 1, -1):
    if a % i == 0 and b % i == 0:
        c += 1
    if c == k:
        ans = i
        break
print(ans)

### FIXED CODE ###

a, b, k = map(int, input().split())
c = []
for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        c.append(i)
print(c[k - 1])
import numpy as np  # noqa
import numba
from numba import njit, b1, i4, i8, f8

m = 998244353
N, K = map(int, input().split())

jumps = []
for i in range(K):
    l, r = map(int, input().split())
    jumps.append([l, r])

jumps = np.array(jumps)


@njit((i8, i8, i8[:, :]), cache=True)
def main(N, m, jumps):
    dpsum = np.zeros(N + 1)
    dp = np.zeros(N + 1)
    dp[1] = dpsum[1] = 1

    for i in range(2, N + 1):
        for j, jump in enumerate(jumps):
            mn = max(0, i - jump[1])
            mx = max(mn, i - jump[0])
            dp[i] = (dp[i] + dpsum[mx] - dpsum[mn - 1]) % m
        dpsum[i] = (dp[i] + dpsum[i - 1]) % m
    return dp[N]


print(int(main(N, m, jumps)))


### FIXED CODE ###

import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 998_244_353


@njit((i8, i8[:]), cache=True)
def main(N, LR):
    L, R = LR[::2], LR[1::2]
    K = len(L)
    F = np.zeros(N + 10, np.int64)
    F[0] = 1
    for n in range(1, N + 10):
        F[n] += F[n - 1]
        for k in range(K):
            l, r = L[k], R[k] + 1
            if n - l >= 0:
                F[n] += F[n - l]
            if n - r >= 0:
                F[n] -= F[n - r]
        F[n] %= MOD
    ans = F[N - 1] - F[N - 2]
    return ans % MOD


N, K = map(int, readline().split())
LR = np.array(read().split(), np.int64)

print(main(N, LR))
a, b, c, d = map(int, input().split())

if a + b + c + d == 7:
    print(a, '+', b, '+', c, '+', d, sep='')
elif a + b + c - d == 7:
    print(a, '+', b, '+', c, '-', d, sep='')
elif a + b - c + d == 7:
    print(a, '+', b, '-', c, '+', d, sep='')
elif a + b - c - d == 7:
    print(a, '+', b, '-', c, '-', d, sep='')
elif a - b + c + d == 7:
    print(a, '-', b, '+', c, '+', d, sep='')
elif a - b + c - d == 7:
    print(a, '-', b, '+', c, '-', d, sep='')
elif a - b - c + d == 7:
    print(a, '-', b, '-', c, '+', d, sep='')
elif a - b - c - d == 7:
    print(a, '-', b, '-', c, '-', d, sep='')


### FIXED CODE ###

a, b, c, d = map(int, input())

if a + b + c + d == 7:
    print(a, '+', b, '+', c, '+', d, '=', 7, sep='')
elif a + b + c - d == 7:
    print(a, '+', b, '+', c, '-', d, '=', 7, sep='')
elif a + b - c + d == 7:
    print(a, '+', b, '-', c, '+', d, '=', 7, sep='')
elif a + b - c - d == 7:
    print(a, '+', b, '-', c, '-', d, '=', 7, sep='')
elif a - b + c + d == 7:
    print(a, '-', b, '+', c, '+', d, '=', 7, sep='')
elif a - b + c - d == 7:
    print(a, '-', b, '+', c, '-', d, '=', 7, sep='')
elif a - b - c + d == 7:
    print(a, '-', b, '-', c, '+', d, '=', 7, sep='')
elif a - b - c - d == 7:
    print(a, '-', b, '-', c, '-', d, '=', 7, sep='')
# -*- coding: utf-8

x = input()
a = input().split()
a = a[::-1]
for i range(len(a)):
   b += a[i]+" "
print(b[:-1])



### FIXED CODE ###

# -*- coding: utf-8

x = input()
a = input().split()
a = a[::-1]
b = ""
for i in range(len(a)):
   b += a[i]+" "
print(b[:-1])
import sys

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def parse(*params):
    if len(params) == 1:
        return params[0](next(args))
    return tuple(p(v) for p, v in zip(params, next(args).split()))
def debug(*v):
    if __debug__:
        print(*v, file=sys.stderr)

# エントリーポイント
def main():
    N = parse(int)
    H = (0, *map(int, next(args).split()))

    c = 0
    debug(H)
    for h in range(100):
        for n in range(1, N + 1):
            if H[n - 1] - h <= 0 and 0 < H[n] - h:
                c += 1
    print(c)

if __name__ == '__main__':
    args = iter(sys.stdin.read().split("\n"))
    main()


### FIXED CODE ###

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

h = [0] + H
c = 0
for i in range(1, 100 + 1):
	for j in range(1, N + 1):
		if h[j - 1] < i and i <= h[j]:
			c += 1
print(c)
import sys, math
step = [1,1,2,4] + [0]*26
for i in range(4,30):
  step[i] = step[i-1] + step[i-2] + step[i-3]

for s in sys.stdin:
  n = int(s)
  if n == 0: break
  print int(math.ceil(step[n]/3650.0))

### FIXED CODE ###

import math

steps=[1, 1, 2, 4]+ [0]*27
for i in range(4, 31):
  steps[i] = steps[i-1] + steps[i-2] + steps[i-3]

while True:
  n = input()
  if n == 0: break
  print int(math.ceil(steps[n]/3650.0))
W, H, x, y = map(float, input().split())

def calc_aspect_ratio(x, y):
    return max(x, y) / min(x, y)

# 長方形の中心で対称
if (H-y) < y:
    y = H-y

if (W-x) < x:
    x = W-x

area = 0
dup = 0

# 頂点に乗る場合対角線で分断できる
# 上記の点移動の処理により(x,y)=(0,0)しかありえない
if (x == 0) & (y == 0):
    area = W * H / 2

# 辺xに点が乗っている場合
elif (x != 0) & (y == 0):
    area = x * H

# 辺yに点が乗っている場合
elif (y == 0) & (y != 0):
    area = y * W

# 内点の場合
else:
    aspect_rect = calc_aspect_ratio(W, H)
    aspect_point = calc_aspect_ratio(x, y)

    # 対角線上に点が乗っている場合は半分に分けられる
    if aspect_rect == aspect_point:
        area = W * H / 2

        # かつ点が長方形の中心に位置する場合は二通りの分割を達成できる
        if ((H-y) == y) & ((W-x) == x):
            dup = 1
    
    # 対角線外の点の場合
    else:
        area = max(y*W, x*H)

print('{} {}'.format(area, dup))


### FIXED CODE ###

W, H, x, y = map(float, input().split())

print('{} {}'.format(W*H/2, 1 if (x*2==W) & (y*2==H) else 0))
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

max_v = -(10 ** 10)
for i in range(1,2**10):

    S_cnt = [0] * 10
    for j in range(10):
        if i % 2 == 1:
            for k in range(N):
                if F[k][j] == 1:
                    S_cnt[k] += 1
        i //= 2
    print

    tmp_v = 0
    for j in range(N):
        tmp_v += P[j][S_cnt[j]]
    max_v = max(max_v, tmp_v)

print(max_v)

### FIXED CODE ###

N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

max_v = -(10 ** 10)
for i in range(1,2**10):

    S_cnt = [0] * N 
    for j in range(10):
        if i % 2 == 1:
            for k in range(N):
                if F[k][j] == 1:
                    S_cnt[k] += 1
        i //= 2

    tmp_v = 0
    for j in range(N):
        tmp_v += P[j][S_cnt[j]]
    max_v = max(max_v, tmp_v)

print(max_v)
N = int(input())

A = [int(i) for i in input().split() ]



for ai in A:
  if ai == 0 :
    print('0')
    exit()
	    
ans = A[0]
border = 18 ** 10
      
for i in range(1,N):
  
  ansCp = ans
  ansCnt = 1
  while ansCp >= 10:
    ansCp /= 10
    ansCnt += 1
    
  if ansCnt == 18 and ansCp > 0:
    print("-1")
    exit()
    
  ans *= A[i]
  
      
print(str(ans))

### FIXED CODE ###

N = int(input())

A = [int(i) for i in input().split() ]



for ai in A:
  if ai == 0 :
    print('0')
    exit()
	    
ans = A[0]      
for i in range(1,N):
  
  ans *= A[i]
  
  ansCp = ans
  ansCnt = 1
  while ansCp >= 10:
    ansCp /= 10
    ansCnt += 1
    
  if (ansCnt > 19) or ( ansCnt == 19 and ans%10 > 0 ) :
    print("-1")
    exit()
  
  
      
print(str(ans))
N,M = map(int, input().strip())
G = [[] for _ in range(N)]
for _ in range(M):
  a,b = map(int, input().strip().split(' '))
  G[a].append(b)
  G[b].append(a)

for i in range(N):
  print(len(G[i]))




### FIXED CODE ###

N,M = map(int, input().strip().split(' '))
G = [[] for _ in range(N)]
for _ in range(M):
  a,b = map(int, input().strip().split(' '))
  a,b = a-1, b-1
  G[a].append(b)
  G[b].append(a)

for i in range(N):
  print(len(G[i]))
a,b=map(int,input().split())
height=list(input())
count=0
for i in range (a):
    if height[i]>=b:
       count+=count
print(count)

### FIXED CODE ###

a,b=map(int,input().split())
height=list(map(int,input().split()))
count=0
for i in range (a):
    if int(height[i])>=b:
       count+=1
print(count)
def dfs(s):
	global x, G
	for t, d in G[s]:
		if x[t] is None:
			x[t] = x[s] + d
			if not dfs(t):
				return False
		else:
			if x[t] != x[s] + d:
				return False
	return True

N,M = map(int,input().split())
x = [None] * N
G = [[] for _ in range(N)]
for i in range(M):
	L, R, D = map(int,input().split())
	G[L-1].append([R-1,D])
	G[R-1].append([L-1,-D])

res = True
for i in range(N):
	if x[i] is None:
		x[i] = 0
		res &= dfs(i)

print("Yes" if res == True else "No")

### FIXED CODE ###

NOT_VISIT = 10**20
N, M = map(int,input().split())
graph = [[] for i in range(N)]

for i in range(M):
	L, R, D = map(int,input().split())
	graph[L-1].append((R-1,D))
	graph[R-1].append((L-1,-D))

visited = [NOT_VISIT for i in range(N)]

def dfs(start):
	global graph, visited

	if visited[start] != NOT_VISIT:
		return True

	stack = [start]
	visited[start] = 0
	while stack:
		label = stack.pop()
		for nextnode, distance in graph[label]:
			if visited[nextnode] == NOT_VISIT:
				stack.append(nextnode)
				visited[nextnode] = visited[label] + distance
			elif visited[nextnode] != visited[label] + distance:
				return False
	return True

res = True
for i in range(N):
	res &= dfs(i)

print("Yes" if res == True else "No")
sorted(a) = int(input())
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

### FIXED CODE ###

n = input()
if n[0] == n[2]:
  print("Yes")
else:
  print("No")
r = int(input)
print(r**2)

### FIXED CODE ###

r = int(input())
print(r*r)
S = input()
S_list = list(map(int, S.split()))
K = int(input())

S_set_under_K = set(S[:K])

if len(S_set_under_K) == 1 and S_list[0] == 1:
    print(1)
else:
    print(S_list[1])


### FIXED CODE ###

S = input()
S_list = list(map(int, list(S)))
K = int(input())

S_set_under_K = set(S[:K])

if len(S) == 1:
    print(S)
elif len(S_set_under_K) == 1 and S_list[0] == 1:
    print(1)
else:
    for c in S:
        if c != "1":
            print(c)
            exit()
N = int(input())
XU=list(input().split() for i in range(input()))
print(sum([float(x)*{"JPY":1,"BTC":380000}[u] for x,u in XU]))

### FIXED CODE ###

XU=list(input().split() for i in range(int(input())))
print(sum([float(x)*{"JPY":1,"BTC":380000}[u] for x,u in XU]))
import bisect
n,k = map(int, input().split( ))
x = list(map(int, input().split( )))

start = bisect.bisect_left(x,0)

if x[start] == 0:
    k -= 1
    n -= 1
    #x = x[:start] + [0] + x[start+1:]
else:
    x = x[:start] + [0] + x[start:]
#print(x)
ans = 10**15

for i in range(start,start + k - n - 1 ,-1):
    tmp1 = -x[start-i]
    tmp2 = x[start+k-i]
    #print(tmp1,tmp2)
    ans = min(ans, tmp1*2 + tmp2, tmp1 + tmp2*2)

print(ans)


### FIXED CODE ###

##境界の処理が場当たり的すぎるが他を見てもコードの発想が理解できない
import bisect
n,k = map(int, input().split( ))
x = list(map(int, input().split( )))
inf = 10**15
x.append(inf)
start = bisect.bisect_left(x,0)

if x[start] == 0:
    k -= 1
    n -= 1
    x = [-inf]*k + x + [inf]*k###
else:
    x = [-inf]*k + x[:start] + [0] + x[start:] + [inf]*k###
#print(x)
ans = inf
start = bisect.bisect_left(x,0)
for i in range(k+1):###
    tmp1 = -x[start-i]
    tmp2 = x[start+k-i]
    #print(tmp1,tmp2)
    ans = min(ans, tmp1*2 + tmp2, tmp1 + tmp2*2)

print(ans)