akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>

#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>

// namespace
using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

// constant
static const ll MOD = 1000000007LL;
static const double PI = 3.14159265358979323846;

// conversion
inline ll toint(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// print
#define RET(x) return cout << x << endl, 0;

// for loop
#define REP(i, a, b) for ((i) = (ll)(a);(i) < (ll)(b);(i)++)
#define REPD(i, a, b) for (ll i = (ll)(a);(i) < (ll)(b);(i)++)
#define REPI(v, vs) for (auto& v : vs)

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __LINE__ << ")" << " " << __FILE__ << endl

#define MAX_VALUE 9223372036854775807

inline ull get_gcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return get_gcd(b, a % b);
}

int solve() {
	ll n, m;
	cin >> n >> m;

	vector<ll> as(n);
	REPD(i, 0, n) cin >> as[i];

	ll power_of_2 = -1;
	REPD(i, 0, n) {
		ll curr_power = 0;
		while(as[i] % 2LL == 0LL) {
			as[i] /= 2LL;
			++curr_power;
		}
		if (power_of_2 == -1) power_of_2 = curr_power;
		else if (power_of_2 != curr_power) RET(0);
	}

	ll base = 1;
	REPD(i, 1, power_of_2) base *= 2LL;

	ll slcm = as[0];
	if (slcm * base > m) RET(0);
	REPD(i, 1, n) {
		slcm *= as[i] / get_gcd(slcm, as[i]);
		if (slcm * base > m) RET(0);
	}
	ll res = 0;

	RET(1LL + (m - slcm * base) / slcm / base / 2LL);
}

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

	solve();
	// ll t;
	// cin >> t;
	// REPD(i, 0, t) solve();

	return 0;
}


Measured memory_bytes: 3996
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class B81 {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        for(int i=1;i<10;i++){
            if(n%i==0){
                int t=n/i;
                if(t>0&&t<10){
                    out << "Yes" << endl;
                    return ;
                }
            }
        }
        out << "No" << endl;
	}
};


int main() {
	B81 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int H, W;

vector<int> dxw = { 1, 0, -1, 0 };
vector<int> dyw = { 0, 1, 0, -1 };
vector<int> dxb = { 1, 0, -1, 0, 1, 1, -1, -1 };
vector<int> dyb = { 0, 1, 0, -1, 1, -1, 1, -1 };

struct P {
	int x, y;
};

bool in(int x, int y) {
	return 0 <= x && x < W && 0 <= y && y < H;
}

pair<vector<vector<int>>, vector<vector<P>>> color(const vector<string>& b) {
	vector<vector<int>> C(H, vector<int>(W, -1));
	vector<vector<P>> pos;

	int n = 0;
	for(int y = 0; y < H; y++) {
		for(int x = 0; x < W; x++) {
			if(C[y][x] != -1) continue;
			vector<P> ps;
			queue<P> q;
			q.push({ x, y });
			ps.push_back({ x, y });
			C[y][x] = n;
			while(q.size()) {
				int cx = q.front().x, cy = q.front().y;
				q.pop();
				vector<int> dx, dy;
				if(b[y][x] == '.') dx = dxw, dy = dyw;
				else dx = dxb, dy = dyb;
				for(int k = 0; k < dx.size(); k++) {
					int nx = cx + dx[k], ny = cy + dy[k];
					if(!in(nx, ny)) continue;
					if(b[ny][nx] != b[y][x]) continue;
					if(C[ny][nx] != -1) continue;
					q.push({ nx, ny });
					ps.push_back({ nx, ny });
					C[ny][nx] = n;
				}
			}
			pos.push_back(ps);
			n++;
		}
	}
	return{ C, pos };
}

vector<vector<int>> build(const vector<string>& b) {
	auto res = color(b);
	auto C = res.first;
	auto pos = res.second;
	int n = pos.size();

	vector<vector<int>> G(n);
	vector<vector<int>> check(H, vector<int>(W));
	vector<int> checkV(n);
	queue<int> q;
	q.push(0);
	checkV[0] = 1;
	while(q.size()) {
		int v = q.front();
		q.pop();
		for(auto p : pos[v]) {
			check[p.y][p.x] = 1;
		}

		for(auto p : pos[v]) {
			vector<int> dx = dxw, dy = dyw;
			for(int k = 0; k < dx.size(); k++) {
				int nx = p.x + dx[k], ny = p.y + dy[k];
				if(!in(nx, ny)) continue;
				if(check[ny][nx]) continue;
				if(b[p.y][p.x] == b[ny][nx]) continue;
				int u = C[ny][nx];
				if(checkV[u]) continue;
				checkV[u] = 1;
				q.push(u);
				G[v].push_back(u);
			}
		}
	}

	return G;
}

string f(int v, int p, const vector<vector<int>>& G) {
	vector<string> s;
	for(auto c : G[v]) {
		if(c == p) continue;
		s.push_back(f(c, v, G));
	}

	sort(s.begin(), s.end());
	string ret;
	for(auto ss : s) {
		ret += ss;
	}
	ret = "(" + ret + ")";
	return ret;
}

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

	while(cin >> H >> W, H) {
		string tree[2];
		for(int i = 0; i < 2; i++) {
			if(i == 1) {
				cin >> H >> W;
			}
			H += 2, W += 2;
			vector<string> b;
			b.push_back(string(W, '.'));
			for(int j = 0; j < H - 2; j++) {
				string p;
				cin >> p;
				b.push_back("." + p + ".");
			}
			b.push_back(string(W, '.'));

			auto G = build(b);
			tree[i] = f(0, -1, G);
		}

		if(tree[0] == tree[1]) cout << "yes" << endl;
		else cout << "no" << endl;

	}
}

Measured memory_bytes: 3364
#include <stdio.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)

//sからtへの最大流 O(E flow)を横着してO(VV flow)
//*
#define VMAX 210
int vcnt;
int foodoflag[VMAX];
int resflow[VMAX][VMAX];

int foododfs(int s,int t){
	if(s==t)return 1;
	foodoflag[s]=1;
	rep(i,0,vcnt)if(!foodoflag[i]&&resflow[s][i]>0){
		if(foododfs(i,t)){
			resflow[s][i]--;
			resflow[i][s]++;
			return 1;
		}
	}
	return 0;
}
int foodo(int s,int t){
	int ans=0;
	while(foododfs(s,t)){
		ans++;
		rep(i,0,vcnt)foodoflag[i]=0;
	}
	return ans;
}
#undef VMAX
//*/
int main(){
	int x,y,e;
	scanf("%d%d%d",&x,&y,&e);
	vcnt=x+y+2;
	while(e--){
		int p,q;
		scanf("%d%d",&p,&q);
		resflow[0][p+1]=1;
		resflow[p+1][q+x+1]=1;
		resflow[q+x+1][x+y+1]=1;
	}
	printf("%d\n",foodo(0,x+y+1));
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};


int main() 
{
	// ios::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);
	
	ll n;
	cin>>n;
	int cnt = 0;
	int res = 0;
	loop(i,0,n){
		int d1,d2;
		cin>>d1>>d2;
		if(d1==d2)
			cnt++;
		else
			cnt = 0;
		if(cnt==3)
			res = 1;
	}

	if(res==1)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int L = a+b, R = c+d;
  if (L == R) cout << "Balanced\n";
  else if (L > R) cout << "Left\n";
  else cout << "Right\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#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)
const ll INF=1e18+3;
const ll MOD=1e9+7;

class UnionFind{
public:
	vector<int> par,size;
	//0-indexed
	void init(int n = 1) {
		par.resize(n);
		size.resize(n);
		for (int i = 0; i < n; ++i) par[i] = i;
		for (int i = 0; i < n; ++i) size[i] = 1;
	}
	int root(int x = 1){
		if(par[x]==x)return x;
		else{
			return par[x] = root(par[x]);
		}
	}
	void unite(int x = 1,int y = 1){
		x = root(x);
		y = root(y);

		if(x==y)return;
		else{
			par[x] = y;
			size[y] += size[x];
			size[x] = 0;
		}
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,ans=0;
	cin>>n;
	vector<ll> a(n+1,0),b(n+1,0);
	vector<bool> didj(n+1,false);
	UnionFind uf;
	uf.init(n+1);
	FOR(i,1,n+1)cin>>a[i];
	FOR(i,1,n+1)b[a[i]]=i;
	FORR(i,1,n+1){
		ll j = b[i];
		didj[j] = true;
		ll r = 0,l = 0;
		if(j>0)if(didj[j-1])l = uf.size[uf.root(j-1)];
		if(j<n)if(didj[j+1])r = uf.size[uf.root(j+1)];
		if(j>0)if(didj[j-1])uf.unite(j,j-1);
		if(j<n)if(didj[j+1])uf.unite(j,j+1);
		ans += a[j]*1LL*(r+1)*(l+1);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
// #define pie 3.141
using namespace  std;
int main()
{
long long perimater;
long house ;
cin>>perimater>>house;
vector <long long> hl(house);
for(int i =0;i<house;i++)
	cin>>hl[i];
long long max=0 ,sum = 0;
for(int i =1;i<house;i++)
	{
		if(max<hl[i] - hl[i-1])
			max = hl[i] - hl[i-1];
	}
if(max<perimater-hl[house-1]+hl[0])
	max = perimater-hl[house-1]+hl[0];
cout<<perimater-max;
return 0;
}

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

int main(void) {
	int n;
	cin >> n;
	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] < a[i+1]) {
			while (a[i] <= a[i+1] && i + 1 < n) {
				i++;
			}
			ans++;
		} else if (a[i] == a[i+1] && i + 1 < n) {
			continue;
		} else {
			while (a[i] >= a[i+1] && i + 1 < n) {
				i++;
			}
			ans++;
		} 
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
////=====BIsmillahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comilla University

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define fi 2*acos(0.0)
#define ee 2.71828
#define ll  long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define edl printf("\n")
#define infinity 1e16
#define mod 1000000007
#define cn continue
#define csprint1 printf("Case %lld: ", cs++)
#define csprint2 printf("Case %lld:\n", cs++)
#define sf(a) scanf("%lld", &a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define all(v) v.begin(),v.end()
#define pfn(a) printf("%lld\n",a)
#define pfs(a) printf("%lld ",a)

using namespace __gnu_pbds;
using namespace std;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<pl> vpi;
typedef vector<pl> vpl;
typedef tree<pair<ll, int> , null_type, less<pair<ll, int> >, rb_tree_tag, tree_order_statistics_node_update> ost;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<","<< spc;
    err(++it, args...);
    cout<<edl;
}
///Bit manipulation

bool checkbit(int mask,int bit){return mask & (1<<bit);}
int setbit(int mask,int bit){ return mask | (1<<bit) ; }
int clearbit(int mask,int bit){return mask & ~(1<<bit);}
int togglebit(int mask,int bit){return mask ^ (1<<bit);}
int bitno(int mask) {return (int)__builtin_popcount(mask);}

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

///=====================================///

const int maX = 1e5+10;
ll exp(ll a,ll b){
    if(b==0)return 1;
    ll x=exp(a,b/2);
    x=(x*x)%mod;
    if(b&1)x=(x*a)%mod;
return x%mod;
}
int main(){
    ll n;
    sf(n);
    cout<<(((exp(10,n)-2*exp(9,n)+exp(8,n))%mod)+mod)%mod<<endl;
return 0;
}
//4 3
//7 -1 3
//8 2 5
//3 -1 9
//1 7 4


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
 
/* Rerooting: 全方位木 DP
    問題ごとに以下を書き換える
    - 型DPと単位元
    - 型DPに対する二項演算 merge
    - まとめたDPを用いて新たな部分木のDPを計算する add_root
    計算量: O(N)
*/
struct Rerooting {
    /* start 問題ごとに書き換え */
    struct DP {  // DP の型
        long long dp;
        DP(long long dp_) : dp(dp_) {}
    };
    const DP identity = DP(-1);  // 単位元(末端の値は add_root(identity) になるので注意)
    function<DP(DP, DP)> merge = [](DP dp_cum, DP d) -> DP {
        return DP(max(dp_cum.dp, d.dp));
    };
    function<DP(DP)> add_root = [](DP d) -> DP {
        return DP(d.dp + 1);
    };
    /* end 問題ごとに書き換え */
 
    // グラフの定義
    struct Edge {
        int to;
    };
    using Graph = vector<vector<Edge>>;
 
    vector<vector<DP>> dp;  // dp[v][i]: vから出るi番目の有向辺に対応する部分木のDP
    vector<DP> ans;         // ans[v]: 頂点vを根とする木の答え
    Graph G;
 
    Rerooting(int N) : G(N) {
        dp.resize(N);
        ans.assign(N, identity);
    }
 
    void add_edge(int a, int b) {
        G[a].push_back({b});
    }
    void build() {
        dfs(0);            // 普通に木DP
        bfs(0, identity);  // 残りの部分木に対応するDPを計算
    }
 
    DP dfs(int v, int p = -1) {  // 頂点v, 親p
        DP dp_cum = identity;
        int deg = G[v].size();
        dp[v] = vector<DP>(deg, identity);
        for (int i = 0; i < deg; i++) {
            int u = G[v][i].to;
            if (u == p) continue;
            dp[v][i] = dfs(u, v);
            dp_cum = merge(dp_cum, dp[v][i]);
        }
        return add_root(dp_cum);
    }
    void bfs(int v, const DP& dp_p, int p = -1) {  // bfs だが、実装が楽なので中身は dfs になっている
        int deg = G[v].size();
        for (int i = 0; i < deg; i++) {  // 前のbfsで計算した有向辺に対応する部分木のDPを保存
            if (G[v][i].to == p) dp[v][i] = dp_p;
        }
        vector<DP> dp_l(deg + 1, identity), dp_r(deg + 1, identity);  // 累積merge
        for (int i = 0; i < deg; i++) {
            dp_l[i + 1] = merge(dp_l[i], dp[v][i]);
        }
        for (int i = deg - 1; i >= 0; i--) {
            dp_r[i] = merge(dp_r[i + 1], dp[v][i]);
        }
 
        ans[v] = add_root(dp_l[deg]);  // 頂点 v の答え
 
        for (int i = 0; i < deg; i++) {  // 一つ隣の頂点に対しても同様に計算
            int u = G[v][i].to;
            if (u == p) continue;
            bfs(u, add_root(merge(dp_l[i], dp_r[i + 1])), v);
        }
    }
};
 
int main() {
    int N;
    cin >> N;
    Rerooting reroot(N);
    for (int i = 0; i < N - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        reroot.add_edge(u, v);
        reroot.add_edge(v, u);
    }
    reroot.build();
 
	long long ans = 0;
    for (int i = 0; i < N; i++) {
        ans = max(ans, reroot.ans[i].dp);
    }
	if(ans % 3 == 1) cout << "Second" << endl;
	else cout << "First" << endl;
}

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
    if (i == N - 1)
      cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int x,y,cnt;
  while(cin >> x >> y,x!=0&&y!=0){
    if(x < y) swap(x,y);
    cnt = 1;
    while(x%y != 0){
    
      swap(x,y);
      y = y%x;
      
      cnt++;
    }
    cout << y << " " << cnt << endl;
  }
  return(0);
}



Measured memory_bytes: 2984
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Iterator;

public class Main{
public static void main(String[] args){

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();
int m = sc.nextInt();
int sum = 0;
ArrayList<ArrayList<Integer>> List = new ArrayList<ArrayList<Integer>>();


for(int i = 0 ; i < n ; i++){
  ArrayList<Integer> List2 = new ArrayList<Integer>();
  for(int j = 0; j < m ; j++){
    List2.add(sc.nextInt());

  }
List.add(List2);
}


ArrayList<Integer> List3 = new ArrayList<Integer>();

for(int i = 0 ; i < m ; i++){
  List3.add(sc.nextInt());

}//Input Vectors

int cnt=0;
for(ListIterator<ArrayList<Integer>> it = List.listIterator(); it.hasNext();){
  for(ListIterator<Integer> itt = (it.next()).listIterator();itt.hasNext();){

sum += (itt.next())*(List3.get(cnt));
cnt++;
  }
cnt = 0;
System.out.println(sum);
sum = 0;
}

}//main



}//class



Measured memory_bytes: 41288
/*
   _  __  U _____ u  _  __    
  |"|/ /  \| ___"|/ |"|/ /    
  | ' /    |  _|"   | ' /     
U/| . \\u  | |___ U/| . \\u   
  |_|\_\   |_____|  |_|\_\    
,-,>> \\,-.<<   >>,-,>> \\,-. 
 \.)   (_/(__) (__)\.)   (_/  
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define zhfs main
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define re return
#define forn(i, n) for (int i = 1; i <= n; i++)
const int MAXN = 100 * 1000 + 7;
vector<int> g[MAXN];
bool cut[MAXN];
bool used[MAXN];
int tin[MAXN], fup[MAXN];
int timer = 1;
void dfs(int v, int p = -1)
{
	used[v] = true;
	tin[v] = timer;
	fup[v] = timer;
	timer++;
	int child = 0;
	for (int i = 0; i < (int)g[v].size(); i++)
	{
		int to = g[v][i];
		if (to == p) continue;
		if (used[to])
		{
			fup[v] = min(fup[v], tin[to]);
		}
		else
		{
			dfs(to, v);
			fup[v] = min(fup[v], fup[to]);
			if (fup[to] >= tin[v] && p != -1)
			{
				cut[v] = true;
			}
			child++;
		}
	}
	if (p == -1 && child > 1)
	{
		cut[v] = true;
	}
}
int zhfs()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		int u, v;
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1);
	int s = 1;
	while (cut[s]) s++;
	assert(s <= n);
	vector<int> res;
	memset(used, 0, sizeof(used));
	while (1)
	{
		res.push_back(s);
		used[s] = true;
		bool found = false;
		for (int i = 0; i < (int)g[s].size(); i++)
		{
			int v = g[s][i];
			if (!used[v])
			{
				s = v;
				found = true;
				break;
			}
		}
		if (!found) break;
	}
	s = res[0];
	vector<int> res2;
	while (1)
	{
		res2.push_back(s);
		used[s] = true;
		bool found = false;
		for (int i = 0; i < (int)g[s].size(); i++)
		{
			int v = g[s][i];
			if (!used[v])
			{
				s = v;
				found = true;
				break;
			}
		}
		if (!found) break;
	}

	printf("%d\n", (int)res.size() + (int)res2.size() - 1);
	for (int i = (int)res2.size() - 1; i >= 1; i--)
	{
		printf("%d ", res2[i]);
	}
	for (int i = 0; i < (int)res.size(); i++)
	{
		printf("%d ", res[i]);
	}
	printf("\n");
}



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

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

    int n, k;
    cin >> n >> k;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    sort(A.begin(), A.end());

    int ans = 0;
    for(int i = 0; i < k; i++){
        ans += A[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
const ll MOD = 1000000007;
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

template <class T>
void MODinit(T MAX, T M, vector<T> &fac, vector<T> &finv) {
    // fac,finvは空配列でok
    fac.resize(2, 1);
    finv.resize(2, 1);
    vector<T> inv(2, 1);
    for (T i = 2; i < MAX; i++) {
        fac.push_back(fac[i - 1] * i % M);
        inv.push_back(M - inv[M % i] * (M / i) % M);
        finv.push_back(finv[i - 1] * inv[i] % M);
    }
}

template <class T>
T com(T n, T k, vector<T> &fac, vector<T> &finv, T M) {
    // nCk
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % M) % M;
}

signed main() {
    int x, y;
    cin >> x >> y;
    if ((2 * y - x) % 3 != 0 || (2 * x - y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }
    int a = (2 * y - x) / 3;
    int b = (2 * x - y) / 3;
    if (2 * y - x < 0 || 2 * x - y < 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> s(0);
    vector<int> t(0);
    ll max = 3000000;
    MODinit(max, MOD, s, t);
    cout << com(a + b, b, s, t, MOD) << endl;
}

Measured memory_bytes: 73832
N, T = map(int, input().split())

t_list = [int(x) for x in input().split()]

total = 0
for i in range(1, len(t_list)):
    if t_list[i] - t_list[i-1] > T:
        total += T
    else:
        total += t_list[i] - t_list[i-1]
total += T

print(total)

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

int main(){
    ll N;
    cin >> N;
    if(N%2==1){
        cout << 0 << endl;
    }else{
        ll n = 10;
        ll ans = 0;
        if(N%2 == 0 ){
            while(N >= n){
                ans += N/n;
                n *= 5;
            }
        cout << ans << endl;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,a,b,c,d,m=1e9,i;
  scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
  a--;
  b--;
  c--;
  d--;
  for(i=1;i<n;i++)m=MIN(m,abs(a/i-b/i)+abs(a%i-b%i)+abs(c/i-d/i)+abs(c%i-d%i));
  printf("%d\n",m);
  return 0;
}
    

Measured memory_bytes: 596
def divisor(x):
  divx = []
  for i in range(1,x+1):
    if x%i == 0:
      divx += [i]
  return divx
n = int(input())
ans = []
for j in range(1,n+1):
  if j%2 == 1 and len(divisor(j)) == 8:
    ans += [j]
print(len(ans))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int ctoi(char);

struct btn{
    int next;
    int flag;
};

int main()
{
    int N,M;
    vector<string> blue, red;

    cin >> N;
    rep(i, N)
    {
        string s;
        cin >> s;
        blue.push_back(s);
    }
    cin >> M;
    rep(i, M)
    {
        string s;
        cin >> s;
        red.push_back(s);
    }

    int ans = 0;
    rep(i, N)
    {
        string kw = blue.at(i);
        int count = 1;
        rep2(j, i+1, N)
        {
            if (kw == blue.at(j))
            {
                count++;
            }
        }
        rep(l, M)
        {
            if (kw == red.at(l))
            {
                count --;
            }
            if (count == 0) break;
        }
        if (ans < count) ans = count;
    }
    cout << ans << endl;
}


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


Measured memory_bytes: 256
N, M = map(int, input().split())
ans = 1
if N == 1:
    print(M)
else:
    for n in range(2, int(M ** 0.5) + 1):
        if M % n == 0 and M / N >= n:
            ans = max(ans, n)
            if M // n * N <= M:
                ans = max(ans, M // n)
    print(ans)


Measured memory_bytes: 9400
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    long len = (long)c.length;
    long ans = (len*(len-1))/2;
    for(char x='a';x<='z';x++){
      long cnt = 0;
      for(int i=0;i<len;i++){
        if(c[i]==x)cnt++;
      }
      ans-=(cnt*(cnt-1))/2;
    }
    System.out.println(ans+1);
  }
}


Measured memory_bytes: 27576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int X[60];
int main(){
    ll n;
    scanf("%lld",&n);
    int cur = 0;
    //X[1] = 1;
    for (int i = 0; i < 60; i++){
        if (i*2 >= cur*(cur+1)) cur++;
        X[i] = cur-1;
        //printf("%d %d\n",i,cur);
    }
    int ans = 0;
    for (int i = 2; (ll)i*i <= n; i++){
        int ct = 0;
        if (n % i == 0){
            while (n % i == 0){
                ct++;
                n /= i;
            }
        }
        ans += X[ct];
    }
    if (n != 1){
        ans += 1;
    }
    printf("%d",ans);
}


Measured memory_bytes: 3840
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
p = []
ans = 0
for _ in range(q):
    p.append(list(map(int, input().split())))
for A in combinations_with_replacement(range(1,m+1), n):
    cnt = 0
    for i in range(q):
        if A[p[i][1]-1] - A[p[i][0]-1] == p[i][2]:
            cnt += p[i][3]
    ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 9184
a,b,k = list(map(int, input().split()))
if (b-a)//2 < k:
  for i in range(a, b+1, 1):
    print(i)
    #print("one")
else:
  for j in range(a, a+k, 1):
    print(j)
  for k in range(b-k+1, b+1, 1):
    print(k)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define foreach(c,itr) for(__typeof(c)::iterator itr=c.begin();itr!=c.end();itr++)
typedef long long ll;
int i,j;

int main(){
	ios::sync_with_stdio(false);
    cin.tie();
    
    int n,x,t;
    cin>>n>>x>>t;
    int z=(n+x-1)/x;
    ll ans=z*t;
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,a;
ll x[55];
ll dp[55][6000];
int main(void){
    cin>>n>>a;
    for(ll i=0;i<n;i++){
        cin>>x[i];
        x[i]-=a;
    }
    sort(x,x+n);
    dp[0][2500]=1;
    dp[0][x[0]+2500]++;
    for(int i=1;i<n;i++){
        for(int j=-2000;j<=2000;j++){
            if(dp[i-1][j+2500]>0){
                dp[i][j+2500]+=dp[i-1][j+2500];
                dp[i][j+2500+x[i]]+=dp[i-1][j+2500];
            }
        }
    }
    cout<<dp[n-1][2500]-1<<endl;
    
    
}


Measured memory_bytes: 896
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

int main() {
	int n;
	cin >> n;
	cout << n / 3 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if( ( a < b) && ( b < c ) ) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26312
import numpy as np

h, w, k = map(int, input().split())

c = [list(str(input())) for _ in range(h)]
c = np.array(c)
ans = 0

for i in range(2 ** w):  # 横について
    for j in range(2 ** h):  # 縦について
        mas = c.copy()
        for p in range(w):
            for q in range(h):
                if (i >> p) & 1:
                    mas[:, p] = "0"
                if (j >> q) & 1:
                    mas[q, :] = "0"
        # print(mas, "\n", i, j)
        cnt = np.count_nonzero(mas == "#")
        if cnt == k:
            ans += 1

print(ans)


Measured memory_bytes: 27060
a = map(int, input().split())
a = int(list(a)[0])


#  for a in range(100, 1000):

ans = 'No'
while a > 1:
    #  print(f"a = {a}  : ", end='')
    if a % 10 == 7:
        ans = 'Yes'
        break
    a /= 10
    a = int(a)
print(ans)



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

long long manyFormula(string str){
    
    //int n = str.size();
    long long sum = 0;
    
    for(int i = 0; i < (1 << (str.size()-1) ); i++){
        
        bitset<10> bit(i);
        long long tmp = 0;
        
        for(int j = 0; j < str.size(); j++){
            tmp *= 10;
            tmp += str[j] - '0';
            if(bit.test(j)){
                sum += tmp;
                tmp = 0;
            }
        }
        sum += tmp;
    }
    
    return sum;
}


int main(void){
    
    string S;
    cin >> S;
    
    long long ans = manyFormula(S);
    
    cout << ans << endl;
    
}


Measured memory_bytes: 3200
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc171/tasks/abc171_a
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    char ch;
    cin >> ch;
    if('a' <= ch && 'z' >= ch ) cout << 'a';
    else cout << 'A';

	return 0;
}


Measured memory_bytes: 3640
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();
 
    let a: i32 = vec[0].parse().unwrap();
    let b: i32 = vec[1].parse().unwrap();

    if a == b {
        println!("a == b");
    }

    if a > b {
        println!("a > b");
    }

    if a < b {
        println!("a < b");
    }
}


Measured memory_bytes: 5020
#include <iostream>
#include <map>
#include <cmath>

long long n, p;
std::map<long long, long long> data;
int main() {
	std::cin >> n >> p;

	long long a = 2;
	while (p >= a * a) {
		if (p % a == 0) {
			++data[a];
			p /= a;
		}
		else {
			a++;
		}
	}
	if (p != 1)
		++data[p];

	long long ans = 1;
	for (auto& s : data)
		if (s.second >= n)
			ans *= std::pow(s.first, s.second / n);

	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<tuple>
#include<string>
#include<vector>
using namespace std;
long long p1[13][33], p2[13][33], V[401];
tuple<int, int, int>x[13][20][20][18][20];
tuple<int, int, int, int, int>xx[1872002];
void Day_Init() {
	for (int i = 0; i < 429; i++) { p1[i / 33][i % 33] = -1; p2[i / 33][i % 33] = -1; }
	long long CNTS = 0;
	for (int i = 1; i <= 12; i++) {
		long long V = 31; if ((i <= 6 && i % 2 == 0) || (i >= 9 && i % 2 == 1))V = 30;
		if (i == 2)V = 28;
		for (int j = 1; j <= V; j++) { p1[i][j] = CNTS; CNTS++; }
	}
	CNTS = 0;
	for (int i = 1; i <= 12; i++) {
		long long V = 31; if ((i <= 6 && i % 2 == 0) || (i >= 9 && i % 2 == 1))V = 30;
		if (i == 2)V = 29;
		for (int j = 1; j <= V; j++) { p2[i][j] = CNTS; CNTS++; }
	}
	for (int i = 1; i <= 400; i++) {
		long long II = i - 1;
		if (II % 4 == 0 && (II % 100 >= 1 || II % 400 == 0))V[i] = V[i - 1] + 366;
		else { V[i] = V[i - 1] + 365; }
	}
}
void init() {
	Day_Init();
	long long CNTS = 0; long long yy = 2012, mm = 12, dd = 21;
	for (int i = 0; i < 13; i++) {
		for (int j = 0; j < 20; j++) {
			for (int k = 0; k < 20; k++) {
				for (int l = 0; l < 18; l++) {
					for (int m = 0; m < 20; m++) {
						x[i][j][k][l][m] = make_tuple(yy, mm, dd);
						xx[CNTS] = make_tuple(i, j, k, l, m);
						CNTS++; dd++;
						if (yy % 4 == 0 && (yy % 100 >= 1 || yy % 400 == 0)) {
							if (p2[mm][dd] == -1) { mm++; dd = 1; }
						}
						else { if (p1[mm][dd] == -1) { mm++; dd = 1; } }
						if (mm == 13) { mm = 1; yy++; }
					}
				}
			}
		}
	}
}
long long DayCount(long long y, long long m, long long d) {
	long long DD = 0; if (y % 4 == 0 && (y % 100 >= 1 || y % 400 == 0)) { DD = p2[m][d]; }
	else { DD = p1[m][d]; }
	return (V[400] * (y / 400) + V[y % 400]) + DD;
}
tuple<int, int, int> MayaWest(long long I, long long J, long long K, long long L, long long M) {
	return x[I][J][K][L][M];
}
tuple<int, int, int, int, int>WestMaya(long long I, long long J, long long K) {
	long long X = (DayCount(I, J, K) + 1872000LL - DayCount(2012, 12, 21)) % 1872000LL;
	return xx[X];
}
int main() {
	init();
	while (true) {
		string S; cin >> S; if (S == "#")break; S += '.';
		vector<long long>Vec; string T = "";
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == '.') { Vec.push_back(stoi(T)); T = ""; }
			else { T += S[i]; }
		}
		if (Vec.size() == 3) {
			tuple<long long, long long, long long, long long, long long>ans = WestMaya(Vec[0], Vec[1], Vec[2]);
			cout << get<0>(ans) << '.' << get<1>(ans) << '.' << get<2>(ans) << '.' << get<3>(ans) << '.' << get<4>(ans) << endl;
		}
		if (Vec.size() == 5) {
			tuple<long long, long long, long long>ans = MayaWest(Vec[0], Vec[1], Vec[2], Vec[3], Vec[4]);
			cout << get<0>(ans) << '.' << get<1>(ans) << '.' << get<2>(ans) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 61712
while True:
    q = int(input())
    if q < 0:
        break
    ep = q / 1e5
    x = q/2
    while True:
        x = x - (x**3-q)/(3*(x**2))
        
        if abs(x**3 -q) < ep:
            break
    
    print("{:.6f}".format(x))
        
        


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

int main(){
 
  string s;
  string t;
  cin >> s >> t;
  
  sort(s.begin(), s.end());
  
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  
  if (s < t){
    cout << "Yes" << endl;
  }
  else{
   cout << "No" << endl; 
  }
  
  
  
  
}



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


int main()
{
	ios_base::sync_with_stdio(false);
	#ifdef temp
	char s[100006];
	scanf("%s",s);
	int n = strlen(s);
	#else
	string s ;
	cin >> s;
	int n = s.size();
	#endif

	int left = 0;
	int right = n-1;
	int ans = 0;
	int flag = 0;
	while(left < right)
	{
		if(s[left] == s[right])
		{
			left++;
			right--;
		}
		else
		{
			if(s[left] == 'x')
				ans++,left++;
			else if(s[right] == 'x')
				ans++,right--;
			else
			{
				cout << -1 << endl;
				return 0;
			}

		}
	}

	
	cout << ans << endl;
	return 0;
}

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


namespace 競プロCS {
    class ABC136A {
        static void Main(string[] args) {
            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Math.Max(0, nums[2] - (nums[0] - nums[1])));

        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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

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

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


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

  vector<ll> v;
  for (ll i = 1; i <= sqrt(N); ++i) {
    if (N % i == 0) v.push_back(i);
  }

  ll a = v[v.size()-1];
  ll b = N / a;
  a--, b--;
  print(a + b);

  return 0;
}

Measured memory_bytes: 256
/*
  Bismillahir Rahmanir Raheem
*/
#include<bits/stdc++.h>
#define sc(x)        scanf("%lld",&x)
#define pcase(x)     printf("Case %d: ",x++)
#define pn           printf("\n")
#define fri(f)       for(int i=0;i<f;i++)
#define frj(f)       for(int j=0;j<f;j++)
#define reset(x,e)   memset(x,e,sizeof(x))
#define all(x)       x.begin(),x.end()
#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout)
#define infi         INT_MAX
#define max_value    3000000
#define pii          pair<int,int>
#define pch          pair<char,char>
#define pll          pair<ll,ll>
#define mgraph       map<int,vector<int> >
#define mp           make_pair
#define pb           push_back
#define clr(x)       memset(x,0,sizeof(x))

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


 //.................___Start from here___.................//
//.................._____________________................//







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

    t.pop_back();
    if(s==t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3600
#include<iostream>
using namespace std;
int main(){
	int a,b;
	long long c=1000000,d=-1000000,e=0;
	cin >> a;
	for(;a>0;a--){
		cin >> b;
		if(b<c){
			c=b;
		}
		if(b>d){
			d=b;
		}
		e+=b;
	}
	cout << c << " " << d << " " << e << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vii         vector<pair<ll int, ll int>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
//#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
// cerr<<1.0/CLOCKS_PER_SEC<<endl;
using namespace std;
#define N  1000000007 
#define MAXN   200005
//ll int dp[1001][100005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout.precision(15);
ll int n,k;
cin>>n>>k;
vi a(n);
rep(i,0,n)
cin>>a[i];
vector<bool>dp(k+1);
rep(i,0,k+1)
{
for(auto j:a)
{
if(i-j>=0 && !dp[i-j])
dp[i]=1;	
}	
}
if(dp[k])
	cout<<"First";
else
	cout<<"Second";
}


Measured memory_bytes: 256
// CPP program for finding number of divisor
#include <iostream>
// #include <bits/stdc++.h>
using namespace std;
#define ll long long

// driver program
int main()
{
    char c;
    cin >> c;
    if(c >= 97)
    cout << "a";
    else
    cout << "A";
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int a[10010];
bitset <4001000> b;
int main()
{
	int n,sum=0;scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum=(sum+1)/2;
	b[0]=1;
	for (int i=1;i<=n;i++) b|=b<<a[i];
	for (int i=sum;;i++) if (b[i]) {printf("%d\n",i);return 0;}
}

Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

vector< ll > V;

ll A[200007];
set<int> M;

int main(){
  int N,ANS=0;
  cin >> N;
  rep(i,N){
    cin  >> A[i];
  }
  sort(A,A+N);
  rep(i,N){
    bool Z=0;
    if(i<N-1){
      if(A[i]==A[i+1]){
        Z=1;
      }
    }
    if(Z==1){

    }
    else{
    V.clear();
  for(ll j = 1; j * j <= A[i]; j++) {
    if(A[i] % j == 0) {
      V.push_back(j);
      if(j * j != A[i]) V.push_back(A[i] / j);
    }
  }
  sort(begin(V), end(V));
    rep(i,V.size()){
      if(Z==1 ||  M.find(V[i])!=M.end()){
        Z=1;
        break;
      }
    }
    }
    if(Z==0){
      ANS++;
    }
    M.insert(A[i]);
  }
  cout  << ANS << endl;
}


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

int V, E;

void dfs(vector<vector<int>> &G, int p, int u, int d, vector<int> &depth, vector<int> &lowlink, vector<bool> &visited, vector<int> &pars){
    visited[u] = true;
    pars[u] = p;
    depth[u] = lowlink[u] = d;
    
    for(auto v: G[u]) if(v != p){
        if(!visited[v]){
            dfs(G, u, v, d+1, depth, lowlink, visited, pars);
            lowlink[u] = min(lowlink[u], lowlink[v]);
        }else{
            lowlink[u] = min(lowlink[u], depth[v]);
        }
    }
}

int main(){
    cin >> V >> E;
    
    vector<vector<int>> G(V);
    for(int i=0; i<E; i++){
        int s, t; cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    
    vector<int> depth(V, -1), lowlink(V, -1);
    vector<bool> visited(V, false);
    vector<int> pars(V, -1);
    dfs(G, -1, 0, 0, depth, lowlink, visited, pars);
    
    vector<vector<int>> tree(V);
    for(int i=0; i<V; i++){
        int p = pars[i];
        if(p != -1)
            tree[p].push_back(i);
    }
    
    if(tree[0].size() > 1)
        cout << 0 << endl;
    for(int s=1; s<V; s++){
        bool art = false;
        for(auto v: tree[s]){
            art |= depth[s] <= lowlink[v];
        }
        if(art)
            cout << s << endl;
    }
    
    return 0;
}

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

namespace _0357
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(RArInt().Sum() / 2);
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> X(N),Y(N);
    for(int i=0;i<N;i++){
        cin >> X[i];
    }

    Y = X;

    sort(X.begin(),X.end());

    for(int i=0;i<N;i++){
        if(Y[i]<=X[N/2 -1]){
            cout << X[N/2];
        }else{
            cout << X[N/2 -1];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3712