akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	string s;

	cin >> s;

	if (s.size() < 4) {
		cout << "No" << endl;
	}
	else {
		string s1 = s.substr(0, 4);

		if (s1 == "YAKI") {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}


}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef long long ll;



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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n),p,q;
    for(int i=0;i<n;i++)cin>>a[i];
    int m=a[0];
    for(int i=1;i<n;i++){
        m=gcd(m,a[i]);
    }


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

    for(int i=1;i*i<=a[0];i++){
        if(a[0]%i==0){
            p.push_back(i);
            if(i*i!=a[0])p.push_back(a[0]/i);
        }
    }
    for(int i=1;i*i<=a[1];i++){
        if(a[1]%i==0){
            q.push_back(i);
            if(i*i!=a[1])q.push_back(a[1]/i);
        }
    }

    int pm=0;
    int qm=0;
    for(int i=0;i<p.size();i++){
        int cnt=0;
        for(int j=0;j<n;j++){
            if(a[j]%p[i]!=0){
                cnt++;
            }
        }
        if(cnt==1)pm=max(pm,p[i]);
    }
    for(int i=0;i<q.size();i++){
        int cnt=0;
        for(int j=0;j<n;j++){
            if(a[j]%q[i]!=0){
                cnt++;
            }
        }
        if(cnt==1)qm=max(qm,q[i]);
    }

    cout<<max({pm,qm,m})<<endl;
    


}

   


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  unordered_set<int> st;
  int N;cin >> N;
  int x;
  rep(i,N){
    cin >> x;
    if(st.count(x)) st.erase(x);
    else st.insert(x);
  }
  cout << st.size() << endl;
  return 0;
}


Measured memory_bytes: 4388
#include <iostream>
#include <algorithm>
#include <cassert>
#include <set>

using namespace std;

#define	MAXN 100
int N, x;
int a;

void solve() {
	int ans;
	cin >> N >> x;
	multiset<int> s;
	long long sum_a = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> a;
		s.insert(a);
		sum_a += a;
	}


	if (sum_a < x) {
		ans = N - 1;
	}
	else {
		ans = 0;
		for (const auto &e : s) {
			x -= e;
			if (x >= 0) {
				ans++;
			}
			else {
				break;
			}
		}
	}

	cout << ans << endl;
	return;
}



int main() {
	solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long int
#define ld long double
#define ull unsigned long long
const double pi=3.14159265358979323846;
using namespace std;

bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 

ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }

    return result;
}

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    ull a;
    cin>>a;
    cout<<a+a*a+a*a*a<<"\n";

    
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define ll long long
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define Outerloop int q;cin>>q;while(q--)
#define Mod 1000000007
#define N 1e5

    int32_t main()
    {
    	int n,w;
    	cin >> n >> w;
    	
    	vector<pair<int,int>> v(n);	
    	f(i,0,n)
    	{
    		cin >> v[i].first >> v[i].second;
    	}
    	sort(v.begin(),v.end());
    	
    	int dp[n+5][w+5];
    	memset(dp,0,sizeof dp);
    	
    	f(i,1,n+1)
    	{
    		int temp=v[i-1].first;
    		for(int j=1;j<=w;j++)
    		{
    			if(j>=temp)
    			{
    				dp[i][j]=max(dp[i-1][j-temp]+v[i-1].second,dp[i-1][j]);
    			}
    			else dp[i][j]=dp[i-1][j];
    		//	cout<<dp[i][j]<<" ";
    		}
    		//cout<<E;
    	}
    	
    	
    	cout<<dp[n][w];
    	
    return 0;
    }

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

using namespace std;

int main() {

	int n;
	cin >> n;

	int counter = 0;
	int in1;
	int oldin=0;
	int zoukaflg = 0;
	for (int i = 0; i < n; i++) {
		cin >> in1;
		if (oldin == 0) {
			oldin = in1;
			counter++;
		}
		else {
			if (zoukaflg == 0) {
				if (in1 != oldin) {
					zoukaflg = (in1 - oldin) / (abs(in1 - oldin));
					oldin = in1;
				}
				else {
					zoukaflg = 0;
					oldin = in1;
				}
			}
			else {
				if (zoukaflg > 0 && in1 >= oldin) {
					oldin = in1;
				}
				else if (zoukaflg > 0 && in1 < oldin) {
					oldin = in1;
					zoukaflg = 0;
					counter++;
				}
				else if (zoukaflg < 0 && in1 <= oldin) {
					oldin = in1;
				}
				else {
					oldin = in1;
					zoukaflg = 0;
					counter++;
				}
			}
		}
	}

	cout << counter << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#define rep(i,n) for(int i=0;i<n;++i)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
int main() {
	vector<int> num(3); rep(i, 3)cin >> num[i];
	sort(num.rbegin(), num.rend());
	vector<int> d(3);
	int sum = 0;
	rep(i, 2) {
		d[i+1] = num[0] - num[i+1];
		sum += d[i + 1];
	}
	if (!(sum % 2)) cout << sum / 2 << endl;
	else cout << (sum + 3) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,c,k;
    cin>>a>>b>>c;
    cin>>k;
    while (b<=a)
    {
        b*=2;
        --k;
    }
    while (c<=b)
    {
        c*=2;
        --k;
    }
    if (k<0)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3684
from operator import itemgetter

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort(key=itemgetter(1))

now_time = 0
flag = True
for a, b in AB:
    now_time += a
    if now_time > b:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 89688
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int edge[50][50];
vector <int> st[50];
ll dp[50][1 << 20];

bool dfs(int cur, int par, int goal, int idx) {
    if (cur == goal) return true;

    for (int i = 0; i < 50; i++) {
        if (i == par) continue;
        if (edge[cur][i] != -1) {
            bool ret = dfs(i, cur, goal, idx);
            if (ret) {
                st[edge[cur][i]].push_back(idx);
                return true;
            }
        }
    }

    return false;
}

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

    int n;
    cin >> n;
    fill(edge[0], edge[n], -1);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        edge[a][b] = i;
        edge[b][a] = i;
    }

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        dfs(u, -1, v, i);
    }
    
    fill(dp[0], dp[n], 0LL);
    dp[0][0] = 1LL;

    for (int i = 0; i < n - 1; i++) {
        int mask = 0;
        for (int j : st[i]) mask += (1 << j);

        for (int j = 0; j < (1 << m); j++) {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j | mask] += dp[i][j];
        }
    }

    cout << dp[n - 1][(1 << m) - 1] << '\n';
    return 0;
}

Measured memory_bytes: 409856
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
const ll MOD=1e9+7;
const int N=500000;


main(){
    int n=in(),m=in();
    string s;cin>>s;
    vec ans;
    int now=n;
    while(now){
        rep3(i,m,1){
            if(now-i<0){
                continue;
            }
            if(s[now-i]=='0'){
                ans.pb(i);
                now=now-i;break;
            }
            if(i==1){
                cout<<-1;return 0;
            }
        }
    }
    reverse(all(ans));
    print(ans);
}

Measured memory_bytes: 1528
#include<iostream>
#include<string>

using namespace std;

int main () {
	long debt=100000;
	int n;
	cin >> n;
	for (; n > 0; --n) {
		debt *= 1.05;
		long a = (debt % 1000 == 0) ? 0 : 1;
		debt = (long)(debt / 1000 + a) * 1000;
	}

	cout << debt << endl;

	return 0;
}

Measured memory_bytes: 2952
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long
#define ld double
#define ull unsigned long long
#define PI pair < int, int > 

const int N = 5e5 + 123;
const int M = 123;
const ld Pi = acos(-1);
const ll Inf = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int Sz = 501;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) {
  return 1ll * a * b % mod;
}
int sum(int a, int b) {
  add(a, b);
  return a;
}

int n, a[N];
vector < int > g[N];

ll dfs(int v, int p = -1) {
  vector < ll > now;
  ll x = a[v];
  ll y = 0;
  for (auto to : g[v]) {
    if (to != p) {
      ll tmp = dfs(to, v);
      y += tmp;
      now.pb(tmp);
    }
  }
  if (now.size() == 0) return x;
  if (x > y) {
    cout << "NO\n";
    exit(0);
  }
  ll z = y - x;
  ll lim = y / 2;
  for (auto i : now) {
    if (2 * i > y) {
      lim = y - i;
      break;
    }
  }
  if (z > lim) {
    cout << "NO\n";
    exit(0);
  }
  x -= z;
  return x;
}
void solve() { 
  scanf("%d", &n);
  for (int i = 1;i <= n;i++) scanf("%d", &a[i]);
  for (int i = 1, u, v;i < n;i++) {
    scanf("%d%d", &u, &v);
    g[u].pb(v);
    g[v].pb(u);
  }
  if (n == 2) {
    if (a[1] != a[2]) cout << "NO\n";
    else cout << "YES\n";
    return;
  }
  int rt = 1;
  while(g[rt].size() == 1) rt++;
  if (dfs(rt) == 0) cout << "YES\n";
  else cout << "NO\n";
}

int main() {
  #ifdef wws
   freopen("in", "r", stdin);
   // freopen("in", "w", stdout);
  #endif 
//  ios_base::sync_with_stdio(0);
  int tt = 1; 
  while(tt--) solve();
  return 0;
}

Measured memory_bytes: 24960
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  long sum=0;
  for(int i=1;i<N+1;i++){
  if(i%3!=0&&i%5!=0)sum+=i;
  }

      cout<<sum<<endl;
 return 0;
}

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

int main() {
	string S, T, U;
	int A, B;

	cin >> S >> T >> A >> B >> U;

	if (U == S) {
		A -= 1;
	}
	else if (U == T) {
		B -= 1;
	}

	cout << A << " " << B;

}

Measured memory_bytes: 256
import copy

n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(k):
    b = [0] * (n + 1)
    for j in range(n):
        d = a[j]
        l = max(0, j - d)
        r = min(j + d + 1, n)
        b[l] += 1
        b[r] -= 1

    for j in range(n):
        b[j + 1] += b[j]
    b = b[:-1]

    if b == a:
        break
    a = copy.deepcopy(b)
print(*a, sep=' ')

Measured memory_bytes: 179828
n = int(input())
dict = {}
for _ in range(n):
    s = input()
    if s not in dict:
        dict[s] = 0
    dict[s] += 1

m = int(input())
for _ in range(m):
    t = input()
    if t not in dict:
        dict[t] = 0
    dict[t] -= 1
print(max(dict.values()) if max(dict.values()) > 0 else 0)


Measured memory_bytes: 3060
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()

    val a: MutableList<Long> = mutableListOf()
    
    for (i in 0..3*n-1) {
        a.add(cin.nextLong())
    }

    val a_sorted = a.sortedDescending()
    var ans: Long = 0
    for (i in 0..n-1) {
        ans += a_sorted[2*i + 1]
    }
    println(ans)
}

Measured memory_bytes: 115332
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>

using namespace std;
using pii=pair<int,int>;
using ll=long long;

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin>>n;
    int answer=0;
    for(int i=10;;i*=100){
        if(n<i){
            answer+=max(0,min(i,n)-i/10+1);
            break;
        }
        answer+=i-i/10;
    }
    cout<<answer;

    return 0;
}

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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    set<int> values;
    for (int i = 0; i < k; i++) {
        if (a <= b) {
            values.insert(a++);
            values.insert(b--);
        }
    }
    for (auto itr = values.begin(); itr != values.end(); itr++) {
        cout << *itr << endl;
    }
    return 0;
}

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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N, M;
  while(cin >> N >> M){
    vector<int> A(N); cin >> A;
    int s = accumulate(ALL(A), 0);

    int c = 0;

    for(auto &x : A){
      if(x * 4 * M >= s) ++c;

      
    }



    pout(c >= M ? "Yes" : "No");
  }


  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
D = defaultdict(int)
for i in range(M):
  b, c = map(int, input().split())
  D[c] += b
  
idx = 0
ans = 0

A.sort()

for c,b in sorted(D.items(), key=lambda x: x[0], reverse=True):
  for _ in range(b):
    if idx >= len(A):
      keep = False
      break
    if A[idx] < c:
      ans += c
      keep = True
    else:
      keep = False
      break
    idx += 1
  if keep:
    continue
  else:
    break
    
for i in range(idx, len(A)):
  ans += A[i]
  
print(ans)

Measured memory_bytes: 28572
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define INF 10000000000000009
#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int X;
    cin >> X;
    YES(X==3||X==5||X==7);
    return 0;
}   


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  while (true) {
    ll h, w; cin >> h >> w;
    if (h == 0 && w == 0) break;
    for (int i = 0; i < h; i++) {
      char c = i % 2 == 0 ? '#' : '.';
      for (int j = 0; j < w; j++) {
        cout << c;
        c = c == '#' ? '.' : '#';
      }
      outl("");
    }
    outl("");
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}



Measured memory_bytes: 3232
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d, e, f, g, h;
	cin >> a >> b >> c >> d >> e >> f >> g >> h;
	cout << max(a + b + c + d, e + f + g + h)<<endl;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int h,w,c,dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
vector<int> p(64);

int nu(int x,int y,int cl,int t){
  int res=1;
  p[y*w+x]=cl;
  for(int i=0;i<4;i++){
    int nx=x+dx[i],ny=y+dy[i];
    if(nx<0||w<=nx||ny<0||h<=ny||p[ny*w+nx]!=t||p[ny*w+nx]==cl)continue;
    res+=nu(nx,ny,cl,t);
  }
  return res;
}

int dfs(int d){
  if(d==4){
    nu(0,0,c,p[0]);
    return nu(0,0,7,p[0]);
  }
  vector<int> tp=p;
  int res=0;
  for(int j=1;j<7;j++){
    nu(0,0,j,p[0]);
    res=max(res,dfs(d+1)),p=tp;
  }
  return res;
}

int main(){
  while(cin>>h>>w>>c,h){
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)cin>>p[i*w+j];
    cout<<dfs(0)<<endl;
  }
  return 0;
}

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

int main(){
	int n;
	cin>>n;
	
	int nn=n;
	int sum=0;
	for(int i=0;n>0;i++){
		sum+=n%10;
		n=n/10;
	}
	
	
	if(nn%sum==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	return 0;
}		

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <stdlib.h>


int main()
{
	long long a, b, c, d;
	long long cd;
	long long c_div_a;
	long long d_div_a;
	long long cd_div_a;
	long long c_div_b;
	long long d_div_b;
	long long cd_div_b;
	long long bamari;
	long long aamari;
	long long x, tmp, r;
	long long constant;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	c_div_a = a / c;
	d_div_a = a / d;
	c_div_b = b / c;
	d_div_b = b / d;

	if ((a % c == 0 )|| (a % d == 0)) {
		constant = 0;
	}
	else {
		constant = 1;
	}
	x = c * d;

	/* 自然数 a > b を確認・入替 */
	if (c<d) {
		tmp = c;
		c = d;
		d = tmp;
	}

	/* ユークリッドの互除法 */
	r = c % d;
	while (r != 0) {
		c = d;
		d = r;
		r = c % d;
	}
	cd = x / d;

	cd_div_a = a / cd;
	cd_div_b = b / cd;
	bamari = b - (c_div_b + d_div_b - cd_div_b);
	aamari = a - (c_div_a + d_div_a - cd_div_a);

	printf("%lld\n", bamari - aamari + constant);
	return 0;

}

Measured memory_bytes: 128
import java.util.*;

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

		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		if(R - L < 2019) {
			L = L % 2019;
			R = R % 2019;
			int min = Integer.MAX_VALUE;
			if(L < R) {
				for(int i = (int)L; i <= R - 1; i++) {
					for(int j = i + 1; j <= R; j++) {
						min = Math.min(min, (i * j) % 2019);
					}
				}
			}
			else {
				for(int i = 0; i <= 2018; i++) {
					if(i <= R || L <= i) {
						for(int j = 0; j <= 2018; j++) {
							if((j <= R || L <= j) && i != j) {
								min = Math.min(min, (i * j) % 2019);
							}
						}
					}
				}
			}
			System.out.println(min);
		}
		else{
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
const int INF = 1e9;

long slice(long n)
{
    if (n == 1)
        return 1;
    return (long)1 + 2 * slice(n / 2);
}

int main()
{
    long n, h;
    std::cin >> h >> n;
    std::vector<int> a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        std::cin >> a[i] >> b[i];
    }

    std::vector<int> dp(h + 1, INF);
    dp[0] = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < n; j++)
        {
            dp[std::min(i + a[j], (int)h)] = std::min(dp[i] + b[j], dp[std::min(i + a[j], (int)h)]);
        }
    }

    std::cout << dp[h] << std::endl;
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int a, b;

signed main() {
    cin >> a >> b;
    if (max(a,b)<=9) cout << a*b << endl;
    else cout << -1 << endl;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,n=0;cin>>h>>w;
  vector<vector<char>>a(h,vector<char>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a.at(i).at(j);
      if(a.at(i).at(j)=='#')n++;
    }
  }
  if(n!=h+w-1)cout<<"Impossible"<<endl;
  else{
    vector<pair<int,int>>p(n);
    int s=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(a.at(i).at(j)=='#'){
          p.at(s).first=j;
          p.at(s).second=i;
          s++;
        }
      }
    }
    int t=0;
    for(int i=0;i<n-1;i++){
      if(p.at(i)>p.at(i+1)){
        t++;
        break;
      }
    }
    if(t>0)cout<<"Impossible"<<endl;
    else cout<<"Possible"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n/*都市数*/,m/*道路数*/;
	cin>>n>>m;
	int a[50],b[50],c[50];
	for(int i=0;i<n;i++)c[i]=0;
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		c[a[i]-1]++;
        c[b[i]-1]++;
	}
	for(int i=0;i<n;i++)cout<<c[i]<<endl;
    return 0;
}



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

int main(void){
    int n,c,k;
    cin >> n >> c >> k;
    int t[n];
    for(int i = 0;i < n;i++)cin >> t[i];
    sort(t,t+n);
    int num = 0,count = 0,sum = 0;
    for(int i = 0;i < n;i++){
        if(num >= t[i] && count < c){
            count++;
        } else {
            num = t[i]+k;
            count = 1;
            sum++;
        }
        //cout << t[i] << " ";
    }
    cout << sum << endl;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(),h.end());
    ll ans = 0;
    rep(i,n){
        if (i >= (n - k)) continue;
        ans += h[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
#define NUM 10
long long int mod = 1000000007;
long long power(int x, long long int y);
int main(void) {
	int n;
	long long int ans;
	scanf("%d", &n);
	ans = power(NUM, n) - (power(NUM - 1, n) + power(NUM - 1, n) - power(NUM - 2, n));
	ans=ans%mod;
	ans = (ans + mod) % mod;
	printf("%lld", ans);
	return 0;
}
long long int power(int x, long long int y) {
	long long int power_num = 1;
	int i;
	for (i = 0; i < y; i++) {
		power_num = power_num * x % mod;
	}
	return power_num;
}

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

using namespace std;

const int MAXN = 1e5 + 5;

long long x[5], k;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> x[0] >> x[1] >> x[2] >> k;
	sort(x, x + 3);
	while (k--)
		x[2] *= 2;
	cout << x[0] + x[1] + x[2] << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define dump(x) cout << (x) << endl;
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 114514810893364364;

int main() {
  Int n, m;
  cin >> n >> m;
  vector<Int> a(n + 1), b(m + 1);
  for (Int i = 1; i <= n; i++) cin >> a[i];
  for (Int i = 1; i <= m; i++) cin >> b[i];
  Int x = 0;
  for (Int i = 1; i <= n; i++) {
    x += a[i] * (i - 1);
    x = (x + mod) % mod;
    x -= a[i] * (n - i);
    x = (x + mod) % mod;
  }
  Int y = 0;
   for (Int i = 1; i <= m; i++) {
    y += b[i] * (i - 1);
    y = (y + mod) % mod;
    y -= b[i] * (m - i);
    y = (y + mod) % mod;
  }
  dump(x * y % mod);
  return 0;
}


Measured memory_bytes: 1792
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    vector<pair<ll,ll>> pf;

    for(ll i = 2; i * i <= p; i++){
        if(p % i != 0) continue;

        int cnt = 0;
        while(p % i == 0){
            p /= i;
            cnt++;
        }

        pair<ll,ll> tmp;
        tmp.first = i;
        tmp.second = cnt;
        pf.push_back(tmp);
    }

    if(p != 1){
        pf.push_back(make_pair(p, 1));
    }

    ll ans = 1;
    for(int i = 0; i < pf.size(); i++){
        for(int j = 0; j < pf[i].second / n; j++){
            ans *= pf[i].first;
        }
    }

    cout << ans << endl;
}


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

int main() {
  int h,n;
  cin >> h >> n;
  int a[h][4];
  memset(a,0,sizeof(a));
  for(int i=0; i<n; i++) {
    int x,y;
    cin >> y >> x;
    a[x][y]=1;
  }
  int dp[2][1<<6],r=0;
  for(int i=0;i<2;i++)for(int t=0;t<(1<<6);t++)dp[i][t]=-(1<<30);
  dp[0][0]=0;
  for(int i=0; i<h*4; i++) {
    for(int t=0; t<(1<<6); t++) {
      int x=i/4,y=i%4,s=t/2;
      for(int j=4; j>=0; j--) {
        y--;
        if(y<0) y=3,x--;
        if(x<0) break;
        if(a[x][y]&&!(t&(1<<j))) goto next;
      }
      x=i/4,y=i%4;
      if(a[x][y]) s|=1<<4;
      dp[r^1][s]=max(dp[r^1][s],dp[r][t]);
      if(!y||i<5) continue;
      if(a[x][y]||a[x][y-1]||a[x-1][y]||a[x-1][y-1]||(t&51));
      else {
        s=(t/2)|25;
        dp[r^1][s]=max(dp[r^1][s],dp[r][t]+1);
      }
    next:;
    }
    memset(dp[r],0,sizeof(dp[r]));
    r^=1;
  }
  int ans=0;
  for(int t=0; t<(1<<6); t++) ans=max(ans,dp[r][t]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3240
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;
llint gcd(llint x, llint y) {
	while (y != 0) {
		if (x > y) {
			llint r = x % y;
			x = y;
			y = r;
		}
		else {
			llint r = y % x;
			y = r;
		}
	}
	return x;
}


int main(void){
	vint a(3);
	for (int i = 0; i < 3; i++)cin >> a[i];
	sort(a.begin(), a.end());
	cout << a[0] + a[1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    ll x,y;
    scanf("%lld%lld",&x,&y);


    ll ans = 0;

    if(x%y==0){
        ans = -1;
    }else{
        ans = x;
    }
    
    cout << ans << endl;
    return 0;
}
 
 


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

typedef long long ll;

int c[10][10];
int H, W, A, res;

int main() {
    cin >> H >> W;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> c[i][j];
        }
    }

    for (int k = 0; k < 10; k++) {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (c[i][j] > c[i][k]+c[k][j]) {
                    c[i][j] = c[i][k]+c[k][j];
                }
            }
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> A;
            if (A >= 0) {
                res += c[A][1];
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	int n;
	int[] a;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	}

	Main(Scanner sc) {
		n = sc.nextInt();
		a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
		}
	}

	void solve() {
		int ans = 1;
		int sign = 0;
		for(int i=0;i<n-1;i++){
			switch(sign){
			case 0:
				if(a[i]<a[i+1]){
					sign = 1;
				} else if(a[i]>a[i+1]){
					sign = -1;
				}
				break;
			case 1:
				if(a[i]>a[i+1]){
					sign=0;
					ans++;
				}
				break;
			case -1:
				if(a[i]<a[i+1]){
					sign=0;
					ans++;
				}
				break;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 50264
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;cin>>N;
  long long H=1;bool F=false;bool J=false;long long P=0;long long U=1;
  for(int X=0;X<N;X++){
    long long A;cin>>A;
    string S=to_string(A);P+=S.size()-1;
    if(A==0)J=true;
    H*=A;U*=A;
    if(H/1000000000000000001!=0)F=true;
    H%=1000000000000000001;
  }
  if(J)cout<<0<<endl;
  else if(U==1000000000000000000)cout<<1000000000000000000<<endl;
  else if(F||P>=18)cout<<-1<<endl;
  else cout<<H<<endl;
}

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

int main()
{
    int a,b,c,d,e;
    int sum = 0;
    int cnt = 0;

    cin >> a >> b >> c >> d >> e;
    sum = a + b + c + d + e;
    
    if(a == 0){
        cout << b - 1;
        return 0;
    }
    if (b == 0)
    {
        cout << c- 1;
        return 0;
    }
    if (c == 0)
    {
        cout << d - 1;
        return 0;
    }
    if (d == 0)
    {
        cout << e - 1;
        return 0;
    }
    if (e == 0)
    {
        cout << d + 1;
        return 0;
    }
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    string o, e;
    cin >> o >> e;
    for(int i = 0; i < o.size(); ++i){
        if(i >= e.size()){
            cout << o[i] << endl;
            return 0;
        }
        cout << o[i] << e[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int i, f, n, m, c, a[21][21], b[20], count, ans[21];
int main(void)
{
    scanf("%d%d%d", &n, &m, &c);
    for (i = 0; i < m; i++)
    {
        scanf("%d", &b[i]);
    }
    for (i = 0; i < n; i++)
    {
        for (f = 0; f < m; f++)
        {
            scanf("%d", &a[i][f]);
        }
    }
    for (i = 0; i < n; i++)
    {
        for (f = 0; f < m; f++)
        {
            ans[i] += a[i][f] * b[f];
        }
    }
    for (i = 0; i < n; i++)
    {
        if (ans[i] + c > 0)
        {
            count++;
        }
    }
    printf("%d", count);
    return 0;
}

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

#define lint long long
#define P pair<int, int>

int main() {
    int N;
    cin >> N;
    
    int C[N], S[N], F[N];
    
    for(int i = 0; i < N - 1; ++i){
        cin >> C[i] >> S[i] >> F[i];
    }
    
    for(int i = 0; i < N - 1; ++i){
        int time = 0;
        for(int j = i; j < N - 1; ++j){
            time = max(S[j], ((time - 1) / F[j] + 1) * F[j]);
            time += C[j];
        }
        
        cout << time << endl;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

#define REP(i,n) for(int i=0; i<n; ++i)

typedef unsigned long long u64;
typedef long long i64;

u64 x,y,z,k;
u64 a[1005];
u64 b[1005];
u64 c[1005];

u64 p[3005];
u64 q[3005];

u64 v[3000005];

void d(u64 s[1005],u64 s1, u64 t[1005], u64 t1, u64 u[3005]) {
        REP(i,s1) {
                REP(j,t1) {
                        v[i*t1 + j] = s[i] + t[j];
                }
        }

        sort(v,v+s1*t1, greater<u64>());
        REP(i,k)
                u[i] = v[i];

}

void solve() {
        d(a,x, b,y, p);
        d(p,k, c,z, q);

        REP(i,k)
                cout << q[i] << endl;
}

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

        cin >> x >> y >> z >> k;
        REP(i,x)
                cin >> a[i];
        REP(i,y)
                cin >> b[i];
        REP(i,z)
                cin >> c[i];

        sort(a,a+x, greater<u64>());
        sort(b,b+x, greater<u64>());
        sort(c,c+x, greater<u64>());

        solve();


        return 0;
}


Measured memory_bytes: 23808
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define yn(a) cout <<((a)?"Yes":"No")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {
    
    int sa=0;
    vector<int> a(3);
    FOR(i,0,2){
        cin >>a[i];
    }
    SORT(a);
    sa=abs(a[2]-a[0]);
    cout <<sa<<endl;

    return 0;
}

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N;
    cin >> N;
    V<ll> A(N);
    for(auto &&e : A) cin >> e;
    ll sum = 0;
    for(ll i = 0; i < N; i++) {
        if(i & 1) sum -= A[i];
        else sum += A[i];
    }
    ll x = sum;
    V<ll> ans(N);
    ans[0] = x;
    for(ll i = 1; i < N; i++) {
        ll pre = ans[i - 1];
        ans[i] = (A[i - 1] - pre / 2) * 2;
    }

    for(ll i = 0; i < N; i++) cout << ans[i] << " \n"[i + 1 == N];
    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep (i, N)
    cin >> A[i];
  vector<int> B(N);
  rep (i, N)
    cin >> B[i];
  vector<int> C(N);
  rep (i, N)
    cin >> C[i];

  sort(all(A));
  sort(all(B));
  sort(all(C));

  ll ans = 0;
  rep (i, N) {
    ll a = lower_bound(all(A), B[i]) - A.begin();
    ll c = N - (upper_bound(all(C), B[i]) - C.begin());
    ans += a * c;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x1,x2,a1,a2,MOD=1000000007,bik[2000003],ans;
ll f(ll x,ll y){
    if(y==1)return x;
    if(y%2==1)return f(x,y-1)*x%MOD;
    else return f(x,y/2)*f(x,y/2)%MOD;
}
ll comb(ll x,ll y){
    return bik[x+y]*f(bik[y],MOD-2)%MOD*f(bik[x],MOD-2)%MOD;
}
int main(void){
    cin>>x1>>a1>>x2>>a2;
    bik[0]=1;
    for(ll i=1;i<=2000002;i++){
        bik[i]=bik[i-1]*i%MOD;
    }
    ans=comb(a2+1,x2+1)-comb(x2+1,a1)-comb(a2+1,x1)+comb(a1,x1);
    ans%=MOD;
    ans=(ans+MOD)%MOD;
    cout<<ans<<endl;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void DFS(vector<vector<long>> &G,vector <long> &A,long a,long p,long c) {
    A[a] = c;
    for(auto b:G[a]) {
        if(p==b || A[b]!=0) continue;
        DFS(G,A,b,a,c);
    }
}

long Solve(vector <vector <long> > &G) {
    long n = G.size();
    vector <long> A(n,0);
    long c = 0;
    for(int i=0;i<n;i++) {
        if(A[i]==0) {
            c++;
            DFS(G,A,i,-1,c);
        }
    }
    unordered_map <long,long> M;
    for(int i=0;i<n;i++) M[A[i]]++;
    long mx = 0;
    for(auto a:M) mx = max(mx,a.second);
    return mx;
}

void Crack() {
	long n,m,a,b;
    cin >> n >> m;
    vector <vector <long>> G(n);
    for(int i=0;i<m;i++) {
        cin >> a >> b;
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    cout << Solve(G) << endl;
}

int main() {
	Boost;
    Crack();
	return 0;
}

Measured memory_bytes: 31384