akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end());
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e3;
int n, x[N], w[N];
VV<int> e;
V<int> v;
bitset<5001> bs;
struct TSort{
  bool tsort(const vector<vector<int>>&E, vector<int>&v){
    int n = E.size();
    v.resize(0);
    queue<int> q;
    vector<int> c(n, 0);
    for(int i=0; i<n; i++) for(int a:E[i]) c[a]++;
    for(int i=0; i<n; i++) if(!c[i]) q.push(i);
    while(!q.empty()){
      int a = q.front(); q.pop();
      v.push_back(a);
      for(int b:E[a]){
        c[b]--;
        if(!c[b]) q.push(b);
      }
    }
    return v.size() == n;
  }
} tsort;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  e.resize(n);
  FOR(i, 1, n){
    int p;
    cin >> p;
    p--;
    e[p].pb(i);
  }
  tsort.tsort(e, v);
  reverse(all(v));
  FOR(i, 0, n) cin >> x[i];
  for(int a:v){
    bs.reset();
    bs.set(0);
    int s = 0;
    for(int b:e[a]){
      s += x[b]+w[b];
      bs = (bs<<x[b]) | (bs<<w[b]);
    }
    FORR(i, x[a], 0) if(bs[i]){
      w[a] = s-i;
      goto ok;
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
ok:;
  }
  cout << "POSSIBLE" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = 1 << 30;
// static const ll INF = 1LL << 62;
// --------------------------------------------------------


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);

    int N, M; cin >> N >> M;

    auto uf = dsu(N);
    REP(_, M) {
        int A, B; cin >> A >> B;
        A--; B--;
        uf.merge(A, B);
    }

    set<int> c;
    REP(i, N) {
        c.insert(uf.leader(i));
    }
    int ans = c.size() - 1;
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 7652
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=4999999996000000001;
int dp[6001][6001];

int main(){
    int n;
    string s;
    cin>>n>>s;
    for(int i=n-1;i>=0;i--){
        for(int j=n-1;j>=0;j--){
            if(s[i]!=s[j]) continue;
            dp[i][j]=dp[i+1][j+1]+1;
            //cout<<"i="<<i<<"j="<<j<<" : "<<dp[i][j]<<endl;
        }
    }
    int ans=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            int buf=min(dp[i][j],j-i);
            ans=max(ans,buf);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 120308
#include <bits/stdc++.h>

using namespace std;

int main(){
    string s;
    cin >> s;

    string t1(s.size(), '0');
    string t2(s.size(), '1');
    for (int i = 0; i < s.size(); i += 2) {
        t1[i] = '1';
        t2[i] = '0';
    }


    int cnt1 = 0;
    int cnt2 = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t1[i]) cnt1++;
    }
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t2[i]) cnt2++;
    }

    int res = min(cnt1, cnt2);

    cout << res << endl;
}





Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;


int main(){
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  for(auto& a : A){
    cin >> a;
  }
  for(int ii=0; ii<W+2; ii++){
    cout << "#";
  }
  cout << endl;
  for(auto& a : A){
    cout << "#" << a << "#" << endl;
  }
  for(int ii=0; ii<W+2; ii++){
    cout << "#";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)

int main() {
	ios::sync_with_stdio(false);
	bool s[30] = {};
	int a;
	rep(i, 28) {
		cin >> a;
		s[a-1] = true;
	}
	rep(i, 30) {
		if(!s[i])cout << (i+1) << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define mod 998244353
using namespace std;
int read();
int n;
int m1, m2, m3;
void Add(int& x, int y) { (x += y) >= mod ? x -= mod : x; }

vector<int> e[3][100005];
void add(int f, int t, int d) { e[d][f].push_back(t), e[d][t].push_back(f); }
int sg[3][100005];
vector<int> nx[100005];
void solve(int d) {
    for (int i = 1; i <= n; ++i) nx[i].clear();
    for (int u = n; u >= 1; --u) {
        sort(nx[u].begin(), nx[u].end());
        for (int v : nx[u]) {
            if (sg[d][u] == v) sg[d][u]++;
            if (sg[d][u] < v) break;
        }
        for (int v : e[d][u]) nx[v].push_back(sg[d][u]);
    }
}

int fsp(int base, int p) {
    int rt = 1;
    while (p) {
        if (p & 1) rt = 1ll * rt * base % mod;
        base = 1ll * base * base % mod, p >>= 1;
    }
    return rt;
}
int M(int x) { return x + (x >> 31 & mod); }
struct Poly {
    int x[300005];
    int& operator[](int p) { return x[p]; }
    void fwt(int len) {
        for (int l = 2; l <= len; l <<= 1)
            for (int i = 0, m = l >> 1; i < len; i += l)
                for (int j = i, t; j < i + m; ++j)
                    t = x[j + m], x[j + m] = M(x[j] - t), Add(x[j], t);
    }
} F[3];

int main() {
    n = read(), m1 = read();
    for (int i = 1; i <= m1; ++i) add(read(), read(), 0);
    m2 = read();
    for (int i = 1; i <= m2; ++i) add(read(), read(), 1);
    m3 = read();
    for (int i = 1; i <= m3; ++i) add(read(), read(), 2);
    for (int i = 0; i < 3; ++i) {
        solve(i);
        for (int j = 1, t = 1, p = fsp(10, 18); j <= n; ++j)
            t = 1ll * t * p % mod, Add(F[i][sg[i][j]], t);
    }
    int len = 1;
    while (len <= n) len <<= 1;
    F[0].fwt(len), F[1].fwt(len), F[2].fwt(len);
    for (int i = 0; i < len; ++i)
        F[0][i] = 1ll * F[0][i] * F[1][i] % mod * F[2][i] % mod;

    F[0].fwt(len);
    printf("%d\n", 1ll * F[0][0] * fsp(len, mod - 2) % mod);
    return 0;
}

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}

Measured memory_bytes: 25216
import java.util.Scanner;

class Main {
	static class Card {
		// 絵柄
		enum MARK {
			S, H, C, D;
		}

		MARK mark;	//絵柄
		int num;	//数字

		//絵柄と数字から生成
		Card(String mark, int num) {
			this.mark = MARK.valueOf(mark);
			this.num = num;
		}

		//配列の番号から生成
		Card(int arrayNum) {
			for (MARK m : MARK.values()) {
				if (m.ordinal() == arrayNum / 13) {
					this.mark = m;
					this.num = arrayNum % 13 + 1;
				}
			}
		}

		//配列番号を返す
		public int getArrayNum() {
			for (MARK m : MARK.values()) {

				if (m == mark) {

					return num + (m.ordinal() * 13) - 1;
				}
			}
			return 0;
		}

	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		// カード総数
		final int TOTAL_CARDS = 52;

		// どのカードを所持しているかのフラグ
		boolean[] flagArray = new boolean[TOTAL_CARDS];

		// 所持カード枚数(入力レコード数)を記録
		int cardCount = Integer.parseInt(sc.nextLine());

		for (int i = 0; i < cardCount; i++) {
			// 所持カード(絵柄 + " " + 数字)の入力
			Card card = new Card(sc.next(), sc.nextInt());
			// 所持フラグの変更
			flagArray[card.getArrayNum()] = true;

		}

		print(flagArray);

	}

	// 表示処理
	static void print(boolean[] flagArray) {
		// 所持していなかったカードを表示させる
		for (int i = 0; i < flagArray.length; i++) {

			if (flagArray[i] == false) {
				Card card = new Card(i);
				// 出力
				System.out.println(card.mark + " " + card.num);
			}
		}
	}
}



Measured memory_bytes: 26336
#include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    string S; cin >> S;
    REVERSE(S);
    int N = S.size();
    ll dp[N+1][13]; CLR(dp);
    vector<ll> p(N); p[0] = 1; REP(i,N-1) p[i+1] = (p[i]*10)%13;
    dp[0][0] = 1;
    REP(i,N){
        if(S[i] == '?'){
            REP(k,10)REP(j,13){
                dp[i+1][(j+k*p[i])%13] = (dp[i+1][(j+k*p[i])%13] + dp[i][j])%MOD;
            }
        }
        else{
            ll s = S[i]-'0';
            REP(j,13) dp[i+1][(j+s*p[i])%13] = (dp[i+1][(j+s*p[i])%13] + dp[i][j])%MOD;
        }
    }
    ll ans = dp[N][5];
    cout << ans << en;
    return 0;
}

Measured memory_bytes: 11392
#include <bits/stdc++.h> 

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    ll t = 1;
    ll a = 1;
    rep (i, N) {
        ll T, A;
        cin >> T >> A;
        ll n = max((t+T-1)/T, (a+A-1)/A);
        t = T*n;
        a = A*n;
    }

    cout << t+a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100050];
int sum=0;
bool f=0;
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		if(a[i]%4==0)
			sum+=2;
		else if(a[i]%2==0)
			sum++,f=1;
	}
	sum-=f;
	if(sum>=n-1) {
		puts("Yes");
		return 0;
	}
	else {
		puts("No");
		return 0;
	}
	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<cmath>
#define eps 1e-9
using namespace std;
const int MAXN=1e5+3;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
int arr[MAXN];
signed main()
{
    double w,h;
    scanf("%lf%lf",&w,&h);
    double x,y;
    scanf("%lf%lf",&x,&y);
    double midx=w/2.0,midy=h/2.0;
    printf("%f",w*h/2.0);
    if(fabs(x-midx)<eps&&fabs(y-midy)<eps)
        puts(" 1");
    else
        puts(" 0");
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll inf = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/


int main(){
    fIO

    int n;
    cin >> n;

    string s;
    cin >> s;

    int ans = 1;
    char prev = s[0];

    for(int i = 1; i < n; i++){
        if(s[i] != prev) ans++;
        prev = s[i];
    }
    cout << ans;
}








Measured memory_bytes: 512
n, k = list(map(int, input().split()))
b = {i for i in range(1, n+1)}
a = []
for i in range(k):
    d = int(input())
    z = list(map(int, input().split()))
    for l in z:
        a.append(l)
a_ = set(a)
print(len(b-a_))

Measured memory_bytes: 9244
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a * b) % 2 == 0)
            System.out.println("Even");
        else
            System.out.println("Odd");
    }
}

Measured memory_bytes: 21972
n = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

s = factorization(n)

if n == 1:
    print(0)
    exit()

count,ans = 1,0
for i in range(len(s)):
    while(s[i][1] >= count):
        ans += 1
        s[i][1] -= count
        count += 1
    count = 1

print(ans)

Measured memory_bytes: 9508
a = int(input())
b = int(input())

if (a == 1 and b == 2) or (a == 2 and b == 1) :
  print(3)
elif (a == 2 and b == 3) or (a == 3 and b == 2) :
  print(1)
elif (a == 1 and b == 3) or (a == 3 and b == 1) :
  print(2)

Measured memory_bytes: 8992
#include <iostream>
#include <vector>
#define int long long
using namespace std;
signed main() {
	int a, b, k; cin >> a >> b >> k;
	vector<int>v;
	for (int i = 1; i <= 100; i++) {
		if (a%i == 0 && b%i == 0) {
			v.push_back(i);
		}
	}
	cout << v[v.size() - k] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){
	int N, D1, D2, i, j, k, l, f, g;
	scanf("%d%d%d", &N, &D1, &D2);
	for(k = 0; D1 % 2 == 0; D1 /= 2, k++){}
	for(l = 0; D2 % 2 == 0; D2 /= 2, l++){}
//	printf("(k, l) = (%d, %d)\n", k, l);
	int num = 0;
	for(i = 0; i < 2 * N; i++){
		for(j = 0; j < 2 * N; j++){
			if(num == N * N){
				return 0;
			}
			if(k % 2 == 0){
				if(((i / (1 << (k / 2))) + (j / (1 << (k / 2)))) % 2 == 0){
					f = 0;
				}
				else{
					f = 1;
				}
			}
			else{
				if((i / (1 << (k / 2))) % 2 == 0){
					f = 0;
				}
				else{
					f = 1;
				}
			}
			if(l % 2 == 0){
				if(((i / (1 << (l / 2))) + (j / (1 << (l / 2)))) % 2 == 0){
					g = 0;
				}
				else{
					g = 1;
				}
			}
			else{
				if((i / (1 << (l / 2))) % 2 == 0){
					g = 0;
				}
				else{
					g = 1;
				}
			}
			if(f == 0 && g == 0){
//				printf("o");
				printf("%d %d\n", i, j);
				num++;
			}
			else{
//				printf("x");
			}
		}
//		printf("\n");
	}
//	printf("num = %d\n", num);
	return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>
#include<bitset>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const double EPS = 0.000000000001;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;


ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================
	   
	ll N;
	cin >> N;
	vector<ll> T(N);
	for (ll i = 0; i < N; i++) {
		cin >> T[i];
	}

	ll ans = 1;
	for (int i = 0; i < N; i++) {
		ans = lcm(ans, T[i]);
	}

	cout << ans;


}

//---------------------------------------------------------------
//ユークリッドの互除法
//---------------------------------------------------------------
ll gcd(ll a, ll b) {
	if (a < b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}

	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

//---------------------------------------------------------------
// 最小公倍数
//---------------------------------------------------------------
ll lcm(ll a, ll b) {
	ll temp = gcd(a, b);
	return temp * (a / temp)*(b / temp);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,i,ans=0;
	ll d,x,y;
	std::cin >> n >> d;
	for(i=0; i<n; ++i){
		std::cin >> x >> y;
		if(x*x+y*y<=d*d){
			++ans;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include <algorithm>
using namespace std;
int tab[510][510] = {};
int table[510][510] = {};
int answer[100010] = {};
int main() {
	int n, m, Q;
	cin >> n;
	cin >> m;
	cin >> Q;
	int l, r;
	for (int i = 0;i < m;i++) {
		cin >> l;
		cin >> r;
		tab[r][l] += 1;
	}
	for (int i = 1;i <= n;i++) {
		for (int j = i;j >= 1;j--) {
			table[i][j] = table[i][j + 1] + tab[i][j];
		}
	}
	int p, q;
	for (int i0 = 0;i0 < Q;i0++) {
		cin >> p;
		cin >> q;
		for (int i = 1;i <= q;i++) {
			answer[i0] += table[i][p];
		}
	}
	for (int i = 0;i < Q;i++) {
		cout << answer[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3328
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1010;
const long long MAX_INF = 1e18;

long long x[MAXN], y[MAXN], s[MAXN], t[MAXN];

int main ()
{
    int n;
    scanf ("%d", &n);
    for (int i = 1; i <= n; i ++)
    {
        scanf ("%lld%lld", &x[i], &y[i]);
    }
    s[1] = x[1];
    t[1] = y[1];
    for (int i = 2; i <= n; i ++)
    {
        long long l = 1, r = min(MAX_INF / x[i], MAX_INF / y[i]), ret;
        while (l <= r)
        {
            long long mid = (l + r) >> 1;
            if ((mid * x[i] >= s[i - 1]) && (mid * y[i] >= t[i - 1]))
            {
                ret = mid;
                r = mid - 1;
            }
            else
            {
                l = mid + 1;
            }
        }
        s[i] = ret * x[i];
        t[i] = ret * y[i];
    }
    printf("%lld\n", s[n] + t[n]);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<int64_t> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];

  int64_t P = A[0] + A[1];
  int64_t S = 0; for (int i = 2; i < N; ++i) S ^= A[i];

  if (P - S & 1) {
    cout << -1 << endl;
    return 0;
  }

  int64_t D = P - S >> 1;

  int64_t a = D;
  int64_t b = D;
  for (int i = 40; ~i; --i) if (S >> i & 1) {
    int64_t na = a | (int64_t) 1 << i;
    if (na <= A[0]) a = na;
    else b = b | (int64_t) 1 << i;
  }

  if (a + b == P && (a ^ b) == S && (1 <= a && a <= A[0])) {
    cout << A[0] - a << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}



Measured memory_bytes: 3612
import sys

for line in sys.stdin:
	a, b, c, d, e, f = map(float, line.split())
	x = (c * e - f * b) / (a * e - d * b)
	y = (c * d - f * a) / (b * d - e * a)
	if x == 0:
		x = 0
	if y == 0:
		y = 0
	print('{0:.3f} {1:.3f}'.format(x, y))

Measured memory_bytes: 7360
// Problem Code: abc177_c

#include <iostream>
#include <vector>

using namespace std;

int get_sum(int N, vector<int>& A) {
	int mod, sum, inner_sum;
	mod = 1e9 + 7;
	sum = inner_sum = 0;
	
	for (long long x: A) {
		sum = (sum + x * inner_sum) % mod;
		inner_sum = (inner_sum + x) % mod;
	}
	
	return sum;
}

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];
	cout << get_sum(N, A);
	return 0;
}

Measured memory_bytes: 4056
#include<stdio.h>

#define MAX 100000

int parent(int i){
  return i / 2;
}
int left(int i){
  return 2 * i;
}
int right(int i){
  return 2 * i + 1;
}

int main(){
  int H, i, A[MAX + 1];

  scanf("%d",&H);

  for(i = 1 ; i <= H ; i++){
    scanf("%d",&A[i]);
  }
  
    for(i = 1 ; i <= H ; i++){
      printf("node %d: key = %d, ",i,A[i]);
      if(parent(i) >= 1) printf("parent key = %d, ",A[parent(i)]);
      if(left(i) <= H) printf("left key = %d, ",A[left(i)]);
      if(right(i) <= H) printf("right key = %d, ",A[right(i)]);
      printf("\n");
    }

    return 0;
	       
}


Measured memory_bytes: 2104
// 2013/06/14 Tazoe

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	while(true){
		string N;
		cin >> N;

		if(N=="0000")
			break;

		if(N[0]==N[1] && N[1]==N[2] && N[2]==N[3]){
			cout << "NA" << endl;
			continue;
		}

		int cnt = 0;

		int n = (N[0]-'0')*1000+(N[1]-'0')*100+(N[2]-'0')*10+(N[3]-'0');

		while(true){
			if(n==6174){
				cout << cnt << endl;
				break;
			}

			int tmp[4];
			tmp[0] = n/1000;
			tmp[1] = n/100%10;
			tmp[2] = n/10%10;
			tmp[3] = n%10;

			sort(tmp, tmp+4);
			int L = tmp[3]*1000+tmp[2]*100+tmp[1]*10+tmp[0];
			int S = tmp[0]*1000+tmp[1]*100+tmp[2]*10+tmp[3];

			n = L-S;
			cnt++;
		}
	}

	return 0;
}

Measured memory_bytes: 1208
from heapq import heappush, heappop
from collections import defaultdict

N, M = map(int, input().split())
AB = defaultdict(list)
for i in range(N):
    a, b = map(int, input().split())
    AB[a].append(-b)

q = []
ret = 0
for i in range(1, M+1):
    for j in AB[i]:
        heappush(q, j)
    if q:
        ret += heappop(q)

print(-ret)





Measured memory_bytes: 77528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll A[200005], dp[200005][3], amax[3];
int main() {
    init();
    ll N;
    cin >> N;
    rep(i, N) cin >> A[i];

    if(N%2==0){
        rep(i,N/2){
            ll a = 2 * i;
            dp[i + 1][1] = max(dp[i][0], dp[i][1]) + A[a + 1];
            dp[i + 1][0] = dp[i][0] + A[a];
        }
        cout << max(dp[N/2][0], dp[N/2][1]) << endl;
    }
    else{
        rep(i,N/2){
            ll a = 2 * i;
            amax[0] = dp[i][0];
            rep(j, 2) amax[j + 1] = max(amax[j], dp[i][j + 1]);
            rep(j, 3) dp[i + 1][j] = amax[j] + A[a + j];
        }
        cout << *max_element(dp[N / 2], dp[N / 2] + 3) << endl;
    }
}

Measured memory_bytes: 7564
var
 s,a,b,c,d:longint;
begin
 read(s);
 a:=s div 1000;
 b:=s mod 1000 div 100;
 c:=s mod 100 div 10;
 d:=s mod 10;
 if a+b+c+d=7 then begin writeln(a,'+',b,'+',c,'+',d,'=7');halt;end;
  if a+b+c-d=7 then begin writeln(a,'+',b,'+',c,'-',d,'=7');halt;end;
   if a+b-c+d=7 then begin writeln(a,'+',b,'-',c,'+',d,'=7');halt;end;
    if a-b+c+d=7 then begin writeln(a,'-',b,'+',c,'+',d,'=7');halt;end;
     if a-b-c+d=7 then begin writeln(a,'-',b,'-',c,'+',d,'=7');halt;end;
      if a-b+c-d=7 then begin writeln(a,'-',b,'+',c,'-',d,'=7');halt;end;
       if a+b-c-d=7 then begin writeln(a,'+',b,'-',c,'-',d,'=7');halt;end;
        if a-b-c-d=7 then begin writeln(a,'-',b,'-',c,'-',d,'=7');halt;end;
       end.

Measured memory_bytes: 128
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p, l, r;
};
struct Node T[MAX];
int n;

void preParse(int u){
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i, v, l, r, root;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    T[i].p = NIL;
  }

  for(i = 0; i < n; i++){
    scanf("%d %d %d", &v, &l, &r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }

  for(i = 0; i < n; i++) if(T[i].p == NIL) root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}

Measured memory_bytes: 620
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,r,n) for(int i=r;i<(int)n;i++)
using namespace std;
int in(){int x;cin>>x;return x;}

int main()
{
	int a,b,c;
	int ans1=0,ans2=0;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF)
	{
		if(a==b)ans1++;
		if(c==sqrt(a*a+b*b))ans2++;
	}
	cout<<ans2<<endl<<ans1<<endl;



}

Measured memory_bytes: 1208
#include <stdio.h> 

int main(void)
{
	int x,y,z;
	while(1)
	{
		scanf("%d %d",&x,&y);
		if((x==0)&&(y==0))
		{
			break;
		}
		else
		{
			if(x>y)
			{
				printf("%d %d\n",y,x);
			}
			else
			{
				printf("%d %d\n",x,y);
			}
		}
	}

	return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;

#define ll long long

int main() {
	int n;
	int i, j;
	int ac, wa, tle, re;
	ac = 0; wa = 0; tle = 0; re = 0;
	cin >> n;
	string a;
	for (i = 0; i < n; i++) {
		cin >> a;
		if (a.compare("AC" )== 0)ac++;
		else if (a.compare("WA") == 0)wa++;
		else if (a.compare("TLE") == 0)tle ++;
		else re++;
	}
	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;

	return 0;
}

Measured memory_bytes: 3612
#include<iostream> 
#define fastio(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"

using namespace std; 
  
int main() 
{
	fastio();
	int a,b,c;
	cin >> a >> b >> c;
	if(a==b){
		if(a!=c)cout << "Yes";
		else cout << "No";
	}
	else {
		if(b==c || a==c)cout << "Yes";
		else cout << "No";
	}
    return 0; 
}

Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a.reverse()

if x > sum(a):
  print(n - 1)
else:
  c = 0
  while x >= a[-1]:
    x -= a.pop()
    c += 1
    if c == n:
      break
  print(c)


Measured memory_bytes: 9016
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;cin>>n;int count = 0;
    for(int i= 1;i<n;i++){
        if(n%i==0){
            count+=((n/i)-1);
        }else{
            count+=(n/i);
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3624
//2018.9.29 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read(){
    res s=0;
    bool w=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=1;ch=getchar();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return w?-s:s;
}
inline void _swap(res &x,res &y){
    x^=y^=x^=y;
}
inline int _abs(const res &x){
    return x>0?x:-x;
}
inline int _max(const res &x,const res &y){
    return x>y?x:y;
}
inline int _min(const res &x,const res &y){
    return x<y?x:y;
}
const int N=1e5+10;
namespace MAIN{
    int n,k;
    int fa[N];
    struct E{
        int next,to;
        E() {}
        E(res next,res to):next(next),to(to) {}
    }edge[N];
    int head[N],cnt;
    inline void addedge(const res &u,const res &v){
        edge[++cnt]=E(head[u],v),head[u]=cnt;
    }
    int ans;
    int dfs(const res &x,const res &depx){
        res ret=depx;
        for(res i=head[x];~i;i=edge[i].next){
            res tox=edge[i].to;
            ret=_max(ret,dfs(tox,depx+1));
        }
        if(fa[x]!=1&&ret-depx==k-1){ans++;return 0;}
        return ret;
    }
    inline void MAIN(){
        memset(head,-1,sizeof(head));
        n=read(),k=read();
        for(res i=1;i<=n;i++)fa[i]=read();
        for(res i=2;i<=n;i++)addedge(fa[i],i);
        if(fa[1]!=1)ans++;
        fa[1]=1;
        dfs(1,0);
        printf("%d\n",ans);
    }
}
int main(){
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N; cin>>N;
  vector<int> a(N+1),roopCheck(N+1,1);
  for(int i=0; i<N; i++) cin>>a[i+1];
  
  int now=1; roopCheck[now]=0;
  int count=0;
  bool flg = false;
  while(roopCheck[a[now]]){
    now = a[now];
    roopCheck[now]=0;
    count++;
    if(now==2){
      flg = true;
      break;
    }
  }
  
  if(flg){
    cout << count << endl;
  }else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;

void solveA(){
  string n;
  cin >> n;

  for(int i=0;i<3;i++){
    if(n[i]=='1'){
      n[i]='9';
    }
    else {
      n[i]='1';
    }
  }

    cout << n << endl;
}
void solveB(){
  string n;
  cin >> n;

  if(n[0]<n[1] || (n[0]==n[1]&&n[1]<n[2])){
    n[0]++;
  }
    n[1]=n[0];
    n[2]=n[0];
    cout << n << endl;
}

void solveBB(){
  int n;
  cin >> n;

  if(n%111==0) n--;
  cout << (n/111+1)*111 << endl;
}

void solveC(){
  int n;
  cin >> n;

  vector<int> ocnt(100000);
  vector<int> ecnt(100000);

  int omode=0,emode=0;
  int omax_cnt=0,emax_cnt=0;
  for(int i=0;i<n;i++){
    int v;
    cin >> v;
    if(i%2==0){
      ecnt[v]++;
      if(ecnt[v]>emax_cnt){
	emax_cnt=ecnt[v];
	emode=v;
      }
    }
    else {
      ocnt[v]++;
      if(ocnt[v]>omax_cnt){
	omax_cnt=ocnt[v];
	omode=v;
      }
    }
  }
  
  sort(ocnt.begin(),ocnt.end(),greater<int>());
  sort(ecnt.begin(),ecnt.end(),greater<int>());

  if(emode==omode){
    cout << min(n-ocnt[0]-ecnt[1],n-ocnt[1]-ecnt[0]) << endl;
  }
  else{
    cout << n-ocnt[0]-ecnt[0] << endl;
  }
}
void solveD(){

}

int main(){
  solveC();
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VB = vector<bool>;
using VS = vector<string>;
using graph = vector<vector<int>>;

int main()
{
double d,t,s;
cin>>d>>t>>s;
if (d>t*s)
{
    cout<<"No"<<endl;
}
else cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    cin >> N;
    vector<long long> a(N);
    map<long long, long long> b;
    queue<long long> q;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        if(!b.count(a[i])) {
            b[a[i]] = 1;
            q.push(a[i]);
        }
        else b[a[i]]++;
    }
    long long sum = 0;
    while(!q.empty()){
        long long t = q.front();
        long long n = b[t];
        sum += n*(n - 1) / 2;
        q.pop();
    }
    for(int i = 0; i < N; i++){
        long long sum2 = sum;
        cout << sum2 - b[a[i]]*(b[a[i]] - 1) / 2 + (b[a[i]] - 2)*(b[a[i]] - 1) / 2 << endl;
    }
}

Measured memory_bytes: 12928
import sys
import collections


while True:
    N, A, B, C, X = map(int, sys.stdin.readline().split())
    if N == 0:
        break
    
    x = X
    
    count = 0
    Y = map(int, sys.stdin.readline().split())
    before = -1
    for y in Y:
        if before == y:
            x = (A * x + B) % C
            count += 1
        while x != y and count <= 10000:
            x = (A * x + B) % C
            count += 1
        before = x
    if count <= 10000:
        print count
    else:
        print -1

Measured memory_bytes: 4632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,a,b) for (int i = (a); i < (b); ++i)


int main() {
    int x,y;
    cin>>x>>y;

    cout<<x+y/2<<endl;
        
    return 0;
}


Measured memory_bytes: 256
input_s = input()
head_num = int(input_s[:2])
bottom_num = int(input_s[2:])
yymm_flag = 0
mmyy_flag = 0

if bottom_num <= 12 and bottom_num != 0:
    yymm_flag += 1


if head_num <= 12 and head_num != 0:
    mmyy_flag += 1
    
if yymm_flag == 1 and mmyy_flag == 1:
    print("AMBIGUOUS")
elif yymm_flag == 1:
    print("YYMM")
elif mmyy_flag == 1:
    print("MMYY")
else:
    print("NA")
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;

int main() {
    int K;
    string S;
    cin >> K >> S;

    if(S.size() <= K) {
        cout << S << endl;
    }else{
        for(int i=0; i<K; i++)
            cout << S[i];

        cout << "..." << endl;
    }

    return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100000;

// ──────────────────────────────────────────────────────────────────

int dp1[1000000];
int dp2[1000000];

int main() {
	vi a, b;

	int num = 1;
	int val = 1;
	while (val <= 1000000) {
		a.push_back(val);
		if (val % 2 == 1) b.push_back(val);
		val = num * (num + 1) * (num + 2) / 6;
		num++;
	}

	memset(dp1, inf, sizeof(dp1));
	memset(dp2, inf, sizeof(dp2));
	dp1[0] = dp2[0] = 0;

	Rep(i, 1000000) {
		rep(j, a.size()) {
			if (i >= a[j]) chmin(dp1[i], dp1[i - a[j]] + 1);
		}
	}
	Rep(i, 1000000) {
		rep(j, b.size()) {
			if (i >= b[j]) {
				chmin(dp2[i], dp2[i - b[j]] + 1);
			}
		}
	}

	while (true) {
		int n;
		cin >> n;

		if (!n) break;

		cout << dp1[n] << " " << dp2[n] << endl;
	}
}


Measured memory_bytes: 10932
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,K; cin >> N >> K;
  vi a(N); rep(i,N) cin >> a[i] ;
  cout << (N-K+K-2)/(K-1)+1 << endl;
  // int N; cin >> N ;
  // // REP(i,3099,3210){
  // //   ll s = f(ll(i));
  // //   cout << i << "/" << s << " = " << double(i)/double(s)  << endl;
  // // }
  // ll s = 0;
  // ll d = 1;
  // rep(i,N){
  //   s+=d;
  //   cout << s << endl;
  //   if(i%9==8) d*=10;
  // }
  return 0; 
}


Measured memory_bytes: 640
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]

v = 0
for a, b in zip(A, B):
    if b - a > 0:
        v += (b - a) // 2
    else:
        v += b - a
if v >= 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 10472
#include<stdio.h>
int main(void)
{
	int H,W;
	int i, j;
	while(1){
	scanf("%d %d" ,&H ,&W);
	if(H == 0 && W == 0) break;
		for ( i = 0; i < H; i++ ){
		for ( j = 0; j < W; j++ ){
	if(j==0||j==W-1||i==0||i==H-1){
			printf("#");
	}else{
			printf(".");
		}
	}
		printf("\n");
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 2620
#include <bits/stdc++.h>
using namespace std; 
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long ll; 
const ll MOD = 1000000007;

int main()  
{ 
    FAST_INP;
    int x;
    cin >> x;
    if(x>=30) cout << "Yes\n";
    else cout << "No\n";
    return 0;
} 

Measured memory_bytes: 3616
def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      #table.append(n//i)
    i += 1
  table = list(set(table))
  return table

n = int(input())
t = divisor(n)
ans = float('inf')
for num in t:
  ans = min(ans, num + n//num - 2)
print(ans)

Measured memory_bytes: 38896
# https://atcoder.jp/contests/dp/tasks/dp_c
N = int(input())
Max_List=[]
N_List=[i for i in range(3)]
for i in range(N):
    Current_List=list(map(int,input().split())) 
    if i == 0:
        Max_List.append(Current_List)
    else:
        Current_Max_List = []
        Search_List=Max_List[i-1]
        for j in range(3):
            Current_Search_List=Search_List[1:3]
            Current_Max_List.append(max(Current_Search_List)+Current_List[j])
            Search_List.append(Search_List[0])
            del Search_List[0]
        Max_List.append(Current_Max_List)
        
    
print(max(Max_List[-1]))

Measured memory_bytes: 86004
#include<bits/stdc++.h>
using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	vector<int>arr(n);
	for(int i=0; i<n; i++) arr[i]=i+1;
	for(int i=0; i<n; i++) arr[i]%=k;
	if(k%2){
		long long zero = 0;
		for(int i=0; i<n; i++) if(arr[i]==0) zero++;
		long long ret = pow(zero,3);
		cout<<ret;
	}
	else{
		long long zero = 0;
		long long half = 0;
		for(int i=0; i<n; i++){
			if(arr[i]==0) zero++;
			else if(arr[i]==k/2) half++;
		}
		long long ret = pow(zero,3);
		ret+=pow(half,3);
		cout<<ret;
	}
}

Measured memory_bytes: 3900
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n;
    while(cin >> n) {
        if(n == -1) break;
        double ans = n / 2.0;
        while(abs(pow(ans, 3) - n) >= 0.00001 * n)
            ans = ans - (pow(ans, 3) - n) / (3 * pow(ans, 2));
        printf("%.8f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<algorithm>
using namespace std;

int func(int a){
  int res = 0;
  while(a){
    res += a%10;
    a /= 10;
  }
  return res;
}

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

  int res = 1e8;
  for(int i = 1 ; i < n ; i++){
    res = min(res, func(i) + func(n-i));
  }
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int X[5050];
int T[505*505];
int R[505*505];
int L[505];
vector<pair<int,int>> A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>X[i+1];
		T[X[i+1]]=i+1;
		L[i+1]=i;
		if(i) A.push_back({X[i+1],i+1});
	}
	
	sort(ALL(A));
	reverse(ALL(A));
	
	for(i=1;i<=N*N;i++) {
		if(T[i]) {
			R[i]=T[i];
			if(L[T[i]]) return _P("No\n");
			if(T[i]!=N) B.push_back({T[i],N-T[i]});
		}
		else if(A.size()) {
			R[i]=A.back().second;
			L[A.back().second]--;
			if(L[A.back().second]==0) A.pop_back();
		}
		else if(B.size()) {
			R[i]=B.back().first;
			B.back().second--;
			if(B.back().second==0) B.pop_back();
		}
		else return _P("No\n");
	}
	_P("Yes\n");
	FOR(i,N*N) _P("%d%c",R[i+1],(i==N*N-1)?'\n':' ');
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 2944
'use strict';
(function(stdin) {
  var inputs  = stdin.toString();
  var r = parseFloat(inputs);
  var circlearea = Math.pow(r,2) * Math.PI ;
  var circumference = 2 * Math.PI * r;

  // console.log(
  //   Number(circlearea.toFixed(5))
  //   ,Number(circumference.toFixed(5))
  // );
 console.log(
    circlearea.toFixed(5)
    ,circumference.toFixed(5)
  );

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15640