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

ans = 0
cnt = 0
flag = 1
while flag:
    flag = 0
    if cnt == N-1:
        break
    for i in range(cnt, N):
        if P[i] == i+1:
            P[i], P[i+1] = P[i+1], P[i]
            ans += 1
            flag = 1
        else:
            cnt += 1

print(ans)

### FIXED CODE ###

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

ans = 0

for i in range(N):
    if P[i] != i+1:
        continue
    if i+1 < N and P[i] != i+2 or i == 0:
        P[i], P[i+1] = P[i+1], P[i]
        ans += 1
    else:
        P[i], P[i-1] = P[i-1], P[i]
        ans += 1

print(ans)
K = int(input())
gcd_sum = 0
for a in range(1,K+1):
  a_init = a
  for b in range(1, K+1):
	b_init = b
    for c in range(1, K+1):
      a = a_init
	  b = b_init						
	  m = min(a, b, c)
	  gcd = 1
	  for i in range(2, m+1):
	    if a%i == 0 and b%i == 0 and c%i == 0:
	      a /= i
		  b /= i
		  c /= i
		  gcd *= i
	  gcd_sum += gcd
print(gcd_sum)

### FIXED CODE ###

def gcd(a, b):
  if a < b:
    a_init = a
    a = b
    b = a_init
  while b != 0:
    r = a % b
    a = b
    b = r
  return a
	
K = int(input())
count = 0
temp = []
for a in range(1, K+1):
	for b in range(1, a):
		temp.append(gcd(a, b))
for c in range(1, K+1):
	for j in range(len(temp)):
		count += gcd(c, temp[j]) * 2
	for k in range(1, K+1):
		count += gcd(c, k)
print(count)
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

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

ans += h[0]
base = h[0]
for i in range(1,N):
    ans += max(h[i]-base,0)
    base = h[i]

print(ans)

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

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

ans = h[0]
base = h[0]
for i in range(1,N):
    ans += max(h[i]-base,0)
    base = h[i]

print(ans)
from numba import njit
@njit
def main():
  n,k=map(int,input().split())
  p=list(map(int,input().split()))
  c=list(map(int,input().split()))
  ans=-10**18
  for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1!=i: #ループ部分
      start=p[start]-1
      count+=1
      val+=c[start]
    start=i
    if val>0:
      a=(k//count-1)*val #一周目はループのどの部分から始めるのが最適かわからないので
      ans=max(a,ans)
      num=count+k%count
    else:
      a=0
      num=min(k,count)
    for _ in range(num):
      start=p[start]-1
      a+=c[start]
      ans=max(a,ans)
  print(ans)
main()


### FIXED CODE ###

from numba import jit
@jit
def main():
  n,k=map(int,input().split())
  p=list(map(int,input().split()))
  c=list(map(int,input().split()))
  ans=-10**18
  for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1!=i: #ループ部分
      start=p[start]-1
      count+=1
      val+=c[start]
    start=i
    if val>0:
      a=(k//count-1)*val #一周目はループのどの部分から始めるのが最適かわからないので
      ans=max(a,ans)
      num=count+k%count
    else:
      a=0
      num=min(k,count)
    for _ in range(num):
      start=p[start]-1
      a+=c[start]
      ans=max(a,ans)
  print(ans)
main()
from functools import lru_cache

N = int(input())
S = input()
mod = 10 ** 9 + 7
x = 0
for i in range(len(S)):
    if S[i] == 'B':
        x += 2**i

@lru_cache(maxsize=10**10)
def func(now, remain=tuple(range(2*N))):
    if len(remain) == 0:
        if now == 0:
            return 1
        else:
            return 0
        
    ret = 0
    for i in range(len(remain)):
        for j in range(i+1, len(remain)):
            temp = list(remain)
            temp.pop(j)
            temp.pop(i)
            ret += func(now ^ ((2**(remain[j]+1)-1)-(2**remain[i]-1)), tuple(temp))
            ret %= mod
    return ret

print(func(x) % mod)


### FIXED CODE ###

import math

N = int(input())
S = input()
mod = 10**9 + 7

left = 0
ret = 1
for i in range(len(S)):
    if S[i] == 'W':
        if left % 2 == 1:
            left += 1
        else:
            if left > 0:
                ret *= left
                ret %= mod
                left -= 1
            else:
                print(0)
                exit()
    else:
        if left % 2 == 1:
            ret *= left
            ret %= mod
            left -= 1
        else:
            left += 1

if left > 0:
    print(0)
    exit()
            
for i in range(1, N+1):
    ret *= i
    ret %= mod
print(ret)
string=input()
number=int(input())
characters=len(string)
empty=""
if characters<=number:
    print(string)
else:
    i=0
    while i<number:
        empty+=string[i]
        i=i+1
    print(f"{empty}...")



### FIXED CODE ###

#K input for the range of S
K = int(input())
#input of lowercase english letters
S = input()
if len(S) > K:
    print(S[:K] + "...")
else:
    print(S)
A, B = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

import math

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = True
    is_prime[1] = True
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime

print(primes(10**5))

import fractions
x = fractions.gcd(A, B)
divisors = make_divisors(x)
ans = 0
P = primes(x)
for d in divisors:
    if P[d]:
        ans += 1
print(ans)

### FIXED CODE ###

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

import math

def is_prime(n):
    if n == 1: return True

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

import fractions
x = fractions.gcd(A, B)
divisors = make_divisors(x)
ans = 0
for d in divisors:
    if is_prime(d):
        ans += 1
print(ans)
H, W = map(int, input().split(" "))

result = True
masu = [[0 for i in range(H+2)] for j in range(W+2)]
for h in range(1, H+1):
    s = "0"+input()+"0"
    masu[h] = list(s)

# print(masu)    

for h in range(1, H+1):
    for w in range(1, W+1):
        # print(h, w, masu[h][w])
        if masu[h][w] == "#":
            if not ((masu[h][w] == masu[h+1][w]) or (masu[h][w] == masu[h][w+1]) or (masu[h][w] == masu[h-1][w]) or (masu[h][w] == masu[h][w-1])):
                result = False
                break

if result:
    print("Yes")
else:
    print("No")

### FIXED CODE ###


H, W = map(int, input().split(" "))

# result = True
masu = [['.' for i in range(W+2)] for j in range(H+2)]
for h in range(H):
    s = "."+input()+"."
    masu[h+1] = s

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                # result = False
                print("No")
                exit()

print("Yes")
from collections import defaultdict


class Solution:
    def main(self):
        N = int(input())
        self.hashmap = defaultdict(set)
        for i in range(N-1):
            u, v, w = map(int, input().split())
            self.hashmap[u-1].add((v-1, w))
            self.hashmap[v-1].add((u-1, w))
        # print(self.hashmap)
        self.colors = [None] * N
        for i in range(N):
            try:
                self.dfs(i, 0)
                print(self.colors[i])
            except IndexError:
                print('Error')
                return

    def dfs(self, i, color):
        if self.colors[i] is None:
            self.colors[i] = color
            for node, weight in self.hashmap[i]:
                if weight % 2 == 0:
                    self.dfs(node, color)
                else:
                    self.dfs(node, 1 ^ color)


if __name__ == '__main__':
    Solution().main()

### FIXED CODE ###

from collections import defaultdict


class Solution:
    def main(self):
        N = int(input())
        self.hashmap = defaultdict(set)
        for i in range(N-1):
            u, v, w = map(int, input().split())
            self.hashmap[u-1].add((v-1, w))
            self.hashmap[v-1].add((u-1, w))
        # print(self.hashmap)
        self.colors = [None] * N
        for i in range(N):
            stack = [(i, 0)]
            while stack:
                idx, color = stack.pop()
                if self.colors[idx] == None:
                    self.colors[idx] = color
                    for node, weight in self.hashmap[idx]:
                        if weight % 2 == 0:
                            stack.append((node, color))
                        else:
                            stack.append((node, 1 ^ color))
        for i in range(N):
            print(self.colors[i])

    def dfs(self, i, color):
        if self.colors[i] is None:
            self.colors[i] = color
            for node, weight in self.hashmap[i]:
                if weight % 2 == 0:
                    self.dfs(node, color)
                else:
                    self.dfs(node, 1 ^ color)


if __name__ == '__main__':
    Solution().main()
while true:
  H, W = map(int, raw_input().split())
   if H == 0 and W == 0:
      break
  print (("#" * W + "\n") * H)

### FIXED CODE ###

while True:
  H, W = map(int, raw_input().split())
  if H == 0 and W == 0:
      break
  print (("#" * W + "\n") * H)
x = int(input())
 
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    prnit(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

### FIXED CODE ###

x = int(input())
 
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)
import math
N,K = map(int,input().split())
if N >= 100000:
  raise IndexError
cnt = 0
for n in range(1,N+1):
    if K/n <= 1:
        x = 0
    elif math.log(K/n)%math.log(2)<=0.00001:
        x = (math.log(K)-math.log(n))//math.log(2)
    else:
        x = (math.log(K)-math.log(n))//math.log(2)+1
    cnt += (0.5)**x
 
print(cnt/N)

### FIXED CODE ###

import math
N,K = map(int,input().split())
cnt = 0
for n in range(1,N+1):
    x = 0
    while n*(2**x) < K:
        x += 1
    cnt += (0.5)**x

print(cnt/N)
import.math
A, B = map(int, input().split())
print(math.floor(A*B))

### FIXED CODE ###

def resolve():
    A, B = input().split()
    ans = int(A)*int(B[0])*100+int(A)*int(B[2:])
    print(str(ans)[:-2] if len(str(ans)) >= 3 else "0")
resolve()
n = int(input())
C = [int(input()) for i in range(n)]
mod = 10**9+7

A = [0] * n
B = [-1] * (n+1)

A[-1] = 1
B[C[-1]] = n-1
# print(B)

for i in range(n-2, -1, -1):
    if B[C[i]] != -1 and B[C[i]] != i+1:
        A[i] = (A[i+1] + A[B[C[i]]]) % mod
    else:
        A[i] = A[i+1]
    B[C[i]] = i
    # print(A,B)

# print(A)
# print(B)
print(A[0])

### FIXED CODE ###

n = int(input())
C = [int(input()) for i in range(n)]
nc = 2 * 10 ** 5 + 3
mod = 10**9+7

A = [0] * n
B = [-1] * nc

A[-1] = 1
B[C[-1]] = n-1
# print(B)

for i in range(n-2, -1, -1):
    if B[C[i]] != -1 and B[C[i]] != i+1:
        A[i] = (A[i+1] + A[B[C[i]]]) % mod
    else:
        A[i] = A[i+1]
    B[C[i]] = i
    # print(A,B)

# print(A)
# print(B)
print(A[0])
print(vacation_planning(a,b,c))

### FIXED CODE ###

n = int(raw_input())

a = []
b = []
c = []

for _ in range(n):
    ai, bi, ci = [int(i) for i in raw_input().split()]
    a.append(ai)
    b.append(bi)
    c.append(ci)


def vacation_planning(a,b,c):
    n = len(a)
    fa = [0] * n 
    fb = [0] * n
    fc = [0] * n

    fa[0] = a[0]
    fb[0] = b[0]
    fc[0] = c[0]

    for i in range(1, n):
        fa[i] = a[i] + max(fb[i-1], fc[i-1])
        fb[i] = b[i] + max(fa[i-1], fc[i-1])
        fc[i] = c[i] + max(fa[i-1], fb[i-1])

    return max(fa[-1], fb[-1], fc[-1])

print(vacation_planning(a,b,c))
# https://atcoder.jp/contests/abc107/tasks/arc101_a

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)

    N, K = map(int, input().split())
    X = [-INF] + list(map(int, input().split())) + [INF]
    pos = bisect.bisect(X, 0) # 右にあって0に一番近くて要素のインデックス
    # print(pos)
    ans = INF
    if N - pos + 1 >= K: # 右側からだけ取れるなら
        ans = min(ans, abs(X[pos + K - 1]))
    # print(ans)
    if pos - 1 >= K: # 左側からだけ取れるなら
        ans = min(ans, abs(X[pos - K]))
    # print(ans)

    for i in range(1, K):  # 左側からいくつ取るか
        if not i < pos - 1:  # 左側に取れるだけ数がないなら continue
            continue
        # min(一番左までの距離 x 往復 + 一番右までの距離, 一番右までの距離 x 往復 + 一番左までの距離)
        ans = min(ans, abs(X[pos - i]) * 2 + abs(X[pos + K - i - 1]))
        ans = min(ans, abs(X[pos + K - i - 1]) * 2 + abs(X[pos - i]))

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# https://atcoder.jp/contests/abc107/tasks/arc101_a

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)

    N, K = map(int, input().split())
    X = [-INF] + list(map(int, input().split())) + [INF]
    pos = bisect.bisect(X, 0) # 0より大きい中で最小の要素のインデックス
    # print(pos)

    right_num = N - pos + 1
    left_num = pos - 1

    ans = INF
    if right_num >= K:  # 右側からだけ取れるなら
        ans = min(ans, abs(X[pos + K - 1]))
    # print(ans)

    for i in range(1, K):  # 左側からいくつ取るか
        if i > left_num:  # 左側に取れるだけ数がないなら continue
            continue
        if K - i > right_num:  # 右側に取れるだけ数がないなら continue
            continue

        left_distance = abs(X[pos - i])
        right_distance = abs(X[pos + K - i - 1])
        # min(一番左までの距離 x 往復 + 一番右までの距離, 一番右までの距離 x 往復 + 一番左までの距離)
        ans = min(ans, left_distance * 2 + right_distance, right_distance * 2 + left_distance)

    if left_num >= K:  # 左側からだけ取れるなら
        ans = min(ans, abs(X[pos - K]))
    # print(ans)

    print(ans)


if __name__ == '__main__':
    main()
N, M = (int(x) for x in input().split())
A = [int(x) for x in input().split()]
B = [0] * M
C = [0] * M
Bsum = 0
for i in range(M):
    B[i], C[i] = (int(x) for x in input().split())
    Bsum += B[i]

### FIXED CODE ###

N, M = (int(x) for x in input().split())
Lmax = -1
Rmin = N + 1
for i in range(M):
    L, R = (int(x) for x in input().split())
    if Lmax < L:
        Lmax = L
    if Rmin > R:
        Rmin = R
if (Rmin - Lmax) >= 0:
    print(Rmin - Lmax + 1)
else:
    print(0)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np 
def main():
    H, W = map(int , readline().split())
    A = np.array([1 if i == ord('.') else 0 for i in read()], np.int16).reshape(H, W+1)
    A = np.vstack((A, np.zeros(W+1, np.int16)))
    row = np.zeros((H+1, W+1), np.int16)
    clumn = np.copy(row)

    for j in range(H):
        prev = 0
        start = 0
        for i in range(W+1):
            if A[j, i] == 1:
                if prev == 0:
                    start = i 
                    prev = 1
            else:
                if prev == 1:
                    n = i - start
                    for k in range(start, i):
                        row[j, k] = n
                    prev = 0 
    

    for i in range(W):
        prev = 0
        start = 0
        for j in range(H+1):
            if A[j, i] == 1:
                if prev == 0:
                    start = j
                    prev = 1
            else:
                if prev == 1:
                    n = j - start
                    for k in range(start, j):
                        clumn[k, i] = n
                    prev = 0

    print((row+clumn).max()-1)
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np 
import itertools as it
def main():
    H, W = map(int, readline().split())
    G = np.zeros((H+2, W+2), np.int16)
    G[1:-1, 1:] = (np.frombuffer(read(H*(W+1)), dtype='B') == ord('.')).reshape((H, W+1))
    def solve(G):
        left = np.zeros(G.shape, np.int16)
        for i in range(G.shape[0]):
            left[i, ] = np.arange(G.shape[1])
        left[G>0] = 0
        np.maximum.accumulate(left, out=left, axis=1)

        rG = G[..., ::-1]
        right = np.zeros(G.shape, np.int16)
        for i in range(G.shape[0]): 
            right[i, ] = np.arange(G.shape[1])
        right[rG>0] = 0
        np.maximum.accumulate(right, out=right, axis=1)

        right = G.shape[1] - right[..., ::-1]-1
        scoreres = (right-left-1) 
        scoreres[G==0] = 0
        return scoreres

    print((solve(G)+solve(G.T).T-1).max())
if __name__ == '__main__':
    main()
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i]-a[i-1])
b.append(k-a[n-1]+a[0])

b.sorted(b)

print(sum(b[:-1]))


### FIXED CODE ###

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

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))
from collections import defaultdict
import numpy as np


def trial_division(n):
    factor = defaultdict(int)
    tmp = int(np.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            factor[num] += 1
    factor[n] += 1
    return factor


def powmod(x, y, mod):
    if y == 0:
        return 1
    return (((powmod(x, y >> 1, mod) ** 2) % mod) * x ** (y & 1)) % mod


n = int(input())
a = np.array(list(map(int, input().split())))
mod = 10**9 + 7
numbers = defaultdict(int)
for a_i in a:
    for i, v in trial_division(a_i).items():
        numbers[i] = max(v, numbers[i])

l = 1
for i, v in numbers.items():
    l *= i ** v
    l %= mod

r = powmod(a, mod-2, mod)
ans = 0
for i in r:
    ans += l * r
    ans %= mod
print(int(ans))




### FIXED CODE ###

from collections import defaultdict
from functools import lru_cache
import math


def trial_division(n):
    factor = defaultdict(int)
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            factor[num] += 1
    factor[n] += 1
    return factor


@lru_cache(maxsize=None)
def powmod(x, y, mod):
    if y == 0:
        return 1
    return (((powmod(x, y >> 1, mod) ** 2) % mod) * x ** (y & 1)) % mod


n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
numbers = defaultdict(int)
for a_i in a:
    for i, v in trial_division(a_i).items():
        numbers[i] = max(v, numbers[i])

l = 1
for i, v in numbers.items():
    l *= powmod(i, v, mod)
    l %= mod


ans = 0
for i in a:
    r = powmod(i, mod-2, mod)
    ans += l * r
    ans %= mod
print(int(ans))
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

k = ni()
x, y = na()

def go(x, y, k):
    if x < 0:
        res = go(-x, y, k)
        for u in res:
            u[0] = -u[0]
        return res
    if y < 0:
        res = go(x, -y, k)
        for u in res:
            u[1] = -u[1]
        return res

    if (x+y) % 2 == 1 and k % 2 == 0:
        return None

    ops = []
    while x+y >= 2*k and x >= k:
        ops.append([k, 0])
        x -= k
    while x + y >= 2 * k and y >= k:
        ops.append([0, k])
        y -= k
    if (x+y) % k == 0:
        while x >= k:
            ops.append([k, 0])
            x -= k
        while y >= k:
            ops.append([0, k])
            y -= k
        if x > 0 and y > 0:
            ops.append([x, y])
        return ops

    if (x+y) % 2 == 0:
        mid = (x + y) // 2
        if mid <= x:
            ops.append([mid, -(k-mid)])
            ops.append([x-mid, y+(k - mid)])
        else:
            ops.append([x+(k-mid), mid-x])
            ops.append([-(k-mid), y-(mid-x)])
        return ops

    if x >= k:
        ops.append([k, 0])
        res = go(x-k, y, k)
        ops.extend(res)
        return ops

    ops.append([x, k-x])
    res = go(0, y-(k-x), k)
    ops.extend(res)
    return ops

res = go(x, y, k)
if not res:
    print(-1)
    sys.exit(0)

print(len(res))
cx, cy = 0, 0
for o in res:
    cx += o[0]
    cy += o[1]
    print(cx, cy)

### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

k = ni()
x, y = na()

def go(x, y, k):
    if (x+y) % 2 != 0 and k % 2 == 0:
        return None
    if x < 0:
        res = go(-x, y, k)
        for u in res:
            u[0] = -u[0]
        return res
    if y < 0:
        res = go(x, -y, k)
        for u in res:
            u[1] = -u[1]
        return res

    ops = []
    while x+y >= 2*k and x >= k:
        ops.append([k, 0])
        x -= k
    while x + y >= 2 * k and y >= k:
        ops.append([0, k])
        y -= k
    if (x+y) % k == 0:
        while x >= k:
            ops.append([k, 0])
            x -= k
        while y >= k:
            ops.append([0, k])
            y -= k
        if x > 0 and y > 0:
            ops.append([x, y])
        return ops

    if (x+y) % 2 == 0:
        mid = (x + y) // 2
        if mid <= x:
            ops.append([mid, -(k-mid)])
            ops.append([x-mid, y+(k - mid)])
        else:
            ops.append([x+(k-mid), mid-x])
            ops.append([-(k-mid), y-(mid-x)])
        return ops

    if x >= k:
        ops.append([k, 0])
        res = go(x-k, y, k)
        ops.extend(res)
        return ops

    ops.append([x, k-x])
    res = go(0, y-(k-x), k)
    ops.extend(res)
    return ops

res = go(x, y, k)
if not res:
    print(-1)
    sys.exit(0)

print(len(res))
cx, cy = 0, 0
for o in res:
    cx += o[0]
    cy += o[1]
    print(cx, cy)
# -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
left_in_c = c - (a -b )
if left_in_c < 0
	left_in_c = 0 
print("{}".format(left_in_c));

### FIXED CODE ###

a, b, c = map(int, input().split())
left_in_c = c - (a -b )
if left_in_c <=0:
  left_in_c =0
print("{}".format(left_in_c));
from heapq import*
(n,m),*t=[map(int,s.split())for s in open(0)]
q=[0]*7**6
v=[[]for _ in q]
z=0
for a,b in t:
  v[a-1]+=[b]
for i in v[:m]:
  for j in i:
    heappush(q,-j)
  z-=heappop(q)
print(z)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
if n == 1:
  print(1)
  exit()
  
chk = []
for i in range(n):
  a = int(input())
  chk.append((i,a))
  
from bisect import bisect_left,insort_left
from collections import deque
ans = 1

c = deque([])
for j in chk:
  i,a = j
  if i == 0:
    c.append((a,n-i))
  else:
    ind = bisect_left(c,(a,n-i))
    if ind == 0:
      ans += 1
      c.appendleft((a,n-i))
    else:
      c[ind-1] = (a,n-i)
      
print(ans)
h,w = map(int,input().split())

ans = 10**10

if h * w % 3 == 0:
    print(0)
    exit()

ans = min(ans,w,h)

for i in range(1,h//2+1):
    a = [w * j, (h - j) * (w // 2), (h - j) * (w // 2 + w % 2)]
    a.sort()
    ans = min(ans, a[2] - a[0])
for i in range(1, w//2+1):
    a = [h * j, (w - j) * (h // 2), (w - j) * (h // 2 + h % 2)]
    a.sort()
    ans = min(ans, a[2] - a[0])
print(ans)

### FIXED CODE ###

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

ans = 10**10

if h * w % 3 == 0:
    print(0)
    exit()

ans = min(ans,w,h)

for i in range(1,h//2+1):
    a = [w * i, (h - i) * (w // 2), (h - i) * (w // 2 + w % 2)]
    a.sort()
    ans = min(ans, a[2] - a[0])
for i in range(1, w//2+1):
    a = [h * i, (w - i) * (h // 2), (w - i) * (h // 2 + h % 2)]
    a.sort()
    ans = min(ans, a[2] - a[0])
print(ans)