akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

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



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

	while (1) {
		ll n, p;
		scanf("%lld %lld", &n, &p);
		if (n == 0 && p == 0) break;
		ll ini = p;
		vector<ll> a(n);
		ll res = 0;
		bool flag = false;
		while (1) {
			for (ll i = 0; i < n; i++) {
				if (p == 0) {
					p += a[i];
					a[i] = 0;
				}
				else {
					a[i]++;
					p--;
					if (p == 0 && a[i] == ini) {
						res = i;
						flag = true;
						break;
					}
				}
			}
			if (flag)break;
		}
		//puts("a");
		printf("%lld\n", res);
	}
	return 0;
}



Measured memory_bytes: 3184
from collections import deque, defaultdict

def bfs(i, V, E):
    S = deque()
    S.append(i)
    V[i] = 1
    while(len(S) > 0):
        vi = S.popleft()
        for j in E[vi]:
            if V[j] == 0:
                V[j] = vi
                S.append(j)
    return V

n, m = map(int, input().split())
V = [0 for _ in range(n + 1)]
E = [[] for _ in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)
V = bfs(1, V, E)
print('Yes')
print(*V[2:], sep='\n')


Measured memory_bytes: 35396
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
    int n;
    cin>>n;
    bool ch=false;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a%2!=0) ch=true;
    }
    if(ch) cout<<"first"<<endl;
    else cout<<"second"<<endl;
    return 0;
}

Measured memory_bytes: 256
S = input()

init0 = 0
init1 = 0
for i in range(len(S)):
    if i % 2 != int(S[i]):
        init0 += 1
    if i % 2 == int(S[i]):
        init1 += 1

#print(init0, init1)
print(min(init0, init1))


Measured memory_bytes: 3188
#include <stdio.h>
int main (void)
{
	int A;
	int B;
	int C;
	
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	
	if ((A+B)>=C){
		printf("Yes");
	}
	else {
		printf("No");
	}
	return(0);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
#define mop2 998244353

using namespace std;

int main() {
	ll n;
	cin >> n;
	n %= 10;
	if (n == 3) {
		cout << "bon" << endl;
	}
	else if (n == 0 or n == 1 or n == 6 or n == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}

}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

main()
{
    int n,k,s; cin>>n>>k>>s;

    int t=0;
    if(s==1e9)t=1;
    vi v(n,1e9-t);
    rep(i,k)v[i]=s;

    each(it,v)cout<<it<<" ";
    cout<<endl;
}

Measured memory_bytes: 1664
#include <stdio.h>

int main()
{
 int i,a[100],n,flag=0;
  
  scanf("%d", &n);
  
  for(i=0;i<n;i++){
    scanf("%d", &a[i]);
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0)
      flag = 1;
    }
  }
  
  if(flag==0)
    printf("APPROVED");
  else
    printf("DENIED");
  
  return 0;
}

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

int mod = 1e9 + 7;
long long c[2001][2001];
int main()
{
	int N, K;
	cin >> N >> K;
	
	// create combination lookup table
	c[0][0] = 1;
	for (int i = 1; i <= 2000; ++i)
	{
		c[i][0] = c[i][i] = 1;
		for (int j = 1; j <= i - 1; ++j)
			c[i][j] = (c[i-1][j-1]%mod + c[i-1][j]%mod)%mod;
	}
	
	// compute arrangements
	for (int i = 1; i <= K; ++i)
		cout << (c[K-1][i-1] * c[N-K+1][i])%mod << '\n';
}


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

int main() {
    int n;
    ll power = 1;
    cin >> n;
    FOR(i, n) {
        power = ((i + 1) * power) % 1000000007;
    }
    cout << power % (1000000007) << endl;

    return 0;
}


Measured memory_bytes: 256
a=input()
b=input()
n=0
c=1
S=""
if len(a)==len(b):
    for _ in range(len(a)):
        S=(S+(a[n]+b[n]))
        n+=1
    print(S)
else:
    for _ in range(len(b)):
        S=(S+(a[n]+b[n]))
        n+=1
    print(S+a[n])


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

using namespace std;

int main() {
    string a = "", b = "", c = "";
    cin >> a >> b >> c;

    if (a.at(a.length() - 1) == b.at(0) && b.at(b.length() - 1) == c.at(0)) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3636
n = int(input())
t = [int(input()) for i in range(n)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    g_a = a // g
    g_b = b // g
    return g_a * g_b * g

ans = t[0]
for i in range(n-1):
    ans = lcm(ans, t[i+1])

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
// #define int LL

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  int n,k,c;cin >> n >> k >> c;
  string s;cin >> s;
  map<int,vector<int>> tt;
  int mx[n+1];
  mx[n] = 0;
  for(int i=n-1;i>=0;i--){
    if(s[i]=='x') mx[i] = mx[i+1];
    else{
      mx[i] = 1;
      int nxt = i + c + 1;
      if(nxt<n) mx[i] += mx[nxt];
    }
  }
  if(mx[0]>k) return 0;
  int vis[n];
  memset(vis,0,sizeof(vis));
  vis[0] = 1;
  for(int i=0;i<n;i++){
    if(vis[i]==0) continue;
    if(i+1<n && mx[i+1]==mx[i]) vis[i+1] = 1;
    if(s[i]=='o'){
      int nxt =i + c + 1;
      if(nxt<n) vis[nxt] = 1;
    }
  }
  for(int i=0;i<n;i++){
    if(s[i]=='o' && vis[i]) tt[mx[i]].push_back(i+1);
  }
  vector<int> ans;
  for(auto it:tt){
    if(it.second.size()==1) ans.push_back(it.second[0]);
  }
  sort(ALL(ans));
  for(auto it:ans) cout << it << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

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

int main()
{
int i;
int iCnt;
int N, K;
int iSum;
int A[ 5010 ];

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> K;

	for( i = 0; i < N; i++ ) cin >> A[ i ];

	sort( A, A + N );

	iSum = 0;
	iCnt = 0;
	for( i = N - 1; i >= 0; i-- )
	{
		if( iSum + A[ i ] >= K )
			iCnt = 0;
		else
		{
			iCnt++;
			iSum += A[ i ];
		}
	}

	cout << iCnt << endl;

	return 0;
}


Measured memory_bytes: 256
A,B,C,D,E,F = map(int,input().split())
A,B = 100*A,100*B

def ql():
    ans = (0,A)
    for a in range(0,F,A):
        for b in range(0,F,B):
            for c in range(0,F,C):
                for d in range(0,F,D):
                    wat = (a + b)
                    sug = (c + d)
                    if wat == 0:
                        break
                    if wat+sug > F or 100*sug > E*wat:
                        break
                    elif 100*sug == E*wat:
                        return (sug,wat)
                    elif sug*ans[1] > ans[0]*wat:
                        ans = (sug,wat)  
    return ans
ans = ql()
print(str(ans[0]+ans[1]) + " " + str(ans[0]))

Measured memory_bytes: 3064
/**
*    author:  yuya1234
*    created: 25.07.2020 21:00:11
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))

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 gcd(int a,int b){return b?gcd(b,a%b):a;}

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

  int x;
  cin>>x;

  int ans=(x-200)/200;
  cout<<8-ans+1<<endl;

  return 0;
}

Measured memory_bytes: 3648
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')



def solve():
    
    # for _ in range(ii()):

    s=si()
    if 'a'<=s[0]<='z':
        print('a')
    else:
        print('A')

    










        
if __name__ =="__main__":

    if path.exists('input.txt'):
        sys.stdin=open('input.txt', 'r')
        sys.stdout=open('output.txt','w')
    else:
        input=sys.stdin.readline
    solve()


Measured memory_bytes: 69768
#include<stdio.h>

int main() {

	int a, b, c, d;
	scanf("%d%d%d%d",&a,&b,&c,&d);

	if (a + b > c + d) printf("Left");
	else if (a + b < c + d) printf("Right");
	else printf("Balanced");


	return 0;
}

Measured memory_bytes: 128
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;


long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

vector <int> g[MAXN];
int dp[MAXN];

int dfs(int v) {
	vector <int> tmp;
	for (int i : g[v]) {
		dfs(i);
		tmp.push_back(dp[i]);
	}
	int sz = g[v].size();
	sort(tmp.begin(), tmp.end());
	reverse(tmp.begin(), tmp.end());
	dp[v] = sz;
	for (int i = 0; i < sz; i++) {
		dp[v] = max(dp[v], tmp[i] + i + 1);
	}
}


int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 2; i <= n; i++) {
    	g[readInt()].pb(i);
    }
	dfs(1);
	cout << dp[1];    
    return 0;
}

Measured memory_bytes: 38400
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N, K;
    cin >> N >> K;
    map<int, int> mp;
    rep(i, N) {
        int t;
        cin >> t;
        mp[t]++;
    }

    priority_queue<int, vector<int>, greater<int>> q;
    for(auto& p: mp) {
        q.push(p.se);
    }

    int res = 0;
    while(q.size() > K) {
        res += q.top();
        q.pop();
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 14964
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;

int main()
 {
 long long 	int n,m,a,b,c,d,e,f,g,sum;
 	cin>>n>>m;
 	a=n*(n-1)/2;
 	b=m*(m-1)/2;
 	sum=a+b;
 	cout<<sum<<endl;
 	return 0;
}
 	
 					

Measured memory_bytes: 3596
#include <stdio.h>

int main(void){
  long long x;
  scanf("%lld",&x);

  long long cnt = (x/11)*2;
  x %= 11;

  if(x%11 == 0) cnt--;
  if(x > 6) cnt += 2;
  else cnt++;


  printf("%lld\n",cnt);

  return 0;
}

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



int sc1() {int x; scanf("%d", &x); return x;}

long long sc2() {long long x; scanf("%lld", &x); return x;}

#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>



std::vector<int> adj[200005];
ll cnt[200005];
bool vis[200005];
ll ans[200005];

void dfs(int s, ll vl)
{
	vis[s] = 1;
	ll xx = cnt[s] + vl;
	ans[s] = xx;
	for (int i = 0; i < adj[s].size(); i++ )
	{
		int sss= adj[s][i];
		if(!vis[sss]) dfs(sss,xx);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n = Int;
	int q = Int;
	for (int i = 0; i < n - 1; i++)
	{
		int u = Int, v = Int;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	while (q--)
	{
		int ver = Int;
		int val = Int;
		cnt[ver] += val;
	}

	dfs(1, 0);

	for(int i=1;i<=n;i++)
	{
		 cout<<ans[i];
		 if(i!=n) cout<<" ";
	}
	cout<<endl;
	return 0;
}




Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll a, b;
    cin >> a >> b;
    cout << 6-a-b << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

const int mod = 1000000007;

ll pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n % 2 == 1) res = res * x % mod;
        x = x * x % mod;
        n = n / 2;
    }
    return res;
}

ll modInverse(ll x) {
    return pow(x, mod - 2);
}

ll combination(ll n, ll k) {
    ll u = 1, d = 1;
    for (int i = 0; i < k; ++i) {
        u = u * (n - i) % mod;
        d = d * (1 + i) % mod;
    }
    return u * modInverse(d) % mod;
}

int main() {
    int n, a, b, c = 1;
    cin >> n >> a >> b;
    ll res = pow(2, n) - 1;
    res = (res + mod - combination(n,a)) % mod;
    res = (res + mod - combination(n,b)) % mod;
    cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
int main(){
vector<int> v;
int a,b,c;
cin >> a >> b >> c;
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(), v.end());
if(v[0] == 5 && v[1] == 5 && v[2] == 7){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
 
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	int a[30] = {};
	string s;
	bool f = true;
	cin >> s;
	rep(i, s.size()) a[s[i] - 'a']++;
	rep(i, 30) if(a[i] >= 2) f = false;
	cout << (f ? "yes" : "no") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    while (1) {
        int n;
        cin>>n;
        if (n==0)break;
        int T[10]={0};
        for (int i=0; i<n; i++) {
            int x;
            cin>>x;
            T[x]++;
        }
        for (int i=0; i<10; i++) {
            for (int j=0; j<T[i]; j++) {
                cout<<"*";
            }
            if (T[i]==0) {
                cout<<"-";
            }
            cout<<endl;
        }

    }
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define int  long long int
#define mod 1000000000000007
#define pb push_back
#define mp make_pair
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(i) i.begin(),i.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define set_bit __builtin_popcount //gives number of set_bits
#define ff first
#define ss second
#define cases(t) int t;cin>>t; rep(casn,1,t+1)
#define el cout<<"\n";
#define deci(n) int n; scanf("%lld",&n);
#define decs(n) string n; cin>>n;
#define sz(v) v.size()
#define repit(m) for(auto it=m.begin();it!=m.end();it++)
// #define find(m,i) (m.find(i)!=m.end())
// #define find(m,i) (m.find(i)==m.end())
#define cYES cout<<"YES\n";
#define cNO cout<<"NO\n";
#define ins insert
#define imax 1000000000000000000
#define imin -1000000000000000000
// #define NP 50000
//  cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
 
//  IIITA
//SUNEET KUMAR -->  ਸੁਨੀਤ
 
// scanning numbers extremely fast/////////
void fs(int &number)
{
    bool negative = false;
    register int c;
    number = 0;
    c = getchar();
    if (c=='-')
    {
        negative = true;
        c = getchar();
    }
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;
    if (negative)
        number *= -1;
}
// ========================================
int power(int a,int x)
{
        a%=mod;
    int res=1;
    while(x>0)
    {
        if(x&1)
        res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}
int max(int a,int b)
{
    if(a>b)
    {
        return a;
    }
    else
    {
        return b;
    }
}
int min(int a,int b)
{
    if(a>b)
    {
        return b;
    }
    else
    {
        return a;
    }
}
int madd(int a,int b)
{
    int ans;
    ans=(a%mod+b%mod)%mod;
    return ans;
}
int mmult(int a,int b)
{
    int ans=1;
    ans=((a%mod)*(b%mod))%mod;
    return ans%mod;
}
int modinverse(int a)
{
    return power(a,mod-2);
}
 
void nhi_degi()
{
    int n=100;
    int x;cin>>x;
    int count=0;
    while(n<x)
    {
        count++;
        n+=(n/100);
    }
    cout<<count;el
}
signed main()
{
    // cases(t)
    // {
        nhi_degi();
    // }
}

Measured memory_bytes: 3628
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
	int A, B;
	cin >> A >> B;
	for( int i = 1; i <= 3; ++i )
	{
		if( ( A * B * i ) % 2 == 1 )
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = int;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

vector<bool> seen;

vector<ll> ans(200010);
vector<set<int>> child(200010);
void dfs(const Graph &G, int v)
{
    seen[v] = true;
    for (auto &&next_v : G[v])
    {
        if (seen[next_v])
            continue;
        ans[next_v] += ans[v];
        dfs(G, next_v);
    }
}
int main()
{

    long long N;
    scanf("%lld", &N);
    long long Q;
    scanf("%lld", &Q);
    Graph G(N);
    std::vector<long long> a(N - 1);
    std::vector<long long> b(N - 1);
    for (int i = 0; i < N - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
    }
    for (int i = 0; i < Q; i++)
    {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }
    seen.assign(N,false);
    dfs(G, 0);

    for (int i = 0; i < N; i++)
    {
        cout << ans[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 36992
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("no-stack-protector")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

const ll LINF = 9187201950435737471;
const ll nLINF = -9187201950435737472;
const ll INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const ll MAXN = 1e5 + 15;
const ll MAXE = 1000 + 15;
const double PI = acos(-1);
const ll MOD = 998244353;
const double EPS = 1e-10;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(seed);

bool isEqual(double a, double b) {
    return abs(a - b) <= EPS;
}

#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) ((_v) * (_v))
#define vpi vector<pair<int, int>>
#define eb emplace_back
#define pb push_back
#define mod(x, m) ((x) % m + ((x) < 0  && ((x % m) != 0) ? m : 0))
#define vi vector<int>
#define pi pair<int, int>
#define minq(x, y) (x) = min(x, y)
#define maxq(x, y) (x) = max(x, y)


inline void IO() {
#if(DEBUG_LEVEL > 0)
    freopen("../input.txt", "r", stdin);
    freopen("../out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
}

template <typename T>
istream& operator >> (istream& in, vector<T>& a) {
    for (auto& i : a)
        in >> i;
    return in;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T>& a) {
    for (auto& i : a) {
        out << i << " ";
    }
    return out;
}

template <typename T, typename D>
istream& operator >> (istream& in, pair<T, D>& a) {
    in >> a.first >> a.second;
    return in;
}

template <typename T, typename D>
ostream& operator << (ostream& out, const pair<T, D>& a) {
    out << a.first << " " << a.second;
    return out;
}

#define int ll

int n, k;
vi a, preff1, preff2;

int get(int l, int r, const vi &preff) {
    if (l > r || r < 0) {return 0;}
    l = max(l, (ll)0);
    r = max(r, (ll)0);
    int ans = preff[r];
    if (l != 0) {
        ans -= preff[l - 1];
    }
    return ans;
}

inline void solve() {
    cin >> n >> k;
    a.resize(n);
    preff1.resize(n);
    preff2.resize(n);
    cin >> a;
    preff1[0] = a[0];
    preff2[0] = max((ll)0, a[0]);
    for (int i = 1; i < n; ++i) {
        preff1[i] = preff1[i - 1] + a[i];
        preff2[i] = preff2[i - 1];
        if (a[i] > 0) {
            preff2[i] += a[i];
        }
    }
    int ans = 0;
    for (int i = k - 1; i < n; ++i) {
        int l = i - k + 1;
        maxq(ans, max((ll)0, get(l, i, preff1)) + get(0, l - 1, preff2) + get(i + 1, n - 1, preff2));
    }
    cout << ans;
}

signed main() {
    IO();
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}





Measured memory_bytes: 5560
#include <bits/stdc++.h>
using namespace std;
using edge= pair<int, int64_t>;
using Graph= vector<vector<edge>>;
const int64_t INF= 1e15;

void solve(const Graph &gph, int s, vector<int64_t> *scores){
  const int N= gph.size();

  scores->at(s)= 0;
  queue<int> s_inf;
  for(int d=1; d<=N; d++){
    for(int from=0; from<N; from++){
      for(auto e:gph.at(from)){
        int to; int64_t reward;
        tie(to, reward)= e;
        if(scores->at(to) < scores->at(from)+ reward){
          scores->at(to)= scores->at(from)+ reward;

          if(d==N){
            scores->at(to)= INF;
            s_inf.push(to);
          }
        }
      }
    }
  }

  if(s_inf.size()){
    while( !s_inf.empty() ){
      int from= s_inf.front();
      s_inf.pop();
      for(auto e:gph.at(from)){
        int to;
        tie(to, ignore)= e;

        if(scores->at(to) < INF){
          scores->at(to)= INF;
          s_inf.push(to);
        }
      }
    }
  }
}

int main(){
  int N,M;
  cin >> N >> M;

  Graph gph(N);
  int v1,v2; int64_t score;
  for(int j=0; j<M; j++){
    cin >> v1 >> v2 >> score;
    v1--; v2--; // 1-indexed -> 0-indexed
    gph.at(v1).emplace_back(make_pair(v2, score));
  }

  vector<int64_t> scores(N, -INF);
  solve(gph, 0, &scores);

  string ans= (scores.back() < INF) ? to_string(scores.back())
                                    : "inf";

  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int K;
    cin >> K;
    
    int ans = 0;
    for (int i = 1; i <=K; i++){
        for (int j = 1; j <= K; j++){
            for (int k = 1; k <= K; k++){
                ans += __gcd(i,__gcd(j,k));
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n;
	cin>>n;
	ll x = 1;
	while(x <= n){
		x *= 2;
	}
	cout<<x-1;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
c,s,f=[0]*(n-1),[0]*(n-1),[0]*(n-1)
for i in range(n-1):
  c[i],s[i],f[i]=map(int,input().split())
for i in range(n-1):
  ans=s[i]+c[i]
  for j in range(i+1,n-1):
    if s[j]>ans:
      ans=s[j]+c[j]
    else:
      ans+=(f[j]-ans%f[j])%f[j]+c[j]
  print(ans)
print(0)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b+c>=22){
		cout<<"bust"<<endl;
	}else{
		cout<<"win"<<endl;
	}
}

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

typedef vector <long long> vi;
typedef vector <vi> vvi;
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define ll long long

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

    ll len1 = sz(s), len2 = sz(t);

    ll dp[len1 + 1][len2 + 1];

    for (int i = 0; i <= len1; i++)
    {
        for (int j = 0; j <= len2; j++)
        {
            if (i == 0 && j == 0)
                dp[i][j] = 0;
            else if (i == 0)
                dp[i][j] = dp[i][j - 1];
            else if (j == 0)
                dp[i][j] = dp[i - 1][j];
            else
            {
                if (s[i - 1] == t[j - 1])
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                else
                    dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    ll i = len1, j = len2, k = 0;
    char ans[dp[len1][len2]];
    while(j != 0)
    {
        if (dp[i][j] != dp[i][j - 1])
            if (dp[i][j] != dp[i - 1][j])
                ans[k] = t[j - 1], i--, j--, k++;
            else
                i--;
        else
            j--;
    }
    
    while(k--)
        cout << ans[k];
    cout << "\n";
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
int n;string p,s;
int main()
{
	cin>>n>>p>>s;int ls=0;
	for(int i=1;i<=n;i++) 
	{
		if(p.substr(n-i)==s.substr(0,i))
			ls=max(ls,i);
	}
	cout<<n*2-ls;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
LL a, b;
LL ans;
 
int main() {
	while(~scanf("%lld %lld", &a, &b)) {
		ans = abs(a * b - a * 2 - (b - 2) * 2);
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 128
N = int(input())
nS = [0 for i in range(N)]
nV = [0 for i in range(N)]
nS  = input().rstrip().split(' ')

for i in range(N):
    nV[i] = int(nS[i])

nV = sorted(nV, reverse = True)

nA = 0
nB = 0


for i in range(N):
    Tmp = i % 2
    if Tmp == 0:
        nA += nV[i]
    else:
        nB += nV[i]
        
Ans = nA - nB

print(Ans)



Measured memory_bytes: 3064
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;
int n,m;
string st[110];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>st[i];
	sort(st+1,st+1+n);
	for(int i=1;i<=n;i++)
		cout<<st[i];
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc108/tasks/abc108_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int x1, x2, y1, y2;

  cin >> x1 >> y1 >> x2 >> y2;

  int dx = abs(x2 - x1),
      dy = abs(y2 - y1),
      x3, y3, x4, y4;

  if (x1 <= x2)
  {
    if (y1 <= y2)
    {
      x3 = x2 - dy;
      y3 = y2 + dx;
      x4 = x1 - dy;
      y4 = y1 + dx;
    }
    else
    {
      x3 = x2 + dy;
      y3 = y2 + dx;
      x4 = x1 + dy;
      y4 = y1 + dx;
    }
  }
  else
  {
    if (y1 <= y2)
    {
      x3 = x2 - dy;
      y3 = y2 - dx;
      x4 = x1 - dy;
      y4 = y1 - dx;
    }
    else
    {
      x3 = x2 + dy;
      y3 = y2 - dx;
      x4 = x1 + dy;
      y4 = y1 - dx;
    }
  }

  cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int num;
	int ary[10000];
	int i;
	long min = 1000000;
	long max = -1000000;
	long sum = 0;


	scanf("%d\n",&num);

	for(i = 0; i < num; i++)
	{
		scanf("%d",&ary[i]);
		if(min > ary[i]){
			min = (long)ary[i];
		}
		if(max < ary[i]){
			max = (long)ary[i];
		}
		sum += (long)ary[i];
	}

	printf("%ld %ld %ld\n",min,max,sum);
	return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

bool b_search(int border, int n, int k, vector<int> w){
	int t = 0, i = 0;
	while(i < n && t < k){
		int sum = 0;
		while (sum + w[i] <= border && i < n) sum += w[i++];
		t++;
	}
	return i == n;
}

void solve(){
	int n, k;
	cin >> n >> k;
	vector<int> w(n);
	for (int i = 0; i < n; i++) cin >> w[i];
	long left = 0, right = 1000000000;
	while (left < right - 1){
		int mid = (left + right) / 2;
		if (b_search(mid, n, k, w)) right = mid;
		else left = mid;
	}
	if (b_search(left, n, k, w)) cout << left << endl;
	else cout << right << endl;
}

signed main(){
	solve();
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

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

    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int idx = 1;
    for (int i = 1; i <= n; i++) {
        if (a[idx] == 0) {
            break;
        } else if (a[idx] == 2) {
            cout << i << endl;
            return 0;
        }
        idx = a[idx];
    }

    cout << -1 << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

vector<ll> v,p;
vector<ll> v2,p2;

int main() {
	ll a;	
	scanf("%lld",&a);
	v.pb(1), p.pb(a);
	scanf("%lld",&a);
	v.pb(2), p.pb(a);
	scanf("%lld",&a);
	v.pb(4), p.pb(a);
	scanf("%lld",&a);
	v.pb(8), p.pb(a);
	for(int i = 0; i <= 3; ++i) {
		int V = v[i], P = p[i];
		if(v2.size() && V * p2.back() < v2.back() * P) {
			continue;
		}
		v2.pb(V), p2.pb(P);
		// cout << V << " " << P << endl;
	}
	int k = v2.size()-1;
	ll N, y = 0;
	scanf("%lld",&N);
	N *= 4;
	for(int k = (int)v2.size()-1; k >= 0; --k) {
		if(v2[k] <= N) {
			y += (N/v2[k]) * p2[k];
			N %= v2[k];
		}
	}
	printf("%lld\n",y);
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=5e5+5;
int a[N],st[N],pos[N],cnt[N],vis[N];
int n,m,q,top,p;
int main(){
	scanf("%d%d%d",&n,&m,&q);
	fp(i,1,q)scanf("%d",&a[i]);
	fd(i,q,1)if(!vis[a[i]])st[++top]=a[i],vis[a[i]]=1;
	fp(i,1,m)if(!vis[i])st[++top]=i;
	fp(i,1,m)pos[st[i]]=i;
	p=m;
	while(p>1&&st[p-1]<st[p])--p;
	if(p==1)return puts("Yes"),0;
	cnt[0]=2333333;
	fd(i,q,1)if(cnt[pos[a[i]]-1])--cnt[pos[a[i]]-1],++cnt[pos[a[i]]];
	R int res=0;
	fp(i,p-1,m)res+=cnt[i];
	puts(res>=n?"Yes":"No");
	return 0;
}

Measured memory_bytes: 6912
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, Write};
#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

    let n = scan.next::<usize>();
    let k = scan.next::<i64>();
    let mut a: Vec<i64> = (0..n).map(|_| scan.next()).collect();
    a.sort();
    let f: Vec<i64> = (0..n).map(|_| scan.next()).collect();

    let mut l: i64 = 0;
    let mut r: i64 = 1e12 as i64;

    while l < r {
        let mid: i64 = (l + r) >> 1;
        let mut b: Vec<i64> = Vec::new();
        for i in 0..n {
            b.push(mid / f[i]);
        }
        b.sort();
        let mut req: i64 = 0;
        for i in 0..n {
            req += max(a[i] - b[i], 0);
        }
        if req > k {
            l = mid + 1;
        } else {
            r = mid;
        }
    }
    writeln!(out, "{}", l).ok();
}


Measured memory_bytes: 26040
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N;
  cin >> N;
  vi A(N);
  cin >> A;

  vi line(N,0);
  rep(i,N){
    if(i - A[i] > 0){
      line[i - A[i]]++;
    }
  }

  i64 ans = 0;
  rep(i,N){
    if(i + A[i]<N){
      ans += line[i + A[i]];
    }
  }

  cout << ans << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll n;cin>>n;
  vector<ll>ans;
  rep(i,1,n+1){
    if(i%3==0)ans.push_back(i);
    else{
      string s=to_string(i);
      bool e=false;
      rep(j,0,s.size()){
        if(s[j]=='3')e=true;
      }
      if(e)ans.push_back(i);
    }
  }

  cout<<" ";
  rep(i,0,ans.size()){
    if(i!=ans.size()-1)cout<<ans[i]<<" ";
    else out(ans[i]);

  }


  return 0;
}



Measured memory_bytes: 3336
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

    int count = 0;
    bool flag = true;
    while(flag){
        for(int i = 0; i < n; i++){
            if (a[i] % 2 != 0) flag = false;
            a[i] /= 2;
        }
        count++;
    }
    p(count - 1);
}


Measured memory_bytes: 256
array = Array.new
while true
	a = gets.split(" ").map{|e|e.to_i}
	break if a[0] == 0 && a[1] == 0
	array.push a
end

array.each{|a|
	a[0].times{|a0|
		a[1].times{|a1|
			if (a0+a1)%2 == 0
				print "#"
			else
				print "."
			end
		}
		puts ""
	}
	puts ""
}

Measured memory_bytes: 6108
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		myBTree tree=new myBTree();
		
		int q=in.nextInt();
		for(int i=0;i<q;i++) {
			String odr=in.next();
			
			switch(odr.charAt(0)) {
			case 'i':
				tree.inset(Integer.parseInt(in.next()));
				break;
				
			case 'p':
				tree.walk('m');
				tree.walk('f');
				break;
			}
		}
		
		
		
	}

}

class BTNode{
	int v;
	BTNode p,lc,rc;
	
	BTNode(int n){
		v=n;
	}
}

class myBTree{
	private BTNode EDG,ROOT;
	
	myBTree(){
		EDG=new BTNode(-1);
		ROOT=EDG;
	}
	
	void inset(int v) {
		BTNode NEW=new BTNode(v);
		NEW.lc=EDG; NEW.rc=EDG;
		
		if(ROOT==EDG) {
			ROOT=NEW;
			ROOT.p=EDG;
		}
		else {
			BTNode NOW=ROOT;
			while(true) {
				if(NEW.v<NOW.v) {
					if(NOW.lc==EDG) {
						NOW.lc=NEW;
						NEW.p=NOW;
						break;
					}
					else NOW=NOW.lc;
				}
				else {
					if(NOW.rc==EDG) {
						NOW.rc=NEW;
						NEW.p=NOW;
						break;
					}
					else NOW=NOW.rc;
				}
			}
		}
	}
	
	/*-----walk-----*/
	public void walk(char opt) {
		BTNode NOW=ROOT;
		
		switch(opt) {
		case 'f':
			preWalk(NOW);
			break;
			
		case 'm':
			inWalk(NOW);
			break;
			
		case 'l':
			postWalk(NOW);
			break;
		}
		
		System.out.println();
	}
	
	private void preWalk(BTNode NOW) {
		System.out.print(" "+NOW.v);
		if(NOW.lc!=EDG)preWalk(NOW.lc);
		if(NOW.rc!=EDG)preWalk(NOW.rc);
	}
	
	private void inWalk(BTNode NOW) {
		if(NOW.lc!=EDG)inWalk(NOW.lc);
		System.out.print(" "+NOW.v);
		if(NOW.rc!=EDG)inWalk(NOW.rc);
	}
	
	private void postWalk(BTNode NOW) {
		if(NOW.lc!=EDG)postWalk(NOW.lc);
		if(NOW.rc!=EDG)postWalk(NOW.rc);
		System.out.print(" "+NOW.v);
	}
	
	
	
}


Measured memory_bytes: 193232
N = int(input())
A = map(int, input().split())
magic = 0
seq = 1
pre_a = 0
for a in A:
  if a == pre_a:
    seq += 1
  else:
    magic += seq // 2
    seq = 1
  pre_a = a
magic += seq // 2
print(magic)

Measured memory_bytes: 3060