akhauriyash/Code-Regression huggingface dataset:
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[500005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=500005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }



lld maxSubArraySum(vector<lld> &a, lld size) 
{ 
    lld max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (lld i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 


lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;
lld ss=1;

void solve()
{    
    cin>>n;
    cin>>x;
    ans=0;
    for(i=1;i<n;i++)
    {
        cin>>l;
        if(l<x) ans+=(x-l);
        x=  max(l,x);
    }
    cout<<ans;
}

void fun111(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    
}

int main()
{
    // fun111();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    // cin>>t;
    // cout<<t;
    lld p1 = 1e9 + 7;
    // getfac(p1);
    //check the value by which modulo is to be taken
    // precompute();
    for(int i=0;i<t;i++)
    {
        // cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}


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


void recursive_comb(int *indexes, int s, int rest, function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {
  int indexes[n];
  for (int i = 0; i < n; i++) indexes[i] = i;
  do {
    f(indexes);
  } while (std::next_permutation(indexes, indexes + n));
}

// nPkの順列に対して処理を実行する
void foreach_permutation(int n, int k, std::function<void(int *)> f) {
  foreach_comb(n, k, [&](int *c_indexes) {
    foreach_permutation(k, [&](int *p_indexes) {
      int indexes[k];
      for (int i = 0; i < k; i++) {
        indexes[i] = c_indexes[p_indexes[i]];
      }
      f(indexes);
    });
  });
}

int main() {
  int n;
  cin >> n;
  vector<P> ps(n);
  rep(i, n) {
    int x, y;
    cin >> x >> y;
    ps[i] = {x,y};
  }

  auto calc_distance_x2 = [](P &p1, P &p2) {
    int dx = p1.first - p2.first;
    int dy = p1.second - p2.second;
    return sqrt(dx*dx + dy*dy);
  };

  int cnt = 0;
  double ans = 0;
  foreach_permutation(n, n, [&](int *indexes) {
    double dis = 0;
    for(int i=0;i<n-1;i++) {
      dis += calc_distance_x2(ps[indexes[i]], ps[indexes[i+1]]);
    }
    ans += dis;
    cnt++;
  });
  cout << std::fixed << std::setprecision(15) << ans / (double)cnt << endl;
  return 0;
}


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

using namespace std;

#define ll					long long
#define vi					vector<int>
#define vii					vector<vi>
#define ALL(s)			(s).begin(),(s).end()
#define pii					pair<int, int> pii;
#define pll					pair<ll, ll>
#define si					set<int>
#define F						first
#define S						second
#define pb					push_back
#define tc(t)				int t; cin >> t; while(t--)
#define _						ios_base::sync_with_stdio(false); cin.tie(NULL); 
const ll MOD = 1e9 + 7;
const ll INF = 1<<29;
const ll MAX_N = 1e6 + 7;

int main() {_
	int k, x;
	cin >> k >> x;

	if(k*500 >= x)
		cout << "Yes\n";
	else
		cout << "No\n";

}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n; cin >> n; vl value(n); vl cost(n); ll allsum = 0;
  rep(i,n){ ll x; cin >> x; value[i] = x; }
  rep(i,n){ ll x; cin >> x; cost[i] = x; }
  
  for(ll i=0; i < n; i++){
    ll sum = value[i]-cost[i];
    if(sum > 0) allsum += sum;
  }
  
  cout << allsum << endl;
}

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


int main(){
  int n,k;cin>>n>>k;
  vector<ll> h(n);
  r(i,n){
    cin>>h.at(i);
  }
  sort(h.begin(),h.end());

  ll mini=h.at(h.size()-1);

  r(i,n-k+1){
    if(mini>h.at(i+k-1)-h.at(i) ){
      mini=h.at(i+k-1)-h.at(i);
    }
  }

  cout<<mini<<endl;

  return 0;

}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
	int n,i;
	while(cin>>n,n){
		i=0;
		while(n!=1){
			if(n%2==0)n/=2;
			else if(n%2==1)n=(n*3)+1;
			i++;
		}
		cout<<i<<endl;
	}
}

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

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

class union_find_tree {
public:
	int n;//要素数
	vector<int> parent;
	vector<int> hight;

	union_find_tree(int sz) {
		n = sz;
		for (int i = 0; i < n; ++i) {
			parent.push_back(i);
			hight.push_back(0);
		}
	}

	int find_root(int x) {
		if (parent[x] == x)return x;
		else return parent[x] = find_root(parent[x]);
	}

	void unite(int x, int y) {
		x = find_root(x);
		y = find_root(y);
		if (x == y)return;

		if (hight[x] < hight[y]) parent[x] = y;
		else {
			parent[y] = x;
			if (hight[x] == hight[y])++hight[x];
		}
	}

	bool same(int x, int y) {
		return find_root(x) == find_root(y);
	}
};
signed main() {
	int n, m;
	cin >> n >> m;
	union_find_tree uf(n);
	for (int i = 0; i < m; ++i) {
		int x, y, z;
		cin >> x >> y >> z;
		uf.unite(x - 1, y - 1);
	}
	set<int> s;
	for (int i = 0; i < n; ++i) {
		s.insert(uf.find_root(i));
	}
	cout << s.size() << endl;
}


Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X;
  cin >> X;
  
  int X_last2 = X % 100;
  int N_limit = min(20, X/100);

  int ans = 0;
  if (X_last2 == 0) {
    ans = 1;
  }
  else if (X >= 100) {
    for (int a = 0; a <= N_limit; a++) {
      for (int b = 0; b <= max(0,N_limit-a); b++) {
        for (int c = 0; c <= max(0,N_limit-a-b); c++) {
          for (int d = 0; d <= max(0,N_limit-a-b-c); d++) {
            for (int e = 0; e <= max(0,N_limit-a-b-c-d); e++) {
              for (int f = 0; f <= max(0,N_limit-a-b-c-d-e); f++) {
                if (X_last2 == a*0 + b*1 + c*2 + d*3 + e*4 + f*5) {
                  ans = 1;
                  break;
                }
              }
            }
          }    
        }
      }    
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
typedef long long int ll;

int main(){
  int n;
  int a[100];
  ll dp[100][21];

  cin >> n;
  memset(dp,0,sizeof(dp));
  for(int i = 1 ; i <= n ; i++)cin >> a[i];
  a[0]=0;
  dp[1][a[1]] = 1;

  for(int i = 2 ; i < n ; i++ ){
    for(int j = 0 ; j <= 20  ; j++ ){
      if( j + a[i] <= 20 ){
	dp[i][j + a[i]] += dp[i - 1][j]; 
      }
      if(j - a[i] >= 0){
	dp[i][ j - a[i]] += dp[i - 1][j];
      }
    }
  }
  cout << dp[n-1][a[n]] << endl;
}

Measured memory_bytes: 1180
#include <cstdio>

int main(){
    int n,m,l;
    scanf("%d%d%d",&n,&m,&l);
    
    int a[n][m];
    for(int i = 0; i < n; i++) {
        for(int j = 0;j < m;j++){
            scanf("%d", &a[i][j]);
        }
    }
    int b[m][l];
    for(int i = 0;i < m;i++){
        for(int j = 0;j < l;j++){
            scanf("%d",&b[i][j]);
        }
    }
    long c[n][l];
    
    for(int i = 0;i < n;i++){
        for(int k = 0;k < l;k++){
            c[i][k] = 0;
            for(int j = 0;j < m;j++){
                c[i][k] +=  a[i][j] * b[j][k];
            }
            if(k < l - 1){
                printf("%ld ",c[i][k]);
                }
            else if(k == l - 1){
                printf("%ld\n",c[i][l - 1]);
            }
        }
       
    }
    return 0;
}


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

using namespace std;

void prime(int n){
    int i,c=0;
    for(i=2;i<=n/2;i++){
        if(n%i==0){
            c++;
            break;
        }
    }
    if(c==0){
        cout<<n;
        exit(0);
    }
}

int main(){
    int n,i;
    cin>>n;
    i=n;
    while(i>=n){
        prime(i);
        i++;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<typename T>
void print(T &arr){
    ll sz = sizeof(arr)/sizeof(arr[0]);
    for(int i = 0;i < sz-1;i++){cout << arr[i] << ' ';}
    cout << arr[sz-1] << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll t_sum = 0;
    vector<ll> t(n+2,0);
    
    rep(i,n){
        cin >> t[i+1];
        t_sum += t[i+1];
    }
    rep(i,n+1)t[i+1] += t[i];
    vector<ll> v(n+2,0);
    rep(i,n) cin >> v[i+1];
    vector<ld> speed(2*t_sum + 10,0);
    ll cnt = 0;
    rep(i,2*t_sum){
        // if(!i)continue;
        if(i < 2*t[cnt])speed[i] = v[cnt];
        else{
            speed[i] = min(v[cnt],v[cnt+1]);
            cnt++;
        }
    }
    // rep(i,2*t_sum+1){
    //     print(i*0.5,"\t", speed[i]);
    // }
    // print(speed);
    rep(i,2*t_sum){
        speed[i+1] = min(speed[i+1], speed[i] + 0.5);
    }
    // print(speed);
    for(int i = 2*t_sum; 0 < i;--i){
        speed[i-1] = min(speed[i-1],speed[i] + 0.5);
    }
    // print(speed);
    // rep(i,2*t_sum+1){
    //     print(i*0.5,"\t", speed[i]);
    // }
    ld res = 0;
    rep(i,2*t_sum){
        res += ld(0.5 * (speed[i] + speed[i+1]) * 0.5);
    }
    cout << fixed;
    cout << setprecision(10) << res << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n){ cin >> a[i]; }
  rep(i,n){ cin >> b[i]; }

  ll cnta=0,cntb=0;
  rep(i,n){
    if(a[i]>b[i]){
      cntb += a[i]-b[i];
    }
    if(a[i]<b[i]){
      if((b[i]-a[i])%2){
        cnta += (b[i]-a[i]+1)/2;
        cntb++;
      } else {
        cnta += (b[i]-a[i])/2;
      }
    }
  }
  if(cnta>=cntb){
    cout << "Yes" << ln;
  } else {
    cout << "No" << ln;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int get(int n, int x) {
  int cur = 0;
  while(n) {
    cur += n / x;
    n /= x;
  }
  return cur;
}

bool prime(int x) {
  if(x == 1) return false;
  if(x == 2 or x == 3) return true;
  for(int i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}

ll ans = 0;
vector <int> save;
map <int, int> cnt;

void go(int idx, int pro) {
  if(pro > 75) return;
  if(idx == save.size()) {
    ans += pro == 75;
    return;
  }
  for(int i = 0; i <= cnt[save[idx]]; i++) {
    go(idx + 1, pro * (i + 1));
  }
}

int main() {
  int n; cin >> n;
  for(int i = 1; i <= 100; i++) if(prime(i)) save.push_back(i), cnt[i] = get(n, i);
  go(0, 1);
  print(ans);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ff first
#define ss second
#define szof(_x) ((int) (_x).size())
#define TASK_NAME ""

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
const ll INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(tw) % (y - x + 1) + x; }


void solve() {
	int n;
	cin >> n;
	set<pii> arrl, arrr;
	vector<pii> inp;
	for (int i = 0; i < n; ++i) {
		int l, r;
		cin >> l >> r;
		inp.push_back({l, r});
	}
	ll ans = 0;
	for (int q = 0; q < 2; ++q) {
		int cur = q;
		int pos = 0;
		arrl.clear();
		arrr.clear();
		for (int i = 0; i < n; ++i) {
			arrl.insert({inp[i].ff, i});
			arrr.insert({inp[i].ss, i});
		}
		ll res = 0;
		for (int i = 0; i < n; ++i) {
			//cerr << i << " " << pos << endl;
			if (cur == 0) {
				auto it = --arrl.end();
				if (it -> ff > pos) {
					res += it -> ff - pos;
					pos = it -> ff;
				}
				arrr.erase({inp[it -> ss].ss, it -> ss});
				arrl.erase(it);
			} else {
				auto it = arrr.begin();
				if (it -> ff < pos) {
					res += pos - it -> ff;
					pos = it -> ff;
				}
				arrl.erase({inp[it -> ss].ff, it -> ss});
				arrr.erase(it);
			}
			cur = !cur;
		}

		ans = max(ans, res + abs(pos));
	}

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


int main() {
	//freopen(TASK_NAME ".in", "r", stdin);
	//freopen(TASK_NAME ".out", "w", stdout);
	cerr << fixed << setprecision(15);
	cout << fixed << setprecision(15);
	ios::sync_with_stdio(false);

	int tests = 1;
	// cin >> tests;
	for (int it = 1; it <= tests; ++it) {
		solve();
	}
	
	#ifdef LOCAL
		cerr << "time: " << clock() << " ms\n";
	#endif
	return 0;
}

Measured memory_bytes: 10484
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int inf = INT_MAX;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int a, b;
    cin >> a >> b;
    a -= 2 * b;
    if (a >= 0) {
        cout << a;
    }
    else cout << 0;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

K = int(input())

d = deque(i for i in range(1, 10))

count = 0

while count != K:
    x = d.popleft()
    a = (10 * x) + (x % 10)
    if x % 10 != 0:
        d.append(a - 1)

    d.append(a)

    if x % 10 != 9:
        d.append(a + 1)

    count += 1

print(x)


Measured memory_bytes: 18684
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p = 0;
    cin >> n >> m;
    ll arr[m];
    for(i = 0; i < m; i++){
        cin >> x;
        sum += x;
    }
    if(sum > n){
        cout << "-1";
    }
    else{
        cout << n-sum;
    }

    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <iomanip> // setprecision
#include <cmath>

using namespace std;
typedef long long ll;
const double long PI = acos(-1);

void solve() {
  ll N, ds[50];
  cin >> N;
  for (ll i=0;i<N;i++) {
    cin >> ds[i];
  }

  ll sum = 0;
  for (ll i=0;i<N;i++) {
    for (ll j=i+1;j<N;j++) {
      sum += ds[i] * ds[j];
    }
  }
  cout << sum << endl;
}

int main(void) {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	vector<queue<int>> Setsuzoku(N);
	vector<int> FriendsNum(N, 0);
	vector<int> color(N, -1);
	vector<int> colorNum(N, 0);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		Setsuzoku[a - 1].push(b - 1);
		Setsuzoku[b - 1].push(a - 1);
		FriendsNum[a - 1]++;
		FriendsNum[b - 1]++;
	}
	vector<pair<int, int>> Block(K);
	for (int i = 0; i < K; i++) {
		int c, d;
		cin >> c >> d;
		Block[i] = { c-1,d-1 };
	}

	int first_uncolored = 0;
	while (first_uncolored < N) {
		queue<int> userQueue;
		userQueue.push(first_uncolored);
		int now_color = first_uncolored;
		while (!userQueue.empty()) {
			int u = userQueue.front();
			userQueue.pop();
			if (color[u] >= 0) continue;
			else color[u] = now_color;
			colorNum[now_color]++;
			while (first_uncolored < N && color[first_uncolored] >= 0) first_uncolored++;
			while (!Setsuzoku[u].empty()) {
				userQueue.push(Setsuzoku[u].front());
				Setsuzoku[u].pop();
			}
		}
	}

	vector<int> Kouho(N, 0);
	for (int i = 0; i < N; i++) {
		Kouho[i] = colorNum[color[i]] - 1 - FriendsNum[i];
	}
	for (auto b : Block) {
		if (color[b.first] == color[b.second]) {
			Kouho[b.first]--;
			Kouho[b.second]--;
		}
	}
	for (int k : Kouho) {
		cout << k << " ";
	}
	cout << endl;
}


Measured memory_bytes: 70784
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

#define MAX_N 1001

struct S {
    int y, x;
    S(int y, int x) : y(y), x(x) {}
};

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

int W, H, N;
int X1[MAX_N], Y1[MAX_N], X2[MAX_N], Y2[MAX_N];

int compress(int *x1, int *x2, int w) {
    vector<int> xs;
    for (int i = 0; i < N; i++) {
        if (x1[i] - 1 >= 0) xs.push_back(x1[i] - 1);
        xs.push_back(x1[i]);
        xs.push_back(x2[i] - 1);
        if (x2[i] < w) xs.push_back(x2[i]);
    }
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    for (int i = 0; i < N; i++) {
        x1[i] = lower_bound(xs.begin(), xs.end(), x1[i]) - xs.begin();
        x2[i] = lower_bound(xs.begin(), xs.end(), x2[i]) - xs.begin();
    }
    return xs.size();
}

int main() {
    while (scanf("%d %d", &W, &H), W || H) {
        scanf("%d", &N);
        for (int i = 0; i < N; i++) {
            scanf("%d %d %d %d", &X1[i], &Y1[i], &X2[i], &Y2[i]);
        }
        int w = compress(X1, X2, W);
        int h = compress(Y1, Y2, H);

        bool F[h][w]; memset(F, 0, sizeof(F));
        for (int n = 0; n < N; n++) {
            for (int i = Y1[n]; i < Y2[n]; i++) {
                for (int j = X1[n]; j < X2[n]; j++) {
                    F[i][j] = true;
                }
            }
        }

        bool used[h][w]; memset(used, 0, sizeof(used));
        int cnt = 0;
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                if (!used[y][x] && !F[y][x]) {
                    cnt++;
                    used[y][x] = true;
                    queue<S> q; q.push(S(y, x));
                    while (!q.empty()) {
                        S s = q.front(); q.pop();
                        for (int i = 0; i < 4; i++) {
                            int ny = s.y + dy[i], nx = s.x + dx[i];
                            if (!(0 <= ny && ny < h && 0 <= nx && nx < w)) continue;
                            if (!used[ny][nx] && !F[ny][nx]) {
                                used[ny][nx] = true;
                                q.push(S(ny, nx));
                            }
                        }
                    }
                }
            }
        }

        printf("%d\n", cnt);
    }
    return 0;
}

Measured memory_bytes: 3000
#include <iostream>
#include <vector>

using namespace std;

int cnt[5];
int matrix[5][5];

int main(){
    vector<int> a, b;
    int sub;
    
    for(int i = 0; i < 3; i++){
        cin >> sub;
        a.push_back(sub);
        cin >> sub;
        b.push_back(sub);
    }
    
    for(int i = 0; i < 3; i++){
        matrix[a[i]][b[i]] = 1;
        matrix[b[i]][a[i]] = 1;
    }
    
    for(int i = 1; i <= 4; i++){
        for(int j = 1; j <= 4; j++){
            cnt[i] += matrix[i][j];
        }
    }
    
    bool judge = true;
    for(int i = 1; i <= 4; i++){
        if(cnt[i] == 3){
            judge = false;
            break;
        }
    }
    
    if(judge){
        cout << "YES\n";
    }
    else{
        cout << "NO\n";
    }
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cinttypes>
#include <cstdint>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <forward_list>
#include <initializer_list>
#include <random>
#include <regex>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;

using Field = vector<vector<ll>>;
using Graph = vector<vector<ll>>;
using VI = vector<int>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VC = vector<char>;
using PI = pair<int, int>;

#define FOR(i, s, n) for (int i = s; i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

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; }

int K;
string S;

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

    int si = S.length();

    if (si <= K) {
        cout << S << endl;
    } else {
        string s = S.substr(0, K);
        s = s + "..."; 
        cout << s << endl;
    }
    
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  sort(a.rbegin(),a.rend());
  int A=0,B=0;
 for(int i=0;i<N;i++){
   if(i%2==0){
     A += a[i];
   }
   else{
     B += a[i];
   }
 }
  cout << A-B;
}


Measured memory_bytes: 256
s = list(input())
abc = list('abcdefghijklmnopqrstuvwxyz')
abc_exist = [False] * 26

for i in range(len(s)):
  for j in range(26):
    if s[i] == abc[j]:
      abc_exist[j] = True

r = 'None'      
for k in range(26):
  if abc_exist[k] == False:
    r = abc[k]
    break
    

print(r)

Measured memory_bytes: 3956
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

map< vector<int>, int > memo;

struct Elem {
    vector<int> vec;
    int cost;
    Elem() {}
    Elem(vector<int> v, int c) : vec(v), cost(c) {}
    bool operator<(const Elem &e) const {
        return cost > e.cost;
    }
};

int cost[10][10];
signed main() {
    int N; cin >> N;
    for(int i=0; i<N; i++) {
        for(int j=0; j<N; j++) {
            cin >> cost[i][j];
        }
    }

    priority_queue<Elem> que;
    vector<int> init(N);
    iota(init.begin(), init.end(), 0);
    memo[init] = 0;
    que.push(Elem(init, 0));
    
    while(que.size()) {
        auto e = que.top(); que.pop();
        auto vec = e.vec;
        auto orig = e.cost;
        if(orig > memo[vec]) continue;

        for(int i=0; i<N; i++) {
            for(int j=i+1; j<N; j++) {
                int vl = vec[i], vr = vec[j];
                int c = cost[vl][vr];

                swap(vec[i], vec[j]);
                if(!memo.count(vec) or memo[vec] > orig + c) {
                    memo[vec] = orig + c;
                    que.push(Elem(vec, orig + c));
                }
                swap(vec[i], vec[j]);
            }
        }
    }

    int ans = 0;
    for(auto v : memo) ans = max(ans, v.second);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 15152
#include<iostream>
using namespace std;
int main()
{
    long long int n,i,s=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        s+=i;

    }
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 3676
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITP1
{
    class ITP1_7_D
    {
        static void Main(string[] args)
        {
            int n, m, l;
            long[,] matrixA, matrixB, matrixC;
            int[] readLine;
            StringBuilder writeLine;

            readLine = Console.ReadLine().Split().Select(int.Parse).ToArray();

            n = readLine[0];
            m = readLine[1];
            l = readLine[2];

            matrixA = new long[n, m];
            matrixB = new long[m, l];
            matrixC = new long[n, l];

            for (int i = 0; i < matrixA.GetLength(0); i++)
            {
                readLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < matrixA.GetLength(1); j++)
                {
                    matrixA[i, j] = readLine[j];
                }
            }
            for (int i = 0; i < matrixB.GetLength(0); i++)
            {
                readLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = 0; j < matrixB.GetLength(1); j++)
                {
                    matrixB[i, j] = readLine[j];
                }
            }

            for (int i = 0; i < matrixC.GetLength(0); i++)
            {
                for (int j = 0; j < matrixC.GetLength(1); j++)
                {
                    for (int k = 0; k < m; k++)
                    {
                        matrixC[i, j] += matrixA[i, k] * matrixB[k, j];
                    }
                }
            }

            for (int i = 0; i < matrixC.GetLength(0); i++)
            {
                writeLine = new StringBuilder();
                for (int j = 0; j < matrixC.GetLength(1); j++)
                {
                    writeLine.Append(matrixC[i, j].ToString() + " ");
                }
                Console.WriteLine(writeLine.ToString().Trim());
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 18528
use std::io;

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let stdin = io::stdin();
    let mut buf = String::new();

    stdin.read_line(&mut buf).unwrap();
    buf.split(' ')
        .map(|s| s.trim().parse().unwrap())
        .collect()
}


fn main() {
    let (n, v) = {
        let input = read::<usize>();
        (input[0], input[1])
    };

    for j in 0..2001 {
        if j > n || 10_000 * j > v {
            continue;
        }

        for k in 0..4001 {
            if n < j + k {
                continue;
            }

            let sum = 10_000 * j + 5000 * k + (n - j - k) * 1000;
            if sum == v {
                println!("{} {} {}", j, k, n - j - k);
                return;
            }
        }
    }

    println!("-1 -1 -1");
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    string s;cin >> s;
    int a = 0,b = 0;
    
    rep(i,2){
        a  = a*10 + (s[i] - '0');
    

    }
    
    for(int i = 2;i < 4;i++){
        b = b *10 + (s[i] - '0');
        
    }
    if(a >= 1 && a <= 12 && b >= 1&&b <= 12){
        cout << "AMBIGUOUS" << endl;

    }
    else if(a >= 1 && a <= 12){
        cout << "MMYY" << endl;

    }
    else if(b <= 12&& b >= 1){
        cout << "YYMM" << endl;

    }
    else{
        cout << "NA" << endl;

    }
    
    return 0;
}

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

int main() {
	long long A, B, C;
	cin >> A >> B >> C;
	long long i;
	if (A*C <= B) {
		cout << C;
	}
	else {
		for (i = 1; i <= C; i++) {
			if (A*i > B) {
				cout << i - 1;
				break;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
using namespace std;

int main()
{
	int d[5];
	int k;

	for (int i = 0; i < 5; i++) {
		cin >> d[i];
	}
	cin >> k;

	if (d[4] - d[0] <= k) {
		printf("Yay!");
	} else {
		printf(":(");
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
#define endl "\n"
//#define int long long
#define ALL(x) begin(x),end(x)
#define resort(v) sort((v).rbegin(), (v).rend())
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
//const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

/*signed*/int main(void) {
    int x;
    cin >> x;
    int ans = 1;
    if ((x / 100) * 5 < (x % 100)) ans = 0;
    cout << ans << endl;
}

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

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

    int R, G, B, N;
    cin >> R >> G >> B >> N;

    vector<int> rg;
    for (int r = 0; r * R <= N; ++r) {
        for (int g = 0; r * R + g * G <= N; ++g) {
            rg.push_back(N - r * R - g * G);
        }
    }

    sort(rg.begin(), rg.end());
    int count = 0;
    for (int b = 0; b * B <= N; ++b) {
        auto it =  upper_bound(rg.begin(), rg.end(), b * B) - lower_bound(rg.begin(), rg.end(), b * B);
        count += it;
    }

    cout << count << '\n';

    return 0;
}


Measured memory_bytes: 33720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc150/abc150_c.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<int> c(N);
  rep(i, N) { c[i] = i + 1; }

  string p;
  rep(i, N) {
    string _p;
    cin >> _p;
    p += _p;
  }
  string q;
  rep(i, N) {
    string _q;
    cin >> _q;
    q += _q;
  }

  vector<string> perm;
  do {
    string s = "";
    rep(i, N) { s += c[i] + '0'; }
    perm.push_back(s);
  } while (next_permutation(c.begin(), c.end()));

  int a = lower_bound(perm.begin(), perm.end(), p) - perm.begin();
  int b = lower_bound(perm.begin(), perm.end(), q) - perm.begin();

  cout << abs(a - b) << endl;
}

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

ll inf = LLONG_MAX;
ll minf = -inf;
ll mod = 1e9 + 7;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    vector<int> B(M);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < M; i++) cin >> B[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    A.push_back(0);
    B.push_back(0);
    
    ll ans = 1;
    int x = 1;
    int y = 1;
    
    for (int i = N*M; i >= 1; i--) {
        if (i < A[x-1] || i < B[y-1]) {
            cout << 0 << endl;
            return 0;
        }
        if (i == A[x-1] && i == B[y-1]) {
            x++;
            y++;
        }else if(i == A[x-1] && i > B[y-1]) {
            ans = ans * (y-1) % mod;
            x++;
        }else if(i > A[x-1] && i == B[y-1]) {
            ans = ans * (x-1) % mod;
            y++;
        }else if(i > A[x-1] && i > B[y-1]) {
            ans = ans * ((x-1)*(y-1) - (N*M-i)) % mod;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// !Start && !End 
//  0 se divide
//https: //www.youtube.com/watch?v=6Nb-prB-4P0&list=RD6Nb-prB-4P0&start_radio=1

// https: //www.youtube.com/watch?v=eYDI8b5Nn5s
// Electrify my OOOoooooOOOoooOOOOOoooooOOOooo!
#pragma optimise GCC(-O2)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define ve(x) vector<x>
#define f(a,b,c) for(int a=b;a<c;a++)
#define foto(x,v) for(auto x:v)
#define read(t) ll t; cin>>t;
#define reads(t) string t; cin>>t;
#define readarr(arr,n) ll arr[n]; f(i,0,n) cin>>arr[i];
#define forstl(i,v) for(auto &i: v)
#define ln endl
#define Endl endl
#define dbg(x) cout<<#x<<" = "<<x<<ln;
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<ln;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    Term "<< ++c <<" = "<<it<<ln;} cout<<ln;
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; forstl(it,v) \
cout<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cout<<ln;
#define dbgarr(v,s,e) cout<<#v<<" = "; f(i,s,e) cout<<v[i]<<", "; cout<<ln;
#define addEdge(tr,k) f(i,0,k) { ll x,y; cin>>x>>y, tr[x].push_back(y), tr[y].push_back(x);}
#define all(v) v.begin(),v.end()

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); }

//														GLOBAL VARS
ll INF =LLONG_MAX;
const ll M= 1000000007;

//														USEFUL FUNCTIONS
ll powm(ll ,ll);

// 														MAIN
int main()
{ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    //It gets easier day by day, but the hard part is to........
    read(n) read(k)
    ll arr [n+1]={0};
    f(i,0,k)
    {
        read(x)
        f(i,0,x)
        {
            read(y) arr[y]++;
        }
    }
    ll ct  = 0;
    f(i,1,n+1) if(!arr[i]) ct++;
    cout<<ct;
}










//													FUNCTIONS DECLARATIONS
ll powm(ll a, ll b) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%M;
		a=(a*a)%M;
		b>>=1;
	}
	return res;
}


Measured memory_bytes: 3648
<?php
list($s) = strs();
list($t) = strs();
$cnt = 0;
for ($i = 0; $i < strlen($s); ++$i) if ($s[$i] !== $t[$i]) ++$cnt;
echo $cnt;
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


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

const int MAX_N = 1 << 19;
const int def = 1 << 25;
const int INF = 1 << 25;

typedef pair<int, int> Node;
struct MinSegTreeIdx {
	int n;
	Node node[2 * MAX_N - 1];

	void init(int n_) {
		n = 1;
		while(n < n_) n *= 2;
		for(int i = 0; i < 2 * n - 1; i++) node[i] = make_pair(def, def);
	}

	Node merge(Node l, Node r) {
		if(l.first <= r.first) return l;
		return r;
	}

	void update(int k, int a) {
		k += n - 1;
		node[k] = make_pair(a, k - (n - 1));
		while(k > 0) {
			k = (k - 1) / 2;
			node[k] = merge(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}

	Node query(int a, int b) { return query(a, b, 0, 0, n); }

	Node query(int a, int b, int k, int l, int r) {
		if(r <= a || b <= l) return make_pair(def, def);
		if(a <= l && r <= b) return node[k];
		Node vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		Node vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return merge(vl, vr);
	}

	void show() {
		for(int i = 0; i < n; i++) cout << node[i + n - 1].first << " ";
		cout << endl;
	}
};

int a[200000];
MinSegTreeIdx even, odd;
int N;
set<int> s;

typedef pair<int, int> P;
typedef pair<P, int> Pi;

vector<P> ps;
vector<int> children[200000];

Pi f(int L, int R){
	int len = R - L;
	if(len <= 0) {
		return { {-1, -1}, -1 };
	}

	int id = ps.size();
	ps.push_back({ -1, -1 });

	if(len == 2) {
		ps[id] = { a[L], a[L + 1] };
		return { ps[id] ,id };
	}

	MinSegTreeIdx* st1 = &even;
	MinSegTreeIdx* st2 = &odd;
	if(L % 2 == 1) {
		st1 = &odd;
		st2 = &even;
	}

	auto res1 = st1->query(L, R - 1);
	//cout << res1.first << " " << res1.second << endl;
	int l = res1.second;
	int right = *s.upper_bound(l);
	auto res2 = st2->query(l + 1, right);
	//cout << res2.first << " " << res2.second << endl;
	int r = res2.second;

	s.insert(l);
	s.insert(r);

	auto k1 = f(L, l), k2 = f(l + 1, r), k3 = f(r + 1, R);
	if(k1.second != -1) children[id].push_back(k1.second);
	if(k2.second != -1) children[id].push_back(k2.second);
	if(k3.second != -1) children[id].push_back(k3.second);

	//st1->update(l, INF);
	//st1->update(r, INF);
	//st2->update(l, INF);
	//st2->update(r, INF);

	ps[id] = { a[l], a[r] };
	return { ps[id] ,id };
}

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

	cin >> N;

	even.init(N);
	odd.init(N);

	for(int i = 0; i < N; i++) {
		cin >> a[i];
		if(i % 2 == 0) {
			even.update(i, a[i]);
			odd.update(i, INF);
		}
		else {
			even.update(i, INF);
			odd.update(i, a[i]);
		}
	}
	//even.show();
	//odd.show();

	s.insert(N);

	deque<int> ans;
	priority_queue<Pi, vector<Pi>, greater<Pi>> q;
	auto res = f(0, N);
	q.push(res);
	while(q.size()) {
		auto pi = q.top();
		q.pop();
		ans.push_back(pi.first.first);
		ans.push_back(pi.first.second);
		int id = pi.second;
		for(auto c : children[id]) {
			q.push({ ps[c], c });
		}
	}

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


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

int main()
{
	int N;
	cin >> N;
	vector<double> p(N);
	for (int i = 0; i < N; i++) cin >> p[i];
	vector<vector<double>> dp(N+1, vector<double>(N+1,0));

	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= N; j++) {
			dp[i + 1][j] = dp[i][j] * (1 - p[i]);
			if(j - 1 >= 0) dp[i + 1][j] += (dp[i][j - 1] * p[i]);
		}
	}

	int th = (N) / 2;
	double ans = 0;
	for (int i = 0; i < N+1; i++) {
		if (i > th) ans += dp[N][i];
	}
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 70656
#include <stdio.h>

int main(void){

    int data[4][13];
    char pic[4]={'S','H','C','D'};
    int give,rank;
    char des;

    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            data[i][j]=0;
        }
    }
    //手元のカード枚数
    scanf("%d",&give);
    for(int i=0;i<give;i++){
        //絵柄、ランク
        scanf(" %c",&des);
        scanf("%d",&rank);
        if(des=='S'){
            data[0][rank-1]=1;
        }else if(des=='H'){
            data[1][rank-1]=1;
        }else if(des=='C'){
            data[2][rank-1]=1;
        }else if(des=='D'){
            data[3][rank-1]=1;
        }
    }

    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(data[i][j]==0){
                printf("%c %d\n",pic[i],j+1);
            }
        }
    }
}


Measured memory_bytes: 2076
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>

long long PRIME = 1e9 + 7;
using namespace std;


int main(){ 
    long long N, M;
    vector<bool> spade(13, false), heart(13, false), clover(13, false), diamond(13, false);

    cin >> N;

    string s;
    int num;

    for(int i = 0; i < N; ++i){
        cin >> s >> num;
        if(s == "S"){
            spade[num - 1] = true;
        }
        else if(s == "H"){
            heart[num - 1] = true;
        }
        else if(s == "C"){
            clover[num - 1] = true;
        }
        else{
            diamond[num - 1] = true;
        }

    }

    for(int i = 0; i < 13; ++i){
        if(!spade[i]){
            cout << "S " << i + 1 << endl;
        }
    }
    for(int i = 0; i < 13; ++i){
        if(!heart[i]){
            cout << "H " << i + 1 << endl;
        }
    }
    for(int i = 0; i < 13; ++i){
        if(!clover[i]){
            cout << "C " << i + 1 << endl;
        }
    }
    for(int i = 0; i < 13; ++i){
        if(!diamond[i]){
            cout << "D " << i + 1 << endl;
        }
    }
}




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

int main()
{
    int a,b;
    cin>>a>>b;
    int aa=a*3;
    int ans=aa+b;

    if(ans<2)
    {
        cout<<0<<endl;
    }
    else
    {
        cout<<ans/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
als = list(map(int, input().split()))
bls = list(map(int, input().split()))
cls = list(map(int, input().split()))

numls = []
for i in range(n-1):
  dif = als[i+1] - als[i]
  if dif == 1:
    numls.append(als[i])
#print(numls)

subtotal = 0
for j in numls:
  subtotal = subtotal + cls[j-1]
  
print(sum(bls)+subtotal)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <cmath>

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	string ans = s.substr(0,4) + " "+ s.substr(4);
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256