akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const long double EPS = 1e-14;
const long double INF = 1e+20;
const long double PI = acos(-1);
char S[110000];
char T[110000];
int bit[2][110000];
int sum(int a,int b,int c){
	if(a)return sum(0,b,c)-sum(0,a-1,c);
	int ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret+=bit[c][b];
	return ret;
}
void add(int a,int b,int c){
	for(;a<110000;a|=a+1)bit[c][a]+=b;
}
int main(){
	int a;
	scanf("%s%s%d",S,T,&a);
	for(int i=0;S[i];i++){
		if(S[i]=='A')add(i,1,0);
		else add(i,2,0);
	}
	for(int i=0;T[i];i++){
		if(T[i]=='A')add(i,1,1);
		else add(i,2,1);
	}
	while(a--){
		int p,q,r,s;
		scanf("%d%d%d%d",&p,&q,&r,&s);
		p--;q--;r--;s--;
		if(sum(p,q,0)%3==sum(r,s,1)%3){
			printf("YES\n");
		}else printf("NO\n");
	}
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll n;
    cin >> n;
    Vi a(n);
    ll sum=0;
    rp(i,n){
        cin >> a.at(i);
        a.at(i) -= 1+i;
    }
    sort(all(a));
    ll b=a[n/2];
    rp(i,n){
        sum += llabs(a[i]-b);
    }
    print(sum);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int pow3[16];
void init(){
	pow3[0]=1;
	rep(i,15){
		pow3[i+1]=pow3[i]*3;
	}
}
struct Cup{
	vint A,B,C;
	bool operator==(const Cup& r) const{
		return A==r.A&&B==r.B&&C==r.C;
	}
};
int para(Cup c){
	int ans=0;
	rep(i,c.B.size()){
		ans+=pow3[c.B[i]];
	}
	rep(i,c.C.size()){
		ans+=pow3[c.C[i]]*2;
	}
	return ans;
}
int main(){
	init();
	while(1){
		int N,M;
		scan(N);scan(M);
		if(N==0&&M==0) break;
		Cup ini;
		map<int,int> tesu;
		int an,bn,cn;
		scan(an);
		rep(i,an){
			int a; scan(a); ini.A.push_back(a);
		}
		scan(bn);
		rep(i,bn){
			int a; scan(a); ini.B.push_back(a);
		}
		scan(cn);
		rep(i,cn){
			int a; scan(a); ini.C.push_back(a);
		}
		Cup goal1,goal2;
		rep1(i,N){
			goal1.A.push_back(i);
		}
		rep1(i,N){
			goal2.C.push_back(i);
		}
		if(ini==goal1||ini==goal2){
			prin(0);
			continue;
		}
		int g1para=para(goal1),g2para=para(goal2);
		vector<Cup> record;
		record.push_back(ini);
		tesu[para(ini)]=-INF;
		for(int count=1;count<=M;count++){
			if(record.empty()||tesu[g1para]>0||tesu[g2para]>0) break;
			vector<Cup> before=record;
			record.clear();
			rep(i,before.size()){
				rep(k,4){
					Cup now=before[i];
					if(k==0){
						if(now.A.empty()) continue;
						if(now.B.empty()||now.A.back()>now.B.back()){
							int move=now.A.back();
							now.A.pop_back();
							now.B.push_back(move);
						}
					}
					else if(k==1){
						if(now.C.empty()) continue;
						if(now.B.empty()||now.C.back()>now.B.back()){
							int move=now.C.back();
							now.C.pop_back();
							now.B.push_back(move);
						}
					}
					else if(k==2){
						if(now.B.empty()) continue;
						if(now.A.empty()||now.B.back()>now.A.back()){
							int move=now.B.back();
							now.B.pop_back();
							now.A.push_back(move);
						}
					}
					else{
						if(now.B.empty()) continue;
						if(now.C.empty()||now.B.back()>now.C.back()){
							int move=now.B.back();
							now.B.pop_back();
							now.C.push_back(move);
						}
					}
					int nowpara=para(now);
					if(tesu[nowpara]==0){
						tesu[nowpara]=count;
						record.push_back(now);
					}
				}
			}
		}
		if(tesu[g1para]==0&&tesu[g2para]==0) prin(-1);
		else if(tesu[g1para]==0) prin(tesu[g2para]);
		else if(tesu[g2para]==0) prin(tesu[g1para]);
		else prin(min(tesu[g1para],tesu[g2para]));
	}


	return 0;
}



Measured memory_bytes: 120496
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
#include<string>
#include<iomanip>
using namespace std;
int main() {
	string s,mae,usiro,gyaku;
	cin >> s;
	mae = s.substr(0, s.length() / 2);
//	cout << mae << endl;
	usiro = s.substr(s.length() / 2 + 1, s.length() - 1);
//	cout << usiro << endl;
	gyaku = mae;
	reverse(gyaku.begin(),gyaku.end());
	if(mae == usiro && mae == gyaku) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>

#include <cstring>

using namespace std;

#define FOR(var,start,end) for(int var=start; var<end; var++)
#define REP(var,cnt) FOR(var,0,cnt)

int main(void) {
	char s[105], t[105];
	cin >> s;
	cin >> t;
	
	sort(s, s+strlen(s));
	sort(t, t+strlen(t), greater<char>());
	
	string sss(s);
	string ttt(t);
	
	if ( sss < ttt ) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstdio>
#include<map>
#include<set>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;



/*素因数分解*/
map<ll,ll> prime_factorization(ll m){

    map<ll,ll> tmp;
    for(ll i = 2;i * i <= m;i++){
        while(m % i == 0) {
            tmp[i]++;
            m /= i;
        }
    }
    if(m != 1){
        tmp[m] = 1;
    }
    return tmp;
}


int main(){

    ll n;
    cin >> n;
    map<ll,ll> mp;

    map<ll,ll>::iterator itr;
    for(int i = 1;i <= n;i++){
        //n!の素因数分解
        map<ll,ll> tmp = prime_factorization(i);
        for(itr = tmp.begin();itr != tmp.end();itr++){
            mp[itr->first] += itr->second;
        }
    }
    mp[1] = 1;

    ll ans = 0;
    //75乗のやつ
    for(itr=mp.begin();itr != mp.end();itr++){
        if(itr->second >= 74){
            ans++;
        }
    }

    map<ll,ll> a,b,c;//25×3用と5×5×3用と15×3用
    //25乗×3乗
    for(itr=mp.begin();itr != mp.end();itr++){
        if(itr->second >= 24){
            a[24]++;
        }
        if(itr->second >= 2){
            a[2]++;
            b[2]++;
        }
        if(itr->second >= 4){
            b[4]++;
        }
        if(itr->second >= 14){
            c[14]++;
        }
        if(itr->second >= 4){
            c[4]++;
        }
    }
    //25乗×3乗
   
    ans += a[24]*(a[2]-1);
    ans += b[4]*(b[4]-1)*(b[2]-2)/2;
    ans += c[14]*(c[4]-1);
    
    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

string s, t;
int dp[3030][3030];
char ans[3030];
int main(){
    cin >> s >> t;
    int ss = (int)s.size();
    int tt = (int)t.size();
    s = "*" + s;
    t = "*" + t;
    for(int i = 1;i <= ss;i++){
        for(int j = 1; j <= tt;j++){
            if(s[i] == t[j])dp[i][j] = dp[i - 1][j - 1] + 1;
            else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }
    int len = dp[ss][tt];
    int ll = len;
    while(len >= 1){
        if(s[ss] == t[tt]){
            ans[len] = s[ss];
            ss--;
            tt--;
            len--;
        }else if(dp[ss][tt] == dp[ss - 1][tt]){
            ss--;
        }else{
            tt--;
        }
    }
    for(int i = 1;i <= ll;i++){
        cout << ans[i];
    }
    cout << endl;
}

Measured memory_bytes: 35840
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
mint pow(mint x, ll ntimes) {
    mint ret = 1;
    while (ntimes > 0) {
        if ((ntimes & 1) == 1) {
            ret = ret * x;
        }
        x = x * x;
        ntimes >>= 1;
    }
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;
    cin >> n >> a >> b;
    mint ans = pow(mint(2),n)-mint(1);
    mint ta = mint(1);
    REP(i,a){
        ta *= mint(n-i);
    }
    REP(i,a){
        ta /= mint(i+1);
    }
    mint tb = mint(1);
    REP(i,b){
        tb *= mint(n-i);
    }
    REP(i,b){
        tb /= mint(i+1);
    }
    ans -= (ta+tb);
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n;
char p[260];
struct point {
	int x, ck, dir;
};
vector<point>Res;
vector<point> Add(int x, int mask) {
	vector <point> r, T;
	if (mask == 1) {
		r.push_back({ x,0,0 });
		r.push_back({ x,1,1 });
		return r;
	}
	if (!(mask&1)) {
		r.push_back({ x,0,0 });
		T = Add(x + 1, mask >> 1);
		r.insert(r.end(),T.begin(),T.end());
		r.push_back({ x,0,1 });
		return r;
	}
	r.push_back({ x,0,0 });
	T = Add(x + 1, mask >> 1);
	r.insert(r.end(), T.begin(), T.end());
	r.push_back({ x,0,1 });
	reverse(T.begin(), T.end());
	for (int i = 0; i < T.size(); i++)T[i].dir = !T[i].dir;
	r.push_back({ x,1,0 });
	r.insert(r.end(), T.begin(), T.end());
	r.push_back({ x,1,1 });
	return r;
}
struct PP {
	int x, y;
};
vector<PP>RR;
void Print(point a) {
	PP t1 = { a.x + a.dir, a.ck };
	PP t2 = { a.x + 1 - a.dir, a.ck };
	if (!RR.empty() && RR.back().x == t1.x && RR.back().y == t2.y) {
		RR.push_back(t2);
	}
	else {
		RR.push_back(t1);
		RR.push_back(t2);
	}
}
int main() {
	int i, j;
	scanf("%d", &n);
	scanf("%s", p);
	int s = 0;
	for (i = 0; i < (1 << n); i++) {
		int c = 0;
		if (p[i] == '0')c++, s++;
		for (j = 0; j < i; j++) {
			if ((i&j) == j) {
				if (p[j] == '0' && p[i] == '1') {
					puts("Impossible");
					return 0;
				}
				if (p[j] == '0')c--;
			}
		}
		if (c == 1) {
			vector<point>T = Add(0, i);
			Res.insert(Res.end(), T.begin(), T.end());
		}
	}
	puts("Possible");
	if (!s) {
		printf("0\n0 0\n");
		return 0;
	}
	for (auto &t : Res) {
		Print(t);
	}
	if (RR.back().x == RR[0].x && RR.back().y == RR[0].y)RR.pop_back();
	printf("%d\n", RR.size());
	RR.push_back(RR[0]);
	for(auto &t :RR)printf("%d %d\n", t.x, t.y);
}

Measured memory_bytes: 620
def main():
    numbers = list(map(str, input().split()))
    stuck = []

    for c in numbers :
        if c == '+':
            a = stuck.pop(-1)
            b = stuck.pop(-1)
            stuck.append(a + b)

        elif c == '-':
            a = stuck.pop(-1)
            b = stuck.pop(-1)
            stuck.append(b - a)

        elif c == '*' :
            a = stuck.pop(-1)
            b = stuck.pop(-1)
            stuck.append(a * b)

        else :
            stuck.append(int(c))

    print(stuck[0])

if __name__ == '__main__':
    main()



Measured memory_bytes: 5600
s=int(input())

def f(n):
    if n%2==0:
        return n//2
    return 3*n+1
ans=[s]

while True:
    x=ans.pop()
    ans.append(x)
    check=f(x)
    if check in ans:
        ans.append(check)
        print(len(ans))
        break
    else:
        ans.append(check)
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) (a).begin(), (a).end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { assert(x > 0); return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { assert(x > 0); return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { assert(x > 0); return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { assert(x > 0); return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
void fail() { cout << -1 << '\n'; exit(0); }
// const int INF  = 1<<30;
// const ll INFll = 1ll<<62;
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
// const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n; cin >> n;
  Vld a(n); cin >> a;
  Vll b(n);
  rep(i, n) b[i] = a[i] * 1e9 + 0.1;

  const int M2 = 51;
  const int M5 = 22;

  VVll cnt(M2, Vll(M5));
  rep(i, n) {
    int m2 = 0;
    while (b[i] % 2 == 0) {
      b[i] /= 2;
      ++m2;
    }
    int m5 = 0;
    while (b[i] % 5 == 0) {
      b[i] /= 5;
      ++m5;
    }
    ++cnt[m2][m5];
  }

  ll ans = 0;
  rep(i2, M2) rep(i5, M5) rep(j2, M2) rep(j5, M5) {
    if (min(i2 + j2, i5 + j5) >= 18) ans += cnt[i2][i5] * cnt[j2][j5];
  }

  rep(i2, M2) rep(i5, M5) {
    if (min(i2, i5) >= 9) ans -= cnt[i2][i5];
  }
  ans /= 2;

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 7992
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
ll pow1(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a;
		}
		a=a*a;
		b=b>>1;
	}
	return ans;
}
vector<pair<int,pair<int,int> > > v;
int main()
{
	int n,m,i,j,p,y;
	cin>>n>>m;
	for(i=0;i<m;i++)
	{
		cin>>p>>y;
		v.pb(mp(p,mp(y,i)));
	}
	sort(v.begin(),v.end());
	map<int,string> ma;
	int cnt = 1;
	for(i=0;i<m;i++)
	{
		// cout<<v[i].f<<endl;
		string tmp,arr;
		int val = v[i].f;
		if(i!= 0 && val != v[i-1].f)
			cnt = 1;
		while(val)
		{
			tmp.pb(char(val%10)+48);
			val /= 10;
		}
		reverse(tmp.begin(),tmp.end());
		if(tmp.size() < 6)
		{
			int num = tmp.size();
			tmp = "";
			for(j=0;j<6-num;j++)
				tmp.push_back('0');
			val = v[i].f;
			while(val)
			{
				arr.pb(char(val%10)+48);
				val /= 10;
			}
			reverse(arr.begin(),arr.end());
			tmp += arr;
		}
		// cout<<tmp<<endl;
		string tmp1,arr1;
		val = cnt;
		while(val)
		{
			tmp1.pb(char(val%10)+48);
			val /= 10;
		}
		reverse(tmp1.begin(),tmp1.end());
		if(tmp1.size() != 6)
		{
			int num = tmp1.size();
			tmp1 = "";
			for(j=0;j<6-num;j++)
				tmp1.push_back('0');
			val = cnt;
			while(val)
			{
				arr1.pb(char(val%10)+48);
				val /= 10;
			}
			reverse(arr1.begin(),arr1.end());
			tmp1 += arr1;
		}
		cnt++;
		ma[v[i].s.s] = tmp+tmp1;
	}
	map<int,string>:: iterator it = ma.begin();
	for(;it!=ma.end();it++)
		cout<<(it->s)<<endl;
	return 0;
}

Measured memory_bytes: 15220
open Printf open Scanf
module MyInt = struct
	let (+) = (+) let (-) = (-) let (/) = (/) let ( * ) = ( * ) let (mod) = (mod) let (%) = (mod) let (+=) r v = r := !r + v let (-=) r v = r := !r - v let ( *=) r v= r := !r * v let (/=) r v = r := !r / v
	(* let input_int_array n = Array.init n (fun _ -> Scanf.scanf " %d" (fun v -> v))	
	let get_int () = Scanf.scanf " %d" (fun v -> v)
	let get_2_ints () = Scanf.scanf " %d %d" (fun u v -> u,v)
	let get_3_ints () = Scanf.scanf " %d %d %d" (fun u v w -> u,v,w)
	let get_4_ints () = Scanf.scanf " %d %d %d %d" (fun u v w x -> u,v,w,x)
	let get_5_ints () = Scanf.scanf " %d %d %d %d %d" (fun u v w x y -> u,v,w,x,y)
	let print_int_endline n = n |> string_of_int |> print_endline *)
end
(* module MyInt64 = struct *)
	let (+$) = (+) let (-$) = (-) let (/$) = (/) let ( *$) = ( * )
	let (+) p q = Int64.add p q let (-) p q = Int64.sub p q let ( * ) p q = Int64.mul p q let (/) p q = Int64.div p q let (+=) r v = r := !r + v let (-=) r v = r := !r - v let ( *=) r v= r := !r * v let (/=) r v = r := !r / v
	let labs p = if p < 0L then -1L*p else p
	let (~|) p = Int64.to_int p
	let (~~|) p = Int64.of_int p

	let input_i64_array n = Array.init (~| n) (fun _ -> Scanf.scanf " %Ld" (fun v -> v))
	let get_i64 () = Scanf.scanf " %Ld" (fun v -> v)
	let get_2_i64 () = Scanf.scanf " %Ld %Ld" (fun u v -> u,v)
	let get_3_i64 () = Scanf.scanf " %Ld %Ld %Ld" (fun u v w -> u,v,w)
	let get_4_i64 () = Scanf.scanf " %Ld %Ld %Ld %Ld" (fun u v w x -> u,v,w,x)
	let get_5_i64 () = Scanf.scanf " %Ld %Ld %Ld %Ld %Ld" (fun u v w x y -> u,v,w,x,y)
	let print_i64_endline n =
		n |> Int64.to_string |> print_endline
	
	let (mod) m n = m - (m/n) * n let (%) = (mod)
	let rec gcd m n = match m,n with | m,0L -> m | m,n -> gcd n (m mod n)
	let rec lcm m n = (m*n) / gcd m n
	let rep from_ to_ fbod =
		let i,f = ref ~|from_,ref true in while !i <= ~|to_-$1 && !f do
			match fbod !i with
			| `Ok -> i := !i +$ 1;
			| `Ng -> f := false
		done
(* end open MyInt64 *)

let () =
	let n = get_i64 ()
	in let a = input_i64_array n
	in
	let sum = ref 0L in
	for j=0 to Array.length a -$ 1 do
		sum += (a.(j) - 1L)
	done;
	!sum |> printf "%Ld\n"

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#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(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	ll N; cin >> N;
	ll ans = 1e18;
	for(ll i=1;i*i<=N;i++) if(N%i == 0){
		ll j = N/i;
		chmin(ans,i+j-2);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<atcoder/all>

using namespace std;
using namespace atcoder;
using ll = long long;


int main(){
  int n,m;
  cin >> n >> m;
  dsu uf(n);
  int ans = n-1;
  for(int i=0; i<m; i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    if(uf.same(a,b))continue;
    ans--;
    uf.merge(a,b);
  }
  cout << ans << endl;
}


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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<pair<string,ll> > svp;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0);
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define spc(x)     cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=1,cnt1=0;
    bool flag = false;   /*vector<long long> v,v1;*/
    
    cin>>a>>b>>c;
    if(ceil(a*1.0/c)<=b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // ll tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


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


int main() {

int a[5];
for(int i=0;i<5;i++) cin>>a[i];
for(int i=0;i<5;i++){
	if(a[i]==0 ) {
		cout<<i+1;break;
	}
}
}


Measured memory_bytes: 3648
N = int(input())
A = []
B = []
s = 0
for x in range(N):
  a, b = input().split()
  a = int(a)
  b = int(b)
  A.append(a)
  B.append(b)
for i in range(N):
  if A[i] == B[i]:
    s = s+1
  else:
    if s >= 3:
      s = s + 0
    else:
      s = 0
if s >= 3:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9148
/* Ahmed Maher ( Acro_14 ) */
#include <bits/stdc++.h>
typedef long long ll;
const ll oo = 0x3f3f3f3f;
int const N = 1e9+7;
using namespace std;
//string alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//string BN(ll x){bool f=0;string Bn;int i=62;while(i--){if ((ll)x & (1LL << i)){Bn+='1';f=1;}else{if(f)Bn+='0';}}return Bn;}//Decimal to Binary converter
int main()
{
    ll n,fact=1,ans=1,i;
    cin>>n;
    for(i=1;i<=n;i++){
      fact=fact*i;
  }
    map<ll,ll>m;
    for(i=1;i<=n;i++){
    	ll cur=i;
        for(int j=2;j*j<=i;j++){
            while(cur%j==0){
                m[j]++;
                cur/=j;
            }
        }
        if(cur>1)m[cur]++;
    }
    for(auto i:m){
    	ans*=(i.second+1);
    	ans%=N;
    }
    cout<<ans<<endl;
}

//       int anss[t+1];
//            anss[j]=ans;
//     for(int j=1;j<=t;j++) printf("Case %d: %d\n",j,anss[j]);


Measured memory_bytes: 3600
(defun read-and-num ()
  (if (char= (read-char) #\I)
	1
	-1))

(let ((n (read)))
  (setf ans 0)
  (setf x 0)
  (dotimes (i n)
	(incf x (read-and-num))
	(setf ans (max ans x)))
  (princ ans))


Measured memory_bytes: 13792
SIZE = 2**20 # 2**20 > N=500000

class SegmentTree:
    def __init__(self, size):
        self.size = size
        self.seg = [0] * (2 * size)

    def update(self, pos, ch):
        # update leaf
        i = self.size + pos - 1
        self.seg[i] = 1 << (ord(ch)-ord('a'))
        # update tree
        while i > 0:
            i = (i - 1) // 2
            self.seg[i] = self.seg[i*2+1] | self.seg[i*2+2]

    def _query(self, a, b, k, left, right):
        if right<a or b<left:
            return 0
        if a<=left and right<=b:
            return self.seg[k]

        vl = self._query(a,b,k*2+1, left, (left+right)//2)
        vr = self._query(a,b,k*2+2, (left+right)//2+1, right)
        return vl | vr

    def query(self, a, b):
        return self._query(a,b,0,0,self.size-1)


def resolve():
    N = int(input())
    S = input().strip()
    Q = int(input())
    table = [[] for _ in range(26)]
    sg = SegmentTree(SIZE)
    for i,ch in enumerate(S):
        sg.update(i, ch)

    for i in range(Q):
        query = input().strip().split()
        if query[0] == '1':
            pos = int(query[1])-1
            sg.update(pos, query[2])
        else:
            left = int(query[1])-1
            right = int(query[2])-1
            bits = sg.query(left, right)
            count = 0
            for j in range(26):
                count += (bits>>j) & 1
            print(count)

resolve()

Measured memory_bytes: 86344
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int num[66][2];
int main()
{
    int n;scanf("%d",&n);
    long long ans=0;
    for(int i=1;i<=n;++i)
    {
        long long x;
        scanf("%lld",&x);
        for(int j=0;j<=60;++j)
        {
            ans+=(1LL<<j)%mod*num[j][(x&1)^1]%mod;
            ans%=mod;
            ++num[j][x&1];
            x/=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    unsigned long long n,k;
    unsigned long long sum = 0;
    cin >> n >> k ;
    vector<unsigned long long> h(n);
    rep(i,n) cin >> h[i];
    sort(ALL(h));
    if(k>n) k =n; 
    rep(i,k){
         h.pop_back();
    }
    rep(i,h.size()) sum += h[i];
    cout << sum <<endl;
    return 0;
}


Measured memory_bytes: 1792
import sys
readline = sys.stdin.buffer.readline
N = int(readline())
A = []
B = []
for i in range(N):
    Ai,Bi = map(int,input().split())
    A.append(Ai)
    B.append(Bi)
button = 0
for i in range(N)[::-1]:
    button += (B[i]-A[i]-button)%B[i]
print(button)

Measured memory_bytes: 85652
#include <iostream>
#include <algorithm>
#include <cstdint>

int const MAXN = 200000;
int const MAXBIT = 1<<18;

int N, NN, h[MAXN];
uint64_t a[MAXN];
uint64_t dp[MAXBIT+1];

inline int pw2(int n) {
  int ret = 1;
  while(ret < n) ret <<= 1;
  return ret;
}

uint64_t bit_max(int i) {
  ++i;
  uint64_t ret = 0;
  while(i > 0) {
    ret = std::max(ret, dp[i]);
    i -= i&-i;
  }
  return ret;
}

void bit_set(int i, uint64_t x) {
  ++i;
  while(i <= NN) {
    dp[i] = std::max(dp[i], x);
    i += i&-i;
  }
}

int main() {
  std::cin >> N;
  NN = pw2(N+2);
  for(int i = 0; i < N; ++i) std::cin >> h[i];
  for(int i = 0; i < N; ++i) std::cin >> a[i];

  for(int i = 0; i <= NN; ++i) dp[i] = 0;
  for(int i = 0; i < N; ++i) {
    uint64_t tmp = bit_max(h[i]) + a[i];
    bit_set(h[i]+1, tmp);
  }
  std::cout << dp[NN] << std::endl;
  return 0;
}


Measured memory_bytes: 4608
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let w = sc.next::<String>();

    let mut cnt = 0;
    loop {
        let t = sc.next::<String>();
        if t == "END_OF_TEXT" {
            break;
        }
        if w == t.to_lowercase() {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    fn char(&mut self) -> char {
        self.chars()[0]
    }
}



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

int main(){
    string s;
    int x;
    cin>>s;
    x = 1;
    for(int i = 0;i<s.size();i++){
        if(s.at(i)==','){
            s.at(i) =' ';
        }
      
    }
  cout<<s<<endl;
}

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


struct student_t
{
  int height;
  bool left;
  bool right;
};

int n;
student_t matrix[100][100];

int main()
{
  int a;

  while (1)
  {
    cin >> n;
    if (n==0) return 0;
    for (int i=0;i<n;i++)
      for (int j=0;j<n;j++)
      {
        cin >> a;
        matrix[i][j].height = a;
        matrix[i][j].left = matrix[i][j].right = false;
      }

    int shortest;
    for (int i=0;i<n;i++)
    {
      shortest = INT_MAX;
      for (int j=0;j<n;j++)
      {
        if (shortest > matrix[i][j].height) shortest = matrix[i][j].height;
      }
      for (int j=0;j<n;j++)
        if (shortest == matrix[i][j].height)
        {
          matrix[i][j].left = true;
        }
    }

    int tallest;
    for (int j=0;j<n;j++)
    {
      tallest = 0;
      for (int i=0;i<n;i++)
      {
        if (tallest < matrix[i][j].height) tallest = matrix[i][j].height;
      }
      for (int i=0;i<n;i++)
        if (tallest == matrix[i][j].height) matrix[i][j].right = true;
    }

    bool exist = false;
    for (int j=0;j<n;j++)
    {
      for (int i=0;i<n;i++)
        if (matrix[i][j].left && matrix[i][j].right)
        {
          cout << matrix[i][j].height << endl;
          exist = true;
          break;
        }
      if (exist) break;
    }
    if (!exist) cout << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check


void solve(std::string S){
    ll x;
    if(S == "SUN") x=0;
    if(S == "MON") x=1;
    if(S == "TUE") x=2;
    if(S == "WED") x=3;
    if(S == "THU") x=4;
    if(S == "FRI") x=5;
    if(S == "SAT") x=6;
    cout << 7-x<<endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    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;

char nokori(char c1, char c2) {
  if ((c1 == 'R' && c2 == 'G') || (c2 == 'R' && c1 == 'G')) return 'B';
  if ((c1 == 'R' && c2 == 'B') || (c2 == 'R' && c1 == 'B')) return 'G';
  if ((c1 == 'B' && c2 == 'G') || (c2 == 'B' && c1 == 'G')) return 'R';
}

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

  vector<int> R;
  vector<int> G;
  vector<int> B;
  rep(i, n) {
    if (s[i] == 'R')
      R.push_back(i);
    else if (s[i] == 'G')
      G.push_back(i);
    else if (s[i] == 'B')
      B.push_back(i);
  }
  map<char, vector<int>> mp;
  mp['R'] = R;
  mp['G'] = G;
  mp['B'] = B;

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) continue;
      char c = nokori(s[i], s[j]);
      vector<int> v = mp[c];
      ans += v.end() - upper_bound(v.begin(), v.end(), j);
      if (binary_search(v.begin(), v.end(), j + (j - i))) ans--;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[405];
ll dp[405][405];
ll rui[405];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++)rui[i]=rui[i-1]+a[i];
	for(int i=1;i<=n;i++) dp[i][i] = 0;
	for(int a=2;a<=n;a++){
		for(int i=1;i+a-1<=n;i++){
			//dp[i][i+a-1]
			dp[i][i+a-1] = 1e18;
			for(int j=i;j<i+a-1;j++){
				dp[i][i+a-1] = min(dp[i][i+a-1],dp[i][j]+dp[j+1][i+a-1]+rui[i+a-1]-rui[i-1]);
			}
		}
	}
	cout<<dp[1][n]<<endl;
}

Measured memory_bytes: 1536
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define INF 1e9
#define MOD 1000000007;//1e9+7

void solve() {
    int A, P;
    cin >> A >> P;
    cout << (A * 3 + P) / 2;
}

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

Measured memory_bytes: 256
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
ab = np.array([LI() for _ in range(N)])
cd = np.array([LI() for _ in range(M)])
for x in ab:
    vector = np.sum(np.abs(cd-x),axis=1).tolist()
    print(vector.index(min(vector))+1)


Measured memory_bytes: 12436
#include <bits/stdc++.h>
using namespace std;
int main (){
  int i;
  cin >> i;
  i %= 10;
  if (i==0 || i==1 || i==6 || i==8) {
    cout << "pon" << endl;
  }
  else if (i==3) {
    cout << "bon" << endl;
  }
  else {
    cout << "hon" << endl;
  }  
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int  n;
int a[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];

    int s = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0 && a[i] % 2)
            s++;
    }
    cout << s << endl;
    return 0;

}


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

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int n,s;

long dp[11][1025][334];
long rec(int now, int state, int sum)
{
	if(dp[now][state][sum]>=0) return dp[now][state][sum];

	long ret=0;
	if(now==n)
	{
		if(sum==s) ret=1;
	}
	else
	{
		for(int i=0; i<=9; ++i)
		{
			//??¢????????¨????????????????????§??????
			if(state>>i&1) continue;

			ret+=rec(now+1,state+(1<<i),sum+(now+1)*i);
		}
	}

	return dp[now][state][sum]=ret;
}

int main()
{
	while(scanf(" %d %d",&n,&s)!=EOF)
	{
		memset(dp,-1,sizeof(dp));
		printf("%ld\n",rec(0,0,0));
	}
}

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

pair<int, int> search(int from, int to, vector<vector<int>> &g)
{
    pair<int, int> result = {0, to};
    for (int next : g[to])
    {
        if (next != from)
        {
            auto tmp = search(to, next, g);
            tmp.first += 1;
            if (result.first < tmp.first)
            {
                result = tmp;
            }
        }
    }
    return result;
}

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

    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    auto tmp = search(-1, 0, g);
    auto cmp = search(-1, tmp.second, g);
    int diameter = cmp.first;

    cout << ((diameter % 3 != 1) ? "First" : "Second") << endl;

    return 0;
}


Measured memory_bytes: 26752
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
const ll INF = 1e18;

int main() {
    ll n, h;
    cin >> n >> h;
    vector <ll> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a.begin(), a.end());
    cout << n - min((ll)(lower_bound(a.begin(), a.end(), h) - a.begin()), n) << "\n";

    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
    y=((f*a)-(d*c))/((a*e)-(d*b));
    x=(c-(b*y))/a;
    printf("%.3lf %.3lf\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 1756
#include<stdio.h>
typedef long long ll;
int main()
{
	ll n;
	scanf("%lld", &n);
	ll t = 1;
	int c = 0;
	for (;;)
	{
		if (t * 10 > n)break;
		t *= 10;
		c++;
	}
	printf("%lld\n", (n + 1) / t - 1 + c * 9);
}

Measured memory_bytes: 128
x,y,z,k = list(map(int, input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
l = []
for i in range(len(a)):
    for j in range(len(b)):
        for kk in range(len(c)):
            if (i + 1) * (j + 1) * (kk + 1) <= k:
                l.append(a[i] + b[j] + c[kk])
            else:
                break
l.sort(reverse = True)
for i in range(k):
    print(l[i])

Measured memory_bytes: 8708
x = int(input())
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

b = False
while True:
    b = is_prime(x)
    if b:
        print(x)
        exit(0)
    x += 1

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i=(a); i<(n); ++i)
#define rrep(i,a,n) for(ll i=(a); i>(n); --i)
#define erep(i,a,n) for(ll i=(a); i<=(n); ++i)
#define rerep(i,a,n) for(ll i=(a); i>=(n); --i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int) x.size())
#define print(X) cout << (X) << endl
#define _ << " " <<
static const int INF = 1e+9+7;
ll a,b,c,x,y;
str s,t;
int M[100];

int main(){
  cin >> a >> b >> c >> x >> y;

  ll small = INF;
  ll tmp = INF;

  erep(i, 0, max(x,y)){
    if(x-i < 0 ){
      tmp = c*i*2 + (y-i)*b;
    }else if (y-i < 0){
      tmp = c*i*2 + (x-i)*a;
    }else{
      tmp = c*i*2 + (x-i)*a + (y-i)*b;
    }
    if(tmp < small)small = tmp;
  }

  print(small);
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=[-1]
for i in range(m):
    s=int(input())
    a.append(s)  
a.append(n+1)
if 1 in a:
    a=a[1:]
if n-1 in a:
    a=a[:-1]
b=[]
for i in range(len(a)-1):
    b.append(a[i+1]-a[i]-2)
l=[1,1,2]
for i in range(3,n+1):
    l.append(l[i-2]+l[i-1])
ans=1
#print(a,b,l)
for i in range(len(b)):
    if b[i]<0:
        print(0)
        break
    else:
        ans*=l[b[i]]%1000000007
else:
    print(ans%1000000007)


Measured memory_bytes: 464900
n,m = map(int,input().split())
class dsu:
    def __init__(self,n):
        self.par = [i for i in range(n)]
        self.sz = [1] * n
    def find(self,a):
        if self.par[a] == a:
            return a
        self.par[a] = self.find(self.par[a])
        return self.par[a]
    def unite(self,a,b):
        a = self.find(a)
        b = self.find(b)
        if a != b:
            if self.sz[b] > self.sz[a]:
                a,b = b,a
            self.par[b] = a
            self.sz[a] += self.sz[b]
d = dsu(n)            
for i in range(m):
    u,v = map(int,input().split())
    d.unite(u-1,v-1)
    
print(max(d.sz) if m else 1)

Measured memory_bytes: 88488
import java.util.Scanner;

public class Main{
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int H,W;
		while(true){
			H = sc.nextInt();
			W = sc.nextInt();
			if(H==0&&W==0) break;
			for(int i=0; i<H; i++){
				for(int j=0; j<W; j++){
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
			
		}
	}
}

Measured memory_bytes: 26712
N,D=input().split()
N=int(N)
D=int(D)
cnt = 0
for i in range(N):
    
    p1,p2 = map(int,input().split())
    t = ((p1*p1)+(p2*p2))**(0.5)
    if t <= D:
        cnt += 1
    
print(cnt)

Measured memory_bytes: 9556
#include <bits/stdc++.h>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }
 
typedef long long ll;
int const inf = 1<<29;
 
int main() {
  int N, M; cin >> N >> M;
  vector<map<int, int>> g(N);
  rep(i, M) {
    int a, b; cin >> a >> b;
    g[a-1][b-1] = g[b-1][a-1] = 1;
  }
  vector<int> ns(N); iota(ns.begin(), ns.end(), 0);
  int count = 0;
  do {
    if (ns[0] != 0) continue;
    bool ok = 1;
    rep(i, N - 1) {
      if (!g[ns[i]][ns[i + 1]]) {
        ok = 0;
      }
    }
    count += ok;
  } while (next_permutation(ns.begin(), ns.end()));
  cout << count << "\n";
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt(), b = scanner.nextInt();
        int ans = -1;
        for (int i = 1; i <= 1000; i ++){
            if ((int)Math.floor(i * 0.08) == a && (int)Math.floor(i * 0.1) == b){
                ans = i;
                break;
            }
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 23892