akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    REP(i, 1000000) if(i * 108 / 100 == N){
        Out(i);
        return 0;
    }
    Out(":(");

    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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 main(void) {
    int N;
    cin >> N;

    cout << (N + 111 - 1) / 111 * 111 << endl;

    return 0;
}


Measured memory_bytes: 256
#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>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> num;
  rep(i, n) num.push_back(i + 1);
  vector<int> res;
  vector<int> first(n);
  vector<int> second(n);
  rep(i, n) {
    cin >> first[i];
  }
  rep(i, n) {
    cin >> second[i];
  }
  int now = 1;
  do {
    if(num == first) res.push_back(now);
    if(num == second) res.push_back(now);
    if(res.size() == 2) break;
    now++;
  } while(next_permutation(num.begin(), num.end()));
  cout << abs(res[0] - res[1]) << endl;
  return 0;
}

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

#define PI 3.1415926535897932
#define inf 1<<29

int n,m,r;
int d[201][201];
int w[9];
int a,b,c;
int res;
bool used[9];

void dfs(int c,int las,int dist) {
    if (c==r+1) {
        if (res>dist) res=dist;
        return;
    }

    for (int i=1;i<=r;i++) if (!used[i]) {
        used[i]=true;
        if (las==-1) dfs(c+1,i,0);
        else dfs(c+1,i,dist+d[w[las]][w[i]]);
        used[i]=false;
    }
}

int main(){
    scanf("%d %d %d",&n,&m,&r);
    for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) if (i!=j) d[i][j]=inf;
    for (int i=1;i<=r;i++) scanf("%d",&w[i]);
    for (int i=1;i<=m;i++) {
        scanf("%d %d %d",&a,&b,&c);
        if (d[a][b]>c) d[a][b]=d[b][a]=c;
    }
    for (int k=1;k<=n;k++) for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) {
        if (d[i][j]>d[i][k]+d[k][j]) d[i][j]=d[i][k]+d[k][j];
    }
    res=inf;
    dfs(1,-1,0);
    printf("%d\n",res);
    return 0;
}


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

struct Strongly_Connected_Component {
  int n, k;
  vector<vector<int>> G, reverseG;
  vector<int> vs, cmp;
  vector<bool> used;
  Strongly_Connected_Component(int newv = 1) {
    n = newv;
    G.resize(n);
    reverseG.resize(n);
    used.resize(n, 0);
    cmp.resize(n);
  }

  bool add(int from, int to) {
    G[from].push_back(to);
    reverseG[to].push_back(from);
    return 1;
  }
  void dfs(int v) {
    used[v] = true;
    for (auto to : G[v])
      if (!used[to]) dfs(to);
    vs.push_back(v);
  }
  void rdfs(int v) {
    used[v] = true;
    cmp[v] = k;
    for (auto to : reverseG[v])
      if (!used[to]) rdfs(to);
  }
  int solve() {
    used.assign(n, 0);
    vs.clear();
    for (int v = 0; v < n; ++v)
      if (!used[v]) dfs(v);
    used.assign(n, 0);
    k = 0;
    for (int i = (int)vs.size() - 1; i >= 0; --i)
      if (!used[vs[i]]) {
        rdfs(vs[i]);
        ++k;
      }
    return k;
  }
  vector<vector<int>> make_graph(bool dosolve = 1) {
    if (dosolve) solve();
    vector<vector<int>> res(k);
    for (int i = 0; i < n; ++i)
      for (int to : G[i])
        if (!issame(i, to)) res[cmp[i]].push_back(cmp[to]);
    for (auto& v : res) {
      sort(v.begin(), v.end());
      v.erase(unique(v.begin(), v.end()), v.end());
    }
    return res;
  }
  bool issame(int l, int r) { return cmp[l] == cmp[r]; }
};

int v, e, q;
Strongly_Connected_Component scc;

int main() {
  cin >> v >> e;
  scc = Strongly_Connected_Component(v);
  for (int i = 0; i < e; ++i) {
    int s, t;
    cin >> s >> t;
    scc.add(s, t);
  }
  cin >> q;
  scc.solve();
  for (int i = 0; i < q; ++i) {
    int u, v;
    cin >> u >> v;
    cout << scc.issame(u, v) << endl;
  }
  return 0;
}


Measured memory_bytes: 4532
#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<stdio.h>

using namespace std;

int main() {	
	int n, number = 0, cardnum[4][14] = { 0 };
	char Card,dummy;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%c", &dummy);
		scanf("%c", &Card);
		scanf("%d", &number);
		if (Card == 'S') {
			cardnum[0][number] = 1;
		}
		else if (Card == 'H') {
			cardnum[1][number] = 1;
		}
		else if (Card == 'C') {
			cardnum[2][number] = 1;
		}
		else if (Card == 'D') {
			cardnum[3][number] = 1;
		}
	}

	for (int i = 0; i < 4; i++) {
		for (int j = 1; j <= 13; j++) {
			if (cardnum[i][j] != 1) {
				if (i == 0)printf("S %d\n", j);
				else if (i == 1)printf("H %d\n", j);
				else if (i == 2)printf("C %d\n", j);
				else if (i == 3)printf("D %d\n", j);
			}
		}
	}
	return 0;
}

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

int main(){
	int N,a;
	cin>>N;
	int d[N];
	for(int i=0;i<N;i++){
		cin>>d[i];
	}
	sort(d,d+N);
	a=d[N/2]-d[N/2-1];
	cout<<a;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N;
deque<int> ans1, ans2;
int now = 1;

void f(int n) {
    if (n == 1) {
        return;
    }
    if (n % 2 == 1) {
        f(n - 1);
        ans1.push_back(now);
        ans2.push_front(now);
        now++;
        return;
    } else {
        f(n / 2);
        ans1.push_back(now);
        ans2.push_back(now);
        now++;
    }
}

void solve() {
    N++;
    f(N);

    cout << ans1.size() * 2 << endl;
    for_each(all(ans1), [](int x) {
        std::cout << x << " ";
    });
    for_each(all(ans2), [](int x) {
        std::cout << x << " ";
    });
    cout << endl;
}

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

    cin >> N;

    solve();
    return 0;
}


Measured memory_bytes: 3572
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 12 2019
 * 
 */

#include <bits/stdc++.h>

#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define ef else if
#define wh while
#define el else
#define ivv(x) int x; cin>>x
#define lv(x) bint x; cin>>x
#define sv(x) string x; cin>>x
#define cv(x) char x; cin>>x
#define fv(x) float x; cin>>x
#define dv(x) double x; cin>>x
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 

    lv(l);
    lv(r);
    bint ans = INT_MAX;
    for(bint i=l; i<r; ++i){
        for(bint j=i+1; j<r+1; ++j){
            ans = min(ans , (i*j)%2019);
            if(ans==0){
                cout<<ans<<endl;
                return ;
            }
        } 
    }


    cout<<ans<<endl;
    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

N,M,P = map(int,input().split())
edges = []
to = [[] for i in range(N)]
rto = [[] for i in range(N)]
for i in range(M) :
    u,v,cost = map(int,input().split())
    u -= 1
    v -= 1
    cost -= P
    cost *= -1
    edges.append([u,v,cost])
    to[u].append(v)
    rto[v].append(u)

canVisitFromS = [False]*N
canVisitFromG = [False]*N

def dfs(u) :
    if canVisitFromS[u] : return
    canVisitFromS[u] = True
    for v in to[u] :
        dfs(v)

def rdfs(v) :
    if canVisitFromG[v] : return
    canVisitFromG[v] = True
    for u in rto[v] :
        rdfs(u)

dfs(0)
rdfs(N-1)

OK = [canVisitFromS[i]*canVisitFromG[i] for i in range(N)]

dist = [float("inf")]*N
dist[0] = 0

ans = 0
step = 0
update = True
while update :
    update = False
    for i in range(M) :
        u,v,cost = edges[i]
        if OK[u]*OK[v] == 0 : continue
        if dist[v] > dist[u] + cost :
            dist[v] = dist[u] + cost
            update = True
    step += 1
    if step > N :
        ans = -1
        break

if ans != -1 :
    ans = max(0, dist[N-1]*(-1))

print(ans)

Measured memory_bytes: 64984
from collections import defaultdict

N, M = map(int, input().split())
d = defaultdict(int)
for a, b in [tuple(map(int, input().split())) for _ in range(M)]:
    d[a] += 1
    d[b] += 1

if all([i % 2 == 0 for i in d.values()]):
    print('YES')
else:
    print('NO')


Measured memory_bytes: 72408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
ll mod = 1000000007;
ll INF = 1000000099;



signed main(){
    ll q,ans=0;
    cin>>q;
    ll b=0;
    bool f=true;
    ll mid=0,mit=0,l=0,r=0;;
    priority_queue<ll> fr;
    priority_queue<ll, vector<ll>, greater<ll> > ba;

    for(int i=0;i < q;i++)
    {
        int x;
        cin>>x;

        if(x==1){
            ll A,B;
            cin>>A>>B;
            b+=B;

            if(f){
                f=false;
                fr.emplace(A);
                mid=A;
                continue;
            }
            mit=mid;

            if((ll)fr.size()==(ll)ba.size()){
                if(ba.top()<A){
                    ba.push(A);
                    fr.push(ba.top());
                    ba.pop();
                    mid=fr.top();
                }else{
                    fr.push(A);
                    mid=fr.top();
                }
            }else{
                if(fr.top()>A){
                    fr.push(A);
                    ba.push(fr.top());
                    fr.pop();
                    mid=fr.top();                    
                }else{
                    ba.push(A);
                    mid=fr.top();
                }
            }
            
            ans+=abs(mit-A);
            if(mit>mid){
                ans-=((ll)fr.size())*(mit-mid);
                ans+=((ll)ba.size())*(mit-mid);
            }else if(mit<mid){
                ans-=(mid-mit)*((ll)ba.size()+1);
                ans+=(mid-mit)*((ll)fr.size()-1);
            }
        }else{
            cout << fr.top() <<" "<< ans+b<<endl;
        }
    }
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long 
#define pi 3.1415926536
using namespace std;
const ll N=1e18;
ll pr(ll a,ll b,ll c)
{
	if(b==0)
	return 1LL;
	ll ans=1;
	while(b>0)
	{
		if(b%2)
		ans=((ans%c)*(a%c))%c;
		a=((a%c)*(a%c))%c;
		b/=2;
		a%=c;
		ans%=c;
	}
	return ans;
}
void solve()
{ll n,k,h,x,y,z,w,mini,maxi=INT_MAX,prev,res;
 cin>>n;
 vector<ll> v(n+1),a(n+1);
 map<ll,ll> m;
 for(ll i=1;i<=n;i++)
 {
 	cin>>x;
 	v[i]=x+i;
 	a[i]=i-x;
 	m[a[i]]++;
 }
 ll ans=0;
 for(ll i=1;i<=n;i++)
 {
 	ans+=m[v[i]];
 }
 cout<<ans;
}
  
int main()
{
  fast
  //for(ll i=0;i<=9;i++)
  //cal(1,3234566667,i);
  //sort(v.begin(),v.end());
  //pre();
ll t=1;
//cin>>t;
//SieveOfEratosthenes();
//cout<<"ok";
while(t--)
{ //cout<<"ok";

solve();
 //cout<<ma<<endl;
}
return 0;}
/*
ll pr(ll a,ll b,ll c)
{
	if(b==0)
	return 1LL;
	ll ans=1;
	while(b>0)
	{
		if(b%2)
		ans=((ans%c)*(a%c))%c;
		a=((a%c)*(a%c))%c;
		b/=2;
		a%=c;
		ans%=c;
	}
	return ans;
}
vector<ll> fact(N+1);
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=N;i++)
	fact[i]=fact[i-1]*i,fact[i]%=hell;
	
}
*/

Measured memory_bytes: 29076
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include "iomanip"
#include <cstdio>
#include <cstring>
#include <set>
#include <vector>
#include <fstream>
#include <algorithm>
#include <queue>
#include <cassert>
#include <stack>


using namespace std;

bool cmp(pair<int, int> a, pair<int, int> b) {
    return a.first < b.first;
}

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


    int n;
    cin >> n;
    pair<int, int> p;
    vector<pair<int, int>> v;
    for (int i = 1; i <= n; ++i) {
        cin >> p.first;
        p.second = i;
        v.push_back(p);
    }
    sort(v.begin(), v.end(), cmp);
    for (int i = 0; i < n; ++i) {
        cout << v[i].second << " ";
    }

    return 0;
}



Measured memory_bytes: 1780
#include <iostream>
#include <vector>
#include <algorithm>

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

int num[3];

int main(){
	cin >> num[0] >> num[1] >> num[2];
	/*sort(num,num+3);*/
	if( (num[2] == num[1] ) and ( num[2] == num[0] ) and (num[1] == num[0])){
		cout << "Yes"<<endl;
	}else{
		cout << "No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static long N, M, Q;
        static long[] a, b, c, d;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NMQ = Sarray();
            N = NMQ[0];
            M = NMQ[1];
            Q = NMQ[2];
            a = new long[Q];
            b = new long[Q];
            c = new long[Q];
            d = new long[Q];
            for (var i = 0; i < Q; ++i)
            {
                var abcd = Sarray();
                a[i] = abcd[0] - 1;
                b[i] = abcd[1] - 1;
                c[i] = abcd[2];
                d[i] = abcd[3];
            }
            A = new long[N];
            var max = dfs(1, 0);
            WriteLine(max);
        }
        static long[] A;
        static long dfs(long p, long dp)
        {
            if (N == dp)
            {
                var ans = 0L;
                for (var i = 0; i < Q; ++i)
                {
                    if (A[b[i]] - A[a[i]] == c[i])
                        ans += d[i];
                }
                return ans;
            }
            var max = 0L;
            for (var i = p ; i <= M; ++i)
            {
                A[dp] = i;
                max = Max(max, dfs(i, dp + 1));
            }
            return max;
        }
    }
}

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

using namespace std;

int main()
{
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    double x = (x1-x2);
    double y = (y1-y2);

    double l = sqrt(x*x + y*y);
    printf("%.8f\n", l);

}


Measured memory_bytes: 3180
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <tuple>
#include <functional>

auto topological_sort(std::vector<std::set<int>> const& graph) {
  auto const team = graph.size();
  std::vector<int> result;
  std::vector<bool> visited(team);
  auto visit_aux = [&] (int v, auto recur) {
    if (visited[v]) return;
    visited[v] = true;
    for (auto i : graph[v])
      recur(i, recur);
    result.push_back(v);
  };
  using namespace std::placeholders;
  auto visit = std::bind(visit_aux, _1, visit_aux);
  for (int i = 0; i < team; i++)
    visit(i);
  std::reverse(std::begin(result), std::end(result));
  return result;
}

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int team, games;
  std::cin >> team >> games;
  std::vector<std::set<int>> graph(team);
  for (int i = 0; i < games; i++) {
    int a, b;
    std::cin >> a >> b;
    graph[a - 1].insert(b - 1);
  }
  auto const& sorted = topological_sort(graph);
  bool unique = true;
  for (auto i = std::begin(sorted); i < std::end(sorted) - 1; i++)
    unique &= graph[*i].count(*(i + 1));
  for (auto i : sorted) std::cout << i + 1 << std::endl;
  std::cout << (!unique) << std::endl;
}

Measured memory_bytes: 7836
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int maxn=5e5+10;

int main()
{
	int n;cin>>n;
	vector<ll> a,b;
	for(int i=1;i<=n;i++){
		ll x,y;cin>>x>>y;
		a.push_back(x+y);b.push_back(x-y);
	}
	sort(a.begin(),a.end());sort(b.begin(),b.end());
	cout<<max(a[n-1]-a[0],b[n-1]-b[0]);
	return 0;	
} 

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string s, t; cin >> s >> t;
  ll ns = s.size();
  ll nt = t.size();
  ll ans = ns * 2;
  for (ll i = 0; i < ns; i++) {
    if (i + nt > ns) break;
    ll cnt = 0;
    for (ll j = 0; j < nt; j++) {
      if (s[i + j] != t[j]) cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ll n; cin >> n;
	ll a[n];
	for(ll i = 0; i < n; i++) cin >> a[i];
	ll ans = 0;
	for(ll i = 0; i < n; i++){
		ans += a[i] / 2;
		if(a[i] % 2 && i < n - 1 && a[i + 1]){
			ans++;
			a[i + 1]--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
#include<string>
#include<string.h>
using namespace std;


int main() {
	int color = 0;
	int n;
	cin >> n;
	char a;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (a == 'Y')color++;   //"Y"だとダメ　'Y'はおｋ
	}
	if (color == 0)cout << "Three";
	else cout << "Four";
	return 0;
}


Measured memory_bytes: 256
@o=(0)x($i=<>);$i{$_}//=$%,++$%,++$n{$_}for glob<>;map{?? or$o[$i-=$-=$i-$i{$p}]+=($p-$_)*($n+=$n{$p});$p=$_}sort{$b-$a}keys%n,0;print"@o"

Measured memory_bytes: 46836
#include <stdio.h>

int main(){
    int Map[101][101];
    int N, u, k, temp;
    scanf("%d\n",&N);
    for (int ix = 0; ix < N; ix++)
        for (int jx = 0; jx < N; jx++)
            Map[ix][jx] = 0;
    for (int ix = 0; ix < N; ix++){
        scanf("%d %d",&u,&k);
        for (int kx = 0; kx < k; kx++){
            scanf("%d",&temp);
            Map[u-1][temp-1] = 1;
        }
    }
    for (int ix = 0; ix < N; ix++)
        for (int jx = 0; jx < N; jx++){
            if (jx == N-1) printf("%d\n",Map[ix][jx]);
            else printf("%d ",Map[ix][jx]);
        }
    return 0;
}


Measured memory_bytes: 2632
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<long long,long long>
#define vl vector<long long>
#define vll vector<pll>
#define vi vector<int>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
using namespace std;
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000010;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;    
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;
// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()   
#define trav(a, x) for(auto& a : x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr<< *it << " = " << a << endl;
	err(++it, args...);
}
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void solve()
{
    int x,y;
    cin>>x>>y;
    if(y<2*x)
    {
        cout<<"No"<<endl;
        return;
    }    
    else if((y-2*x)%2)
    {
        cout<<"No"<<endl;
        return;
    }
    else
    {
        int b=(y-2*x)/2;
        if(b>x)
        {
            cout<<"No"<<endl;
            return;
        }
        cout<<"Yes"<<endl;
    }
}
int main()
{
    sws
    // tcase{
        solve();
    // }
    return 0;
}


Measured memory_bytes: 3652
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val a = scanner.nextDouble()
    val b = scanner.nextDouble()
    val min = Math.min(a,b).toInt()
    if(Math.abs((a-b)/2) === Math.abs((a-b)/2).toInt().toDouble()) println(Math.abs((a-b)/2).toInt()+min)
    else println("IMPOSSIBLE")
}

Measured memory_bytes: 29472
#!/usr/bin/env python3
# 

n = int(input().strip())
i = input().split(' ')
t = int(i[0])
a = int(i[1])
hs = input().split(' ')
an = list(map(lambda x:t-int(x)*0.006, hs))
diffs = list(map(lambda a_:abs(a-a_), an))
diffs_sorted = sorted(diffs)
print(diffs.index(diffs_sorted[0])+1)

Measured memory_bytes: 3064
/*
          ,     \    /      ,
         / \    )\__/(     / \
        /   \  (_\  /_)   /   \
   ____/_____\__\@  @/___/_____\____
  |             |\../|              |
  |              \VV/               |
  |        ------hoi-------         |
  |_________________________________|
   |    /\ /      \\       \ /\    |
   |  /   V        ))       V   \  |
   |/     `       //        '     \|
   `              V                '
*/

#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define f first
#define se second
#define Speedforce boost();
#define fop(s1, s2) freopen(s1, "r", stdin);freopen(s2, "w", stdout);

using namespace std;

void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int N = 1e6;
const ll inf = 1e9 + 7;
const ld PI = acos(-1);

ll bin_pow(ll x, ll y){
    ll res = 1, base = x;
    while(y){
        if(y & 1){
            res *= base;
            res %= inf;
        }
        base *= base;
        base %= inf;
        y /= 2;
    }
    return res;
}

queue <ll> q;
int k;

int main(){
    Speedforce
    //fop("", "")
    cin >> k;
    for(int i = 1;i <= 9;i ++){
        q.push(i);
    }
    for(int i = 1;i < k;i ++){
        ll x = q.front();
        q.pop();
        if(x % 10 != 0){
            q.push(x * 10 + x % 10 - 1);
        }
        q.push(x * 10 + x % 10);
        if(x % 10 != 9){
            q.push(x * 10 + x % 10 + 1);
        }
    }
    cout << q.front();
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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;}

bool flag(int a){
    bool f3 = false, f5 = false, f7 = false;
    while(a>0){
        if(a%10 == 3){
            a /= 10;
            f3 = true;
        }
        if(a%10 == 5){
            a /= 10;
            f5 = true;
        }
        if(a%10 == 7){
            a /= 10;
            f7 = true;
        }
    }
    if(f3 && f5 && f7) return true;
    
    return false;
}

int main(){
    int n;
    cin >> n;
    vi bfs;
    int a[4] = {3, 5, 7};
    rep(i, 3){
        if(a[i] <= n){
            bfs.push_back(a[i]);
        }
        else {
            cout << i << endl;
            return 0;
        }
    }
    int tmp;
    int cnt = 0;
    while(1){
        rep(j, 3){
            tmp = bfs[cnt]*10+a[j];
            if(tmp <= n){
                bfs.push_back(tmp);
            }
            else {
                cnt = 0;
                tmp = bfs.size();
                rep(i, tmp){
                    if(flag(bfs.at(i))){
                        cnt++;
                    }
                }
                cout << cnt << endl;
                return 0;
            }
        }
        cnt++;
    }
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,pt,px,py;
    cin>>n;
    pt=0,px=0,py=0;
    bool flag=true;
    for(int i=0;i<n;i++){
        int t,x,y;
        cin>>t>>x>>y;
        t-=pt;x-=px;y-=py;
        if((t%2==1&&(x+y)%2==0)||(t%2==0&&(x+y)%2==1)||(t<x+y)){
            flag=false;
        }
        pt=t;px=x;py=y;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int k = sc.nextInt();
		String s = sc.next();

		if (k >= s.length()) {
			out.println(s);
		} else {
			out.println(s.substring(0, k) + "...");
		}

		out.flush();
	}
}


Measured memory_bytes: 38712
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		solve(n);
		in.close();
	}

	private static void solve(long n) {
		System.out.println(n * (n - 1) / 2);
	}
}


Measured memory_bytes: 21972
#include<set>
#include<stack>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<iomanip>
#include<iostream>
#define pb push_back
using namespace std;
vector<int> e[1005];
int n,m,i,j,x[1005],y[1005],vis[1005],ans;
void dfs(int x,int fa)
{
	vis[x]=1;
	int i;
	for (i=0;i<e[x].size();i++)
	{
		if (vis[e[x][i]]) continue;
		dfs(e[x][i],x);
	}
}
int main()
{
	cin>>n>>m;
	for (i=1;i<=m;i++)
	{
		cin>>x[i]>>y[i];
		e[x[i]].pb(y[i]);
		e[y[i]].pb(x[i]);
	}
	for (i=1;i<=n;i++) sort(e[i].begin(),e[i].end());
	for (j=1;j<=m;j++)
	{
		e[x[j]].erase(lower_bound(e[x[j]].begin(),e[x[j]].end(),y[j]));
		swap(x[j],y[j]);
		e[x[j]].erase(lower_bound(e[x[j]].begin(),e[x[j]].end(),y[j]));
		swap(x[j],y[j]);
		memset(vis,0,sizeof(vis));
		dfs(1,0);
		for (i=1;i<=n;i++)
		{
			if (!vis[i])
			{
				ans++;
				break;
			}
		}
		e[x[j]].insert(lower_bound(e[x[j]].begin(),e[x[j]].end(),y[j]),y[j]);
		swap(x[j],y[j]);
		e[x[j]].insert(lower_bound(e[x[j]].begin(),e[x[j]].end(),y[j]),y[j]);
		swap(x[j],y[j]);
	}
	cout<<ans;
	return 0;
}

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

int main() {
	unsigned long long h, w,ans;
	cin >> h >> w;
  	if(h==1||w==1){
      cout<<1;
      return 0;
    }
	ans = h * w;
	if (ans % 2 == 1)ans++;
	cout << ans/2;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

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

    string a, b, c;

    cin >> a >> b >> c;

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

    return 0;
}


Measured memory_bytes: 256
#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <bitset>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
ll adad(ll x) {return x*(x+1)/2;} // 1～xの総和
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
ll gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}
const int up[]={1,-1,0,0}, lf[]={0,0,1,-1};

int main() {
  int n,k; cin>>n>>k;
  int a[n]; for(int i=0;i<n;i++) cin>>a[i];

  sort(a,a+n);
  // ある部分まで必要、そこから不要→二分探索

  int ng = -1, ok = n;
  while(ok - ng > 1) {
    int md = (ng + ok) / 2;
    if (a[md] >= k) { // 明らかに必要
      ok = md; continue;
    }

    bool able[k]={}; able[0]=true;
    for(int i=0;i<n;i++) {
      if (i == md) continue;
      for(int j=k-1;j>=0;j--) {
        able[min(j+a[i],k)] |= able[j];
      }
    }

    bool use = false;
    for(int i=0;i<k;i++) {
      if (i + a[md] >= k) use |= able[i];
    }
    if (use) ok=md;
    else ng=md;
  }
  cout<<ok<<endl;
}

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

using ll = long long;

int main() {
    string A;
    cin >> A;
    ll counter[26] = {};

    ll ans = 1;
    for (int i = A.size() - 1; i >= 0; i--) {
        int id = A[i] - 'a';
        counter[id]++;

        ans += (A.size() - i - counter[id]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#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;



int main() 
{
  ll N; cin>>N;
  vector<ll> vecA(N);
  rep(i,N)
  {
    cin>>vecA.at(i);
  }
  sort(vecA.begin(),vecA.end());
  /*rep(i,N)
  {
    if(i!=0) cout<<" ";
    cout<<vecA.at(i);
  }*/
  vector<ll> vecans(0);
  rep(i,N)
  {
    if(i==0) {vecans.push_back(vecA.at(0)); continue;}
    if(vecans.size()==0) {vecans.push_back(vecA.at(i)); continue;}
    if(vecA.at(i)==vecans.at(vecans.size()-1)) {vecans.pop_back(); continue;}
    vecans.push_back(vecA.at(i));
  }  
  cout<<vecans.size()<<endl;
  return 0;
}

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

const int maxn=2e5+10;

int n,a[maxn];
bool x[maxn];

bool pass(int mid)
{
	int i,l=0,r=2*n;;
	for (i=1;i<2*n;i++)
		x[i]=a[i]<=mid;
	for (i=2*n-1;i>n;i--)
		if (x[i]==x[i-1]) r=i;
	for (i=1;i<n;i++)
		if (x[i]==x[i+1]) l=i;
	if (n-l<r-n) return x[l];
	if (n-l>r-n) return x[r];
	if (l!=0&&x[l]==x[r]) return x[l];
	return !x[n]^(n&1);
}

int main()
{
#ifdef h10
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
	int i;
	scanf("%d",&n);
	for (i=1;i<2*n;i++)
		scanf("%d",&a[i]);
	int L=1,R=2*n-1,mid;
	while (L<=R)
	{
		mid=(L+R)>>1;
		if (pass(mid)) R=mid-1;
		else L=mid+1;
	}
	printf("%d\n",L);
}


Measured memory_bytes: 1280
void main()
{
    string s = rdStr;

    long len = s.length;
    foreach (i; 0 .. len-1)
    {
        if (s[i] == s[i+1])
        {
            writeln(i + 1, " ", i + 2);
            return;
        }
        if (i == len - 2) break;
        if (s[i] == s[i+2])
        {
            writeln(i + 1, " ", i + 3);
            return;
        }
    }

    writeln(-1, " ", -1);
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 508
#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <cstdio>
#include <cstdint>
#define READINTA(X) while((ct=readchar())>='0')(X)=(X)*10+ct-'0';
#define READINTB(X) while((ct=*ci++)>='0')(X)=(X)*10+ct-'0';
using namespace std;

uint16_t d, k;
uint32_t M = 0;
int_fast64_t c, sd = 0, sc = 0;
const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;

inline char readchar() {
    if(ci-cn==cm){fread_unlocked(cn,1,cm,stdin);ci=cn;}
    return *ci++;
}

int main() {
    READINTA(M);
    while(M--) {
        c = 0;
        if(ci-cn+16>cm) {
            d = readchar() - '0';
            readchar();
            READINTA(c);
        } else {
            d = *ci++ - '0';
            ci++;
            READINTB(c);
        }
        sc += c;
        sd += c * d;
    }
    printf("%lld\n", --sc + --sd / 9);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
int n,t1=0,t2=0;
main(){
	cin>>n;
	int a[n],b[n];
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n){
		if(a[i]>b[i]){
			t1+=(a[i]-b[i]);
		}
		else if(a[i]<b[i]){
			if((b[i]-a[i])%2)t2++,t1++;
			t2+=(b[i]-a[i]);
		}
	}
	//swap(t1,t2);
	//if(t2%2)t2++,t1+=2;
	if(t1<=t2/2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 384
#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++;
		}
	}
	
	printf("%d\n", x);

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std; 
#define endl '\n' 

using namespace std; 

int main()
{
	const int m = 10000; 
	int n; 
	cin >> n; 
	int a[n]; 
	for(int i = 0; i<n; ++i)
		cin >> a[i]; 
	int c = 0; 
	for(int i = 1; i<n; ++i){
		if(a[i] == a[i-1]){
			a[i] = -1; 
			c++; 
		}
	}
	cout << c; 
	
}

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

int main(){
    int N;  cin >> N;
    vector<int> p(N);
    for(int i=0; i<N; i++){
        cin >> p[i];
    }

    int ans = 0;
    for(int i=1; i<N-1; i++){
        vector<int> a = {p[i-1], p[i], p[i+1]};
        sort(a.begin(), a.end());
        if(a[1]==p[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    int sx,sy,tx,ty,i=0,a,b,c,d;
    char ch[20000];
    scanf("%d%d%d%d",&sx,&sy,&tx,&ty);
    a=sx,b=sy,c=tx,d=ty;
    for(;;)
    {
      if(b<d)
      {
         ch[i++]='U';
          b++;
      }
      else if(a<c)
      {
          ch[i++]='R';
          a++;
      }
      if(a==tx&&b==ty)break;
    }
    int j=i;a=sx-1,b=sy;
    ch[j++]='L';
    for(;;)
    {
        if(b<d+1)
        {
            ch[j++]='U';
            b++;
        }
        else if(a<c)
        {
            ch[j++]='R';
            a++;
        }
        if(a==c&&b==d+1)
            break;
    }
    ch[j++]='D';
    int x;
    for(x=0;x<i;x++)
        printf("%c",ch[x]);
    for(x=0;x<i;x++)
    {
        if(ch[x]=='U')printf("D");
        else printf("L");
    }
    for(x=i;x<j;x++)
    printf("%c",ch[x]);
    for(x=i;x<j;x++)
    {
        if(ch[x]=='L')printf("R");
        else if(ch[x]=='U')printf("D");
        else if(ch[x]=='R')printf("L");
        else printf("U");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int maxn = 500+10;
LL a[maxn];
LL b[maxn];
LL ans = 1;
int n,k;

void update(LL x){
    LL t = 0;
    for(int j = 1;j <= n; ++j)
        b[j] = a[j]%x, t += b[j];
    sort(b+1,b+n+1,greater<LL>());
    LL tt = t;
    for(int j = 1;j <= tt/x; ++j)
        t -= b[j];
    if(t <= k)
        ans = max(ans,x);
}
int main(void)
{
    cin>>n>>k;
    LL sum = 0;
    for(int i = 1;i <= n; ++i)
        cin>>a[i],sum += a[i];
    // cout<<sum<<endl;
    for(LL i = 2;i*i <= sum; ++i){
        if(sum % i == 0){
            update(i);
            update(sum/i);
        }
    }
    update(sum);

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323
const int N = 2e5+5;
pll e[N];
ll par[N];
vl a[N];
ll n, m, ans[N];

ll fp(ll x)
{
       while(par[x]!=x)
       {
              par[x]=par[par[x]];
              x=par[x];
       }
       return x;
}

void solve()
{
       cin>>n>>m;
       rep(i,1,m+1) cin>>e[i].F>>e[i].S;
       ans[m]=n*(n-1)/2;
       rep(i,1,n+1) { par[i]=i; a[i].pb(i); }
       for(ll i=m; i>0; i--)
       {
              ll x=fp(e[i].F), y=fp(e[i].S);
              ans[i-1]=ans[i];
              if(x==y) continue;
              ll w=sz(a[x]), z=sz(a[y]);
              ll inc=(w+z)*(w+z-1)/2 - w*(w-1)/2 - z*(z-1)/2;
              ans[i-1]-=inc;
              if(w>z)
              {
                     for(ll d : a[y]) a[x].pb(d);
                     par[y]=x;
                     a[y].clear();
              }
              else
              {
                     for(ll d:a[x]) a[y].pb(d);
                     par[x]=y;
                     a[x].clear();
              }
       }
       rep(i, 1, m+1) cout<<ans[i]<<"\n";
}

int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 21612
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,tn;
string s;
int a[26];
int ans=1;

main(){
	cin>>n;
	rep(i,26)a[i]++;
	rep(i,n){
		char t;
		cin>>t;
		a[t-'a']++;
	}
	rep(i,26){
		ans*=a[i];
		ans%=MOD;
	}
	dump(ans-1);
}


Measured memory_bytes: 256
let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let tbl = Hashtbl.create ~random:true n in
  for _ = 0 to n - 1 do
    match split_on_char ' ' (read_line ()) with
    | ["find"; s] -> print_endline (if Hashtbl.mem tbl s then "yes" else "no")
    | [_; s] -> Hashtbl.add tbl s ()
    | _ -> assert false
  done

Measured memory_bytes: 43952