akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  vi h(N);
  rep(i,N) {
    cin >> h[i];
  }
  vi dp(N);
  dp[0] = 0;
  srep(i,1,N) {
    if(i < 2) {
      dp[i] = abs(h[i]-h[i-1]);
    } else {
      dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }
  }
  cout << dp[N-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M, C;
  cin >> N >> M >> C;
  
  vector<int> B(M);
  for (int i = 0; i < M; i++){
    cin >> B.at(i);
  }
  
  int count = 0;
  vector<int> A(M);
  for (int i = 0; i < N; i++){
    for (int j = 0; j < M; j++){
      cin >> A.at(j);
    }
    int sum = 0;
    for (int k = 0; k < M; k++){
      sum += A.at(k)*B.at(k);
    }
    if (sum + C > 0){
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int A, B;
  cin >> A >> B;
  int x = A + B;
  int y = A - B;
  int z = A * B;
  cout << max(x, max(y, z)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 2e5 + 7;
const int maxm = 1e6 + 7;
const int ALP = 26;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-8;

int n,k,s;
int a[maxn];

int main()
{
	//freopen("1.in","r",stdin);
	scanf("%d%d%d",&n,&k,&s);
	for(int i=1;i<=n;i++)
	{
		if(i<=k)
			a[i]=s;
		else
			a[i]=(s==1e9?1:s+1);
	}
	for(int i=1;i<=n;i++)
		printf("%d ",a[i]);
	printf("\n");
	return 0;
}


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

int main() {
    int N, K, S;
    cin >> N >> K >> S;
    vector<int> A(N);
    for (int i = 0; i < K; ++i) A[i] = S;
    if (S == 1000000000) {
        for (int i = K; i < N; ++i) A[i] = S - 1;
    } else {
        for (int i = K; i < N; ++i) A[i] = 1000000000;
    }
    for (int i = 0; i < N - 1; ++i) cout << A[i] << " ";
    cout << A[N - 1] << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int k,x;
    cin>>k>>x;
    vi v;
    FOR(i,-1000,1000)if(abs(i-x)<k){
        v.push_back(i);
    }
    REP(i,v.size()){
        printf("%d%c",v[i],i+1==v.size()?'\n':' ');
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, vector<ll> A) {
  int c = 0;
  for (ll i: A) {
    if (i % 2) ++c;
  }
  cout << (c % 2 == 0) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	scanf("%lld", &N);
	vector<ll> A(N-1+1);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &A[i]);
	}
	solve(N, A);
	return 0;
}


Measured memory_bytes: 1792
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    int n;cin>>n;
    map<string,int> m;

    REP(i,n){
        string s;cin>>s;
        m[s]=1;
    }

    cout<<m.size()<<endl;


	return;
}

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

Measured memory_bytes: 19296
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main() {
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    map<int,int> p;
    rep(i,n)p[a[i]]++;
    int ma = *max_element(a.begin(),a.end());
    auto b = a;
    sort(b.begin(),b.end());
    int c = b[b.size()-2];

    rep(i,n){
        if(a[i]!=ma)cout << ma << endl;
        else if(p[a[i]]==1){
            cout << c << endl;
        }else{
            cout << ma << endl;
        }
    }
}


Measured memory_bytes: 8704
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int count(int N)
{
        int cnt = 0;
        while (N)
        {
                cnt += N % 10;
                N /= 10;
        }
        return cnt;
}

int main()
{
        int N;
        cin >> N;
        int cnt = count(N);

        if (N % cnt == 0)
                cout << "Yes" << endl;
        else
                cout << "No" << endl;

        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,l[10],c=0,x=0;
	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&l[n]);
		x=x+l[n];
		if (l[n]>c)
		{
			c=l[n];
		}
	}
	if (x-c>c)
	{
		printf("Yes\n");
	}else printf("No\n");
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int A[3]; rep(i, 3) cin >> A[i];
    sort(A, A+3);
    if(A[0]+A[1] == A[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;

int main(){

	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
	
		cin>>a[i];
	}
	sort(a,a+n);
	int ans=0;
	int ch=0;
	for(int i=n-1;i>-1;i--){

		if(ch==0){
		
			ans+=a[i];
			ch=1;
		}
		else{
		
			ans-=a[i];
			ch=0;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

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

        String w = sc.next();

        sc.close();

        int[] arr = new int[26];

        for (int i = 0; i < w.length(); i++) {
            arr[w.charAt(i) - 'a']++;
        }

        boolean flg = true;

        for (int i = 0; i < 26; i++) {
            if (arr[i] % 2 != 0) {
                flg = false;
            }
        }

        System.out.println(flg ? "Yes" : "No");

    }
}

Measured memory_bytes: 22740
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>
using namespace std;
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	fill((T*)array, (T*)(array + N), val);
}

const ll INF = 1e18;
const ll mod = 1e9 + 7;
ll fact(ll x) {
	if (x == 0)return 1;
	ll cnt = 1;
	for (int i = 1; i <= x; i++) {
		cnt *= i;
		cnt %= mod;
	}
	return cnt;
}
ll modpow(ll a, ll b, ll c) {
	if (b == 0)return 1;
	else if (b % 2 == 0) {
		ll d = modpow(a, b / 2, c);
		return (d * d) % c;
	}
	else return (a * modpow(a, b - 1, c)) % c;
}
int main() {
	IOS;
	ll n, m;
	cin >> n >> m;
	ll k = m;
	map<ll,ll> mp;
	ll cnt = 2;

	while (k > 1) {
		while (k % cnt == 0) {
			k /= cnt;
			mp[cnt]++;
		}
		cnt++;
	}
	ll ans = 1;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		ll p = it->second;
		ans = (ans * fact(p + n - 1)) % mod;
		for (int i = 1; i <= p; i++) {
			ans = (modpow(i, mod - 2, mod) * ans) % mod;
		}
		if (n == 1)continue;
		for (int i = 1; i <= n - 1; i++) {
			ans = (modpow(i, mod - 2, mod) * ans) % mod;
		}
	}
	dump(ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

ll recursive_square(ll x, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    ll t = recursive_square(x, n / 2);
    return t * t;
  }
  return x * recursive_square(x, n - 1);
}

int main() {
  ll N, P;
  cin >> N >> P;
  ll X = P;
  map<ll, ll> prime_cnt;
  ll p;
  for (ll i = 2; i * i <= P; i++) {
    if (X % i == 0) {
      p = i;
      prime_cnt[p] = 1;
      X = X / p;
      while (X % i == 0) {
        X = X / p;
        prime_cnt[p]++;
      }
    }
  }
  if (X != 1) prime_cnt[X] = 1;
  ll g = 1;
  for (auto p : prime_cnt) {
    ll x = p.first;
    ll e = p.second;
    ll f = e / N;
    g *= recursive_square(x, f);
  }
  cout << g << endl;
  return 0;
}

Measured memory_bytes: 256
/*#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#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;}
////////////////////////////////////////


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

ll used[105][105];

int h,w;
string s[105];
void bfs(int x,int y,int c){
    c++;
    for(int i=0;i<=3;i++){
        int px=x+dx[i],py=y+dy[i];
        if(0<=px&&px<=h-1&&0<=py&&py<=w-1&&s[px][py]=='.'&&used[px][py]>c){
            used[px][py]=c;
            bfs(px,py,c);
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>h>>w;
    for(int i=0;i<=h-1;i++)cin>>s[i];
    int sum=0;
    for(int i=0;i<=h-1;i++)for(int j=0;j<=w-1;j++){
        if(s[i][j]=='.')sum++;
    }
    rep(i,0,h-1)rep(j,0,w-1)used[i][j]=inf;
    used[0][0]=1;
    bfs(0,0,1);
    cout<< (used[h-1][w-1]==inf ? -1:sum-used[h-1][w-1])<<endl;
    
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		int max= Integer.MAX_VALUE;
		int now_cost=0;
		int[] point=new int[N];

		for(int i=0; i<N; i++) {
			point[i]=sc.nextInt();
		}

		for(int i=0; i<N-K+1; i++) {
			now_cost=0;
			now_cost=Math.min(Math.abs(point[K-1+i]-point[i])+Math.abs(point[i]),Math.abs(point[K-1+i]-point[i])+Math.abs(point[K-1+i]));
			max=Math.min(now_cost, max);
		}

		System.out.println(max);
	}
}

Measured memory_bytes: 50160
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define faster ios::sync_with_stdio(0)
const int N  = 509;
vector<int>v[N+5];

int32_t main()
{
    faster;
    int n, p, q;
    cin >> n >> p >> q;
    int x, y;
    for(int i = 1; i <=p; i++){
        cin >> x >> y;
        v[x].pb(y);
    }
    for(int i = 1; i <= n; i++){
        sort(v[i].begin(), v[i].end());
    }

    while(q--){
        cin >> x >> y;
        int ans = 0;
        for(int i = x; i <= y; i++){
            ans += upper_bound(v[i].begin(), v[i].end(), y) - v[i].begin();
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,a[10],su;double x[10],y[10],all;
int main()
{
    scanf("%d",&n);
    rep(i,1,n) scanf("%lf%lf",x+i,y+i),a[i]=i;
    do{
        double cur=0;
        rep(i,2,n) cur+=sqrt((x[a[i]]-x[a[i-1]])*(x[a[i]]-x[a[i-1]])+(y[a[i]]-y[a[i-1]])*(y[a[i]]-y[a[i-1]]));
        all+=cur;su++;
    }while(next_permutation(a+1,a+n+1));
    printf("%.12lf",all/su);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {
	ll H, N;
	cin >> H >> N;
	vector<int> A(N), B(N);
	rep(i, N) {
		cin >> A[i] >> B[i];
	}

	vector<vector<int>> dp(N, vector<int>(H+1, 0)); //dp[i][j] : 最初に魔法i, ダメージj を与える最小の消費魔力

	vector<int> dp2(H, 0);

	// dp[i][0] = 0;
	for(int j=1; j<H+1; j++) {
		for(int i=0; i<N; i++) {
			if(A[i]>=j) {
				dp[i][j] = B[i];
			} else { // A[i] < j;
				// ll tmp = dp[0][j-A[i]];
				// for(int k = 1; k<N; k++) {
				// 	if(tmp > dp[k][j-A[i]]) tmp = dp[k][j-A[i]];
				// }
				dp[i][j] = B[i] + dp2[j-A[i]];
			}
		}

		dp2[j] = dp[0][j];
		for(int k = 1; k<N; k++) {
			if(dp2[j] > dp[k][j]) dp2[j] = dp[k][j];
		}
	}

	// for(int i=0; i<N; i++) {
	// 	for(int j=0; j<H+1; j++) {
	// 		cout << dp[i][j] << ' ';
	// 	}
	// 	cout << endl;
	// }


	ll ans = dp[0][H];
	rep(i, N) {
		if(ans > dp[i][H]) ans = dp[i][H];
	}

	cout << ans << endl;

  return 0;
}

Measured memory_bytes: 39424
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
//#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define loop(s, v, it) for (s::iterator it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = e[i].nxt)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, sum) memset(a, sum, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(#x".in", "r", stdin),freopen(#x".out", "w", stdout)
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int N = 100010 ;
const int INF = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const int MOD = 1000000007 ;
const double eps = 1e-7 ;
void douout(double x){ printf("%lf\n", x + 0.0000000001) ; }
template <class T> void print(T a) { cout << a << endl ; exit(0) ; }
template <class T> void chmin(T &a, T b) { if (a > b) a = b ; }
template <class T> void chmax(T &a, T b) { if (a < b) a = b ; }
template <class T> void upd(T &a, T b) { (a += b) %= MOD ; }
template <class T> void mul(T &a, T b) { a = (ll) a * b % MOD ; }

int n, r, b ;
string s ;

signed main(){
//	file(test) ;
	scanf("%d", &n) ;
	cin >> s ;
	rep(i, 0, n - 1)
	if (s[i] == 'R') r++ ;
	else b++ ;
	if (r > b) print("Yes") ;
	else print("No") ;
	return 0 ;
}

/*
写代码时请注意：
	1.ll？数组大小，边界？数据范围？
	2.精度？
	3.特判？
	4.至少做一些
思考提醒：
	1.最大值最小->二分？
	2.可以贪心么？不行dp可以么
	3.可以优化么
	4.维护区间用什么数据结构？
	5.统计方案是用dp？模了么？
	6.逆向思维？
*/




Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
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 void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });            var N = Sarray()[0];
            var S = ReadLine();
            var assyuku = new List<char>();
            var pre = '.';
            for (var i = 0; i < S.Length; ++i)
            {
                if (pre != S[i])
                {
                    assyuku.Add(S[i]);
                    pre = S[i];
                }
            }
            WriteLine(assyuku.Count - 1);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 11616
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a,b=input().split()
b=b[0]+b[2:]
# print(b)
a=int(a)
b=int(b)

# b*=100
# print(a,b)
# b=math.floor(b)
print(a*b//100)

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

class Compare{
public:
  bool operator()(const string &a, const string &b)const{
    if(a.length() == b.length()){
      return a < b;
    }
    return a.length() < b.length();
  }
};

int main(){
  map<string, int, Compare> mp;
  int n;
  cin >> n;

  for(int i = 0; i < n; i++){
    string name;
    int x;
    cin >> name >> x;
    mp[name] += x;
  }

  for(map<string,int>::iterator iter = mp.begin(); iter != mp.end(); iter++){
    cout << (iter->first) << " " << (iter->second) << endl;
  }
}

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

int main() {
    int h, w;
    while(true) {
        cin >> h >> w;
        if(h == 0 && w == 0) {
            break;
        }
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                if((i+j)%2 == 0) {
                    cout << "#";
                }
                else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;

}


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String buff = s.substring(0,s.length()-2);
		int next =1;

		for(int i=0;i<s.length()-2;i++) {
			if(buff.length()%2==0&&buff.substring(0,buff.length()/2-1).equals(buff.substring(buff.length()/2,buff.length()-1))) {
				System.out.println(buff.length());
				break;
			}
			buff=buff.substring(0,buff.length()-2);
		}
		
		//System.out.println(-1);
	}
	public static int sample() {
		return 1;
	}

}


Measured memory_bytes: 22612
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 A, B, C, X, Y;
  std::cin >> A >> B >> C >> X >> Y;
  std::cout << std::min({A * X + B * Y, X < Y ? C * X * 2 + B * (Y - X) : C * Y * 2 + A * (X - Y), C * std::max(X, Y) * 2}) << std::endl;
  return 0;
}

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

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


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int sum;
	while(cin >> sum && sum != 0){
	
		for(int i = 0; i < 9; ++i){
			int book;
			cin >> book;
			sum -= book;
		}
		
		cout << sum << endl;
	}
	
	return 0;
}

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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rep(i,j,k) for(int i=j;i<k;i++)
#define repb(i,j,k) for(int i=j;i>=k;i--)

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

const ll inf = 1e10;
const ll mod = 1e9 + 7;
const int maxn = 100 + 6;
string s[maxn];


signed main(){
	IOS;
	int n;
	cin >> n;
	rep(i,0,n){
		cin>>s[i];
	}
	bool flag = true;
	rep(i,0,n){
		rep(j,i+1,n){
			if(s[i] == s[j]){
				flag = false;
				break;
			}
		}
	}
	bool flag1 = true;
	rep(i,0,n-1){
		int x = s[i].length();
		
		if(s[i][x-1] != s[i+1][0]){
			flag1 = false;
			break;
		}
		
	}
	
	if(flag1 == true and flag == true){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)


int main(){
	
	int n;
	cin>>n;
	vector<int> p(n);
	for(int i=0;i<n;i++){
		cin>>p[i];
	}
	int cnt = 0;
	for(int i=0;i<n-2;i++){
		if((p[i+2]-p[i+1])*(p[i]-p[i+1])<0){
			cnt++;
		}
	}
	
	cout<<cnt<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a,b,c;
 cin>>a>>b>>c;
  if(a==b&&a!=c){
    cout<<"Yes";
  } else if(a==c&&b!=c){
    cout<<"Yes";
  } else if(b==c&&a!=b){
    cout<<"Yes";
  } else {
    cout<<"No"<<endl;
  }
}
    

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}
const ll MOD = 1e9 + 7;

ll fc(int n) {
    ll ans = 1;
    for (int i = 1; i <= n; ++i)
        ans = (ans * i) % MOD;
    return ans;
}

int main() {
    int n, m;
    cin >> n >> m;
    if (max(n, m) > min(n, m) + 1) {
        cout << 0 << "\n";
    }
    else if (max(n, m) == min(n, m) + 1) {
        cout << (fc(n) * fc(m)) % MOD << "\n";
    }
    else {
        cout << (2 * fc(n) * fc(m)) % MOD << "\n";
    }
    return 0;
}




Measured memory_bytes: 256
program sample
    implicit none
  
    integer(8) :: i,j,m,n,x,b,s
    
    integer(8),allocatable:: a(:)
  
    read(*,*) n,x
    allocate(a(n))
    read(*,*)a
    call msort(a)
    m=0
    do i=1,n
        x=x-a(i)
        if (x<0)then
            write(*,*)i-1
            stop
        end if
    end do
    if (x==0)then
        write(*,*)n
    else
        write(*,*)n-1
    end if
       
    
    stop
    contains
    recursive subroutine msort(x)
    implicit none
    integer(8), intent(inout) :: x(:)
 
    integer(8) :: n, mid, i, j, k
    integer(8), allocatable :: tmp(:)
    
    n = size(x)
    
    if(n == 1) then
      return
    end if
 
    !
    ! 前半と後半に分けてソート
    ! 1~midとmid+1~nをそれぞれソート済みにする
    !
    mid = n / 2
    call msort(x(:mid))
    call msort(x(mid+1:))
 
    !
    ! tmpという配列にxを一時的に保管
    ! マージソートは外部ソート
    !
    allocate(tmp(n))
    tmp = x
 
    ! tmpの後半部分を左右反転
    do k = n, mid+1, -1
      tmp(k) = x(mid + n - k + 1)
    end do
 
    ! iは前半のリストのうちまだ見ていないものの最小値
    ! jは後半のリストのうちまだ見ていないものの最小値
    ! kは見た回数の合計
    i = 1
    j = n
 
    do k = 1, n
      !
      ! 一番左と一番右のうち小さい方をxに入れていく
      ! ここが等号つき不等号なので、安定ソートとなる
      !
      if(tmp(i) <= tmp(j)) then
        x(k) = tmp(i)
        i = i + 1
      else
        x(k) = tmp(j)
        j = j - 1
      end if
    end do
    
    deallocate(tmp)
    return
  end subroutine msort
end program sample
  



Measured memory_bytes: 2808
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

int main(){
  string s;
  cin >> s;
  if(s == "abc"){
    cout << "Yes" << endl;
    return 0;
  }
  if(s == "acb"){
    cout << "Yes" << endl;
    return 0;
  }
  if(s == "bac"){
    cout << "Yes" << endl;
    return 0;
  }
  if(s == "bca"){
    cout << "Yes" << endl;
    return 0;
  }
  if(s == "cab"){
    cout << "Yes" << endl;
    return 0;
  }
  if(s == "cba"){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}

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

const int END = -1;
struct StNod
{
  int m_nKey;
  int m_nParnt;
  int m_nLeft;
  int m_nRigt;

  StNod() :
    m_nKey(END), m_nParnt(END), m_nLeft(END), m_nRigt(END)
  { }
};

void fnInput(vector<StNod> &rvoNod)
{
  StNod oNod;
  int nMaxSiz;

  cin >> nMaxSiz;
  rvoNod.resize(nMaxSiz, oNod);

  for (int i = 0; i < nMaxSiz; i++)
  {
    int nNo, nLeft, nRigt;
    cin >> nNo >> nLeft >> nRigt;

    rvoNod[nNo].m_nKey  = nNo;
    rvoNod[nNo].m_nLeft = nLeft;
    rvoNod[nNo].m_nRigt = nRigt;
    if (nLeft != END)  rvoNod[nLeft].m_nParnt = nNo;
    if (nRigt != END)  rvoNod[nRigt].m_nParnt = nNo;
  }
}

void fnPreOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  cout << " " << nx;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnInOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  cout << " " << nx;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
}

void fnPostOrder(const vector<StNod> &cnrvoNod, int nx)
{
  if (nx == END)  return;

  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);
  cout << " " << nx;
}

void fnTreeWalk(const vector<StNod> &cnrvoNod)
{
  int nx = 0;
  while (cnrvoNod[nx].m_nParnt != END)
    nx = cnrvoNod[nx].m_nParnt;

  cout << "Preorder" << endl;
  fnPreOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;

  cout << "Inorder" << endl;
  fnInOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;

  cout << "Postorder" << endl;
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nKey);
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StNod> voNod;

  fnInput(voNod);
  fnTreeWalk(voNod);
  return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define ll long long int
#define ff first
#define pb push_back
#define ss second
#define ff first
#define mp make_pair

using namespace std;

vector<int> vec;


map<ll,ll> has;

set<ll> st;


int main() 
{
    ll n,m,t,p,q,r,s,a,b,c,d,e,f,g,h,sum,res,flag,u,v,i,j,l,k,z,x,y,len;
    
    string str,ptr;
    
    set<ll>::iterator it;
    
    cin>>n;
    
    ll ar[n+2];
    
    for(i=0;i<n;i++)
    {
    	cin>>ar[i];
    	has[ar[i]]++;
    	
    	st.insert(ar[i]);
	}
	
	it=st.end();
	it--;
	
	a=b=-1;
	
	for(;;--it)
	{
		
	//	cout<<*it<<"\n";
		if(has[*it]>=4)
		{
			if(a==-1)
			a=*it;
			
			b=*it;
			break;
		}
		else if(has[*it]>=2)
		{
			if(a==-1)
			a=*it;
			else if(b==-1)
			b=*it;
			
			if(a!=-1 && b!=-1)
			break;
		}
		
		if(it==st.begin())
		break;
		
	}
	
	if(a==-1 || b==-1)
	p=0;
	else
	p=a*b;
     
     cout<<p;
   
    return 0;
}


Measured memory_bytes: 11904
n = int(input())
s = []
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
    s.append(input())
for i in range(n):
    if(s[i]=='AC'):
        ac+=1
    elif(s[i]=='WA'):
        wa+=1
    elif(s[i]=='TLE'):
        tle+=1
    else:
        re+=1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)


Measured memory_bytes: 16140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 2e5 + 555;
const int MOD = 1e9 + 7;
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    cout << fixed;
    int x, n;
    cin >> x >> n;
    set<int> V;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        V.insert(a);
    }
    int ans = -1000;
    for (int i = -100; i <= 200; i++) {
        if (!V.count(i) && abs(ans - x) > abs(i - x)) {
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
using namespace std;
int main(){
	int n,y;
	cin >> n >> y;
	for(int i=0;i<=y/10000;i++){
		for(int j=0;j<=y/5000;j++){
			int k=n-i-j;
			if(k>=0&&i*10000+j*5000+k*1000==y){
				cout << i << ' ' << j << ' ' << k;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a[10],i,b=0,x=1000;
	for(i=0;i<6;i++){
		scanf("%d",&a[i]);
		b+=a[i];
	}
	for(i=0;i<4;i++){
		if(x>a[i]){
			x=a[i];
		}
	}
	b-=x;
	if(a[4]<a[5]){
		b-=a[4];
	}
	else{
		b-=a[5];
	}
	printf("%d\n",b);
	return 0;
}

Measured memory_bytes: 1028
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main(void){ 
char S[27];
int i=0,j=0;
while(scanf("%c",&S[i])!=EOF){
 i++;
}
for(i=0;i<strlen(S)-1;i++)
 for(j=i+1;j<strlen(S);j++)
  if(S[i]==S[j]){
   printf("no\n");
   return 0;
  }
printf("yes\n");
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <utility>
#include <sstream>
#include <iomanip>

typedef std::tuple<long long ,long long ,int> lli;

int main(){
  int N , M;
  std::cin >> N >> M;
  std::vector<lli> v(M);
  for(int i = 0 ; i < M ; i++){
    std::cin >> std::get<0>(v[i]) >> std::get<1>(v[i]);
    std::get<2>(v[i]) = i;
  }

  std::sort(v.begin(), v.end(),
	    [](lli &x , lli &y){
	      return (std::get<0>(x) == std::get<0>(y))?(std::get<1>(x) < std::get<1>(y)):(std::get<0>(x)<std::get<0>(y));});
  
  long long city  = 1;
  long long count = 1;
  std::vector<std::tuple<int ,long long> > ha(M);
  for(int i = 0 ; i < (int)v.size() ; i++){
    long long first = std::get<0>(v[i]);
    if(first != city){
      city = first;
      count = 1;
    }
    if(first == city){
      std::get<0>(ha[std::get<2>(v[i])]) = city;
      std::get<1>(ha[std::get<2>(v[i])]) = count;
      count++;
    }
  }
  for(int i = 0 ; i < M ; i++){
    std::cout << std::setw(6) << std::setfill('0') << std::get<0>(ha[i]) << std::setw(6) << std::setfill('0') << std::get<1>(ha[i]) << std::endl;
  }
  return 0; 
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;


int main() {
  int a, b, k;
  cin >> a >> b >> k;
  int cnt = 0;
  while (1) {

    if (a % 2 != 0) {
      a--;
    }
    b += (a / 2);
    a /= 2;
    cnt++;
    if (cnt == k) break;

    if (b % 2 != 0) {
      b--;
    }
    a += (b / 2);
    b /= 2;
    cnt++;
    if (cnt == k) break;
  }
  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A, B, C, D;
    cin>>A>>B>>C>>D;
    while ((A > 0)||(C > 0))
    { C-=B;
        if(C<=0){
            cout<<"Yes"<<endl;
            break;}
        A-=D;
        if(A<=0)
        {
            cout<<"No"<<endl;
            break;}
    }
}


Measured memory_bytes: 3636
n, m, x = [int(i) for i in input().split()]

array = [int(i) for i in input().split()]
cnta = 0
cntb = 0

for i in range(m):
  if array[i] < x:
    cnta +=1
  else:
    cntb +=1
    
print(min([cnta,cntb]))
  

Measured memory_bytes: 2940
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
struct unionfind{
  int par[100010]; // 親ノード  必要に応じて要素数を変えよう
  int rank[100010]; // ランク　必要に応じて要素数を変えよう
  unionfind(int n){
    init(n);
  }
  void init(int n){
    for(int i=0;i<=n;i++){
      par[i]=i;
      rank[i]=1;
    }
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      return par[x] = root(par[x]);
    }
  }
  int size(int x){
    return rank[root(x)];
  }
  bool same(int x,int y) {
    return root(x) == root(y);
  }
  void unite(int x,int y) {
    x=root(x);
    y=root(y);
    if(x==y){
      return;
    }
    if(rank[x]<rank[y]){
      swap(x,y);
    }
    rank[x]=rank[x]+rank[y];
    par[y]=x;
  }
};
int main(){
  int i,n,m,a[5010],b[5010],j,ans=0;
  scanf("%d %d\n",&n,&m);
  unionfind tree(n);
  for(i=0;i<m;i++){
    scanf("%d %d\n",&a[i],&b[i]);
  }
  for(i=0;i<m;i++){
    for(j=0;j<m;j++){
      if(i!=j){
        tree.unite(a[j],b[j]);
      }
    }
    if(tree.size(a[0])==n){
      ans++;
    }
    tree.init(n);
  }
  printf("%d\n",m-ans);
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back


ll modpow(ll a, ll n, ll m)
{
    if(n == 0) return 1;
    ll t = modpow(a, n >> 1, m);
    t = t * t % m;
    if(n & 1) t = t * a % m;
    return t; 
}

int main()
{
    ll N;
    cin >> N;
    vec A(N+1, 0), B(N+1, 0);
    REP(i,1,N+1) cin >> A[i];

    REP(i,1,N+1) {
        if((N + 1 + A[i]) % 2 == 0) {
            ++B[(N+1+A[i])/2];
            ++B[(N+1-A[i])/2];
        }
    }

    bool f = true;
    REP(i,1,N+1) {
        if(B[i] != 2) {
            f = false;
            break;
        }
    }

    if(f) PR(modpow(2,N/2,MOD));
    else PR(0);

    return 0;
}

/*



*/

Measured memory_bytes: 4840
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

vector<int> G[100005];
int used[100005];
bool ans;

bool search(int s, int tama){
	vector<int> children;
	used[s]=true;
	rep(i,G[s].size()){
		if(!used[G[s][i]]){
			children.push_back(G[s][i]);
		}
	}
	if(children.size() == 0){
		if(tama%2==0){
			//cout<<s<<"a"<<endl;
			return true;
		}
	}
	if(children.size()==1){
		//cout<<s<<"b"<<endl;
		return search(children[0],tama+1);
	}
	int count=0;
	rep(i,children.size()){
		if(search(children[i],0)){
			count++;
		}
	}
	if(count >= 2){
		//cout<<s<<"c"<<endl;
		ans=true;
		return true;
	}
	if(count==1 && tama%2 == 1){
		//cout<<s<<"d"<<endl;
		return true;
	}
	if(count == 0 && tama%2 == 0){
		return true;
	}
	//cout<<s<<"e"<<endl;
	return false;
}

int main(void){
	int n,a,b;
	cin>>n;
	rep(i,n-1){
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	//cout<<"First"<<endl;
	//return 0;
	reps(i,n){
		used[i]=false;
	}
	ans = false;

	if(n%2==1){
		cout<<"First"<<endl;
		return 0;
	}
	bool memo = search(1,0);
	if(memo || ans){
		cout<<"First"<<endl;
	}else{
		cout<<"Second"<<endl;
	}
	return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a[5];
	for(ll i=0;i<5;i++){
		cin>>a[i];
	}
	for(ll i=0;i<5;i++){
		if(a[i]==0){
			cout << i+1;
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3632