akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

ll solve(){
    ll N;
    cin >> N;
    vector<ll>v(N);
    ll sum = 0;
    rep(i, N){
        cin >> v[i];
        sum += v[i];
    }
    ll step_num = sum / (N * (N + 1) / 2);
    if(sum % (N * (N + 1) / 2))return 0;
    stack<ll>S;
    rep(a, N){
        ll b = (a + 1) % N;
        ll tmp = v[b] - v[a] - step_num;
        if(tmp < 0)S.push(-tmp);
    }
    while(!S.empty()){
        ll val = S.top();
        S.pop();
        if(val % N)return 0;
        step_num -= val / N;
    }
    if(step_num)return 0;
    return 1;
}

int main(){

    if(solve())cout << "YES" << endl;
    else cout << "NO" << endl;


    return 0;
}

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

long long MOD = 1e9 + 7;
int a[24][24];
long long dp[(1<<22) + 10];
long long solve(long long mask, int n){
    //cout<<mask<<"\n";
    int in = __builtin_popcount(mask) + 1;
    if(in==n+1) return 1;
    if(dp[mask]!=-1) return dp[mask];
    int w;
    long long ans = 0;
    for(w=1;w<=n; w++) {
        if(a[in][w] && !(mask&(1<<w)) )
            ans+=solve(mask|(1<<w), n), ans%=MOD;
    }
    
    return dp[mask] = ans;
}
int main() {
	int n;
	cin>>n;
	int i, j;
	for(i=1;i<=n;i++) 
	    for(j=1;j<=n;j++)
	        cin>>a[i][j];
    for(i=1;i<(1<<(n+1))+2;i++)
        dp[i]=-1;
    long long ans = 0;
    for(i=1;i<=n;i++)
        if(a[1][i])
            ans +=solve(1<<i, n), ans%=MOD;
    cout<<ans<<"\n";
            
	return 0;
}

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

using namespace std;

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

// 46786 - 106

void oneCase() {
    int n, k;
    cin >> n >> k;
    int res = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        res += 2 * min(a, k - a);
    }
    cout << res << "\n";
}


int main() {
    int t = 1;
//    cin >> t;
    while (t--) {
       oneCase();
    }

    return 0;
}


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

#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
#define N 	     10001
int A[N];
void solve(){
	string s;
	cin>>s;
	int cnt1=0, cnt2=0;
	rep(i,0,s.length()){
		if(i%2)
			if(s[i]=='0')cnt1++;else cnt2++;
		else
			if(s[i]=='1')cnt1++; else cnt2++;
	}
	cout <<min((int)s.length()-cnt1, (int)s.length() - cnt2)<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    int n;
    std::cin >> n;

    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    std::vector<int> b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
    }

    long long count = 0;

    for (int i = 0; i < n; i++) {
        if (a[i] > b[i]) {
            count -= a[i] - b[i];
        } else {
            count += (b[i] - a[i]) / 2;
        }
    }

    if (count >= 0) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll N,X;
ll allNum[59];
ll pNum[59];
ll bNum[59];

ll dfs(int depth, ll num){
    if(num<=0) return 0;
    if(allNum[depth]<=num) return pNum[depth];
    ll res=0;
    num--;
    if(num>=allNum[depth-1]){
        res += pNum[depth-1];
        num -= allNum[depth-1];
        if(num>0) num--, res++;
    }
    res += dfs(depth-1,num);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>X;
    
    allNum[0]=1;
    pNum[0]=1;
    bNum[0]=0;
    rep1(i,50) allNum[i] = allNum[i-1]*2+3;
    rep1(i,50) pNum[i] = pNum[i-1]*2 + 1;
    rep1(i,50) bNum[i] = bNum[i-1]*2 + 2;
    
    ll ans = dfs(N,X);
    cout1(ans)
}

Measured memory_bytes: 256
using System;
using System.Linq;
class Program
{
 
  static void Main(string[] args)
  {
    var input = Console.ReadLine().Split(' ').Select(v => ulong.Parse(v));
    ulong h = input.First();
    ulong w = input.Last();
    if (h == 1 || w == 1)
    {
      Console.WriteLine(1);
      return;
    }
    
    ulong n = h * w;
    
    
    if (n % 2 == 0)
      Console.WriteLine(n / 2);
    else
      Console.WriteLine(n / 2 + 1);
  }
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double EPS = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int N, M;

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	while (cin >> N, N) {
		int table[21][21];
		rep(i, 21) rep(j, 21) table[i][j] = 0;
		int py = 10, px = 10;
		rep(i, N) {
			int x, y;
			cin >> x >> y;
			table[20 - y][x] = 1;
		}
		cin >> M;
		int cnt = 0;
		rep(i, M) {
			char d; int l;
			cin >> d >> l;
			switch (d) {
			case 'N':
				rep(i, l) {
					py--;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			case 'S':
				rep(i, l) {
					py++;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			case 'E':
				rep(i, l) {
					px++;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			case 'W':
				rep(i, l) {
					px--;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			}
		}
		if (cnt == N) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;

vector<pair<int,int>> ps;
vector<int> xs[MAX_N];
vector<int> ys[MAX_N];
bool vis[MAX_N];

void dfs(int pos, vector<int>&hist) {
  if (vis[pos]) return;
  vis[pos] = true;
  hist.push_back(pos);
  for (int nxt : xs[ps[pos].first]) dfs(nxt, hist);
  for (int nxt : ys[ps[pos].second]) dfs(nxt, hist);
}

int main2() {

  ps.clear();
  REP(i, MAX_N) xs[i].clear();
  REP(i, MAX_N) ys[i].clear();
  CLR(vis, 0);


  int N = nextInt();
  REP(i, N) {
    int x = nextInt();
    int y = nextInt();
    ps.push_back({x, y});
    xs[x].push_back(i);
    ys[y].push_back(i);
  }

  ll ans = 0;
  REP(i, N) {
    vector<int> v;
    dfs(i, v);
    if (v.size() >= 3) {
      set<int> ix, iy;
      for (int pos : v) {
        ix.insert(ps[pos].first);
        iy.insert(ps[pos].second);
      }
      ans += (ll)ix.size() * (ll)iy.size() - v.size();
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

int main() {
	int n;
	cin>>n;
	int arrA[n],arrB[n],arrC[n];
	int dpA[n],dpB[n],dpC[n];
	for(int i=0;i<n;i++){
	    cin>>arrA[i]>>arrB[i]>>arrC[i];
	}
	dpA[0]=arrA[0];
	dpB[0]=arrB[0];
	dpC[0]=arrC[0];
	for(int i=1;i<n;i++){
	   dpA[i] = max(dpB[i-1],dpC[i-1])+arrA[i];
	   dpB[i] = max(dpA[i-1],dpC[i-1])+arrB[i];
	   dpC[i] = max(dpA[i-1],dpB[i-1])+arrC[i];

	}
	cout<<max(dpA[n-1],max(dpB[n-1],dpC[n-1]));
	return 0;
}

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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

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

    vector< vector<int> > A(N, vector<int>(N-1));
    REP(i, N) {
        REP(j, N-1) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }

    int ans = 0;
    vector< int > check(N, 0);
    vector< int > yes;
    REP(i, N) {
        yes.pb(i);
    }
    int games = 0;

    while(games < N * (N-1) / 2) {
        bool flag = false;
        ans++;
        vector<int> today(N, 0);
        vector<int> _yes;
        // cout << "day = " << ans << endl;

        for(int i: yes) {
            if (today[i] == 1) continue;
            if (check[i] == N-1) continue;

            int next = A[i][check[i]];
            // cout << "check[i] = " << check[i] << endl;
            // cout << "next = " << next << endl;
            if (today[next] == 1) continue;

            // cout << "next = " << next << ", check[next] = " << check[next] << endl;
            if (A[next][check[next]] == i) {
                games++;
                check[i]++;
                check[next]++;
                today[i] = 1;
                today[next] = 1;
                _yes.pb(i);
                _yes.pb(next);
                flag = true;
            }
        }

        yes = _yes;

        if (flag == false) {
            ans = -1;
            break;
        }
    }


    cout << ans << endl;

    return 0;
}

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

int main() {
  int N,K;
  string S;
  cin >> N >> K >> S;
  K--;
  string T = S;
  
  for (int i=0; i<N; i++) {
    T[i] = S[N-1-i];
  }
  S += T;
  
  string ans = T;
  string term = T;
  char c;
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      term[j] = S[j+i];
    }
    ans = min(ans,term);
  }
  c = ans[0];
  int num = 1;
  for (int i=1; i<N; i++) {
    if (ans[i] == c) {
      num++;
    }
    else {
      break;
    }
  }
  int fn = num;
  for (int i=0; i<K; i++) {
    num *= 2;
    if (num >= N*2) {
      for (int j=0; j<N; j++) {
        cout << c;
      }
      cout << endl;
      return 0;
    }
  }
  num -= fn;
  for (int i=0; i<N; i++) {
    if (i<num) {
      cout << c;
    }
    else {
      cout << ans[i-num];
    }
  }
  cout << endl;
  return 0;
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int k, s;
  cin >> k >> s;
  int ans = 0;
  rep(x, k+1) rep(y, k+1) {
    int z = s - x - y;
    if(0 <= z && z <= k) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var d string
	fmt.Scan(&d)

	switch d {
	case "25":
		fmt.Println("Christmas")
	case "24":
		fmt.Println("Christmas Eve")
	case "23":
		fmt.Println("Christmas Eve Eve")
	case "22":
		fmt.Println("Christmas Eve Eve Eve")
	}
}


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

int main(){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;

    int a=x2-x1;
    int b=y2-y1;

    cout<<x2-b<<" "<<y2+a<<" "<<x2-a-b<<" "<<y2+a-b<<"\n";
    return 0;
}

Measured memory_bytes: 3572
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let mut s: Vec<char> = itr.next().unwrap().chars().collect();
    if s[1] == 'B' {
        s[1] = 'R'
    } else {
        s[1] = 'B'
    }
    let s: String = s.iter().collect();
    println!("{}", s);
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define b push_back
#define mem(x,y) memset(x,y,sizeof(x))

int cont[104];

int main()
{
    int i,j,k,s,d,r,m,n,test,tc;
    cin>>n>>m;
    for(i=1; i<=m; i++)
    {
        cin>>r;
        for(j=1; j<=r; j++) cin>>d, cont[d]++;
    }

    s=0;
    for(i=1; i<=n; i++) if(!cont[i]) s++;
        //cout<<cont[i]<<endl;
    cout<<s<<endl;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> vec(M);
    for (int i = 0; i < M; ++i) {
        cin >> vec[i].first >> vec[i].second;
    }

    map<int, vector<int>> root_map;
    for (int i = 0; i < M; i++) {
        root_map[vec[i].first].push_back(vec[i].second);
        root_map[vec[i].second].push_back(vec[i].first);
    }

    queue<int> BFS_room;
    vector<int> room_mark(N + 1);
    BFS_room.push(1);
    while (!BFS_room.empty()) {
        int target_room = BFS_room.front();
        BFS_room.pop();

        for (int i = 0; i < root_map[target_room].size(); ++i) {
            if (room_mark[root_map[target_room][i]] == 0) {
                BFS_room.push(root_map[target_room][i]);
                room_mark[root_map[target_room][i]] = target_room;
            }
        }
    }

    cout << "Yes" << endl;
    for (int i = 2; i < N + 1; ++i) {
        cout << room_mark[i] << endl;
    }
}

Measured memory_bytes: 17312
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
int main() 
{
    int t;
    cin>>t;
    if(t%2==0)
    cout<<(t/2);
    else
    cout<<((t/2)+1);
}

        

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int N,M;
  	cin>>N>>M;
  	int count[N]={0}; //都市から伸びている道路の数
  	
  	rep(i,M){
     	 int a,b;
      	 cin>>a>>b;
      	 a--; b--;
      	 count[a]++;
      	 count[b]++;
    }
  
  	rep(i,N) cout<<count[i]<<endl;
  
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n >> a;  
    if(a >= 500){
    cout << "Yes" << endl;
  }
	else if(n % 500 <= a){
    cout << "Yes" << endl;
  }
   else{
    cout << "No" << endl;
  }  
}


Measured memory_bytes: 256
n = gets.to_i
ans = 10000000

for i in 0..n/9
    ret = 0
    m = 9*i
    7.downto(1) do |j|
        ret += m/(9**j)
        m %= 9**j
    end
    l = n-9*i
    7.downto(0) do |j|
        ret += l/(6**j)
        l %= 6**j
    end
    ans = [ans,ret].min
end
puts ans

Measured memory_bytes: 1788
//#include<bits/stdc++.h>
#include<iostream>
//#include<vector>
//#include<map>
//#include <iomanip>
//#include<cstring>
//#include<string>
//#include<cmath>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
#define eps 1e-9
#define endl "\n"
#define PI acos(-1)
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define rep(j,n) for(int j=0;j<n;j++)
using namespace std;
/*
ll mod=1e9+7;
bool f(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.first<b.first);
}
bool f2(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
} */

int main()
{
    fast;
    string s;
    cin>>s;
    int r=0;
    int maxi=0;
    int res=0;
    for(int i=0; i<s.length(); i++)
    {
        int ct=0;
        if(s[i]=='R')
        {

            for(int j=i; j<s.length(); j++)
            {
                if(s[j]!='R')
                {
                    break;
                }
                ct++;
            }
            maxi=max(maxi,ct);
        }
    }
    cout<<maxi<<endl;


    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N, A, B;
    cin >> N >> A >> B;
    cout << min(A, B) << " " << max(0ll, A + B - N) << endl;
}

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

int main(){
    string S;
    cin >> S;
    int d;
    string day[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    rep(i,0,7){
        if (day[i] == S){
            cout << 7 - i << endl;
        }
    }
}

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void solve(long long N, long long M, std::vector<long long> X) {
  sort(X.begin(), X.end());
  vector<ll> Y;
  for(int i = 0 ; i + 1 < X.size() ; i++) Y.push_back(X[i+1] - X[i]);
  sort(Y.rbegin(), Y.rend());
  ll sum = 0;
  for(int i = 0 ; i < N - 1 && i < Y.size() ; i++){
    sum += Y[i];
  }
  cout << X.back() - X.front() - sum << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  std::vector<long long> X(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &X[i]);
  }
  solve(N, M, std::move(X));
  return 0;
}



Measured memory_bytes: 2168
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[] a = new int[3];
		
		a[0] = s.nextInt();
		a[1] = s.nextInt();
		a[2] = s.nextInt();
		
		ArrayList<Integer> list = new ArrayList();
		boolean flg = true;
		
		for(int i=0; i<a.length; i++){
			flg = true;
			for(int j=0; j<list.size(); j++){
				if(list.get(j) == a[i] ){
					flg = false;
				}
			}
			if(flg){
				list.add(a[i]);	
			}
			
		}
		System.out.println(list.size());
	}	
}

Measured memory_bytes: 9684
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<bool>jud(n, false);
  for (int i=0; i<k; i++){
    int d;
    cin >> d;
    for(int j=0; j<d; j++){
      int a;
      cin >> a;
      a--;
      jud[a] = true;
    }
  }
  int ans=0;
  for (int i=0; i<n; i++){
    if (jud[i]==false) ans++;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3592
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a < c && c < b || b < c && c < a)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
#define PI acos(-1.0)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

int main()
{
 
    int n, x, i, c=0;
    cin>>n;
    while(n--){
    	cin>>x;
    	if(x%2==0){
    		while(x%2==0){
    			c++;
    			x/=2;
    		}
    	}
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        // 入力を受け取る
        var input = Console.ReadLine().Split(' ').ToArray();

        // スタックを宣言
        var stack = new Stack<int>();

        // 入力の個数
        var inputSize = input.Count();

        // 頭から順番にinput配列を処理する
        for (var i = 0; i < inputSize; i++)
        {
            // 演算子かどうか判定する
            // 演算子なら計算してstackにpushする
            if (input[i].IsOperator())
            {
                // 2回popして
                var num = GetCalculatedNum(stack, input[i]);
                stack.Push(num);
            }
            else // 演算子じゃないならそのままstackにpushする
            {
                stack.Push(int.Parse(input[i]));
            }
        }

        Console.WriteLine(stack.Pop());
    }

    public static int GetCalculatedNum(Stack<int> stack, string operatorString)
    {
        if(operatorString == "+")
        {
            var b = stack.Pop();
            var a = stack.Pop();
            var num = a + b;
            return num;
        }
        else if(operatorString == "-")
        {
            var b = stack.Pop();
            var a = stack.Pop();
            var num = a - b;
            return num;
        }
        else if(operatorString == "*")
        {
            var b = stack.Pop();
            var a = stack.Pop();
            var num = a * b;
            return num;
        }
        else
        {
            var b = stack.Pop();
            var a = stack.Pop();
            var num = a / b;
            return num;
        }
    }
}


static class Extension
{
    public static bool IsOperator(this string s)
    {
        if(s == "+" || s == "-" || s == "*" || s == "/")
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}




Measured memory_bytes: 16712
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


void k_swap(vector<int>& v,int k){
    int n=v.size();
    for(int i=k;i<n;++i)swap(v[i],v[i-k]);
    //rep(i,n)cout<<v[i]<<" ";
    //cout<<endl;
}

bool sorted(vector<int>& v){
    int n=v.size();
    rep(i,n-1)if((v[i+1]-v[i]+n)%n!=1)return false;
    return true;
}
int main(){
    vector<int> ans;
    int n;
    cin>>n;
    vector<int> p(n);
    rep(i,n)cin>>p[i];
    int k=0;
    while(!sorted(p)){
        if(p[0]!=0&&p[n-1]!=0&&p[n-1]>p[0]){
            k_swap(p,n-1);
            ans.push_back(n-1);
        }
        k_swap(p,1);
        ans.push_back(1);
    }
    while(p[0]!=0){
        k_swap(p,1);
        ans.push_back(1);
    }
    cout<<ans.size()<<endl;
    for(auto e : ans)cout<<e<<endl;
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int64_t N, K;
    cin >> N >> K;
    vector<int64_t> mod(K);
    for(int a=1; a<=N; a++) {
        mod.at(a%K) ++;
    }
    int64_t ans = 0;
    for(int a=1; a<=N; a++) {
        int64_t inv = (K - a%K) % K;
        if((2*inv) % K == 0) {
            ans += mod.at(inv) * mod.at(inv);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
using System.Collections.Generic;
using System.Linq;
using static System.Math;
using System;

public class P
{
    public int mdown { get; set; }
    public int Last { get; set; }
    public int mdown2 { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var ps0 = new List<P>();
        var ps1 = new List<P>();
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            var t = getP(s);
            if (t.Last > 0) ps0.Add(t);
            else ps1.Add(t);
        }
        var c = check(ps0,ps1);
        Console.WriteLine(c? "Yes":"No");
    }
    static bool check (List<P> ps2, List<P> ps3)
    {
        var ps = ps2.OrderByDescending(x => x.mdown).ToList();
        var ps1 = ps3.OrderBy(x => x.mdown2).ToList();
        ps.AddRange(ps1);
        var psc = ps.Count();
        var L = 0;
        var mdown = 0;
        for (int i = 0; i < psc; i++)
        {
            mdown = L + ps[i].mdown;
            if (mdown < 0) return false;
            L += ps[i].Last;
        }
        return L == 0;
    }
    static P getP (string s)
    {
        var sL = s.Length;
        var mmin = 0;
        var w = 0;
        for (int i = 0; i < sL; i++)
        {
            if (s[i] == '(') { w++; }
            else { w--; mmin = Min(mmin, w); }
        }
        if (w > 0) return new P { mdown = mmin, Last = w };
        else
        {
            var tt = getMdown(s);
            return new P { mdown = mmin, Last = w ,mdown2  = tt};
        }
    }
    static int getMdown (string s)
    {
        var s2 = s.ToCharArray();
        var sL = s2.Length;
        for (int i = 0; i < sL; i++)
        {
            if (s2[i] == '(') s2[i] = ')';
            else s2[i] = '(';
        }
        Array.Reverse(s2);
        var s3 = new string(s2);
        var mmin = 0;
        var w = 0;
        for (int i = 0; i < sL; i++)
        {
            if (s3[i] == '(') { w++; }
            else { w--; mmin = Min(mmin, w); }
        }
        return mmin;
    }
}



Measured memory_bytes: 113532
#include<bits/stdc++.h>
using namespace std;
int N;
int main(){
  cin >> N;
  int gc = 0, kc = 0;
  for(int i=0;i<N;i++){
    int a; cin >> a;
    if( a&1 ) kc++;
    else gc++;
  }
  if( kc & 1 ) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;    
  }
           
}


Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================

int a = 0, b = 0, c, d, n, k = 0, ans = 0;
string s, t;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int>a(n);
	int sum = 0;
	rep(i, n) { cin >> a[i]; sum += a[i]; }
	double flag = sum / (double)4 / m;
	rep(i, n)
	{
		if (a[i] >= flag)
			ans++;
	}
	Cout(Yes(ans >= m));

	return 0;
}


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

using namespace std;

int main() {
   
   int A, B;
   cin >> A >> B;
  
   if (A <=8 && B <= 8) cout << "Yay!" << endl;
   else cout << ":(" << endl;
   return 0;
}


Measured memory_bytes: 256
from operator import itemgetter

N = int(input())

splist = [[0, 0, 0]]*N

for i in range(N):
    s, p = input().split()
    splist[i] = [s, int(p), i+1]

s1splist = sorted(splist, key=itemgetter(1), reverse=True)
s2splist = sorted(s1splist, key=itemgetter(0))

for s in s2splist:
    print(s[2])


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;
    int cnt = 0;
    cin >> N;
    REPP(i,1,N+1){
        if(i % 2 == 1) cnt++;
    }
    double ans = (double)cnt / (double)N;
    Dcout(ans);
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N,M=map(int,input().split())

edge=[[] for _ in range(N)]
for i in range(N-1):
    edge[i+1].append((0,i))
for _ in range(M):
    l,r,c=map(int,input().split())
    l-=1
    r-=1
    edge[l].append((c,r))

from heapq import heappop,heappush
# edges=[[(cost1,v1),(cost2,v2)],...]
def dijkstra(start,n,edges):
    d=[INF]*n
    used=[False]*n
    d[start]=0
    used[start]=True
    edgelist=[]
    for edge in edges[start]:
        heappush(edgelist,edge)
    while edgelist:
        minedge=heappop(edgelist)
        if used[minedge[1]]:
            continue
        v=minedge[1]
        d[v]=minedge[0]
        used[v]=True
        for edge in edges[v]:
            if not used[edge[1]]:
                heappush(edgelist,(edge[0]+d[v],edge[1]))
    return d

d=dijkstra(0,N,edge)
print(d[-1] if d[-1]!=INF else -1)

Measured memory_bytes: 72864
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define FORD(i,a,b) for(int i = (a); i >= (b); i--)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define M_PI 3.14159265358979323846
template<class C> void mini(C& _a4, C _b4) { _a4 = min(_a4, _b4); }
template<class C> void maxi(C& _a4, C _b4) { _a4 = max(_a4, _b4); }

template<class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
	while (*sdbg != ',')cerr << *sdbg++; cerr << '=' << h << ','; _dbg(sdbg + 1, a...);
}

template<class T> ostream& operator<<(ostream& os, vector<T> V) {
	os << "["; for (auto& vv : V) os << vv << ","; os << "]";
	return os;
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
	return os << "(" << P.st << "," << P.nd << ")";
}


#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#endif

int CeilIndex(std::vector<int> &v, int l, int r, int key) {
	while (r - l > 1) {
		int m = l + (r - l) / 2;
		if (v[m] >= key)
			r = m;
		else
			l = m;
	}

	return r;
}

int LongestIncreasingSubsequenceLength(std::vector<int> &v) {
	if (v.size() == 0)
		return 0;

	std::vector<int> tail(v.size(), 0);
	int length = 1; // always points empty slot in tail

	tail[0] = v[0];
	for (size_t i = 1; i < v.size(); i++) {
		if (v[i] < tail[0])
			// new smallest value
			tail[0] = v[i];
		else if (v[i] > tail[length - 1])
			// v[i] extends largest subsequence
			tail[length++] = v[i];
		else
			// v[i] will become end candidate of an existing subsequence or
			// Throw away larger elements in all LIS, to make room for upcoming grater elements than v[i]
			// (and also, v[i] would have already appeared in one of LIS, identify the location and replace it)
			tail[CeilIndex(tail, -1, length - 1, v[i])] = v[i];
	}

	return length;
}

int32_t main(int32_t argc, char ** argv) {
	ios_base::sync_with_stdio(0);
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	bool swap1 = x1 > x2;
	bool swap2 = y1 > y2;
	if (swap1) {
		x1 = 1e8 - x1;
		x2 = 1e8 - x2;
	}
	if (swap2) {
		y1 = 1e8 - y1;
		y2 = 1e8 - y2;
	}
	int n;
	cin >> n;
	set<PII> s;
	REP(i, n) {
		int t1, t2;
		cin >> t1 >> t2;
		if (swap1) {
			t1 = 1e8 - t1;
		}
		if (swap2) {
			t2 = 1e8 - t2;
		}
		if (t1 >= x1 && t1 <= x2 && t2 >= y1 && t2 <= y2) {
			s.insert({ t1, t2 });
		}
	}
	LD askrot = M_PI * 10LL - 20LL;
	LD skrot = M_PI * 5LL - 20LL;
	LD total = (x2 - x1 + y2 - y1) * 100LL;
	vector<int> v;
	for (PII p : s) {
		v.push_back(p.second);
	}
	cout << fixed << setprecision(15);
	int k = LongestIncreasingSubsequenceLength(v);
	total += (k == min(x2 - x1 + 1, y2 - y1 + 1))?(k - 1) * skrot + askrot:k * skrot;
	cout << total;
}

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

int main() {
    int n;
    cin >> n;

    vector<int> v(n+1);
    for (int i = 1; i <= n; ++i) {
        cin >> v[i];
    }


    vector<int> ans(n+1);

    for (int i = n; i >= 1; --i) {
        int sum = 0;
        for (int j = i; j <= n; j+=i) {
            sum += ans[j];
        }
        if(sum%2 != v[i]) ans[i]++;
    }

    int m = 0;
    for (int i = 1; i <= n; ++i) {
        m += ans[i];
    }
    cout << m << endl;

    for (int i = 1; i <= n; ++i) {
        if(ans[i] == 1) cout << i << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	int n,m;
	int[] count;
	void solve(){
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		m=sc.nextInt();
		count=new int[n+1];
		for(int i=0;i<m;i++){
			int a=sc.nextInt();
			int b=sc.nextInt();
			count[a]++;
			count[b]++;
		}
		for(int i=1;i<=n;i++){
			if(count[i]%2!=0){
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}


Measured memory_bytes: 65472
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem{

    void Solve() {
        string s; cin >> s;
        string t; cin >> t;
        t.pop_back();
        cout << (s == t ? "Yes" : "No") << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    p->Solve();
    return 0;
}


Measured memory_bytes: 3632
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::cmp::{max, min};
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }
    let mut m = HashMap::new();
    for i in 0..n {
        if m.contains_key(&a[i]) {
            if let Some(x) = m.get_mut(&a[i]) {
                *x+=1;
            }
        } else {
            m.insert(a[i], 1);
        }
    }
    let types = m.len();
    let mut v = m.into_iter().map(|c| c.1).collect::<Vec<_>>();
    v.sort();
    v.reverse();
    let mut sum =0;
    if types <= k {
        println!("0");
        return;
    }
    for _ in 0..types-k {
        if let Some(x) = v.pop() {
            sum += x;
        }
    }
    println!("{}", sum);
}

Measured memory_bytes: 20632
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
#print(P,Q)
l = [i for i in range(1,N+1)]
count = 1
count_p = 0
count_q = 0

for v in itertools.permutations(l):
    #print(v)
    if v == P:
        count_p = count
    if v == Q:
        count_q = count

    if (count_p != 0) & (count_q != 0):
        ans = abs(count_p - count_q)
        break
    else:
        count += 1

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int n,m;
LL mod=1000000007;
vector<LL> x;
vector<LL> y;
int main(){
	cin>>n>>m;
	REP(i,n){
	    LL a;
	    cin>>a;
	    x.push_back(a);
	}
	REP(i,m){
	    LL a;
	    cin>>a;
	    y.push_back(a);
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	LL yoko_sum=0;
	LL yoko=0;
	REP(i,n){
	    yoko+=x[i]-x[0];
	    yoko=yoko%mod;
	}
	REP(i,n-1){
	    //cout<<"bbb"<<yoko<<endl;
	    yoko_sum=(yoko_sum+yoko)%mod;
	    yoko=(yoko-(n-i-1)*(x[i+1]-x[i])+mod*10000000)%mod;
	}
        //cout<<"aa"<<yoko_sum<<endl;
	LL tate_sum=0;
	LL tate=0;
	REP(i,m){
	    tate+=y[i]-y[0];
	    tate=tate%mod;
	}
	REP(i,m){
		    //cout<<"bbb"<<tate<<endl;
	    tate_sum=(tate_sum+tate)%mod;
	    tate=(tate-(m-i-1)*(y[i+1]-y[i])+mod*10000000)%mod;
	}
	        //cout<<"aa"<<tate_sum<<endl;

        cout<<(tate_sum*yoko_sum)%mod<<endl;
	return(0);
}

Measured memory_bytes: 2548
N, K = map(int, input().split())
import math
mod =10**9+7

l = []
l.append(N-K+1)
for i in range(1, K):
  a = l[i-1] * (N-K-i+1) * (K-i) // ((i+1)*i)
  l.append(int(a))

for j in l:
  print(j%mod)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}

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

    ll k;
    cin>>k;
    ll low = -1, up = 1e18,mid;
    while(up-low>1){
        mid = (up+low)/2;
        string s;
        ll t = mid;
        while(t){
            s += '0'+(t%10);
            t /= 10;
        }
        reverse(s.begin(),s.end());
        int n = s.size();
        ll cnt = 0;
        ll dp[n+1][10][2]={};
        dp[1][s[0]-'0'][0]=1;
        for(int i=1;i<s[0]-'0';i++) dp[1][i][1]=1;
        for(int i=1;i<n;i++){
            if(abs(s[i]-s[i-1]) <= 1) dp[i+1][s[i]-'0'][0] += dp[i][s[i-1]-'0'][0];
            else dp[i+1][s[i]-'0'][0] = 0;
            if(s[i-1] <= s[i]){
                if(s[i-1]+1 < s[i]) dp[i+1][s[i-1]-'0' + 1][1] += dp[i][s[i-1]-'0'][0];
                if(s[i-1] < s[i]) dp[i+1][s[i-1]-'0'][1] += dp[i][s[i-1]-'0'][0];
                if(s[i-1]-1 >= '0') dp[i+1][s[i-1]-'0'-1][1] += dp[i][s[i-1]-'0'][0];
            }
            for(int j=0;j<10;j++){
                if(j) dp[i+1][j][1] += 1;
                if(j) dp[i+1][j][1] += dp[i][j-1][1];
                if(j!=9) dp[i+1][j][1] += dp[i][j+1][1];
                dp[i+1][j][1] += dp[i][j][1];    
                //cerr << j << " " << dp[i+1][j][1] << endl;
            }
        }
        for(int i=0;i<10;i++){
            cnt += dp[n][i][1] + dp[n][i][0];
        }
        //cerr << "last " << mid << " "<< cnt << endl;
        if(cnt >= k) up = mid;
        else low = mid;
    }
    cout << low+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    string s;
    cin >> s;
    ll a=0,bc=0,nowa=0;
    ll cnt=0;
    bool renzoku=false;
    ll i=0;
    while(i<s.size()){
        while(s[i]=='A'){
            i++;
            nowa++;
        }
        while(s[i]=='B' && s[i+1]=='C'){
            i+=2;
            bc++;
        }
        a+=nowa;
        cnt+=a*bc;
        if(bc==0 && s[i+1]=='A'){
            a=0;
            i++;
        }
      	else if(bc==0&&s[i+1]!='A') {
          a=0;
          i+=2;
        }
        bc=0;
        nowa=0;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

#define STACK_MAX 100
#define LINE_MAX 80 + 1

int main(void)
{
	double stack[STACK_MAX], now_p, tmp, *p = stack;
	char in[LINE_MAX];
	while ((scanf("%s", in)) != EOF) {
		switch (in[0]) {
		case '+':
			tmp = *--p;
			tmp += *--p;
			break;
		case '-':
			if (in[1] == '\0') {
				tmp = -(*--p);
				tmp += *--p;
			} else {
				tmp = atol(in);
			}
			break;
		case '*':
			tmp = *--p;
			tmp *= *--p;
			break;
		case '/':
			tmp = 1 / *--p;
			tmp *= *--p;
			break;
		default:
			tmp = atol(in);
		}
		*p++ = tmp;
		if (getchar() == '\n')
			printf("%f\n", *--p);
	}
	return 0;
}

Measured memory_bytes: 596
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

	A := make([]int, n)
	B := make([]int, n)
	C := make([]int, n)
	for i := range A {
		fmt.Fscan(read, &A[i])
		b, c := 0, 0
		for j := 0; j < A[i]; j++ {
			var x, y uint
			fmt.Fscan(read, &x, &y)
			if y == 1 {
				b |= 1 << (x - 1)
			} else {
				c |= 1 << (x - 1)
			}
		}
		B[i] = b
		C[i] = c
	}

	ans := 0
	for mask := 0; mask < (1 << uint(n)); mask++ {
		chk := true
		for i := 0; i < n; i++ {
			if (mask>>uint(i))&1 == 0 {
				continue
			}
			if mask&B[i] != B[i] || mask&C[i] != 0 {
				chk = false
			}
		}
		if chk {
			cnt := 0
			tmp := mask
			for tmp > 0 {
				if tmp&1 == 1 {
					cnt++
				}
				tmp = tmp >> 1
			}
			if cnt > ans {
				ans = cnt
			}
		}
	}
	fmt.Fprintln(write, ans)
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<queue>
#include<utility>

#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;


int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> jobs(m);
    rep(i,n){
        int a, b;
        cin >> a >> b;
        if(a>m) continue;
        jobs[m-a].push_back(b);
    }
    priority_queue<int> q;
    ll ans=0;
    for(int i = m-1; i>=0; i--){
        for(int b: jobs[i]){
            q.push(b);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5632
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

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

int main() {
    int h, w;
    while ( cin >> h >> w && h && w ) {
        VS lines;
        string line;
        for ( int i = 0; i < h; ++ i ) {
            cin >> line;
            lines.push_back( line );
        }
        VS M = lines;

        VVI W( h, VI( w, 0 ) );
        VVI H( h, VI( w, 0 ) );
        for ( int i = 0; i < h; ++ i ) {
            int t = 0;
            for ( int j = w - 1; j >= 0; -- j ) {
                if ( M[i][j] == '*' ) {
                    t = 0;
                } else {
                    t ++;
                    W[i][j] = t;
                }
            }
        }

        int answer = 0;
        for ( int i = 0; i < h; ++ i ) {
            for ( int j = 0; j < w; ++ j ) {
                if ( M[i][j] == '*' ) continue;
                int width = W[i][j];
                for ( int k = 0; i + k < h; ++ k ) {
                    width = min( width, W[i + k][j] );
                    answer = max( answer, ( k + 1 ) * width );
                }
            }
        }
        cout << answer << endl;
    }
    return 0;
}

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

const int N = 1e6 + 5;

#define st first
#define nd second

typedef pair<int,int> pun;
typedef long long ll;
char slo[100];
int main() {
	scanf("%s", slo);
	bool ans = false;
	if (strlen(slo) >= 4 && slo[0] == 'Y' && slo[1] == 'A' && slo[2] == 'K' && slo[3] == 'I') ans = true;
	printf("%s\n", ans? "Yes":"No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0)cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
}

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

int main() {
    int n;
    cin >> n;
    if(n<1200) {
        cout << "ABC" <<endl;
        return 0;
    }
    else if(n<2800){
        cout << "ARC" <<endl;
        return 0;
    }
    else cout << "AGC" <<endl;
}


Measured memory_bytes: 256