akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <string>
#include <list>
using namespace std;

struct Mizutamari
{
    int kudatta;
    int menseki;
};
int main()
{
    int total = 0;
    stack<int> kudari;
    stack<Mizutamari> mizutamari;

    string input;
    cin >> input;
    for (int i = 0; i < input.size(); i++)
    {
        char c = input[i];
        // 平地は特にすることが無い
        if (c == '_')
            continue;

        // 下りならその位置を記録する
        if (c == '\\')
        {
            kudari.push(i);
            continue;
        }

        // 平地でも下りでも無いので上り
        // 上りでも、対応するくだりがなければ何もしない
        if (kudari.empty())
            continue;

        // 下った位置と上った位置の差が面積
        int kudatta = kudari.top();
        kudari.pop();
        int menseki = i - kudatta;

        total += menseki;

        while (mizutamari.empty() == false && kudatta < mizutamari.top().kudatta)
        {
            // 水たまりが下にある、ので合成する
            Mizutamari m = mizutamari.top();
            mizutamari.pop();
            menseki += m.menseki;
        }
        mizutamari.push({kudatta, menseki});
    }
    list<int> reverse;
    while (mizutamari.empty() == false)
    {
        reverse.push_back(mizutamari.top().menseki);
        mizutamari.pop();
    }
    cout << total << endl;
    cout << reverse.size();
    for (auto it = reverse.rbegin(); it != reverse.rend(); it++)
    {
        cout << " " << *it;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	string str, longest, s, most;
	int m=0, count=0;
	vector<string> vs;
	vector<int>vi;
	getline(cin, str);
	for(int i=0; i<str.length(); i++){
		if(str[i]!=' ' && str[i]!='\n'){
			s+=str[i];
		}
		else{
			vs.push_back(s);
			if(s.length()>m){
				m=s.length();
				longest=s;
			}
			s="";
		}
	}
	if(s.length()>m){
		m=s.length();
		longest=s;
	}
	m=0;
	for(int i=0; i<vs.size()-1; i++){
		count=0;
		for(int j=i+1; j<vs.size(); j++){
			if(vs[i]==vs[j])
				count++;
		}
		if(count>m){
			m=count;
			most=vs[i];
		}
	}
	cout<<most<<" "<<longest<<endl;
	return 0;
}




Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int mex=2005;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 

int main()
{
  int n,m;
  cin>>n>>m;
  if(m==n) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////
struct UnionFind {
	vector<int>par;
	UnionFind(int n) :par(n) {
		for (int i = 0; i < n; ++i) {
			par[i] = i;
		}
	}

	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}

	void unit(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		par[rx] = ry;
	}

	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
int main() {
	int n, m; cin >> n >> m;
	vector<int>p(n);
	for (int i = 0; i < n; ++i)cin >> p[i];
    UnionFind tree(n);
	for (int i = 0; i < m; ++i) {
		int x, y; cin >> x >> y;
		tree.unit(p[x-1]-1,p[y-1]-1);
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if (tree.same(i, p[i] - 1)) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
N,M,X = [int(v) for v in input().split()]
abc = []

for _ in range(N):
    abc.append([int(v) for v in input().split()])


L = []
def dfs(index,c_L):
    if index == N:
        L.append(c_L)
        return
    dfs(index+1,c_L)
    n_L = c_L[:]
    n_L.append(abc[index])
    dfs(index+1,n_L)

dfs(0,[])

ans = float("inf")

for l in L:
    m = [0 for _ in range(M)]
    cost = 0
    for row in l:
        cost += row[0]
        for i,a in enumerate(row[1:]):
            m[i] += a

    flag = True
    for i in m:
        if i < X: flag = False
    if flag: ans = min(cost,ans)
if ans == float('inf'):
    print(-1)
else:
    print(ans)


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);
bool visited[200001];
vector<int> mp[200001];
vector<ll> color,query;
void dfs(int s)
{
    visited[s]=true;
    for (int i=0;i<mp[s].size();i++)
    {
        if (visited[mp[s][i]]==false)
        {
            query[mp[s][i]]+=query[s];
            dfs(mp[s][i]);
        }
    }
}
int main()
{
	IOS;
    cout.precision(30);
    ll n,m,k,a,b,c,x,y,p; int q;
    cin >> n >> q; query.resize(n+1,0); color.resize(n+1,0);
    memset(visited,false,sizeof visited);
    for (int i=0;i<n-1;i++)
    {
        cin >> a >> b;
        mp[a].pb(b);
        mp[b].pb(a);
    }
    for (int i=1;i<=q;i++)
    {
        cin >> p >> x;
        query[p]+=x;
    }
    dfs(1);
    for (int i=1;i<=n;i++) cout << query[i] << " ";
    return 0;
}


Measured memory_bytes: 25984
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int H,W,K;
  cin >> H >> W >> K;
  char field[H][W];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> field[i][j];
    }
  }
  int ans = 0;

  for (int bit = 0; bit < (1 << (H + W)); bit++) {
    int cnt = 0;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (field[i][j] == '#') {
          if ((1 << i) & bit || (1 << (j + H)) & bit) {
            
          } else {
            cnt++;
          }
        }
      }
    }
    if (cnt == K) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#include <sstream>
#include <complex>
#define BIT(nr) (1ULL << (nr))
#define int long long
#define ll long long
#define double complex<long double>
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	
#define LL_HALFMAX 9223372036854775807 / 2	
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#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--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

using namespace std;


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

	int ans = 0;
	REPS(i, N) {
		if (i % 2 == 0) continue;
		int cnt = 0;
		for (int j = 1; j*j < i; j++) {
			if (i % j == 0) {
				cnt++;
			}
		}
		if (cnt == 4) {
			ans++;
		}
	}

	cout << ans << "\n";
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll N,M,ans,count;
  vl L,R;
  vector<ll>rg(2);
  cin >> N>> M;
  REP(i,M){
		int x,y;
		cin >> x>> y;
		L.push_back(x);
    R.push_back(y);
	}
  count=0;
  rg[0] = L[0];
  rg[1] = R[0];
  REP(i,M-1){
    if (L[i+1]>rg[1] ||R[i+1]<rg[0]) {
      count = 1;
    };
    rg[0] = max(rg[0],L[i+1]);
    rg[1] = min(rg[1],R[i+1]);
  }
  if(count==1){
    cout << 0<< endl;
  }else{
    ans = rg[1]-rg[0]+1;
    cout << ans<< endl;
  } 
  return 0;
}

Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,B;
	scanf("%d%d",&A,&B);
	A *= B;
	for(int i = 1;i <= 3;i ++)
	{
		int num = A*i;
		if(num&1)
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	string a, b;
	cin >> a >> b;
	a += b;
	int va = atoi(a.c_str());
	rep (i, va) {
		if (i * i == va) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string.h>
#include <cassert>
#include <string.h>
#include <tuple>

using namespace std;
#define  rep(i,n) for(int i=0;i<n;i++)
#define  rrep(i,n) for(int i=n-1;i>=0;i--)///n-1番目からn回
#define  REP(i,a,b) for(int i=a;i<=b;i++) ///a番目からb回
#define  RREP(i,a,b) for(int i=a;i<b;i--)
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pair_t;
#define MOD 1000000007

//int arr[N]
////sort(arr,arr +N)

//vector <int> hoge
////sort(hoge.begin(),hoge.end());
///*min_element(hoge.begin(),hoge.end();　最小値　　　最大値はmax_element();
///(10-(n%10))%10  10-(1桁目)取得 12->8 20->0

#define Ru(n)  ( ((n)+9)/10*10  ) //切りあげ
#define Rd(n)  ( ((n)-10)/10*10 +10 )	切り捨て


int gcd(int a,int b);
size_t length(const std::string& str) {
	return str.length();
}
bool comp(const pair_t &a, const pair_t &b) {
	return a.first < b.first;
}

int main() {
	int n;
	vi h(100000);
	cin>>n;
	rep(i,n)
		cin>>h[i];

	int now=0,ans=-1,time=0;
	rep(st,n-1) {
		if (h[st] >= h[st + 1]) {
			time++;
		}
		else {
			if (time > ans)
				ans = time;
			time=0;
		}

	}
	if (time > ans)
		ans = time;
	cout<<ans;
	return 0;

}


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


Measured memory_bytes: 640
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#define llint long long

using namespace std;

struct edge{
	int to, id;
	edge(int a, int b){
		to = a, id = b;
	}
};

struct UnionFind{
	int size;
	vector<int> parent;
	
	UnionFind(){}
	UnionFind(int size){
		this->size = size;
		parent.resize(size+1);
		init();
	}
	void init(){
		for(int i = 0; i <= size; i++) parent[i] = i;
	}
	int root(int i){
		if(parent[i] == i) return i;
		return parent[i] = root(parent[i]);
	}
	bool same(int i, int j){
		return root(i) == root(j);
	}
	void unite(int i, int j){
		int root_i = root(i), root_j = root(j);
		if(root_i == root_j) return;
		parent[root_i] = root_j;
	}
};

int n, m;
vector<edge> G[405];
bool valid[405], used[405][405];
UnionFind uf(405);
map<int, llint> mp;

bool dfs(int v, int s, int c)
{
	used[s][v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i].id >= c) continue;
		if(used[s][G[v][i].to]) return false;
		if(!dfs(G[v][i].to, s, G[v][i].id)) return false;
	}
	return true;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	int u, v;
	for(int i = 1; i <= m; i++){
		cin >> u >> v;
		G[u].push_back(edge(v, i));
		G[v].push_back(edge(u, i));
	}
	
	for(int i = 1; i <= n; i++){
		if(valid[i] = dfs(i, i, m+1));
	}
	
	llint ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i >= j) continue;
			if(!valid[i] || !valid[j]) continue;
			bool flag = true;
			for(int k = 1; k <= n; k++){
				if(used[i][k] && used[j][k]){
					flag = false;
					break;
				}
			}
			if(flag) ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2816
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
#include <chrono>
#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

void hora(int tc) {
	int h1, m1, h2, m2;
	int k;
	cin>>h1>>m1>>h2>>m2;
	cin>>k;
	int t1 = h1 * 60 + m1;
	int t2 = h2 * 60 + m2;
	cout<<max(0, t2 - t1 - k)<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define sd size()
#define pi pair<ll,ll>
#define lb(a,b) lower_bound(all(a),b) - a.begin()
#define ub(a,b) upper_bound(all(a),b) - a.begin()
#define sp( a, b)   cout<<setprecision(b)<<a<<" ";
#define mod 1000000007
#define d2 vector<vector<ll>>
#define d1 vector<ll>
#define d1pi vector<pi>
#define d1b vector<bool>
#define p(x) cout<<x;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
const ll N = 2e5+100;
d1 g[N];
vector<bool> vis(N,0);
void un_add_edge(ll a,ll b)
{
        g[a].pb(b);
        g[b].pb(a);
}
void add_edge(ll a,ll b)
{
        g[a].pb(b);
      
}
ll lcm(ll a,ll b)
{
        return (a*b)/__gcd(a,b);
}
int main()
{
        fast;
        ll n,w; cin>>n>>w;
        
        d1 wt(n,0),val(n,0);
        
        ll dp[n+1][w+1]={0};
        for(ll i=0;i<n;i++)
        {
                cin>>wt[i]>>val[i];
        }
        
        for(ll i=0;i<=n;i++)
        {
                for(ll j=0;j<=w;j++)
                {
                        if(i==0 || j==0)
                            dp[i][j]=0;
                        else if( wt[i-1]<=j  )
                        {
                            dp[i][j] =  max(dp[i-1][j] ,val[i-1]+ dp[i-1][ j-wt[i-1]]);
                        }
                        else
                            dp[i][j] = dp[i-1][j];
                }
        }
        cout<<dp[n][w];
      
}



Measured memory_bytes: 83840
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function lineIn(){
		$buf = fgets(STDIN);
		return $this->killNewLine($buf);
	}
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$n = $this->lineIn();
		$s = $this->arrayIn();
		$ans = 0;
		
		for($i = 0; $i < ($n - 1); $i++){
			if ( $s[$i] == $s[($i + 1)] ){
				if(($i + 2) < $n){
					$s[($i + 1)] = $s[( $i + 2)] + 1;
				}
				$ans++;
			}
		}

		echo $ans . "\n";

	}
}
?>


Measured memory_bytes: 4728
n, m = map(int, input().split())
py = []
for i in range(m):
    a = list(map(int, input().split()))
    a.append(i)
    py.append(a)

py = sorted(py, key=lambda x:x[1])
py = sorted(py, key=lambda x:x[0])
#print(py)

ans = [[0] * 2 for i in range(m)]
cnt = 0
val = py[0][0]
for i in range(m):
    #print(val)
    if py[i][0] != val:
        cnt = 0
        val = py[i][0]
    cnt += 1

    ans[py[i][2]][0] = py[i][0]
    ans[py[i][2]][1] = cnt
#print(ans)
for i in range(m):
    print('0' * (6 - len(str(ans[i][0]))) + str(ans[i][0]) + '0' * (6 - len(str(ans[i][1]))) + str(ans[i][1]))


Measured memory_bytes: 42212
#include <bits/stdc++.h>
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;

signed main() {
	int n;
	cin >> n;
	int a[n];
	int sum = 1;
	vector <int> s;
	int pear = -1, berry = -1;
	rep (i, n) {
		cin >> a[i];
		if (abs(a[i]) == 2) {
			sum *= a[i];
			s.push_back(i + 1);
		}
		if (a[i] == -1 && pear == -1) pear = i + 1;
		if (a[i] == -2) berry = s.size() - 1;
	}
	if (sum == 1) {
		cout << 0 << endl;
	} else if (sum > 0 ) {
		cout << s.size() << endl;
		rep (i, s.size()) cout << s[i] << endl;
	} else if (pear != -1) {
		s.push_back(pear);
		sort(s.begin(), s.end());
		cout << s.size() << endl;
		rep (i, s.size()) cout << s[i] << endl;
	} else {
		cout << s.size() - 1 << endl;
		rep (i, s.size()) if (i != berry) cout << s[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3160
#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int guard=101;
    int count=0;
    int x,y,z;
    cin>>x;
    int X[x];
    for(int i=0;i<x;i++){
        cin>>X[i];
    }
    cin>>y;
    int Y[y];
        for(int i=0;i<y;i++){
        cin>>Y[i];
    }
    cin>>z;
    int Z[z];
        for(int i=0;i<z;i++){
        cin>>Z[i];
    }
    int W[N];
    int w=0;
    for(int i=0;i<x;i++){
        for(int j=0;j<z;j++){
            if(X[i]==Z[j]){
                W[w]=X[i];
                w++;
                Z[j]=guard;
            }
        }
    }
    for(int i=0;i<y;i++){
        for(int j=0;j<z;j++){
            if(Y[i]==Z[j]){
                count++;
                Z[j]=guard;
            }
        }
    }
    for(int i=0;i<y;i++){
        for(int j=0;j<w;j++){
            if(Y[i]==W[j]){
                count++;
            }
        }
    }
    for(int i=0;i<z;i++){
        if(Z[i]!=guard){
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3124
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

int main() {
  int n, m , q;
  cin >> n >> m >> q;
  
  int board[n + 1][n + 1];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      board[i][j] = 0;
    }
  }
  
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    board[l][r]++;
  }
  
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      board[i][j] += board[i][j - 1];
    }
  }
  
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      board[i][j] += board[i - 1][j];
    }
  }
  
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    cout << board[r][r] - board[r][l - 1] - board[l - 1][r] + board[l - 1][l - 1] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

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

    int ans = 1e9+1;
    char car = s[0];
    for(int i = 0; i < s.size(); i++) {
        if(car != s[i]) {
            int t = max(i, (int)s.size()-i);
            ans = min(ans, t);
            car = s[i];
        }
    }

    if(ans == 1e9+1) ans = s.size();

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
using System;

namespace Application
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			while(true) {
			   	var a=Console.ReadLine();
				if(a==null) break;
				var aa=a.Split();
				int sum=int.Parse (aa[0])+int.Parse(aa[1]);
				int ans=sum.ToString ().Length;
				Console.WriteLine ("{0}",ans);
			}
		}
	}
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

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

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

template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

	ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

	ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<998244353>;

int N;
int A[333333];

signed main(){
	cin>>N;
	string str;
	cin>>str;
	rep(i,str.size()){
		if(str[i]=='R')A[i]=0;
		else if(str[i]=='G')A[i]=1;
		else A[i]=2;
	}

	mint ans=1;

	int cnt[3]={};
	rep(i,3*N){
		int f=(A[i]+1)%3;
		int s=(A[i]+2)%3;

		if(cnt[f]<cnt[s])swap(f,s);
		if(cnt[f]&&cnt[s]){
			ans*=cnt[s];
			cnt[f]--;
			cnt[s]--;
			continue;
		}

		if(cnt[A[i]]>=cnt[f]){
			cnt[A[i]]++;
		}
		else {
			ans*=(cnt[f]-cnt[A[i]]);
			cnt[A[i]]++;
			continue;
		}
	}

	rep(i,N)ans*=i+1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3076
# -*- coding: utf-8 -*-
N=int(input())
a=list(map(int,input().split()))
seta=set(a)
lista=list(seta)
if len(a)==a.count(0):
    print("Yes")
elif len(set(a))>4:
    print("No")        
elif N%3!=0:
    print("No")
elif len(seta)==3:
    if a.count(lista[0])==a.count(lista[1])==a.count(lista[2]) and \
        lista[0]^lista[1]==lista[2]:
        print("Yes")
    else:
        print("No")
elif len(seta)==2:
    if a.count(lista[0])*2==a.count(lista[1]) and \
        lista[1]^lista[1]==lista[0]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	map<char,char> mp={{'A','T'},{'T','A'},{'C','G'},{'G','C'}};
	char ch; cin>>ch; cout<<mp[ch]<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
char s[MAXN];
int tree[26][MAXN];
void add(int x,int xx,int k){while(x<=n)tree[k][x]+=xx,x+=lb(x);}            //注意数组大小
int query(int x,int k){int sum=0;while(x>0)sum+=tree[k][x],x-=lb(x);return sum;}
int main(){
    cin>>n;
    cin>>s+1;

    REP(i,1,n){
        add(i,1,s[i]-'a');
    }

    cin>>m;
    REP(i,1,m){
        int a,b,c;
        char ch;
        sci(a),sci(b);
        if(a==1){
            cin>>ch;
            add(b,-1,s[b]-'a');
            add(b,1,ch-'a');
            s[b]=ch;
        }
        else {
            sci(c);
            int ans=0;
            REP(i,0,25){
                if(query(c,i)-query(b-1,i))ans++;
            }
            cout<<ans<<endl;
        }
    }
}

Measured memory_bytes: 102656
//C

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

int main(){
    int N; cin >> N;
    int a[10010];
    for(int i=0;i<N;i++) cin >> a[i];
    int ans = 0;
    for(int i=0; i<N; i++){
        while(a[i]%2==0) {a[i]=a[i]/2; ans++;}
    }

    cout << ans << endl;
}

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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define VSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

int main() {
    ll a,b,i,j;

    cin>>a>>b;
    i=1;
    j=0;
    while(i<b){
        i--;
        i+=a;
        j++;
    }

    cout<<j;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define call(x) (x).cbegin(), (x).cend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) {if (b<a) {a=b; return 1;} return 0;}
const int INF = INT_MAX;
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

vi a;
ll dp[3100][3100];

void solve(int N, vi &a){
    ll ans = 0;
    int turn = 0;
    memset(dp, 0, sizeof(dp));

    for (int len = 1; len <= N; len++){
        for (int i = 0; i+len <= N; i++){
            int j = i+len;
            if ((N-len)%2 == 0) {
                dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1]);
            }
            else {
                dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1]);
            }
        }
    }

    cout << dp[0][N] << endl;
}

int main(){
    int N;
    cin >> N;
    a.resize(N);
    for(int i = 0 ; i < N ; i++){
        cin >> a[i];
    }
    solve(N, a);
    return 0;
}

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

int main(){
  ll n,W;
  cin >> n >> W;
  ll w,v,w1;
  cin >> w1 >> v;
  vector<ll> a[4];
  a[0].push_back(v);
  for(int i=1;i<n;i++){
    cin >> w >> v;
    a[w-w1].push_back(v);
  }
  for(int i=0;i<4;i++){
    sort(a[i].begin(),a[i].end());
    reverse(a[i].begin(),a[i].end());
  }
  vector<ll>b[4];
  for(int i=0;i<4;i++)if(!a[i].empty())b[i].push_back(a[i][0]);
  for(int i=0;i<4;i++){
    for(int j=1;j<(int)a[i].size();j++){
      b[i].push_back(b[i][j-1]+a[i][j]);
    }
  }
  ll ret = 0;
  ll wsum = 0;
  ll vsum = 0;
  for(int i=-1;i<(int)a[0].size();i++){
    wsum=0;
    vsum=0;
    if(i!=-1){
      wsum=w1*(i+1);
      vsum=b[0][i];
    }
    if(wsum>W)break;
    for(int j=-1;j<(int)a[1].size();j++){
      ll wsum1 = wsum;
      ll vsum1 = vsum;
      if(j!=-1){
        wsum1+=(w1+1)*(j+1);
        vsum1+=b[1][j];
      }
      if(wsum1>W)break;
      for(int k=-1;k<(int)a[2].size();k++){
        ll wsum2 = wsum1;
        ll vsum2 = vsum1;
        if(k!=-1){
          wsum2+=(w1+2)*(k+1);
          vsum2+=b[2][k];
        }
        if(wsum2>W)break;
        for(int h=-1;h<(int)a[3].size();h++){
          ll wsum3 = wsum2;
          ll vsum3 = vsum2;
          if(h!=-1){
            wsum3+=(w1+3)*(h+1);
            vsum3+=b[3][h];
          }
          //cout << wsum3 << " " << vsum3 << endl;
          if(wsum3<=W)ret = max(ret,vsum3);
        }
      }
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 405;
const int MAXM = 805;
const int P = 998244353;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n, tot, num[MAXN][MAXN], ptwo[MAXN], a[MAXN];
int dp[MAXM][MAXN][MAXN][2], size[MAXM], binom[MAXN][MAXN];
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
int work(int l, int r, int h) {
	if (l > r) {
		dp[0][h][0][0] = 1;
		dp[0][h][0][1] = 1;
		return 0;
	}
	int &res = num[l][r];
	if (res == 0) res = ++tot;
	int Min = n, pos = l;
	for (int i = l; i <= r; i++)
		if (a[i] < Min) {
			Min = a[i];
			pos = i;
		}
	if (Min == h) {
		int x = work(l, pos - 1, h);
		int y = work(pos + 1, r, h);
		size[res] = size[x] + size[y] + 1;
		for (int i = 0; i <= size[x]; i++)
		for (int j = 0; j <= size[y]; j++) {
			update(dp[res][h][i + j + 0][0], 1ll * dp[x][h][i][0] * dp[y][h][j][0] % P);
			update(dp[res][h][i + j + 1][1], 1ll * dp[x][h][i][1] * dp[y][h][j][1] % P);
		}
	} else {
		work(l, r, h + 1);
		for (int i = 0; i <= size[res]; i++) {
			update(dp[res][h][i][0], dp[res][h + 1][i][1]);
			update(dp[res][h][i][1], dp[res][h + 1][i][1]);
			
			update(dp[res][h][i][0], 1ll * dp[res][h + 1][i][0] * (ptwo[size[res] - i] - 1) % P);
			update(dp[res][h][i][1], 1ll * dp[res][h + 1][i][1] * (ptwo[size[res] - i] - 1) % P);
		}
		for (int i = 1; i <= size[res]; i++)
		for (int j = 1; j <= i; j++) {
			update(dp[res][h][i - j][0], 1ll * dp[res][h + 1][i][0] * ptwo[size[res] - i] % P * binom[i][j] % P);
			update(dp[res][h][i - j][1], 1ll * dp[res][h + 1][i][1] * ptwo[size[res] - i] % P * binom[i][j] % P);
		}
	}
	return res;
}
int main() {
	read(n), ptwo[0] = binom[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		read(a[i]), binom[i][0] = 1;
		ptwo[i] = 2 * ptwo[i - 1] % P;
		for (int j = 1; j <= i; j++)
			binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % P;
	}
	int res = work(1, n, 0);
	cout << dp[res][0][0][0] << endl;
	return 0;
}


Measured memory_bytes: 516864
def isAbleToBack(plan):
    alphaToInt = {'E':0, 'W':1, 'N':2, 'S':3}
    count = [False]*4
    for c in plan:
        count[alphaToInt[c]] = True
    for i in xrange(4):
        if count[i] and not count[i^1]:
            return False
    return True

def main():
    plan = raw_input().strip()
    if isAbleToBack(plan):
        print 'Yes'
    else:
        print 'No'

if __name__ == '__main__':
    main()

Measured memory_bytes: 2568
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
T Read(T)() { return readln.chomp.to!(T); }
T[] Reads(T)() { return readln.split.to!(T[]); }
alias read = Read!(int);
alias reads = Reads!(int);

void main() {
    int[] a = reads;
    a.sort();
    writeln(a[0] + 10 * a[2] + a[1]);
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;
using System.Runtime.InteropServices.ComTypes;
using System.Xml.Schema;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (A, B, T) = Slice3<long>();
            WriteLine(T / A * B);
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

Measured memory_bytes: 27272
#include <bits/stdc++.h>
#define SLAY ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.141592653589793238
#define ll long long
#define dd  double
#define pii pair<int , int>
#define pll pair<long long , long long>
#define INPUT freopen("travel_restrictions_validation_input.txt", "r", stdin);
using namespace std;

int dp[3001][3001];

int l,k,n,m,p ,nodes;
string a ,b;

int getmod(int x, int y , int mod ){
    return ( ( (x - y) %  mod ) +  mod ) %  mod;
}

int solve(int i , int j){
	
	if(i>=n || j>=m)return 0;
	
	int& ret = dp[i][j];
	if(~ret)return ret;
	
	if(a[i] == b[j]){
		ret = 1 + solve(i+1 , j+1);
	}else{
		ret = max(solve(i+1 , j) , solve(i , j+1));
	}
	
	return ret;
}


void trace(int i , int j){
	
	if(i>=n || j>=m)return;

	
	if(a[i] == b[j]){
		cout<<a[i];
		trace(i+1 , j+1);
	}else{
		int x = solve(i+1 , j); 
		int y = solve(i , j+1); 
		
		if(x>y)trace(i+1 ,j);
		else trace(i,j+1);
	}
	
}


int main(){
	SLAY
	int _=1;
	// cin>>_;
	while(_--){
		cin>>a>>b;
		n=a.length() , m = b.length();
		memset(dp,-1,sizeof(dp));
		solve(0,0);
		trace(0,0);
		
	}
	return 0;
}






Measured memory_bytes: 39064
c = []
c << gets.split.map(&:to_i)
c << gets.split.map(&:to_i)
c << gets.split.map(&:to_i)
ans = 'No'
if (c[0][0]-c[0][1]==c[1][0]-c[1][1]) && (c[0][0]-c[0][1]==c[2][0]-c[2][1])
  if (c[0][0]-c[0][2]==c[1][0]-c[1][2]) && (c[0][0]-c[0][2]==c[2][0]-c[2][2])
    c.transpose
    if (c[0][0]-c[0][1]==c[1][0]-c[1][1]) && (c[0][0]-c[0][1]==c[2][0]-c[2][1])
      if (c[0][0]-c[0][2]==c[1][0]-c[1][2]) && (c[0][0]-c[0][2]==c[2][0]-c[2][2])
        ans = 'Yes'
      end
    end
  end
end
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int main()
{
    fast;
    ll a;
    cin>>a;
    ld b;
    cin>>b;
    cout<<(ll)(a*b);
}

Measured memory_bytes: 3744
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

const int MAX = 5000;
LL fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理。main()ないでCOMinit()する
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
LL COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

void Main()
{
    COMinit();
    LL n,k;cin>>n>>k;

    FOR(i,1,k+1){
        LL result = COM(n-k+1,i) * COM(k-1,i-1);
        cout<<result%MOD<<endl;
    }
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 5;
  int x;
  for (int i = 0; i < 5; i++) {
  	cin >> x;
    if (x == 0) {
      cout << i + 1 << endl;
    }
  }
  

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF (ll)(1e17+5)
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
ll N,M;
vector <ll> adj[100005];
ll dp[100005];
ll fn(ll n)
{
    ll i,mx=-1*INF;
    if(dp[n]!=-1)
     return dp[n];
    if(adj[n].size()==0)
     return dp[n]=0;
    for(i=0;i<adj[n].size();i++)
     mx=max(mx,fn(adj[n][i]));
    return dp[n]=1+mx;
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       cin>>N>>M;
       ll i,x,y,mx=-1*INF;
       memset(dp,-1,sizeof(dp));    
       for(i=0;i<M;i++)
       {
           cin>>x>>y;
           adj[x].pb(y);
       }
       for(i=1;i<N+1;i++)
        mx=max(mx,fn(i));    
       cout<<mx<<"\n";
   }
}

Measured memory_bytes: 8576
n = int(input())
x = list(map(int,input().split()))
Min = 999999999
cnt = 0
for i in range(min(x),max(x)+1):
    p = i
    cnt = 0
    for j in range(n):
        cnt += (x[j] - p) ** 2
    Min = min(Min,cnt)
print(Min)

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

int main() {
	int numberA[4], b, c, i, min, ans=0;
	for (i = 0; i <= 3; i++) {
		cin >> numberA[i];
		if (i == 0) {
			min = numberA[0];
		}
		if (i > 0) {
			if (numberA[i] < min) {
				min = numberA[i];
			}
			else if (numberA[i] > min) {
				min = min;
			}
			else {
				min = min;
			}
		}
	}
	ans = (numberA[0] + numberA[1] + numberA[2] + numberA[3]) - min;

	cin >> b;
	cin >> c;
	if (b > c) {
		ans += b;
	}
	else if (b < c) {
		ans += c;
	}
	else {
		ans += b;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

int main()
{
  int n;
  cin >> n;
  int use[12] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
  vector<int> dp(200000, 100001);
  dp[0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 12; j++)
      dp[i + use[j]] = min(dp[i + use[j]], dp[i] + 1);
  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define FORR(i,a,b) for (int i=a; i>=b; i--)

typedef long long ll;

int w,h;
bool c[50][50];
int dx[9] = {-1,-1,-1,0,0,0,1,1,1} , dy[9] = {-1,0,1,-1,0,1,-1,0,1};

bool isok(int i ,int j){
	return i>=0 && i<h && j>=0 && j<w;
}

void dfs(int i, int j){
	c[i][j] = 0;
	REP(k,9){
		int ii=i+dx[k] , jj=j+dy[k];
		if (isok(ii,jj)&&c[ii][jj]){
			dfs(ii,jj);
		}
	}
}

int main(void){
	while (cin >> w >> h && w){
		REP(i,h) REP(j,w) cin >> c[i][j];
		int ans = 0;
		REP(i,h){
			REP(j,w){
				if (c[i][j]==1){
					dfs(i,j);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <algorithm>
#define INF 1000000013
using namespace std;
int dp[100010];

int main(){
  int n,k;
  cin >> n >> k;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++){
    dp[i]=INF;
    for(int j=1;j<=k;j++){
      if(i-j>=0) dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
    }
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
    string c;
    cin >> c;
    printf("%c", (c[0]+1)); 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll 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;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

bool isPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
vector<int> primes;
void solve(long long N)
{
    for (int i = 2; i <= 55555; i++)
    {
        if (isPrime(i))
        {
            if (i % 5 == 1)
            {
                primes.push_back(i);
            }
        }
    }

    for (int i = 0; i < N; i++)
    {
        cout << primes[i] << endl;
    }
    
}

int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256