akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC oplmize(2)
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define sc(x) scanf("%lld",&x)
#define scs(x) scanf("%s",x+1)
#define pr(x) printf("%lld\n",x)
#define prs(x) printf("%s\n",x)
using namespace std;
const int maxn=1e6+5;
const int mod=1e9+7;
const double pi=acos(-1.0);
const double eps = 1e-8;
ll n,s,a[maxn];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    sc(n);
    for(int i=1;i*i<=n;i++){
        for(int j=i+1;i*j<=n;j++){
            a[i*j]+=2;
        }
        a[i*i]+=1;
    }
    while(n--){
        s+=a[n];
    }
    pr(s);
    return 0;
}

Measured memory_bytes: 11636
import math

def factor(n):
    i = 2
    r = []
    while i * i <= n:
        if n % i == 0:
            c = 0
            while n % i == 0:
                c += 1
                n //= i
            r.append((i, c))
        i += 1
    if n > 1:
        r.append((n, 1))
    return r

class nCrMod():
    def __init__(self, mod):
        self.mod = mod
        self.fac = [1, 1]
        self.finv = [1, 1]
        self.inv = [0, 1]

    def prep(self, n):
        mod = self.mod
        f, fi = self.fac[-1], self.finv[-1]
        for i in range(len(self.fac), n + 1):
            fn = f * i % mod
            v = -self.inv[mod % i] * (mod // i) % mod
            fin = fi * v % mod
            f, fi = fn, fin
            self.fac.append(f)
            self.finv.append(fi)
            self.inv.append(v)

    def __call__(self, n, r):
        if len(self.fac) <= n:
            self.prep(n)
        return self.fac[n] * self.finv[r] * self.finv[n - r] % self.mod

def main():
    N, M = map(int, input().split())
    mod = 10**9 + 7
    nCr = nCrMod(mod)
    f = factor(M)
    r = 1
    for p, q in f:
        r = r * nCr(N + q - 1, q) % mod
    return r

print(main())


Measured memory_bytes: 57980
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, p, cnt[11111], suff[N];
string s;
main() {
  file("threesum");
  ios;
  cin >> n >> p >> s;
  ll ans = 0;
  if (p == 2 || p == 5) {
    for (int i = 0; i < n; ++i) {
      if ((s[i] - '0') % p == 0) {
        ans += i + 1;
      }
    }
    cout << ans;
    return 0;
  }
  ll cur = 1;
  for (int i = n - 1; ~i; --i) {
    if (i == n - 1) {
      suff[i] = (s[i] - '0');
      suff[i] %= p;
    } else {
      suff[i] = suff[i + 1] + cur * (s[i] - '0');
      suff[i] %= p;
    }
    ans += cnt[suff[i]]++;
    if (!suff[i]) ++ans;
//    cout << i << " " << suff[i] << " " << cnt[suff[i]] << "\n";
    cur *= 10ll;
    cur %= p;
  }
  cout << ans;
  return 0;
}
/**

*/


Measured memory_bytes: 1428
#include<bits/stdc++.h>
using namespace std;
#define fop(i,a,b) for(int i=a;i<b;i++)
#define int long long
main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    int dp[n];
    fop(i,0,n) dp[i]=INT_MAX;
    dp[0]=0;
    fop(i,0,n) cin>>a[i];
    fop(i,0,n)
        for(int j=i-1;j>=max(i-k,1ll*0);j--)
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
    cout<<dp[n-1];
}


Measured memory_bytes: 5092
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n0 = sc.nextLong();
        long m0 = sc.nextLong();
        long N = Math.max(m0,n0);
        long M = Math.min(m0,n0);
        long ans = 0;
        if(M==1){
            if(N==1) ans = 1;
            else ans += N-2;
        }
        else if(M>=3){
            ans += (M-2)*(N-2);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false); 
    long long n;
    cin>>n;
    cout<<  n*(n-1)/2;
}

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

int main(){
	int n;
	cin>>n;
	int a[n];
	int b[n];
	int c[n];
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	int dp[n][3];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			if(j==0){
				dp[i][j]=max(dp[i-1][1],dp[i-1][2])+a[i];
			}
			if(j==1){
				dp[i][j]=max(dp[i-1][0],dp[i-1][2])+b[i];
			}
			if(j==2){
				dp[i][j]=max(dp[i-1][0],dp[i-1][1])+c[i];
			}
		}
	}
	cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
}

Measured memory_bytes: 5852
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
	LL l, r;
	cin >> l >> r;

	if (r - l >= 2019) {
		cout << 0 << endl;
		return 0;
	}

	vector<LL> ans;
	LL mod = 2019;
	rep(i, l, r + 1) {
		ans.pb(i);
	}
	int siz = ans.size();
	rep(i, 0, siz - 1) {
		rep(j, i + 1, siz) {
			LL a = (ans[i] % 2019) * (ans[j] % 2019) % 2019;
			mod = min(mod, a);
		}
	}

	cout << mod << endl;

	return 0;
}

Measured memory_bytes: 256
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let n = parse!(it);
    let g = (0..n)
        .map(|_| {
            it.next()
                .unwrap()
                .chars()
                .enumerate()
                .filter(|&(i, x)| x.to_digit(2).unwrap() != 0)
                .map(|(i, x)| i)
                .collect::<Vec<usize>>()
        })
        .collect::<Vec<_>>();
    let mut color: Vec<Option<usize>> = vec![None; n];
    if !binary(0, 0, &g, &mut color) {
        println!("{}", -1);
        return;
    }
    let d = wf(&g);
    let b = d.iter().map(|x| x.iter().max().unwrap()).max().unwrap();
    println!("{:?}", b + 1); // DEBUG
}

fn wf(g: &Vec<Vec<usize>>) -> Vec<Vec<usize>> {
    let n = g.len();
    let mut d = vec![vec![std::usize::MAX / 3; n]; n];
    for i in 0..n {
        for j in 0..n {
            if g[j].contains(&i) {
                d[i][j] = 1;
            }
        }
    }
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                if d[i][j] > d[i][k] + d[k][j] {
                    d[i][j] = d[i][k] + d[k][j];
                }
                if i == j {
                    d[i][j] = 0;
                }
            }
        }
    }
    d
}

fn binary(x: usize, c: usize, g: &Vec<Vec<usize>>, color: &mut Vec<Option<usize>>) -> bool {
    for &y in &g[x] {
        if let Some(d) = color[y] {
            if d != c {
                return false;
            }
        } else {
            color[y] = Some(c);
            if !binary(y, 1 - c, &g, color) {
                return false;
            }
        }
    }
    return true;
}


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

int main() {
  ll n,x;cin>>n>>x;
  ll an[n];rep(i,n) cin>>an[i];
  ll ans = 0;
  rep(i, n-1) {
    if (an[i]+an[i+1] > x) {
      ans += (an[i]+an[i+1]-x);
      an[i+1] = max(0LL, x - an[i]);
    }
  }
  cout << ans;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a[5], i;
  for(i = 0; i < 5; i++)
  {
    cin >> a[i];
    if(a[i] == 0)
    {
      break;
    }
  }
  cout << i + 1 << "\n";
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF 100000000
#define _INF -100000000
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;

int main() {
	int x, y; cin >> x >> y;
	int ans;
	if (abs(x) <= abs(y)) {
		if (x >= 0 && y >= 0) {
			ans = y - x;
		}
		else if (x >= 0 && y < 0) {
			ans = y*(-1) - x + 1;
		}
		else if (x < 0 && y >= 0) {
			ans = y - x*(-1) + 1;
		}
		else {
			ans = y*(-1) - x*(-1) + 2;
		}
	}
	else {
		if (x >= 0 && y > 0) {
			ans = x - y + 2;
		}
		else if (x >= 0 && y <= 0) {
			ans = y - x*(-1) + 1;
		}
		else if (x < 0 && y > 0) {
			ans = x*(-1) - y + 1;
		}
		else {
			ans = y - x;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val ns @ Array(n, m, x, y) = input.nextLine().split(" ").map(_.toInt)
      val xs = input.nextLine().split(" ").map(_.toInt)
      val ys = input.nextLine().split(" ").map(_.toInt)
      val zs = xs ++ ys

      if (zs.filter(n => x < n && n <= y).exists(z => xs.forall(_ < z) && ys.forall(_ >= z)))
        println("No War")
      else
        println("War")
    }

  }

}


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

int main() {
  int n;
  cin >> n;
  vector<int>data(n);
  for(int i=0;i<n;i++){
    cin >> data.at(i);
  }
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(i!=j) ans+=data.at(i)*data.at(j);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int add(int a, int b) {
    return (a + b) % MOD;
}
int mul(int a, int b) {
    return 1LL * a * b % MOD;
}
int n, dp[100005][13];
char s[100005];
int sum[6], m[6];
int main() {
    scanf(" %s", s);
    n = strlen(s);
    for (int i = 0; i < n; ++i) {
        if (s[n - i - 1] != '?')
            sum[i % 6] = add(sum[i % 6], s[n - i - 1] - '0');
        else
            m[i % 6]++;
    }
    int M = 0;
    for (int i = 0; i < 6; ++i) M = max(M, m[i]);
    dp[0][0] = 1;
    for (int i = 1; i <= M; ++i) {
        // to get to j, either start from j,j-1, j-2, ...,j-9
        for (int k = 0; k <= 9; ++k) dp[i][0] = add(dp[i][0], dp[i - 1][(13 - k) % 13]);
        for (int j = 1; j < 13; ++j) {
            dp[i][j] = add(dp[i][j - 1], add(dp[i - 1][j], -dp[i - 1][(13 + j - 10) % 13]));
        }
    }
    int ans = 0;
    for (int a = 0; a < 13; ++a) {
        for (int b = 0; b < 13; ++b) {
            for (int c = 0; c < 13; ++c) {
                for (int d = 0; d < 13; ++d) {
                    for (int e = 0; e < 13; ++e) {
                        for (int f = 0; f < 13; ++f) {
                            if ((13 + (a + sum[0] - 3 * (b + sum[1]) + 9 * (c + sum[2]) - (d + sum[3]) + 3 * (e + sum[4]) - 9 * (f + sum[5])) % 13) % 13 == 5) {
                                // printf("a = %d, b = %d, c = %d, d = %d, e = %d, f = %d\n", a, b, c, d, e, f);
                                ans = add(ans, mul(dp[m[0]][a], mul(dp[m[1]][b], mul(dp[m[2]][c], mul(dp[m[3]][d], mul(dp[m[4]][e], dp[m[5]][f]))))));
                            }
                        }
                    }
                }
            }
        }
    }
    if (ans < 0) ans += MOD;
    printf("%d\n", ans);
}

/*
10^0 = 1
10 = -3
100 = 9,
1000 = -27 = -1
10^4 = 3
10^5 = -9
10^6 = 1
*/

Measured memory_bytes: 1152
N = int(input())
c = [[0]*10 for _ in range(10)]
for i in range(1, N+1):
    s = str(i)
    c[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j]*c[j][i]
print (ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    string ss,tt,s="#",t="#";
    cin>>ss>>tt;
    ll n=ss.size();
    ll m=tt.size();
    s+=ss;
    t+=tt;
    ll d[n+1][m+1];
	for(ll j=0;j<=m;j++) 
	    d[0][j]=0;
	for(ll i=0;i<=n;i++) 
	    d[i][0]=0;    
	
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=m;j++){
			if(s[i]==t[j])d[i][j]=d[i-1][j-1]+1;
			else d[i][j]=max(d[i-1][j],d[i][j-1]);
		}
	}
	vector<char> ans;
	ll ind1,ind2;
	ind1=n;
	ind2=m;
	
	while(ind1>0&&ind2>0){
		if(s[ind1]==t[ind2]){
			ans.push_back(s[ind1]);
			ind1--;
			ind2--;
		}
		else{
			if(d[ind1-1][ind2]>d[ind1][ind2-1])
				ind1--;
			else 
				ind2--;
		}
	}
	for(ll k=ans.size()-1;k>=0;k--){
		cout<<ans[k];
	}
	return 0;
}

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

const int MaxN=1e6;
const int MaxA=1e6;
bool check[MaxA+1]={};
vector<int> prime={2};

int N, num[MaxN];
int main(){
	/* 1000以內的質數 */
	for(int i=4;i<=MaxA;i+=2)
		check[i]=1;
	for(int i=3;i<1000;i+=2)
		if(check[i]==0){
			prime.push_back(i);
			for(int j=3;i*j<MaxA;j+=2)
				check[i*j]=1;
		}
	
	scanf("%d\n",&N);
	for(int i=0;i<N;i++)
		scanf("%d",&num[i]);
	sort(num,num+N);
	
	bool pairwise=true;
	int _GCD=num[0];
	for(int i=0;i<N;i++){
		_GCD=__gcd(_GCD,num[i]);
		for(int j=0;j<prime.size() and prime[j]*prime[j]<=num[i];j++)
			if(num[i]%prime[j]==0){
				while(num[i]%prime[j]==0)
					num[i]/=prime[j];
				pairwise&= check[prime[j]]==0;
				check[prime[j]]=1;
			}
		if(num[i]>1){
			pairwise&= check[num[i]]==0;
			check[num[i]]=1;
		}
	}
	if(_GCD==1){
		if(pairwise)
			puts("pairwise coprime");
		else
			puts("setwise coprime");
	}else
		puts("not coprime");
}

Measured memory_bytes: 8580
N = int(input())
A = list(map(int, input().split()))  # ソート前の並び
B = sorted(A)  # ソート後の並び
c = 0  # 移動コスト

# 1 3 4 ... N 2 -> 1 2 3 4 ... N
# パターンa) 移動すべき要素（グループ）の中での最小(2:B[i]） を使って移動させる
# 1 3 4 2 : スタート
# 1 3 2 4 : <1>
# 1 2 3 4 : <2>
#
# パターンb) 一旦 最小(1:B[0]) と グループ最小(2:B[i]) を交換して始める
# 1 3 4 2 : スタート
# 2 3 4 1 : B[i] + B[0] 追加
# 2 3 1 4 : <1> - (B[i] - B[0])
# 2 1 3 4 : <2> - (B[i] - B[0])
# 1 2 3 4 : B[i] + B[0] 追加

for i in range(N - 1):  # 最後の一つは、手前が揃っていれば揃っている
    t = cnt = 0
    ai = A.index(B[i])  # 並べ替え前の B[i] がいる場所

    while ai != i:  # 並べ替え前と同じでない場合
        y = A.index(B[ai])  # 更に次の
        A[ai], A[y] = B[ai], B[i]  # スワップ
        cnt += 1
        t += B[ai] + B[i]  # このときのコスト
        ai = y
    if cnt:
        # パターンa と パターンb を比較して、コストが小さい方に決める
        c += min(t, (B[i] + B[0]) * 2 + t - (B[i] - B[0]) * cnt)
print(c)



Measured memory_bytes: 5624
// Problem : E - This Message Will Self-Destruct in 5s
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int n;
		cin>>n;
		int arr[n+1];
		for(int i=1;i<=n;++i)
		cin>>arr[i];
		map<int,int> mpadd,mpsub;
		for(int i=1;i<=n;++i)
		{
			mpsub[i-arr[i]]++;
			mpadd[i+arr[i]]++;
		}
		int ans = 0;
		for(auto x:mpsub)
		{
			ans+= (mpsub[x.first]*mpadd[x.first]);
		}
		cout<<ans;    	
    }
    return 0;
}



Measured memory_bytes: 39428
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long int LL;
const LL MAX=2e9;
LL pos[1005][2];
 
void check(int a,int t){
	int i,j,k;
	t=1<<t;
	if(abs(pos[a][0])>abs(pos[a][1])){
		if(pos[a][0]>0){
			cout<<'R';
			pos[a][0]-=t;
		}else{
			cout<<'L';
			pos[a][0]+=t;
		}
	}else{
		if(pos[a][1]>0){
			cout<<'U';
			pos[a][1]-=t;
		}else{
			cout<<'D';
			pos[a][1]+=t;
		}
	}
}
 
int main(){
	int n;
	int i,j,k;
	LL a,b,c,d;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>pos[i][0]>>pos[i][1];
	}
	a=(pos[0][0]+pos[0][1]+MAX)%2;
	for(i=0;i<n;i++){
		b=(pos[i][0]+pos[i][1]+MAX)%2;
		if(a!=b){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<(32-a)<<endl;
	for(i=30;i>0;i--){
		cout<<(1<<i)<<" ";
	}
	if(a==1)cout<<1<<endl;
	else cout<<1<<" "<<1<<endl;
	
	for(i=0;i<n;i++){
		for(j=30;j>=0;j--){
			check(i,j);
		}
		if(a==0)check(i,0);
		cout<<endl;
	}
	
	return 0;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdlib.h>

using namespace std;

int main(void){
    long long N, T;

    cin >> N >> T;

    long long S[N+5];

    long long sum_time = 0;
    for(int i=0; i<N;i++){
        cin >> S[i];
    }
    for(int i=0;i<N-1;i++){ 
        sum_time = sum_time + min(T, S[i+1] - S[i]);
    }
    sum_time = sum_time + T;
    cout << sum_time;
    return 0;
}

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

long modpow(int a, int b, int mod){
    long tmp = 1;
    rep(i, b) {
        tmp *= a;
        tmp %= mod;
    } 
    return tmp;
}

int main(){
    int N;
    cin >> N;
    int mod=998244353;
    vector<int> D(N);
    for(auto &x: D){
        cin >> x;
    }

    int max = *max_element(D.begin(), D.end());
    vector<int> cnt(max+1);
    for (auto d:D){
        cnt[d]++;
    }

    if (D[0] != 0 || cnt[0] != 1){
        cout << 0 << endl;
        return 0;
    }

    long ans = 1;
    rep(i, max+1) {
        if(i == 0) continue;
        ans *= modpow(cnt[i-1], cnt[i], mod);
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		String s[] = new String[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		Arrays.sort(s);
		String joinS = "";
		for (int i = 0; i < n; i++) {
			joinS += s[i];
		}
		System.out.println(joinS);
	}
}

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

#define pb push_back
#define F first
#define S second
#define rep(i,n) for(int i = 0; i < (n); i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
        return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  vector<int> l(n), r(n);
  rep(i,n-1) l[i+1] = gcd(l[i], a[i]);
  for(int i = n-1; i >= 1; i--) r[i-1] = gcd(r[i], a[i]);
  int ans = 1;
  rep(i,n) ans = max(ans, gcd(l[i], r[i]));
  cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
typedef long long ll;
using namespace std;
ll a,b,m,n,MOD=1e9+7;
ll f(ll x,ll y){
    if(y==0)return 1;
    if(y%2==0)return f(x,y/2)*f(x,y/2)%MOD;
    return f(x,y-1)*x%MOD;
}
ll bik(ll x){
    ll l=1;
    for(int i=1;i<=x;i++){
        l*=i;
        l%=MOD;
    }
    return l;
}
ll comb(ll x,ll y){
    return bik(x)*f(bik(x-y),MOD-2)%MOD*f(bik(y),MOD-2)%MOD;
}
int main(void){
    cin>>a>>b;
    if((2*a-b)%3==0&&(2*b-a)%3==0&&2*a-b>=0&&2*b-a>=0){
        m=(2*a-b)/3,n=(2*b-a)/3;
        cout<<comb(m+n,m)<<endl;
    }
    else cout<<0<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  int  n;
  cin >> n;
  int sum = 1000000;
  rep(i,1,n){
    int a = i;
    int b = n-i;
    int num = 0;
    while(a > 0){
      num += a%10;
      a /= 10;
    }
    while(b > 0){
      num += b%10;
      b /= 10;
    }
    sum = min(sum,num);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    if(*s.rbegin()=='s') cout<<s<<"es";
    else cout<<s<<"s";
}

Measured memory_bytes: 3656
/*
 * atcoder/abc105/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

ll N;
string ans = "";

void solve() {
  cin >> N;
  if (N==0) {
    cout << 0 << endl;
    return;
  }

  while (N != 0) {
    int r = N%(-2);
    if (r<0) r += 2;
    ans += to_string(r);
    N = (N-r) / (-2);
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

using ll = long long;

ll N;
ll A[200010];
std::vector<ll> G[200010];

int main()
{
  std::cin >> N;

  rep( i, N-1 )
  {
    std::cin >> A[i+1];
    --A[i+1];
    G[A[i+1]].emplace_back( i+1 );
  }

  rep( i, N )
    std::cout << G[i].size() << std::endl;

  return 0;
}

Measured memory_bytes: 15608
S = list(input())
T = list(input())

def diff(s,t):
    count = 0
    #print(s,t)
    for i in range(len(t)):
        if s[i]!=t[i]:
            count+=1
    #print(count)
    return count
min_c = diff(S,T)

for i in range(len(S)-len(T)):
    d = diff(S[i:],T)
    #print(d)
    if d<min_c:
        min_c = d
print(min_c)


Measured memory_bytes: 67388
def takahashi_cal(m: int, d: int) -> int:
    res = 0
    for mm in range(1, m + 1):
        for dd in range(1, d + 1):
            d1 = dd % 10
            d10 = dd // 10
            if any([d1 < 2, d10 < 2]):
                continue
            if d1 * d10 == mm:
                res += 1
    return res
    
m, d = input().split(" ")
print(takahashi_cal(int(m), int(d)))

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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll a, b;
  cin >> a >> b;

  ll i = 0;
  while ((a - 1) * i + 1 < b) {
    i++;

  }

  COUT(i);


}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*

3 2
*/


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int mn = 1ll * 100 * 100 * 100 * 100;
    mn *= mn;
    int n;
    cin >> n;
    for(int i = 1; i <= 5; ++i) {
        int x;
        cin >> x;
        mn = min(mn, x);
    }
    cout << (n + mn - 1) / mn + 4 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    int n;
    cin >> n;
    vector<int> a(n+1);
    for(int i = 0; i < n; i++){
        cin >> a[i+1];
    }

    int start = n/2 + 1;

    vector<bool> exist(n+1, false);
    for(int i = start; i <= n; i++){
        if(a[i] == 1){
            exist[i] = true;
        }
    }
    for(int i = start-1; i > 0; i--){
        int cnt = 0;
        int idx = i*2;
        while(idx <= n){
            if(exist[idx]){cnt++;}
            idx += i;
        }
        if(a[i] == 1 && cnt%2==1){
            exist[i] = false;
        }else if(a[i] == 1 && cnt%2==0){
            exist[i] = true;
        }else if(a[i] == 0 && cnt%2==1){
            exist[i] = true;
        }else{
            exist[i] = false;
        }
    }

    int ans = 0;
    for(int i = 0; i <= n; i++){
        if(exist[i]){ans++;}
    }
    cout << ans << endl;
    for(int i = 0; i <= n; i++){
        if(exist[i]){cout << i << " ";}
    }
    cout << endl;
    return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
template <typename t>
void read(t &x)
{
    char ch = getchar();
    x = 0;
    t f = 1;
    while (ch < '0' || ch > '9')
        f = (ch == '-' ? -1 : f), ch = getchar();
    while (ch >= '0' && ch <= '9')
        x = x * 10 + ch - '0', ch = getchar();
    x *= f;
}
//---------------https://lunatic.blog.csdn.net/-------------------//
#define wi(n) printf("%d ", n)
#define wl(n) printf("%lld ", n)
#define rep(m, n, i) for (int i = m; i < n; ++i)
#define rrep(m, n, i) for (int i = m; i > n; --i)
#define P puts(" ")
typedef long long ll;
#define MOD 1000000007
#define mp(a, b) make_pair(a, b)
#define N 100005
#define fil(a, n) rep(0, n, i) read(a[i])
ll power(ll a, ll b, ll p)
{
    ll ans = 1 % p;
    for (; b; b >>= 1)
    {
        if (b & 1)
            ans = ans * a % p;
        a = a * a % p;
    }
    return ans;
}
long long mm[500000];
void init(ll n, ll k)
{
    mm[1] = 1;
    for (ll i = 2; i <= n; i++)
    {
        mm[i] = ((mm[i - 1] * (k + i - 1)) % MOD * power(i - 1, MOD - 2, MOD)) % MOD;
        //cout<<mm[i]<<endl;
    }
}
ll a[N];
int main()
{
    int n, k;
    read(n), read(k);
    fil(a, n);
    sort(a, a + n);
    init(n, k - 1);
    long long sum = 0;
    rrep(n - 1, k - 2, i)
        sum = (sum + (mm[i - k + 2] * (a[i] - a[n - i - 1]) % MOD) % MOD) % MOD;
    wl((sum+MOD)%MOD);
    P;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
	int N;
	cin >> N;
	int now = N, S = 0;
	while(now > 0)
	{
		S += now % 10;
		now /= 10;
	}
	if (N % S == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long int
#define N 200005
 
main(){
    // ios_base::sync_with_stdio(false); 
    // cin.tie(NULL);
    int n;
	cin>>n;
	int a[n+5],b[n+5],c[n+5];
	for(int i=1;i<=n-1;i++)cin>>a[i];
	int ans=a[1]+a[n-1];
	for(int i=2;i<=n-1;i++)ans+=min(a[i],a[i-1]);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPP(i, n) for(int i = 1; i <= n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<string, ll> p;
const ll MOD = 1000000007;

int main() {
    int n,q; cin >> n >> q;
    queue<p> s;
    REP(i,n) {
        string a; int b; cin >> a >> b;
        s.push(make_pair(a,b));
    }
    int second = 0;
    while(!s.empty()) {
        second += (s.front().second - q >= 0 ? q : s.front().second);
        s.front().second -= q;
        if(s.front().second<=0) {
            cout << s.front().first << " " << second << endl;
            s.pop();
        }
        else {
            s.push(s.front());
            s.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 6212
#include <cmath>
#include <iostream>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int d, n;
  cin >> d >> n;
  int ans = 0;
  if (d == 0) {
    int loop = 0;
    int count = 0;
    while (count < n) {
      loop += 1;
      if (loop % 100 == 0) {

      } else {
        count += 1;
      }
    }
    ans = loop;
  } else if (d == 1) {
    int loop = 0;
    int count = 0;
    while (count < n) {
      loop += 1;
      if (loop % 100 == 0 && loop % 10000 > 0) {
        count += 1;
      }
    }
    ans = loop;
  } else if (d == 2) {
    int loop = 0;
    int count = 0;
    while (count < n) {
      loop += 1;
      if (loop % 10000 == 0 && loop % 1000000 > 0) {
        count += 1;
      }
    }
    ans = loop;
  }
  cout << ans << endl;
  return 0;
}


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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(ba))

signed main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    int ans = 0;
    ans += x * min(n, k);
    ans += y * max(0, n-k);
    cout << ans << endl;
}

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

int main(){
    int n, m;
    while(cin >> n >> m){
        if(!n)
            break;
        if(n % 2 && m % 2){
            cout << "no" << endl;
        }else{
            cout << "yes" << endl;
        }
    }
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    set<pair<int, int> > edge;

    REP(i,N){
        REPi(j,i+1,N){
            auto p = make_pair(i, j);
            edge.insert(p);
        }
    }

    if(N%2 == 0){
        REP(i,N/2){
            auto p = make_pair(i, N-1-i);
            edge.erase(p);
        }
    }
    else{
        REP(i,N/2){
            auto p = make_pair(i, N-2-i);
            edge.erase(p);
        }
    }

    cout << edge.size() << endl;
    for(auto&& p : edge){
        cout << p.first+1 << " " << p.second+1 << endl;
    }

    return 0;
}


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

int main() {
  int K;
  int N;
  cin >> K >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  int s = 0;
  for (int i = 0; i < (N - 1); i++) {
    
    if (s < (A.at(i + 1) - A.at(i))) {
      s = A.at(i + 1) - A.at(i);
    }
    
  }
  if (s < (K + A.at(0) - A.at(N - 1))) {
    s = K + A.at(0) - A.at(N - 1);
  }

  cout << K - s << endl;
  
}


Measured memory_bytes: 1024
#include <stdio.h>
#define N 100000
#define Q 50000
#define notFound -1

int binarySearch(int[],int,int);

int main()
{
  int i,n,q,key,cnt=0,bS;
  int S[N];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    bS = binarySearch(S,key,n);
    if(bS != notFound){
      cnt++;
    }
  }
  printf("%d\n",cnt);
  
  
  return 0;
}

int binarySearch(int A[],int key,int n)
{
  int left=0,right,mid;
  
  right = n;
  while(left < right){
    mid = (left + right)/2;
    if(A[mid] == key){
      return mid;
    }
    else if(key<A[mid]){
      right = mid;
    }
    else {
      left = mid+1;
    }
  }
  return notFound;
  
}

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

typedef long long int ll;

int main(void){
	ll x, cnt;

	scanf("%lld", &x);

	cnt = 2*(x/11) + (x%11)/6 + (((x%11)-6*((x%11)/6))&&1);
	printf("%lld\n", cnt);
	

	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

struct tree {
	int value;
	unique_ptr<tree>ltree, rtree;
	tree(const int value_):value(value_) {

	}

};
void ins(unique_ptr<tree>&t, int num) {
	if (t == nullptr) {
		t = make_unique<tree>(num);
	}
	else {
		if (num < t->value) {
			ins(t->ltree, num);
		}
		else {
			ins(t->rtree, num);
		}
	}
}
void dfs(unique_ptr< tree>&t,bool mid,vector<int>&v) {
	if (mid) {
		v.emplace_back(t->value);
	}
	if (t->ltree) {
		dfs(t->ltree, mid, v);
	}
	if (!mid) {
		v.emplace_back(t->value);
	}
	if (t->rtree) {
		dfs(t->rtree, mid, v);
	}
	
	return;
}

int main() {
	int N; cin >> N;
	unique_ptr<tree> t(nullptr);
	while (N--) {
		string st;  cin >> st ;
		if (st == "print") {
			vector<int> v;
			for (int i = 0; i < 2; ++i) {
				dfs(t, bool(i), v);
				cout << " ";
				for (int i = 0; i < v.size(); ++i) {
					cout << v[i];
					if (i == v.size() - 1)cout << endl;
					else cout << " ";
				}
				v.clear();
			}
			
		}
		else {
			int a; cin >> a;
			ins(t, a);
		}
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    if ((n % 2 != 0)){
        ans = (n / 2) + 1;
        cout << ans << endl;
    }
    else cout << (ans = n /2) << endl;
    return 0;
}


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

typedef double f64;
typedef long long i64;
typedef int i32;
typedef pair<i32, i32> pi32;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef vector<i32> vi32;
typedef deque<i32> di32;

#define all(c) (c).begin(), (c).end()
#define REP(i, a, b) for (auto i = a; i < b; i++)
#define REPA(i, a, b, acc) for (auto i = a; i < b; i += acc)
#define PB push_back
#define PF push_front
#define PRINT(x) cout << #x ": " << (x) << endl;
#define TR(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); (it)++)
#define MAX_PRECISION cout << setprecision(numeric_limits<double>::max_digits10);

i32 main() {
  ios::sync_with_stdio(false);  // Makes IO faster, remove this line if C style scanf/printf needed.

  i32 n;
  string s;
  cin >> n >> s;
  // White at the beginning, black at the end.
  vi32 bPrefix(n + 1);
  REP(i, 1, n + 1) {
    bPrefix[i] = bPrefix[i - 1];
    bPrefix[i] += s[i - 1] == '#' ? 1 : 0;
  }
  i32 bTotal = bPrefix[n];

  i32 ret = n - bTotal;  // All black
  REP(i, 0, n) {
    i32 blackToWhite = bPrefix[i + 1];
    i32 whiteToBlack = n - i - 1 - (bTotal - bPrefix[i + 1]);
    ret = min(ret, blackToWhite + whiteToBlack);
  }
  cout << ret << endl;
}


Measured memory_bytes: 1428
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(void){

	string A,B;
	char ch;
	int use[10];
	int h,b;

	while(1){

		cin>>A>>B;
		if(A=="0"&&B=="0") break;

		h=0;b=0;
		for(int i=0;i<10;i++) use[i]=0;

		for(int i=0;i<4;i++){
			if(A[i]==B[i]) h++;
			use[A[i]-'0']++;
		}
		for(int i=0;i<4;i++){
			b+=use[B[i]-'0'];
		}
		b-=h;

		cout<<h<<" "<<b<<endl;
	}

}

Measured memory_bytes: 1184
main(){

  int i,n;
  int fi[45];
 
  scanf("%d",&n);
 
  fi[0]=1;
  fi[1]=1;

  for(i=2;i<=n;i++){
    fi[i]=fi[i-1]+fi[i-2];
  }

  printf("%d\n",fi[n]);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  string s, t;
  cin >> s >> t;

  ll len = s.size();
  ll ans = 0;
  for (int i = 0; i < len; i++) {
    if (s[i] != t[i]) {
      ans++;
    }
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <stack>

using namespace std;

typedef long long ll;
#define mem(a) (memset(a,0,sizeof(a)))
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))

const int maxn = static_cast<const int>(1e3 + 5);
const int mod = static_cast<const int>(1e9);

int t[maxn], a[maxn];
ll T[maxn], A[maxn];

int main() {
    int n;
    ll ak, tk, k;
    scanf("%d", &n);
    rep(i, n)scanf("%d%d", &t[i], &a[i]);
    T[0] = t[0];
    A[0] = a[0];
    for (int i = 1; i < n; i++) {
        if (t[i] >= T[i - 1] && a[i] >= A[i - 1]) {
            T[i] = t[i];
            A[i] = a[i];
        } else {
            if (A[i - 1] % a[i] == 0)ak = A[i - 1] / a[i];
            else ak = A[i - 1] / a[i] + 1;
            if (T[i - 1] % t[i] == 0)tk = T[i - 1] / t[i];
            else tk = T[i - 1] / t[i] + 1;
            k = MAX(ak, tk);
            A[i] = a[i] * k;
            T[i] = t[i] * k;

        }
    }
    printf("%lld\n", T[n - 1] + A[n - 1]);

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
using namespace std;

int64_t modinv(int64_t a, int64_t mod) {
  int64_t b = mod;
  int64_t u = 1;
  int64_t v = 0;
  while (b) {
    int64_t t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= mod;
  if (u < 0) u += mod;
  return u;
}

int64_t nCr(int64_t n, int64_t r) {
  int64_t y = 1;
  int64_t r0 = r;
  while (r0) {
    y = (y * r0) % MOD;
    r0--;
  }
  int64_t x = 1;
  while (r) {
    x = (x * n) % MOD;
    r--;
    n--;
  }
  int64_t ret = x * modinv(y, MOD) % MOD;
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  int64_t n, a, b;
  cin >> n >> a >> b;

  int64_t ans = 1;
  int64_t m = n;
  int64_t nn = 2;
  while (m) {
    if (m % 2) ans = (ans * nn) % MOD;
    nn = (nn * nn) % MOD;
    m /= 2;
  }
  ans = ans - 1;
  if (ans < 0) ans += MOD;
  ans = (ans - nCr(n, a));
  if (ans < 0) ans += MOD;
  ans = (ans - nCr(n, b));
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::Ordering;

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    input! {
        x: usize, y: usize, z: usize, k: usize,
        a: [i64; x],
        b: [i64; y],
        c: [i64; z],
    }

    let mut ab = vec![];
    for &a in &a {
        for &b in &b {
            ab.push(a + b);
        }
    }
    ab.sort_by_key(|&x| Rev(x));
    ab.truncate(k);

    let mut abc = vec![];
    for &ab in &ab {
        for &c in &c {
            abc.push(ab + c);
        }
    }
    abc.sort_by_key(|&x| Rev(x));
    abc.truncate(k);

    for x in abc {
        println!("{}", x);
    }
}


Measured memory_bytes: 44276
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     debug(i)            cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    string s; cin>>s;
    for(int i = 0;i < s.length(); ++i){
        if(s[i]-'0'==7){
            cout<<"Yes\n";
            return;
        }
    }
    cout<<"No\n";
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 3652