akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s,t,d;
    cin >> s >> t >> d;
    vector<int> vec(d);
    rep(i,d){
        cin >> vec[i];
    }
    vector<ll> sm(d);
    sm[0] = vec[0];
    ll mn = min(0LL,sm[0]);
    rep(i,d-1){
        sm[i+1] = sm[i] + vec[i+1];
        mn = min(sm[i+1],mn);
    }
    if(sm[d-1] < 0){
        if(mn <= t-s){
            ll nw = s;
            rep(i,d){
                nw += vec[i];
                if(nw <= t){
                    cout << i+1 << endl;
                    break;
                }
            }
        }else{
            ll diff = -sm[d-1];
            mn = -mn;
            ll sy = (s-t-mn-1)/diff + 1;
            ll nw = s-sy*diff;
            rep(i,d){
                nw += vec[i];
                if(nw <= t){
                    cout << sy*d + i+1 << endl;
                    break;
                }
            }
        }
    }else{
        if(mn <= t-s){
            ll nw = s;
            rep(i,d){
                nw += vec[i];
                if(nw <= t){
                    cout << i+1 << endl;
                    break;
                }
            }
        }else{
            cout << "-1\n";
        }
    }
    return 0;
}



Measured memory_bytes: 4168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<pii> a(n);
	rep(i,n){
		cin >> a.at(i).first;
		a.at(i).second = i;
	}
	vector<int> ans(n);
	sort(all(a));
	rep(i,n){
		if(i < n / 2) ans.at(a.at(i).second) = a.at(n / 2).first;
		else ans.at(a.at(i).second) = a.at(n / 2 - 1).first;
	}
	rep(i,n) cout << ans.at(i) << endl;
}


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

using namespace std;

int main()
{   
	long long x;
	cin >> x;
	vector<long long> factor(100);
	long long n = x;
	long long i = 1;
	long long count = 0;
    while (i * i <= n) {
			if (n % i == 0) {
				factor[count] = i;
				count++;
			}
			i++;
		}
		long long a = 1;
		long long b = 1;
		for (long long i = 0; i < count; i++) {
			long long k = factor[i];
			for (long long j = 0; j <= factor[count-1]*1000; j++) {
				if (j * j * j * j + j * j * j * (j - k) + j * j * (j - k) * (j - k) + j * (j - k) * (j - k) * (j - k) + (j - k) * (j - k) * (j - k) * (j - k) == x / k) {
					a = j;
					b = j - k;
					break;
				}
			}
			if (a != 1 || b != 1) {
				break;
			}
		}
		cout << a << " " << b << endl;
	

	
	return 0;
}



Measured memory_bytes: 3632
import java.util.Scanner;

class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int num[] = new int[n];
        
        for (int i=0; i<num.length; i++) {
            num[i] = scanner.nextInt();        
        }
        for(int i = num.length-1; i>=0;i--){
            if(i != 0){
                System.out.print(Integer.toString(num[i]) + " ");
            } else {
                System.out.println(Integer.toString(num[i]));   
            } 
        }
    }
}



Measured memory_bytes: 26272
#include <bits/stdc++.h>
using namespace std;
using ii = pair<int,int>;
using ll = long long;

constexpr int MAXN = 5+3e5;

int c1[MAXN], c2[MAXN], curr[MAXN];
vector<int> r[MAXN];

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int h,w,m;
  cin >> h >> w >> m;
  set<ii> cell;
  for (int i = 0; i < m; ++i) {
    int x,y; cin >> x >> y;
    ++c1[x];
    ++c2[y];
    r[x].push_back(y);
  }

  int ans = 1;
  multiset<int> s;

  for (int i = 1; i <= w; ++i) {
    curr[i] = c2[i];
    s.insert(curr[i]);
  }

  for (int i = 1; i <= h; ++i) {
    for (auto p : r[i]) {
      s.erase(s.find(curr[p]));
      curr[p] = c2[p]-1;
      s.insert(curr[p]);
    }

    ans = max(ans, c1[i] + *s.rbegin());

    for (auto p : r[i]) {
      s.erase(s.find(curr[p]));
      curr[p] = c2[p];
      s.insert(curr[p]);
    }
  }

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


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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
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 (b<a) { a=b; return 1; } return 0; }
 

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

    int N, K;
    cin >> N >> K;

    string S;
    cin >> S;

    int happy=0;
    rep(i, N)
    {
        if(S[i]=='L')
        {
            if(i!=0&&S[i-1]=='L')
            {
                happy++;
            }
        }

        if(S[i]=='R')
        {
            if(i!=N-1&&S[i+1]=='R')
            {
                happy++;
            }
        }
    }

    if(S[0]==S[S.size()-1])
    {
        happy+=2*K;
    }
    else
    {
        happy+=2*K;
    }
    
    if(happy>N-1)
    {
        cout << N-1 << endl;
    }
    else
    {
        cout << happy << endl;
    }
    
    

 

 

 

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int H, W;
	cin >> H >> W;
	string *S = new string[H];
	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};



int a1, a2, a3;

int main () {
  cin >> a1 >> a2 >> a3;
  int sum = a1 + a2 + a3;

  if (sum >= 22) {
    cout << "bust\n";
  } else {
    cout << "win\n";
  }
}

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

int main() {
  string s, t; cin >> s >> t;
  
  int ans = 0;
  for(int i = 0; i < s.length(); i++) {
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3916
K, N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
distances = []
for ind, a in enumerate(A):
    if(ind==0):
        distances.append(K-A[-1]+a)
    else:
        distances.append(a-A[ind-1])
print(K-max(distances))



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

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{
  //https://kmjp.hatenablog.jp/entry/2017/02/19/0900
  int n;cin>>n;
  map<int,int> mp;
  vector<int> vec(n,0);
  for (int i = 0; i < n; i++)
  {
    cin>>vec[i];
    mp[vec[i]]++;
  }
  vector<int> v;
  v.push_back(0);
  for (int i = 1; i < n; i++)
  {
    if(vec[v.back()] < vec[i]) v.push_back(i);
    // 1 2 1 3 2 4 2 5 8 1
    // => 0 1 3 5 7 8 
  }
  // DEBUG(v);
  vector<int> ret (n,0);
  for (int i = v.size() - 2 ; i >= 0; i--) 
  {
    while(mp.rbegin() ->first > vec[v[i]])
    {
      auto r = *mp.rbegin();
      mp.erase(r.first);
      ret[v[i+1]] += (r.first - vec[v[i]])*1LL*r.second;
      mp[vec[v[i]]] += r.second;
    }
  }
  for (auto &&r : mp)
  {
    ret[0] += r.first*r.second;
  }
  for (int i = 0; i < ret.size(); i++)
  {
      // if(i != 0)cout<<char(32);
      cout<<ret[i]<<endl;;
  }
  // cout<<endl;
  
  
  


  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 11976
#include<iostream>
using namespace std;
int main(void)
{
  int num[4][3][10]={0};
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
    {
      int b,f,r,v;
      cin>>b;
      cin>>f;
      cin>>r;
      cin>>v;
      num[b-1][f-1][r-1]+=v;
    }
  for(int i=0;i<4;i++)
    {
      for(int j=0;j<3;j++)
	{
	  for(int k=0;k<10;k++)
	    {
	      cout<<" "<<num[i][j][k];
	      
	    }
	  cout<<endl;
	}
      if(i==3)break;
      cout<<"####################"<<endl;
    }
  return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
int main()
{
    int n;
    cin>>n;
    int res=0;
    for(int i=1; i<=n; i++)
    {
        int x=n/i;
        if(n%i==0)
            x--;
        res+=x;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n, m, x; cin>>n>>m>>x;
  vector<ll> c(n);
  vector<vector<ll>> a(n, vector<ll>(m));
  rep(i, n) {
    cin>>c.at(i);
    rep(j, m) {
      cin>>a.at(i).at(j);
    }
  }
  ll ans=99999999999;
  for(int bit=0; bit<(1<<n); bit++) {
    ll cost=0;
    vector<ll> skill(m);
    for(int j=0; j<n; j++) {
      if(bit>>j&1) {
        cost+=c.at(j);
        rep(h, m) skill.at(h)+=a.at(j).at(h);
      }
    }
    bool ok=true;
    rep(i, m) {
      if(skill.at(i)<x) ok=false;
    }
    if(ok) ans=min(ans, cost);
  }
  if (ans==99999999999) cout << -1;
  else cout << ans;  
}

Measured memory_bytes: 3580
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

former_a = -100
res = 0
for a in As:
    a = a - 1
    b = Bs[a]
    res += Bs[a]
    if a - former_a == 1:
        res += Cs[former_a]
    former_a = a

print(res)


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

int main() {
  int n;
  int card[4][13] = {0};

  int i, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    char suit;
    int ranck;
    cin >> suit >> ranck;
    if (suit == 'S') {
      card[0][ranck - 1] = 1;
    } else if (suit == 'H') {
      card[1][ranck - 1] = 1;
    } else if (suit == 'C') {
      card[2][ranck - 1] = 1;
    } else if (suit == 'D') {
      card[3][ranck - 1] = 1;
    }
  }

  for (i = 0; i < 4; i++) {
    for (j = 0; j < 13; j++) {
      if (card[i][j] != 1) {
        if (i == 0) {
          cout << "S";
        } else if (i == 1) {
          cout << "H";
        } else if (i == 2) {
          cout << "C";
        } else if (i == 3) {
          cout << "D";
        }
        cout << " " << (j + 1) << endl;
      }
    }
  }
  
  return 0;
}



Measured memory_bytes: 3120
#include <stdio.h>
int main(void){
int h, w;
int i, j;
while(1){
scanf("%d %d", &h, &w);
if(h + w == 0) break;
for(i = 0; i < h; i++){
for(j = 0; j < w; j++)
putchar('#');
putchar('\n');
}
puts("");
}
return 0;
}

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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
	IOS;
  int n,k;cin>>n>>k;
  string s;cin>>s;
  k--;
  int i=k;
  s[i]=(s[i]-'A')+'a';
  cout<<s<<endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#include <iomanip>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


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

int main(){
  int n;
  int a[1000000];

  cin>>n;rep(i,n)cin>>a[i];

  int ans = a[0];
  rep(i,n-1){
    ans = gcd(ans,a[i+1]);
  }

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

Measured memory_bytes: 2560
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
using namespace std;
 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007
 




void solve()
{
	ll n;
	cin>>n;
	
	m(string,ll) s1;
	string s;
	
	f(i,0,n-1)
	{
		cin>>s;
		s1[s]++;
	}
	ll maxer=0;
	
	fe(x,s1)
	{
		maxer=max(maxer,x.S);
	}
	
	v(string) vec;
	fe(x,s1)
	{
		if(x.S == maxer) vec.pub(x.F);
	}
	
	fe(x,vec) cout<<x<<endl;
	
	
}

signed main() 
{
	speed;
	
	int q=1;
	//cin>>q;
	
	while(q--)
		solve();
		
 	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}


Measured memory_bytes: 25584
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int N;
long long ans = 0;
vector<pair<int,pair<int,int>>> V;
	//vector<pair<int,int>> A,B;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N;
	
	REP(i,N){
		int A,B;
		cin >> A >> B;
		V.push_back(make_pair(A + B,make_pair(A,B)));
	}

	sort(V.rbegin(),V.rend());

	bool flag = true;
	REP(i,N){
		if(flag){
			ans += V[i].second.first;
		}else{
			ans -= V[i].second.second;
		}
		flag = !flag;
	}
		
	cout << ans << endl;


}

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

int f (int &b, int &c) {
  int a;
  a = b + c;
  return a;
}

int main() {
  int A, B, C;
  long long int K;
  cin >> A >> B >> C >> K;
  
  if (K%2 == 0){
    A = A - B;
  }
  else {
    A = B - A;
  }
  
  
  cout << A << endl;
  
  
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,m;
	cin>>n>>m;
	char arr[n][m];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>arr[i][j];
		}
	}
	vector<vector<ll> > dp(n,vector<ll>(m,0));
	dp[0][0] = 1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if((i==0 && j==0) || arr[i][j]=='#')
				continue;
			dp[i][j] = (((((i-1)>=0)?dp[i-1][j]%1000000007:0)+((j-1>=0)?dp[i][j-1]%1000000007:0))%1000000007);
		}
	}
	cout<<dp[n-1][m-1]%1000000007<<endl;
}

Measured memory_bytes: 9088
#include <stdio.h>
#include <stdlib.h>
#define MOD 1000000007
#define MAX 100005

long long fac[MAX], finv[MAX], inv[MAX];

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

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

int int_sort( const void * a , const void * b ) {
  return *(long *)a - *(long *)b;
};


int main(void){
    int long long ans=0,cmb;
    int n,k,i;
    int long a[MAX];
    scanf("%d %d",&n,&k);
    for(i=1;i<=n;i++){
        scanf("%ld",&a[i]);
    };
    qsort(&a[1],n,sizeof(long),int_sort);
    /*for(i=1;i<=n;i++){
        printf("%d ",a[i]);
    };*/
    //putchar('\n');
    COMinit();
    for(i=k;i<=n;i++){
        cmb=COM(i-1,k-1);
        ans+=(a[i]*cmb)% MOD;
        ans%=MOD;
        //printf("a[%d]=%d, a[%d]=%d, f=%d, cmb=%lld, ans=%lld\n",i,a[i],j,a[j],f,cmb,ans);
    };
    for(i=1;i<=n-k+1;i++){
        cmb=COM(n-i,k-1);
        ans-=(a[i]*cmb)% MOD;
        ans %= MOD;
    };
    if (ans < 0) ans += MOD;
    printf("%lld",ans);
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n; cin>>n;
    int cnt=0;
    for(int i=0; i<n; i++){
        int a; cin>>a;
        while(a%2==0) a/=2, cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

origin = list(map(int, input().rstrip('\n')))
# print(origin)

t1 = []
t2 = []
for i in range(len(origin)):
    if i % 2 == 0:
        t1.append(0)
        t2.append(1)
    else:
        t1.append(1)
        t2.append(0)

n1 = 0
n2 = 0
for i in range(len(origin)):
    if t1[i] != origin[i]:
        n1 += 1
    if t2[i] != origin[i]:
        n2 += 1

print(min(n1, n2))


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

int main(){
	int N;
  	cin >> N;
  	vector<int>a(N);
  	for(int i = 0; i < N; i++) cin >> a[i];
  	int sum = 0;
  	for(int i = 0; i < N; i++) sum ^= a[i];
  	for(int i = 0; i < N; i++) cout << (sum ^ a[i]) << '\n';
}

Measured memory_bytes: 3880
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
  long long n, a, b;
  cin >> n >> a >> b;
  
  if ((b-a)%2 == 0)
    cout << (b-a)/2 << endl;
  else
    cout << min(a-1, n-b) + (b-a+1)/2 << endl;
  
  return 0;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}
char c[6][6];
signed main(void) {
	int h, w, k;
	cin >> h >> w >> k;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
		}
	}
	int ans = 0;
	for (int a = 0; a < 1 << h; a++) {
		for (int b = 0; b < 1 << w; b++) {
			int cnt = 0;
			rep(i, h) rep(j, w) {
				if (a >> i & 1) continue;
				if (b >> j & 1) continue;
				if (c[i][j] == '#') cnt++;
			}
			if (cnt == k) ans++;
		}
	}
		print(ans);
}

Measured memory_bytes: 3596
import sys
s = input()
ans = 'AC'
c = 0
if s[0] != 'A':
    ans = "WA"
for i in range(2,len(s)-1):
    if "C" == s[i]:
        c += 1
if c != 1:
    ans = "WA"
c = 0
for i in range(len(s)):
    a = ord(s[i])
    if 65 <= a and a <= 96:
        c += 1
if c != 2:
    ans = "WA"
print(ans)

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m, a[101010], d[101010];
void solve(){
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> a[i];
	}
	sort(a,a+m);
	if(n >= m){
		cout << 0 << endl;
		return;
	}
	
	i64 ans = a[m-1]-a[0];
	for(int i = 1; i < m; i++){
		d[i] = abs(a[i]-a[i-1]);
	}
	sort(d,d+m);
	while(--n){
		ans -= d[--m];
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int X, A, B;

int main()
{
	in >> X >> A >> B;
	X -= A;
	X -= X / B*B;
	out << X << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    
    ll x = 0, ans = 0, N;
    cin >> N;
    for(ll i = 0; i < N; i++){
        char c;
        cin >> c;
        if(c == 'I')x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
A,B,C,D = map(int,list(input()))

dic = { 1:"+" , -1:"-"}

import itertools
for AB,BC,CD in itertools.product([1,-1],repeat=3):
    tmp = A + B*AB + C*BC + D*CD

    if tmp ==7:
        ans = str(A)+dic[AB]+str(B)+dic[BC]+str(C)+dic[CD]+str(D)+"=7"
        print(ans)
        exit()

Measured memory_bytes: 9200
#include<iostream>
using namespace std;
int main(){
    int W ,H ,x ,y ,r;
    cin >> W >> H >> x >> y >> r;
    if(x + r <= W&&y + r <= H&&r <= x&&r <= y)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3116
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] A = new int[N];
   boolean flag=true;
   
   for(int i=0;i<N;i++){
     A[i] = sc.nextInt();
     if(A[i]%2==0&&(A[i]%3!=0&&A[i]%5!=0)){
     	flag=false;
     }
   }
      
      
   if(flag){
     System.out.println("APPROVED");
   }else{
     System.out.println("DENIED");
   }
 
 }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String sdash = sc.next();
        String t = sc.next();
        String[] sdashArr = sdash.split("");
        String[] tArr = t.split("");

        boolean replaced = false;
        for (int i = sdash.length() - t.length(); i >= 0; i--) {
            boolean matched = true;
            for (int j = 0; j < t.length(); j++) {
                if (!sdashArr[i + j].equals(tArr[j]) && !sdashArr[i + j].equals("?")) {
                    matched = false;
                    break;
                }
            }
            if (!matched) {
                continue;
            }
            String sdash1 = sdash.substring(0, i);
            String sdash2 = sdash.substring(i + t.length());
            sdash = sdash1 + t + sdash2;
            replaced = true;
            break;
        }
        if (!replaced) {
            System.out.println("UNRESTORABLE");
            return;
        }
        String result = sdash.replaceAll("\\?", "a");
        System.out.println(result);
    }

}


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

int main()
{
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, n) cin >> A[i];
    map<int, int> I;
    ll ans = 0;
    rep(i, n)
    {
        int wa = A[i] + i;
        int sa = i - A[i];
        I[wa]++;
        ans += I[sa];
    }
    cout << ans << endl;
}

Measured memory_bytes: 20984
/*Fuck the world*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0),cout.tie(0);
#define fori(i,a,b) for(i=a;i<b;i++)
int main()
{
    fast;
    int a;
    cin>>a;
    int s=a+a*a+a*a*a;
    cout<<s<<"\n";
}

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

#define st              first
#define nd              second
#define pb              push_back
#define lwb             lower_bound
#define upb             upper_bound
#define Size(a)         int((a).size())
#define reset(s, n)     memset(s, n, sizeof(s))
#define bit(n, i)       (((n) >> (i)) & 1)
#define cntbit(n)       __builtin_popcountll(n)
#define all(a)          (a).begin(), (a).end()
#define unique(a)       (a).resize(unique(all(a)) - (a).begin())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))

typedef long double ld;
typedef long long ll;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-7;
inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int inv(int a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
inline void onbit(ll &a, int i){a |= 1LL << i;}
inline void offbit(ll &a, int i){onbit(a, i), a -= (1LL << i);}

const int N = 3e5 + 5;

ll n, m, k;
ll a[N];

void solve(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a, a + n);
  int res = 0;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      for(int k = j + 1; k < n; k++){
        if(a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k]){
          res++;
        }
      }
    }
  }
  cout << res << '\n';
  
}

main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
  cout << fixed << setprecision(10);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int query = 1;
  // cin >> query;
  int start = 1000 * clock() / CLOCKS_PER_SEC;
  while(query--) solve();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC  - start << "ms\n";
}


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

const ll MAX = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;
const double PI=3.1415926535897932;

ll N, K, ans=0, tmp1=0, tmp2=0, sum1=0, sum2=0;
vector<ll> A, S, L, R, SS;

signed main(){
    cin >> N >> K;
    for(int i=0;i<N;i++) {
        ll a;
        cin >> a;
        A.push_back(a);
    }
    S.resize(N, 0);
    SS.resize(N, 0);
    L.resize(N, 0);
    R.resize(N, 0);
    S[0] = A[0];
    for(int i=1;i<N;i++) {
        S[i] = S[i-1]+A[i];
    }
    SS[0] = S[K-1];
    for(int i=1;i<=N-K;i++) {
        SS[i] = S[i+K-1]-S[i-1];
    }
    for(int i=1;i<N;i++) {
        L[i] = L[i-1]+max(0LL, A[i-1]);
        //cout << L[i] << endl;
    }
    //cout << endl;
    for(int i=1;i<N;i++) {
        R[N-i-1] = R[N-i]+max(0LL, A[N-i]);
        //cout << R[N-i-1] << endl;
    }
    //cout << endl;
    for(int i=0;i<=N-K;i++) {
        ans = max(ans, L[i]+R[i+K-1]+max(0LL, SS[i]));
        //cout << SS[i] << endl;
        //cout << L[i] << " " << R[i+K-1] << " " << max(0LL, SS[i]) << " " << ans << endl;
    }
    //cout << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7132
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x,a,b;
	cin>>x>>a>>b;
	if(a-b>=0) {
        cout<<"delicious";
        return 0;
	}
	else {
	    int diff = b-a;
	    if(diff > x) {
            cout<<"dangerous";
	    }
	    else cout<<"safe";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <list>
using namespace std;

int main(){

    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    if(e - a > k){
        cout << ":(";
    }
    else{
        cout << "Yay!";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000000LL;
const int MAX=100001;
const double EPS=1e-10;
int main(){
    int h,w;
    cin>>h>>w;
    char a[510][510];
    for(int i=0;i<h;i++){
        cin>>a[i];
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i%2){
                if(a[i][j]=='#'||j==0){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }else{
                if(j<w-1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
        }
        cout<<endl;
    }
    cout<<endl;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i%2==0){
                if(a[i][j]=='#'||j==w-1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }else{
                if(j>0){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
        }
        cout<<endl;
    }
}


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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int a;
  cin >> a;
  int b = a * a;
  int c = a * a * a;
  cout << a + b + c << endl;


  return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int N = 200005;

int h[N];

map <int, int> cnt;

int main() {

	FAST;

	int n;
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> h[i];
		cnt[i + h[i]] ++;
	}
	intt ans = 0;
	for (int i = 1; i <= n; i ++) {
		ans += cnt[i - h[i]];
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 21360
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
		     //  #ifndef ONLINE_JUDGE
	      //  // for getting input from input.txt
	      //  freopen("input.txt", "r", stdin);
	      //  // for writing output to output.txt
	      //  freopen("output.txt", "w", stdout);
	      // #endif
	string s;
	cin>>s;
	cout<<count(s.begin(),s.end(),'1')<<"\n";
	return 0;
}

Measured memory_bytes: 256
// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue> 
#include <string.h>
#include <string>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl
 
const ll mod=998244353;
#define inf 9999999999999
#define MAXN   100001 
  
// stores smallest prime factor for every number 
 
 
ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}
 
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b,b%a);}
inline void fastio(){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
// Template ends
const int MN = 2e5+7;

void solve(){
    string s; cin>>s;
    if(s[s.length()-1]=='s'){
        cout<<s+"es"<<endl;
    }else{
        cout<<s+'s'<<endl;
    }
}
int main(){
    fastio();
    //write code
    int t; t=1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3052
// ~/BAU/ACM-ICPC/Teams/Rampage/Abukhadijah
// ~/Remember,remember the 6th of March.
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include<complex>
#include <unordered_map>
#include<unordered_set>
#include <numeric>
#include <string>
#include<iostream>
#include <fstream>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include<cmath>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double  EPS = 1e-11;
const ll MOD = 1000000007;
const int N = 10000007;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
void fast()
{
	std::ios_base::sync_with_stdio(0);
}
bool check(int num)
{
	set<int>st;
	while(num)
	{
		int t = num % 10;
		num /= 10;
		st.insert(t);
	}
	if (st.size() == 1)
		return 1;
	else
		return 0;
}
int main()
{
	int n;
	cin >> n;
	while (!check(n))
	{
		n++;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
  	cin >> N;
    string ans = "Yes";
    vector<string> W(N);
    for(int i = 0;i < N;i ++){
        cin >> W[i];
    }
    for(int i = 0;i < N-1;i ++){
        bool judge = true;
        for(int j = 0;j < i;j ++){
            if(W[i] == W[j]) judge = false;
        }
        if(!(judge) || W[i].at(W[i].size()-1)!=W[i+1].at(0)) ans = "No";
    }
  	for(int i = 0;i < N-1;i ++){
        if(W[N-1] == W[i]) ans = "No";      
    }
      
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from operator import itemgetter
from heapq import *
input = sys.stdin.readline



def main():
    n, k = map(int, input().split())
    sushi = [list(map(int, input().split())) for _ in range(n)]
    
    sushi.sort(key=itemgetter(1), reverse=True)
    
    key = []
    already = [False]*(n+1)
    variety = k
    taste = 0
    for i in range(k):
        v, t = sushi[i]
        taste += t
        if already[v]:
            variety -= 1
            heappush(key, t)
            continue
        already[v]= True
    
    ans = [variety**2+taste]
    for i in range(k, n):
        if variety == k:
            break
        v, t = sushi[i]
        if already[v]:
            continue
        already[v] = True
        taste += t-key[0]
        heappop(key)
        variety += 1
        ans.append(variety**2+taste)
        
    print(max(ans))
    
    
        
   
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 28696
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] arr = new int[n];
            int curxor = 0;
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                curxor ^= x;
                arr[i] = x ^ (x - 1);
            }
            if (curxor == 0) {
                out.println(0);
                return;
            }

            Arrays.sort(arr);
            int count = 0;
            for (int i = 0; i < 60; i++) {
                for (int j = n - 1; j >= 0; j--) {
                    if ((curxor ^ arr[j]) < curxor) {
                        curxor ^= arr[j];
                        count++;
                    }
                }
            }
            if (curxor == 0) {
                out.println(count);
            } else {
                out.println(-1);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 23712
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

// ^^^ Template ^^^ //


int main() {
	in(int, N, P);
	int c_even = 0, c_odd = 0, tmp;
	loop(i, N) {
		cin >> tmp;
		if (tmp & 1)
			++c_odd;
		else
			++c_even;
	}
	auto nCr = [](ll n, ll r) {
		ll ret = 1;
		loop(i, r) {
			ret *= n - i;
			ret /= i + 1;
		}
		return ret;
	};
	ll ans = 1, tmp_ans = 0;
	for (int i = P; i <= c_odd; i += 2)
		tmp_ans += nCr(c_odd, i);
	ans *= tmp_ans;
	ans *= std::pow<ll>(2, c_even);
	out(ans);
	return 0;
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}

signed main()
{   
    gearup;
    int n; cin >> n;
    ll res = 0;
    ll pre; cin >> pre;
    ll sum = 0;
    rep(i,n-1){
        ll num; cin >> num;
        if(pre >= num){
            sum++;
            pre = num;
        }
        else{
            pre = num;
            sum = 0;
        }
        res = max(res,sum);
    }
    cout << res << endl;
}

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

int main(void){
    int H1, M1, H2, M2, K;
    int th, tm;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    
    if((M2 - M1) < 0){
        tm = 60 + M2 - M1;
        th = H2 - H1 - 1;
    }
    else{
        tm = M2 - M1;
        th = H2 - H1;
    }
    tm = tm + th * 60;
    
    if((tm - K) < 0)    tm = 0;
    else    tm -= K;
    
    cout << tm << endl;
}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var ans = 0L;

            foreach (var item in a)
            {
                ans += TimesOfDivisible(item);
            }

            Console.WriteLine(ans);
        }


        public static int TimesOfDivisible(long x)
        {
            int res = 0;
            while (x % 2 == 0)
            {
                x /= 2;
                res++;
            }
            return res;
        }
    }
}


Measured memory_bytes: 14304
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)

H, W = [int(i) for i in input().split()]
S = [[j for j in input()]for i in range(H)]

INF = int(1e12)

def dfs(h, w, p):
    b_cnt = 0
    w_cnt = 0
    if h < 0 or h >= H or w < 0 or w >= W:
        return 0, 0
    if S[h][w] == p or S[h][w] == 'x':
        return 0, 0
    if S[h][w] == '#':
        b_cnt += 1
    elif S[h][w] == '.':
        w_cnt += 1
    t = S[h][w]
    S[h][w] = 'x'

    for dh, dw in ((0, 1), (0, -1), (1, 0), (-1, 0)):
        res = dfs(h + dh, w + dw, t)
        b_cnt += res[0]
        w_cnt += res[1]

    return (b_cnt, w_cnt)

ans = 0

for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            b_cnt, w_cnt = dfs(h, w, '.')
            ans += b_cnt * w_cnt

print(ans)

Measured memory_bytes: 151760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1000000007;
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int a,b,c;cin>>a>>b>>c;
        string ans="No";
        if(a==b&&a!=c){
            ans="Yes";
        }
        if(a==c&&a!=b){
            ans="Yes";
        }
        if(c==b&&a!=c){
            ans="Yes";
        }
        cout<<ans;
    }   
    return 0;   
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)


int main(){

    string s;
    cin >> s;
    int result = 9999, s_size=s.size()-2;

    REP(i,s_size){
        result = min(result, abs(((s[i] - '0') * 100) + ((s[i + 1] - '0') * 10) + ((s[i + 2] - '0')) - 753));
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 888