akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
<url:https://www.ioi-jp.org/joi/2007/2008-ho-prob_and_sol/2008-ho.pdf>
?±????????????============================================================
???????????????????\`???????? w x h ????¢????????????¶????????????
?????????????????n?\?¬???????°??????????????????\`????¢????????????¢??w????????\???????????????¬???A
w x h??????????????????????\`????????????????¢????????¬?????????¢????????\????????????

1<=w<=1000000 1<=h<=1000000
1<= n <= 1000
=================================================================
?¢?£??????=============================================================

??????????\`????¢???¢???§???????????£?????????????????????T?§?±??????????????O(wh)??????????????±???????????????TLE

?§????W????\?¨k?????????????????????O((2n)*(2n))????????????????????????§?????§

================================================================
*/

/* Coordinate_Compression : ?§????W????\?¨k*/
class CC {
public:
	ll N;
	vector<ll> xs; // ?????\??\??p:xs[x1 or x2?????¬Y???¶???¶] := ?\??\?????§????W

	CC(ll N) :N(N) {}
	// x1, x2???£??§????W????\?¨k????, ?§????W????\?¨k?????????§??¬???????????£???????????
	int compress(vector<ll>& x1, vector<ll>& x2, ll MIN_W = -1e10, ll MAX_W = 1e10) {
		for (int i = 0; i < N;i++) {
			ll tx1 = x1[i], tx2 = x2[i];
			if (MIN_W <= tx1 && tx1 <= MAX_W) xs.push_back(tx1);
			if (MIN_W <= tx2 && tx2 <= MAX_W) xs.push_back(tx2);
		}

		sort(xs.begin(), xs.end());
		xs.erase(unique(xs.begin(), xs.end()), xs.end());

		for (int i = 0; i < N;i++) {
			x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
			x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
		}

		return (int)xs.size();
	}
};

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

void dfs(int ny, int nx, vector<vector<int>>& masu, int range_h, int range_w) {
	masu[ny][nx] = 1;
	for (int i = 0; i < 4;i++) {
		int next_y = ny + dy[i];
		int next_w = nx + dx[i];
		if (next_y < 0 || next_y >= range_h)continue;
		if (next_w < 0 || next_w >= range_w)continue;
		if(masu[next_y][next_w] == 0) dfs(next_y, next_w, masu, range_h, range_w);
	}
}

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll w, h; 
        while(cin >> w >> h){
       if(w == 0 && h == 0) break;
	ll N; cin >> N;
	vector<ll> x1(N+1), y1(N+1), x2(N+1), y2(N+1);
	x1[N] = 0, y1[N] = 0, x2[N] = w, y2[N] = h;
	for (int i = 0; i < N;i++) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];

	CC CCx(N+1), CCy(N+1);
	ll W = CCx.compress(x1, x2, 0, w);
	ll H = CCy.compress(y1, y2, 0, h);

	vector<vector<int>> masu(H-1, vector<int>(W-1, 0));

	for (int i = 0; i < N;i++) {
		for (int j = x1[i]; j < x2[i];j++) {
			for (int k = y1[i]; k < y2[i];k++) {
				masu[k][j] = 1;
			}
		}
	}

	ll res = 0;
	for (int i = 0; i < H - 1;i++) {
		for (int j = 0; j < W - 1;j++) {
			if (masu[i][j] == 0) {
				res++;
				dfs(i, j, masu, H - 1, W - 1);
			}
		}
	}
	cout << res << endl;
       }
	return 0;
}

Measured memory_bytes: 8352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
using namespace std;

long long mod = 1000000007;



int main()
{
	int N,M[100][100];
	cin >> N;

	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			M[i][j] = 0;
		}
	}

	int u, k, v;
	for (int i = 0; i < N; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}


	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (j == 0)
				cout << M[i][j];
			else
				cout << " " << M[i][j];
		}
		cout << endl;
	}


	


	return 0;
}




Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#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()
typedef long long ll;
typedef unsigned long long ull;


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

  S[3] = '8';

  cout << S << endl;
  
  return 0;
}


Measured memory_bytes: 256
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define FP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define FS(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define IT(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)

#define eps 1e-6
#define pi 3.141592653589793
using namespace std;

template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector< pair<int, int> > VPII;
typedef vector< pair<int, PII > > VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

int main(int argc, char* argv[])
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	VII arr(n);
	for(auto &x:arr)cin>>x;
	if(n==1)cout<<0;
	else {
	    //for(auto x:arr)cout<<x<<' ';
	    ll ans=INT_MAX;
	    for(int i=1;i<=100;++i)
        {
	        ll tmp=0;
	        for(auto gg:arr){
	            tmp=tmp+pow(gg-i,2);
	        }
	        ans=min(ans,tmp);
        }
        cout<<ans;
	}


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define f first
#define s second
#define mk make_pair
#define MOD 1000000007
vector<string> ans;
void calc(string s,ll n,char mx)
{
	if(s.length()==n)
	{
		ans.pb(s);
		return;
	}
	char cur='a';
	while(cur<=mx)
	{
		calc(s+cur,n,mx);
		cur++;
	}
	calc(s+char(mx+1),n,mx+1);
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	ll n;
	cin>>n;
	if(n==1)
	cout<<"a";
	// else if(n==2)
	// {
	// 	cout<<"aa\nab\n";
	// }
	// else if(n==3)
	// {
	// 	cout<<"aaa\naab\naba\nabb\nabc\n";
	// }
	// else if(n==4)
	// {
	// 	cout<<"aaaa\naaab\naaba\naabb\naabc\nabaa\nabab\nabba\nabbb\nabbc\nabca\nabcb\nabcc\nabcd\n";
	// }
	// cout<<"a";
	else
	{
		string s="a";
		calc(s,n,'a');
		sort(ans.begin(),ans.end());
		for(ll i=0;i<ans.size();i++)
		cout<<ans[i]<<"\n";
	}
  return 0;
}


Measured memory_bytes: 7796
#include <stdio.h>
int main(){
	int i,x,y;
	for(i=1;;i++){
		scanf("%d %d",&x,&y);
		if(x==0 && y==0){
			break;
		}
		else if(x<=y){
			printf("%d %d\n",x,y);
		}
		else{
			printf("%d %d\n",y,x);
		}
	}
	
	return 0 ;
}

Measured memory_bytes: 2560
using System;
class Program
{
    static void Main()
    {
        var s = Console.ReadLine();
        var t = Console.ReadLine();
        var judge = false;
        for (int i = 0; i < t.Length; i++)
        {
            if (s == t) judge = true;
            t = t.Substring(1) + t[0].ToString();
        }
        Console.WriteLine(judge ? "Yes" : "No");
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

int main()
{
  int n, k;
  while(cin >> n >> k){
    if(k == 1) cout << 0 << endl;
    else cout << (n - k) << endl;
  }
  return 0;
}


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

int main(void) {
  ll n, t;
  cin >> n >> t;

  ll T[n];
  rep (i, n) cin >> T[i];

  ll ans = 0;

  for (int i = 1; i < n; i++) {
    if (T[i] - T[i - 1] >= t) {
      ans += t;
    }
    else ans += T[i] - T[i - 1];
  }
  cout << ans + t << endl;
  return 0;
}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W = map(int, input().split())
    S = [list(list(input().rstrip())) for _ in range(H)]

    CW = [[0] * W for _ in range(H)]
    for h in range(H):
        cnt = 0
        for w in range(W):
            if S[h][w] == "#":
                cnt = 0
            else:
                cnt += 1
                CW[h][w] = cnt
        cnt = 0
        for w in reversed(range(W)):
            if S[h][w] == ".":
                cnt = max(cnt, CW[h][w])
                CW[h][w] = cnt
            else:
                cnt = 0

    CH = [[0] * W for _ in range(H)]
    for w in range(W):
        cnt = 0
        for h in range(H):
            if S[h][w] == "#":
                cnt = 0
            else:
                cnt += 1
                CH[h][w] = cnt
        cnt = 0
        for h in reversed(range(H)):
            if S[h][w] == ".":
                cnt = max(cnt, CH[h][w])
                CH[h][w] = cnt
            else:
                cnt = 0

    res = 0
    for h in range(H):
        for w in range(W):
            C = CW[h][w] + CH[h][w] - 1
            res = max(res, C)
    print(res)


if __name__ == '__main__':
    resolve()


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

#define rep(i,n) for(ll i=0;i<n;i++)
#define repm(i,m,n) for(ll i=m;i<n;i++)
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define YesNo(a) (a)?cout<<"Yes"<<endl:cout<<"No"<<endl
#define YESNO(a) (a)?cout<<"YES"<<endl:cout<<"NO"<<endl
#define INF (2e9)
#define PI (acos(-1))
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007

typedef long long ll;

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

  int change = 1000 - a%1000;
  if(change == 1000) change = 0;

  cout << change << endl;
}

Measured memory_bytes: 3612
// Code for B - Crane and Turtle
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

int main() {
  int X, Y;

  cin >> X >> Y;

  FOR(i, 0, X + 1) {
    if (i * 2 + (X - i) * 4 == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3628
fun main(args:Array<String>){
  var c = readLine()
  when(c){
    "a" -> println("vowel")
    "i" -> println("vowel")
    "u" -> println("vowel")
    "e" -> println("vowel")
    "o" -> println("vowel")
    else -> println("consonant")
  }
}

Measured memory_bytes: 31656
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

int main()
{
	int a1, a2, a3;

	cin >> a1 >> a2 >> a3;

	int cost = 9999;

	cost = min(cost, abs(a1 - a2) + abs(a2 - a3));
	cost = min(cost, abs(a1 - a3) + abs(a3 - a2));
	cost = min(cost, abs(a2 - a1) + abs(a1 - a3));
	cost = min(cost, abs(a2 - a3) + abs(a3 - a1));
	cost = min(cost, abs(a3 - a1) + abs(a1 - a2));
	cost = min(cost, abs(a3 - a2) + abs(a2 - a1));

	cout << cost << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  
  vector<int> d(n);
  for(int i=0; i<n; i++){
    cin >> d[i];
  }
 
  int sum=0;
  for(int j=0; j<n-1; j++){
    for(int k=j+1; k<n; k++){
      sum = sum + (d[j]*d[k]);
    }
  }
  
  cout << sum << endl;
  
  
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<MOD>;

int N;
vector<vector<int>> G;
int cnt[202020];
mint beki[202020];
mint dp[202020];
int dfs1(int v, int pv) {
    cnt[v] = 1;
    for (auto nv: G[v]) {
        if (nv == pv) continue;
        cnt[v] += dfs1(nv,v);
    }
    return cnt[v];
}

void dfs2(int v, int pv, int k) {
    dp[v] = beki[N-1]-1;
    dp[v] -= (beki[k]-1);
    for (auto nv : G[v]) {
        if (nv == pv) continue;
        dp[v] -= (beki[cnt[nv]]-1);
        dfs2(nv,v,N - cnt[nv]);
    }
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> N;
    G.resize(N);
    rep(i,N-1) {
        int u,v; cin >> u >> v;
        --u; --v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    beki[0] = 1;
    rep(i,N) beki[i+1] = beki[i]*2;
    dfs1(0,-1);
    dfs2(0,-1,0);

    mint ans = 0;
    rep(i,N) ans += dp[i];
    ans /= beki[N];
    cout << ans.a << ln;
}

Measured memory_bytes: 24064
N,*M = map(int,input().split())
abc = [list(map(int,input().split())) for _ in [0]*N]
INF = 100*40*100
dp = [[[INF]*500 for _ in [0]*500] for _ in [0]*(N+1)]
dp[0][0][0] = 0
for i in range(1,N+1):
    a,b,c = abc[i-1]
    for j in range(410):
        for k in range(410):
            dp[i][j][k] = min(dp[i-1][j][k],dp[i-1][j-a][k-b]+c)
ans = min([dp[-1][M[0]*i][M[1]*i] for i in range(1,1+400//(max(M)))])
if ans == INF:ans=-1
print(ans)

Measured memory_bytes: 122204
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
#define MAXN 200000
#define ll long long
#define Trav(p) for(rint u = first[p], v; ~u; u = e[u].nex)
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
#define BUF_SIZE 1000000
#define _END fwrite(_Ob,1,_O-_Ob,stdout), _O = _Ob
#define Outc(a) (*_O++ = a)
char _Ob[BUF_SIZE+5], *_O = _Ob, _Os[25], *_Ot;
template <typename T> inline void Out(T x)
{
	if(!x){Outc('0'); return;} if(x < 0) Outc('-'), x = -x;
	for(_Ot = _Os; x; *_Ot++ = x%10+'0', x /= 10);
	for(; _Ot != _Os; Outc(*--_Ot)); if(_O-_Ob >= BUF_SIZE-50) _END;
}
int first[MAXN+5], sz[MAXN+5], mx[MAXN+5], o[MAXN+5], fa[MAXN+5], X[MAXN+5], sum, tot, top, rt, n, m; ll d[MAXN+5], ans; bool book[MAXN+5];
struct Edge{int to,nex,w; Edge(){} Edge(int _to, int _nex, int _w){to=_to,nex=_nex,w=_w;}}e[(MAXN<<1)+5];
struct E{int u,v; ll w; E(){} E(int _u, int _v, ll _w){u=_u,v=_v,w=_w;}}ed[(MAXN<<5)+5]; inline bool operator < (E a, E b){return a.w < b.w;}
inline void Add(int a, int b, ll w){e[tot] = Edge(b,first[a],w), first[a] = tot++, e[tot] = Edge(a,first[b],w), first[b] = tot++;}
void DFS_sz(int p, int fa){sz[p] = 1, mx[p] = 0; Trav(p) if(!book[v=e[u].to] && v-fa) DFS_sz(v,p), sz[p] += sz[v], mx[p] = max(mx[p],sz[v]);}
void DFS_rt(int p, int fa){(mx[p]=max(mx[p],sum-sz[p]))<mx[rt]?rt=p:0; Trav(p) if(!book[v=e[u].to] && v-fa) DFS_rt(v,p);}
void DFS_d(int p, int fa){o[++top] = p; Trav(p) if(!book[v=e[u].to] && v-fa) d[v] = d[p]+e[u].w, DFS_d(v,p);}
void DCT(int p)
{
	DFS_sz(p,0), sum = sz[p], rt = p, DFS_rt(p,0), p = rt, book[p] = true, d[p] = top = 0, DFS_d(p,0);
	rt = p, d[p] += X[p]; for(rint i = 2; i <= top; (d[o[i]]+=X[o[i]])<d[rt] ? rt = o[i] : 0, i++);
	for(rint i = 1; i <= top; ed[++m] = E(rt,o[i],d[rt]+d[o[i]]), i++); Trav(p) if(!book[v=e[u].to]) DCT(v);
}
inline int getf(int x){return x-fa[x] ? fa[x] = getf(fa[x]) : x;} inline bool Union(int x, int y){return (x=getf(x))-(y=getf(y)) ? fa[x] = y, true : false;}
int main()
{
	n = read(), memset(first+1,-1,n<<2); for(rint i = 1; i <= n; fa[i] = i, X[i++] = read());
	for(rint i = 2, u, v; i <= n; u = read(), v = read(), Add(u,v,read()), i++); DCT(1), sort(ed+1,ed+m+1);
	for(rint i = 1, c = ~-n; i <= m && n; Union(ed[i].u,ed[i].v) ? --c, ans += ed[i].w : 0, i++);
	printf("%lld\n",ans); return 0;
}

Measured memory_bytes: 75648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;
void hyouji(int a[], int n){
    int i;
    for(i=0; i<n-1; ++i){
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
}
int main() {
    int i, j, n, k, p, q,v;
    int num = 0;
    int temp = 0;
    int flag = 0;
    cin>>n;
    int r[n];
    for(i=0; i<n; ++i){
        cin>>r[i];
    }
    hyouji(r,n);
    for(i=1; i<n; ++i){
        v=r[i];
        j=i-1;
        while(j>=0&&r[j]>v) {
            r[j + 1] = r[j];
            --j;
        }
        r[j+1]=v;
        hyouji(r,n);
    }

    return 0;
}


Measured memory_bytes: 3088
# 169A
# 値 A × B を整数として出力せよ

# 1. 入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# print(a, b)

# 2. 受け取った入力値を使って、適切に処理(計算)すること
answer = a * b


# 3. 計算した結果を出力すること
print(answer)

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

typedef pair<int, int> P;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int N, X; cin >> N >> X;
    int d = 0, ans = 0;
    REP( i, N ){
        int l; cin >> l;
        d += l;
        if( d <= X ) ans++;
    }

    cout << ans + 1 << endl;
}


Measured memory_bytes: 256
def gcd(x,y):
	while y != 0:
		x , y = y , x % y
	return x

def lcm(x,y):
    return x*y//gcd(x,y)


n = int(input())

a =[]
for i in range(n):
    a.append(int(input()))

for i in range(n-1):
    a[i+1] = lcm(a[i],a[i+1])
print(a[-1])

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
using namespace std;
char a[105][105];

int sum[100];
int h, w;
int main()
{
    cin >> h >> w;
    memset(sum, 0, sizeof(sum));
    for(int i = 0; i < h; i++)
    {
        cin >> a[i];
        for(int j = 0; j < w; j++)
        {
            for(int k = 0; k < 26; k++)
            if(a[i][j] == k+'a')sum[k+1]++;
        }
    }
    int four = 0, two = 0, one = 0;
    for(int i = 0; i < h/2; i++)
    for(int j = 0; j < w/2; j++)
    {
        four++;
    }
    if(h%2 == 1 && w%2 == 1)
    {
        two = h/2+w/2;
        one = 1;
    }
    if(h%2 == 1 && w%2 == 0)two = w/2;
    if(h%2 == 0 && w%2 == 1)two = h/2;
    for(int i = 1; i <= 26; i++)
    {
        while(sum[i] >= 4 && four){four--;sum[i] -= 4;}
        while(sum[i] >= 2 && two){two--;sum[i] -= 2;}
        if(sum[i] == 1 && one){one--; sum[i] -= 1;}
        if(sum[i] != 0){cout << "No" << endl;return 0;}

    }
    cout << "Yes" << endl;
    return 0;
}


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

int main()
{
   string x;
   cin>>x;
   if(x=="Sunny")
        cout<<"Cloudy"<<endl;
    else if (x=="Cloudy")
        cout<<"Rainy"<<endl;
    else if (x=="Rainy")
        cout<<"Sunny"<<endl;

    return 0;


}

Measured memory_bytes: 3588
#include <stdio.h>
int main(void){
  int i;
  int len,b;
  char aa[200],bb[100],cc[100];
  int ia,ib,ic;
  scanf("%s",&aa);
//    printf("aa:%s len %d\n",aa,strlen(aa));
	for(i=0;i<strlen(aa);i++){
		printf("x");
    }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1(x,n) for(int x = 1; x <= n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	int n,m;
	cin>>n>>m;

	set<int> s;
	vector<pi >v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i].se>>v[i].fi;
	}

	sort(v.begin(),v.end());
	for(int i=1;i<=m;i++)
	{
		s.insert(i);
	}
	int day;
	ll total=0;
	for(int i=n-1;i>=0;i--)
	{
		day = m - (v[i].se-1);
		if(s.upper_bound(day)==s.begin())
			continue;

		auto it = *prev(s.upper_bound(day));
		s.erase(it);
		//debug(v[i].fi);
		total += v[i].fi;
		
		if(s.empty()==true)
			break;
	}
	cout<<total<<endl;



	
	return 0;	
}

Measured memory_bytes: 5760
import string
a=string.ascii_lowercase
N=int(input())
ans=[]
count=1
n=26
s=0
while N>n:
    count+=1
    s=n
    n+=26**count
N-=s+1
for i in range(count):
    n=N//26
    m=N%26
    ans.append(a[m])
    N=n
Ans=[]
for i in range(len(ans)):
    Ans.append(ans[len(ans)-i-1])
print("".join(Ans))

Measured memory_bytes: 9976
#include <bits/stdc++.h>
using namespace std;
const int N = 110, M = 10010;
int W, n;
int w[N], v[N];
int dp[N][M];
int main(){
    scanf("%d %d", &n, &W);
    for(int i = 0; i < n; i++) scanf("%d %d", &v[i], &w[i]);
    for(int j = 0; j <= W; j++) dp[0][j] = 0;
    for(int i = 0; i < n; i++) dp[i][0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= W; j++)
            dp[i+1][j] = (w[i] > j) ? dp[i][j] : max(dp[i][j], dp[i+1][j-w[i]] + v[i]);
    }
    printf("%d\n", dp[n][W]);
    return 0;
}


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

using namespace std;

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;

  vector<int> v;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  v.push_back(d);
  v.push_back(e);

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

  if(v[4] - v[0] > k) cout << ":(\n";
  else cout << "Yay!\n";

  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int,input().split()))
MOD = 10**9+7

cnt_a = 0
cnt_b = 0
for i in range(n-1):
    for j in range(i+1,n):
        cnt_a += 1 if a[i] > a[j] else 0
        cnt_b += 1 if a[i] < a[j] else 0
ans = cnt_a * (1+k)*k//2
ans += cnt_b * (1+k-1)*(k-1)//2

# print(cnt_a)
print(ans%MOD)

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

const int md = 1e9 + 7;

int main(void)
{
	ios_base::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<bool> a(n, false);
	for(int i = 0; i < k; i++) {
                int x;
                cin >> x;
                a[x] = true;
	}
	long long x = 1, y = 0, z = 1;
	if(!a[1])
                y++;
        for(int i = 2; i <= n; i++) {
                z = (x + y) % md;
                if(a[i])
                        z = 0;
                x = y;
                y = z;
        }
        cout << z;
	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E solver = new E();
        solver.solve(1, in, out);
        out.close();
    }

    static class E {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            long[] a = new long[n];
            long sum = 0;
            for (int i = 0; i < n; i++) {
                a[i] = Long.parseLong(in.next());
                sum ^= a[i];
            }

            // 出力
            for (int i = 0; i < n; i++) {
                out.printf("%d ", sum ^ a[i]);
            }
            out.println();

        }

    }
}



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

double mysqrt(double x){
	double l = 0 , r = x ;
	for(int i = 0 ; i < 64 ; i++){
		double m = (l+r)/2.0;
		if(m * m < x){
			l = m;
		}else{
			r = m;
		}
	}
	return l;
}


int main(){
	int p,n;
	while(cin >> p >> n , n){
		double sp = mysqrt(p);
		int a1 = 0 , b1 = 1 , a2 = p , b2 = 1;
		
		for(int i = 1 ; i <= n ; i++){
		
			int l = 0 , r = n;
			
			for(int x = 0 ; x < 14 ; x++){
				int m = (l+r+1)/2;
				if( (double)m/i < sp){
					if(__gcd(m,i)==1){
						if(m*b1 > a1*i){
							a1 = m;
							b1 = i;
						}
					}
					l = m;
				}else{
					r = m-1;
				}
			}
	
			l = 0 , r = n;
			for(int x = 0 ; x < 14 ; x++){
				int m = (l+r)/2;
				if( (double)m/i > sp){
					if(__gcd(m,i)==1){
						if(m*b2 < a2*i){
							a2 = m;
							b2 = i;
						}
					}
					r = m;
				}else{
					l = m+1;
				}
			}
			
		}

		cout << a2<< "/" << b2 << " " << a1 << "/" << b1 << endl;
	}
}

Measured memory_bytes: 868
/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-7-1 22:00:11
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

typedef tuple<int, int> D;

int N;
int A[300010];
int DP[300010];
int DP2[300010];

set<D> S[300010];

void make_S(int i)
{
  if (!S[i].empty())
  {
    return;
  }
  S[i].insert(D(-A[0], 0));
  S[i].insert(D(-A[i], i));
  for (auto j = 0; j < N; j++)
  {
    int mask = (1 << N) - 1 - (1 << j);
    int new_i = mask & i;
    if (new_i == i || new_i == 0)
    {
      continue;
    }
    make_S(new_i);
    auto it = S[new_i].begin();
    S[i].insert(*it);
    it++;
    S[i].insert(*it);
  }
}

int main()
{
  cin >> N;
  for (auto i = 0; i < (1 << N); i++)
  {
    cin >> A[i];
  }
  for (auto i = 0; i < (1 << N); i++)
  {
    make_S(i);
    auto it = S[i].begin();
    // cerr << "i = " << i << endl;
    // cerr << "(" << -get<0>(*it) << ", " << get<1>(*it) << ")" << endl;
    DP2[i] = -(get<0>(*it));
    it++;
    // cerr << "(" << -get<0>(*it) << ", " << get<1>(*it) << ")" << endl;
    DP2[i] += -(get<0>(*it));
  }
  // flush
  DP[0] = 0;
  for (auto i = 1; i < (1 << N); i++)
  {
    DP[i] = max(DP[i - 1], DP2[i]);
    cout << DP[i] << endl;
  }
}

Measured memory_bytes: 253824
#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int h, w;
    cin >> h >> w;
    int v [h+1][w+1];
    memset(v, -1, sizeof v);
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++) {
            char temp;
            cin >> temp;
            if(temp == '#') 
                v[i][j] = 0;
        }
    }
    for(int i=0; i<h; i++) {
        v[i][w] = 0;
    }
    for(int i=0; i<w; i++) {
        v[h][i] = 0;
    }
    v[h-1][w-1] = 1;
    for(int i = h-1; i>=0; i--) {
        for(int j = w-1; j>=0; j--) {
            if(v[i][j] == -1) {
                v[i][j] = (v[i+1][j] + v[i][j+1]) % mod;
            }
        }
    }
    cout << v[0][0] << '\n';
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;



int main(){
    int N, M;
    vector<pair<int, int>> v;
    priority_queue<int> q;
    cin >> N >> M;
    for (int i = 0; i < N; ++i){
        int a, b;
        cin >> a >> b;
        v.push_back(make_pair(a, b)); 
    }
    sort(v.begin(), v.end());

    int j = 0, ans = 0; 
    for (int i = 1; i <= M; ++i){
        while(j < N && v[j].first <= i){
            q.push(v[j++].second);
        }
        if (!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1908
n=int(input())
s=input()
'''
k=int(input())
a,b,c=map(int,input().split())
a=[int(i) in range(n)]
a=[0]*n
for i in range(n):
    a.append(int(i))
'''
pre=0
b=[0]*n
w=[0]*n

for i in range(n):
    if s[i]=='#':
        cc=1
    else:
        cc=0
    b[i]=pre+cc
    pre+=cc
tb=b[n-1]
for i in range(n):
    w[i]=n-(i+1)-(tb-b[i])

#print(s,b,w)
ans=min(n,w[0])
for i in range(n):
    ans=min(ans,b[i]+w[i])
    
print(ans)

Measured memory_bytes: 19128
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long mod2 = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

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

  int fir = stoi(S.substr(0, 2));
  int sec = stoi(S.substr(2, 2));
  string ans;
  bool yymm = true, mmyy = true;
  if (fir == 0 || fir > 12) mmyy = false;
  if (sec == 0 || sec > 12) yymm = false;
  if (mmyy)
  {
    if (yymm) ans = "AMBIGUOUS";
    else ans = "MMYY";
  }
  else
  {
    if (yymm) ans = "YYMM";
    else ans = "NA";
  }
  
  cout << ans << endl;
}

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

int N;
const int MAX_N = 100;
int A[MAX_N];

int main()
{
  cin >> N;
  for (int i = 0; i < N; ++i)
  {
    cin >> A[i];
  }
  double res = 0;
  for (int i = 0; i < N; ++i)
  {
    res += 1. / A[i];
  }
  res = 1. / res;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void show_me(int *a, size_t size)
{
    for (size_t i = 0; i < size; ++i)
    {
        cout << (i == 0 ? "" : " ") << a[i];
    }
    cout << endl;
}

void do_bubble_sort(int *a, size_t size)
{
    for (size_t j = 1; j < size; ++j)
    {
        int v = a[j];
        int i = j - 1;
        while (i >= 0 && a[i] > v)
        {
            a[i + 1] = a[i];
            --i;
        }
        a[i + 1] = v;
        show_me(a, size);
    }
}

int main()
{
    int a[100] = {};
    size_t size;
    cin >> size;
    for (size_t i = 0; i < size; ++i)
    {
        cin >> a[i];
    }
    show_me(a, size);
    do_bubble_sort(a, size);

    return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include <cmath>
#include <set>
#include <complex>
#include <queue>
#include <functional>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define all(a) a.begin(), a.end()
#define N 500000

const long long int  inf = 1e15 ;
const int M = 1e9+7;

typedef long long int LL;
typedef pair<LL,LL>pii;
LL n,w;
std::vector<pii> v;

LL dp[N];
LL temp[N];


int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>w;
	for (int i = 1; i <= n; ++i)
	{
		LL a,b;
		cin >>a>>b;
		v.push_back(make_pair(a,b));
	}

	for (int i = 0; i < N; ++i)
	{
		dp[i]=-1;
	}
	dp[0]=w;

	for (int i = 0; i < v.size(); ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			temp[j]=dp[j];
		}
		for (int j = 0; j < N; ++j)
		{
			if(v[i].first <= dp[j])
			{
				temp[j+v[i].second] = max(temp[j+v[i].second], dp[j]-v[i].first);
			}
		}
		for (int j = 0; j < N; ++j)
		{
			dp[j]=temp[j];
		}
	}
	LL ans=0;
	for (LL i = 0; i < N; ++i)
	{
		// cout << dp[i]<<endl;
		if(dp[i]>=0)
		{
			ans=max(ans,i);
		}
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N,M;
	cin >> N >> M;
	map<int,vector<int>> ma;
	for(int i = 0;i < N;i++) {
		int A,B;
		cin >> A >> B;
		ma[A].push_back(B);
	}
	priority_queue<int> que;
	int ret = 0;
	for(int i = 0;i < M;i++) {
		for(int j = 0;j < ma[i + 1].size();j++) {
			que.push(ma[i + 1].at(j));
		}
		if(!que.empty()) {
          	ret += que.top();
          	que.pop();
        }
	}
	cout << ret << endl;
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}

signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n=read(),m=read();
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=(read()>=m);
	}
	cout<<ans<<endl;
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int INF = 1e9+7;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<pair<ll, ll> > xy(N, pair<ll, ll>());
  REP(i, N){
    ll x, y; cin >> x >> y;
    xy[i] = {x, y};
  }
  ll ans = N;
  REP(i, N){
    REP(j, N){
      if(i == j) continue;
      ll p = xy[i].first - xy[j].first;
      ll q = xy[i].second - xy[j].second;
      ll res = 0;
      REP(k, N){
        REP(l, N){
          if(k == l) continue;
          if(p == xy[k].first-xy[l].first && q == xy[k].second-xy[l].second){
            res++;
            break;
          }
        }
      }
      ans = min(ans, N-res);
    }
  }  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		String s = sc.next();
		StringBuilder ans = new StringBuilder();
		for(int i = 0; i < s.length(); i++){
			if(s.charAt(i) == 'S')
				ans.append("S");
			else{
				if(ans.length() != 0 && ans.charAt(ans.length()-1) == 'S'){
					ans.delete(ans.length()-1, ans.length());
				}else
					ans.append("T");
			}
		}
		System.out.println(ans.length());
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 22612
#include <stdio.h>
long gcd_euclid(long m, long n) {
    long temp;
    while (n) {
        temp = m % n;
        m = n;
        n = temp;
        } 
        return m;
        }
        int main(){
            long a, b;
            long temp;
            long gcd, lcm;
            while(scanf("%ld %ld", &a, &b)!=EOF){
             gcd = gcd_euclid(a, b);
             temp = a / gcd;
             lcm = temp * b;
             printf("%ld\n", gcd);
             }
             return 0; 
            
} 


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

struct StCond                  // 材料質量・限界量
{
  int m_nWaterA;
  int m_nWaterB;
  int m_nSugerC;
  int m_nSugerD;
  double m_nConcE;
  int m_nLimitF;
};

struct StAmt                   // 使用量
{
  StAmt() : m_nAmtA(0), m_nAmtB(0), m_nAmtC(0), m_nAmtD(0) { }

  int m_nAmtA, m_nAmtB, m_nAmtC, m_nAmtD;
};

struct StRslt                  // 出力結果
{
  StRslt() : m_nAllMass(0), m_nSugerMass(0) { }

  int m_nAllMass, m_nSugerMass;
};

void fnInput(StCond& roCond)
{
  cin >> roCond.m_nWaterA >> roCond.m_nWaterB >> roCond.m_nSugerC >> roCond.m_nSugerD;
  cin >> roCond.m_nConcE  >> roCond.m_nLimitF;
}

int fnAmtProc(string sProc, const StCond& cnroCond, StAmt& roAmt)
{ 
  if (sProc[0] == 'c')
  {
    if      (sProc[3] == 'A')
      { roAmt.m_nAmtA = 0; roAmt.m_nAmtB = 0; roAmt.m_nAmtC = 0; roAmt.m_nAmtD = 0; }
    else if (sProc[3] == 'B')
      { roAmt.m_nAmtB = 0; roAmt.m_nAmtC = 0; roAmt.m_nAmtD = 0; }
    else if (sProc[3] == 'C')
      { roAmt.m_nAmtC = 0; roAmt.m_nAmtD = 0; }
    else if (sProc[3] == 'D')
      { roAmt.m_nAmtD = 0; }
    return 0;
  }
  else                         // sProc[0] == 's'
    if      (sProc[3] == 'A')
      return  (cnroCond.m_nWaterA * roAmt.m_nAmtA + cnroCond.m_nWaterB * roAmt.m_nAmtB) * 100
            + (cnroCond.m_nSugerC * roAmt.m_nAmtC + cnroCond.m_nSugerD * roAmt.m_nAmtD);
    else                       // sProc[3] == 'S'         
      return  (cnroCond.m_nSugerC * roAmt.m_nAmtC + cnroCond.m_nSugerD * roAmt.m_nAmtD);
}

double fnConcCalc(const StCond& cnroCond, StAmt& roAmt)
{
  double nLimtConc = cnroCond.m_nConcE / (100.0 + cnroCond.m_nConcE);
  double nNowConc =  (double)fnAmtProc("sumSUG", cnroCond, roAmt)
                   / (double)fnAmtProc("sumALL", cnroCond, roAmt);

  if (nLimtConc < nNowConc)  return 0.0;
  else                       return nNowConc;
}

void fnConcCheck(const StCond& cnroCond, StRslt& roRslt)
{
  StAmt oAmt;
  double nMaxConc = -1.0;

  fnAmtProc("clrA", cnroCond, oAmt);
  while (true)
  {
    fnAmtProc("clrB", cnroCond, oAmt);
    if (fnAmtProc("sumALL", cnroCond, oAmt) > cnroCond.m_nLimitF)  break;

    if (!oAmt.m_nAmtA)  oAmt.m_nAmtB = 1;
    while (true)
    {
      fnAmtProc("clrC", cnroCond, oAmt);
      if (fnAmtProc("sumALL", cnroCond, oAmt) > cnroCond.m_nLimitF)  break;

      while (true)
      {
        fnAmtProc("clrD", cnroCond, oAmt);
        if (fnAmtProc("sumALL", cnroCond, oAmt) > cnroCond.m_nLimitF)  break;

        while (true)
        {
          if (fnAmtProc("sumALL", cnroCond, oAmt) > cnroCond.m_nLimitF)  break;

          double nNowConc = fnConcCalc(cnroCond, oAmt);
          if (nMaxConc < nNowConc)
          {
            nMaxConc = nNowConc;
            roRslt.m_nAllMass = fnAmtProc("sumALL", cnroCond, oAmt);
            roRslt.m_nSugerMass = fnAmtProc("sumSUG", cnroCond, oAmt);
          }
          oAmt.m_nAmtD++;
        }
        oAmt.m_nAmtC++;
      }
      oAmt.m_nAmtB++;
    }
    oAmt.m_nAmtA++;
  }
}

int main()
{
  StCond oCond;
  StRslt oRslt;

  fnInput(oCond);
  fnConcCheck(oCond, oRslt);
  cout << oRslt.m_nAllMass << " " << oRslt.m_nSugerMass << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int MAX=1e5+1;
int min_val=MAX;
int n,k;
vector<int> dp(MAX);
vector<int> arr(100);
int calc(int left){
    if(left<min_val){
        return 0;
    }
    if(dp[left]!=-1){
        return dp[left];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(left>=arr[i]){
            int val=1-calc(left-arr[i]);
            if(val>0){
                ans=1;
                break;
            }
        }
    }
    return dp[left]=ans;
}
void solve(){
    cin>>n>>k;
    dp.assign(k+1,-1);
    for(int i=0;i<n;i++){
        cin>>arr[i];
        min_val=min(min_val,arr[i]);
    }
    int result=calc(k);
    if(result==1){
        cout<<"First"<<'\n';
    }
    else{
        cout<<"Second"<<'\n';
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


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

#define st first
#define nd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;

int main(){
	setIO();
	ld a, b, x;
	cin>>a>>b;
	x = a*b;
	cout<<(ll)trunc(x)<<endl;

}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define ll long long
#define pp push_back
#define fr first
#define sc second

using namespace std;



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

    ll x = 1;
    cin >> x;
    for(ll a = -1000;a <=1000;a++){
        for(ll b = -1000;b <= 1000;b++){
            if(x == ((a*a*a*a*a)-(b*b*b*b*b)))
                return cout << a << ' ' << b << '\n' ,0;
        }
    }

    return 0;
}


Measured memory_bytes: 3640
def ABC_81_B():
    N=int(input())
    A = input().split()
    A = [int(s) for s in A]
    c=0

    for i in range(100):
        for j in range(N-1):
            if A[j]%2 != 0:
                break
            A[j] = A[j]/2
        else:
            c+=1
            continue
        break

    print(c)

if __name__ == '__main__':

    ABC_81_B()

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

int main(){
  string S;
  cin >> S;
  for(int i=0;i<5;i++){
    cout << S.at(i);
  }
  cout << " ";
  for(int i=6;i<13;i++){
     cout << S.at(i);
  }
  cout << " ";
  for(int i=14;i<19;i++){
     cout << S.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		String w=sc.next();
		String ans="Yes";
		int l=w.length();
		for(int i=0;i<l;i++) {
			char x=w.charAt(i);
			int count=0;
			for(int j=0;j<l;j++) {
				if(w.charAt(i)==w.charAt(j)){
					count++;
				}
			}
			if(count%2!=0) {
				ans="No";	
			}
		}
		System.out.println(ans);
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}





Measured memory_bytes: 22100