akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=16;

int n;
int a[MAXN][MAXN];

ll sum[1<<MAXN];
ll dp[1<<MAXN];

ll solve() {
	FOR(mask,1,1<<n) { sum[mask]=0; REP(i,n) if(mask&(1<<i)) FOR(j,i+1,n) if(mask&(1<<j)) sum[mask]+=a[i][j]; }
	FOR(mask,1,1<<n) {
		dp[mask]=sum[mask];
		int others=(1<<n)-mask-1;
		for(int i=(others+1)&mask;i<mask;i=(i+others+1)&mask) {
			dp[mask]=max(dp[mask],dp[i]+dp[mask^i]);
		}
	}
	return dp[(1<<n)-1];
}

void run() {
	scanf("%d",&n); REP(i,n) REP(j,n) scanf("%d",&a[i][j]);
	printf("%lld\n",solve());
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    string S;
    cin >> S;
    int N = S.length();

    vector<vector<ll>> dp(N+1, vector<ll> (4, 0));
    if(S[0] == 'A'){
        dp[1][0] = 1;
        dp[1][1] = 1;
    }
    else if(S[0] == 'B'){
        dp[1][0] = 1;
        dp[1][1] = 0;
    }
    else if(S[0] == 'C'){
        dp[1][0] = 1;
        dp[1][1] = 0;
    }
    else if(S[0] == '?'){
        dp[1][0] = 3;
        dp[1][1] = 1;
    }

    for (int i = 2; i < N+1; i++) {
        if(S[i-1] == 'A'){
            dp[i][0] = dp[i-1][0];
            dp[i][1] = (dp[i-1][1] + dp[i-1][0]) % MOD;
            dp[i][2] = dp[i-1][2];
            dp[i][3] = dp[i-1][3];
        }
        else if(S[i-1] == 'B'){
            dp[i][0] = dp[i-1][0];
            dp[i][1] = dp[i-1][1];
            dp[i][2] = (dp[i-1][2] + dp[i-1][1]) % MOD;
            dp[i][3] = dp[i-1][3];
        }
        else if(S[i-1] == 'C'){
            dp[i][0] = dp[i-1][0];
            dp[i][1] = dp[i-1][1];
            dp[i][2] = dp[i-1][2];
            dp[i][3] = (dp[i-1][3] + dp[i-1][2]) % MOD;
        }
        else if(S[i-1] == '?'){
            dp[i][0] = dp[i-1][0] * 3 % MOD;
            dp[i][1] = (dp[i-1][1] * 3 % MOD + dp[i-1][0]) % MOD;
            dp[i][2] = (dp[i-1][2] * 3 % MOD + dp[i-1][1]) % MOD;
            dp[i][3] = (dp[i-1][3] * 3 % MOD + dp[i-1][2]) % MOD;
        }
    }

    ll ans = dp[N][3];

    printf("%lld\n", ans);




}

Measured memory_bytes: 10388
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define ll long long

using namespace std;

int main()
{
    int n;
    cin >> n;
    long long sum(0);
    vector <int> a(n), b(n);
    for(int i = 0; i < n; i++)
        cin >> a[i], b[i] = a[i] - i;
    sort(b.begin(), b.end());
    if(n % 2 == 0)
    {
        ll ans(0);
        int cur = b[n / 2];
        for(int i = 0; i < n; i++)
            ans += abs(b[i] - cur);
        cur = b[n / 2 - 1];
        ll cur_ans(0);
        for(int i = 0; i < n; i++)
            cur_ans += abs(b[i] - cur);
        ans = min(ans, cur_ans);
        cout << ans;
    }
    else
    {
        ll ans(0), cur = b[n / 2];
        for(int i = 0; i < n; i++)
            ans += abs(b[i] - cur);
        cout << ans;
    }
}


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

#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; const int inf = 1e9 + 7;
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cout << str << " : " << t << endl;}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cout << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cout << "["; for (T i = a; i != b; ++i) {if (i != a) cout << ", "; cout << *i;} cout << "]";cout<<endl;}

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

	int n; cin >> n;
	if (n == 3) {
		cout << "2 5 63\n";
		return 0;
	}

	map<int, vi> mp;
	FOR (i, 1, 30000) if (i % 2 == 0 or i % 3 == 0) {
		if (i > 3) mp[i % 6].push_back(i);
	}

	int tot = 20000;
	while (tot > n) {
		if (sz(mp[2]) and sz(mp[4]) and tot > n + 1) {
			mp[2].pop_back(), mp[4].pop_back();
			tot -= 2;	
		} else if (sz(mp[3]) > 1 and tot > n + 1) {
			mp[3].pop_back(), mp[3].pop_back();
			tot -= 2;
		} else if (sz(mp[0])) {
			mp[0].pop_back();
			tot--;
		} else {
			assert(0);
		}
	}
	cout << "2 3 ";
	for (auto it : mp) for (auto itt : it.S) cout << itt << " ";

	return 0;
}


Measured memory_bytes: 512
#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define REP(i,a,n) for(int i = (a); i < (n); i++)
#define ALL(v) v.begin(), v.end()
ll A[100000];
ll L[100000], R[100000];
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	int N;
	cin >> N;
	rep(i, N) cin >> A[i];
	L[0] = A[0];
	for (int i = 1; i < N; i++) L[i] = gcd(L[i - 1], A[i]);
	R[N - 1] = A[N - 1];
	for (int i = N - 2; i >= 0; i--) R[i] = gcd(R[i + 1], A[i]);
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ll g = 0;
		if (i > 0) g = gcd(g, L[i - 1]);
		if (i + 1 < N) g = gcd(g, R[i + 1]);
		ans = max(ans, g);
 	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
/*
Looking from a window above
It's like a story of love
Can you hear me?
Came back only yesterday
I'm moving further away
Want you near me
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you
Sometimes when I think of her name
When it's only a game
And I need you
Listen to the words that you say
It's getting harder to stay
When I see you
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you
Uh uh uh only you, only you
Only you, only you, only you
This is going to take a long time
And I wonder what's mine
Can't take no more
Wonder if you'll understand
It's just the touch of your hand
Behind a closed door
And all I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you, only you
All I needed was the love you gave
All I needed for another day
And all I ever knew
Only you, only you, only you
Only you
*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) ((int)(x.size()))
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define see(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define see(x...)
#endif

const int inf = 3e18;
const int N = 5e5 + 100;




int32_t main(){ 
   FAST;
   string s;
   cin >> s;
   int ans = 0;
   cout << (s[0] + s[1] + s[2] - 3 * '0') << '\n';
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
    int N;
    int a[3000];
    int result = 0;
    scanf("%d", &N);
    int i;
    for (i = 0; i < N; i++) {
        scanf("%d", &a[i]);
    }

    for (i = 0; i < N; i++) {
        result += a[i] - 1;
    }

    printf("%d", result);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int iinf = 1 << 29;
const int imax = ~(1 << 31);
const long long linf = 1ll << 61;
const long long lmax = ~(1ll << 63);

#define dump(x) cerr << #x << " : " << x << '\n'
#define MOD(x, y) (((y) + (x) % (y)) % (y))

int n;
ll a[100000];

int main(int argc, char* argv[])
{
	scanf("%d", &n);
	ll M = 0;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		M = max(M, a[i]);
	}
	ll m = linf;
	ll k;
	for (int i = 0; i < n; i++) {
		if (M == a[i]) continue;
		ll p = abs(M - 2 * a[i]);
		if (p < m) {
			m = p;
			k = a[i];
		}
	}
	printf("%lld %lld\n", M, k);

	return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};

bool isprime(int n){
  if(n == 1)return false;
  bool flag = true;
  for(int i = 2;i*i <= n;i++){
    if(!(n % i))flag = false;
  }
  return flag;
}

int bs(vector<int> &like,int n,bool b){
  int left = -1,right = (int)like.size();
  if(b){
    while(right-left > 1){
      int mid = (left+right)/2;
      if(like[mid] > n)right = mid;
      else left = mid;
    }
    return left;
  }else{
    while(right-left > 1){
      int mid = (left+right)/2;
      if(like[mid] >= n)right = mid;
      else left = mid;
    }
    return right;
  }
}

int main(){

  int q;
  cin >> q;
  vector<int> like;
  for(int i = 3;i < 100000;i+=2){
    if(isprime(i) && isprime((i+1)/2))like.push_back(i);
  }

  for(int i = 0;i < q;i++){
    int l,r;cin >> l >> r;
    int left = bs(like,l,false),right = bs(like,r,true);
    if(right>=left)cout << right-left+1 << endl;
    else cout << 0 << endl;

  }



  return 0;
}


Measured memory_bytes: 640
package main

import (
	"bufio"
	"container/list"
	"fmt"
	"os"
	"strconv"
)

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	n := len(list)
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list[0 : n-1] {
		buf.Write([]byte(fmt.Sprintf("%d ", v)))
	}
	buf.Write([]byte(fmt.Sprintf("%d\n", list[n-1])))
	buf.Flush()
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

//solve
const (
	MAX = 100000
	NIL = -1
)

var (
	n, m, q, s, t int
	G             [MAX][]int //連結リスト
	color         [MAX]int
)

func dfs(r int, c int) {
	S := list.New()
	S.PushFront(r)
	color[r] = c
	for S.Len() != 0 {
		u := S.Remove(S.Front()).(int)
		for i := 0; i < len(G[u]); i++ {
			v := G[u][i]
			if color[v] == NIL {
				color[v] = c
				S.PushFront(v)
			}
		}
	}
}

//幅優先探索で、頂点を色付け
func assignColor() {
	id := 1
	for i := 0; i < n; i++ {
		color[i] = NIL
	}
	for i := 0; i < n; i++ {
		if color[i] == NIL {
			id++
			dfs(i, id)
		}
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m = nextInt(), nextInt()
	for i := 0; i < m; i++ {
		s, t = nextInt(), nextInt()
		if i == 0 {
			G[s] = make([]int, 0)
			G[t] = make([]int, 0)
		}
		G[s] = append(G[s], t)
		G[t] = append(G[t], s)

	}
	assignColor()
	q = nextInt()
	for i := 0; i < q; i++ {
		s, t = nextInt(), nextInt()
		if color[s] == color[t] {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}

}



Measured memory_bytes: 11900
#include<iostream>
#include<string>

using namespace std;

int main( )
{
	string taro, hanako;
	int tscore, hscore;
	int n;
	cin>>n;
	
	tscore = hscore = 0;
	while( n-- ) {	
		cin>>taro>>hanako;
		if( taro < hanako ) {
			hscore += 3;		
		} else if( hanako < taro ) {
			tscore += 3;
		} else {
			tscore += 1;
			hscore += 1;
		}
	}
	cout<<tscore<<" "<<hscore<<endl;
	
	return 0;
}

Measured memory_bytes: 1208
#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--)

ll pow_mod(ll n, ll k, ll m) {
    if (k == 0) {
        return 1;
    } else if (k%2) {
        return pow_mod(n, k-1, m) * n % m;
    } else {
        ll t = pow_mod(n, k/2, m);
        return t*t%m;
    }
}

ll comb(ll n, ll r) {
    ll ans = 1;

    for (ll i = n; i > n-r; i--) {
        ans = ans*i%MOD;
    }
    for (ll i = 1; i < r+1; i++) {
        ans = ans*pow_mod(i, MOD-2, MOD) % MOD;
    }

    return ans%MOD;
}

ll dcomb(ll n, ll r) {
    return comb(n+r-1, r);
}

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

    ll N, a, b;
    cin >> N >> a >> b;

    ll tmp1 = pow_mod(2, N, MOD) - 1;
    ll tmp2 = comb(N, a);
    ll tmp3 = comb(N, b);

    ll ans = tmp1 + MOD - tmp2;
    ans %= MOD;
    ans += MOD - tmp3;
    ans %= MOD;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
lst = [list(map(int,input().split())) for _ in range(n-1)]
c = [[] for _ in range(n+1)]
for i in lst:
  c[i[0]].append([i[1],i[2]])
  c[i[1]].append([i[0],i[2]])
ans = [0]*(n+1)
pool = [1]
done = set()
done.add(1)
while pool:
  start = pool.pop()
  for l in c[start]:
    if l[0] not in done:
      ans[l[0]] = ans[start] + l[1]
      done.add(l[0])
      pool.append(l[0])
for i in ans[1:]:
  print(int(i%2))

Measured memory_bytes: 68100
#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;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max

int main ()  {
    cout << fixed << setprecision(18);

    int n,k;cin>>n>>k;

    ll a[20];
    rep(i,n) {
        cin>>a[i];
    }

    ll ans=99999999999999999;
    for (int bit=0;bit<(1<<(n-1));bit++) {
        ll tmp=1;
        ll mymax=a[0];
        ll money=0;
        for(int j=0;j<n-1;j++){
            if(((1<<j)&bit)==0){
                if(mymax>=a[j+1]){
                    money+=(-a[j+1]+mymax)+1;
                    mymax++;
                }
                tmp++;
            }else if(mymax<a[j+1]){
                tmp++;
            }
            mymax=max(mymax,a[j+1]);
        }
        if (tmp>=k) {
            ans=min(ans,money);
        }
    }

    cout<<ans<<endl;

}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

long long C(int n, int r) {
    if (r > n - r) r = n - r;
    long long ans = 1;
    for (int i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }
    return ans;
}

void solve() {
    int n, p;
    cin >> n >> p;

    vector<int> v(n);
    int o = 0, e = 0;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        if (v[i] & 1)o++;
        else e++;
    }
    int ans = 0;
    if (p == 1) {
        int tp = 0;
        for (int i = 1; i <= o; i += 2)
            tp += C(o, i);
        ans = pow(2, e) * (tp);
    } else {
        int tp = 0;
        for (int i = 0; i <= o; i += 2)
            tp += C(o, i);
        ans = pow(2, e) * (tp);
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(n);
  for (int i = 0; i<m; i++){
    int a, b;
  	cin >> a >> b;
    vec.at(a-1) += 1;
    vec.at(b-1) += 1;
  }
  for (int i = 0; i<n; i++){
  	cout << vec.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}


ll f[100001],rf[100001];

ll inv(ll x){
	ll ret=1;
	ll k=mod-2;
	ll y=x;
	while(k){
		if(k&1) ret=(ret*y)%mod;
		y=(y*y)%mod;
		k/=2;
	}
	return ret;
}

void init(){
	f[0]=1;
	for(int i=1;i<=100000;++i) f[i]=(f[i-1]*i)%mod;
	rep(i,100001) rf[i]=inv(f[i]);
}

ll calc(int n,int k){
	ll a=f[n];
	ll b=rf[n-k];
	ll c=rf[k];
	ll bc=(b*c)%mod;
	return (a*bc)%mod;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	init();
	vector<ll> ans(k);
	rep(i,k){
		if(n-k+1<i+1) break;
		ans.at(i)=calc(n-k+1,i+1)*calc(k-1,i)%mod;
	}
	rep(i,k) cout << ans.at(i) << endl;
}


Measured memory_bytes: 1792
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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 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--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	ll n,k;
	cin >> n >> k;
	if(n>=k)n= n%k;
    ll x=0;
	x=min(k-n,n);
	cout << x <<endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
x=list(map(int,input().split()))
x.append(0)
x.sort()
x_0=x.index(0)

if x_0 == 0:
    print(x[k])
elif x_0==n:
    print(-x[-k-1])
else:
    r = min(n-x_0, k)
    l = min(x_0, k)
    ans1=float("inf")
    ans2=float("inf")
    #スタートで正に移動
    for i in range(1,r+1):
        if  k-i <= l:
            s = 2*x[x_0 + i] - x[x_0 - (k-i)]
            ans1=min(ans1, s)
    #スタートで負に移動
    for i in range(1,l+1):
        if k-i <= r:
            s = -2*x[x_0 - i] + x[x_0 + (k-i)]
            ans2=min(ans2, s)
    print(min(ans1, ans2))


Measured memory_bytes: 14480
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
namespace Mylib{
    
    int Factorial(int N){
        if(N==0||N==1)return 1;
        int ans=0;
        if(N>=2){
            ans=Factorial(N-1);
        }
        return N*ans;
    }
}
int main(void){
    int N;
    cin >> N;
    vector<int> vInt;
    vector<int> vTemp;
    for(int i=1;i<=N;i++)vTemp.push_back(i);
    
    
    int tempInt=0;
    for(auto x:vTemp)tempInt=tempInt*10+x;
    vInt.push_back(tempInt);
    while(next_permutation(vTemp.begin(),vTemp.end())){
        tempInt=0;
        for(auto x:vTemp)tempInt=tempInt*10+x;
        vInt.push_back(tempInt);
    }
    int P=0;
    int Q=0;
    for(int i=0;i<N;i++){
        cin >> tempInt;
        P=P*10+tempInt;
    }
    for(int i=0;i<N;i++){
        cin >> tempInt;
        Q=Q*10+tempInt;
    }
    auto result1=find(vInt.begin(),vInt.end(),P);
    auto result2=find(vInt.begin(),vInt.end(),Q);
    
    int ans=distance(result1,result2);
    
    cout << abs(ans) << endl;
    return 0;
}

Measured memory_bytes: 640
s = input()
a = int(s[0:2])
b = int(s[2:4])
if (a > 12 or a == 0) and 0 < b < 13:
  print('YYMM')
elif (b > 12 or b == 0) and 0 < a < 13:
  print('MMYY')
elif (b > 12  or a == 0) and (a == 0 or a > 12):
  print('NA')
elif int(s) == 1700:
  print('NA')
else:
  print('AMBIGUOUS')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n,s;
  cin >> n;
  s=0;
  for(int i=1; i<=n; i++){
    long long x=n/i;
    s += x*(x+1)/2*i;
  }
  cout << s << endl;
  
}

Measured memory_bytes: 3636
program ccc
implicit none

character(10**5+1) :: s
integer :: l, zero, one, i

read*, s
l=len_trim(s)

zero=0
one=0
do i=1,l
if(s(i:i)=='0') then
zero=zero+1
else
one=one+1
end if
end do

write(*,'(i0)') min(zero,one)*2

end program

Measured memory_bytes: 700
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int[][] a = new int[7][7];
        for(int i = 0; i < 7; i++) {
            a[i][0] = stdIn.nextInt();
            a[i][1] = stdIn.nextInt();
        }
         
        int[] ans = new int[7];
        for(int i = 0; i < 7; i++) {
            if(a[i][0] < a[i][1]) {
                ans[i] = a[i][1]-a[i][0];
            }
            else {
                ans[i] = a[i][0]-a[i][1];
            }
        }
         
        for(int i = 0; i < 7; i++) {
            System.out.println(ans[i]);
        }
    }
         
}

Measured memory_bytes: 17176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 100005
#define PI 3.1415926535897932384626433
#define gcd(a,b) __gcd(a,b)

using namespace std;

ll power(ll x,ll y,ll p)
{
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0)
    {
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}



int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);

    ll T=1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        vector<pair<ll,ll>> arr(n);
        forn(i,n) cin>>arr[i].first>>arr[i].second;
        vector<ll> a(n),b(n);
        forn(i,n){
            a[i]=2*min(arr[i].first,arr[i].second);
            b[i]=2*max(arr[i].first,arr[i].second);
        }
        sort(a.begin(),a.end());
        sort(b.begin(),b.end());
        ll y,x;
        if(n%2==0){
            y=b[n/2-1]+b[n/2];
            x=a[n/2-1]+a[n/2];
        }
        else{
            y=b[(n+1)/2-1];
            x=a[(n+1)/2-1];
        }
        cout<<(y-x+2)/2;

    }


    return 0;
}

Measured memory_bytes: 9532
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Time Limit Exceeded
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int INF = 1 << 30;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n, t;
  scanf("%d%d", &n, &t);

  int minc = INF;
  for (int i = 0; i < n; i++) {
    int ci, ti;
    scanf("%d%d", &ci, &ti);

    if (ti <= t && minc > ci) minc = ci;
  }

  if (minc >= INF) puts("TLE");
  else printf("%d\n", minc);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int const nmax = 5000;
int const lgmax = 12;
int const modulo = 1000000007;
int cat[5 + nmax];

int lgpow(int a, int b){
  if(b == 0)
    return 1;
  else if(b == 1)
    return a;
  else {
    int result = lgpow(a, b / 2);
    if(b % 2 == 0)
      return 1LL * result * result % modulo;
    else
      return 1LL * result * result % modulo * a % modulo;
  }
}

void computecat(){
  cat[0] = 1;
  for(int i = 1;i <= nmax; i++)
    for(int j = 0; j < i; j++) {
      cat[i] += 1LL * cat[j] * cat[i - 1 - j] % modulo;
      if(modulo <= cat[i])
        cat[i] -= modulo;
    }

}
int empt[5 + nmax][5 + nmax];
int dp[1 + nmax], dp2[1 + nmax];
int far[1 + lgmax][1 + nmax];

void computefar(int n, int spaces){
  for(int i = 0;i <= n; i++)
    far[0][i] = cat[i];
  for(int h = 1;h <= lgmax; h++)
    for(int i = 0;i <= n; i++)
      for(int j = 0;j <= n - i; j++)
        if(i + j <= n) {
          far[h][i + j] += 1LL * far[h - 1][i] * far[h - 1][j] %modulo;
          if(modulo <= far[h][i + j])
            far[h][i + j] -= modulo;
        }
  dp[0] = 1;
  for(int h = lgmax; 0 <= h; h--)
    if(0 < ((1 << h) & spaces)) {
      for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n - i; j++)
          if(i + j <= n) {
            dp2[i + j] += 1LL * dp[i] * far[h][j] % modulo;
            if(modulo <= dp2[i + j])
              dp2[i + j] -= modulo;
          }

      for(int i = 0; i <= n; i++) {
        dp[i] = dp2[i];
        dp2[i] = 0;
      }
    }
}

int main()
{
  int n,k;
  string s;
  cin >> n >> s;
  k = s.size();
  computecat();
  empt[0][0] = 1;
  for(int i = 1;i <= n; i++) {
    empt[i][0] = (empt[i - 1][0] + empt[i - 1][1]) % modulo;
    for(int j = 1; j <= i; j++)
      empt[i][j] = (empt[i - 1][j + 1] + 1LL * 2 * empt[i - 1][j - 1]) % modulo;
  }
  int result = 0;
  int lost = n - k;
  computefar(lost, k);


  for(int i = 0; i <= lost; i++){
    if((lost - i) % 2 == 0) {
      result += 1LL * empt[i][0] * dp[(lost - i) / 2] % modulo * lgpow(2, (lost - i) / 2) % modulo;
    }
    if(modulo <= result)
      result -= modulo;
  }
  cout << result << '\n';
  return 0;
}


Measured memory_bytes: 97024
#!/usr/bin/env python3
# coding: utf-8
# import pprint
# import numpy as np
# import code
import functools

if __debug__:
    def debug(arg):
        pass
else:
    import sys
    def debug(arg):
        debug = lambda *x: None
        print(arg, file=sys.stderr)

n, m = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
# d = dict.fromkeys(range(1, n), 0)
debug([m, n])
debug(a)

c = 0
t = sum(a)
debug(t)
s = t / (4 * m)
debug(s)
for aa in a:
    if aa >= s:
        c += 1
        if c >= m:
            print('Yes')
            exit()

# debug(c)
print('No')


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
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(a > b){a = b; return 1;}return 0;}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // Educational DP Contest H - Grid1
  // dp[i][j] : マス(i, j)に到達する経路数
  // 状態遷移
  // dp[i][j] = max(dp[i][j], dp[i-1][j] + dp[i][j-1])
  // 初期設定（全てのマスを0にする）
  // dp[1][1] = 1（最初に太郎君がいる場所）
  // マス(i, j)が'#'ならば、そのマスは0とする
  // dp[H][W]が答え
  int mod = 1e9 + 7;
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  REP(i, H){
    cin >> a.at(i);
  }
  vector<vector<int> > dp(H+1, vector<int>(W+1, 0));
  dp[1][1] = 1;
  for(int i = 1; i <= H; i++){
    for(int j = 1; j <= W; j++){
      if(a.at(i-1).at(j-1) == '#'){
        dp[i][j] = 0;
      }else{
        dp[i][j] = max(dp[i][j], dp[i-1][j] + dp[i][j-1]) % mod;
      }
    }
  }
  cout << dp[H][W] % mod << endl;
}


Measured memory_bytes: 5248
import math
import sys
readline = sys.stdin.readline


def main():
    x, n = map(int, readline().rstrip().split())
    p = list(map(int, readline().rstrip().split()))
    for k in range(100):
        if p.count(x - k) == 0:
            print(x - k)
            break
        if p.count(x + k) == 0:
            print(x + k)
            break


if __name__ == '__main__':
    main()


Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 3e5 + 1; int n;
const lli mod = 1e9 + 7;
lli a[maxN];
lli r[60][2][maxN];

lli multMod(lli x, lli y)
{
  lli ans = 0;
  while (y)
  {
    if (y & 1LL) ans = (ans + x) % mod;
    x = (x + x) % mod, y >>= 1LL;
  }
  return ans;
}

int main()
{
  while (scanf("%d", &n) != EOF)
  {
    for (int i = 0; i < n; i ++)
      scanf("%lld", &a[i]);
    for (lli bit = 0; bit < 60; bit ++)
    {
      r[bit][0][n] = r[bit][1][n] = 0;
      for (int i = n - 1; i >= 0; i --)
      {
        r[bit][0][i] = !((a[i] >> bit) & 1LL) + r[bit][0][i + 1];
        r[bit][1][i] = ((a[i] >> bit) & 1LL) + r[bit][1][i + 1];
      }
    }

    lli ans = 0;
    for (lli bit = 0; bit < 60; bit ++)
      for (int i = 0; i < n - 1; i ++)
        ans = (ans + multMod((1LL << bit), r[bit][!((a[i] >> bit) & 1LL)][i + 1])) % mod;
    printf("%lld\n", ans);
  }
  return 0;
}

Measured memory_bytes: 283776
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<float> vfloat;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main(void){
    int n;
    cin >> n;
    if (n == 1) {
        puts("Hello World");
        return 0;
    }
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
}

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

int main()
{
    int r, c, i, j;
    cin >> r >> c;
    vector<vector<int>> v(r, vector<int>(c));
    vector<int> v2(101, 0);
    int last_sum = 0;

    for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
            cin >> v.at(i).at(j);
        }
    }

    for (i = 0; i < r; i++) {
        int sum = 0;
        int sum2 = 0;
        for (j = 0; j < c; j++) {
            cout << v.at(i).at(j) << " ";
            sum += v.at(i).at(j);
            v2.at(j) += v.at(i).at(j);
        }
        cout << sum << endl;
        // sum2 += v.at(i).at(j);
        // v2.push_back(sum2);
    }

    for (i = 0; i < c; i++) {
        cout << v2.at(i) << " ";
        last_sum += v2.at(i);
    }
    cout << last_sum << endl;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
int n,primes[60000],PF[60000],gesu;
void eratos()
{
    for(int i=1;i<=55555;i+=2) primes[i]=1;
    for(int i=3;i<=55555;i+=2)
        if(primes[i])
        {
            if(1LL*i*i<=55555) for(int j=i*i;j<=55555;j+=i) primes[j]=0;
            if(i%5==1) PF[++gesu]=i;
        }
}
int main(void)
{
    scanf("%d",&n);
    eratos();
    for(int i=1;i<=n;i++) printf("%d ",PF[i]);
}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
// #define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    ll n;
    cin>>n;
    double t,a,h[10010];
    cin>>t>>a;
    rep(i,n){
        cin>>h[i];
        h[i]=t-h[i]*0.006;
    }
    double res=LLINF;
    ll ans=0;
    rep(i,n){
        if(chmin(res,abs(h[i]-a))) ans=i+1;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;


public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final int n = scanner.nextInt();
    int[][] a = new int[9][9];
    int count = 0;

    for (int i = 1; i <= n; i++) {
      char[] cs = String.valueOf(i)
          .toCharArray();
      int t = Character.getNumericValue(cs[cs.length - 1]);
      if (t != 0) {
        int h = Character.getNumericValue(cs[0]);
        a[h - 1][t - 1]++;
//        System.out.println(h + " " + t);
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        count += a[i][j] * a[j][i];

      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 39232
N, A, B = [int(x) for x in input().split()]


def digit_sum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = int (n / 10)
    return sum
ans = 0
for i in range(0, N+1):
    sum = digit_sum(i)
    if sum >= A and sum <= B:
        ans += i
print(ans)



Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll a;  cin >> a;
    string s;
    cin >> s;

    if(a>=3200) cout << s << endl;
    else cout << "red" << endl;
    
    return 0;
}


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

typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)(N); i++)

// chmax, chmin
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; }

int main() {
    ll X,Y;
    cin >> X >> Y;
    
    
    ll ans = 1;
    REP(i,1e+7){
        X *= 2;
        if ( X <= Y ) ++ ans;
        else break;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,d;
    cin>>n>>d;
    double x[n][d];
    rep(i,n){
        rep(j,d){
            cin>>x[i][j];
        }
    }
    int cnt=0;
    rep(i,n){
        repi(k,i+1,n){
            double sum=0;
            rep(j,d){
                double diff=abs(x[i][j]-x[k][j]);
                sum+=diff*diff;
            }
            bool flag=false;
            rep(j,sum+1) if(j*j==sum) flag=true;
            if(flag) cnt++;
        }
    }
    cout<<cnt;
}

Measured memory_bytes: 3780
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

// 0-based Binary Indexed Tree
// 数え上げ用
template<typename T> struct BIT {
    int max;
    vector<T> bit;
    BIT(int max) : max(max) {bit.resize(max+1);}
    // [0, i)
    T sum(int i) {
        T s = 0;
        while (i > 0) {
            (s += bit[i]);
            i ^= i&-i;
        }
        return s;
    }
    // 0-basedな座標iに値xを追加する
    void add(int i, T x) {
        ++i;
        while (i <= max) {
            (bit[i] += x);
            i += i&-i;
        }
    }
    // [a, b)
    T sum(int a, int b) {
        return sum(b)-sum(a);
    }
    // sum(0, i) >= wとなる最小のiを求める 存在しなければmaxを返す
    int lb(T w) {
        if (w <= 0) return 0;
        int k = 1;
        while (k <= max) k <<= 1;
        int i = 0;
        for (; k > 0; k >>= 1) if (i+k <= max && bit[i+k] < w) {
            w -= bit[i+k];
            i += k;
        }
        return i+1;
    }
};

int A[222222];
int rA[222222];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        rA[A[i]] = i;
    }
    ll ans = 0;
    BIT<int> bit(N+10), rbit(N+10);
    for (int i = 1; i <= N; i++) {
        int l = bit.lb(bit.sum(rA[i]));
        int r = N-rbit.lb(rbit.sum(N-1-rA[i]));
        ans += i * (ll)(r-rA[i]) * (rA[i]-l+1);
        bit.add(rA[i], 1);
        rbit.add(N-1-rA[i], 1);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define ll long long

const ll mod = 1e9 + 7;

ll big_mod(ll a, ll p) {

    if(p == 0) return 1LL;

    ll ret = big_mod(a, p / 2);
    ret *= ret;
    ret %= mod;

    if(p & 1){
        ret *= a;
        ret %= mod;
    }
    return ret;
}
ll inv(ll x) {
    return big_mod(x, mod - 2);
}

ll F[5000010];

int main() {

    F[0] = 1LL;

    for(int i = 1; i <= 5000000; i++){
        F[i] = F[i - 1] * (ll)i;
        F[i] %= mod;
    }

    int x, y, A, B;
    cin >> x >> y;

    A = 2 * y - x;
    B = 2 * x - y;

    if(A % 3 || B % 3 || A < 0 || B < 0){
        cout << 0 << endl;
    }
    else {
        A /= 3, B /= 3;
        ll ans = F[A + B];
        ans *= inv(F[A]);
        ans %= mod;
        ans *= inv(F[B]);
        ans %= mod;
        cout << ans << endl;
    } 

    return 0;
}

Measured memory_bytes: 39296
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

struct Data
{
    int x, y;
};

Data in[1000000];
Data ans[1000000];

bool cmp(Data a, Data b)
{
    if (a.x == b.x)
        return a.y < b.y;
    return a.x < b.x;
}

int main()
{
    int n, p, q;
    while (cin>>n>>p>>q)
    {
        if (n + p + q == 0) break;

        int cnt = 0;
        int k, a, b;
        for (int i = 1; i <= n; i++)
        {
            int pp = p;
            cin>>k;
            for (int j = 1; j <= k; j++)
            {
                cin>>a>>b;
                if (a > pp)
                {
                    in[cnt].x = pp, in[cnt].y = a;
                    cnt++;
                }
                pp = b;
            }
            if (pp < q)
            {
                in[cnt].x = pp, in[cnt].y = q;
                cnt++;
            }
        }

//        for (int i = 0; i < cnt; i++)
//            cout<<in[i].x<<" "<<in[i].y<<endl;

        sort(in, in+cnt, cmp);

        int inx = 0;
        for (int i = 1; i < cnt; i++)
        {
            if (in[i-1].y >= in[i].x)
            {
                in[i].x = in[i-1].x;
                in[i].y = max(in[i-1].y, in[i].y);
            }
            else
            {
                ans[inx].x = in[i-1].x;
                ans[inx].y = in[i-1].y;
                inx++;
            }
        }
        if (cnt > 1)
        {
            ans[inx].x = in[cnt-1].x;
            ans[inx++].y = in[cnt-1].y;
        }

//        cout<<endl;
//        for (int i = 0; i < inx; i++)
//            cout<<ans[i].x<<" "<<ans[i].y<<endl;

        int Max = 0;
        for (int i = 0; i < inx; i++)
            Max = max(Max, ans[i].y - ans[i].x);
        int h = Max / 100;
        Max %= 100;
        Max += 60*h;
        cout<<Max<<endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

void solve(){
    ll N;
    cin >> N;

    vector<ll> a(N+1);
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }

    vector<ll> b(N+1);
    for (int i = N; i > 0; i--) {
        ll sum = 0;
        for (int j = 2; j <= N / i; j++) {
            sum += b[j*i];
        }
        b[i] = a[i] ^ (sum & 1);
    }

    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        if (b[i] == 1) {
            cnt++;
        }
    }

    if (cnt == 0) {
        cout << 0 << endl;
        return;
    }

    vector<ll> candidate;
    for (int i = 1; i <= N; i++) {
        if (b[i] == 1) {
            candidate.push_back(i);
        }
    }

    cout << cnt << endl;
    for (int i = 0; i < cnt; i++) {
        if (i == 0) {
            cout << candidate[0];
        } else {
            cout << " " << candidate[i];
        }
    }
    cout << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    string s;
    cin >> s;
    int cnt = 0;
    rep(i, s.size()) if (s[i] == '0') cnt++;
    int tmp = s.size() - cnt;
    cout << 2 * min(cnt, tmp) << endl;
}

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

#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> v(n);

    for (int i = 0 ;i < n; i++) cin >> v[i];

    int min = 1e9;
    for (int ai = -100; ai <= 100; ai++) {
        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += (ai - v[i]) * (ai - v[i]);
        }
        if (sum < min) {
            min = sum;
        }
    }
    cout << min << endl;
    return 0;
}


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

int main(){
    ll N;
    cin >> N;
    set<string> a;
    for(int i=0; i<N; i++){
        string x;
        cin >> x;
        a.insert(x);
    }
    cout << a.size()  << endl;
}


Measured memory_bytes: 19276
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main() {
    int H,W,K;
    cin>>H>>W>>K;
    vector<vector<bool>> c(H,vector<bool>(W,0));
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            char s;
            cin>>s;
            if(s=='#')c[i][j]=true;
        }
    }
    int ans=0;
    for (int h = 0; h < (1<<H); h++){
        bitset<6> bith(h);
        for (int w = 0; w < (1<<W); w++){
            bitset<6> bitw(w);
            int sum=0;
            for (int i = 0; i < H; i++){
                for (int j = 0; j < W; j++){
                    if(bith[i]==0&&bitw[j]==0&&c[i][j]==1)sum++;
                }
            }
            if(sum==K)ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
int main() {
	int n, m, o, x, y;
	cin >> n >> m >> o >> x >> y;
	int X = n * x + m * y;
	int Y = o * min(x, y) * 2 + (x - min(x, y))*n + (y - min(x, y))*m;
	int Z = o * max(x, y) * 2;
	cout << min({ X,Y,Z }) << endl;
	return 0;
}

Measured memory_bytes: 256