Problem:
Problem G:
CarrotBreeding
にんじんは繁殖の好きな植物である.
うさぎが畑でにんじんを飼うことにした. 畑は (0, 0) と (1000000000, 1000000000) を対角線とする正方形 (boundary を含む) である. うさぎは, 2 個以上のにんじんを通るすべての直線に沿って毎日1 回ずつ水をまくことにした.
このにんじんたちは, 毎日 $N$ 回ずつ水をまかれるのが繁殖に最適だと考えているので, そのような条件を満たすようにうさぎの畑に並ぶことにした. にんじんは畑内部の格子点にしか並ぶことができない. また, そのような条件を満たす並び方が複数ある場合は, 最もにんじんの個数が少ないものを選ぶことにした.
条件を満たすにんじんの配置を1 つ出力せよ. そのような配置が存在しない場合には -1 と出力せよ.
Constraints
$N$ will be between 1 and 1,000,000, inclusive.
Input
入力は以下の形式で与えられる:
$N$
Output
条件を満たす配置が存在しない場合, -1 と一行に出力せよ.
存在する場合, にんじんの本数を $K$ とすると, 以下の形式で出力せよ:
$K$
$x_1$ $y_1$
...
$x_K$ $y_K$
Sample Input 1
4
Sample Output 1
4
0 0
1 0
2 0
1 1
Sample Input 2
6
Sample Output 2
4
0 0
0 1
1 0
1 1

Submitted solutions:

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;
#define rep(i,n) for(ll i=0;i<ll(n);i++)

ll M=1e9;

ll num(vector<pair<ll,ll>> &V){
    ll N=V.size();
    set<tuple<ll,ll,ll>> L;
    rep(i,N)rep(j,i){
        ll dx=V[i].first-V[j].first;
        ll dy=V[i].second-V[j].second;
        if(dx==0){
            L.insert({1,0,-V[i].first});
        }
        else if(dy==0){
            L.insert({0,1,-V[i].second});
        }
        else{
            ll z=dx*V[j].second-dy*V[j].first;
            ll g=gcd(dx,gcd(z,dy));
            dx/=g;
            dy=-dy/g;
            z/=g;
            if(dx<0){
                dx*=-1;
                dy*=-1;
                z*=-1;
            }
            L.insert({dx,dy,z});
        }
    }

    return L.size();
}
void print(vector<pair<ll,ll>> V){
    ll N=V.size();
    cout<<N<<endl;
    rep(i,N)cout<<V[i].first<<" "<<V[i].second<<endl;
}

void solve(ll N){
    // cout<<"========"<<N<<"=======\n";
    if(N==1){
        vector<pair<ll,ll>> V={{0,0},{1,1}};
        // cout<<num(V)<<endl;
        print(V);
        return;
    }
    else if(N==2){
        cout<<-1<<endl;
        return;
    }
    else if(N==7){
        vector<pair<ll,ll>> V={{0,0},{2,2},{3,0},{0,3},{6,0},{0,6}};
        // cout<<num(V)<<endl;
        print(V);
        return;
    }
    else if(N==9){
        vector<pair<ll,ll>> V={{0,0},{1,1},{2,2},{3,1},{2,0},{4,0}};
        // cout<<num(V)<<endl;
        print(V);
        return;
    }
    else if(N==20){
        vector<pair<ll,ll>> V={{0,0},{0,1},{0,2},{1,2},{2,2},{2,1},{2,0},{1,0}};
        // cout<<num(V)<<endl;
        print(V);
        return;
    }
    ll a=1;
    while(a*(a-1)/2<N){
        a++;
    }
    if(a*(a-1)/2-N==1||a*(a-1)/2-N==3)a++;
    ll d=a*(a-1)/2-N;
    // cout<<N<<" "<<a<<" "<<d<<" ";

    if(d==0){
        // cout<<endl;
        while(1){
            vector<pair<ll,ll>> V(a);
            set<pair<ll,ll>> S;
            S.insert({-1,-1});
            rep(i,a){
                ll y=-1,x=-1;
                while(S.count({x,y})){
                    x=rand()%M;
                    y=rand()%M;
                }
                S.insert({x,y});
                V[i]={x,y};
            }
            if(num(V)!=N)continue;
            print(V);
            return;
        }
    }

    ll A=a-1,B=0,C=0,D=0;
    while((d>=9&&(d-9)%2==0)||d>=18){
        A-=4;
        D++;
        d-=9;
    }
    while(d>=10){
        A-=3;
        C++;
        d-=5;
    }
    if(d%2!=0){
        A-=3;
        C++;
        d-=5;
    }
    while(d>0){
        A-=2;
        B++;
        d-=2;
    }
    if(A<0){
        // cerr<<N<<endl;
    }
    // cout<<A<<" "<<B<<" "<<C<<" "<<D<<endl;
    while(1){
            vector<pair<ll,ll>> V;
            V.push_back({0,0});
            set<pair<ll,ll>> S;
            rep(i,D){
                ll y=2,x=2;
                while(gcd(y,x)!=1||S.count({x,y})){
                    x=rand()%(M/10);
                    y=rand()%(M/10);
                }
                S.insert({x,y});
                ll f=M/max(x,y);
                set<ll> P;
                P.insert(-1);
                rep(k,4){
                    ll w=-1;
                    while(P.count(w))w=rand()%f+1;
                    P.insert(w);
                    V.push_back({x*w,y*w});
                }
            }
            rep(j,C){
                ll y=2,x=2;
                while(gcd(y,x)!=1||S.count({x,y})){
                    x=rand()%(M/10);
                    y=rand()%(M/10);
                }
                S.insert({x,y});
                ll f=M/max(x,y);
                set<ll> P;
                P.insert(-1);
                rep(k,3){
                    ll w=-1;
                    while(P.count(w))w=rand()%f+1;
                    P.insert(w);
                    V.push_back({x*w,y*w});
                }
            }
            rep(j,B){
                ll y=2,x=2;
                while(gcd(y,x)!=1||S.count({x,y})){
                    x=rand()%(M/10);
                    y=rand()%(M/10);
                }
                S.insert({x,y});
                ll f=M/max(x,y);
                set<ll> P;
                P.insert(-1);
                rep(k,2){
                    ll w=-1;
                    while(P.count(w))w=rand()%f+1;
                    P.insert(w);
                    V.push_back({x*w,y*w});
                }
            }
            rep(a,A){
                ll y=2,x=2;
                while(gcd(y,x)!=1||S.count({x,y})){
                    x=rand()%(M/10);
                    y=rand()%(M/10);
                }
                S.insert({x,y});
                ll f=M/max(x,y);
                set<ll> P;
                P.insert(-1);
                rep(k,1){
                    ll w=-1;
                    while(P.count(w))w=rand()%f+1;
                    P.insert(w);
                    V.push_back({x*w,y*w});
                }
            }
            if(V.size()!=a)continue;
            if(num(V)!=N)continue;
            print(V);
            return;
        }


    
}


int main(){
    
    
    // for(ll i=1;i<=10000;i++){
    //     clock_t start=clock();
    //     ll N=rand()%ll(1e6);
    //     solve(N);
    //     clock_t end=clock();
    //     cout<<fixed<<setprecision(15);
    //     cerr<<N<<" "<<"OK"<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
    // }
    // return 0;

    ll N;
    cin>>N;
    solve(N);
    
}
accuracy: 1
time_ms: 830
memory_kb: 66004
final_rank: 4

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
using ll=long long;
#define all(p) p.begin(),p.end()
const int mod=1e9+7;
/*
n角形 -> n(n-1)/2
n-1角形 -> n(n-1)/2-(n-1)
n角形の角を潰すという行為をすることで、n(n-1)/2-a ~ n(n-1)/2
が可能。ただし、aは n以下の偶数
よって、半分くらいは自明な下界を達成できる

5とかはn=5がライン(10-2-3)
7とかもn=6? 15-8を達成できる?無理そう...

一個上に対して-3や-1がかなり厳しい
9とかはいけそう 9=6(6-1)/2-6より、
N=(2a+1)a-1 (a+1) 角形に a+1個の1  　　 でn=2a+2達成
N=(2a+1)a-3 (a+1) 角形に a-3個の1,2個の2でn=2a+2達成
N=(2a-1)a-1 (a+1) 角形に a-2個の1,1個の2でn=2a+1達成
N=(2a-1)a-3 (a+1) 角形に a-3個の1,1個の3でn=2a+1達成
以上でできないのは、
N=7のみ、
これはコーナーケースで、n=7ではイージー
*/
int solve(int N);
int main(){
	int N;
	cin>>N;
	solve(N);
	/*
	rep(i,100){
		solve(i+1);
	}*/
}
int solve(int N){
	if(N==7){
		cout<<"6\n0 0\n0 3\n3 0\n2 0\n1 2\n0 4\n";
		return 0;
	}
	if(N==3){
		cout<<"3\n0 1\n0 0\n1 0\n";
		return 0;
	}
	if(N==2){
		cout<<"-1\n";
		return 0;
	}
	if(N==1){
		cout<<"2\n0 0\n1 1\n";
		return 0;
	}
	//a角形を返す
	auto f=[&](int a)->vector<pair<int,int>>{
		if(a==3){
			return {{12,0},{0,0},{0,12}};
		}
		vector<pair<int,int>> order;
		rep(i,2000) rep(j,2000){
			if(__gcd(i,j)==1){
				order.push_back({i,j});
			}
		}
		sort(all(order),[&](pair<int,int> l,pair<int,int> r){
			return l.first+l.second<r.first+r.second;
		});
		order.resize(a-2);
		sort(all(order),[&](pair<int,int> l,pair<int,int> r){
			return l.first*r.second>l.second*r.first;
		});
		int H=0;
		rep(i,a-2) H+=order[i].second;
		vector<pair<int,int>> ans={{0,0},{0,H}};
		rep(i,a-2){
			ans.push_back({ans[i+1].first+order[i].first,ans[i+1].second-order[i].second});
		}
		for(auto &x:ans) x.first*=12,x.second*=12;
		return ans;
	};
	auto g=[](pair<int,int> l,pair<int,int> r,int a,int b)->pair<int,int>{
		swap(a,b);
		return {(b*l.first+a*r.first)/(a+b),
				(b*l.second+a*r.second)/(a+b)};
	};
	int n=1;
	while(N>(n*(n-1))/2) n++;
	int M=(n*(n-1))/2;
	int diff=M-N;
	int a=n/2;
	auto p=f(a+1);
	p.push_back(p[0]);
	vector<pair<int,int>> ans;
	if(N+1==M){
		if(n%2==1){
			rep(i,a+1){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
		}else{
			rep(i,a-2){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
			ans.push_back(p[a-2]);
			ans.push_back(p[a-1]);
			ans.push_back(g(p[a-1],p[a],2,1));
			ans.push_back(g(p[a-1],p[a],1,2));
			ans.push_back(p[a]);
		}
	}
	else if(N+3==M){
		if(n%2==1){
			rep(i,a-3){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
			ans.push_back(p[a-3]);
			rep(i,2){
				ans.push_back(g(p[a-3+i],p[a-2+i],2,1));
				ans.push_back(g(p[a-3+i],p[a-2+i],1,2));
				ans.push_back(p[a-2+i]);
			}
			ans.push_back(p[a]);
		}else{
			rep(i,a-3){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
			ans.push_back(p[a-3]);
			rep(i,3){
				ans.push_back(g(p[a-3],p[a-2],3-i,i+1));
			}
			ans.push_back(p[a-2]);
			ans.push_back(p[a-1]);
			ans.push_back(p[a]);
		}
	}
	else if((M-N)%2==1){
		int X=(diff-5)/2;
		auto p=f(n-2-X);
		p.push_back(p[0]);
		rep(i,X){
			ans.push_back(p[i]);
			ans.push_back(g(p[i],p[i+1],1,1));
		}
		ans.push_back(p[X]);
		ans.push_back(g(p[X],p[X+1],2,1));
		ans.push_back(g(p[X],p[X+1],1,2));
		for(int i=X+1;i<n-2-X;i++) ans.push_back(p[i]);
	}
	else{
		int X=diff/2;
		auto p=f(n-X);
		p.push_back(p[0]);
		rep(i,X){
			ans.push_back(p[i]);
			ans.push_back(g(p[i],p[i+1],1,1));
		}
		rep(i,n-X*2) ans.push_back(p[X+i]);
	}

	// output ans
	cout<<ans.size()<<"\n";
	for(auto x:ans) cout<<x.first<<" "<<x.second<<"\n";
/*
	//output vis
	int H=0,W=0,X=0,Y=0;
	for(auto x:ans){
		if(H<x.first) H=x.first;
		if(W<x.second) W=x.second;
		X=__gcd(X,x.first);
		Y=__gcd(Y,x.second);
	}
	H/=X,W/=Y;
	vector<vector<char>> zoo(H+1,vector<char>(W+1,'.'));
	for(auto x:ans) zoo[x.first/X][x.second/Y]='#';
	for(auto x:zoo){for(auto y:x){cout<<y;}cout<<"\n";}
	cout<<endl;
*/
	/*
	//cheak
	set<array<int,3>> s;
	for(auto x:ans) for(auto y:ans){
		if(x==y) continue;
		int A=x.second-y.second;
		int B=y.first-x.first;
		int C=x.second*y.first-x.first*y.second;
		if(A<0) A*=-1,B*=-1,C*=-1;
		else if(A==0&&B<0) A*=-1,B*=-1,C*=-1;
		int D=__gcd(A,__gcd(abs(B),abs(C)));
		A/=D,B/=D,C/=D;
		s.insert({A,B,C});
	}
	cout<<N<<" "<<s.size()<<endl;
	assert(N==(int)(s.size()));
	*/
	return 0;
}
accuracy: 1
time_ms: 450
memory_kb: 54220
final_rank: 3

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
using ll=long long;
#define all(p) p.begin(),p.end()
const int mod=1e9+7;
/*
n角形 -> n(n-1)/2
n-1角形 -> n(n-1)/2-(n-1)
n角形の角を潰すという行為をすることで、n(n-1)/2-a ~ n(n-1)/2
が可能。ただし、aは n以下の偶数
よって、半分くらいは自明な下界を達成できる

5とかはn=5がライン(10-2-3)
7とかもn=6? 15-8を達成できる?無理そう...

一個上に対して-3や-1がかなり厳しい
9とかはいけそう 9=6(6-1)/2-6より、
N=(2a+1)a-1 (a+1) 角形に a+1個の1  　　 でn=2a+2達成
N=(2a+1)a-3 (a+1) 角形に a-3個の1,2個の2でn=2a+2達成
N=(2a-1)a-1 (a+1) 角形に a-2個の1,1個の2でn=2a+1達成
N=(2a-1)a-3 (a+1) 角形に a-3個の1,1個の3でn=2a+1達成
以上でできないのは、
N=7のみ、
これはコーナーケースで、n=7ではイージー
*/
int main(){
	int N;
	cin>>N;
	if(N==7){
		cout<<"7\n";
		cout<<"0 1\n";
		rep(i,6) cout<<i<<" 0\n";
		return 0;
	}
	if(N==3){
		cout<<"3\n0 1\n0 0\n1 0\n";
		return 0;
	}
	if(N==2){
		cout<<"-1\n";
		return 0;
	}
	if(N==1){
		cout<<"2\n0 0\n1 1\n";
		return 0;
	}
	//a角形を返す
	auto f=[&](int a)->vector<pair<int,int>>{
		if(a==3){
			return {{12,0},{0,0},{0,12}};
		}
		vector<pair<int,int>> order;
		rep(i,2000) rep(j,2000){
			if(__gcd(i,j)==1){
				order.push_back({i,j});
			}
		}
		sort(all(order),[&](pair<int,int> l,pair<int,int> r){
			return l.first+l.second<r.first+r.second;
		});
		order.resize(a-2);
		sort(all(order),[&](pair<int,int> l,pair<int,int> r){
			return l.first*r.second>l.second*r.first;
		});
		int H=0;
		rep(i,a-2) H+=order[i].second;
		vector<pair<int,int>> ans={{0,0},{0,H}};
		rep(i,a-2){
			ans.push_back({ans[i+1].first+order[i].first,ans[i+1].second-order[i].second});
		}
		for(auto &x:ans) x.first*=12,x.second*=12;
		return ans;
	};
	auto g=[](pair<int,int> l,pair<int,int> r,int a,int b)->pair<int,int>{
		return {(b*l.first+a*r.first)/(a+b),
				(b*l.second+a*r.second)/(a+b)};
	};
	int n=1;
	while(N>(n*(n-1))/2) n++;
	int M=(n*(n-1))/2;
	int diff=M-N;
	int a=n/2;
	auto p=f(a+1);
	p.push_back(p[0]);
	vector<pair<int,int>> ans;
	if(N+1==M){
		if(n%2==1){
			rep(i,a+1){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
		}else{
			rep(i,a-2){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
			ans.push_back(p[a-2]);
			ans.push_back(p[a-1]);
			ans.push_back(g(p[a-1],p[a],2,1));
			ans.push_back(g(p[a-1],p[a],1,2));
			ans.push_back(p[a]);
		}
	}
	else if(N+3==M){
		if(n%2==1){
			rep(i,a-3){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
			ans.push_back(p[a-3]);
			rep(i,2){
				ans.push_back(g(p[a-3+i],p[a-2+i],2,1));
				ans.push_back(g(p[a-3+i],p[a-2+i],1,2));
				ans.push_back(p[a-2+i]);
			}
			ans.push_back(p[a]);
		}else{
			rep(i,a-3){
				ans.push_back(p[i]);
				ans.push_back(g(p[i],p[i+1],1,1));
			}
			ans.push_back(p[a-3]);
			rep(i,3){
				ans.push_back(g(p[a-3],p[a-2],3-i,i+1));
			}
			ans.push_back(p[a-2]);
			ans.push_back(p[a-1]);
			ans.push_back(p[a]);
		}
	}
	else if((M-N)%2==1){
		int X=(diff-5)/2;
		auto p=f(n-2-X);
		p.push_back(p[0]);
		rep(i,X){
			ans.push_back(p[i]);
			ans.push_back(g(p[i],p[i+1],1,1));
		}
		ans.push_back(p[X]);
		ans.push_back(g(p[X],p[X+1],2,1));
		ans.push_back(g(p[X],p[X+1],1,2));
		for(int i=X+1;i<n-2-X;i++) ans.push_back(p[i]);
	}
	else{
		int X=diff/2;
		auto p=f(n-X);
		p.push_back(p[0]);
		rep(i,X){
			ans.push_back(p[i]);
			ans.push_back(g(p[i],p[i+1],1,1));
		}
		rep(i,n-X*2) ans.push_back(p[X+i]);
	}
	cout<<ans.size()<<"\n";
	for(auto x:ans) cout<<x.first<<" "<<x.second<<"\n";
}
accuracy: 0.13953488372093023
time_ms: 220
memory_kb: 35728
final_rank: 19

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;
    int x = 1;

    for(int i = 0; i < info[minus].num_3; i++){

        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,13*x*x+k);
        }
        x++;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,13*x*x+k);
        }
        x += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

       for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,13*x*x+k);
        }
        x += 1;
    }

    int rest = table[N]-dp[minus];

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,13*x*x+i);

        x += 1;
    }

    return 0;
}
accuracy: 1
time_ms: 60
memory_kb: 42292
final_rank: 2

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = 1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,10*x*x+k);
        }
        x++;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,10*x*x+k);
        }
        x += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

       for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,10*x*x+k);
        }
        x += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,10*x*x+i);

        x += 1;
    }

    return 0;
}
accuracy: 1
time_ms: 60
memory_kb: 42276
final_rank: 1

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

        y = a*x+7;
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

        y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,10*x*x+i);

        x += 1;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42292
final_rank: 6

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

        y = a*x+7;
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

        y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,10*x*x+y);

        x += 1;
        a += rand()%3+1;
        y += 2*a;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42296
final_rank: 8

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

        y = a*x+7;
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

        y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,10*x*x+y);

        x += 1;
        //a += rand()%3+1;
        y += 2*a;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42296
final_rank: 8

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

        y = a*x+7;
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

        y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,a*x*x+y);

        x += 1;
        a += rand()%3+1;
        y += 2*a;
    }

    return 0;
}
accuracy: 0.46511627906976744
time_ms: 60
memory_kb: 42276
final_rank: 14

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

        y = a*x+7;
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

        y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,y);

        x += 2;
        a += rand()%3+1;
        y += 2*a;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42292
final_rank: 6

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

    	y = a*x+7;
    	for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a+3;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

    	y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a+5;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

    	y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a+7;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,y);

        x += 2;
        a++;
        y += 2*a+11;
    }

    return 0;
}
accuracy: 0.23255813953488372
time_ms: 60
memory_kb: 42276
final_rank: 17

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

    	y = a*x+7;
    	for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

    	y = a*x+17;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

    	y = a*x+23;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a+107;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,y);

        x += 2;
        a++;
        y += 2*a;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42276
final_rank: 5

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1;
    int x = rand()%7+1,y = a*x;

    for(int i = 0; i < info[minus].num_3; i++){

    	y = a*x;
    	for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    a++;

    for(int i = 0; i < info[minus].num_4; i++){

    	y = a*x;
        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

    	y = a*x;
        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,y);
            x += 2;
            y += 2*a;
        }
        a += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a++;
    y = 2*a;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,y);

        x += 2;
        a++;
        y += 2*a;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42296
final_rank: 8

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1,b = rand()%13+1;
    int x = rand()%7+1;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += a;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += a;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += a;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a ++;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,a*x+b);

        x += 2;
        a++;
        b += a;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42296
final_rank: 8

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a = rand()%11+1,b = rand()%13+1;
    int x = rand()%7+1;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    x += 2;
    a ++;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,a*x+b);

        x += 2;
        a++;
        b += i;
    }

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42296
final_rank: 8

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

   /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a =0,b = 0;
    int x = 0;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += i;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

           printf("%d %d\n",x,a*x+b);
           x += 2;
        }
        a += 1;
        b += 2*i;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 3*i;
    }

    int rest = table[N]-dp[minus];
   // printf("rest:%d\n",rest);

    x += 2;
    //a ++;
   // x = 0;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,(rand()%7+1)*x*x+b);

        x += 1;
        //a++;
        b += 4*i;
    }



    return 0;
}
accuracy: 0.20930232558139536
time_ms: 60
memory_kb: 42292
final_rank: 18

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

   /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a =0,b = 0;
    int x = 0;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 3;
        }
        a += 1;
        b += i;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

           printf("%d %d\n",x,a*x+b);
           x += 4;
        }
        a += 1;
        b += i;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 5;
        }
        a += 1;
        b += i;
    }

    int rest = table[N]-dp[minus];
   // printf("rest:%d\n",rest);

    x += 2;
    //a ++;
   // x = 0;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,(rand()%7+1)*x*x+b);

        x += 1;
        //a++;
        b += i;
    }



    return 0;
}
accuracy: 0.23255813953488372
time_ms: 60
memory_kb: 42272
final_rank: 16

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

   /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a =0,b = 0;
    int x = 0;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

           printf("%d %d\n",x,a*x+b);
           x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    int rest = table[N]-dp[minus];
   // printf("rest:%d\n",rest);

    x += 2;
    //a ++;
   // x = 0;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,(rand()%7+1)*x*x+b);

        x += 1;
        //a++;
        b += i;
    }



    return 0;
}
accuracy: 0.46511627906976744
time_ms: 60
memory_kb: 42276
final_rank: 14

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

   /* printf("table[N]:%d\n",table[N]);
    printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d dp:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5,dp[minus]);*/

    int a =0,b = 0;
    int x = 0;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

           printf("%d %d\n",x,a*x+b);
           x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    int rest = table[N]-dp[minus];
    printf("rest:%d\n",rest);

    x += 2;
    //a ++;
   // x = 0;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,(rand()%7+1)*x*x+b);

        x += 1;
        //a++;
        b += i;
    }



    return 0;
}
accuracy: 0.046511627906976744
time_ms: 60
memory_kb: 42248
final_rank: 20

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define NUM 10000000
#define SIZE 2000005
//#define SIZE 25

struct Info{
    void set(int arg_num_3,int arg_num_4,int arg_num_5){
        num_3 = arg_num_3;
        num_4 = arg_num_4;
        num_5 = arg_num_5;
    }
    int num_3,num_4,num_5;
};

int MINUS[6] = {0,0,0,2,5,9};
int table[SIZE]; //table[i] = i本の直線を作れる最小の点の数
int dp[SIZE]; //dp[i] = マイナスiを作れる最小の点の数
Info info[SIZE]; //各iに対する、同一直線上3,4,5点の個数


int getNUM(int number){

    int L = 1,R = 4000,mid = (L+R)/2;
    int ret;

    while(L <= R){

        if((mid*(mid-1))/2 >= number){

            ret = mid;
            R = mid-1;

        }else{

            L = mid+1;
        }
        mid = (L+R)/2;
    }
    return ret;
}

int main(){

    dp[0] = 0;

    for(int i = 1; i < SIZE; i++){

        dp[i] = NUM;
        info[i].set(NUM,NUM,NUM);
    }

    info[0].set(0,0,0);

    int next_3,next_4,next_5;

    //3
    for(int i = MINUS[3]; i < SIZE; i++){

        next_3 = info[i-MINUS[3]].num_3+1;
        next_4 = info[i-MINUS[3]].num_4;
        next_5 = info[i-MINUS[3]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //4
    for(int i = MINUS[4]; i < SIZE; i++){

        next_3 = info[i-MINUS[4]].num_3;
        next_4 = info[i-MINUS[4]].num_4+1;
        next_5 = info[i-MINUS[4]].num_5;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    //5
    for(int i = MINUS[5]; i < SIZE; i++){

        next_3 = info[i-MINUS[5]].num_3;
        next_4 = info[i-MINUS[5]].num_4;
        next_5 = info[i-MINUS[5]].num_5+1;

        if(3*next_3+4*next_4+5*next_5 < dp[i]){

            dp[i] = 3*next_3+4*next_4+5*next_5;
            info[i].set(next_3,next_4,next_5);
        }
    }

    /*for(int i = 0; i < SIZE; i++){

        printf("info[%d].num_3:%d num_4:%d num_5:%d dp:%d\n",i,info[i].num_3,info[i].num_4,info[i].num_5,dp[i]);
    }*/

    table[1] = 1;
    int tmp;

    for(int i = 3; i < SIZE; i++){

        if(i == 7 || i == 9 || i == 20)continue;

        tmp = getNUM(i);

        while(true){

            if(dp[(tmp*(tmp-1))/2-i] <= tmp){

                table[i] = tmp;
                break;
            }
            tmp++;
        }
    }

    int N;
    scanf("%d",&N);

    if(N == 1){

        printf("2\n");
        printf("0 0\n");
        printf("100 100\n");

        return 0;

    }else if(N == 2){

        printf("-1\n");
        return 0;

    }else if(N == 7){

        printf("6\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        return 0;

    }else if(N == 9){

        printf("6\n");
        printf("0 0\n");
        printf("4 0\n");
        printf("1 1\n");
        printf("2 1\n");
        printf("3 1\n");
        printf("2 2\n");
        return 0;

    }else if(N == 20){

        printf("8\n");
        printf("0 0\n");
        printf("24 0\n");
        printf("12 6\n");
        printf("8 8\n");
        printf("16 8\n");
        printf("12 12\n");
        printf("11 100\n");
        printf("13 9999\n");
        return 0;
    }

    printf("%d\n",table[N]);

    int minus = (table[N]*(table[N]-1))/2-N;

    /*printf("minus:%d\n",minus);
    printf("3: %d 4:%d 5:%d\n",info[minus].num_3,info[minus].num_4,info[minus].num_5);*/

    int a =0,b = 0;
    int x = 0;

    for(int i = 0; i < info[minus].num_3; i++){
        for(int k = 0; k < 3; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_4; i++){

        for(int k = 0; k < 4; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    for(int i = 0; i < info[minus].num_5; i++){

        for(int k = 0; k < 5; k++){

            printf("%d %d\n",x,a*x+b);
            x += 2;
        }
        a += 1;
        b += 1;
    }

    int rest = table[N]-dp[minus];
    //printf("rest:%d\n",rest);

    //x += 2;
    //a ++;
   // x = 0;
    b ++;

    for(int i = 0; i < rest; i++){

        printf("%d %d\n",x,10*x*x+b);

        x += 1;
        //a++;
        b += i;
    }


    /*for(int i = 0; i < rest; i++){


        while(true){

            x = rand()*(rand()%30000)+rand()+1;
            y = rand()*(rand()%30000)+rand()+1;

            auto at = MAP.find(make_pair(x,y));
            if(at == MAP.end()){

                MAP[make_pair(x,y)] = true;
                break;
            }
        }

        printf("%d %d\n",x,y);
    }*/

    return 0;
}
accuracy: 0.4883720930232558
time_ms: 60
memory_kb: 42296
final_rank: 8