akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/

ll n,K;
ll dp[10000000];
ll a[105];
int main(){FAST;
cin>>n>>K;
for(ll i=1;i<=n;++i)cin>>a[i];
for(ll i=1;i<=K;++i){
  for(ll j=1;j<=n;++j){
    if(a[j]>i)break;
    dp[i] |= (dp[i-a[j]]^1);
  }
}
if(dp[K]){
  cout<<"First";
}
else cout<<"Second";
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> V(N), C(N);
    for(int i=0; i<N; i++){
        cin >> V.at(i);
    }
    for(int i=0; i<N; i++){
        cin >> C.at(i);
    }

    int ans=0;

    for(int i=0; i<N; i++){
        if(V.at(i)>C.at(i)){
            ans = ans + (V.at(i)-C.at(i));
        }
    }

    cout << ans << endl;
}

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

int main() {
  ll N;
  cin >> N;
  for (ll h = 1; h <= 3500; ++h) {
    for (ll n = 1; n <= 3500; ++n) {
      ll a = 4*h*n - N*(h+n);
      ll b = N*h*n;
      if (a <= 0) continue;
      if (b % a == 0) {
        ll w = b / a;
        printf("%lld %lld %lld\n", h, n, w);
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3732
#include "bits/stdc++.h"
#include<stdio.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv = vector<vector<T>>;
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
const ll MOD = 1e9 + 7;

int N;
LL M;
LL fact[11451];
LL revf[11451];
LL pw2[11451];

LL mypow(LL base, LL exp) {
	if (exp == 0) return 1;
	LL res = mypow(base*base%M, exp / 2);
	if (exp % 2) res = res * base%M;
	return res;
}

LL Comb(LL n, LL k) {
	if (k < 0 || n < k) return 0;
	return fact[n] * revf[k] % M * revf[n - k] % M;
}

int main() {
	cin >> N >> M;

	pw2[0] = 1 % M;
	fact[0] = revf[0] = 1;
	reps(i, 1, N + 10) {
		pw2[i] = pw2[i - 1] * 2 % M;
		fact[i] = fact[i - 1] * i % M;
		revf[i] = revf[i - 1] * mypow(i, M - 2) % M;
	}

	LL ans = 0;
	reps(k, 1, N) {
		LL totsum = 0;
		reps(l,1, N - k+1) {
			LL tot = 0;
			LL v = mypow(pw2[l] - 1, k);
			int sg = N - k - l;
			if (sg % 2) {
				tot += M - v;
			}
			else {
				tot += v;
			}
	//		cout << tot << endl;
			tot = tot * Comb(N - k, l);
			tot %= M;
			totsum += tot;
		}
		totsum %= M;
		LL m = Comb(N, k);
		LL p = k * LL(k - 1) / 2;
		LL q = (N - k)*LL(N - k - 1) / 2;

		m = m * mypow(2, p) % M;
		m = m * mypow(2, q) % M;
		ans += m * totsum;
		ans %= M;
	}
	printf("%lld\n", ans);
}



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

using namespace std;

int main() {

int H,n;
cin>>H>>n;
vector<long long >a(n);
vector<long long >b(n);
vector<long long >dp(H+1,INT_MAX);

	for(int i = 0; i < n; ++i){
		cin >> a[i] >> b[i];
	}
	dp[0] = 0;
	for(int hlth = 0; hlth <= H; ++hlth){
		for(int i = 0; i < n; ++i){
			dp[hlth] = min(dp[max(0LL, hlth - a[i])] + b[i], dp[hlth] );
		}
	}
	cout << dp[H] << '\n';

return 0;
}

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

int main() {
  int n,m;cin>>n>>m;
  vector<string> a(n),b(m);
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  rep(i,n-m+1)rep(j,n-m+1){
    bool ans=true;
    rep(k,m){
      if(a[i+k].substr(j,m)!=b[k])ans=false;
    }
    if(ans){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3580
main :: IO ()
main = do
  n <- readLn
  print $ g n

f :: Int -> [(Int,Int)]
f n = [(x, n-x) | x <- [1..((n+1) `div` 2)]]

sod
  :: Int -> Int
sod = sum . sod'

sod' 
  :: Int -> [Int]
sod' n
  | q == 0 = [r] 
  | otherwise = r : sod' q
  where
    (q,r) = quotRem n 10

sod2 :: Int -> Int -> Int
sod2 x y = sod x + sod y

g :: Int -> Int
g = minimum . map (uncurry sod2) . f

Measured memory_bytes: 1020
#include<iostream>
#include<cmath>

int main(){
    int A[3];
    for(int i = 0; i < 3; i++){
        std::cin >> A[i];
    }
    int minVal = 1000;
    minVal = std::min(minVal, std::abs(A[1] - A[0]) + std::abs(A[2] - A[1]));
    minVal = std::min(minVal, std::abs(A[2] - A[1]) + std::abs(A[0] - A[2]));
    minVal = std::min(minVal, std::abs(A[0] - A[1]) + std::abs(A[2] - A[0]));
    std::cout << minVal << std::endl;
    return 0;
}


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

#define mod 1000000007

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long int
#define vi vector<int>
#define vli vector<long int>
#define vlli vector<long long int >
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define frr(i,a,b) for(i=a;i<b;i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define fbb(i,a,b) for(i=a;i>b;i--)

#define pr_vec(i,a,b,v) for(i=a;i<b;i++) cout<<v[i]<<" ";
#define in_arr(i,n,v) for(i=0;i<n;i++) cin>>v[i];
int gcd(int a,int b){
    if(a<b) swap(a,b);
    if(b==0) return a;
   
    else return gcd(a%b,b);
 }
 bool f1(ll x,ll y){
    return x>y;
 }
 
int main()
{
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
   // #endif

    ll a,p;
    cin>>a>>p;
    ll ans=0;
    ans=(a*3)+p;
    ans=ans/2;
    cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
    int a,b,c;
    int MIN=1000,MAX=-1000,SUM=0;
    scanf("%d %d %d",&a,&b,&c);
	
	MIN=fmin(MIN,a);
	MIN=fmin(MIN,b);
	MIN=fmin(MIN,c);

	MAX=fmax(MAX,a);
	MAX=fmax(MAX,b);
	MAX=fmax(MAX,c);
	
	SUM=a+b+c;
	
	printf("%d %d %d\n",MIN,SUM-MAX-MIN,MAX);
    return 0;
}

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

#define N 100050

vector<int>vc[N],wt[N];
int in[N],val[N];

int dfs(int u)
{
    for(int i=0; i<vc[u].size(); i++)
    {
        int v=vc[u][i];
        if(val[v]==-1)
        {
            val[v]=val[u]+wt[u][i];
            int r=dfs(v);
            if(r==0) return 0;
        }
        else if(val[u]+wt[u][i]!=val[v]) return 0;
    }
    return 1;
}

int ck,vis[N],ok[N];
void cy(int u)
{
    if(vis[u]) return;
    vis[u]=1;
    ok[u]=1;
    for(int i=0; i<vc[u].size(); i++)
    {
        int v=vc[u][i];
        if(!vis[v]) cy(v);
        else if(ok[v]) ck=0;
    }
    ok[u]=0;
}

int main()
{
    int n,m,u,v,w;
    scanf("%d %d",&n,&m);
    for(int i=1; i<=m; i++)
    {
        scanf("%d %d %d",&u,&v,&w);
        vc[u].push_back(v);
        wt[u].push_back(w);
        in[v]++;
    }

    ck=1;
    for(int i=1; i<=n; i++)
    {
        cy(i);
    }
    if(!ck)
    {
        printf("No\n");
        return 0;
    }

    memset(val,-1,sizeof val);
    for(int i=1; i<=n; i++)
    {
        if(in[i]==0)
        {
            val[i]=0;
            if(!dfs(i))
            {
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
}


Measured memory_bytes: 17408
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS cin.tie(0);ios::sync_with_stdio(false)
#define MP_ make_pair
#define PB_ push_back
#define UB_ upper_bound
#define LB_ lower_bound
#define PQ_ priority_queue
#define FIR first
#define SEC second
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZ(x) ((int)(x).size())
#define PRI(x) cout<<(x)<<endl
#define SCA(x) cin>>(x)
typedef long long int lli;
using namespace std;

int ctoi(char c)
{
  if( c >= '0' and c <= '9')
    {
      return (int)(c-'0');
    }

  return -1;
}

vector<string> split(string str, char ch)
{
  int first = 0;
  int last = str.find_first_of(ch);
  
  if(last == string::npos)
    {
      last = SIZ(str);
    }

  vector<string> result;

  while( first < SIZ(str) )
    {
      string Ssubstr(str, first, last - first);
      result.push_back(Ssubstr);
      first = last + 1;
      last = str.find_first_of(ch, first);

      if(last == string::npos)
	{
	  last = SIZ(str);
	}
    }
  
  return result;
}

/*--------------- the end of the template --------------------*/









int main()
{
  IOS; /* making cin faster */
  int K;
  SCA(K);

  int nodd,neven;

  neven = K / 2;

  nodd = (K+1)/2;

  PRI(nodd*neven);
  

  

}


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

#define ll long long
#define ld long double
#define fi first
#define se second
#define pi 3.1415926535
#define mod1 1000000007
#define mod2 1000000009
#define mp make_pair
#define no_of_digits(n) floor(log10(n)) + 1
#define lcm(a, b) (a/__gcd(a,b)*b)
#define sdebug(n) cout << "\n' n = " << n << " '\n";

using namespace std;

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

  string s, t;
  cin >> s >> t;
  t.pop_back();
  cout << ((t == s)?"Yes":"No");
  return 0;
}



Measured memory_bytes: 3632
k, x = [int(i) for i in input().split()]
minimum = 1000000 - k + 1 if x + k - 1 > 1000000 else max(x - k + 1, -1000000)
maximum = -1000000 + k - 1 if x - k - 1 < -1000000 else min(x + k - 1, 1000000)
print(*range(minimum, maximum + 1))

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
  int n;
  string s, t;
  cin >> n >> s >> t;
  for(int i = 0; i < t.length(); i++){
    cout << s[i] << t[i];
  }
  cout << endl;
}


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

int main(void){
    int N;
    std::cin >> N;
    double result = 0;
    for(int i = 0; i < N; i++){
        double x;
        std::string u;
        std::cin >> x >> u;
        if(u == "JPY"){
            result += x;
        }
        else{
            result += 380000.0 * x;
        }
    }

    std::cout << result;
    return 0;
}

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

#define ris   return *this
#define tmplt template<class T
#define dbgo  debug& operator<<
tmplt > struct rge { T b, e; };
tmplt > rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
~debug(){cerr<<endl;}
tmplt > dbgo(T x){cerr<<boolalpha<<x;ris;}
tmplt, class C > dbgo(pair<T, C> x){ris<<"("<<x.first<<", "<<x.second<<")";}
tmplt > dbgo(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}ris<<"]";}
tmplt > dbgo(vector<T> x){ris<<range(x.begin(),x.end());}
#else
tmplt > dbgo(const T&){ris;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define ford(i, n) for(int i = n-1; i >= 0; i--) 

template<typename T> 
void min_self(T& a, T b) { 
   a = min(a, b); 
}
template<typename T>
void max_self(T& a, T b) { 
   a = max(a, b); 
}


int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   
   int n, K, S, T;
   cin >> n >> K >> S >> T;
   vector<int> a(n);
   for(int i = 0; i < n; i++) {
      cin >> a[i];
   }
   { 
      if((S & T) != S) {
         cout << "0\n";
         exit(0);
      }
      vector<int> new_a;
      for(int x : a) {
         if((x & S) == S && (x | T) == T) {
            new_a.push_back(x);
         }
      }
      a.swap(new_a);
      n = a.size();
      min_self(K, n);
   }
   vector<vector<long long>> binomial(n+1, vector<long long>(n+1));
   for(int i = 0; i <= n; i++) {
      binomial[i][0] = binomial[i][i] = 1;
      for(int j = 1; j < i; j++) {
         binomial[i][j] = binomial[i-1][j-1] + binomial[i-1][j];
      }
   }
   vector<long long> up_to_K(n+1);
   for(int i = 1; i <= n; i++) {
      for(int j = 1; j <= K; j++) {
         up_to_K[i] += binomial[i][j];
      }
   }
   const int B = 18;
   vector<int> freq(1 << B);
   long long ans = 0;
   int new_mask = S ^ T;
   for(int mask = new_mask; ; mask = (mask - 1) & new_mask) {
      for(int x : a) {
         ++freq[x & mask];
      }
      long long ways = 0;
      for(int x : a) {
         ways += up_to_K[freq[x & mask]];
         freq[x & mask] = 0;
      }
      if(__builtin_popcount(mask) & 1) {
         ans -= ways;
      } 
      else {
         ans += ways;
      }
      if(mask == 0) {
         break;
      }
   }
   
   cout << ans << "\n";
}















// Author: blondie


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

int main() {
    int N; cin >> N;
    vector<int> t(N), x(N), y(N);
    for(int i=0; i<N; ++i) cin >> t[i] >> x[i] >> y[i];

    bool ok = true;
    int cx = 0, cy = 0, ct = 0;

    for(int i=0; i<N; ++i) {
        int tmp = abs(x[i] - cx) + abs(y[i] - cy);
        if(tmp > t[i] - ct || (tmp % 2 != (t[i] - ct) % 2)) ok = false;
        cx = x[i]; cy = y[i]; ct = t[i];
    }
    cout << (ok ? "Yes\n" : "No\n");
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 2e5 + 10;
const int mod = 2019;
char s[M];
map <int, int> mp;
int main(){
    scanf("%s", s + 1);
    int len = strlen(s + 1), x = 0, pw = 1;
    ll ans = 0;
    mp[0] = 1;
    for(int i = len; i >= 1; i--) {
        x = ((s[i] - '0') * pw + x) % mod;
        //printf("%d\n", x);
        ans += mp[x];
        mp[x]++;
        pw = (pw * 10) % mod;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3968
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    int n,k;
    cin >> n >> k;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    int result = 999999999999;
    for(int i=0;i<n-k+1;i++){
        if(result > a[i+k-1] - a[i]){
            result = a[i+k-1] - a[i];
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int x,y,z,s; 
int main()
{
	cin>>x>>y>>z;
	x-=z;
	while(x>=y+z)
	{
		x-=y+z;
		s++; 
	}
	cout<<s<<endl;
	return 0;
}

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

#define inf 1000000007

using namespace std;

typedef long long ll;

int a[100005];

int main()
{
    ll n;
    int ji=0;
    cin >> n;
    while(n)
    {
        n--;
        a[ji++]=n%26;
        n=n/26;
    }
    for(int i=ji-1;i>=0;i--)
    {
        printf("%c",97+a[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define inf 1000000000

#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int a[100000],b[100000];
int main()
{
    fastread;
    int i,j,k;
    int na,nb,m;
    int ma=inf,mb=inf;
    cin>>na>>nb>>m;
    for(i=0;i<na;i++){
        cin>>a[i];
        ma=min(a[i],ma);
    }
    for(i=0;i<nb;i++){
        cin>>b[i];
        mb=min(b[i],mb);
    }
    int res=ma+mb;
    for(i=0;i<m;i++){
        int x,y,c;
        cin>>x>>y>>c;
        res=min(res,a[x-1]+b[y-1]-c);
    }
    cout<<res;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define ret0 return 0;
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main() {
    map <ll, ll> pcnt;
    map <ll, bool> done;
 
    ll n;
    cin >> n;
    rrep(i, 9) {
        rrep(j, 9) {
            if (i*j == n) {
                mes("Yes");
                ret0;
            }
        }
    }
    
    
    mes ("No");
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
int kaijo(int n) {
  int k=1;
  rep(i,n) k *= (i+1);
  return k;
}

int main() {
  int n;
  vector<int> p(n);
  vector<int> q(n);
  cin>>n;
  rep(i,n) cin>>p[i];
  rep(i,n) cin>>q[i];
  int a=1, b=1;
  rep(i,n-1) {
    a += kaijo(n-i-1)*(p[i]-1);
    for (int j=i+1;j<n-1;j++) {
      if (p[j]>p[i]) p[j]--;
    }
  }
  rep(i,n-1) {
    b += kaijo(n-i-1)*(q[i]-1);
    for (int j=i+1;j<n-1;j++) {
      if (q[j]>q[i]) q[j]--;
    }
  }
  cout<<abs(a-b)<<endl;
}

Measured memory_bytes: 512
import sys
import resource
sys.setrecursionlimit(20000)
def fact(n):
    if n==1:
        return 1
    else:
        return n*fact(n-1)
while True:
    n=int(input())
    if n==0:
        break
    x=fact(n)
    a=0
    while True:
        if x%10!=0:
            break
        if x%10==0:
            x=x//10
            a+=1
    print(a)


Measured memory_bytes: 20352
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int i = 0;
    int j = 0;
    int a, b;
    int graph[n][n];
    int ans = 0;
    int flag = 1;
    vector<int> v;
    
    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++){
            graph[i][j] = 0;
        }
        v.push_back(i);
    }
    
    for(i = 0; i < m; i++){
        cin >> a >> b;
        graph[a-1][b-1] = 1;
        graph[b-1][a-1] = 1;
    }
    
    do{
        if(v[0] != 0){
            continue;
        }
        flag = 1;
        for(i = 0; i < n-1; i++){
            if(graph[v[i]][v[i+1]] == 0){
                flag = 0;
            }
        }
        if(flag){
            ans++;
        }
    }while(next_permutation(v.begin(), v.end()));
    
    cout << ans << endl;
}



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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		vector<int> a(n, 0), idx(n+1, 0);
		for(int i=0; i<n; i++)cin >> a[i];
		for(int i=0; i < n; i++)idx[a[i]] = i;
		multiset<int> si{-1, -1, n, n};
		long long ret = 0;
		for (long long i = n; i > 0; i--){
			long long k = idx[i];
			si.insert(k);
			auto it = si.find(k);
			long long l1 = *prev(it);
			long long l2 = *prev(prev(it));
			long long r1 = *next(it);
			long long r2 = *next(next(it));
			ret += i*((r2-r1) * (k-l1) + (l1-l2) * (r1-k));			
		}
		cout << ret << "\n";
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  ull N;in(N);
  ull ans=ULONG_MAX;
  for(ull i=1;i*i<=N;i++)if(N%i==0)ans=min(ans,N/i+i-2);
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val a = Array<Int>(n, { cin.nextInt() })

    var t = a[0]
    var less = 0
    var same = 0
    var more = 0
    var ok = true

    for (i in 0..n-1) {
        if (a[i] == t + 1) {
            more += 1
        } else if (a[i] == t - 1) {
            less += 1
        } else if (a[i] == t) {
            same += 1
        } else {
            ok = false
            break
        }
    }

    var major = t
    var key = t
    
    var major_cats = same
    var key_cats = same

    if (more == 0) {
        key = t - 1
        key_cats = less
    } else if (less == 0) {
        major = t + 1
        major_cats = more
    } else {
        ok = false
    }

    if (more == 0 && less == 0) {
        major = t
        key = t        
    } 

    if (major != key) {
        val ex = major - key_cats
        if (0 >= ex || ex*2 > major_cats) {
            ok = false
        }
    } else {
        if (major != n - 1 && major*2 > n) {
            ok = false
        }
    }

    if (ok == false) {
        println("No")
    } else {
        println("Yes")
    }
}

Measured memory_bytes: 53756
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  double l;
  cin >> l;
  double a = l / 3;
  
  printf("%.10f", a*a*a);


  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] v = new int[N];
        int[] c = new int[N];
        for (int i = 0; i < N; i++) {
            v[i] = scan.nextInt();
        }
        for (int i = 0; i < N; i++) {
            c[i] = scan.nextInt();
        }
        int[] d = new int[N];
        for (int i = 0; i < N; i++) {
            d[i] = v[i] - c[i];
        }
        Arrays.sort(d);
        int answer = 0;
        for (int i = 0; i < N; i++) {
            if (0 < d[i]) {
                answer += d[i];
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
long long MOD=(long long)(1e9+7);


struct Matrix
{
    vector< vector<long long> > mat; // the contents of matrix as a 2D-vector
    long long n_rows, n_cols; // number of rows and columns

    Matrix(vector< vector<long long> > values): mat(values), n_rows(values.size()),
        n_cols(values[0].size()) {}

    static Matrix identity_matrix(long long n)
    {
        // Return I_n - the identity matrix of size n.
        // This function is static, because it creates a new Matrix instance
        vector< vector<long long> > values(n, vector<long long>(n, 0));
        for(long long i = 0; i < n; i++)
            values[i][i] = 1;
        return values;
    }

    Matrix operator*(const Matrix &other) const 
    {
        long long n = n_rows, m = other.n_cols;
        vector< vector<long long> > result(n_rows, vector<long long>(m, 0));
        for(long long i = 0; i < n; i++)
            for(long long j = 0; j < m; j++) {
                for(long long k = 0; k < n_cols; k++) {
                    result[i][j] = (result[i][j] + mat[i][k] * 1ll * other.mat[k][j]) % MOD;
                }
            }
        // Multiply matrices as usual, then return the result as the new Matrix
        return Matrix(result);
    }

    inline bool is_square() const
    {
        return n_rows == n_cols;
    }
};

Matrix fast_exponentiation(Matrix m, long long power)
{
    assert(m.is_square());
    Matrix result = Matrix::identity_matrix(m.n_rows);

    while(power) {
        if(power & 1)
            result = result * m;
        m = m * m;
        power >>= 1;
    }

    return result;
}
int main()
{
    long long n,k;
    cin>>n>>k;
    vector<vector<long long>> g(n,vector<long long>(n)),ans(n,vector<long long>(n,0));
    for(long long i=0;i<n;i++)
    {
        for(long long j=0;j<n;j++)
        cin>>g[i][j];
    }
   Matrix m(g);
   m=fast_exponentiation(m,k);
    long long rs=0;
for(long long i=0;i<n;i++)
{
    for(long long j=0;j<n;j++)
    {
           rs=(rs+m.mat[i][j])%MOD;
    }

}
cout<<rs;


}

Measured memory_bytes: 384
#define DEBUGGING  // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifndef DEBUGGING
#define DEBUG(...)
#else
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                     \
  do {                                 \
    cerr << " (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ": ";      \
    debug(__VA_ARGS__);                \
    cerr << endl;                      \
  } while (0)
#endif

const int INF = 500;

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

  int N, M;
  i64 L;
  cin >> N >> M >> L;
  vector<vector<i64>> mincost(N, vector<i64>(N, 1LL << 50));
  REP(i, M) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    mincost[a][b] = mincost[b][a] = c;
  }
  REP(k, N) REP(i, N) REP(j, N) {
    i64 c = mincost[i][k] + mincost[k][j];
    if (mincost[i][j] > c) mincost[i][j] = c;
  }

  vector<vector<i64>> mincost2(N, vector<i64>(N, INF));
  REP(i, N) REP(j, N) {
    if (mincost[i][j] <= L) {
      mincost2[i][j] = 1;
    }
  }
  REP(k, N) REP(i, N) REP(j, N) {
    i64 c = mincost2[i][k] + mincost2[k][j];
    if (mincost2[i][j] > c) mincost2[i][j] = c;
  }

  int Q;
  cin >> Q;
  REP(i, Q) {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    i64 refill = mincost2[s][t];
    cout << (refill == INF ? -1 : refill - 1) << '\n';
  }
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, Q; cin >> N >> Q;
    vector<stack<int>> s(N);
    while (Q--) {
        int q, t; cin >> q >> t;
        if (q == 0) {
            int x; cin >> x;
            s[t].push(x);
        } else if (q == 1) {
            if (s[t].size()) cout << s[t].top() << endl;
        } else {
            if (s[t].size()) s[t].pop();
        }
    }
}


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

int main(){
	int n;
  cin>>n;
  int t=0;
  for(int i=1;i<1e7;i++){
    t=(t*10+7)%n;
    if(t==0){
      cout<<i;
      return 0;
    }
  }
  cout<<"-1";
  
  }

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
typedef long long lint;
using namespace std;

int main()
{
	lint N,A,x[55]={};
	lint Max=0;
	lint dp[55][55][2510]={};//50,50,50*50
	lint ans=0;
	
	cin >> N >> A;
	for(lint i=0;i<N;i++)
	{
		cin >> x[i];
		Max=max(Max,x[i]);
	}
	
	dp[0][0][0]=1;
	for(lint i=0;i<N;i++)
	{
		for(lint j=0;j<N;j++)
		{
			for(lint k=0;k<=Max*N;k++)
			{
				if(dp[i][j][k]==0)continue;
				dp[i+1][j][k]+=dp[i][j][k];
				dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
			}
		}
	}
	
	for(lint i=1;i<=N;i++)
		ans+=dp[N][i][i*A];
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 59520
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const ll MOD = (ll)1000000007;//10^9+7
const ll INF2 = (ll)100000000000000000;//10^18

ll upper(ll A,ll x){
    return (ll)(A+x-1)/x;
}


int main() {
    ll N;
    cin>>N;
    VI t(N),a(N);
    REP(i,N){
        cin>>t[i]>>a[i];
    }
    ll c=t[0],d=a[0];

    for(int i=1;i<N;i++){
        ll n = (ll)max(upper(c,t[i]),upper(d,a[i]));
        c = n*t[i];
        d = n*a[i];
    }

    std::cout<<(c+d)<<endl;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n; cin >> n;
    vector<vector<int>> count(n, vector<int>(26, 0));
    rep(i, n) {
        string s; cin >> s;
        for (auto &ch: s) ++count[i][ch - 'a'];
    }

    vector<int> common(26, 0);
    rep(i, 26) {
        int mini = 1e9;
        rep(j, n) {
            mini = min(mini, count[j][i]);
        }
        common[i] = mini;
    }

    rep(i, 26) {
        rep(j, common[i]) {
            printf("%c", i + 'a');
        }
    }
    cout << endl;
}


Measured memory_bytes: 504
#include<stdio.h>

int main(void){
	
	int a , b ;
	scanf("%d %d",&a, &b) ;
	
	if( a < b ){
		printf("a < b\n");
	}
	else if( a > b ){
		printf("a > b\n");
	}
	else if( a == b ){
		printf("a == b\n");
	}
	
	
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main(void){
  int n,m,i,a,b;
  ll ans=0;
  vector<P> s;
  
  cin >> n >> m;
  for (i=0;i<n;i++){
    cin >> a >> b;
    s.push_back(P(a,b));
  }
  
  sort(s.begin(),s.end());
  
  for (i=0;i<n;i++){
    if (m>s[i].second){
      ans+=(ll)s[i].first*s[i].second;
      m-=s[i].second;
    }else{
      ans+=(ll)s[i].first*m;
      break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for (int i=0; i<n; i++)
typedef long long ll;
using namespace std;

int main()
{
    int n;
    ll ans=0;
    cin >> n;
    vector<int> a(3 * n);
    rep (i, 3*n) cin >> a.at(i);
    sort(a.rbegin(), a.rend());
    for (int i=1; i<=2*n; i+=2) {
        ans += a.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
N = int(input())
ans = 0
m = 0
for i in range(1, N + 1, 2):
  m = 0
  for j in range(1, i + 1):
    if i % j == 0:
      m += 1
    if j == i and m == 8:
      ans += 1
print(ans)

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

int main() {
  std::string str;
  std::cin >> str;
  int array[256] = {0};
  for (int i = 0; i < str.size(); ++i) {
    array[str[i]] = 1;
  }
  if (array['N'] ^ array['S']) {
    std::cout << "No" << std::endl;
  } else if (array['E'] ^ array['W']) {
    std::cout << "No" << std::endl;
  } else {
    std::cout << "Yes" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
N = int(input())
MIN = float("inf")

def Sum_Digits(D):
  SUM = 0
  while D > 0:
    SUM += D%10
    D = int((D-D%10)/10)
  return SUM

for a in range(1, N):
  b = N - a
  A = Sum_Digits(a)
  B = Sum_Digits(b)
  if A + B < MIN:
    MIN = A + B
    
print(MIN)

Measured memory_bytes: 3060
/*
AtCoder Beginner Contest 132 - D - Blue and Red Balls
https://atcoder.jp/contests/abc132/tasks/abc132_d
*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

ll sum() { return 0; }
template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;

struct comb{
	public:
	vector<ll> fac, finv, inv;
	comb(int mxN) {
		fac.resize(mxN);
		finv.resize(mxN);
		inv.resize(mxN);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for (int i = 1; i < mxN-1; i++) {
			fac[i+1] = fac[i] * (i+1) % MOD;
			inv[i+1] = MOD - inv[MOD%(i+1)]*(MOD/(i+1))%MOD;
			finv[i+1] = finv[i]*inv[i+1] % MOD;
		}
	}

	ll ncr(ll n, ll k) {
		if (k < 0 || n < k) return 0;
		ll res = 1;
		res *= fac[n]*finv[k]%MOD*finv[n-k]%MOD;
		return res;
	}

};

void solve() {
	ll n, k;
	cin >> n >> k;
	vvl v(n+5,vl(n+5,0));
	v[0][0]=1;
	FORN(i,1,n){
		v[i][0]=1;
		FORN(j,1,i){
			v[i][j]=(v[i-1][j-1]+v[i-1][j])%MOD;
		}
	}
	// c(n-k+1) * c(k-1,i-1)
	FORN(i,1,k){
		OUT(v[n-k+1][i]*v[k-1][i-1]%MOD);
	}
}

void solve2(){ll n, k;
	cin >> n >> k;
	comb c = comb(n);
	FORN(i,1,k){
		OUT((c.ncr(n-k+1,i)*c.ncr(k-1,i-1)%MOD));
	}
}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif

//    int tc; cin >> tc;
//    TC(tc) solve();
//	solve();
	solve2();
    return 0;
}

Measured memory_bytes: 3660
/*Unlucky_Glass*/
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N=1e3;
const ll inf=(1ll<<60);

struct GNODE{
	int to;
	ll cap,cst;
	GNODE *nxt,*rev;
	GNODE(){}
	GNODE(int _t,ll _ca,ll _cs,GNODE *_n,GNODE *_r):
		to(_t),cap(_ca),cst(_cs),nxt(_n),rev(_r){}
};
struct GRAPH{
	GNODE Gnod[(N*N+N+N)*2+10],*Gcnt,*Gtop[N*3];
	GRAPH(){Gcnt=Gnod;}
	void AddEdge(int u,int v,ll cap,ll cst){
		GNODE *p=++Gcnt,*q=++Gcnt;
		*p=GNODE(v,cap,cst,Gtop[u],q);Gtop[u]=p;
		*q=GNODE(u,0, -cst,Gtop[v],p);Gtop[v]=q;
	}
}Gflw;

GNODE *cop[N*3];
int n,Ps,Pt;
int Xa[N+3],Xb[N+3],Ya[N+3],Yb[N+3],Na[N+3],Nb[N+3];
ll dis[N*3];
bool inque[N*3];
bool vis[N*3];

ll fABS(ll Cx){return Cx<0? -Cx:Cx;}
pair<ll,ll> Aug(int u,ll flwin){
	if(u==Pt) return make_pair(flwin,0);
	ll flwout=0,totcst=0;
	vis[u]=true;
	for(GNODE *it=cop[u];it;it=it->nxt,cop[u]=cop[u]->nxt){
		int v=it->to;
		if(!it->cap || vis[v] || dis[v]!=dis[u]+it->cst) continue;
		ll flwv=min(flwin-flwout,it->cap);
		pair<ll,ll>resu=Aug(v,flwv);
		flwv=resu.first;
		totcst+=flwv*it->cst+resu.second;
		it->cap-=flwv;it->rev->cap+=flwv;
		flwout+=flwv;
		if(flwout==flwin) break;
	}
	vis[u]=false;
	return make_pair(flwout,totcst);
}
bool SPFA(){
	for(int i=1;i<=Pt;i++){
		dis[i]=-inf,cop[i]=Gflw.Gtop[i];
		inque[i]=vis[i]=false;
	}
	queue<int> que;
	que.push(Ps);
	dis[Ps]=0;inque[Ps]=true;
	while(!que.empty()){
		int u=que.front();que.pop();
		inque[u]=false;
		for(GNODE *it=cop[u];it;it=it->nxt){
			int v=it->to;
			if(!it->cap) continue;
			if(dis[u]+it->cst>dis[v]){
				dis[v]=dis[u]+it->cst;
//				if(v==Pt) return true;
				if(!inque[v]){
					inque[v]=true;
					que.push(v);
				}
			}
		}
	}
	return dis[Pt]!=-inf;
}
ll Dinic(){
	ll mxcst=0,mxflw=0;
	while(SPFA()){
		pair<ll,ll> resu=Aug(Ps,inf);
		mxflw+=resu.first;
		mxcst+=resu.second;
	}
	return mxcst;
}
int main(){
	scanf("%d",&n);
	Ps=n*2+5;Pt=n*2+6;
	for(int i=1;i<=n;i++) scanf("%d%d%d",&Xa[i],&Ya[i],&Na[i]);
	for(int i=1;i<=n;i++) scanf("%d%d%d",&Xb[i],&Yb[i],&Nb[i]);
	for(int i=1;i<=n;i++){
		Gflw.AddEdge(i,2*n+1,inf,+Xa[i]+Ya[i]);
		Gflw.AddEdge(i,2*n+2,inf,+Xa[i]-Ya[i]);
		Gflw.AddEdge(i,2*n+3,inf,-Xa[i]+Ya[i]);
		Gflw.AddEdge(i,2*n+4,inf,-Xa[i]-Ya[i]);
		Gflw.AddEdge(2*n+1,i+n,inf,-Xb[i]-Yb[i]);
		Gflw.AddEdge(2*n+2,i+n,inf,-Xb[i]+Yb[i]);
		Gflw.AddEdge(2*n+3,i+n,inf,+Xb[i]-Yb[i]);
		Gflw.AddEdge(2*n+4,i+n,inf,+Xb[i]+Yb[i]);
	}
	for(int i=1;i<=n;i++)
		Gflw.AddEdge(Ps,i,Na[i],0ll),
		Gflw.AddEdge(i+n,Pt,Nb[i],0ll);
	printf("%lld\n",Dinic());
	return 0;
}


Measured memory_bytes: 1152
N, X, Y = map(int, input().split())
dis = [0]*(N-1)

for i in range(1, N+1):
  for j in range(i+1, N+1):
    kyori = min(j-i, abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X))
    dis[kyori-1] += 1
    
for ans in dis:
  print(ans)

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

#ifdef LOCAL 
string to_string(char a) { return string(1,a); }
string to_string(bool a) { return a ? "1" : "0"; }
string to_string(const char* a) { return (string)a; }
string to_string(string a) { return a; }
string to_string(vector<bool> v) {
	string s = "["; for(unsigned i=0;i<v.size();i++){ s += ((i>0)?" ":"");
    s += char('0'+v[i]); } 	s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) {
	bool b = 1; string s = "["; for (const auto& x: v) {
		if (!b) {s += ", ";} b = 0; s += to_string(x); } s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void dbgf() { cerr << endl; }
template<class H, class... T> void dbgf(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	dbgf(t...); }
#define dbg(...) cerr << #__VA_ARGS__ << " = ", dbgf(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#define boolout(x) cout<<(x?"YES":"NO")<<endl;
typedef long long ll;


void solve()
{
    string s, t;
    cin >> s >> t;
    int sl = s.length();
    int tl = t.length();

    vector<vector<int>> dp(sl+1, vector<int>(tl+1, 0));

    for (int i = 1; i < sl+1; ++i) {
        for (int j = 1; j < tl+1; ++j) {
            if (s[i-1]==t[j-1]) {
                dp[i][j] = dp[i-1][j-1] + 1; 
            } else {
                dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
            }
        }
    }
    vector<char> res(dp[sl][tl], ' ');
    int i = sl;
    int j = tl;
    int counter = dp[sl][tl];
    //dbg(dp);
    while (i>0&&j>0) {
        //dbg(i, j, counter, s[i-1], t[j-1]);
        if (s[i-1]==t[j-1]) {
           res[--counter] = s[i-1]; 
           i--;
           j--;
        } else if (dp[i-1][j] > dp[i][j-1]) {
           i--; 
        } else {
           j--;
        }
    }
    for (auto i : res) {
        cout << i;
    }
    cout << endl;

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t; // read t. cin knows that t is an int, so it reads it as such.
    for (int i = 1; i <= t; ++i) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 35584
package main

import "fmt"

func main() {
	var n int
	var flg bool
	fmt.Scanf("%d", &n)
	flg = false

	for i := 0; i <= 9; i++ {
		for j := 0; j <= 9; j++ {
			if i*j == n {
				flg = true
			}
		}
	}

	if flg == true {
		fmt.Printf("Yes")
	} else {
		fmt.Printf("No")
	}
}

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

using namespace std;

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

    string answer = "";

    for (char c : T) {
        if (c == '?') {
            answer += 'D';
        } else {
            answer += c;
        }
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 3864
#include <stdio.h>

int main(void){
int H,W;
scanf("%d%d",&H,&W);
int i=0,j=0,k=0;
char a[10000],skip;
for(i=0;i<H*(W+1);i++) {
    if(i%(W+1)!=0){
    scanf("%c",&a[j]);
    j++;}
    else scanf("%c",&skip);
}
for(j=0;j<W+2;j++){
printf("#");
}
printf("\n");
for(j=0;j<H;j++){
 printf("#");
 for(k=0;k<W;k++){
  printf("%c",a[j*W+k]);
 }
 printf("#\n");
}
for(j=0;j<W+2;j++){
printf("#");
}
printf("\n");

return 0;
}

Measured memory_bytes: 128