akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
int main(){
    int N;
    scanf("%d",&N);
    int A[100002];
    int ans[100002];
    for(int i=1;i<=N;i++){
        scanf("%d",A+i);
        ans[A[i]] = i;
    }
    for(int i=1;i<=N;i++)
         printf("%d ",ans[i]);
}


Measured memory_bytes: 2464
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const int N = 1e5 + 5;

int a,b,m;
int aa[N];
int bb[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);
    
    cin>>a>>b>>m;
    int ma = OO, mb = OO;
	REP(i,1,a){
    	cin>>aa[i];
    	ma = min(ma, aa[i]);
	}
	REP(i,1,b){
		cin>>bb[i];
		mb = min(mb, bb[i]);
	}
	int ans = ma + mb;
	REP(i,1,m){
		int x,y,c;
		cin>>x>>y>>c;
		ans = min(ans, aa[x] + bb[y] - c);
	}
	cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

int main(){
        string s;
        cin >> s;
        if(s == "SUN"){
                cout << 7 << endl;
        }else if(s == "MON"){
                cout << 6 << endl;
        }else if(s == "TUE"){
                cout << 5 << endl;
        }else if(s == "WED"){
                cout << 4 << endl;
        }else if(s == "THU"){
                cout << 3 << endl;
        }else if(s == "FRI"){
                cout << 2 << endl;
        }else {
                cout << 1 << endl;
        }
}

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

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  double a, b, x;
  double rad;
  cin >> a >> b >> x;
  double y = a * b - (x / a);

  if (a * b / 2 >= y) {
    rad = y * 2 / (a * a);
  } else {
    rad = b / (a - (2 * y / b - a));
  }
  
  double angle = atan(rad) * 360 / (2 * M_PI);
  cout << fixed;
  cout << setprecision(10) << angle << endl;
}

Measured memory_bytes: 256
N, M, X = list(map(int, input().split()))
conditions = [str(bin((2**N + i) & (2**(N+1) - 1)))[3:] for i in range(2**N)]
Q = [list(map(int, input().split())) for i in range(N)]
ans = -1
for c in conditions:
    res = [0]*(M+1)
    for i in range(N):
        if c[i] == '1':
            for j in range(M+1):
                res[j] += Q[i][j]

    failed = False
    for i in range(1, M+1):
        if res[i] >= X:
            continue
        else:
            failed = True
    if failed:
        continue
    else:
        if ans == -1:
            ans = res[0]
        else:
            ans = min(ans, res[0])

print(ans)

Measured memory_bytes: 74408
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define mod 1000000007
#define inf 1<<30
#define mp(a,b) make_pair(a,b)
#define len(u,N) u.begin(),u.begin()+N

ll N,Q,K;
ll a[100010];
ll b[100010];
ll c[100010];
ll x[100010];
ll y[100010];
vector <pl> g[100010];
ll w[100010];
bool visited[100010];

void dfs(ll cur, ll weight){
    visited[cur] = 1;
    w[cur] = weight;
    rep(i,g[cur].size()){
        if (!visited[g[cur][i].fi]){
            dfs(g[cur][i].fi,weight+g[cur][i].se);
        }
    }
}

int main() {
    cin >> N;
    rep(i,N-1){
        cin >> a[i] >> b[i] >> c[i];
        g[a[i]].push_back(mp(b[i],c[i]));
        g[b[i]].push_back(mp(a[i],c[i]));
    }
    cin >> Q >> K;;
    rep(i,Q){
        cin >> x[i] >> y[i];
    }
    dfs(K,0);
    // rep(i,N+1){
       //  cout << i << " " << w[i] << endl;
    // }
    rep(i,Q){
        cout << abs(w[x[i]-w[K]])+abs(w[y[i]]-w[K]) << endl;
    }
    return 0;
}


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

int main() {
  int n, last, min;
  char white = '.', black = '#';
  string s;
  cin >> n >> s;

  for (int i = 0; i < s.size(); i++) if (s.at(i) == white) last++;
  min = last;
  for (int i = 1; i <= s.size(); i++) {
    s.at(i - 1) == black ? last++ : last--;
    if (min > last) min = last;
  }
  cout << min << endl;
}

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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << " | ";
	err(++it, args...);
}

const ll inf = 1e18;
const int nax = 2e3 + 5;

bool visited[nax];
ll dist[nax];
vector<ll>g[nax];

void bfs(ll src)
{
	reset(visited,0);
	reset(dist,-1);

	visited[src] = 1;
	dist[src] = 0;

	queue<ll>Q;
	Q.push(src);

	while(!Q.empty())
	{
		ll v = Q.front();
		Q.pop();

		for(auto u : g[v])
		{
			if(!visited[u])
			{
				visited[u] = 1;
				dist[u] = dist[v] + 1;

				Q.push(u);
			}
		}
	}
}
int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		ll n,x,y;
		cin>>n>>x>>y;
		
		forn(i,2,n+1)
		{
			g[i].pb(i-1);
			g[i-1].pb(i);
		}
		g[x].pb(y);
		g[y].pb(x);
		
		
		ll ans[n+1];
		reset(ans,0);
		
		forn(i,1,n+1)
		{
			bfs(i);
			forn(j,1,n+1)
			{
				ans[dist[j]]++;
			}
		}
		forn(i,1,n)
		{
			cout<<ans[i]/2<<endl;
		}
	}

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n,m;
int main(){
    cin>>n>>m;
    vector<pair<ll,ll>> pii;
    ll ans=0,now=0;
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        pii.push_back(make_pair(a,b));
    }
    sort(pii.begin(),pii.end());
    for(int i=0;i<pii.size();i++){
        //cout<<u.first<<" "<<u.second<<endl;
            if(m-now<=pii[i].second){
                ans+=(m-now)*pii[i].first;
                cout<<ans<<endl;
                return 0;
            }
            else{
                ans+=pii[i].second*pii[i].first;
                now+=pii[i].second;
            }
    }
    return 0;
}


Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int INF = (1<<21);

class State{
public:
  int d,n;
  bool f;
  State(int d = 0, int n = 0, bool f = false):d(d),n(n),f(f){}
  bool operator < (const State &s) const {return d > s.d;}
};

int Dijkstra(int start/*, int goal*/, vector<vector<int> > Graph){

  int size = Graph.size();
  vector<State> d(size);
  priority_queue<State> Q;
  State u,v;

  for(int i=0;i<size;i++){
    d[i].d = INF;
    d[i].f = false;
    }
  u.d = d[start].d = 0;
  u.n = start;
  Q.push(u);

  while(!Q.empty()){
    u = Q.top();
    Q.pop();

    if(d[u.n].f) continue;
    d[u.n].f = true;

    for(int i=0;i<size;i++){
      if(!d[i].f && /*d[u.n].d +*/ Graph[u.n][i] < d[i].d){
	v = u;
	v.d = d[i].d = /*d[u.n].d +*/ Graph[u.n][i];
	v.n = i;
	Q.push(v);
      }
    }
  }
  /*return d[goal].d;*/
  int ans = 0;
  for(int i=0;i<size;i++) ans += d[i].d;
  return ans;

}

int main(){
  int n,m;
  while(cin >> n >> m && n && m){
    vector<vector<int> > G(n);
    for(int i=0;i<n;i++){
      vector<int> v(n);
      v.assign(n,INF);
      G[i] = v;
    }
    for(int i=0;i<m;i++){
      int a,b,c;
      cin >> a >> b >> c;
      G[a][b] = G[b][a] = c;
    }
    cout << Dijkstra(0,G) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
S = input()
if S=="KIHBR" or S=="AKIHBR" or S=="KIHABR" or S=="KIHBAR" or S=="KIHBRA" or S=="AKIHABR" or S=="AKIHBAR" or S=="AKIHBRA" or S=="KIHABAR" or S=="KIHABRA" or S=="KIHBARA" or S=="AKIHABAR" or S=="AKIHABRA" or S=="AKIHBARA" or S=="KIHABARA" or S=="AKIHABARA":
    print("YES")
else:
    print("NO")

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

using namespace std;

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

    int x,y,s1=0,s2=0;
    cin>>x>>y;
    if(x == 1)s1=300000;
    else if(x == 2)s1=200000;
    else if(x==3)s1=100000;
    if(y == 1)s2=300000;
    else if(y == 2)s2=200000;
    else if(y==3)s2=100000;
    if(x==1&&y==1)cout<<s1+s2+400000<<endl;
    else cout<<s1+s2<<endl;

	return 0;
}


Measured memory_bytes: 256
// あみだくじ。

#include <iostream>
#include <cstdio>
using namespace std;

int main(void) {
    int w, n;
    int* vertical;
    int a, b, tmp;
    
    cin >> w;
    vertical = new int[w + 1];
    for(int i = 0; i <= w; ++i) {
        vertical[i] = i;
    }
    cin >> n;
// scanfの""内に','を入れることで入力の仕方をa,bにすることが出来る。abはエラー
    for(int i = 0; i < n; ++i) {
        scanf("%d,%d", &a, &b);
        tmp         = vertical[a];
        vertical[a] = vertical[b];
        vertical[b] = tmp;
    }
    for(int i = 1; i <= w; ++i) {
        cout << vertical[i] << endl;
    }
}


Measured memory_bytes: 3152
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <bitset>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define iter(it,c) for(auto it=(c).begin(); it!=c.end(); ++it)

typedef vector<int> vi;
typedef map<int, int> mii;

int const score[] = { 0, 0, 60, 70, 80 };
int eval(int n){
    int s = 0;
    rep(i, 5){
        s += score[n & 7];
        n >>= 3;
    }
    return s;
}

int flip(int n, int f){
    f <<= 2;
    int r = 0;
    rep(i, 5){
        int t = n >> (i * 3) & 7;
        if (t){
            int c = (f >> (i * 2) & 3) + (f >> (i * 2 + 2) & 3);
            t = ((t - 1 + c) & 3) + 1;
        }
        r |= t << (i * 3);
    }
    return r;
}

int solve(vi const& v){
    mii prev;
    prev[v[0]] = eval(v[0]);
    rep(i, 4){
        mii next;
        iter(it, prev){
            int bef = eval(it->first);
            rep(a, 4)rep(b, 4)rep(c, 4)rep(d, 4){
                int f = a << 6 | b << 4 | c << 2 | d;
                int aft = flip(it->first, f);
                int suc = flip(v[i + 1], f);
                int e = it->second - bef + eval(aft) + eval(suc);
                next[suc] = max(next[suc], e);
            }
        }
        swap(prev, next);
    }

    int ans = 0;
    iter(it, prev) ans = max(it->second, ans);
    return ans;
}

int main(){
    int n; cin >> n;
    while (n--){
        vi v(5);
        rep(i, 5){
            rep(j, 5){
                int t = 0; cin >> t;
                v[i] <<= 3;
                v[i] |= t;
            }
        }
        cout << solve(v) << endl;
    }
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 20000005;
bool isPrime[MAXN];
vector<int> pr;
vector<pair<int,int>> ans;
void sieve()
{
    memset(isPrime, 1, sizeof isPrime);
    isPrime[0] = isPrime[1] = 0;

    for (int i = 2; i * i <= MAXN; i += 1 + (i & 1))
    {
        if (isPrime[i])
        {

            for (int j = i * i; j < MAXN; j += i)
                isPrime[j] = 0;
        }
    }
    for(int i=0; i<MAXN; i++)
    {
        if(isPrime[i])
        {
            if(!pr.empty())
            {
                if(i-pr.back()==2)
                {
                    ans.push_back({pr.back(),i});
                }
            }
            pr.push_back(i);

        }
    }
}

ld power(ld x, ll y)
{
    ll temp;
    if (y == 0)
        return 1;
    temp = power(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
        return x * temp * temp;
}

void debug_out()
{
    cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << H;
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main()
{
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0)
        cout<<1<<endl;
    else if(b==0)
        cout<<2<<endl;
    else if(c==0)
        cout<<3<<endl;
    else if(d==0)
        cout<<4<<endl;
    else{
        cout<<5<<endl;
    }
    return 0;
}


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

int main(){
    string s,t;
    cin >> s >> t;
    int sn = s.size();
    int tn = t.size();
    int ans = tn;
    for(int i = 0; i <= sn - tn;i++){
        string x = s.substr(i,tn);
        int count = 0;
        for(int j = 0;j < tn;j++){
            if(x.at(j) != t.at(j)) count++;
        }
        ans = min(ans,count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef pair<int, int> pii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
const int N = 200000+5;
OST bit[N];
ll mod = 998244353;
int n;
ll power[200000+5];

bool cmp(const pii &x, const pii &y){
    return x.S<y.S;
}

void pre(){
    power[0] = 1;
    for(int i=1; i<200000+5; i++){
        power[i] = (power[i-1]*2LL)%mod;
    }
}

void update(int x, int y)
{
	for(int i = x; i < N; i += i & -i)
		bit[i].insert(mp(y, x));
}

int get(int x, int y)
{
	int ans = 0;
	for(int i = x; i > 0; i -= i & -i)
		ans += bit[i].order_of_key(mp(y+1, 0));
	return ans;
}
int main()
{
    fast;
    pre();
    cin>> n;
    vector<pii> v;
    for(int i=1; i<=n; i++){
        pii p;
        int x, y;
        cin >> x >> y;
        p.F = x;
        p.S = y;
        v.pb(p);
    }
    sort(v.begin(), v.end(), cmp);

    for(int i=0; i<n; i++){
        v[i].S = i+1;
    }

    sort(v.begin(), v.end());

    for(int i=0; i<n; i++){
        v[i].F = i+1;
        update(v[i].F,v[i].S);

    }

    ll ans = 0;
    for(int i=0; i<n; i++){
        ll sum  = power[n]-1;
        ll temp = get(v[i].F, v[i].S);
        ll ul = get(v[i].F,n) - temp;
        ll rd = get(n,v[i].S) - temp;
        ll dl = get(v[i].F-1, v[i].S-1);
        ll ur = get(n,n)-ul-dl-rd-1;

        ans += sum - power[ul+ur]-power[rd+dl]-power[dl+ul]-power[ur+rd]+power[ul]+power[rd]+power[dl]+power[ur];
        ans%= mod;

    }
    cout<< (ans+mod)%mod<< endl;
    return 0;
}
/*
*/


Measured memory_bytes: 140964
<?php
  declare(strict_types=1);

  fscanf(STDIN, "%i", $n);
  $s = trim(fgets(STDIN));
  $as = explode(" ", $s);

  $counts = [];
  $dups = [];

  foreach ($as as $a)
  {
      if (is_null($counts[$a]))
      {
          $counts[$a] = 1;
      }
      else
      {
          $counts[$a]++;
          $dups[$a] = $a;
      }
  }
  
  $m = 0;
  $k = 0;
  array_walk($dups, function ($d) use (&$m, &$k, $counts) { $m += $counts[$d]; $k++; });

  $x = $n - ($m - $k) - ($m - $k) % 2;
  echo $x.PHP_EOL;
?>


Measured memory_bytes: 14836
#include <bits/stdc++.h>
#include <limits.h>
#include <algorithm>  
#include <numeric>
#include <sys/resource.h>
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define endl '\n'
using ll = long long;
 
const int precision = 15;
const int modulo =  1000000007; // 10^9 + 7
const ll lmodulo =  1000000007; // 10^9 + 7
 
const double EPS = 1e-9;
const ll inf = 1e18;


void increaseStack() {
	const rlim_t kStackSize = 50 * 1024 * 1024;   // min stack size = 50 MB
	struct rlimit rl;
	int result;

	result = getrlimit(RLIMIT_STACK, &rl);
	if (result == 0) {
		if (rl.rlim_cur < kStackSize) {
			rl.rlim_cur = kStackSize;
		    result = setrlimit(RLIMIT_STACK, &rl);
		    if (result != 0) {
		    	fprintf(stderr, "setrlimit returned result = %d\n", result);
		    }
		}
	}
}

void solve_n2 () {
	int n; cin >> n;
	vector<ll> h(n), a(n);
	for (auto &it : h) cin >> it;
	for (auto &it : a) cin >> it;

	vector<ll>  dp(n + 1, 0);

	for (auto i = 0; i < n; ++i) {
		dp[i] = a[i];
		for (int  j = i - 1; j >= 0; --j) {
			if (h[j] < h[i]) {
				dp[i] = max(dp[i], dp[j] + a[i]);
			}
		}
	}

	cout << dp[n - 1];
}

void solve_n22 () {
	int n; cin >> n;
	vector<ll> height(n), a(n);
	unordered_map<int, int> byHeight;
	for (auto i = 0; i < (int)height.size(); ++i) {
		cin >> height[i];
		byHeight[height[i]] = i;
	}
	for (auto &it : a) cin >> it;

	vector<ll>  dp(n + 1, 0);

	for (auto i = 0; i < n; ++i) {
		dp[i] = a[i];
		for (auto h = 0; h < height[i]; ++h) {
			if (!byHeight.count(h)) continue;
			dp[i] = max(dp[i], dp[byHeight[h]] + a[i]);
		}
	}

	cout << dp[n - 1];
}

class segTree {
private:
	int n;

	vector<ll> tree;
public:
	int base = 1;
	segTree(int n) {
		this->n = n;
		while (base <= n) base *= 2;

		tree = vector<ll>(base * 2);
	}
	
	ll get (ll h) {
		ll x = h + base;
		ll best = 0;

		while (x > 1) {
			if (x % 2) {
				best = max(best, tree[x - 1]);
			}
			x /= 2;
		}
		return best;
	}

	void update(ll h, ll curVal) {
		for (int i = base + h; i > 0; i /= 2) {
			tree[i] = max(tree[i], curVal);
		}
	}
	
};

void solve() {
	int n; cin >> n;
	vector<ll> height(n), a(n);
	for (auto &it : height) cin >> it;
	for (auto &it : a) cin >> it;

	segTree st(n);
	vector<ll>  dp(n + 1, 0);
	
	for (auto i = 0; i < n; ++i) {
		auto best = st.get(height[i]);
		dp[height[i]] = best + a[i];
		st.update(height[i], dp[height[i]]);
	}

	ll maxRet = 0;
	for (auto i : dp) {
		maxRet = max(maxRet, i);
	}

	cout << maxRet; 
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(precision);
  cout.setf(ios_base::fixed);
  solve();
  return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)




int main(){
    int n,a,b; cin>>n>>a>>b;
    cout<<min(n*a, b)<<endl;
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	
	int ans = 0;
	REP(i, N) {
		int cnt = 0;
		while (i + cnt < N && S[i] == S[i + cnt]) {
			cnt++;
		}
		ans++;
		i += cnt - 1;
	}
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	ll n, c, k;
	cin >> n >> c >> k;
	ll t[n];
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	sort(t, t+n);

	ll last=t[0];
	ll idx = 1;
	ll ret=0;
	ll amnt=1;
	while (true) {
		if (idx==n) {
			break;
		}
		ll time = t[idx];
		amnt++;
		if (last+k<time) {
			ret++;
			last = t[idx];
			amnt=1;
		}
		if (amnt>c) {
			ret++;
			last=t[idx];
			amnt=1;
		}
		idx++;
	}
	if (amnt>0) {
		ret++;
	}
	cout << ret << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INT long long int
#define oo (INT)6e18
#define MOD 1000000007
using namespace std;
INT n, chk[110], ans;
struct PT{ INT x, y; } s[110], p[110];
bool cmp(PT a, PT b)
{
    return a.x < b.x;
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 0 ; i < n ; i++ ) cin>>s[i].x>>s[i].y;
    for(int i = 0 ; i < n ; i++ ) cin>>p[i].x>>p[i].y;
    sort(p, p+n, cmp);
    for(int i = 0 ; i < n ; i++ )
    {
        int mx = -1, mxj;
        for(int j = 0 ; j < n ; j++ )
        {
            if( !chk[j] and s[j].x < p[i].x and s[j].y < p[i].y )
            {
                if( mx < s[j].y ) mx = s[j].y, mxj = j;
            }
        }
        if( mx >= 0 ) chk[mxj] = 1, ans++;
    }
    cout<<ans<<endl;
}


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

#define ll long long
#define ull unsigned long long
#define db double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 5003;
int n, a, b, p[N], ind[N], fen[N];
ll dp[N];

void upd(int x, int y) {
	for (; x <= n + 1; x |= (x + 1)) {
		fen[x] += y;
	}
}

int get(int x) {
	int res = 0;
	for (; x >= 0; x = (x & (x + 1)) - 1) {
		res += fen[x];
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> a >> b;
	p[0] = 0;
	p[n + 1] = n + 1;
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
		ind[p[i]] = i;
	}
	ind[0] = 0;
	ind[n + 1] = n + 1;
	memset(& dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 1; i <= n + 1; i++) {
		for (int j = p[i] - 1; j >= 0; j--) {
			if (ind[j] < i) {
				ll inner = get(i - 1) - get(ind[j]);
				ll l = get(ind[j]);
				ll r = get(n + 1) - get(i);
				dp[i] = min(dp[i], dp[ind[j]] + inner * min(a, b) + l * a + r * b);
			}
			upd(ind[j], 1);
		}
		for (int j = p[i] - 1; j >= 0; j--) {
			upd(ind[j], -1);
		}
	}
	cout << dp[n + 1];
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    string A;
    cin >> A;
    int ans;
    ans = 0;
    int N = A.size(); 
    for(int i = 0; i < N / 2; i++){
        if(A.at(i) != A.at(N - i -1)){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <cstring>
#include <algorithm>
#include <set>
#include <climits>
#include <numeric>

//usings
using namespace std;

//type def
typedef long long int64;
typedef pair<int, int> ii;

//consts
const int mod = 1e9 + 7;

//methods
template<typename T>
bool chmax(T& source, const T& compare_to) {
    if(source < compare_to) {
        source = compare_to;
        return true;
    }
    return false;
}

int modpow(int64 base, int n) {
    int64 ret = 1;
    while(n) {
        if(n & 1) ret = ret * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return ret;
}

class Solution {
private:
public:
    int solve(int odd, int even) {
        int ret = 0;
        if(odd > 1) ret += odd * (odd - 1) / 2;
        if(even > 1) ret += even * (even - 1) / 2;
        return ret;
    }
};

int main() {
    int odd, even;
    cin >> even >> odd;
    Solution sol;
    auto ret = sol.solve(odd, even);
    cout << ret << endl;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append(a[i] - 1)
    x.append(a[i])
    x.append(a[i] + 1)
X = collections.Counter(x)
print(X.most_common()[0][1])


Measured memory_bytes: 30940
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    int A1[100]={};int A2[100]={};int ans=0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A1[i];
        if(i!=0)A1[i]+=A1[i-1];
    }
    for(int i=0;i<N;i++){
        cin >> A2[i];
    }
    for(int i=N-1;i>=0;i--){
        if(i!=N-1)A2[i]+=A2[i+1];
    }
    
    for(int i=0;i<N;i++){
        ans=max(ans,A1[i]+A2[i]);
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
 public static void main(String[] args) {
  Scanner scanner = new Scanner(System.in);
  while (true) {
   int a = scanner.nextInt();
   int b = scanner.nextInt();
   if (a == 0 & b == 0)
    break;
   for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
     System.out.print("#");
    }
    System.out.println();
   }
   System.out.println();
  }
 }
}


Measured memory_bytes: 35160
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
if A.count(0):
    print(0)
    exit()
A = sorted(A)
ans = 1
for i in range(n):
    if ans * A[i] > 10**18:
        print(-1)
        exit()
    ans *= A[i]
print(ans)


Measured memory_bytes: 24024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;



int main(){
  int a;
  cin >> a;
  if(a==1){
    cout << "Hello World" << endl;
  }else{
    int b,c;
    cin >> b >> c;
    cout << b+c << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXN 100000
typedef long long ll;

using namespace std;

int main(){
    int N;
    cin >> N;
    int odd=0;
    for (int i=0;i<N;i++){
	int a;
	cin >> a;
	if (a%2 == 1) odd++;
    }

    if (odd%2 == 0) cout << "YES" << endl;
    else cout << "NO" <<  endl;

    return 0;
}

Measured memory_bytes: 256
from math import inf
from random import randint,random
import time
START=time.time()
PROB=10**(-3)

def f(a,d,T):
    try:
        return T[d:].index(a)+d
    except ValueError:
        return len(T)

from random import randint
A=26

D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))
 
def g(d,q,T):
    p=T[d]

    a=f(p,d+1,T)
    b=f(q,d+1,T)
    
    Y=0
    h=L[d-1][p]
    for i in range(d,a):
        h+=1
        Y+=h-L[i][p]
        
    m=0
    Z=0
    for j in range(d,b):
        Z-=m-L[j][q]
        m+=1
        
    return (S[d][q]-S[d][p])+Z*C[q]-Y*C[p]

T=[0]
L=[[0]*(A+1) for _ in range(D+1)]
for d in range(1,D+1):
    M=-inf
    E=0

    for j in range(1,A+1):
        X=S[d][j]
        for k in range(1,A+1):
            if j!=k:
                X-=C[k]*L[d][k]

        if M<X:
            M=X
            E=j

    T.append(E)
    for j in range(1,A+1):
        if j!=E:
            L[d][j]=L[d-1][j]+1
        else:
            L[d][j]=0

while time.time()-START<=1.77:
    e=randint(1,D)
    q=randint(1,A)

    V=g(e,q,T)
    if V>0 or random()<PROB:
        p=T[d]

        a=f(p,d+1,T)
        b=f(q,d+1,T)
        
        h=L[d-1][p]
        for i in range(d,a):
            h+=1
            L[i][p]=h

        m=0
        for j in range(d,b):
            L[j][q]=m
            m+=1
        T[d]=q

for i in range(1,D+1):
    print(T[i])


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

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) res += ", ";
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

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

#define mst(x, a) memset(x, a, sizeof(x))
#define all(a) begin(a), end(a)
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LLINF = 0x3f3f3f3f3f3f3f3f;
constexpr ll MOD = 1e9 + 7;

int N;
bool check(const vector<string> &strs) {
  vector<P> posis;
  int sumCl = 0, sumCr = 0;
  for (const auto &s : strs) {
    int cl = 0, cr = 0;
    int maxCrMinusCl = 0;
    for (char ch : s) {
      if (ch == '(') {
        cl++;
      } else {
        cr++;
        chmax(maxCrMinusCl, cr - cl);
      }
    }
    sumCl += cl;
    sumCr += cr;
    if (cl >= cr) {
      posis.emplace_back(maxCrMinusCl, cl - cr);
    }
  }

  if (sumCl != sumCr) {
    return false;
  }

  sort(all(posis));
  int curClMinusCr = 0;
  for (const auto &p : posis) {
    if (p.first <= curClMinusCr) {
      curClMinusCr += p.second;
    } else {
      return false;
    }
  }
  return true;
}

inline char trans(char ch) { return ch == '(' ? ')' : '('; }

int main() {
  cin >> N;
  vector<string> strs(N);
  rep(i, 0, N) { cin >> strs[i]; }

  if (!check(strs)) {
    puts("No");
    return 0;
  }
  for (auto &s : strs) {
    reverse(all(s));
    for (char& ch : s) {
      ch = trans(ch);
    }
  }
  puts(check(strs) ? "Yes" : "No");
}

Measured memory_bytes: 42336
import sys
input = sys.stdin.readline
import numpy as np
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A = np.sort(np.array(A))
def shake_hands(x):
    cnt = 0
    X = np.searchsorted(A, x - A, side="left")
    cnt += N * N - X.sum()
    if cnt >= M:
        return 1
    return 0
left = 0
right = 10 ** 6
while True:
    m = (right + left) // 2
    if shake_hands(m) == 1 and shake_hands(m+1) == 0:
        maximum = m
        break
    elif shake_hands(m) == 0 and shake_hands(m-1) == 1:
        maximum = m - 1
        break
    elif shake_hands(m) == 1:
        left = m + 1
    else:
        right = m - 1
X = np.searchsorted(A,maximum+1-A) # 行わない人数
Acum = np.zeros(N+1,np.int64) # 人数 -> 累積和
Acum[1:] = np.cumsum(A)

shake = N * N - X.sum()
happy = (Acum[-1] - Acum[X]).sum() + (A * (N - X)).sum()

happy += (M - shake) * (maximum)
print(happy)


Measured memory_bytes: 23448
import sys
import math
#from pprint import pprint
import numpy as np
def myinput_int():
    return list(map(int, input().split()))


N = myinput_int()

a = myinput_int()

a = np.array(a)

goukei = np.sum(a[::2]) - np.sum(a[1::2])
x = int(goukei/2)

now_val = x
text = str(now_val*2)
for i in range(1, a.shape[0]) :
    now_val = a[i-1]-now_val    
    text += ' ' + str(now_val*2)

print(text)

Measured memory_bytes: 23092
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n;
	scanf("%lld",&n);
	ll sum;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			sum=n/i+i-2;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
const int size=123456;

int N;
int A[size];
int B[size];
string S;

bool check(int l,int f){
    for(int i=0; i<N+5; i++){
        B[i]=0;
    }
    B[0]=l;
    B[1]=f;
    for(int i=0; i<N; i++){
    if(A[i+1]==0){
        if(B[i+1]==1){
            if(B[i]==1){
                B[i+2]=1;
            }else{
                B[i+2]=2;
            }
        }else{
            if(B[i]==1){
                B[i+2]=2;
            }else{
                B[i+2]=1;
            }
        }
    }else{
        if(B[i+1]==1){
            if(B[i]==1){
                B[i+2]=2;
            }else{
                B[i+2]=1;
            }
        }else{
            if(B[i]==1){
                B[i+2]=1;
            }else{
                B[i+2]=2;
            }
        }
    }
  }
bool flag=0;
for(int i=0; i<N; i++){
    if(A[i+1]==0){
        if(B[i+1]==1){
            if(B[i]!=B[i+2]){
                flag=1; break;
            }
        }else{
            if(B[i]==B[i+2]){
                flag=1; break;
            }
        }
    }else{
        if(B[i+1]==1){
            if(B[i]==B[i+2]){
                flag=1; break;
            }
        }else{
            if(B[i]!=B[i+2]){
                flag=1; break;
            }
        }
    }
}
if(B[0]!=B[N]||B[1]!=B[N+1]) flag=1;
return flag;
}

int main(){

cin>>N>>S;

for(int i=0; i<N; i++){
    if(S[i]=='o') A[i+1]=0;
    else A[i+1]=1;
}

if(!check(1,1)){
    for(int i=0; i<N; i++){
        if(B[i+1]==1) printf("S");
        if(B[i+1]==2) printf("W");
    }
    cout<<endl;
    return 0;
}else if(!check(2,1)){
    for(int i=0; i<N; i++){
        if(B[i+1]==1) printf("S");
        if(B[i+1]==2) printf("W");
    }
    cout<<endl; 
    return 0;
}else if(!check(2,2)){
    for(int i=0; i<N; i++){
        if(B[i+1]==1) printf("S");
        if(B[i+1]==2) printf("W");
    }
    cout<<endl;
    return 0;
}else if(!check(1,2)){
    for(int i=0; i<N; i++){
        if(B[i+1]==1) printf("S");
        if(B[i+1]==2) printf("W");
    }
    cout<<endl;
    return 0;
}else{
    cout<<-1<<endl;
}

return 0;
 
}

Measured memory_bytes: 1408
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int h = sc.nextInt();
    int a = sc.nextInt();
    int ans;

    if(h % a == 0){
      ans = h / a;
    } else {
      ans = (h / a) + 1;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 23892
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int H = int.Parse(str[0]);
		int W = int.Parse(str[1]);
		int K = int.Parse(str[2]);
		int[,]A = new int[H,W];
		for(var i=0;i<H;i++){
			string s = Console.ReadLine();
			for(var j=0;j<W;j++){
				A[i,j] = int.Parse(s.Substring(j,1));
			}
		}
		int min = 999999999;
		for(var i=0;i<1024;i++){
			int ct = 0;
			int[]B = new int[H];
			bool flag2 = true;
			for(var k=0;k<W;k++){
				int[]C = new int[H];
				bool flag = true;
				int s1 = 0;
				for(var j=0;j<H;j++){
					if(i/(int)Math.Pow(2,j)%2==1 || j==H-1){
						for(var l=s1;l<=j;l++){
							if(A[l,k]==1){
								C[s1]++;
							}
						}
						if(B[s1]+C[s1]>K){
							if(flag==false || k==0){
								flag2 = false;
								break;
							} else {
								for(var l=0;l<H;l++){
									B[l] = 0;
								}
								ct++;
								flag = false;
							}
						}
						s1 = j+1;
					}
				}
				for(var l=0;l<H;l++){
					B[l] += C[l];
					//Console.Error.WriteLine(k+" "+B[l]+" "+C[l]);
				}
				if(!flag2){
					break;
				}
			}
			if(flag2){
				int ct2 = 0;
				for(var j=0;j<H-1;j++){
					if(i/(int)Math.Pow(2,j)%2==1){
						//Console.Error.WriteLine(i+" "+j);
						ct2++;
					}
				}
				//Console.Error.WriteLine(i+" "+ct+" "+ct2);
				min = Math.Min(ct+ct2,min);
            }
		}
		Console.WriteLine(min);
	}
}

Measured memory_bytes: 15284
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
LL sqr(LL x)
{
	return x*x;
}
const int MAXN=100000;
vector<int> ans[MAXN+10];
void solve(long long n){
	if (n==1) {
		puts("Yes\n2\n1 1\n1 1\n");
		return;
	}
	LL k=0;
	for(LL i=1; i<=n; ++i) {
		if (i*(i-1)==2*n) {
			k=i;
			break;
		}
	}
	if (k==0) {
		puts("No");
		return;
	}
	LL m=n*2/k;
	int now=1;
	for(int i=1; i<=k; ++i) {
		for(int j=1; j<=m-i+1; ++j) {
			ans[i].push_back(now);
			ans[i+j].push_back(now);
			++now;
		}
	}
	printf("Yes\n%lld\n",k);
	for(int i=1; i<=k; ++i) {
		printf("%lld ",m);
		for(auto j:ans[i]) {
			printf("%d ",j);
		}
		puts("");
	}
}

int main(){	
#ifdef WAAUTOMATON
	//freopen("in.txt","r",stdin);
#endif
	long long N;
	scanf("%lld",&N);
	solve(N);
	return 0;
}



Measured memory_bytes: 4608
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val MOD = 1e9.toInt + 7

  // val a = new Array[Int](N)

  val N, B = in.next().toInt

  //
  val R = N - B

  val mc = new ModComb(N+1, MOD)

  for (k <- 1 to B) {
    if (k > R + 1)
      pw.println(0)
    else {
      var ans = 0L
      ans =
        if (k == 1) 1
        else mc.comb(B-1, k-1)

      val restRed = R - (k-1)
      ans *= mc.comb(k + restRed, restRed)

      ans %= MOD

      pw.println(ans)
    }
  }

  pw.flush()
}


class ModComb(maxNum: Int, mod: Long) {

  private def repeatSquares(x: Long, n: Long): Long = {
    if(n == 0)
      1
    else if(n % 2 == 0)
      repeatSquares(x*x % mod, n/2)
    else
      (x * repeatSquares(x*x % mod, n/2)) % mod
  }

  private val fact = new Array[Long](maxNum + 1)

  fact(0) = 1
  for (i <- 1 to maxNum)
    fact(i) = (i * fact(i-1)) % mod

  private val factInv = new Array[Long](maxNum + 1)

  factInv(maxNum) = repeatSquares(fact(maxNum), mod-2)
  for (i <- (1 to maxNum).reverse)
    factInv(i-1) = (i * factInv(i)) % mod


  // nCk
  def comb(n: Int, k: Int): Long = {
    val numer = fact(n)
    val denom = (factInv(n-k) * factInv(k)) % mod

    (numer * denom) % mod
  }

}



class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 25544
N,K=map(int,input().split())

l=[i+1 for i in range(N)]
L=[0 for i in range(N)]
#print(l)
for i in range(N):
    for j in range(30):
        if l[i]*(2**j)>=K:
            L[i]=1/(2**j)
            break
#print(L)
print(sum(L)/N)

Measured memory_bytes: 10264
#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;
#define PI 3.14159265358979323846264338327950L

//マクロ
#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 FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

ll gcd(ll a, ll b){
    if(a % b == 0){
        return(b);
    }
    else{
        return(gcd(b, a % b));
    }
}

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, Q, i, j, k, l, tmp, ans;

int main(){
    string s, t;
    cin >> s >> t;
    REP(i, s.length()){
        if(s.at(i) != t.at(i)){
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3812
#include<stdio.h>
typedef long long ll;
int main(void)
{
  double h,w,x,y;
  scanf("%lf %lf %lf %lf",&h,&w,&x,&y);
  double result=(h*w)/2.0;
  int able=0;
  if(h/2.0==x&&w/2.0==y){
    able=1;
  }
  printf("%.6lf %d\n",result,able);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	string s;
	cin >> s;
	int len = (int)(s.length());
	long long ans = 0;
	long long acnt = 0;
	long long bccnt = 0;
	int i = 0;
	while (i < len) {
		if (s[i] == 'A') {
			acnt++;
			i++;
		}
		else {
			while (i < len - 1) {
				if (s[i] == 'B' && s[i + 1] == 'C') {
					i += 2;
					bccnt++;
				}
				else break;
			}
			ans = ans + acnt * bccnt;
			bccnt = 0;
			if (s[i] == 'A') acnt++;
			else acnt = 0;
			i++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n;
    string s;
    cin >> n >> s;
    int res = 0;
    rep(i, n)
    {
        int cnt = 0;
        rep2(j,'a','z'+1)
        {
            bool left = false, right = false;
            rep(k, i)
            {
                if(s[k]==j)
                {
                    left = true;
                }
            }
            rep2(k,i,n)
            {
                if(s[k]==j)
                {
                    right = true;
                }
            }
            if(left&&right)
            {
                cnt++;
            }
        }
        res = max(res, cnt);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())
A, B = mi()
Ps = list(mi())

acnt = 0
bcnt = 0
ccnt = 0

for p in Ps:
  if p <= A: acnt += 1
  elif p <= B: bcnt += 1
  else: ccnt += 1

print(min(acnt,bcnt,ccnt))



Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define REP(a, b) for(int a = 0; a < b; a++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define mp make_pair
#define f first
#define s second
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> LL;
typedef vector<int> vi;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int n, ek;
ll DP[105][100005], A[105];

ll rek(int pos, int k) {
	//cout << pos << ' ' << k << "EA\n";
	if (k < 0) return 0;
	if (pos == n) {
		if (k == 0) return 1;
		return 0;
	}
	//cout << pos << ' ' << k << "EB\n";
	ll &ret = DP[pos][k];
	if (ret != -1) return ret;
	ret = rek(pos + 1, k) % MOD;
	ret = (ret + rek(pos, k - 1)) % MOD;
	ret = (ret - rek(pos + 1, k - 1 - A[pos])) % MOD;
	if (ret < 0) ret += MOD;
	return ret;
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> ek;
	REP(i, n) cin >> A[i];
	memset(DP, -1, sizeof DP);
	cout << rek(0, ek) << '\n';
}

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

char itoc(int X){
  switch(X){
    case 0: return '0';
    case 1: return '1';
    case 2: return '2';
    case 3: return '3';
    case 4: return '4';
    case 5: return '5';
    case 6: return '6';
    case 7: return '7';
    case 8: return '8';
    case 9: return '9';
  }
}

char check(int x, int y, vector<vector<char>> MINE){
  if(MINE.at(x).at(y)=='#') return '#';
  int ret=0;
  if(MINE.at(x).at(y)=='.'){
    for(int a=y-1;a<=y+1;a++){
      if(MINE.at(x-1).at(a)=='#'){
        ret++;
      }
      if(MINE.at(x).at(a)=='#'){
        ret++;
      }
      if(MINE.at(x+1).at(a)=='#'){
        ret++;
      }
    }
    return itoc(ret);
  }
}
int main(){
  int H,W; cin >> H >> W;
  vector<vector<char>> mine(H+2, vector<char>(W+2,'*'));
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin >> mine.at(i).at(j);
    }
  }
  string S="k";
  S.resize(W,'¥');
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      S.at(j-1)=check(i,j,mine);
    }
    cout << S << endl;
  }
}
  

Measured memory_bytes: 256