akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int  X, A, B;
	cin >> X >> A >> B;
	int sum = A + ((X - A) / B) * B;
	cout << X - sum;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;

int main() {
    ll n;
    cin >> n;
    if(n%1000==0){
        cout << 0 << endl;
        return 0;
    }
    else{
        ll v=(n/1000)+1;
        cout << v*1000-n << endl;
    }
    return 0;
}

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

class Dice{
public:
    int *arr;
    Dice(int arr2[]){arr = arr2;}

    void roll(char direction){
        int temp;
        switch(direction){
            case 'N':
                temp = arr[0]; arr[0] = arr[1]; arr[1] = arr[5]; arr[5] = arr[4]; arr[4] = temp;
                break;
            case 'E':
                temp = arr[0]; arr[0] = arr[3]; arr[3] = arr[5]; arr[5] = arr[2]; arr[2] = temp;
                break;
            case 'W':
                temp = arr[0]; arr[0] = arr[2]; arr[2] = arr[5]; arr[5] = arr[3]; arr[3] = temp;
                break;
            case 'S':
                temp = arr[0]; arr[0] = arr[4]; arr[4] = arr[5]; arr[5] = arr[1]; arr[1] = temp;
        }
    }

    int report(){return arr[0];}

    int rightside(int a, int b){
        string line = "WWWNNN";
        for(int i = 0; i < 6; i++){
            if(arr[0] == a) break;
            roll(line[i]);
        }
        roll('N');
        line = "EEE";
        for(int i = 0; i < 3; i++){
            if(arr[0] == b) break;
            roll(line[i]);
        }
        roll('S');
        if(arr[0] != a || arr[1] != b) return -1;
        else return arr[2];
    }

    bool issame(int arr2[]){
        string line = "NNNNENNNNENNNNENNNNNENNNNEENNNN";
        for(int i = 0; i < 31; i++){
            bool same = true;
            for(int j = 0; j < 6; j++){
                if (arr[j] != arr2[j]){
                    same = false;
                    break;
                }
            }
            if(same) return true;
            else roll(line[i]);
        }
        return false;
    }
};

int main(){
    int arr[6], arr2[6];
    for(int i = 0; i < 6; i++) cin >> arr[i];
    Dice dice(arr);
    for(int i = 0; i < 6; i++) cin >> arr2[i];

    string same = "No";
    if(dice.issame(arr2)) same = "Yes";
    cout << same << endl;

    return 0;
}



Measured memory_bytes: 3216
// Problem : E - Crested Ibis vs Monster
// Contest : AtCoder Beginner Contest 153
// URL : https://atcoder.jp/contests/abc153/tasks/abc153_e
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcount(x)
#define f first
#define se second
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int h,n;
cin>>h>>n;
vp v(n);
for(int i=0;i<n;i++)
cin>>v[i].f>>v[i].se;
int dp[h+1];
for(int i=0;i<h+1;i++)
dp[i]=INT_MAX;
dp[0]=0;
for(int i=1;i<=h;i++)
for(int j=0;j<n;j++)
{
	if(i-v[j].f<=0)
	dp[i]=min(dp[i],v[j].se);
	else
	dp[i]=min(dp[i],dp[i-v[j].f]+v[j].se);
}
cout<<dp[h];
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t;
//cin>>t;
t=1;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main(){
    int R;
    cin >> R;
    if (R < 1200){
        cout << "ABC" << endl;
    }else if (R < 2800){
        cout << "ARC" << endl;
    }else {
        cout << "AGC" << endl;
    }
    return 0;
}

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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    bool ok = true;
    for(int i = 0; i<n-1;++i){
        if(a[i]==a[i+1]) ok = false;
    }
    if(ok == false) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if((a < c && c < b)||(b < c && c < a))cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

int N, A[200009];
vector<pair<int, int>>Z;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		Z.push_back(make_pair(A[i], i));
	}
	sort(Z.begin(), Z.end());

	for (int i = 0; i < N; i++) {
		if (Z[N - 1].second == i) cout << Z[N - 2].first << endl;
		else cout << Z[N - 1].first << endl;
	}
	return 0;
}

Measured memory_bytes: 4080
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

const int MAX_V = 1e5;
vector<int> es[MAX_V];
int root[MAX_V];
vector<int> chil[MAX_V];
map<pii, int> mp;
queue<pii> que;

void add_edge(int u, int v){
    if(u == v) return;
    mp[pii(u, v)]++, mp[pii(v, u)]++;
    if(mp[pii(u, v)] >= 2) que.push(pii(u, v));
}

void merge(int u, int v){
    u = root[u], v = root[v];
    if(u == v) return;
    if(sz(chil[u]) > sz(chil[v])) swap(u, v);
    for(auto &e: chil[u]){
        root[e] = v;
        chil[v].pb(e);
    }
    chil[u].clear();
    for(auto &e: es[u]){
        es[v].pb(root[e]);
        add_edge(v, root[e]);
    }
}

int main(){
    int N;
    cin >> N;
    rep(i, N){
        root[i] = i;
        chil[i].pb(i);
    }
    rep(i, 2*(N-1)){
        int u, v; cin >> u >> v; u--, v--;
        es[u].pb(v), es[v].pb(u);
        add_edge(u, v);
    }
    while(!que.empty()){
        merge(que.front().first, que.front().second);
        que.pop();
    }
    bool ans = true;
    rep(i, N){
        if(root[i] != root[0]) ans = false;
    }
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

using R = long double;
R sq(R x) { return x*x; }

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

    ll n, k;
    cin >> n >> k;
    vector<ll> xs(n), ys(n);
    REP(i, n) cin >> xs[i] >> ys[i];

    R ans = LLINF;
    auto check_yx = [&](R y, R x) {
        vector<R> dist(n);
        REP(i, n) dist[i] = sqrt(sq(xs[i]-x)+sq(ys[i]-y));
        sort(ALL(dist));
        R ret = 0;
        FOR(i, n-k, n) ret += dist[i];
        chmin(ans, ret);
        return ret;
    };

    auto check_y = [&](R y) {
        R lb = -1000, ub = 1000;
        REP(i, 80) {
            R m1 = (2*lb+ub)/3, m2 = (lb+2*ub)/3;
            if(check_yx(y, m1) < check_yx(y, m2)) ub = m2;
            else lb = m1;
        }
        return check_yx(y, lb);
    };

    R lb = -1000, ub = 1000;
    REP(i, 80) {
        R m1 = (2*lb+ub)/3, m2 = (lb+2*ub)/3;
        if(check_y(m1) < check_y(m2)) ub = m2;
        else lb = m1;
    }
    cout << fixed << setprecision(9) << ans << endl;

    return 0;
}



Measured memory_bytes: 3296
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<double> A;


  return A * 2.0 * 3.1415926535897932;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}


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

typedef vector <int> VI;
typedef vector <VI> VVI;

VVI goal;
VVI init;

int limit;

const int di[4] = { 0, -1, 0, 1 };
const int dj[4] = { 1, 0, -1,  };

const int T[12][2] = {
	{ 0, 0 },
	{ 2, 2 },
	{ 2, 3 },
	{ 2, 4 },
	{ 3, 1 },
	{ 3, 2 },
	{ 3, 3 },
	{ 3, 4 },
	{ 3, 5 },
	{ 4, 2 },
	{ 4, 3 },
	{ 4, 4 }
};

int getMD( VVI P )
{
	int sum = 0;
	int ti, tj;

	for ( int i = 0; i < 7; i++ ) for ( int j = 0; j < 7; j++ )
	{
		if ( P[j][i] <= 0 )
			continue;

		ti = T[P[j][i]][0];
		tj = T[P[j][i]][1];
		sum += ( max( ti, i ) - min( ti, i ) + max( tj, j ) - min( tj, j ) );
	}

	return sum;
}

bool is_goal( VVI puzzle )
{
	bool ok = true;
	for ( int i = 0; ok && i < 7; i++ ) for ( int j = 0; ok && j < 7; j++ )
	{
		if ( puzzle[j][i] != goal[j][i] )
			ok = false;
	}
	return ok;
}

bool dfs( int depth, VVI now )
{
	if ( is_goal( now ) )
		return true;

	if ( depth + getMD( now ) > limit )
		return false;

	for ( int i = 0; i < 7; i++ ) for ( int j = 0; j < 7; j++ )
	{
		if ( now[j][i] != 0 )
			continue;

		for ( int k = 0; k < 4; k++ )
		{
			VVI v = now;
			int ni = i + di[k];
			int nj = j + dj[k];

			if ( v[nj][ni] <= 0 )
				continue;

			swap( v[j][i], v[nj][ni] );

			if ( dfs( depth+1, v ) )
				return true;

		}
	}

	return false;
}

int idfs( VVI src )
{
	for ( limit = 0; limit <= 20; limit++ )
	{
		if ( dfs( 0, src ) )
			return limit;
	}
	return -1;
}

int main( void )
{
	// S[ÌóÔðìé
	goal = VVI( 7, VI( 7, -1 ) );
	goal[3][1] = 0;
	goal[3][5] = 0;
	for ( int i = 0; i < 3; i++ )
	{
		goal[2+i][2] = 1+i;
		goal[2+i][4] = 9+i;
	}
	for ( int i = 0; i < 5; i++ )
	{
		goal[1+i][3] = 4+i;
	}

	while ( 1 )
	{
		// úóÔÌüÍ
		init = VVI( 7, VI( 7, -1 ) );
		cin >> init[3][1];
		if ( init[3][1] == -1 )
			break;
		for ( int i = 0; i < 3; i++ )
			cin >> init[2+i][2];
		for ( int i = 0; i < 5; i++ )
			cin >> init[1+i][3];
		for ( int i = 0; i < 3; i++ )
			cin >> init[2+i][4];
		cin >> init[3][5];

		int cost = idfs( init );

		if ( cost == -1 )
			cout << "NA" << endl;
		else
			cout << cost << endl;

	}

	return 0;
}

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

int n;
int x,ans;
int dp[400100];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        dp[x]=max(dp[x],dp[x-1]+1);
        //cout<<" "<<dp[x]<<endl;
    }
    for(int i=1;i<=n;i++) ans=max(ans,dp[i]);
    cout<<n-ans;
    return 0;
}

Measured memory_bytes: 1024
n=int(input())
A=list(map(int,input().split()))

D={}
for i in A:
      if i not in D:
            D[i]=1
      else:
            D[i]+=1
S=0
DD=D.copy()
for i in DD:
      bu=DD[i]
      DD[i]=bu*(bu-1)//2
      S+=DD[i]

for i in range(n):
      print(S-(D[A[i]]-1))

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

template<typename T>
void VIN(vector<T> &v,int n){for(int i=0;i<n;i++) cin >> v[i];}

template<typename T>
void VOUT(vector<T> &v){
    ll n=(int)v.size();
    for(int i=0;i<n;i++) cout << v[i] << (i==n-1?"\n":" ");
}

template<typename T>
void VOUTL(vector<T> &v){
    ll n=(int)v.size();
    for(int i=0;i<n;i++) cout << v[i] << endl;
}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	vll ans;
	while(1){
		ll n,x,cnt=0;
		cin >> n >> x;
		if(n==0 && x==0) break;
		REP(i,1,n-2)REP(j,i+1,n-1)REP(k,j+1,n){
			if(i+j+k==x) cnt++;
		}
		ans.pb(cnt);
	}
	for(auto&& e:ans) cout << e << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;
#define vsort(v) sort(v.begin(), v.end()); // 昇順
#define vsort_reverse(v) sort(v.begin(), v.end(), greater<int>()); // 降順
#define bsearch(v, n) binary_search(v.begin(), v.end(), n) 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<char> S;
	for(int i = 0; i < N; i++) {
		char c;
		cin >> c;
		S.push_back(c);
	}
	int rslt = 0;
	for(int i = 1; i < N; i++) {
		set<char> left;
		set<char> right;
		for(int j = 0; j < i; j++) {
			left.insert(S[j]);
		}
		for(int j = i; j < N; j++) {
			right.insert(S[j]);
		}
		int count = 0;
		for(set<char>::iterator it = left.begin(); it != left.end(); it++){
			set<char>::iterator it2 = right.find(*it);
			if(it2 != right.end()) count += 1;
		}
		left.clear();
		right.clear();
		rslt = max(rslt, count);
	}
	cout << rslt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main(){

    int N,K,ans=0;
    int p[1001];
    cin>>N>>K;
    for(int i=0;i<N;i++)    cin>>p[i];

    for(int i=0;i<N-1;i++){
        for(int j=i;j<N;j++){
            if(p[i]>p[j]){
                int a=p[i];
                p[i]=p[j];
                p[j]=a;
            }
        }
    }

    for(int i=0;i<K;i++)    ans+=p[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a[100001],ans,lft;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=0;i<n;++i) cin>>a[i];
	for (int i=0;i<n;++i)
	{
		ll th=min(lft,a[i]);
		a[i]-=th;
		ans+=th;
		ans+=a[i]/2;
		a[i]%=2;
		lft=a[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        a: i32,
        b: i32,
    }
    let mut ans = -1;
    for i in 1..1250 {
        if (0.08 * (i as f64)).floor() as i32 == a && (0.1 * (i as f64)).floor() as i32 == b {
            ans = i;
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
   ll n,k;
   cin>>n>>k;
   ll i,j;
   ll a[n];
   for(i=0;i<n;i++)cin>>a[i];
   for(i=k;i<n;i++)
   {
       ll no1 = a[i];
       ll no2 = a[i-k];
       if(no1>no2)
       {
           cout<<"Yes\n";
       }
       else{
           cout<<"No\n";
       }
   }

}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 5208
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void debug(vec &v) {
	int n = v.size();
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << v[i];
	}
	cout << endl;
}

ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n % 2)res = res * x%mod;
		n >>= 1; x = x * x%mod;
	}
	return res;
}
int n;
vector<int> G[1 << 18];

int subch[1 << 18];
ll t2[1 << 18];
void initch(int id, int fr) {
	subch[id] = 1;
	rep(j, G[id].size()) {
		int to = G[id][j];
		if (to == fr)continue;
		initch(to, id);
		subch[id] += subch[to];
	}

}
void init() {
	initch(0, -1);
	t2[0] = 1;
	rep(i, n)t2[i + 1] = t2[i] * 2 % mod;
}
ll ans = 0;

ll dfs(int id, int fr) {
	vector<ll> v;
	vector<ll> vs;
	vector<int> ids;
	rep(j, G[id].size()) {
		int to = G[id][j];
		if (to == fr)continue;
		ll nex = dfs(to, id);
		v.push_back(nex);
		vs.push_back(t2[subch[to]] - 1);
		ids.push_back(to);
	}
	//reflect ans
	ll al = 1;
	rep(i, v.size()) {
		al = al * (v[i] + 1) % mod;
	}

	ll res = 0;
	//id is black
	rep(i, v.size()) {
		ll num = t2[subch[id] - subch[ids[i]] - 1];
		num = (num%mod + mod) % mod;
		num = num * v[i] % mod;
		(res += 2*num) %= mod;
		//num = num * t2[n - subch[id]] % mod;
		(ans += num) %= mod;
	}


	//id is white
	rep(i, v.size()) {
		ll num = t2[subch[id] - subch[ids[i]] - 1] - 1;
		num = (num%mod + mod) % mod;
		num = num * v[i] % mod;
		//(res += num) %= mod;
		//num = num*t2[n - subch[id]] % mod;
		(ans += num) %= mod;
	}

	ll num = t2[subch[id] - 1] - 1;
	res += num;
	rep(i, vs.size()) {
		num -= vs[i];
	}
	num = (num%mod + mod) % mod;
	//num = num * t2[n - subch[id]] % mod;
	ans += num;

	//cout << id << " " << ans << endl;
	//res += num;

	ans %= mod;
	res %= mod;
	//cout << id << " " << res << endl;
	return res;

}

void solve() {
	cin >> n;
	rep(i, n - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	init();
	dfs(0, -1);
	ans = ans * mod_pow(t2[n], mod - 2) % mod;
	cout << ans << endl;
	//cout << t2[7] * 570312505 % mod << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 42624
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    ll n,a,b;
    cin >> n>>a>>b;
    if(a>b) cout << 0 <<endl;
    else if(a==b) cout << 1 <<endl;
    else {
        if(n==1&&a==b) cout << 1 <<endl;
        else if(n==1&&a!=b) cout << 0 <<endl;
        else{
            ll ma = a+b+(n-2)*b;
            ll mi = a+b+(n-2)*a;
            cout << ma-mi+1 <<endl;
        }
    }
}

Measured memory_bytes: 3588
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int cnt = 0;
		while(N > 0){
			cnt += 1;
			N /= K;
		}
		Console.WriteLine(cnt);
		
	}
	long N, K;
	public Sol(){
		var d = rla();
		N = d[0]; K = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11092
#include<stdio.h>
int devcon(int i,int x);

int n,a[21];

int main(){
  int i,m,x,result;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&a[i]);}
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&x);
    result=devcon(0,x);
    if(result)printf("yes\n");
    else printf("no\n");
  }
}

int devcon(int i,int x){
  int result;
  if(x==0)return 1;
  if(i>=n)return 0;
  result = devcon(i+1,x)||devcon(i+1,x-a[i]);
  return result;
}


Measured memory_bytes: 2104
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k= sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();
        if (k <= s * t) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35720
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long m=0,a=0,r=0,c=0,h=0;
  string s[100000];
  for(int i=0; i<n; i++) {
    cin >> s[i];
    if(s[i][0]=='M') {
      m++;
    }
    if(s[i][0]=='A') {
      a++;
    }
    if(s[i][0]=='R') {
      r++;
    }
    if(s[i][0]=='C') {
      c++;
    }
    if(s[i][0]=='H') {
      h++;
    }
  }
  cout << m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h << endl;
}

Measured memory_bytes: 6144
N,X=map(int,input().split())
dp={}
def f(n,x):
    if (n,x) in dp:
        return dp[(n,x)]
    elif (n,x)==(0,1):
        return 1
    else:
        if x==1:
            answer=0
            dp[(n,x)]=answer
            return answer
        elif 2<=x<=2**(n+1)-2:
            answer=f(n-1,x-1)
            dp[(n,x)]=answer
            return answer
        elif x==2**(n+1)-1:
            answer=f(n-1,2**(n+1)-3)+1
            dp[(n,x)]=answer
            return answer
        elif 2**(n+1)<=x<=2**(n+2)-4:
            answer=f(n-1,2**(n+1)-3)+f(n-1,x-2**(n+1)+1)+1
            dp[(n,x)]=answer
            return answer
        else:
            answer=2*f(n-1,2**(n+1)-3)+1
            dp[(n,x)]=answer
            return answer
print(f(N,X))
            
            


Measured memory_bytes: 38256
#include <cstdio>
#include <algorithm>
 
using namespace std;
 
const int mod = 1000000007;
int a[1001];
int b[1001];
 
int main() {
    int n, m, c = 0, i, j, k;
    long long ans = 1;
    
    scanf("%d %d", &n, &m);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    for (i = 0; i < m; i++) scanf("%d", &b[i]);
    
    sort(a, a + n);
    reverse(a, a + n);
    sort(b, b + m);
    reverse(b, b + m);
    
    for (i = n * m, j = 0, k = 0; i > 0; i--) {
        if (a[j] == i && b[k] == i) {
            c += j + k;
            j++;
            k++;
        } else if (a[j] == i) {
            ans = ans * k % mod;
            c += k - 1;
            j++;
        } else if (b[k] == i) {
            ans = ans * j % mod;
            c += j - 1;
            k++;
        } else {
            ans = ans * c % mod;
            c--;
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int H = Integer.parseInt(scan.next());
	int W = Integer.parseInt(scan.next());
	StringBuilder str = new StringBuilder(H*W);
	for(int i=0; i<H; i++) {
	    String s = scan.next();
	    str.append(s + '\n' + s + '\n');
	}
	System.out.println(str.toString());
	scan.close();
    }
}


Measured memory_bytes: 22356
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		for(int i = 0 ; i < n ; i++) b[i] = sc.nextInt();
		for(int i = 0 ; i < n ; i++) c[i] = sc.nextInt();
		long ans = 0;
		Arrays.sort(a);
		Arrays.sort(c);
		// 中段で全探索
		for(int i = 0 ; i < n ; i++) {
			// 上段と中段で比較 // a[i] < b を満たす最大のiを求める
			int l = -1;
			int r = n;
			while(r - l > 1) {
				int mid = (l + r) / 2;
				if(a[mid] < b[i]) l = mid;
				else r = mid;
			}
			int cnt1 = r;
			// 中段と下段を比較 // b >= c[i] を満たす最大のiを求める
			int l1 = -1;
			int r1 = n;
			while(r1 - l1 > 1) {
				int mid = (l1 + r1) / 2;
				if(b[i] >= c[mid]) l1 = mid;
				else r1 = mid;
			}
			int cnt2 = n - r1;
			ans += 1L * cnt1 * cnt2;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 95512
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
  int a,b;
   cin>>a>>b;
   if(a-2*b>=0){
   cout<<a-2*b<<endl;
   }
   else{
   cout<<0<<endl;
   }
}

Measured memory_bytes: 256
n,m=map(int,input().split())
edges=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    a-=1; b-=1
    edges[a].append(b)
    edges[b].append(a)
visited=[False]*n
visited[0]=True
cnt=0

def dfs(fr):
    global cnt
    if all(visited):
        cnt+=1
        return
    for to in edges[fr]:
        if not visited[to]:
            visited[to]=True
            dfs(to)
            visited[to]=False
    return

dfs(0)
print(cnt)

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
int n;
ll dp[103][4][4][4];
map <char,int> c; 
bool agc(int a,int b,int c){
	if (a==0 && b==1 && c==2) return true;
	return false;
}
bool okay3(int a,int b,int c){
	if (a==0 && b==1 && c==2) return false;
	if (a==1 && b==0 && c==2) return false;
	if (a==0 && b==2 && c==1) return false;
	return true;
}
bool okay4(int a,int b,int c,int d){
	if (!okay3(a,b,c) || !okay3(b,c,d)) return false;
	if (agc(a,b,d) || agc(a,c,d)) return false;
	return true;
}
int main(){
	memset (dp,0,sizeof(dp));
	cin>>n;
	if (n==1) return !printf("4");
	if (n==2) return !printf("16");
	if (n==3) return !printf("61");
	for (int i=0;i<4;i++)
		for (int j=0;j<4;j++)
			for (int k=0;k<4;k++)
				dp[3][i][j][k]=1;
	for (int i=3;i<=n;i++)
		for (int j=0;j<4;j++)
			for (int k=0;k<4;k++)
				for (int l=0;l<4;l++)
					for (int q=0;q<4;q++)
						if (okay4(j,k,l,q))
							dp[i][k][l][q]=(dp[i][k][l][q]+dp[i-1][j][k][l])%MOD;
	ll ans=0;
	for (int i=0;i<4;i++)
		for (int j=0;j<4;j++)
			for (int q=0;q<4;q++) 
				ans+=dp[n][i][j][q];
	cout<<ans%MOD;
}

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

int main() {
    string s;
    cin >> s;
    
    int n = s.size();
    bool easy = true;
    for(int i = 0; i < n; ++i) {
        if(i % 2 != 0 && s[i] == 'R') easy = false;
        if(i % 2 == 0 && s[i] == 'L') easy = false;
    }
    
    if(easy) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>

using namespace std;
//#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) 

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define INT(a) int((a)+1e-9)
int DX[4]={1,0,-1,0};
int DY[4]={0,1,0,-1};

int ps[5000];
int sps[5000];
int pl;

void init(){
	int pi=0;
	FOR(p,2,10001){
		bool isPrime=true;
		FOR(qi,0,pi){
			if(p%ps[qi]==0){
				isPrime=false;
				break;
			}
		}
		if(isPrime) ps[pi++]=p;
	}
	pl=pi;

	sps[0]=0;
	FOR(pi,0,pl){
		sps[pi+1]=sps[pi]+ps[pi];
	}
}

int solve(int n){
	int re=0;
	int i=0,j=0;
	while(ps[i]<=n&&j<=pl){
		DEBUG(i);DEBUG(j);DEBUG(sps[j]-sps[i]);
		if(sps[j]-sps[i]==n){re++; j++;}
		else if(sps[j]-sps[i]>n){i++;}
		else if(sps[j]-sps[i]<n){j++;}
	}
	return re;
}



int main(){
	init();
	
	int n;
	while(true){
		cin >> n;			if(!n) return 0;
		DEBUG(n);
		cout<<solve(n)<<endl;
	}
	
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void uniq(vector<int> &vec){sort(vec.begin(), vec.end());vec.erase(unique(vec.begin(), vec.end()), vec.end());}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {start();COMinit();
    int n,k;
    cin>>n>>k;
    REP(i,1,k+1){
        int b = COM(k-1,i-1)%MOD;
        int a = COM(n-k+1,i)%MOD;
        int ans=(a*b)%MOD;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 12160
// (c) 2020, redotter

// Roses are red
// The Tardis is blue
// The Doctor once said
// Rose Tyler...

#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#pragma comment(linker, "/stack:500000000")
#endif

#define pb push_back
#define the(a) (a).begin(), (a).end()
#define ft first
#define sd second
#define endl "\n"
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forr(i, s, n) for (int i = (s); i < (n); i++)

using i64 = long long;
using i32 = int;
using f64 = long double;

template <class T> using vec = vector<T>;
using str = string; using p64 = pair<i64, i64>;
using v64 = vec<i64>; using vv64 = vec<v64>;
using s64 = set<i64>; using m64 = map<i64, i64>;
template <size_t Size1> using a64 = array<i64, Size1>;
template <size_t Size1, size_t Size2> using aa64 = array<a64<Size2>, Size1>;
template <class T> using hash_set = unordered_set<T>;
template <class T, class U> using hash_map = unordered_map<T, U>;

mt19937 gen(998244353);
const i64 inf = numeric_limits<i64>::max() / 2;

template <class T> inline i64 len(const T& a) { return (i64)(a.size()); }
inline void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
template <class T, class S>
inline bool check_min(T& a, S b) { if (a > b) return a = b, 1; return 0; }
template <class T, class S>
inline bool check_max(T& a, S b) { if (a < b) return a = b, 1; return 0; }

void read() {}
template<class T, class ...U>
void read(T& a, U& ...b) { cin >> a; read(b...); }
void print() {}
template<class T, class ...U>
void print(const T& a, const U& ...b) { cout << a << " "; print(b...); }
void println() { cout << "\n"; }
template<class T, class ...U>
void println(const T& a, const U& ...b) { cout << a << " "; println(b...); }

struct Problem {
	void files(str in, str out) {
#ifdef ONLINE_JUDGE
		freopen(in.c_str(), "r", stdin), freopen(out.c_str(), "w", stdout);
#endif
	}
	void solve(), input();
	void many() { i32 t; cin >> t; while (t--) input(), solve(); }
	void make(bool mt = 0) { if (mt) many(); else input(), solve(); }
} problem;

signed main() {
	fast();
	problem.make();
#ifdef _DEBUG
	println(); println("[finished]"); system("pause > nul");
#endif
	return 0;
}

i64 n;
v64 a;

void Problem::solve() {
	vv64 dp(n, v64(n));
	v64 pref(n);
	forn(i, n) {
		pref[i] = a[i] + (i ? pref[i - 1] : 0);
	}
	forn(i, n) {
		dp[i][i] = 0;
		if (i != n - 1) dp[i][i + 1] = a[i] + a[i + 1];
	}
	forr(ln, 3, n + 1) {
		forn(i, n) {
			i64 j = i + ln - 1;
			if (j >= n) break;
			dp[i][j] = inf;
			for (i64 k = i + 1; k <= j; k++) {
				check_min(dp[i][j], dp[i][k - 1] + dp[k][j]);
			}
			dp[i][j] += pref[j] - (i ? pref[i - 1] : 0);
		}
	}
	i64 ans = dp[0][n - 1];
	println(ans);
}

void Problem::input() {
	read(n);
	a.resize(n);
	forn(i, n) read(a[i]);
}


Measured memory_bytes: 4464
a, b = map(int, input().split())
if 0 < a <= b:
    print("Positive")

elif a <= b < 0:
    if (b - a + 1) % 2 == 0:
        print("Positive")

    else:
        print("Negative")
elif a <= 0 <= b:
    print("Zero")


Measured memory_bytes: 9108
use std::io::{self, BufRead, BufReader};

fn main() -> io::Result<()>{
    let mut stdin = BufReader::new(io::stdin());
    let mut buf = String::new();

    stdin.read_line(&mut buf)?;

    let k = buf.split_whitespace().map(|token| token.parse::<u64>().unwrap()).collect::<Vec::<_>>()[0];
    let mut i = f64::log10((k as f64) * 7.0/9.0 + 1.0) as u32 + 1;
    #[allow(non_snake_case)]
    let mut A = (7 * (10_u64.pow(i) - 1) / 9) % k;
    let mut tmp = 10_u64.pow(i) % k;

    while i <= 9000000{
	if A == 0{
	    println!("{}",i);
	    return Ok(())
	}
	A += ((tmp * 7) % k);
	A %= k;
	tmp *= 10;
	tmp %= k;
	i += 1;
    }
    println!("-1");
    Ok(())
}


fn pow_mod(n : u64, e : u32, m : u64) -> u64{
    let mut e = e;
    #[allow(non_snake_case)]
    let mut A = n % m;
    let mut res = 1;
    while e > 0{
	if e & 1 == 1{
	    res = (res * (A % m)) % m;
	}
	A = (A * (A % m)) % m;
	e >>= 1;
    }
    res
}


Measured memory_bytes: 2844
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,kin[5000],x,ans1,ans2;
bool b[10];
int main(){
	fo(i,1,399) kin[i]=1;
	fo(i,400,799) kin[i]=2;
	fo(i,800,1199) kin[i]=3;
	fo(i,1200,1599) kin[i]=4;
	fo(i,1600,1999) kin[i]=5;
	fo(i,2000,2399) kin[i]=6;
	fo(i,2400,2799) kin[i]=7;
	fo(i,2800,3199) kin[i]=8;
	scanf("%d",&n);
	fo(i,1,n){
		scanf("%d",&x);
		if (x>=3200){
			ans2++;
			continue;
		}
		b[kin[x]]=1;
	}
	fo(i,1,8) if (b[i]) ans1++;
	if (!ans1) printf("1 ");else printf("%d ",ans1);
	printf("%d\n",ans1+ans2);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int l=LEN(s);
	vector<int>n(l,0);
	vector<int>L;
	vector<int>R;
	rep(i,l){
		if(s[i]=='L')L.push_back(i);
		else R.push_back(i*-1);
	}
	sort(all(R));
	rep(i,l){
		if(s[i]=='R'){
			auto it=lower_bound(all(L),i);
			int tmp=*it;
			if((tmp-i)%2==0)n[tmp]++;
			else n[tmp-1]++;
		}
		else {
			auto it=lower_bound(all(R),i*-1);
			int tmp=(*it)*-1;
			if((i-tmp)%2==0)n[tmp]++;
			else n[tmp+1]++;
		}
	}
	rep(i,l)cout<<n[i]<<" ";
	cout<<endl;
}

Measured memory_bytes: 1612
# -*- coding: utf-8 -*-
n = int(input())

divisors = []
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n // i)

total = 0
for divisor in divisors:
    if divisor == 1:
        continue
    fav = divisor - 1
    x = n // fav
    y = n % fav
    if x == y:
        total += fav

print(total)

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

int main() {
  int H, W;
  string a;
  cin >> H >> W;
  for (int i = 0; i < W + 2; i++)
    cout << "#";
  cout << endl;
  
  for (int i = 0; i < H; i++) {
    cin >> a;
    cout << '#' + a + '#' << endl;
  }
  
  for (int i = 0; i < W + 2; i++)
    cout << "#";
  cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split(" ");

		int A = Integer.parseInt(lines[0]);
		int B = Integer.parseInt(lines[1]);

		if(A > 12) {
			System.out.println(B);
		}else if(A > 5) {
			System.out.println(B/2);
		}else {
			System.out.println(0);
		}
	}

}


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

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

int main () {
    int a;
    cin >> a;
    if(a == 0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<"------\n"<<#a<<" = "<<a<<endl<<"------"<<endl
#define debug2(a,b) cout<<"--------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<endl<<"--------------"<<endl
#define debug3(a,b,c) cout<<"----------------------\n"<<#a<<" = "<<a<<" ; "<<#b<<" = "<<b<<" ; "<<#c<<" = "<<c<<endl<<"----------------------"<<endl
#define sz(a) (ll)(a.size())
#define debug4(a) cout<<"chu "<<a<<endl
#define endl "\n"

ll a[3][100005],dp[3][100005];

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n;
  cin>>n;
  forn(i,0,n){
    cin>>a[0][i]>>a[1][i]>>a[2][i];
  }
  dp[0][0]=a[0][0];dp[1][0]=a[1][0];dp[2][0]=a[2][0];
  forn(i,1,n){
    dp[0][i]=max(dp[1][i-1],dp[2][i-1])+a[0][i];
    dp[1][i]=max(dp[0][i-1],dp[2][i-1])+a[1][i];
    dp[2][i]=max(dp[0][i-1],dp[1][i-1])+a[2][i];
  }
  ll ans=max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1]));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
 
int main() {
 
	int a, b, c;
   	cin >> a >> b >> c;
  
  if (a + b >= c) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256