akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define mod 1000000007LL
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define endl '\n'
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#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 mp make_pair
#define pb(x) push_back(x)
#define fo(i, a, n) for (i = (a); i < (n); i++)
#define foe(i, a, n) for (i = (a); i <= (n); i++)
// clang-format off
#define vin(a) for (ll i = 0; i < sz(a); i++) { cin >> a[i]; } 
#define vout(a) for (auto x : a) { cout << x << " "; }
#define sws                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0)
// clang-format on
#define pd(x) cout << x
#define sd(x) cin >> x
#define nl cout << endl
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define foreach(i, a)                                                          \
  for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
// int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
void solve() {
  ll m, n;
  ll i, j;
  cin >> n;
  n >= 30 ? cout << "Yes" : cout << "No";
}

int main() {
  sws;
  solve();
  return 0;
}

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

int main(){
    int n , l;
    cin >> n>> l;
    vector<string> s = vector<string>(n);
    for(int i = 0; i< n; i++){
        cin >> s.at(i);
    }
    sort(s.begin(), s.end());

    for(int i = 0; i< n; i++){
        cout << s.at(i);
    }

    cout << endl;

}

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

using namespace std;

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}

int main() {
    int Q;
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        string S, T;
        cin >> S >> T;
        int N = S.length(), M = T.length();
        S.insert(S.begin(), '$');
        T.insert(T.begin(), '$');

        auto dp = Vec<int>(N + 1, M + 1, 0);
        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= M; ++j) {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
                if (S[i] == T[j]) dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
            }
        }
        cout << dp[N][M] << endl;
    }
    return 0;
}



Measured memory_bytes: 6844
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,ma,mb,a[50],b[50],c[50],dp[50][401][401];
    cin>>n>>ma>>mb;
    rep(i,n){
        cin>>a[i]>>b[i]>>c[i];
    }
    rep(i,n+1)rep(j,401)rep(k,401){
        dp[i][j][k]=INF;
    }
    dp[0][0][0]=0;
    rep(i,n){
        rep(j,401){
            rep(k,401){
                if(dp[i][j][k]==INF) continue;
                dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
                dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
            }
        }
    }
    int ans=INF;
    rep2(j,1,401)rep2(k,1,401){
        if(j*mb==k*ma){
            ans=min(ans,dp[n][j][k]);
        }
    }
    if(ans==INF) cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 27904
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<math.h>

//#define DIV 1000000007
using namespace std;
using ll = long long;

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

	string L,R;
	for (int i = 0; i < N; i++) {
		char a;
		cin >> a;
		L.push_back(a);
	}

	for (int i = 0; i < N; i++) {
		char a;
		cin >> a;
		R.push_back(a);
	}
	reverse(R.begin(), R.end());

	ll mx = pow(2, N);
	map<pair<string, string>, ll> Left, Right;
	for (ll i = 0; i < mx; i++) {
		//cout << "i=" << i << endl;
		vector<int> bit(N);
		ll temp = i;
		for (int j = 0; temp > 0; j++) {
			bit[j] = temp % 2;
			temp /= 2;
		}

		string red,blue;
		for (int k = 0; k < N; k++) {
			if (bit[k]) red.push_back(L[k]);
			else blue.push_back(L[k]);
		}
		Left[make_pair(red, blue)]++;

		string red2, blue2;
		for (int k = 0; k < N; k++) {
			if (bit[k]) red2.push_back(R[k]);
			else blue2.push_back(R[k]);
		}
		Right[make_pair(red2, blue2)]++;
	}

	ll ans = 0;
	int cnt = 1;
	/*
	for (auto y : Right) {
		cout << y.first.first << " " << y.first.second << " ";
		cout << y.second << endl;
	}
	*/
	for (auto x : Left) {
		//cout << "cnt=" << cnt << " ";
		//cout << x.first.first << " " << x.first.second << " ";
		//cout << x.second << endl;;
		//cout << Right[x.first] << " " << endl;
		ans += x.second * Right[x.first];
		cnt++;
	}

	cout << ans << endl;
}


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

using namespace std;

int main(void)
{
    int A, B;
    string S;
    cin >> A >> B >> S;

    bool iszip = true;

    if(S[A] != '-')
        iszip = false;

    for(int i = 0; i < A; ++i)
        if(!isdigit(S[i]))
            iszip = false;

    for(int i = A + 1; i < A + B + 1; ++i)
        if(!isdigit(S[i]))
            iszip = false;

    cout << (iszip ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 888
def binary_search(key):
    '''
    条件を満たす最小/最大のindexを求める
    '''
    ok = 10 ** 9  # 条件を満たすindexの上限値/下限値
    ng = 0        # 条件を満たさないindexの下限値-1/上限値+1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        cnt = 0
        for v in a:
            cnt += (v + mid - 1) // mid - 1

        if cnt <= key:  # midが条件を満たすか否か
            ok = mid
        else:
            ng = mid
    
    return ok


n, k = map(int, input().split())
a = list(map(int, input().split()))

print(binary_search(k))

Measured memory_bytes: 104304
#include <iostream>

using namespace std;
long long a[100010],t[100010],s[100010];
int main(){
	long long i,j,n,m;
	cin >> n >> m;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	for(i=0;i<=100010;i++){
		t[i] = 0;
		s[i] = 0;
	}
	for(i=1;i<n;i++){
		if(a[i-1]<a[i]){
			t[1] += a[i]-a[i-1];
			t[a[i-1]+1] -= a[i]-a[i-1];
			t[a[i-1]+1] += a[i]+1;
			s[a[i-1]+1] += -1;
			t[a[i]+1] -= a[i]+1;
			s[a[i]+1] -= -1;
			t[a[i]+1] += a[i]-a[i-1];
		}else{
			t[1] += a[i]+1;
			s[1] += -1;
			t[a[i]+1] -= a[i]+1;
			s[a[i]+1] -= -1;
			t[a[i]+1] += a[i]+m-a[i-1];
			t[a[i-1]+1] -= a[i]+m-a[i-1];
			t[a[i-1]+1] += a[i]+m+1;
			s[a[i-1]+1] += -1;
		}
	}
	
	for(i=1;i<=m+1;i++){
		t[i+1] += t[i];
		s[i+1] += s[i];
	}
	for(i=0;i<=m;i++){
		s[i] *= i;
	}
	long long ans=200000000000;
	for(i=1;i<=m;i++){
		ans = min(ans,t[i]+s[i]);
	}
	cout << ans << endl;
}
	

Measured memory_bytes: 2560
/**
*    created: 12.07.2020 12:45:02
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    vector<string> st(3); rep(i,3) cin >> st[i];
    vector<int> at(3,0);
    int turn = 0;
    while (true) {
        if (at[turn] == st[turn].size()) break;
        else {
            int t = turn;
            turn = st[turn][at[turn]] - 'a';
            at[t]++; 
        }
    }
    cout << (char)('A' + turn) << endl;
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;

bool sort_sec(const pair<int,int> &a,const pair<int,int> &b){
   if(a.second<b.second){
      return true;
   }
   return false;
}

void swap(int *a,int *b){
   int temp=*a;
   *a=*b;
   *b=temp;
}

int gcd(int a,int b){
   if(a%b==0) return b;
   return gcd(b,a%b);
}
int digit(int num){
   int cnt=0;
   while(num!=0){
      cnt+=num%10;
      num=num/10;
   }
   return cnt;
}
int main(void){
   int N;
   cin>>N;
   int ans=digit(N);
   if(N%10==0){
      cout<<10<<endl;
   }else{
      cout<<ans<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if((a>=1&&a<=9)&&(b>=1&&b<=9))
    {
        cout<<a*b<<endl;
    }
    else
    {
        cout<<"-1"<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
template<typename T> T gcd(T a,T b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
ll h, w, d, hw, q, l, r;
pii x[90000];
ll db[90000][17], dd[17];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w >> d;
  hw = h*w;
  FOR(i, 0, 17) dd[i] = (ll(d)<<i);
  FOR(i, 0, h)FOR(j, 0, w){
    int a;
    cin >> a;
    x[a-1] = pii(i, j);
  }
  FOR(i, 0, hw) db[i][0] = i+d < hw ? abs(x[i].fi-x[i+d].fi) + abs(x[i].se-x[i+d].se) : iinf;
  FOR(i, 1, 17) FOR(j, 0, hw) db[j][i] = db[j][i-1] + db[min(dd[i-1]+j, hw-1)][i-1];
  cin >> q;
  FOR(i, 0, q){
    cin >> l >> r;
    int k = (r-l) / d;
    l--;
    ll ans = 0;
    FOR(j, 0, 17){
      if(k%2){
        ans += db[l][j];
        l += dd[j];
      }
      k >>= 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 13824
let rec read u =
  try let line = read_float () in
      let w = match line with
        i when i <= 48. -> "light fly"
      | i when i > 48. && i <= 51. -> "fly"
      | i when i > 51. && i <= 54. -> "bantam"
      | i when i > 54. && i <= 57. -> "feather"
      | i when i > 57. && i <= 60. -> "light"
      | i when i > 60. && i <= 64. -> "light welter"
      | i when i > 64. && i <= 69. -> "welter"
      | i when i > 69. && i <= 75. -> "light middle"
      | i when i > 75. && i <= 81. -> "middle"
      | i when i > 81. && i <= 91. -> "light heavy"
      | _ -> "heavy" in
      print_endline w;read u
  with End_of_file -> ();;

let () = read ();;

Measured memory_bytes: 1976
from collections import deque
n=int(input())
Deq=deque()
for i in range(n):
    command=input().split( )
    com=int(command[0])
    if len(command)>1:
        com1=int(command[1])
    if com==0:
        Deq.append(com1)
    elif com==1:
        q=Deq[com1]
        print(q)
    elif com==2:
        del Deq[-1]



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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  for(int i = 0; i < n; i++) cin >> b.at(i);
  for(int i = 0; i < n; i++) c.at(i) = i + 1;
  
  int aIndex = 0;
  int bIndex = 0;
  int cIndex = 0;

  do
  {
    cIndex++;
    if(c == a) aIndex = cIndex;
    if(c == b) bIndex = cIndex;
    if(aIndex != 0 and bIndex !=0) break;
  } while (next_permutation(c.begin(), c.end()));

  cout << abs(aIndex-bIndex) << endl;

  return 0; 
}

Measured memory_bytes: 3596
def modpow(a, n, p):
  if n == 0:
    return 1
  if n == 1:
    return a % p 
  elif n % 2 == 1:
    return a * modpow(a, n-1, p) % p
  else:
    return modpow(a, n//2, p) **2 % p

l = [-1]*(2*10**5+1)
l[0] = 0
def f(n):
  if l[n] != -1:
    return l[n]
  else:
    b = bin(n)
    k = b.count("1")
    l[n] = f(n%k)+1
    return l[n]

 
  
  
n = int(input())
x = input()
#x = "1000101010"*20000
k = x.count("1")
x_mod_1 = int(x, 2) % (k+1)
x_mod_0 = int(x, 2) % (k-1) if k > 2 else 0
for i in range(n):
  if x[i] == "0":
    print(f((x_mod_1 + modpow(2, n-1-i, k+1))%(k+1))+1)

  else:
    if k > 2:
      print(f((x_mod_0 - modpow(2, n-1-i, k-1))%(k-1))+1)
    elif k > 1:
      print(1)
    else:
      print(0)
    

Measured memory_bytes: 95204
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define debug2(x, y) cout << #x << " : " << x  << ", " << #y << " : " << y << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

#define mod 1000000007
int main()
{
	FASTIO

	ll n;
	cin >> n;

	vector <ll> v(n);
	vector <ll> suffSum(n);
	suffSum[n - 1] = 0;
	for(ll i = 0; i < n; i ++)
	{
		cin >> v[i];
	}	

	for(ll i = n - 1; i > 0; i --)
	{
		suffSum[i - 1] = suffSum[i] + v[i];
	}

	ll ans = 0;
	for(ll i = 0; i < n; i ++)
	{
		ans = (ans % mod + ((v[i] % mod) * (suffSum[i] % mod)) % mod) % mod;
	}

	cout << ans << endl;
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int w,h,x,y;
        cin>>w>>h>>x>>y;
        //float ans=(w*h)/2.0;
        cout<<(w*h)/2.0<<" ";
         if(w/2.0 == x && h/2.0 == y){
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
         
     }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 256
#include<stdio.h>

#define M 3

typedef struct{
  int A[M][M];
}Pazzle;

Pazzle P;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};

int heuristic(Pazzle P){
  int i,j;
  int hx,hy,sum=0;

  for(i=0; i<M; i++){
    for(j=0; j<M; j++){
      if(P.A[i][j] == 0)continue;
      
      hx = (P.A[i][j]-1)%M-j;
      hy = (P.A[i][j]-1)/M-i;

      if(hx < 0)sum -= hx;
      else sum += hx;

      if(hy < 0)sum -= hy;
      else sum += hy;
    }
  }

  return sum;
}

int dfs(int x,int y,int max,int cnt,int n){
  int i,temp;
  int x0,y0,ans=-1,h;

  h = heuristic(P);

  if(h == 0)return cnt;
  if(cnt + h > max)return -1;

  for(i=0; i<4; i++){
    x0 = x + dx[i];
    y0 = y + dy[i];

    if((i == (n+2)%4 && n != -1) || !(0<=x0 && x0<M && 0<=y0 && y0<M))continue;
    temp = P.A[y][x];
    P.A[y][x] = P.A[y0][x0];
    P.A[y0][x0] = temp;

    ans = dfs(x0,y0,max,cnt+1,i);

    if(ans != -1)return ans;
    temp = P.A[y][x];
    P.A[y][x] = P.A[y0][x0];
    P.A[y0][x0] = temp;
  }

  return -1;
}

int main(){
  int i,j;
  int kx,ky,ans,a;
  Pazzle tP;

  for(i=0; i<M; i++){
    for(j=0; j<M; j++){
      scanf("%d",&a);
      P.A[i][j] = a;
      if(a == 0){
	kx = j;
	ky = i;
      }
    }
  }

  tP = P;

  for(i=1; i<46; i++){
    P=tP;
    ans = dfs(kx,ky,i,0,-1);
    if(ans != -1){
      printf("%d\n",ans);
      break;
    }
  }

  return 0;
}



Measured memory_bytes: 2084
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
const long long mod = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += i;
		if (sum > n) {
			int tmp = sum - n;
			for (int j = 1; j <= i; j++) {
				if (j == tmp)continue;
				cout << j << endl;
			}
			return 0;
		}
		if (sum == n) {
			for (int j = 1; j <= i; j++) {
				cout << j << endl;
			}
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    a, b = input().split()
    if a > b :
        taro += 3
    elif a < b:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)



Measured memory_bytes: 5596
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main (String [] args){
		//		String [][] boad = new String[4][4];
		List <Integer> list = new ArrayList<Integer>();
		String s = sc.next();
		int answer = 0;
//		int in = Integer.parseInt(sc.next());
		for(int i = 0;i<s.length();i++){
			list.add(Integer.parseInt(s.substring(i,i+1)));
		}
		for(int i = 2;i<s.length();i++){
			int var = 0;
			var = list.get(i) + list.get(i-1)*10 +list.get(i-2)*100;
			var = Math.abs(753 - var);
			if(i==2){
				answer = var;
			}else{
				if(var<answer){
					answer = var;
				}
			}
		}
		int b = 0;
//		int c = 0;
		String d = null;
//		for(int i = 0;i<n;i++){
//			list.add(Integer.parseInt(sc.next()));
//		}
		
		System.out.println(answer);
		System.out.flush();
		sc.close();
	}
}

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

int main()
{
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> a[i][j];
    }
  }

  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; i++)
  {
    cin >> b[i];
  }
  vector<vector<int>> bingo(3, vector<int>(3));
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      bingo[i][j] = 0;
      for (int k = 0; k < n; k++)
      {
        if (a[i][j] == b[k])
        {
          bingo[i][j] = 1;
        }
      }
    }
  }
  string ans = "No";
  for (int i = 0; i < 3; i++)
  {
    if (bingo[i][0] && bingo[i][1] && bingo[i][2])
    {
      ans = "Yes";
    }
    if (bingo[0][i] && bingo[1][i] && bingo[2][i])
    {
      ans = "Yes";
    }
  }
  if (bingo[0][2] && bingo[1][1] && bingo[2][0])
  {
    ans = "Yes";
  }
  if (bingo[0][0] && bingo[1][1] && bingo[2][2])
  {
    ans = "Yes";
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <random>
#include <chrono>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

#include <cstdio>

template<class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for(int i = 0; i < bits; i++) {
    if((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if(x < 0) return bin(32, x);
  for(int i = 4; i < 31; i++) {
    int y = 1 << i;
    if(x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
template<class T, class U>

using umap = unordered_map<T, U>;
template<class T>
using uset = unordered_set<T>;

typedef long long ll;

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

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

class Random {
  public:
  std::uniform_int_distribution<> uniform_int;
  std::mt19937 rnd;
  std::bernoulli_distribution bern_dist;
  int uniform(int l, int r) {
    return uniform_int(rnd, std::uniform_int_distribution<>::param_type(l, r));
  }
  int next(int N) {
    return uniform(0, N - 1);
  }
  int bern(double p) {
    return bern_dist(rnd, std::bernoulli_distribution::param_type(p));
  }
};
// }}}

// main {{{
void solve();
int main() {
  solve();
}
// }}}

void solve() {
  int N;
  cin >> N;
  cout << (N * N * N) << endl;
}


Measured memory_bytes: 888
/* Author: Dhruv Rastogi */
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<ctime>
#include<string>
#include<random>
#include<ctime>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

void solve(){ 
	string s;
	cin>>s;
	string t="";
	rep(i,0,sz(s)){
		if(s[i]=='C' and sz(t) and t.back()=='B'){
			t.pop_back();
			t.pb('X');
		}
		else{
			t.pb(s[i]);
		}
	} 
	int ans=0;
	int rl=0;
	repd(i,sz(t)-1,0){
		if(t[i]=='A'){
			ans+=rl;
		}
		else{
			if(t[i]!='X')
				rl=0;
			else ++rl;
		}
	}
	cout<<ans<<endl;
}

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

Measured memory_bytes: 916
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

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

    
    
    ll n;
    char ans;
    n = 1e12;
    cout << "? " << n << endl; cout.flush();
    cin >> ans;
    if (ans == 'Y') {
        n = 10;
        while (true) {
            cout << "? " << n-1 << endl; cout.flush();
            cin >> ans;
            if (ans == 'Y') break;
            n *= 10;
        }
        cout << "! " << n/10 << endl; cout.flush();
    } else {
        n = 10;
        while (true) {
            cout << "? " << n << endl; cout.flush();
            cin >> ans;
            if (ans == 'N') break;
            n *= 10;
        }
    
        ll lb = n/10, ub = n;
        while (ub - lb > 1) {
            int mid = (ub + lb) / 2;
            cout << "? " << mid << "0" << endl; cout.flush();
            cin >> ans;
            if (ans == 'N') {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        cout << "! " << ub << endl; cout.flush();
    }
}


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

using namespace std;

void solve()
{
	double x[4], y[4];
	while(cin >> x[0] >> y[0])
	{
		for(int i = 1; i < 4; ++i)
		{
			cin >> x[i] >> y[i];
		}
		if((x[0] == x[1] && y[0] == y[1]) || (x[2] == x[3] && y[2] == y[3]))
		{
			cout << "NO" << endl;
		}
		else if((x[0] == x[1] && y[0] != y[1]) && (x[2] != x[3] && y[2] == y[3]))
		{
			cout << "YES" << endl;
		}
		else if((x[0] != x[1] && y[0] == y[1]) && (x[2] == x[3] && y[2] != y[3]))
		{
			cout << "YES" << endl;
		}
		else if(x[0] != x[1] && x[2] != x[3] && fabs((y[1] - y[0]) * (y[3] - y[2]) + (x[1] - x[0]) * (x[3] - x[2])) < 0.000000001)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

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

Measured memory_bytes: 0
#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;
typedef long double ld;

int solve(void);

int main(void)
{
	while (solve())
	{
	}
	return 0;
}

int solve(void)
{
	ll N, K;
	cin >> N >> K;

	vector<ll> h(N);
	for(auto &v :h)
		cin >> v;

	ll cnt = 0;
	for (auto &v : h)
		if(v >= K) cnt ++;

	cout << cnt << endl;

	return 0;
}



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

int main(){
    int n,x,i;
    cin >> n;
    for(i=1;i<=n;i++){
        x=i;
        if(x % 3 == 0){
            cout << " " << i;
        }else{
            while(x != 0){
                if(x % 10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
    return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 321;

int a[N][N], p[N], h[N];

void solve() {
  int n, m; scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      scanf("%d", a[i]+j);
    }
  }
  int ans = 2e9;
  set<int> s;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      ++h[a[j][p[j]]];
    }
    int hi = max_element(h, h+m+1)-h;
    s.insert(hi);
    ans = min(ans, h[hi]);
    for (int j = 0; j < n; ++j) {
      while (s.count(a[j][p[j]])) ++p[j];
    }
    for (int j = 0; j <= m; ++j) h[j] = 0;
  }
  printf("%d", ans);
}

int main() {
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 4176
#include <stdio.h>

void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

int bubbleSort(int A[],int N) {
    int i,j;
    int sw = 0;
    unsigned short flag = 1;
    for(i=0;flag;i++) {
        flag = 0;
        for(j=N-1;j>=i+1;j--) {
            if(A[j]<A[j-1]) {
                swap(&A[j],&A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}

int main(void) {
    int i, A[100], N, sw;
    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    sw = bubbleSort(A,N);

    for(i=0;i<N;i++) {
        if (i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",sw);

    return 0;
}


Measured memory_bytes: 2040
#include <stdio.h>

int main() {
  int i,j;
  int n,q,m;
  int S[20];
  int sum;
  char isYes[40001];
  scanf("%d", &n);
  for(i = 0; i < n; ++i) scanf("%d",S+i);
  for(i = 0; i < 40001; ++i) isYes[i] = 0;
  for(i = 0; i < (1<<n)-1; ++i) {
    sum = 0;
    for(j = 0; j < n; ++j) {
      if((i>>j)&1) sum += S[j];
    }
    isYes[sum] = 1;
  }
  scanf("%d", &q);
  while(q--) {
    scanf("%d", &m);
    if(isYes[m]) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

Measured memory_bytes: 400
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;

	if (a == b)
	{
		cout << a + b << endl;
	}
	else 
	{
		cout << max(a, b) + max(a- 1, b- 1)<< endl;
	}
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def inpl(): return list(map(int, input().split()))
N, M = inpl()
MOD = 10**9 + 7
A = [1]*(N+3)
for _ in range(M):
    a = int(input())
    A[a] -= 1

DP = [0]*(N+3)
DP[0] = 1
for i in range(N):
    DP[i+1] = ((DP[i+1] + DP[i])*A[i+1])%MOD
    DP[i+2] = ((DP[i+2] + DP[i])*A[i+2])%MOD
print(DP[N])

Measured memory_bytes: 41692
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// int mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,i,j,k,temp,a,b,n;
    cin >> k>>a;
    if(k%a==0) cout << k/a;
    else cout << (k/a) +1;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main() {
  int x, y, z;
  cin >> x >> y >> z;
  P((x - z) / (y + z));
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, pos, s, t, l[1000007], res;
char a[1000007], b[1000007];
int main()
{
	scanf("%d%s%s", &n, a + 1, b + 1);
	if (strcmp(a + 1, b + 1) == 0)
	{
		cout << 0 << endl;
		return 0;
	}
	pos = n;
	s = 1;
	for (int i = n; i >= 1; i--)
	{
		if (b[i] == b[i - 1])continue;
		pos = min(pos, i);
		while (pos && a[pos] != b[i])pos--;
		if (!pos)
		{
			cout << -1 << endl;
			return 0;
		}
		while (s <= t)
			if (l[s] - (t - s + 1) + 1 > i)
				s++;
			else break;
		l[++t] = pos;
		if (i != pos)
			res = max(res, t - s + 1);
	}
	cout << res + 1 << endl;
	return 0;
}

Measured memory_bytes: 6144
n, k = map(int, input().split())
mod = 10**9+7
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
#a/b = a*(b`)となるb`を求める
mod = 10**9+7
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod
N = n - k + 1
combi = [0 for i in range(n+1)]
combi[0] = 1
for i in range(1,N+1):
    combi[i] = (combi[i-1]*(N-i+1)*mod_inv(i,mod)) % mod
fact = [0 for i in range(n+1)]
fact[0] = 1
for i in range(1, n+1):
    fact[i] = (i * fact[i-1]) % mod
for i in range(1, k+1):
    print((combi[i] * fact[k-1] * pow(fact[k-i], -1, mod) * pow(fact[i-1], -1, mod)) % mod)


Measured memory_bytes: 9272
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	string s;
	cin >> s;
	string ans = "";
	for (int i = 0; i < (int) s.size(); i++) {
		if (s[i] == 'B') {
			if (ans.size())
				ans.pop_back();
		} else
			ans.push_back(s[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3640
object Main extends App {
    val in = io.Source.stdin.getLines
    val n = in.next.toInt
    val es = in.take(n).flatMap(e => {
        val Array(r, _, t@_*) = e.split(" ").map(_.toInt)
        t.map((r, _))
    }).toList
    in.next
    for (Array(s, d, v) <- in.map(_.split(" ").map(_.toInt))) {
        val g = Array.fill(n+1)(Int.MaxValue-100)
        g(s) = 1
        (0 until es.size).foreach (_ => 
            for (e <- es) if (g(e._1) + 1 < g(e._2)) g(e._2) = g(e._1) + 1
        )
        println(if (v >= g(d)) g(d) else "NA")
    }
}

Measured memory_bytes: 48440
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define REP(i,a,b) for (int i = a ; i <= b ; i++)
#define REPI(i,a,b) for (int i = a ; i >= b ; i--)
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 3e3+7;

int n;
string s;
ll dp[N][N];
ll pref[N];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("teleport.in","r",stdin);
    //freopen("teleport.out","w",stdout);

    cin >> n >> s;

    // dp[i][j] = num of ways for prefix i while j is last number


    dp[0][0] = 1;
    pref[0] = 1;
    REP(i,1,n-1)
    {
        REP(j,0,i)
        {
            if (s[i-1] == '<')
            {
                if (j != 0) dp[i][j] = (dp[i][j]+pref[j-1])%MOD;
            }
            else if (s[i-1] == '>')
            {
                if (j != 0) dp[i][j] = (dp[i][j]+pref[i-1]-pref[j-1]+MOD)%MOD;
                else dp[i][j] = (dp[i][j]+pref[i-1])%MOD;
            }
        }
        pref[0] = dp[i][0];
        REP(j,1,i) pref[j] = (pref[j-1]+dp[i][j])%MOD;
    }
    ll ans = 0;
    REP(i,0,n-1) ans = (ans+dp[n-1][i])%MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 69120
import itertools
import math
l, r = map(int, input().split())


if(abs(l-r) > 2050): print(0)
else:
    num = []
    for i in range(l,r+1):
        num.append(i)
    minimum = 10**9
    for v in itertools.combinations(num, 2):
        minimum = min(minimum,v[0]*v[1]%2019)
    print(minimum)

Measured memory_bytes: 40428
#include <stdio.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cassert>

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 1e5+1;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FAILNO {cout << "NO\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}

int N,K;

int fact[MAXN], inv[MAXN], ifact[MAXN];

template<typename T, typename T1>
T mod(T x, T1 p) {
	x %= p;
	if (x < 0)
		x += p;
	return x;
}

template<typename T>
T inverse(T x, T p) {
	x = mod(x, p);
	if (x == 1)
		return x;
	return mod((1LL * (-p / x) * (inv[p % x] % p)) , p);
	// Since inverse of p % x is already calculated.
}

int NcR(int n, int r) {
	int ret = (1LL * ifact[n - r] * ifact[r]) % MOD ;
	ret = (1LL * ret * fact[n]) % MOD;
	return ret;
}

int main() {
#ifdef OJ
	freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);
#endif

	fact[0] = 1;
	for(int i = 1; i < MAXN; i++) {
		fact[i] = 1LL * fact[i - 1] * i % MOD;
	}

	ifact[0] = 1;
	for(int i = 1; i < MAXN; i++) {
		inv[i] = inverse(i, MOD);
		ifact[i] = 1LL * ifact[i - 1] * inv[i] % MOD;
	}

	cin >> N >> K;
	int R = N-K;
	for (int i = 1; i <= K; i++) {
		if (i == 1) {
			cout << NcR(R+1,1) << '\n';
		} else { 
			if (R+1 < i) {
				cout << "0\n";
				continue;
			}

			LL ans = 0;
			LL b = NcR(K-1,i-1);

			ans = (ans + NcR(R-1,i)) % MOD;
			ans = (ans + NcR(R-1,i-1)) % MOD;
			ans = (ans + NcR(R-1,i-1)) % MOD;
			ans = (ans + NcR(R-1,i-2)) % MOD;

			ans = (ans*b) % MOD;
			cout << ans << '\n';
		}
	}

	return 0;
}



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

int main()
{
  string s, t;
  cin >> s >> t;
  if (s.size() + 1 == t.size() && s == t.substr(0, t.size() - 1))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

class BIT
    attr_accessor:bit,:n
    def initialize(n)
        @n=n
        @bit=array(@n+1,0)
    end

    def add(i,x)
        while i<=@n
          @bit[i]+=x
          i+=i&-i
        end
    end

    def sum(i)
        s=0
        while i>0
            s+=@bit[i]
            i-=i&-i
        end
        return s
    end
end
MOD=10**9+7
N,K=get_i
A=get_i
ans=0
kind={}
A.sort.each do|a|
    kind[a]=0 if kind[a].nil?
    kind[a]+=1
end
bit=BIT.new(A.max)
N.times do|i|
    ans+=i-bit.sum(A[i])
    bit.add(A[i],1)
end
ans*=K
ans%=MOD
cnt=0
kind.each do|key,val|
  cnt+=val
  ans+=(K-1)*K/2*(N-cnt)*val 
  ans%=MOD
end
puts ans

Measured memory_bytes: 1916
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

d.sort()
t.sort()

from collections import deque

d = deque(d)
t = deque(t)

while len(t) > 0 and len(d) > 0:
	if d[0] == t[0]:
		d.popleft()
		t.popleft()
	else:
		d.popleft()

print('YES') if len(t) == 0 else print('NO')

Measured memory_bytes: 127700
#include <bits/stdc++.h>
using  namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double r,cir;
    double PI  =3.141592653589793238463;
    cin>>r;
    cir=2*PI*r;
    cout<<cir<<endl;
}


Measured memory_bytes: 3804
#include <iostream>

using namespace std;

int main(){
    int N; cin >> N ;
    bool f=false;
    for(int i=0;i<=25;i++){
        cerr << i*4 << " ";
        if(N<i*4) break;
        if((N-i*4)%7==0){
            cerr << N-i*4 << " ";
            f=true;
            break;
        }
        cerr << "" << endl;
    }
    if(f) cout << "Yes" << endl;
    else    cout << "No" << endl;
    return 0;
}

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

using namespace std;

struct node {
	int key;
	node* left;
	node* right;
};

node *root = NULL;

// Insert new key
void insert(int key)
{
	node *n = new node();
	*n = { NULL };
	n->key = key;
	node *x = root;
	node *y;
	y = NULL;
	while (x != NULL) {
		y = x;
		if (x->key >= n->key)
			x = x->left;
		else
			x = x->right;
	}
	if (y == NULL)
		root = n;
	else if (y->key >= n->key)
		y->left = n;
	else
		y->right = n;
}

// Pre-order traversal
void preorder(node* n)
{
	cout << " " << n->key;
	if(n->left != NULL)
		preorder(n->left);
	if (n->right != NULL)
		preorder(n->right);
}

// In-order traversal
void inorder(node* n)
{
	if(n->left != NULL)
		inorder(n->left);
	cout << " " << n->key;
	if (n->right != NULL)
		inorder(n->right);
}

// MAIN FUNCTION
int main(int argc, char** argv)
{
	// input
	string opt;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> opt;
		if (opt == "insert") {
			// insert new node
			int key;
			cin >> key;
			insert(key);
		}
		if (opt == "print") {
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}

	}
	return 0;
}

Measured memory_bytes: 18812
import math

n, d = [int(i) for i in input().split()]
x = [[int(i) for i in input().split()] for j in range(n)]

count = 0
distance = 0

for i in range(n-1):
    for j in range(i+1, n):
        for k in range(d):
            distance += (x[i][k]-x[j][k])**2
        distance = math.sqrt(distance)
        if math.ceil(distance) == math.floor(distance):
            count += 1
        distance = 0
        
print(count)

Measured memory_bytes: 3064
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){
  string s, a;
  cin >> s;
  a = s.substr(4, 6);
  a = "2018" + a;

  cout << a << endl;

  return 0;

}

Measured memory_bytes: 256
package main

import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

var sc = bufio.NewScanner(os.Stdin)

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


func main(){
	var res,a,b int
	H:=nextInt()
	W:=nextInt()
	N:=nextInt()
	if H>W{
		a=W
		b=H
	}else{
		a=H
		b=W
	}
	res=0
	for i:=0; i<a; i++{
		if (b*i>=N){
			break
		}
		res++
	}

	fmt.Println(res)


}


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

#define rep(i,start,n) for(int i=start;i<(int)(n);i++)
#define rrep(i,n,end) for(int i=n-1;i>=end;i--)
#define each(it,v) for(auto it : v)
#define all(v) (v).begin(),(v).end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using vpii = vector<Pii>;
using vpll = vector<Pll>;

const ll mod=1e9+7;
const int intINF=INT_MAX;
const ll  longINF=LONG_LONG_MAX;

main()
{
        ll h,w; cin>>h>>w;

        ll m=h*w;

        if(m%3==0)
        {
                cout<<0<<endl;
                return 0;
        }

        ll l=max(h,w),s=min(h,w);
        ll a,b,c,x,y;
        ll ans=1000100;
        rep(i,1,s)
        {
                a=l*i;
                b=(s-i)*(l/2);
                c=m-a-b;
                x=max({a,b,c}),y=min({a,b,c});
                ans=min(ans,x-y);
        }
        rep(i,1,s-1)
        {
                a=l*i;
                b=l*((s-i)/2);
                c=m-a-b;
                x=max({a,b,c}),y=min({a,b,c});
                ans=min(ans,x-y);
        }

        swap(s,l);
        rep(i,1,s)
        {
                a=l*i;
                b=(s-i)*(l/2);
                c=m-a-b;
                x=max({a,b,c}),y=min({a,b,c});
                ans=min(ans,x-y);
        }
        rep(i,1,s-1)
        {
                a=l*i;
                b=l*((s-i)/2);
                c=m-a-b;
                x=max({a,b,c}),y=min({a,b,c});
                ans=min(ans,x-y);
        }

        cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=0; i<n; i++) {
        double xa, ya, ra, xb, yb, rb;
        cin>>xa>>ya>>ra>>xb>>yb>>rb;
        double d=hypot(fabs(xb-xa), fabs(yb-ya));
        if(ra>d+rb) cout<<"2\n";
        else if(rb>d+ra) cout<<"-2\n";
        else if(ra+rb<d) cout<<"0\n";
        else cout<<"1\n";
    }
    return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
#define lg 18
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    int hash[26]={0};
    string s;
    cin>>s;
    for(auto z:s) hash[z-'A']++;
    int fg=0;
    rep(i,0,26)
    {
        if(hash[i]!=2 && hash[i]!=0) fg=1;
    }
    if(fg) cout<<"No";
    else cout<<"Yes";
    return 0;
}


Measured memory_bytes: 764