Problem:
Problem D : Numbers
n
が与えられるので、
n
個の連続した正の整数を求めよ。
ただしすべての数が、１とその数自身以外の約数をもたなくてはならない。
Input
入力は以下のフォーマットで与えられる。
n
入力は以下の制約を満たす。
1 ≤
n
≤ 1,500
Output
最初の行に、あなたが選んだ連続した
n
個の正の整数の中で一番小さいものを出力せよ。
2行目から
n+1
行目に、それぞれの値に対する約数を出力せよ。
約数は1かその数自身でなければどの値を出力しても良い。
1行目に出力した数を
x
として、i行目には
x+i-2
の約数を出力せよ。
出力する値は5,000桁を超えてはいけない。
Sample Input 1
2
Sample Output 1
8
2
3
Sample Input 2
3
Sample Output 2
8
2
3
5
Hint
Sample Output 2では、8,9,10を3個の連続した整数として選んでいる。
2行目に、8の約数として2,3行目は9の約数として3,４行目には10の約数として5,を出力している。

Submitted solutions:

code_snippet: #include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
using namespace std;

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    namespace mp = boost::multiprecision;
    using Bint = mp::cpp_int;

    int n;
    cin >> n;

    Bint fact = 1;
    for(Bint i = 1 ; i <= n + 1 ; ++i){
        fact *= i;
    }
    fact += 2;

    cout << fact << endl;
    for(int i = 0 ; i < n ; ++i){
        if(i % 2 == 0){
            cout << 2 << endl;
        }else{
            for(Bint j = 3 ; j <= fact ; ++j){
                if(fact % j == 0){
                    cout << j << endl;
                    break;
                }
            }
        }
        ++fact;
    }

    return 0;
}
accuracy: 1
time_ms: 880
memory_kb: 3292
final_rank: 11

code_snippet: #include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
ostream& operator<<(ostream& o,P p){
  return o<<"("<<p.first<<","<<p.second<<")";
}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(auto &t:a)cin>>t;return i;}
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T> void prArr(T a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


class Int{
public:
  string val;
  Int():val("0"){}
  Int(string num,bool reversed=0){if(!reversed)R(num); val = num;}
  Int(int num){val = to_string(num); R(val);}
  
  void R(string &a){reverse(a.begin(),a.end());}
  bool neg(const string &a)const{return a.back() == '-';}
  char& operator [] (int i){assert(i<(int)val.size());return val[i];}

  bool operator ==  (Int b) {R(b.val); return *this == b.val;}
  bool operator ==  (string b) {R(b);return val == b;}
  template<class T> bool operator == (T b){return *this == Int(b);}
  
  bool operator !=  (Int b) {R(b.val); return *this != b.val;}
  bool operator !=  (string b) {R(b);return !(val == b);}
  template<class T> bool operator != (T b){return *this != Int(b);}
  
  bool operator >=  (Int b) {R(b.val); return *this >= b.val;}
  bool operator >=  (string b) {return !(*this < b);}
  template<class T> bool operator >= (T b){return *this >= Int(b);}

  bool operator >   (Int b) {R(b.val); return *this > b.val;}
  bool operator >   (string b) {return *this>=b && *this != b;}
  template<class T> bool operator > (T b){return *this > Int(b);}

  bool operator <=  (Int b) {R(b.val); return *this <= b.val;}
  bool operator <=  (string b) {return *this<b || *this == b;}
  template<class T> bool operator <= (T b){return *this <= Int(b);}

  bool operator <   (Int b) {R(b.val); return *this < b.val;}
  template<class T> bool operator < (T b){return *this < Int(b);}
 
   bool operator <   (string b) {
    R(b);
    const string &a = val;
    if(neg(a) != neg(b)) return neg(a)? 1:0;
    if(a.size() != b.size()) return !neg(a)? (a.size()<b.size()):(a.size()>b.size());
    for(int i=a.size()-1;i>=0;i--)if(a[i] != b[i]) return !neg(a)? a[i] < b[i]: a[i] > b[i];
    return 0;
  }
  
  Int operator + (string b){
    R(b);
    string a = val;
    string fa = neg(a)? "-":"";
    string fb = neg(b)? "-":"";
    if(neg(a)) a.pop_back();
    if(neg(b)) b.pop_back();
    if(Int(a,1) < Int(b,1)) swap(a,b),swap(fa,fb);
    
    if(fa == fb){
      a += '0';
      for(int i=0;i<(int)a.size()-1;i++){
        if(i < (int)b.size()) a[i] += b[i]-'0';
        a[i+1] += (a[i]-'0')/10;
        a[i] = (a[i]-'0')%10 + '0';
      }
      if(a.size() > 1 && a.back() == '0') a.pop_back();
      if((int)a.size() > 1 && a.back() == '0') a.pop_back();
      if(a != "0") a += fa;
    }
    else {
      for(int i=0;i<(int)a.size();i++){
        if(i < (int)b.size()) a[i] -= b[i]-'0';
        if(a[i]-'0' < 0) a[i]+=10, a[i+1]--; 
      }
      while((int)a.size()>1 && a.back() == '0') a.pop_back();
      if(a != "0") a += fa;
    }
    return Int(a,1);
  }

  Int operator * (string b){
    R(b);
    vector<int> res;
    string a = val;
    string fa = neg(a)? "-":"";
    string fb = neg(b)? "-":"";
    if(neg(a)) a.pop_back();
    if(neg(b)) b.pop_back();
    if(a.size() < b.size()) swap(a,b), swap(fa,fb);
    if(a == "0" || b == "0") return Int("0");
    
    for(int j=0;j<(int)b.size();j++)
      for(int i=0;i<(int)a.size();i++){
        if(i+j >= (int)res.size()) res.push_back(0);
        res[i+j] += (a[i]-'0') * (b[j]-'0');
      }
    for(int i=0; i <(int)res.size(); i++) {
      if(res[i]/10 == 0) continue;
      if(i + 1 >= (int)res.size()) res.push_back(0);
      res[i+1] += res[i]/10, res[i]=res[i]%10;
    }
    string sres;
    for(int i:res) sres += char(i + '0');
    if(fa != fb) sres += '-';
    return Int(sres,1);
  }

  Int div(string b,int flg){
    assert(b != "0");
    string a = val;
    string fa = neg(a)? "-":"";
    string fb = b[0]=='-'? "-":"";
    if(neg(a)) a.pop_back();
    if(b[0]=='-') b.erase(b.begin());
    Int mod("0");
    string d="0";
    for(int i=(int)a.size()-1;i>=0;i--){
      mod = mod * 10 + (a[i] - '0');
      while(mod >= b) mod -= b, d.back()+=1;
      if(i && d != "0") d += '0'; 
    }
    if(flg == 0 && d != "0" && (fa != fb)) d = "-" + d;
    if(flg == 1 && mod != "0" && (fa == "-")) mod *= -1;
    return flg==0? d:mod;
  }
  
  Int operator + (Int b){R(b.val); return *this + b.val;}
  template<class T> Int operator + (T b){return *this + Int(b);}
  
  Int operator * (Int b){R(b.val); return *this * b.val;}
  template<class T> Int operator * (T b){return *this * Int(b);}

  Int operator - (string b){b = (b[0] == '-')? b.substr(1):"-" + b;return *this + b;}
  Int operator - (Int b){R(b.val); return *this - b.val;} 
  template<class T> Int operator - (T b){return *this - Int(b);}
  
  Int operator / (string b){return div(b,0);}
  Int operator / (Int b){R(b.val);return div(b.val,0);}
  template<class T> Int operator / (T b){return *this / Int(b);}
  
  Int operator % (string b){return div(b,1);}
  Int operator % (Int b){R(b.val);return div(b.val,1);}
  template<class T> Int operator % (T b){return *this % Int(b);}
  
  Int operator += (Int b){return *this = *this+b;}
  Int operator += (string b){return *this = *this+b;}
  template<class T> Int operator += (T b){return *this += Int(b);}
  
  Int operator -= (Int b){return *this = *this-b;}
  Int operator -= (string b){return *this = *this-b;}
  template<class T> Int operator -= (T b){return *this -= Int(b);}
  
  Int operator *= (Int b){return *this = *this*b;}
  Int operator *= (string b){return *this = *this*b;}
  template<class T> Int operator *= (T b){return *this *= Int(b);}
  
  Int operator /= (string b){return *this = *this/b;}
  Int operator /= (Int b){return *this = *this/b;}
  template<class T> Int operator /= (T b){return *this /= Int(b);}
  
  Int operator %= (string b){return *this = *this % b;}
  Int operator %= (Int b){return *this=*this%b;}
  template<class T> Int operator %= (T b){return *this %= Int(b);}
  
  Int operator ++(){return *this += 1;}
  Int operator --(){return *this -= 1;}

#ifdef int
#undef int
#define eraseIntDefine
#endif
  Int operator ++(int){
    Int tmp = *this;
    *this += 1;
    return tmp;
  }
  
  Int operator --(int){
    Int tmp = *this;
    *this -= 1;
    return tmp;
  }
#ifdef eraseIntDefine
#define int long long
#endif

  friend ostream& operator << (ostream& os,const Int a){
    for(int i=(int)a.val.size()-1;i>=0;i--) os<<a.val[i];
    return os;
  }

  friend istream& operator >> (istream& is,Int &a){
    string num;
    is>>num;
    a = Int(num);
    return is;
  }
  friend string to_string(Int a){reverse(a.val.begin(),a.val.end());return a.val;}
};


vector<int>getPrime(int n){
  vector<bool>used(n+1,0);

  for(ll i=2;i*i<=n;i++)
    if(!used[i])for(int j=2;j<=n/i;j++)used[i*j]=1;
  
  vector<int> res;
  for(int i=2;i<=n;i++)if(!used[i])res.push_back(i);

  return res;
}



signed main(){
  int n;
  cin>>n;

  Int num("1");
  for(int i=2;i<=1502;i++) num *= i;

  cout<<num+2<<endl;
  for(int i=0;i<n;i++){
    cout<<2+i<<endl;
  }

  
  return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 3412
final_rank: 7

code_snippet: #include<bits/stdc++.h>
using namespace std;

string sub1(string a){
  assert(a!="0");
  
  int as=a.size();
  int len=as+5;
  vector<int> A(len,0);
  for(int i=0;i<as;i++)A[i]=a[as-1-i]-'0';
  
  A[0]--;
  for(int i=0;i+1<len;i++){
    if(A[i]<0){
      A[i+1]--;
      A[i]+=10;
    }
    A[i+1]+=A[i]/10;
    A[i]%=10;
  }
  
  string res="";
  for(int i=len-1;i>=0;i--){
    if(res.size()==0&&A[i]==0)continue;
    res.push_back('0'+A[i]);
  }
  return res;
}

string add1(string a){
  int as=a.size();
  int len=as+5;
  vector<int> A(len,0);
  for(int i=0;i<as;i++)A[i]=a[as-1-i]-'0';
  
  A[0]++;
  for(int i=0;i+1<len;i++){
    A[i+1]+=A[i]/10;
    A[i]%=10;
  }
  string res="";
  for(int i=len-1;i>=0;i--){
    if(res.size()==0&&A[i]==0)continue;
    res.push_back('0'+A[i]);
  }
  return res;
}


string mul(string a,string b){
  if(a=="0"||b=="0")return "0";  
  int as=a.size(),bs=b.size();
  int len=as+bs;
  vector<int> A(as),B(bs),C(len);
  for(int i=0;i<as;i++)A[i]=a[as-1-i]-'0';   
  for(int i=0;i<bs;i++)B[i]=b[bs-1-i]-'0';
 
  for(int i=0;i<as;i++)
    for(int j=0;j<bs;j++)
      C[i+j]+=A[i]*B[j];
 
  for(int i=0;i+1<len;i++){
    C[i+1]+=C[i]/10;
    C[i]%=10;
  }
   
  string res="";
  for(int i=len-1;i>=0;i--){
    if(res.size()==0&&C[i]==0)continue;
    res.push_back('0'+C[i]);
  }
  return res;
}

string i2s( int x ){
  stringstream ss;
  ss<<x;
  string res;
  ss>>res;
  return res;
}

const int MAX = 10000000;
bool isP[MAX];
int isQ[MAX];

int main(){
  int n;
  cin>>n;
  
  if(n==1){
    cout<<100<<endl;
    cout<<2<<endl;
    return 0;
  }
  
  for(int i=2;i<MAX;i++){
    isP[i]=true;
    isQ[i]=i;
  }
  
  for(int i=2;i*i<MAX;i++){
    if(!isP[i])continue;
    for(int j=i*i;j<MAX;j+=i){
      isP[j]=false;
      isQ[j]=i;
    }
  }
  
  vector<int> primes;  

  for(int i=2;i<=n;i++){
    if(isP[i]){
      primes.push_back(i);
    }
  }

  string base="100";
  for(int i=0;i<(int)primes.size();i++){
    string str=i2s(primes[i]);
    base = mul ( base, str);
  }

  string X = add1(base);
  string Y = sub1(base);


  
  base = mul(X,Y);
  base = add1(base);

  
  vector<string> ans;
  ans.push_back("2");
  base=sub1(base);
  ans.push_back(X);
  for(int i=0;i<n-2;i++){
    base = sub1(base);
    ans.push_back( i2s( isQ[i+2]) );
  }
  cout<<base<<endl;
  reverse(ans.begin(),ans.end());
  for(int i=0;i<ans.size();i++)cout<<ans[i]<<endl;
  return 0;
}
accuracy: 1
time_ms: 310
memory_kb: 52096
final_rank: 10

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

bool is_prime[10000001];
int p(int n) {
	for (int i = 2;; i++) {
		if (n%i == 0)return i;
	}
}
int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= 10000000; i++) {
		if (is_prime[i]) {
			for (int j = i * 2; j <= 10000000; j += i)is_prime[j] = false;
		}
	}
	int n; scanf("%d", &n);
	int cnt = 0;
	for (int i = 4; i <= 100000000; i++) {
		if (!is_prime[i])cnt++;
		else cnt = 0;
		if (cnt == n) {
			printf("%d\n", i - cnt + 1);
			for (int j = i - cnt + 1; j <= i; j++)printf("%d\n", p(j));
			break;
		}
	}
}
accuracy: 0.43333333333333335
time_ms: 260
memory_kb: 12964
final_rank: 15

code_snippet: #include<iostream>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
bool a[10000000];
int main() {
	fill(a, a + 10000000, true);
	for (int i = 2; i < 10000000; i++) {
		if (a[i]) {
			int j = 2;
			while (i*j < 10000000) {
				a[i*j] = false;
				j++;
			}
		}
	}
	int n;
	cin >> n;
	int b=8;
	while (true) {
		for (int i = b; i < b + n; i++) {
			if (a[i]) {
				goto stop;
			}
		}
		break;
	stop:;
		b++;
	}
	cout << b << endl;
	for (int i = b; i < b + n; i++) {
		for (int j = 2; j < i; j++) {
			if (i%j == 0) {
				cout << j << endl;
				break;
			}
		}
	}
}
accuracy: 0.43333333333333335
time_ms: 340
memory_kb: 12868
final_rank: 16

code_snippet: #include<iostream>
using namespace std;
#define MAX_P 20000
int n; int dp[5010][MAX_P];
void fact(int n) {
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < MAX_P; j++) {
			dp[i][j] += dp[i - 1][j] * i;
			if (dp[i][j] >= 10) {
				dp[i][j + 1] += dp[i][j] / 10; dp[i][j] %= 10;
			}
		}
	}
	dp[n][0] += 2;
	for (int j = 0; j < MAX_P; j++) {
		if (dp[n][j] >= 10) { dp[n][j + 1] += dp[n][j] / 10; dp[n][j] %= 10; }
	}
}
int main() {
	cin >> n; fact(n + 1); int ok = 0;
	for (int i = MAX_P - 1; i >= 0; i--) {
		if (dp[n + 1][i] >= 1) { ok = 1; }
		if (ok == 1) { cout << dp[n + 1][i]; }
	}
	cout << endl;
	for (int i = 2; i < n + 2; i++) { cout << i << endl; }
	return 0;
}
accuracy: 1
time_ms: 50
memory_kb: 119868
final_rank: 12

code_snippet: #include<bits/stdc++.h>
using namespace std;


vector<int>a;

int N;
bool prime[2000];


void mul(int x){
    int up=0;
    for(int i=0;i<a.size()-1;i++){
        a[i]=a[i]*x+up;
        up=a[i]/10;
        a[i]%=10;
    }
}

void add(int x){
    int up=x;
    for(int i=0;i<a.size();i++){
        a[i]+=up;
        up=a[i]/10;
        a[i]%=10;
    }
}

void print(){
    int pos=0;
    for(int i=0;i<a.size();i++)if(a[i])pos=i;
    for(int i=pos;i>=0;i--)cout<<a[i];cout<<endl;
}

int main(){
    scanf("%d",&N);
    a.resize(5000,0);
    a[0]=1;

    fill_n(prime,2000,true);
    prime[0]=prime[1]=false;
    for(int i=2;i<2000;i++){
        if(!prime[i])continue;
        for(int j=i*2;j<2000;j+=i)prime[j]=false;
    }

    for(int i=2;i<2000;i++)if(prime[i])mul(i);

    add(2);
    print();

    for(int i=2;i<N+2;i++){
        for(int j=2;j<=i;j++)if(i%j==0){
            cout<<j<<endl;
            break;
        }
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1232
final_rank: 1

code_snippet: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(__typeof__(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}



const int MAX_D = 10000;
const long long B = 10000;
const int LB = 4;
struct Bigint {
    int size;
    long long digit[MAX_D/LB];
    
    Bigint(int size = 1, long long a = 0) : size(size) {
        memset(digit, 0, sizeof(digit));
        digit[0] = a;
    }
    Bigint normalize();
    long long tolong();
    string tostr();
    inline const Bigint& operator = (long long a);
    inline const Bigint& operator = (const string &s);
    inline const Bigint& operator += (const Bigint& x);
    inline const Bigint& operator += (long long x);
    inline const Bigint& operator -= (const Bigint& x);
    inline const Bigint& operator -= (long long x);
    inline const Bigint& operator *= (const Bigint& x);
    inline const Bigint& operator *= (long long x);
    inline const Bigint& operator /= (const Bigint& x);
    inline const Bigint& operator /= (long long x);
    inline const Bigint& operator %= (const Bigint& x);
    inline const Bigint& operator %= (long long x);
};

Bigint Bigint::normalize() {
    long long c = 0;
    for (int i = 0; i < (*this).size; ++i) {
        while ((*this).digit[i] < 0) {
            (*this).digit[i+1] -= 1;
            (*this).digit[i] += B;
        }
        long long a = (*this).digit[i] + c;
        (*this).digit[i] = a % B;
        c = a / B;
    }
    for (; c > 0; c /= B) (*this).digit[(*this).size++] = c % B;
    while ((*this).size > 1 && (*this).digit[(*this).size-1] == 0) --(*this).size;
    return *this;
}
long long Bigint::tolong() {
    long long res = 0;
    for (int i = LB; i >= 0; --i) {
        res *= B;
        res += (*this).digit[i];
    }
    return res;
}
string Bigint::tostr() {
    stringstream ss;
    ss << (*this).digit[(*this).size-1];
    for (int i = (*this).size-2; i >= 0; --i)
        ss << setw(LB) << setfill('0') << (*this).digit[i];
    return ss.str();
}
Bigint tobig(long long a) {
    return Bigint(1, a).normalize();
}
Bigint tobig(const string &s) {
    Bigint x;
    int i = s.size() % LB;
    if (i > 0) i -= LB;
    for (; i < (int)s.size(); i += LB) {
        long long a = 0;
        for (int j = 0; j < LB; ++j)
            a = 10 * a + (i + j >= 0 ? s[i+j] - '0' : 0);
        x.digit[x.size++] = a;
    }
    reverse(x.digit, x.digit+x.size);
    return x.normalize();
}
inline const Bigint& Bigint::operator = (long long a) {
    *this = tobig(a);
    return *this;
}
inline const Bigint& Bigint::operator = (const string &s) {
    *this = tobig(s);
    return *this;
}
ostream &operator << (ostream &os, Bigint x) {
    os << x.digit[x.size-1];
    for (int i = x.size-2; i >= 0; --i)
        os << setw(LB) << setfill('0') << x.digit[i];
    return os;
}
istream &operator >> (istream &is, Bigint &x) {
    string s; is >> s;
    x = tobig(s);
    return is;
} 
bool operator < (Bigint x, Bigint y) {
    if (x.size != y.size) return x.size < y.size;
    for (int i = x.size-1; i >= 0; --i)
        if (x.digit[i] != y.digit[i]) return x.digit[i] < y.digit[i];
    return false;
}
bool operator > (Bigint x, Bigint y) { 
    return y < x;
}
bool operator <= (Bigint x, Bigint y) { 
    return !(y < x); 
}
bool operator >= (Bigint x, Bigint y) { 
    return !(x < y); 
}
bool operator != (Bigint x, Bigint y) { 
    return x < y || y < x; 
}
bool operator == (Bigint x, Bigint y) { 
    return !(x < y) && !(y < x); 
}
Bigint operator + (Bigint x, Bigint y) {
    if (x.size < y.size) x.size = y.size;
    for (int i = 0; i < y.size; ++i)
        x.digit[i] += y.digit[i];
    return x.normalize();
}
Bigint operator + (Bigint x, long long y) {
    Bigint Y; Y = y;
    return x + Y;
}
Bigint operator - (Bigint x, Bigint y) {
    for (int i = 0; i < y.size; ++i)
        x.digit[i] -= y.digit[i];
    return x.normalize();
}
Bigint operator - (Bigint x, long long y) {
    Bigint Y; Y = y;
    return x - Y;
}
Bigint operator * (Bigint x, Bigint y) {
    Bigint z(x.size + y.size);
    for (int i = 0; i < x.size; ++i)
        for (int j = 0; j < y.size; ++j)
            z.digit[i+j] += x.digit[i] * y.digit[j];
    return z.normalize();
}
Bigint operator * (Bigint x, long long a) {
    for (int i = 0; i < x.size; ++i)
        x.digit[i] *= a;
    return x.normalize();
}
pair<Bigint, long long> divmod(Bigint x, long long a) {
    long long c = 0, t;
    for (int i = x.size-1; i >= 0; --i) {
        t = B * c + x.digit[i];
        x.digit[i] = t / a;
        c = t % a;
    }
    x.normalize();
    return pair<Bigint, long long>(x, c);
}
Bigint operator / (Bigint x, long long a) {
    return divmod(x, a).first;
}
long long operator % (Bigint x, long long a) {
    return divmod(x, a).second;
}
pair<Bigint, Bigint> divmod(Bigint x, Bigint y) {
    Bigint zero(1, 0);
    if (x.size < y.size) return pair<Bigint, Bigint>(zero, x);
    int F = B / (y.digit[y.size-1] + 1);
    x = x * F; y = y * F;
    Bigint z(x.size - y.size + 1);
    for (int k = z.size-1, i = x.size-1; k >= 0; --k, --i) {
        z.digit[k]  = (i+1 < x.size ? x.digit[i+1] : 0) * B + x.digit[i];
        z.digit[k] /= y.digit[y.size-1];
        Bigint t(k + y.size);
        for (int m = 0; m < y.size; ++m)
            t.digit[k+m] = z.digit[k] * y.digit[m];
        t.normalize();
        while (x < t) {
            z.digit[k] -= 1;
            for (int m = 0; m < y.size; ++m)
                t.digit[k+m] -= y.digit[m];
            t.normalize();
        }
        x = x - t;
    }
    return pair<Bigint, Bigint>(z.normalize(), x / F);
}
Bigint operator / (Bigint x, Bigint y) {
    return divmod(x, y).first;
}
Bigint operator % (Bigint x, Bigint y) {
    return divmod(x, y).second;
}
Bigint power(Bigint x, long long n) {
    Bigint res(1, 1);
    while (n > 0) {
        if (n & 1) res = res * x;
        x = x * x;
        n >>= 1;
    }
    return res;
}
inline const Bigint& Bigint::operator += (const Bigint& x) {*this = *this + x; return *this;}
inline const Bigint& Bigint::operator += (long long x) {*this = *this + x; return *this;}
inline const Bigint& Bigint::operator -= (const Bigint& x) {*this = *this - x; return *this;}
inline const Bigint& Bigint::operator -= (long long x) {*this = *this + x; return *this;}
inline const Bigint& Bigint::operator *= (const Bigint& x) {*this = *this * x; return *this;}
inline const Bigint& Bigint::operator *= (long long x) {*this = *this * x; return *this;}
inline const Bigint& Bigint::operator /= (const Bigint& x) {*this = *this / x; return *this;}
inline const Bigint& Bigint::operator /= (long long x) {*this = *this / x; return *this;}
inline const Bigint& Bigint::operator %= (const Bigint& x) {*this = *this % x; return *this;}
inline const Bigint& Bigint::operator %= (long long x) {*this = *this % x; return *this;}



int n;

int main() {
    cin >> n;
    Bigint res; res = 1;
    for (ll i = 1; i <= n+1; ++i) {
        res *= i;
    }
    res += 2;
    cout << res << endl;
    for (int i = 2; i <= n+1; ++i) cout << i << endl;
    
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1320
final_rank: 4

code_snippet: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const int FACT_MAX = 1500;

void multiply(int res[5001],int num){
  int carry = 0;
  for(int i=0;i<5001;i++){
    int sum = res[i] * num + carry;
    carry = sum / 10;
    res[i] = sum % 10;
  }
}

void add(int res[5001],int num){

  int tmp[5001];
  memset(tmp,0,sizeof(tmp));

  for(int i=0;i<5001;i++){
    tmp[i] = num % 10;
    num /= 10;
  }
  
  int carry = 0;
  for(int i=0;i<5001;i++){
    res[i] += tmp[i] + carry;
    carry = res[i] / 10;
    res[i] %= 10;
  }
}

void printNum(int res[5001]){
  bool flag = false;
  for(int i=5000;i>=0;i--){
    if(res[i] != 0){
      flag = true;
    }
    if(flag){
      printf("%d",res[i]);
    }
  }
  printf("\n");
}

int main(){

  int n;
  while(~scanf("%d",&n)){
    int res[5001];
    memset(res,0,sizeof(res));
    res[0] = 1;
    for(int i=1;i<=FACT_MAX;i++){
      multiply(res,i);
    }

    add(res,2);
    printNum(res);
    for(int i=0;i<n;i++){
      printf("%d\n",i+2);
    }
  }
}
accuracy: 1
time_ms: 30
memory_kb: 1236
final_rank: 5

code_snippet: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const int FACT_MAX = 1550;

void multiply(int res[5001],int num){
  int carry = 0;
  for(int i=0;i<5001;i++){
    int sum = res[i] * num + carry;
    carry = sum / 10;
    res[i] = sum % 10;
  }
}

void add(int res[5001],int num){

  int tmp[5001];
  memset(tmp,0,sizeof(tmp));

  for(int i=0;i<5001;i++){
    tmp[i] = num % 10;
    num /= 10;
  }
  
  int carry = 0;
  for(int i=0;i<5001;i++){
    res[i] += tmp[i] + carry;
    carry = res[i] / 10;
    res[i] %= 10;
  }
}

void printNum(int res[5001]){
  bool flag = false;
  for(int i=5000;i>=0;i--){
    if(res[i] != 0){
      flag = true;
    }
    if(flag){
      printf("%d",res[i]);
    }
  }
  printf("\n");
}

int main(){

  int n;
  while(~scanf("%d",&n)){
    int res[5001];
    memset(res,0,sizeof(res));
    res[0] = 1;
    for(int i=1;i<=FACT_MAX;i++){
      multiply(res,i);
    }

    printNum(res);
    for(int i=0;i<n;i++){
      printf("%d\n",i+2);
    }
  }
}
accuracy: 0.03333333333333333
time_ms: 20
memory_kb: 1220
final_rank: 18

code_snippet: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const int FACT_MAX = 1500;

void multiply(int res[5001],int num){
  int carry = 0;
  for(int i=0;i<5001;i++){
    int sum = res[i] * num + carry;
    carry = sum / 10;
    res[i] = sum % 10;
  }
}

void add(int res[5001],int num){

  int tmp[5001];
  memset(tmp,0,sizeof(tmp));

  for(int i=0;i<5001;i++){
    tmp[i] = num % 10;
    num /= 10;
  }
  
  int carry = 0;
  for(int i=0;i<5001;i++){
    res[i] += tmp[i] + carry;
    carry = res[i] / 10;
    res[i] %= 10;
  }
}

void printNum(int res[5001]){
  bool flag = false;
  for(int i=5000;i>=0;i--){
    if(res[i] != 0){
      flag = true;
    }
    if(flag){
      printf("%d",res[i]);
    }
  }
  printf("\n");
}

int main(){

  int n;
  while(~scanf("%d",&n)){
    int res[5001];
    memset(res,0,sizeof(res));
    res[0] = 1;
    for(int i=1;i<=FACT_MAX;i++){
      multiply(res,i);
    }

    printNum(res);
    for(int i=0;i<n;i++){
      printf("%d\n",i+2);
    }
  }
}
accuracy: 0.03333333333333333
time_ms: 30
memory_kb: 1220
final_rank: 19

code_snippet: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstring>

using namespace std;

typedef long long lli;

const int DIGITS = 1000;
const int BASE = 100000;
const int BD = 5;

class BigNum{
  lli val[DIGITS], tmp[DIGITS];
  int dig;
public:
  BigNum(){
    dig = 1;
    memset(val, 0, sizeof(val));
  }
  BigNum(lli x){
    dig = 0;
    for(int i=0;i<DIGITS;++i){
      if(x == 0) val[i] = 0;
      else{
        ++dig;
        val[i] = x % BASE;
        x /= BASE;
      }
    }
  }

  void operator + (const lli x){
    val[0] += x;
    for(int i=0;i<DIGITS;++i){
      val[i+1] += val[i] / BASE;
      val[i] %= BASE;
      if(val[i]) dig = i + 1;
    }
  }

  void operator * (const lli x){
    for(int i=0;i<DIGITS;++i) val[i] *= x;
    for(int i=0;i<DIGITS;++i){
      val[i+1] += val[i] / BASE;
      val[i] %= BASE;
      if(val[i]) dig = i + 1;
    }
  }

  string toString(){
    string res;
    for(int i=0;i<dig;++i){
      for(int j=0;j<BD;++j){
        res.push_back(val[i]%10 + '0');
        val[i] /= 10;
      }
    }
    int size;
    for(size=res.size();size>1&&res[size-1]=='0';--size);
    res = res.substr(0, size);
    reverse(res.begin(), res.end());
    return res;
  }
};

main(){
  int n;
  cin >> n;
  BigNum x = BigNum(1);
  for(int i=2;i<=n+1;++i) x * i;
  x + 2;
  cout << x.toString() << endl;
  for(int i=0;i<n;i++) cout << i+2 << endl;
}
accuracy: 1
time_ms: 10
memory_kb: 1244
final_rank: 2

code_snippet: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstring>

using namespace std;

typedef long long lli;

const int DIGITS = 1000;
const int BASE = 100000;
const int BD = 5;

class BigNum{
  lli val[DIGITS], tmp[DIGITS];
  int dig;
public:
  BigNum(){
    dig = 1;
    memset(val, 0, sizeof(val));
  }
  BigNum(lli x){
    dig = 0;
    for(int i=0;i<DIGITS;++i){
      if(x == 0) val[i] = 0;
      else{
        ++dig;
        val[i] = x % BASE;
        x /= BASE;
      }
    }
  }

  void operator + (const lli x){
    val[0] += x;
    for(int i=0;i<DIGITS;++i){
      val[i+1] += val[i] / BASE;
      val[i] %= BASE;
      if(val[i]) dig = i + 1;
    }
  }

  void operator * (const lli x){
    for(int i=0;i<DIGITS;++i) val[i] *= x;
    for(int i=0;i<DIGITS;++i){
      val[i+1] += val[i] / BASE;
      val[i] %= BASE;
      if(val[i]) dig = i + 1;
    }
  }

  void print(){
    vector<char> t;
    for(int i=0;i<dig;++i){
      for(int j=0;j<BD;++j){
        t.push_back(val[i]%10 + '0');
        val[i] /= 10;
      }
    }
    while(t.back() == '0') t.pop_back();
    reverse(t.begin(), t.end());
    for(int i=0;i<t.size();++i) cout << t[i];
    cout << endl;
  }
};

main(){
  int n;
  cin >> n;
  BigNum x = BigNum(1);
  for(int i=2;i<=n+1;++i) x * i;
  x + 2;
  x.print();
  for(int i=0;i<n;i++) cout << i+2 << endl;
}
accuracy: 1
time_ms: 10
memory_kb: 1252
final_rank: 3

code_snippet: #include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int n;
bool prime[50000001];

void seive(){
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i<=50000000;i++){
		if(prime[i]){
			for(int j=i*2;j<=50000000;j+=i)prime[j]=false;
		}
	}
}

int main(void){
	scanf("%d",&n);
	seive();
	int res=-1,cnt=0;
	for(int i=4;i<=50000000;i++){
		if(!prime[i]){
			cnt++;
			if(cnt>=n){
				res=i-n+1;
				break;
			}
		}
		else cnt=0;
	}
	//if(res==-1)printf("no answer\n");
	printf("%d\n",res);
	for(int i=res;i<res+n;i++){
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				printf("%d\n",j);
				break;
			}
		}
	}
	return 0;
}
accuracy: 0.4666666666666667
time_ms: 900
memory_kb: 50024
final_rank: 13

code_snippet: #include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int n;
bool prime[5000001];

void seive(){
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i<=5000000;i++){
		if(prime[i]){
			for(int j=i*2;j<=5000000;j+=i)prime[j]=false;
		}
	}
}

int main(void){
	scanf("%d",&n);
	seive();
	int res=-1,cnt=0;
	for(int i=4;i<=5000000;i++){
		if(!prime[i]){
			cnt++;
			if(cnt>=n){
				res=i-n+1;
				break;
			}
		}
		else cnt=0;
	}
	//if(res==-1)printf("no answer\n");
	printf("%d\n",res);
	for(int i=res;i<res+n;i++){
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				printf("%d\n",j);
				break;
			}
		}
	}
	return 0;
}
accuracy: 0.43333333333333335
time_ms: 40
memory_kb: 6076
final_rank: 14

code_snippet: #include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int n;
bool prime[5000001];

void seive(){
	memset(prime,true,sizeof(prime));
	prime[0]=prime[1]=false;
	for(int i=2;i<=500000;i++){
		if(prime[i]){
			for(int j=i*2;j<=500000;j+=i)prime[j]=false;
		}
	}
}

int main(void){
	scanf("%d",&n);
	seive();
	int res=-1,cnt=0;
	for(int i=2;i<=5000000;i++){
		if(!prime[i]){
			cnt++;
			if(cnt>=n){
				res=i-n+1;
				break;
			}
		}
		else cnt=0;
	}
	if(res==-1)printf("no answer\n");
	printf("%d\n",res);
	for(int i=res;i<res+n;i++){
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				printf("%d\n",j);
				break;
			}
		}
	}
	return 0;
}
accuracy: 0.16666666666666666
time_ms: 10
memory_kb: 6080
final_rank: 17

code_snippet: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

typedef complex<double> Complex;

struct Long {
  static const long long BASE = 10000;
  static const int BW = 4;
  vector<long long> digits;
  Long(long long a = 0) {
    digits.push_back(a);
    Normalize();
  }
  Long(const string &str) {
    if (str.length() == 0) {
      digits.push_back(0);
    } else {
      int s = str[0] != '-' ? 1 : -1;
      int sw = s == -1 ? 1 : 0;
      digits = vector<long long>((str.size() - 1 - sw) / BW + 1);
      int i = (str.size() - sw) % BW;
      int index = digits.size() - 1;
      if (i > 0) { i -= BW; }
      for (; i < (int)str.size() - sw; i+= BW) {
        long long a = 0;
        for (int j = 0; j < BW; j++) {
          a = 10 * a + (i + j + sw >= sw ? str[i + j + sw] - '0' : 0);
        }
        digits[index--] = a * s;
      }
    }
    Normalize();
  }
  void resize(int s) { digits.resize(s); }
  int size() const { return digits.size(); } // size of vector of digits
  int size2() const {           // number of digits
    return abs().toString().size();
  }
  int sign() const { return digits[digits.size() - 1] > 0 ? 1 : (digits[digits.size() - 1] < 0 ? -1 : 0); }
  string toString() const {
    int s = sign();
    ostringstream os;
    os << digits[size() - 1];
    for (int i = size() - 2; i >= 0; i--)
      os << setw(Long::BW) << setfill('0') << digits[i] * s;
    return os.str();
  }
  Long abs() const {
    Long ret = *this;
    return ret.sign() >= 0 ? ret : -ret;;
  }
  long long operator[](int index) const { return digits[index]; }
  long long &operator[](int index) { return digits[index]; }
  bool operator<(const Long &rhs) const {
    const Long &lhs = *this;
    if (lhs.sign() != rhs.sign()) { return lhs.sign() < rhs.sign(); }
    if (lhs.size() != rhs.size()) { return lhs.sign() > 0 ? lhs.size() < rhs.size() : lhs.size() > rhs.size(); }
    for (int i = lhs.size() - 1; i >= 0; i--) {
      if (lhs[i] != rhs[i]) { return lhs[i] < rhs[i]; }
    }
    return false;
  }
  bool operator>(const Long &rhs) const { return rhs < *this; }
  bool operator<=(const Long &rhs) const { return !(rhs < *this); }
  bool operator>=(const Long &rhs) const { return !(*this < rhs); }
  bool operator!=(const Long &rhs) const { return *this < rhs || rhs < *this; }
  bool operator==(const Long &rhs) const { return !(*this < rhs) && !(rhs < *this); }

  Long &Normalize() {
    int s = 1;
    while (digits[size() - 1] <= -BASE) {
      ll v = digits[size() - 1] / BASE;
      digits.push_back(v);
      digits[size() - 2] -= v * BASE;
    }     
    for (int i = 0; i < size(); i++) {
      if (i == size() - 1 && digits[i] < 0) {
        goto minus;
      } else if (digits[i] < 0) {
        long long a = -((digits[i] + 1) / BASE) + 1;
        digits[i] = a * BASE + digits[i];
        digits[i + 1] -= a;
      } else if (digits[i] >= BASE) {
        if (i == size() - 1) { digits.push_back(0); }
        long long a = digits[i] / BASE;
        digits[i] = digits[i] % BASE;
        digits[i + 1] += a;
      }
      assert(0 <= digits[i] && digits[i] < BASE);
      if (digits[i] != 0) { s = i + 1; }
    }
    assert(0 <= digits[s - 1] && digits[s - 1] < BASE);
    assert(s == 1 || digits[s - 1] != 0);
    resize(s);
    return *this;
minus:
    s = 1;
    for (int i = size() - 2; i >= 0; i--) {
      digits[i + 1] += 1;
      digits[i] -= BASE;
      if (digits[i + 1] != 0) { s = max(s, i + 2); }
      assert(digits[i + 1] <= 0);
      assert(digits[i] <= 0);
    }
    resize(s);
    return *this;
  }
  Long operator+(const Long &rhs) const {
    Long ret = *this;
    if (ret.size() < rhs.size()) { ret.resize(rhs.size()); }
    for (int i = 0; i < rhs.size(); i++) { ret[i] += rhs[i]; }
    return ret.Normalize();
  }
  Long operator-(const Long &rhs) const {
    //assert(*this >= rhs);
    Long ret = *this;
    if (ret.size() < rhs.size()) { ret.resize(rhs.size()); }
    for (int i = 0; i < rhs.size(); i++) { ret[i] -= rhs[i]; }
    return ret.Normalize();
  }
  Long operator*(const Long &rhs) const {
    const Long &lhs = *this;
    Long ret;
    ret.resize(this->size() + rhs.size());
    for (int i = 0; i < lhs.size(); i++) {
      for (int j = 0; j < rhs.size(); j++) {
        ret[i + j] += lhs[i] * rhs[j];
      }
    }
    return ret.Normalize();
  }
  Long operator/(const Long &rhs) const {
    return this->divmod(rhs).first;
  }
  Long operator%(const Long &rhs) const {
    return this->divmod(rhs).second;
  }
  Long operator-() const {
    return *this * -1;
  }
  Long &operator+=(const Long &rhs) {
    return *this = *this + rhs;
  }
  Long &operator-=(const Long &rhs) {
    return *this = *this - rhs;
  }
  Long &operator*=(const Long &rhs) {
    return *this = *this * rhs;
  }
  Long &operator/=(const Long &rhs) {
    return *this = *this / rhs;
  }
  Long &operator/=(long long rhs) {
    return *this = *this / rhs;
  }
  Long &operator%=(const Long &rhs) {
    return *this = *this % rhs;
  }
  pair<Long, long long> divmodll(long long rhs) const {
    Long ret = *this;
    long long c = 0;
    long long t;
    for (int i = ret.size() - 1; i >= 0; i--) {
      t = BASE * c + ret[i];
      ret[i] = t / rhs;
      c = t % rhs;
    }
    return make_pair(ret.Normalize(), c);
  }
  pair<Long, Long> divmod(Long rhs) const {
    Long lhs = *this;
    if (lhs.size() < rhs.size()) { return pair<Long, Long>(0, lhs); }
    int s = lhs.sign() * rhs.sign();
    lhs = lhs.abs(); rhs = rhs.abs();
    long long F = BASE / (rhs[rhs.size() - 1] + 1);  // multiplying good-factor
    lhs = lhs * F; rhs = rhs * F;
    Long ret;
    ret.resize(lhs.size() - rhs.size() + 1);
    for (int k = ret.size() - 1, i = lhs.size() - 1; k >= 0; k--, i--) {
      ret[k] = (i + 1 < lhs.size() ? lhs[i + 1] : 0) * BASE + lhs[i];
      ret[k] /= rhs[rhs.size() - 1];
      Long t;
      t.resize(k + rhs.size());
      for (int m = 0; m < rhs.size(); m++) {
        t[k + m] = ret[k] * rhs[m];
      }
      t.Normalize();
      while (lhs < t) {
        ret[k] -= 1;
        for (int m = 0; m < rhs.size(); m++) {
          t[k + m] -= rhs[m];
        }
        t.Normalize();
      }
      lhs = lhs - t;
    }
    return make_pair(ret.Normalize() * s, lhs.divmodll(F).first * s);
  }
  Long &multen(int a) { // for LongFloat
    if (a > 0) {
      vector<long long> tmp(a/4);
      FOR(it, digits) tmp.push_back(*it);
      digits = tmp;
      *this *= Long(pow(10,a%4));
    }
    if (a < 0) {
      vector<long long> tmp;
      for (int i=-a/4; i<size(); ++i) {
        tmp.push_back(digits[i]);
      }
      digits = tmp;
      *this /= pow(10,-a%4);
    }
    return *this;
  }
};
ostream &operator<<(ostream &os, const Long &rhs) {
  os << rhs.toString();
  return os;
}
istream &operator>>(istream &is, Long &rhs) {
  string s;
  is >> s;
  rhs = Long(s);
  return is;
}
pair<Long, long long> divmodll(const Long &lhs, long long &rhs) {
  return lhs.divmodll(rhs);
}
pair<Long, Long> divmod(const Long &lhs, const Long &rhs) {
  return lhs.divmod(rhs);
}

// ax+by=gcd(a,b)
Long extgcd(const Long &a, const Long &b, Long &x, Long &y) {
  Long g = a;
  x = 1; y = 0;
  if (b != 0) {
    g = extgcd(b, a%b, y, x);
    y -= (a/b) * x;
  }
  return g;
}
 
Long ChineseRemainderTheorem(const vector<Long> &B, const vector<Long> &M) {
  Long all(1);
  FOR(it, M) all*=*it;
  Long res;
  REP(i,B.size()) {
    Long x,y;
    extgcd(M[i], all/M[i], x, y);
    y = (y+all)%all;
    res = (res + B[i]*y*(all/M[i]) % all) % all;
    assert(res >= 0);
  }
  return res;
}

const int N = 100000;
bool prime[N];
int p[N];
int a[2000];

int main() {
  for (int i=2; i<N; ++i) prime[i]=1;
  int ct=0;
  REP(i,N) if (prime[i]) {
    p[ct++] = i;
    for (int j=i*2; j<N; j+=i)
      prime[j]=0;
  }
  
  int n;
  while(cin >> n) {
    memset(a,0,sizeof(a));
    int c = 0;
    vector<Long> b,m;
    REP(i,n) if (a[i] == 0) {
      if (i) {
        b.push_back(Long(((-i%p[c])+p[c])%p[c]));
        m.push_back(Long(p[c]));
      } else {
        b.push_back(Long(0));
        m.push_back(Long(4));
      }
      for (int j=i; j<n; j+=p[c])
        a[j] = p[c];
      c++;
    }
    cout << ChineseRemainderTheorem(b,m) << endl;
    REP(i,n) cout << a[i] << endl;
  }
}
accuracy: 1
time_ms: 250
memory_kb: 1488
final_rank: 9

code_snippet: #include<iostream>
#include<vector>
#include<algorithm>

#define pb push_back
#define clr clear()
#define sz size()
#define FOR(i,a) for(int i=0;i<(int)(a);i++)

using namespace std;

typedef vector<int> vi;

struct BigInt{
  vi v;
  int s;

  BigInt(void){v.clr;s=0;}
  
  BigInt(int x){
    v.clr; s = 1;
    if(!x)s = 0;
    else if(x<0){
      s = -1;
      x *= -1;
    }
    while(x){
      v.pb(x%10);
      x/=10;
    }
  }

  BigInt(string &x){
    int a = 0;
    v.clr; s = 1;
    if(x[0]=='-'){
      s = -1;
      a = 1;
    }else if(x[0]=='0')s = 0;
    for(int i=x.sz-1;i>=a;i--)v.pb(x[i]-'0');
  }

  BigInt nega(void){
    BigInt t = *this;
    t.s *= -1;
    return t;
  }

  BigInt abs(void){
    if(s<0)return this->nega();
    return *this;
  }

  string bitos(void){
    if(!s)return "0";
    string res;
    FOR(i,v.sz)res += v[i]+'0';
    reverse(res.begin(),res.end());
    return (s<0)?('-'+res):res;
  }

  BigInt operator+(BigInt a){
    if(!s)return a;
    if(!a.s)return *this;
    if(s==a.s){
      if(a.v.sz < v.sz)return a+(*this);
      FOR(i,v.sz)a.v[i] += v[i];
      FOR(i,a.v.sz-1)
	if(a.v[i]>9){
	  a.v[i] -= 10;
	  a.v[i+1]++;
	}

      if(a.v[a.v.sz-1]>9){
	a.v[a.v.sz-1] -= 10;
	a.v.pb(1);
      }
      return a;
    }else{
      if(s<0)return a-(*this).nega();
      else return (*this)-a.nega();
    }
  }
  
  BigInt operator-(BigInt a){
    if(!s)return a.nega();
    if(!a.s)return *this;   
    if(s==a.s){
      if(a.abs() > this->abs())return (a-(*this)).nega();
      BigInt b = *this;
      FOR(i,a.v.sz)b.v[i] -= a.v[i];
      FOR(i,b.v.sz-1)
	if(b.v[i]<0){
	  b.v[i] += 10;
	  b.v[i+1]--;
	}

      while(b.v.sz && !b.v.back())b.v.pop_back();
      if(b.v.empty())b.s=0;
      return b;
    }else return (*this)+a.nega();
  }

  BigInt operator*(BigInt a){
    if(!s)return *this;
    if(!a.s)return a;

    BigInt b(0),tmp;    
    FOR(i,a.v.sz){
      tmp = *this;
      FOR(j,tmp.v.sz)tmp.v[j] *= a.v[i];
   
      FOR(j,tmp.v.sz){
	if(i+j<b.v.sz)b.v[i+j] += tmp.v[j];
	else b.v.pb(tmp.v[j]);
      }
    }

    FOR(i,b.v.sz){
      if(b.v[i]>9){
	if(i+1<b.v.sz)b.v[i+1] += b.v[i]/10;
	else b.v.pb(b.v[i]/10);
	b.v[i] %= 10;
      }
    }
    b.s = s*a.s;
    return b;
  }

  void operator=(BigInt a){v = a.v;s = a.s;}

  bool operator==(BigInt a){
    if(s!=a.s)return false;
    if(!s)return true;
    if(v.sz!=a.v.sz)return false;
    FOR(i,v.sz)if(v[i]!=a.v[i])return false;
    return true;
  }

  bool operator<(BigInt a){
    if(s!=a.s)return s<a.s;
    if(!s)return false;
    int d = v.sz - a.v.sz;
    if(d)return 0>d*s;
    for(int i=v.sz-1;i>=0;i--){
      d = v[i] - a.v[i];
      if(d)return 0>d*s;
    }
    return false;
  }

  bool operator<=(BigInt a){return (*this==a)||(*this<a);}
  bool operator>(BigInt a){return !(*this<=a);}
  bool operator>=(BigInt a){return !(*this<a);}
};

int main(){
  int n;
  BigInt ans(1);

  for(int i=2;i<=1501;i++)ans = ans * BigInt(i);
  ans = ans + BigInt(2);

  cin >> n;
  cout << ans.bitos() << endl;
  for(int i=0;i<n;i++)cout << i+2 << endl;
}
accuracy: 1
time_ms: 40
memory_kb: 1344
final_rank: 6

code_snippet: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

const int MAX_PRIME = 10000000;
int prime[MAX_PRIME+1];
bool isPrime[MAX_PRIME+1];
int p;
void erats(){
  // primeリストを初期化
  fill(isPrime,isPrime+MAX_PRIME,true);
  p=0;
  isPrime[0]=isPrime[1]=false;
  for(int i=2;i<=MAX_PRIME;i++){
    if(isPrime[i]){
      prime[p++]=i;
      // ふるいにかける
      for(int j=2*i;j<=MAX_PRIME;j+=i)isPrime[j] = false;
    }
  }
}


string add(string str1,string str2){
  string str;
  int carry = 0;
  for(int i = 0; i < max(str1.size(),str2.size()); i++){
    if(i >= str1.size()){
      int ret = carry + str2[str2.size()-1-i] - '0';
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
    else if(i >= str2.size()){
      int ret = carry + str1[str1.size()-1-i] - '0';
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
    else{
      int ret = str1[str1.size()-1-i] + str2[str2.size()-1-i] - '0' - '0' + carry;
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
  }
  str+=(carry+'0');
  // 破壊的変更
  reverse(str.begin(),str.end());
  // 先頭の0を消す
  int idx;
  for(int i = 0; i < str.size(); i++){
    idx=i;
    if(str[i]!='0'||str.size()-1==i)
      break;
  }
  return str.substr(idx);
}
string mul(string str1,string str2){
  int base=0;
  string ret="0";
  for(int j = str2.size()-1; j >= 0; j--){
    string str;
    int carry = 0;
    for(int i = str1.size()-1; i >=0; i--){
      int ret = (str1[i]-'0')*(str2[j] - '0') + carry;
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
    str+=(carry+'0');
    // 破壊的変更
    reverse(str.begin(),str.end());
    // 先頭の0を消す
    int idx;
    for(int i = 0; i < str.size(); i++){
      idx=i;
      if(str[i]!='0'||str.size()-1==i)
        break;
    }
    str=str.substr(idx);
    for(int i = 0; i < base; i++){
      str+='0';
    }
    ret=add(ret,str);
    base++;
  }
  return ret;
}

int N;
int main(){
  cin>>N;
  string s="1";
  for(int i=1;i<=N+1;i++){
    stringstream ss;
    ss<<i;
    s=mul(s,ss.str());
  }
  s=add(s,"2");
  cout<<s<<endl;
  for(int i=2;i<=N+1;i++)
    cout<<i<<endl;
  return 0;
}
accuracy: 1
time_ms: 140
memory_kb: 1296
final_rank: 8