akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;

int main(void){
    string s,t;

    cin >> s;

    rep(i,s.size()){
        if(i%2 == 0){
           t += s[i] ;
        }
    }
    
    cout << t << endl;

    return 0;
}

Measured memory_bytes: 3568
D, G = gets.split.map(&:to_i)
a = D.times.map { gets.split.map(&:to_i) }
a = a.map.with_index(1) do |ai, i|
  p, c = ai
  { p: p, c: c, s: i * 100, t: p * i * 100 + c }
end

dbit = 1 << D
min = Float::INFINITY
0.upto(dbit - 1) do |b|
  score = 0
  num = 0
  a.each_with_index do |ai, i|
    if b & (1 << i) > 0
      score += ai[:t]
      num += ai[:p]
    end
  end
  if score >= G
    min = num if num < min
    next
  end
  remain = a.select.with_index { |ai, i| b & (1 << i) == 0 }
  next if remain.empty?
  ai = remain.last
  if score + (ai[:p] - 1) * ai[:s] < G
    next
  else
    num += (G - score).quo(ai[:s]).ceil
    min = num if num < min
  end
end
puts min


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

int main(){
  int A[4],e,f,ans=0;
    for(int i=0;i<4;i++){
      cin>>A[i];
    }
    sort(A,A+4);
    reverse(A,A+4);
    cin>>e>>f;
    if(e<f)
      ans+=f;
    else if(e>=f)
      ans+=e;

  cout<<A[0]+A[1]+A[2]+ans<<endl;

      return 0;

}



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

int main() {
  int N;
  cin >> N;
  vector<int> kagami(N);
  for (int i = 0; i < N; i++) {
	  cin >> kagami.at(i);
	}
  int counter = 1;
  
  sort(kagami.begin(), kagami.end()); 
  
  for (int i = 0; i < N-1; i++) {
	if (kagami.at(i+1) > kagami.at(i)) {
		counter++;
	 	}
	}

  cout << counter <<endl;

}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
S=input()
T=input()
s=[]
t=[]
for i in range(len(S)):
    s.append(S[i])

for i in range(len(T)):
    t.append(T[i])

s.sort()
t.sort()

while len(s)>0 and len(t)>0:
    if min(s)<max(t):
        print("Yes")
        exit()
    elif min(s)==max(t):
        del s[0]
        del t[len(t)-1]
    else:
        print("No")
        exit()
if len(t)==0:
    
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n;
    cin>>n;
    set<string>s;
    rep(i,1,n){
        string t;
        cin>>t;
        s.insert(t);
    }
    cout<<s.size();
    return 0;
}


Measured memory_bytes: 19244
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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




int main() 
{
  ll N; cin>>N;
  vector<ll> table(N+1,INF);
  table.at(0)=0;
  rep(i,N)
  {
    chmin(table.at(i+1),table.at(i)+1);
    for(int j=1;j<=7;j++)
    {
      if(i+pow(6,j)<=N) chmin(table.at(i+pow(6,j)),table.at(i)+1);
    } 
    for(int j=1;j<=6;j++)
    {
      if(i+pow(9,j)<=N) chmin(table.at(i+pow(9,j)),table.at(i)+1);
    } 
  }
  cout<<table.at(N)<<endl;
  /*
  rep(i,20)
  {
    if(i!=0) cout<<" ";
    cout<<table.at(i);
  }
  cout<<endl;
  */
  return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

void mod( ll &n, ll m=MOD ){ n%=m,n+=m,n%=m; }

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

ll dp[MAXN][2];

int main() 
{
    fastio();

    string s;
    cin>>s;
    int n = s.size();

    dp[0][0]=1;
    for(int i=0;i<n;i++)
    {
        for(int tight=0;tight<2;tight++)
        {
            if( !tight && s[i]=='0' )
            {
                dp[i+1][tight] += dp[i][tight];
                mod(dp[i+1][tight]);
            }
            else
            {
                dp[i+1][1] += dp[i][tight];
                mod(dp[i+1][1]);

                dp[i+1][tight] += dp[i][tight];
                mod(dp[i+1][tight]);

                dp[i+1][tight] += dp[i][tight];
                mod(dp[i+1][tight]);
            }
        }
    }
    ll ans = ( dp[n][0] + dp[n][1] );
    mod(ans);
    cout<<ans,nl;

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 2000
if __name__ == '__main__':
    [H, W] = [int(i) for i in input().split()]
    dist = [[0] * 10 for _ in range(10)]

    for i in range(10):
        for j, c in enumerate([int(i) for i in input().split()]):
            dist[i][j] = c

    for k in range(10):
        for i in range(10):
            for j in range(10):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    result = 0

    for h in range(H):
        for w, a in enumerate([int(i) for i in input().split()]):
            if a != -1:
                result += dist[a][1]


    print(result)



Measured memory_bytes: 40684
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int swap_log[1000][2];

void swap(int *A, int i, int j) {
  int temp;
  temp = A[i];
  A[i] = A[j];
  A[j] = temp;
}

void Merge(int *A, int left, int mid, int right) {
  int n1,n2,*L,*R,i,j,k;
  n1 = mid -left;
  n2 = right - mid;
  L = (int*)malloc(sizeof(int) * (n1+1));
  R = (int*)malloc(sizeof(int) * (n2+1));
  for (i = 0; i< n1; i++) L[i] = A[left+i];
  for (i = 0; i < n2; i++) R[i] = A[mid+i];
  L[n1] = INT_MAX; R[n2] = INT_MAX;
  i = 0;j = 0;
  for(k = left; k < right; k++) {
    if (L[i] < R[j]) {
      A[k] = L[i];
      i++;
    }else {
      A[k] = R[j];
      j++;
    }
  }
  free(L);
  free(R);
}

void Merge_Sort(int *A, int left, int right) {
  if(left+1 < right) {
    int mid = (left + right)/2;
    Merge_Sort(A,left,mid);
    Merge_Sort(A,mid,right);
    Merge(A,left,mid,right);
  }
}
long step_sort(int *w, int *w1, int i) {
  int j,k;
  long sum = 0;
  k = 0;
  while(w[i] != w1[i]) {
    j = 0;
    while (w[j] != w1[i]) j++;
    sum += w[i]+w[j];
    swap(w,i,j);
    swap_log[k][0] = i; swap_log[k][1] = j;
    i = j;
    k++;
  }
  swap_log[k][0] = 0; swap_log[k][1] = 0;
  return sum;
}

int search_min(int *w, int *w1,int n) {
  int i,j;
  i = 0;
  while(1) {
    j = 0;
    while(w[j] != w1[i]) j++;
    if(i != j) break;
    i++;
    if(i >= n) return n;
  }
  return j;
}

long run_log(int *w) {
  int i = 0;
  long sum = 0;
  while(swap_log[i][0] != swap_log[i][1]) {
    sum += w[swap_log[i][0]]+w[swap_log[i][1]];
    swap(w,swap_log[i][0],swap_log[i][1]);
    i++;
  }
  return sum;
}

long sub_sort(int *w, int *w1, int i) {
  long sum;

  if(w[0] != w1[0]) return LONG_MAX;
  int j = 0;
  while(w[i] != w1[j]) j++;
  sum = w[i] + w[0];
  swap(w,i,0);
  sum += run_log(w);
  sum += w[0] + w[j];
  swap(w,0,j);
  
  return sum;
}

long repeat_sort(int *w, int *w1, int n,long now) {
  int i;
  int a1[n];
  long v1,v2;
  for (i = 0; i < n; i++) a1[i]=w[i];
  i = search_min(w,w1,n);
  if(i == n) return now;
  v1 = step_sort(w,w1,i);
  v2 = sub_sort(a1,w1,i);
  long min = (v1 < v2) ? v1:v2;
  return repeat_sort(w,w1,n,now+min);
}

long much_sort(int *w, int *w1, int n) {
  int i,j;
  long sum = 0;
  char *checked = (char*)calloc(n,sizeof(char));
  i = 0;
  while(i < n) {
    j = 0;
    while(w[j] != w1[i]) j++;
    if(i != j) {
      if(w1[j] ==  w[i]) {
	sum += w[i] + w[j];
	swap(w,i,j);
      }
    }
    checked[i]=1;checked[j]=1;
    while(i < n && checked[i]!=0)i++;
  }
  free(checked);
  return sum;
}

int main()
{
  int i,n,*w,*w2;
  long sum;
  scanf("%d",&n);
  w = (int*)malloc(sizeof(int) * n);
  w2 = (int*)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) {
    scanf("%d",w+i);
    w2[i] = w[i];
  }
  Merge_Sort(w2,0,n);
  
  sum = much_sort(w,w2,n);
  sum += repeat_sort(w,w2,n,0);
  printf("%ld\n",sum);
  
  return 0;
}

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

int main() {
  	int X, Y, A, B, C;
  	cin >> X >> Y >> A >> B >> C;
  	int p[A], q[B], r[C];
  	int aka = 0, midori = 0, mushoku = 0;
  	long int res = 0;
  	for (int i = 0; i < A; i++){
      	cin >> p[i];
    }
  	for (int i = 0; i < B; i++){
      	cin >> q[i];
    }
  	for (int i = 0; i < C; i++){
      	cin >> r[i];
    }
  
  	sort(p, p + A, greater<int>());
  	sort(q, q + B, greater<int>());
  	sort(r, r + C, greater<int>());
  	
  	for (int i = 0; i < X + Y; i++){
      	if (r[mushoku] >= q[midori] && r[mushoku] >= p[aka]) mushoku++;
      	else if (q[midori] > r[mushoku] && q[midori] >= p[aka]) midori++;
      	else if (p[aka] > r[mushoku] && p[aka] > q[midori]) aka++;
    }

  	if (aka > X){
      	while (aka != X){
          	if (r[mushoku] >= q[midori]){
              	mushoku++;
              	aka--;
            }
          	else{
              	midori++;
              	aka--;
            }
        }  
    }
  	if (midori > Y){
      	while (midori != Y){
          	if (r[mushoku] >= p[aka]){
              	mushoku++;
              	midori--;
            }
          	else{
              	aka++;
              	midori--;
            }
        }
    }
  	
  	for (int i = 0; i < aka; i++){
      	res += p[i];
    }
  	for (int i = 0; i < midori; i++){
      	res += q[i];
    }
  	for (int i = 0; i < mushoku; i++){
      	res += r[i];
    }
  	cout << res << endl;
}  

Measured memory_bytes: 1408
#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 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using P = pair<int,int>;

struct max_flow {
    struct edge { int to, cap, rev; };
    int V;
    vector<vector<edge>> G;
    vector<int> itr, level;

    max_flow(int V) : V(V) { G.assign(V,vector<edge>()); }

    void add_edge(int from, int to, int cap) {
        G[from].push_back((edge) {to, cap, (int) G[to].size()});
        G[to].push_back((edge) {from, 0, (int) G[from].size()-1});
    }

    void bfs(int s) {
        level.assign(V,-1);
        queue<int> q;
        level[s] = 0; q.push(s);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            for(auto &e: G[v]){
                if (e.cap > 0 and level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    q.push(e.to);
                }
            }
        }
    }

    int dfs(int v, int t, int f) {
        if (v == t) return f;
        for (int& i = itr[v]; i < (int) G[v].size(); ++i) {
            edge& e = G[v][i];
            if (e.cap > 0 and level[v] < level[e.to]) {
                int d = dfs(e.to, t, min(f, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    int run(int s, int t) {
        int ret = 0, f;
        while (bfs(s), level[t] >= 0) {
            itr.assign(V,0);
            while ((f = dfs(s, t, INF)) > 0) ret += f;
        }
        return ret;
    }
};

int main()
{
  int N;
  cin >> N;
  vector<P> A(N);
  REP(i,N) cin >> A[i].first >> A[i].second;
  vector<P> B(N);
  REP(i,N) cin >> B[i].first >> B[i].second;
  max_flow mf(2*N+2);
  FOR(i,1,N+1){
    mf.add_edge(0,i,1);
  }
  FOR(i,N+1,2*N+1){
    mf.add_edge(i,2*N+1,1);
  }
  REP(i,N){
    REP(j,N){
      if(A[i].first<B[j].first&&A[i].second<B[j].second){
        mf.add_edge(i+1,j+N+1,1);
      }
    }
  }

  cout << mf.run(0,2*N+1) << endl;
}

Measured memory_bytes: 3620
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    if 400 <= X and X <= 599:
        print(8)
    elif 600 <= X and X <= 799:
        print(7)
    elif 800 <= X and X <= 999:
        print(6)
    elif 1000 <= X and X <= 1199:
        print(5)
    elif 1200 <= X and X <= 1399:
        print(4)
    elif 1400 <= X and X <= 1599:
        print(3)
    elif 1600 <= X and X <= 1799:
        print(2)
    elif 1800 <= X and X <= 1999:
        print(1)

if __name__ == '__main__':
    main()

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)


typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////


ll SOLVE(){
    ll n;cin>>n;
    vector<ll>v(n);
    ll cnt=0;
    rep(i,0,n-1){
        cin>>v[i];
        if(v[i]<0)cnt++;
        v[i]=abs(v[i]);
    }
    SORT(v);
    ll sum=0;
    rep(i,0,n-1){
        if(i==0&&cnt%2==1)sum-=v[i];
        else sum+=v[i];
    }
    cout<<sum<<endl;
    
    
    return 0;
}

int main(){fastio
    
    clock_t start = clock();
    SOLVE();
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    cerr<<endl<<time<<"ms"<<endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
  if (a < b) {
    swap(a, b);
  }
  if (b == 0) {
    return 0;
  }
  while (b) {
    a %= b;
    swap(a, b);
  }
  if (a < 0) {
    a *= -1;
  }
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ret = a[0];
  for (int i = 1; i < n; i++) {
    ret = gcd(ret, a[i]);
  }
  cout << ret << '\n';
  return 0;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){

	int N, M; cin >> N >> M;
	priority_queue<int> q;

	REP(i,N){
		int A; cin >> A;
		q.push(A);
	}

	REP(i,M){
		int A = q.top(); q.pop();
		q.push(A/2);
	}

	ll ans = 0;
	REP(i,N){
		ans += q.top(); q.pop();
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 1020
#ifdef _WIN32
#define NOMINMAX
#define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#define DEBUGBREAK() ::DebugBreak()
#else
#define DEBUGBREAK() static_cast<void>(0)
#endif

#include <iostream>
#include <sstream>
#include <iomanip>
#include <valarray>
#include <vector>
#include <string>
#include <fstream>
#include <cstdlib>
#include <queue>
#include <array>
#include <functional>
#include <stack>
#include <bitset>
#include <random>
#include <algorithm>
#include <unordered_map>

using namespace std;

const int64_t dx4[4] = { 0, -1, 1, 0 };
const int64_t dy4[4] = { -1, 0, 0, 1 };
const int64_t dx5[5] = { 0, -1, 0, 1, 0 };
const int64_t dy5[5] = { -1, 0, 0, 0, 1 };
const int64_t dx8[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int64_t dy8[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int64_t dx9[9] = { -1, 0, 1, -1, 0, 1, -1, 0, 1 };
const int64_t dy9[9] = { -1, -1, -1, 0, 0, 0, 1, 1, 1 };

#define REP(i, K) for (int64_t i = 0; i < K; ++i)
#define REPYX() for (int64_t y = 0; y < H; ++y) for (int64_t x = 0; x < W; ++x)
#define REPX() REP(x, W)
#define REPY() REP(y, H)
#define INSIDE(x_, y_) (0 <= (x_) && 0 <= (y_) && (x_) < W && (y_) < H)
#define INSIDE_MARGIN(x_, y_, m_) ((m_) <= (x_) && (m_) <= (y_) && (x_) < W - (m_) && (y_) < H - (m_))

int get_assert_level() {
    const char* s = getenv("ASSERT_LEVEL");
    if (s) { return atoi(s); }
    return 0;
}
static int g_assert_level = get_assert_level();

#define LV_1() if (g_assert_level >= 1)
#define LV_2() if (g_assert_level >= 2)
#define LV_3() if (g_assert_level >= 3)
#define ASSERT_1(expr) do { const bool b = bool(expr); if (g_assert_level >= 1 && !b) { std::cerr << "[ASSERT 1] (" << #expr << ") failed." << std::endl; exit(-1); } } while (false)
#define ASSERT_2(expr) do { const bool b = bool(expr); if (g_assert_level >= 2 && !b) { std::cerr << "[ASSERT 2] (" << #expr << ") failed." << std::endl; exit(-1); } } while (false)
#define ASSERT_3(expr) do { const bool b = bool(expr); if (g_assert_level >= 3 && !b) { std::cerr << "[ASSERT 3] (" << #expr << ") failed." << std::endl; exit(-1); } } while (false)

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

    char ch;
    cin >> ch;

    if (int('A') <= int(ch) && int(ch) <= int('Z')) {
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    }

    return 0;
}



Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

int main() {
  std::string s;
  std::string t = "CODEFESTIVAL2016";
  int x = 0;
  std::cin >> s;
  for (std::size_t i = 0; i < s.length(); ++i) {
    if (s[i] != t[i]) {
      ++x;
    }
  }
  std::cout << x;
  return 0;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
#define int long long int
vector<pair<int,int> > g[100001];
int par[100001];
int rank1[100001];
int find(int a){
	if(a==par[a]) return a;
	return par[a]=find(par[a]);
}
void merge(int a,int b){
	a=find(a),b=find(b);
	if(rank1[a]>rank1[b]){
		par[b]=a;
		rank1[a]+=b;
	}
	else{
		par[a]=b;
		rank1[b]+=a;
	}
}
int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	vector<pair<int,int>> v,v2;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		v.push_back({a,i});
		v2.push_back({b,i});
		par[i]=i;
		rank1[i]=0;
	}
	sort(v.begin(),v.end());
	sort(v2.begin(),v2.end());
	vector<pair<int,pair<int,int>>> edges;
	for(int i=0;i<n-1;i++){
		g[v[i].second].push_back({v[i+1].second,v[i+1].first-v[i].first});
		g[v[i+1].second].push_back({v[i].second,v[i+1].first-v[i].first});
		edges.push_back({v[i+1].first-v[i].first,{v[i].second,v[i+1].second}});
	}
	for(int i=0;i<n-1;i++){
		g[v2[i].second].push_back({v2[i+1].second,v2[i+1].first-v2[i].first});
		g[v2[i+1].second].push_back({v2[i].second,v2[i+1].first-v2[i].first});
		edges.push_back({v2[i+1].first-v2[i].first,{v2[i].second,v2[i+1].second}});
	}
	sort(edges.begin(),edges.end());
	int cost=0;
	for(auto z:edges){
		int x=find(z.second.first),y=find(z.second.second);
		if(x!=y){
			cost+=z.first;
			merge(x,y);
		}
	}
	cout<<cost;
}

Measured memory_bytes: 22364
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-8;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
	ll K, A, B;
	cin >> K >> A >> B;
	if (B - A <= 2)
		cout << K + 1 << endl;
	else {
		ll ans = 1;
		if (K >= A - 1) {
			K -= A - 1;
			ans += A - 1;
		}
		if (K % 2) {
			K--;
			ans++;
		}
		ans += (K / 2) * (B - A);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include <iostream>
#include <algorithm>
#include <cmath> 
using namespace std;
int main()
{
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
long long int n,k;
cin>>n>>k;
cout<<n*k<<endl;
return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

        int N=gi();
        String[] s=new String[N];
        int[] t=new int[N];
        for (int i=0;i<N;i++) {
        	s[i]=gs();
        	t[i]=gi();
        }
        String X=gs();
        int m=0;
        boolean f=false;
        for (int i=0;i<N;i++) {
        	if(f)m+=t[i];
        	if (X.equals(s[i])) {
        		f=true;
        	}
        }

        System.out.print(m);

//        if (s>L[n-2]) {
//        	System.out.println("Yes");
//        }else {
//        	System.out.println("No");
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35584
# -*- coding: utf-8 -*-

def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N, D = list(map(int, input().split()))
    X, Y = [], []
    for n in range(N):
        X_n, Y_n = list(map(int, input().split()))
        X.append(X_n)
        Y.append(Y_n)

    return N, D, X, Y


def main(N: int, D: int, X: list, Y: list) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 点の個数
        D (int): 距離
        X (list): x座標
        Y (list): y座標
    """
    # 求解処理
    ans = 0
    for n in range(N):
        X_n = X[n]
        Y_n = Y[n]
        if X_n * X_n + Y_n * Y_n <= D * D:
            ans += 1

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N, D, X, Y = get_input()

    # メイン処理
    main(N, D, X, Y)


Measured memory_bytes: 25008
// agrawal117
//chahatagrawal117
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long int ll;
#define MAX 1005
vector<ll> v;
ll check(ll n)
{
    ll ans=0;
    for(int i=0;i<v.size();i++){
        if(v[i]==0){
            if(n>=0) ans+=(v.size()-i-1);
            else continue;
        }
        int j;
        if(v[i]<0 && n<=0){
            ll x=abs(n); ll y=abs(v[i]);
            ll val=x/y;
            if(x%y!=0) val++;
            j=lower_bound(v.begin()+i+1,v.end(),val)-v.begin();
            // cout<<j<<endl;
            ans+=(v.size()-j);
            continue;
            
        }
        if(v[i]<0 && n>0) {
            ll x=abs(n); ll y=abs(v[i]);
            ll val=x/y;
            // if(x%y!=0) val++;
            val=val*(-1);
            j=lower_bound(v.begin()+i+1,v.end(),val)-v.begin();
            // cout<<j<<endl;
            ans=ans+v.size()-j;
            continue;
            
        }
        if(v[i]>0 && n<0) {
            ll x=abs(n); ll y=abs(v[i]);
            ll val=x/y;
            if(x%y!=0) val++;
            val*=-1;
            j=upper_bound(v.begin()+i+1,v.end(),val)-v.begin();
            // cout<<j<<endl;
            ans+=(j-i-1);
            continue;
        }
        if(v[i]>0 && n>=0) {
            j=upper_bound(v.begin()+i+1,v.end(),ll(n/v[i]))-v.begin();
            ans+=(j-i-1);
            // cout<<j<<endl;
            continue;
        }
    }
    return ans;
}
int main()
{
   ll n,k;
   cin>>n>>k;
   for(int i=0;i<n;i++) {
       ll a; cin>>a;
       v.push_back(a);
   }
   sort(v.begin(),v.end());
   ll end=1000000000000000000;
   ll start=-1*end;
  while(true){
      ll mid=(start+end)/2;
      ll val= check(mid);
    //   cout<<mid<<" val--> "<<val<<endl;
      if(val<k) start=mid;
      else end=mid;
      if(end-start<=1) break;
  }
//   cout<<start<<" "<<end<<endl;
   ll val= check(start);
//   cout<<val<<endl;
  if(val>=k) {
      cout<<start<<endl;
      return 0;
  }
  val=check(end);
  cout<<end<<endl;
  return 0 ;
    
}


Measured memory_bytes: 2420
#include "bits/stdc++.h"
using namespace std;
int main(){
    int A, B, K;
    cin>>A >> B >> K;
    int i=0;
    int x=A+B;
    while(i<K){
        if(A%x==0&&B%x==0){
            i++;
        }
       x= x-1;
    }
    cout << x+1 << endl;
}

Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int K, N;
	std::vector<int> A;
	std::cin >> K >> N;
	A.resize(N);
	for (auto& a : A)
		std::cin >> a;

	int longest = (K + A[0]) - A[N-1];
	for (int i = 0; i < N - 1; ++i)
		longest = std::max(longest, A[i+1] - A[i]);
	std::cout << (K - longest) << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int ans=(n/500)*1000;
    n%=500;
    cout<<ans+(n/5)*5<<endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define all(v) v.begin(),v.end()
using namespace std;

signed main(){
    int n;
    cin>>n;
    vi a(n);
    rep(i,n)a[i]=i+1;
    do{
        rep(i,n)cout<<(i?" ":"")<<a[i];
        cout<<endl;
    }while(next_permutation(all(a)));
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
//ll
int n;int a[2030];

int main(){
  int n;string s;cin>>s;n = s.length();
  /*int dp[200100];dp[0] = 0;
  repd(i,1,n){
    dp[i] = dp[i-1];
    if(s[i] == 'W'){

    }else{

    }
  }
  cout << dp[n-1] << endl;*/
  ll ans = 0;int count = 0;int fib = -1;
  rep(i,n){
    if(0>fib && s[i] == 'B')fib = i;
    if(fib>=0 && s[i] == 'W'){
      ans += i-fib-count;count++;
    }
  }
  cout << ans << endl;
}




Measured memory_bytes: 640
h,n=map(int,input().split())

a=[]
b=[]
for _ in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)
    
# print(a)
# print(b)

INF=float("inf")

dp=[INF]*(h+1)
dp[h]=0

for aa,bb in zip(a,b):
    for hh in range(h,0,-1):
        if hh-aa>=0:
            dp[hh-aa]=min(dp[hh-aa],dp[hh]+bb)
        else:
            dp[0]=min(dp[0],dp[hh]+bb)
            
print(dp[0])
# print(dp)
        

Measured memory_bytes: 50568
#include <iostream>
#include <vector>
#include <string>
#include <climits>
using namespace std;

#define INF INT_MAX/2

int h, w;
vector<string> field;
vector< vector<int> > cache;

void step(int x, int y) {
    if (x + 1 < w) {
        if (cache[y][x+1] > cache[y][x] + field[y][x+1] - '0') {
            cache[y][x+1] = cache[y][x] + field[y][x+1] - '0';
        }
    }
    if (y + 1 < h) {
        cache[y+1][x] = cache[y][x] + field[y+1][x] - '0';
    }
}

int main() {
    cin >> h >> w;
    field.resize(h);
    cache.resize(h);
    for (int i = 0; i < h; i++) {
        cache[i].resize(w);
    }
    for (int i = 0; i < h; i++) {
        cin >> field[i];
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cache[i][j] = INF;
        }
    }
    cache[0][0] = field[0][0] - '0';
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            step(j, i);
        }
    }
    cout << cache[h-1][w-1] << endl;
    return 0;
}

    

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
signed main(){
  ll N,A=0,B=0,C=0,r,i;cin>>N;
  REP(i,N){
    cin>>r;if(r%2)A++;
    else if(r%4)B++;else C++;
  }
  //A->C,B->B,C,C->A,B,C
  if((B==0&&A<=C+1)||A<=C)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
s = str(input())
i, j = 0, 0
for i in range(len(s)):
  i = (i + 1)* (-1)
  if s[i] == 'Z':
    break
for j in range(len(s)):
  if s[j] == 'A':
    break
print((len(s) + i) - j + 1)

Measured memory_bytes: 3516
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(p.Count(x => x == 5) == 2 && p.Count(x => x == 7) == 1 ? "YES" : "NO");

            Console.Out.Flush();
        }
    }
    


    public class Calculation
    {
        
    }

    public class Graph
    {

    }
}
    

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod 1000000007 
#define eps 1e-9
#define PI 3.14159265358979323846
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define Fr(i,a,b) for(int i=a;i<b;i++)
#define RF(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pii>
using namespace std;
ll dp[100005];
int main()
{
	SPEED;
   ll n,k,i,s,j;
   cin>>n>>k;
   ll a[n+1];
   Fr(i,0,n)
   {
   	cin>>a[i+1];
   }
   dp[1]=0;
   for(i=2;i<=n;i++)
   {
   	dp[i]=LONG_MAX;
   	 for(j=1;j<=k;j++)
   	 {
   	 	if(i-j>=1)
   	 	{
   	 	dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
	    }
    }
   }
cout<<dp[n]<<endl;
return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#include <chrono>
#include <random>
#include <bits/stdc++.h>
 
using namespace std;
template <typename T> T max(T a, T b) {return a>b?a:b;}
 
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
#define ll long long
#define PI 3.14159265358979323846
#define min(a,b) ((a<b)?(a):(b))
#define max(a,b) ((a<b)?(b):(a))
#define abs(a) ((a>0)?a:-(a))

const double eps = (double)1e-6;
const int maxn = 2e5+5;
const ll mod = 1e9+7;



    

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

    int n; string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i < n-2; i++) {
        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') cnt++;
    }
    cout << cnt << endl;



    
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		String[] array = s.split(" ");
		int a = Integer.parseInt(array[0]);
		int b = Integer.parseInt(array[1]);
		int c = Integer.parseInt(array[2]);

		if ((b - a) == (c - b)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 21332
#include <iostream>


#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#include <stdio.h>
#include <vector> 
#include <map> 
#include <algorithm>
#include <functional>


#include<iostream>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	


	cout << std::max(0, b + c - a) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
vector<int>p; //ノードxの親
vector<int>rank; //ノードxの高さ
int find(int x){ //代表を求める関数
  if(x==p[x]) return x;
  return p[x]=find(p[x]);
}
int same(int x,int y){ //x,yの一致
  if(find(x)==find(y)) return 1;
  else return 0;
}
void unite(int x,int y){ //xとyを合併
  x=find(x);
  y=find(y);
  if(rank[x]>rank[y]){
    p[y]=x;
  }else{
    p[x]=y;
    if(rank[x]==rank[y]){
      rank[y]++; //rank[y]=rank[x]+1
    }
  }
}
int main(){
  int n,q;
  scanf("%d %d",&n,&q);
  rank.resize(n,0);
  p.resize(n,0);
  for(int i=0;i<n;i++){
    p[i]=i;
    rank[i]=0;
  }
  int com,x,y;
  for(int i=0;i<q;i++){
    scanf("%d %d %d",&com,&x,&y);
    if(com==0){
      unite(x,y);
    }else if(com==1){
      cout<<same(x,y)<<endl;
    }
  }
  return 0;
}
  


Measured memory_bytes: 3324
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
	int x, y;

	x = *((int *)a);
	y = *((int *)b);

	return x - y;
}

int main(){

int n,k,i,j;
scanf("%d""%d",&n,&k);

int h[n],tmp,ans=1000000000,sa;
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}

qsort(h, n, sizeof(int), compare_int);


for(i=0;i<n-k+1;i++){
sa = h[i+k-1]-h[i];
if(sa<ans) ans = sa;
}

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


Measured memory_bytes: 892
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  ll a, b, c, N, ans;
  cin >> a >> b >> N;
  ll e = b/N;
  // bで割った余りで考える
  if(b/N > 0 && b%N != 0){ // N がbより小さい場合
    ans = (a*N)/b - a*(N/b);
  } else {
    c = N - N % b - 1;
    ans = (a*(b-1))/b - a*((b-1)/b);
  }

  print(ans);

}


Measured memory_bytes: 3672
#include <stdio.h>
int main(void){
  int a,b,c,i,x=0;
  scanf("%d %d %d",&a,&b,&c);
  for(i=a;i<=b;i++){
      if(c%i==0) x=x+1;
  }
  printf("%d\n",x);
  return 0;
}



Measured memory_bytes: 2100
package main

import (
	"fmt"
)

func main() {
	var k, x int64
	numArray := scanNums(2)
	k = numArray[0]
	x = numArray[1]

	if k*500 >= x {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func scanNums(len int64) (nums []int64) {
	var num int64
	var i int64
	for i = 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func scanStr(len int64) (strs []string) {
	var str string
	var i int64
	for i = 0; i < len; i++ {
		fmt.Scan(&str)
		strs = append(strs, str)
	}
	return
}


Measured memory_bytes: 512
from math import factorial


def perm(n, r):
    return factorial(n) // factorial(n - r)


def comb(n, r):
    if n < r:
        return 0
    return perm(n, r) // factorial(r)


N, M = map(int, input().split())
print(comb(N, 2) + comb(M, 2))


Measured memory_bytes: 2940
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

#define P 1000000007

using namespace std;

int main() {
	int n;
	map<long long, int> mp;
	long long r, c;
	cin >> r >> c >> n;
	long long ll = max(r, c) + 1;
	vector<long long> x, y;
	x.resize(2 * n);
	y.resize(2 * n);
	for (int i = 0; i < n; i++) {
		cin >> x[2 * i] >> y[2 * i] >> x[2 * i + 1] >> y[2 * i + 1];
		long long key1 = -1;
		long long key2 = -1;
		if (x[i * 2] == 0) {
			key1 = 0;
		}
		if (y[i * 2] == 0) {
			key1 = 1;
		}
		if (x[i * 2] == r) {
			key1 = 2;
		}
		if (y[i * 2] == c) {
			key1 = 3;
		}
		if (x[i * 2 + 1] == 0) {
			key2 = 0;
		}
		if (y[i * 2 + 1] == 0) {
			key2 = 1;
		}
		if (x[i * 2 + 1] == r) {
			key2 = 2;
		}
		if (y[i * 2 + 1] == c) {
			key2 = 3;
		}
		if (key1 != -1 && key2 != -1) {
			long long k1 = 0, k2 = 0;
			if (key1 == 0) {
				k1 = y[i * 2];
			}
			else if (key1 == 3) {
				k1 = ll + x[i * 2];
			}
			else if (key1 == 2) {
				k1 = ll * 2 + c - y[i * 2];
			}
			else if (key1 == 1) {
				k1 = ll * 3 + r - x[i * 2];
			}

			if (key2 == 0) {
				k2 = y[i * 2 + 1];
			}
			else if (key2 == 3) {
				k2 = ll + x[i * 2 + 1];
			}
			else if (key2 == 2) {
				k2 = ll * 2 + c - y[i * 2 + 1];
			}
			else if (key2 == 1) {
				k2 = ll * 3 + r - x[i * 2 + 1];
			}
			mp[k1] = i;
			mp[k2] = i;
		}
	}
	vector<int> v;
	int ch = -1;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		if (ch == it->second) {
			ch = -1;
			continue;
		}
		if (ch != -1) {
			v.push_back(ch);
		}
		ch = it->second;
	}
	if (ch != -1) {
		v.push_back(ch);
	}
	for (int i = v.size() - 1; i > 0; i--) {
		if (i >= v.size())
			i = v.size() - 1;
		if (v[i] == v[i - 1]) {
			v.erase(v.begin() + i - 1);
			v.erase(v.begin() + i - 1);
		}
	}
	if (v.size() > 0) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
	//cin >> n;
	return 0;
}


Measured memory_bytes: 18172
#include <iostream>
#include <string>
#include <utility>
using namespace std;

void printArray(string c[], int n) {
    string sep = "";
    for (int i = 0; i < n; i++) {
        cout << sep << c[i];
        sep = " ";
    }
    cout << endl;
}

bool isStable(string c[], string stableArray[], int n) {
    bool stable = true;
    for (int i = 0; i < n; i++) {
        if (c[i] != stableArray[i]) {
            stable = false;
            break;
        }
    }
    return stable;
}

void bubbleSort(string c[], int n) {
    bool flag = true;
    for (int i = 0; flag; i++) {
        flag = false;
        for (int j = n - 1; j > i; j--) {
            if (c[j - 1][1] > c[j][1]) {
                swap(c[j - 1], c[j]);
                flag = true;
            }
        }
    }
}

void selectionSort(string c[], int n) {
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (c[j][1] < c[minj][1]) {
                minj = j;
            }
        }
        swap(c[i], c[minj]);
    }
}

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

    string a[n];
    string b[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }

    bubbleSort(a, n);
    selectionSort(b, n);

    printArray(a, n);
    cout << "Stable" << endl;
    printArray(b, n);
    if (isStable(b, a, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }
}

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

int main() {
	int n; 
	cin >> n;
	int t[100010], x[100010], y[100010];
	t[0] = x[0] = y[0] = 0;
	for (int i = 0; i < n; i++) cin >> t[i+1] >> x[i+1] >> y[i+1];

	bool can = true;
	for (int i = 0; i < n; i++) {
		int dt = t[i+1] - t[i];
		int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
		if (dt < dist) can = false;
		if (dt % 2 != dist % 2) can = false;
	}

	if (can) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

int main() {
	int K, S; cin >> K >> S;
	int count = 0;

	rep(i, 0, K + 1) {
		rep(j, 0, K + 1) {
			if (0 <= (S - i - j) && (S - i - j) <= K) {
				count++;
			}
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;


int fun(vector<int> &v)
{
	sort(v.begin(),v.end());

	if(v.size()%2 == 1)
	{
		int ans = 0;
		int m = v[(v.size()/2)];

		for(int i = 0; i < v.size(); i++)
		{
			ans += abs(v[i]-m);
		}
		return ans;
	}
	else
	{
		int ans1 = 0,ans2 = 0;
		int m1 = v[v.size()/2];
		int m2 = v[v.size()/2 - 1];
		for(int i = 0; i < v.size(); i++)
		{
			ans1 += abs(v[i]-m1);
			ans2 += abs(v[i]-m2);
		}
		return min(ans1,ans2);
	}
}
int32_t main()
{

	    #ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	    #endif

    IOS


    int n;
    cin >> n;

    vector<int> v(n);

   map<int, int> mp;	

   int xorr = 0;


   for(int i = 0; i < n; i++)
   {
   	cin >> v[i];
   	xorr = xorr xor v[i];
   }

   for(int i = 0; i < n; i++)
   {
   	cout << (xorr xor v[i]) << " ";
   }




    return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    int ans = 0;
    int count = 0;
    rep2(i,1,n+1){
        if(i%2!=0){
            rep2(j,1,n+1){
                if(i%j==0)count++;
            }
        }
        if(count==8)ans++;
        count = 0;
    }
    
    cout << ans;
    
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long llint;
#define inf 1e18

llint n,m;

void solve(){
	cin >> n;
	int ans = 0;
	for(; n; n/=2) ans++;

	cout << (1<<(ans-1)) << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<bits/stdc++.h>
#include<chrono>
#include<unordered_map>
#include<random>
#include<complex> 
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned ll 
#define endl '\n'
#define mk make_pair
void fast_in_out() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);

}
int dx[] = { 0,0,-1,1,-1,1,-1,1,0 };
int dy[] = { -1,1,0,0,-1,-1,1,1,0 };
int lx[] = { 2, 2, -1, 1, -2, -2, -1, 1 };
int ly[] = { -1, 1, 2, 2, 1, -1, -2, -2 };
const ld eps = 1e-9;
const int N = 1e6 + 50, M = 1e5 + 10, mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll t = gcd(a, b); return t ? (a / t * b) : 0; }
vector<vector<pair<int,int>>>adj;
int edg[55];
int n,m;
bool dfs(int u,int v,int par,int i) {
	if (u == v) return 1;
	bool flag = 0;
	for(auto e:adj[u])
		if (e.first != par) {
			if (dfs(e.first, v, u, i)) {
				flag = 1;
				edg[e.second] |= (1 << i);
			}

		}
	return flag;
}
int main() {
	fast_in_out();
//	cout << fixed << setprecision(6);
	cin >> n;
	adj.resize(n + 1);
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back({ v,i });
		adj[v].push_back({ u,i });
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		dfs(u, v, -1, i);
	}
	ll ans = (1LL << (n - 1));
	for (int mask = 1; mask < (1 << m); ++mask) {
		int cnt = __builtin_popcount(mask);
		int black = 0;
		for (int i = 1; i < n; i++)
			if (edg[i] & mask)++black;
		if (cnt & 1) ans -= (1LL << (n - 1 - black));
		else ans += (1LL << (n - 1 - black));
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256