Language: C++

#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef LL long long;
typedef pair<LL,LL> pii;
vector<pii> ans;
int k,x,y;

pii calc(LL x,LL y)
{
	if(x>y) {
		pii t=calc(y,x);
		return (pii) {t.se,t.fi};
	}
	if(x<0) {
		pii t=calc(-x,y);
		return (pii) {-t.fi,t.se};
	}
	if(x+y>=2*k) {
		return (pii) {x,y-k};
	}
	if(x+y==k) return (pii) {0,0};
	return (pii) {-k+(x+y)/2,x+y-(x+y)/2};
}

int main()
{
	cin>>k>>x>>y;
	if(k%2==0&&(x+y)%2==1) {
		puts("-1");
		return 0;
	}
	pii tmp=(pii) {x,y};
	ans.push_back(tmp);
	while(tmp.fi&&tmp.se) ans.push_back(tmp=calc(tmp.fi,tmp.se));
	printf("%lld\n",ans.size()-1);
	for(int i=ans.size()-2;i>-1;--i) printf("%lld %lld\n",ans[i].fi,ans[i].se);
}

Compiler output:
a.cc:6:9: error: 'LL' does not name a type
    6 | typedef LL long long;
      |         ^~
a.cc:7:14: error: 'LL' was not declared in this scope
    7 | typedef pair<LL,LL> pii;
      |              ^~
a.cc:7:17: error: 'LL' was not declared in this scope
    7 | typedef pair<LL,LL> pii;
      |                 ^~
a.cc:7:19: error: template argument 1 is invalid
    7 | typedef pair<LL,LL> pii;
      |                   ^
a.cc:7:19: error: template argument 2 is invalid
a.cc:11:10: error: 'LL' was not declared in this scope
   11 | pii calc(LL x,LL y)
      |          ^~
a.cc:11:15: error: 'LL' was not declared in this scope
   11 | pii calc(LL x,LL y)
      |               ^~
a.cc:11:19: error: expression list treated as compound expression in initializer [-fpermissive]
   11 | pii calc(LL x,LL y)
      |                   ^
a.cc: In function 'int main()':
a.cc:35:27: error: too many initializers for 'pii' {aka 'int'}
   35 |         pii tmp=(pii) {x,y};
      |                           ^
a.cc:2:12: error: request for member 'first' in 'tmp', which is of non-class type 'pii' {aka 'int'}
    2 | #define fi first
      |            ^~~~~
a.cc:37:19: note: in expansion of macro 'fi'
   37 |         while(tmp.fi&&tmp.se) ans.push_back(tmp=calc(tmp.fi,tmp.se));
      |                   ^~
a.cc:3:12: error: request for member 'second' in 'tmp', which is of non-class type 'pii' {aka 'int'}
    3 | #define se second
      |            ^~~~~~
a.cc:37:27: note: in expansion of macro 'se'
   37 |         while(tmp.fi&&tmp.se) ans.push_back(tmp=calc(tmp.fi,tmp.se));
      |                           ^~
a.cc:2:12: error: request for member 'first' in 'tmp', which is of non-class type 'pii' {aka 'int'}
    2 | #define fi first
      |            ^~~~~
a.cc:37:58: note: in expansion of macro 'fi'
   37 |         while(tmp.fi&&tmp.se) ans.push_back(tmp=calc(tmp.fi,tmp.se));
      |                                                          ^~
a.cc:3:12: error: request for member 'second' in 'tmp', which is of non-class type 'pii' {aka 'int'}
    3 | #define se second
      |            ^~~~~~
a.cc:37:65: note: in expansion of macro 'se'
   37 |         while(tmp.fi&&tmp.se) ans.push_back(tmp=calc(tmp.fi,tmp.se));
      |                                                                 ^~
a.cc:37:67: error: 'calc' cannot be used as a function
   37 |         while(tmp.fi&&tmp.se) ans.push_back(tmp=calc(tmp.fi,tmp.se));
      |                                                                   ^
a.cc:2:12: error: request for member 'first' in 'ans.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    2 | #define fi first
      |            ^~~~~
a.cc:39:70: note: in expansion of macro 'fi'
   39 |         for(int i=ans.size()-2;i>-1;--i) printf("%lld %lld\n",ans[i].fi,ans[i].se);
      |                                                                      ^~
a.cc:3:12: error: request for member 'second' in 'ans.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    3 | #define se second
      |            ^~~~~~
a.cc:39:80: note: in expansion of macro 'se'
   39 |         for(int i=ans.size()-2;i>-1;--i) printf("%lld %lld\n",ans[i].fi,ans[i].se);
      |                                                                                ^~