Harryxun/stf_run huggingface dataset:
root=[]
string = copy.deepcopy(a)
while len(string)!=0:
    temp=[]
    for i,s in enumerate(string):
        if i+1 == s:
            temp.append(i+1)
    if len(temp)==0:
        break
    
    if temp[0]==1 and len(temp)==1:
        string.pop(0)
        root.append(1)
    else:
        if 1 in temp:
            temp.remove(1)
        for i in temp[-1]:
            root.append(i)
            string.pop(i-1)
        
if len(string)!=0:
    print(-1)
else:
    for i in root[::-1]:
        print(i)

### FIXED CODE ###

import copy

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


root=[]
string = copy.deepcopy(a)
while len(string)!=0:
    temp=[]
    for i,s in enumerate(string):
        if i+1 == s:
            temp.append(i+1)
    if len(temp)==0:
        break
    
    if temp[0]==1 and len(temp)==1:
        string.pop(0)
        root.append(1)
    else:
        if 1 in temp:
            temp.remove(1)
        root.append(temp[-1])
        string.pop(temp[-1]-1)
        
if len(string)!=0:
    print(-1)
else:
    for i in root[::-1]:
        print(i)
import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

N = int(readline())
A = list(map(int,readline().split()))

res = 0

in_i = 0
de_i = 0
i = 0
while i < N-1:
    for j in range(i+1,N):
        if A[j] >= A[j-1]:continue
        else:
            break

    in_i = j
    for j in range(i+1,N):
        if A[j] <= A[j-1]:continue
        else:
            break
    de_i = j

    i = max(de_i,in_i)
    res+=1
#print(res)

if (A[-3] - A[-2])*(A[-2] - A[-1]) >= 0: print(res)
else: print(res+1)

### FIXED CODE ###

import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

#N,*A = map(int,read().split())
N = int(input())
l = list(map(int,input().split()))

#最初の状態分を加算するため、1からカウント
ans = 1

S = 0 #現在の状態 増加 or 減少 or 初期化

for i in range(1,N):
    X = l[i] - l[i-1]

    X = 0 if X == 0 else 1 if X > 0 else -1

    #同じ値の時l[i] == l[i-1]
    if X == 0:
        continue

    #Stateが初期のときは現在の状態に更新
    elif S == 0:
        S = X

    #Stateが違うときは答えに加算して、Stateを初期値に
    elif S != X:
        ans += 1
        S = 0

print(ans)
# A,B,C,D = int(input()) for i in range(4)
A = int(input())
B = int(input())
C = int(input())
D = int(input())
AB = A * B
CD = C * D

if AB > CD:
  print(AB)
elif CD > AB:
  print(CD)
else:
  print(AB)


### FIXED CODE ###

A,B,C,D = map(int, input().split())
print(max(A*B,C*D))
n,q=map(int,input().split())
t=[[] for _ in range(n)]
c=[0 for _ in range(n)]

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

for i in range(q):
  p,x=map(int,input().split())
  c[p-1]+=x

def spread(pi):
  for i in range(len(t[pi])):
    c[t[pi][i]] += c[pi]
    spread(t[pi][i])

spread(0)

print(*c)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline

n,q=map(int,input().split())
t=[[] for _ in range(n)]
c=[0 for _ in range(n)]

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

for i in range(q):
  p,x=map(int,input().split())
  c[p-1]+=x

def dsf(ci,pi):
  for i in t[ci]:
    if i != pi:
      c[i] += c[ci]
      dsf(i, ci)

dsf(0,-1)

print(*c)
#16D8101012J 伊藤惇 dj Python3 

def area(a,b):
    c=a*b
    return c

def perimeter_of_the_rectangle(a,b):
    c=(a+b)*2
    return c

def Rectangle():
    a=int(input("input_a:"))
    b=int(input("input_b:"))
    c=area(a,b)
    d=perimeter_of_the_rectangle(a,b)
    print("{} {}".format(c,d))

if __name__ == '__main__':
    Rectangle()


### FIXED CODE ###

def area(a,b):
    c=a*b
    return c
def perimeter_of_the_rectangle(a,b):
    c=(a+b)*2
    return c
def Rectangle():
    a,b=map(int,input().split())
    c=area(a,b)
    d=perimeter_of_the_rectangle(a,b)
    print("{} {}".format(c,d))
    
if __name__ == '__main__':
    Rectangle()
week = ['SUN','MON','TUE','WED','THU','FRI','SAT' ]
print(week[(week.index(input)+1)%7])

### FIXED CODE ###

week = ['MON','TUE','WED','THU','FRI','SAT','SUN']
day = input()
ans = week.index('SUN')-week.index(day)
print(ans if ans!=0 else 7)
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]

from bisect import bisect_left
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    if i:
        return i
    else:
        return 0

def solve(input_string):
    N, M = makeMultiInteger(input_string[0])
    A = makeMultiInteger(input_string[1])
    _S = makeIntMatrix(input_string[2:])
    cards = sorted(A)
    S = sorted(_S, key=lambda x: x[1], reverse=True)

    i = 1
    while(i < len(S)):
        b = S[i][0]
        c = S[i][1]
        if S[i-1][1] == c:
            S[i-1][0] += b
            del S[i]
            i -= 1
        i += 1

    for s in S:
        b = s[0]
        c = s[1]
        if c > cards[0]:
            for i in range(b):
                if c > cards[i]:
                    cards[i] = c
                else:
                    break
            part_cards = cards[b:]
            s_l = find_lt(part_cards, cards[0])
            if s_l != 0:
                cards = part_cards[:s_l] + cards[0:b] + part_cards[s_l:]
        else:
            break
    return sum(cards)

def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# from sys import exit
N, M = [int(n) for n in input().split()]
# N = int(input())
a = [(int(n), 1) for n in input().split()]
B = [0 for _ in range(M)]
C = [0 for _ in range(M)]
for i in range(M):
    B[i], C[i] = [int(n) for n in input().split()]
    a.append((C[i], B[i]))

a = sorted(a, key=lambda x: -x[0])
i = 0
ans = 0
# print(a)
while(N != 0):
    num = min(N, a[i][1])
    ans += num*a[i][0]
    # print(num*a[i][0])
    N -= num
    i += 1

print(ans)
s=map(str,input().split())
if A not in s or B not in s:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

s=input()
s=list(s)
if "A" not in s or "B" not in s:
  print("No")
else:
  print("Yes")
i = int(input())
d = i * 800
b = i // 15

if 0 < b:
    c = d - (200 * b)
    print(c)
else:
    print(c)


### FIXED CODE ###

i = int(input())
d = i * 800
b = i // 15

if 0 <= b:
    c = d - (200 * b)
    print(c)
else:
    print(c)
from collections import Counter
a=input()
c=Counter(a)
MOD = 10**9+7
n=len(a)
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
f_mod=[1]*(n+1)
f_mod_inverse=[1]*(n+1)
for i in range(1,n+1):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
if n==1:print(1)
else:
    ans=comb_mod(n,2)
    for i in c.values():
        if i==1:continue
        else:ans-=comb_mod(i,2)
print(ans+1)


### FIXED CODE ###

from collections import Counter
a=input()
c=Counter(a)
n=len(a)
if n==1:print(1)
else:
    ans=n*(n-1)//2
    for i in c.values():
        if i==1:continue
        else:ans-=i*(i-1)//2
    print(ans+1)
N = int(input())
num = list(map(int, input().split()))

ans=1
for i in range(N):
    ans *= num[i]
    if ans > 10**18:
        ans=-1
print(ans)

### FIXED CODE ###

L, R = map(int,input().split())

print(L*R)
N = int(input())

Ws = [s for _ in range(N)]

print(len(set(Ws)))

### FIXED CODE ###

N = int(input())
 
Ws = [input() for _ in range(N)]
 
print(len(set(Ws)))
inport sys
x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  sys.exit()
n=(x+y)//3
fac=[1 for i in range(n+1)]#fac[i]=i!. fac[0]=1
for i in range(n+1):
  fac[i]=fac[i-1]*i

print(fac[n]//fac[x-n]//fac[y-n])

### FIXED CODE ###

import sys
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  sys.exit()
n=(x+y)//3

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

print(cmb(n,x-n,mod))
import sys
import math
INF=1e9
mod=1e9+7
n,m=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
g=1
for i in range(n):
    a[i]//=2
    g=g*a[i]//math.gcd(g,a[i])
#print(g)
ans=(m//g)
if(ans%2==1):
    print(ans//2+1)
else:
    print(ans//2)

### FIXED CODE ###

import sys
import math
INF=1e9
mod=1e9+7

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

n,m=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
g=1
init=0
for i in range(n):
    a[i]//=2
num=a[0]
while(num%2==0):
    num/=2
    init+=1
for i in range(1,n):
    num=a[i]
    cnt=0
    while(num%2==0):
        num/=2
        cnt+=1
    if(cnt!=init):
        print(0)
        sys.exit()
for i in range(n):
    g=lcm(g,a[i])
#print(g)
ans=(m//g)
if(ans%2==1):
    print(ans//2+1)
else:
    print(ans//2)
N = int(input())
S, T = map(int,input().split())
for i in range(N):
     print(S[i] + T[i])

### FIXED CODE ###

N = int(input())
S, T = map(str,input().split())
for i in range(N):
     print(S[i] + T[i],end="")
import fractions
from functools import reduce



def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())
A = [int(x) for x in input().split()]
list = []
max = 1

for x in range(N):

    for y in range(N):
        if x != y:
            list.append(A[y])

    gcd = gcd_list(list)
    if gcd > max:
        max = gcd

print(max)

### FIXED CODE ###

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

print(int((T+0.5)/A)*B)
while True:
    H, W = [int(i), for i in input().split()]
    if H == W == 0:
         break

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H - 1 or w == 0 or w == W - 1:
                print('#', end='')
            else:
                print('.', end='')

         print()
    print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H - 1 or w == 0 or w == W - 1:
                print('#', end='')
            else:
                print('.', end='')

        print()
    print()
N,M = map(int,input().split())

judge = [False]*N
WAcnt = [0] * N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

WAans = 0
for i in range(N):
    if judge[i-1] == True:
        WAans += WAans[i-1]

print(ACcnt,WAans)

### FIXED CODE ###

N,M = map(int,input().split())

judge = [False]*N
WAcnt = [0] * N
ACcnt = 0
for i in range(M):
    p,S = (x for x in input().split())
    p = int(p)
    if judge[p-1] == False:
        if S == "AC":
            judge[p-1] = True
            ACcnt += 1
        else:
            WAcnt[p-1] += 1

WAans = 0
for i in range(N):
    if judge[i] == True:
        WAans += WAcnt[i]

print(ACcnt,WAans)
from collections import defaultdict

n = int(input())
z = [list(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
for i in range(n):
    xi, yi = z[i]
    for j in range(n):
        if i == j:
            continue
        xj, yj = z[j]
        d[(xi - xj, yi - yj)] += 1
print(n - max(d.values()))


### FIXED CODE ###

from collections import defaultdict

n = int(input())
z = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
    ans = 1
else:
    d = defaultdict(int)
    for i in range(n):
        xi, yi = z[i]
        for j in range(n):
            if i == j:
                continue
            xj, yj = z[j]
            d[(xi - xj, yi - yj)] += 1
    ans = n - max(d.values())
print(ans)
a,b=map(int,open(0))
if a+b>21:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

print('bwuisnt'[sum(map(int,input().split()))<22::2])
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> path(n);
    int ans[n] = {-1}; // 距離を格納するリスト
    REP(i,n)
        ans[i] = -1;
    
    queue<int> que;
    
    REP(i,m) 
    {
        int a,b;
        cin >> a >> b;
        path[a-1].PB(b-1);
        path[b-1].PB(a-1);
    }
    que.push(0);

    // cout << endl;
    // REP(i,SIZE(path))
    // {   
    //     cout << i << " ";
    //     REP(j,SIZE(path[i]))
    //     {
    //         cout << path[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    ans[0] = 0;
    while (!que.empty())
    {
        int now = que.front(); //現在の場所
        que.pop();
        // cout << "here is top of roop" << endl;
        // cout << "que size" << que.size() << endl; 
        // cout << "now" << now  << endl;
        

        // if (que.size() > 100)
        //     break;

        REP(i,SIZE(path[now]))
        {
            int tmp = path[now][i];
            if (tmp == now) continue;
            if (ans[tmp] != -1)
                continue;
            else
            {
                ans[tmp] = now;
                que.push(tmp);
            }
            // 個々提出前に米
            // cout << "This is test " << now << " " << tmp << endl;
            // REP(i,n)
            //     cout << ans[i] << " ";
            // cout << endl;
        }
    }

    REP(i,n)
    {
        if (ans[i] == -1)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    FOR(i,1,n-1)
        cout << ans[i]+1 << endl;

    return 0;
}


### FIXED CODE ###

from collections import defaultdict

class que(object):
    def __init__(self):
        self.item = []

    def push(self,x):
        self.item.append(x)
    
    def front(self):
        return self.item[0]
    
    def pop(self):
        self.item.pop(0)
    
    def empty(self):
        return len(self.item) == 0

n,m = map(int , input().split())
path = defaultdict(list)

ans = [-1 for i in range(n)]

for i in range(m):
    a,b = map(int, input().split())
    path[a-1].append(b-1)
    path[b-1].append(a-1)

q = que()

q.push(0)

ans[0] = 0

while not q.empty():
    now = q.front()
    q.pop()


    for tmp in path[now]:
        # print(tmp, now)
        if tmp == now:
            continue
        
        if ans[tmp] != -1:
            continue
            
        else:
            ans[tmp] = now
            q.push(tmp)
    # print(now)

# print(ans)

for tmp in ans:
    if tmp == -1:
        print("No")
        exit()

print("Yes")

for tmp in ans[1:]:
    
    print(tmp+1)
import functools
import math
import copy

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    l=copy.copy(a)
    del l[i]
    gcd=functools.reduce(math.gcd, l)
    if ans<gcd:
        ans=gcd
print(ans)

### FIXED CODE ###

import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))
# -*- coding: utf-8 -*-

from heapq import heappop, heappush
from collections import defaultdict

def inpl(): return list(map(int, input().split()))
N, M, L = inpl()

while N:
    G = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b, d, e = inpl()
        G[a].append([b, d, e])
        G[b].append([a, d, e])

    Q = [[0, 0, 1]] # bandits, distance, where
    visited = defaultdict(lambda : False)
    visited[(0, 0, 1)] = True
    
    while Q:
        e, d, p = heappop(Q)
        if p == N:
            print(e)
            break
        for q, dd, de in G[p]:
            if d + dd <= L and not visited[(e, d+dd, q)]:
                heappush(Q, (e, d+dd, q))
                visited[(e, d+dd, q)] = True
            if not visited[(e+de, d, q)]:
                heappush(Q, (e+de, d, q))
                visited[(e+de, d, q)] = True
    N, M, L = inpl()


### FIXED CODE ###

from heapq import heappop, heappush
from collections import defaultdict

def inpl(): return list(map(int, input().split()))
N, M, L = inpl()

while N:
    G = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b, d, e = inpl()
        G[a].append([b, d, e])
        G[b].append([a, d, e])

    Q = [[0, 0, 1]] # bandits, distance, where
    cost = [[10**6]*(L+1) for _ in range(N+1)]
    cost[1][0] = 0
    while Q:
        e, d, p = heappop(Q)
        if cost[p][d] < e:
            continue
        if p == N:
            print(e)
            break
        for q, dd, de in G[p]:
            if d + dd <= L and e < cost[q][d+dd]:
                heappush(Q, (e, d+dd, q))
                cost[q][d+dd] = e
            if e + de < cost[q][d]:
                heappush(Q, (e+de, d, q))
                cost[q][d] = e+de
    N, M, L = inpl()
import string, sys

rot1 = string.maketrans("abcdefghijklmnopqrstuvwxyz. ",\
                        "bcdefghijklmnopqrstuvwxyza. ")

for line in sys.stdin
    while 1:
        if line.count("the") or line.count("this") or line.count("that"):
            print line
            break
        line = text.translate(rot1)

### FIXED CODE ###

import sys,string
A = 'abcdefghijklmnopqrstuvwxyza'
rot = string.maketrans(A[1:], A[:-1])
for line in sys.stdin:
    line = line[:-1]
    while 1:
        if line.count("the") or line.count("this") or line.count("that"):
            print line
            break
        line = line.translate(rot)
N=int(input())
name=[input()[0] for _ in range(N)]
m,a,r,c,h=name.count("M"),name.count("A"),name.count("R"),name.count("C"),name.count("H")
print(m*a*(r+c+h)+m*r*(c+h)+m*c*h+a*r*(c+h)+a*c*h+r*c*h)

### FIXED CODE ###

print(int(input())//3)
import copy
h,w =map(int,input().split())

s = [[]*w for _ in range(h)]
white =0
for i in range(h):
    t = input()
    for j in range(w):
        if t[j] == ".":
            white += 1
            s[i].append(10**5)
        elif t[j] == "#":
            s[i].append(t[j])
now = [0,0]
steps =[]
steps.append(now)
direction = []
s[0][0] =0
a = [2]
while len(steps) >0:
    now = copy.copy(steps[0])
    if s[now[0]][now[1]] =="#":
        continue
    for k in [[0,1],[1,0],[-1,0],[0,-1]]:
        if now[0] + k[0] >=0 and now[0] + k[0] < h:
            now[0] += k[0]
            if now[1] + k[1] >=0 and now[1] + k[1] <w:
                now[1] += k[1]
                if s[now[0]][now[1]] == 10**5:
                    steps.append([now[0],now[1]])
            else:
                continue
        else:
            continue
    if s[steps[0][0]][steps[0][1]] ==0:
        steps.pop(0)
        continue
    elif s[steps[0][0]][steps[0][1]] >10**4:
        direction =[]
        for l in [[0,1],[1,0],[-1,0],[0,-1]]:
            if steps[0][0]+l[0]>=0 and steps[0][0]+l[0]<h and steps[0][1]+l[1]< w and steps[0][1]+l[1] >=0 and s[steps[0][0]+l[0]][steps[0][1]+l[1]] != "#":
                direction.append(s[steps[0][0]+l[0]][steps[0][1]+l[1]])
        s[steps[0][0]][steps[0][1]] = min(direction)+1
    steps.pop(0)

if s[h-1][w-1] == "#" or s[h-1][w-1] == 10**4:
    print(-1)
else:
    print(white-1 - s[h-1][w-1])









### FIXED CODE ###

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

s = [[]*w for _ in range(h)]
white =0
for i in range(h):
    t = input()
    for j in range(w):
        if t[j] == ".":
            white += 1
            s[i].append(10**5)
        elif t[j] == "#":
            s[i].append(t[j])
now = [0,0]
steps =[]
steps.append(now)
direction = []
s[0][0] =0
a = [2]
while len(steps) >0:
    now = copy.copy(steps[0])
    if s[now[0]][now[1]] =="#":
        continue
    for k in [[0,1],[1,0],[-1,0],[0,-1]]:
        now = copy.copy(steps[0])
        if now[0] + k[0] >=0 and now[0] + k[0] < h:
            now[0] += k[0]
            if now[1] + k[1] >=0 and now[1] + k[1] <w:
                now[1] += k[1]
                if s[now[0]][now[1]] == 10**5:
                    if not [now[0],now[1]] in steps:
                        steps.append([now[0],now[1]])
            else:
                continue
        else:
            continue
    # if s[steps[0][0]][steps[0][1]] ==0:
    #     steps.pop(0)
    #     continue
    if s[steps[0][0]][steps[0][1]] >10**4:
        direction =[]
        for l in [[0,1],[1,0],[-1,0],[0,-1]]:
            if steps[0][0]+l[0]>=0 and steps[0][0]+l[0]<h and steps[0][1]+l[1]< w and steps[0][1]+l[1] >=0 and s[steps[0][0]+l[0]][steps[0][1]+l[1]] != "#":
                s[steps[0][0]][steps[0][1]]=min(s[steps[0][0]+l[0]][steps[0][1]+l[1]]+1,s[steps[0][0]][steps[0][1]])
    steps.pop(0)
if s[h-1][w-1] == "#" or s[h-1][w-1] == 10**5:
    print(-1)
else:
    print(white-1 - s[h-1][w-1])
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    K=int(input())
    X,Y=map(int,input().split())

    # defaultは 0 <= Y <= X
    def trans(u,v):
        if(abs(X)<abs(Y)): u,v=v,u
        if(X<0): u=-u
        if(Y<0): v=-v
        return u,v

    x,y=max(abs(X),abs(Y)),min(abs(X),abs(Y))
    if(K%2==0 and (X+Y)&1):
        print(-1)
        return

    # x+y<K
    if(x+y<K and (x+y)&1):
        print(3)
        print(*trans(x,-K+x))
        print(*trans(x+(K+x-y)//2,-(K-x-y)//2))
        print(*trans(x,y))
        return
    if(x+y<K and (not (x+y)&1)):
        print(2)
        print(*trans((x+y)//2,-k+(x+y)//2))
        print(*trans(x,y))
        return

    # # x+y>=K
    # c=(-x-y)%K
    # n=ceil((x+y)/K)+(c&1)
    # l=(K*n-x-y)//2
    # print(n)
    # nx,ny=K-l,-l
    # print(*trans(nx,ny))
    # while(nx+K<=x):
    #     nx+=K
    #     print(*trans(nx,ny))
    # nx,ny=x,ny+(x-nx)
    # print(*trans(nx,ny))
    # while(ny+K<=y):
    #     ny+=K
    #     print(*trans(nx,ny))
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    K=int(input())
    X,Y=map(int,input().split())
    # defaultは 0 <= Y <= X
    def trans(u,v):
        if(abs(X)<abs(Y)): u,v=v,u
        if(X<0): u=-u
        if(Y<0): v=-v
        return u,v

    x,y=max(abs(X),abs(Y)),min(abs(X),abs(Y))
    if(K%2==0 and (X+Y)&1):
        print(-1)
        return

    # x+y<K
    if(x+y<K and (x+y)&1):
        print(3)
        print(*trans(x,-K+x))
        print(*trans(x+(K+x-y)//2,-(K-x-y)//2))
        print(*trans(x,y))
        return
    if(x+y<K and (not (x+y)&1)):
        print(2)
        print(*trans((x+y)//2,-K+(x+y)//2))
        print(*trans(x,y))
        return

    # x+y=K
    if(x+y==K):
        print(1)
        print(*trans(x,y))
        return
    
    # x+y>K
    c=(-x-y)%K
    n=ceil((x+y)/K)+(c&1)
    l=(K*n-x-y)//2
    print(n)
    nx,ny=K-l,-l
    print(*trans(nx,ny))
    while(nx+K<=x):
        nx+=K
        print(*trans(nx,ny))
    nx,ny=x,ny+(K-(x-nx))
    print(*trans(nx,ny))
    while(ny+K<=y):
        ny+=K
        print(*trans(nx,ny))
resolve()