akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


bool func(pair<ll,ll> a, pair<ll,ll> b){
	return a.second > b.second;
}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N;
	cin >> N;

	map<ll,ll> cnt[2];
	vector<ll> vec[2];

	rep(i,N){
		ll inp;
		cin >> inp;
		vec[i%2].pb(inp);
		cnt[i%2][inp] ++;
	}

	rep(i,2){ rmsame(vec[i]); }

	vector<pair<ll,ll> >v[2];
	rep(i,2){
		rep(j, vec[i].size()){
			v[i].pb(mp(vec[i][j], cnt[i][vec[i][j]]));
		}
		sort(all(v[i]), func);
	}


	ll ans = N ;
	ll a = min(2LL, (ll)(v[0].size()));
	ll b = min(2LL, (ll)(v[1].size()));
	rep(i, a)rep(j,b){
		ll ret;
		if(v[0][i].first == v[1][j].first){
			ret = N - max(v[0][i].second, v[1][j].second);
		}
		else{
			ret = N - v[0][i].second - v[1][j].second;
		}
		ans = min(ret, ans);
	}
	cout << ans << endl;

	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


Measured memory_bytes: 9580
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

const int MOD = 1e9+7;

signed main() {
	int n,k;
	std::cin >> n >> k;
	std::vector<int> states;
	for(int i=1;i*i<=n;i++) {
		states.emplace_back(i);
		if(i!=n/i) states.emplace_back(n/i);
	}
	std::sort(all(states));
	int state_count = states.size();
	std::vector<int> a;
	std::vector<int> b;
	a.reserve(state_count);
	b.reserve(state_count);
	for(int i=0;i<state_count;i++) a[i] = states[i];
	for(int i=1;i<k;i++) {
		int last = 0;
		for(int j=0;j<state_count;j++) {
			b[j] = (states[j]-last)*a[std::lower_bound(all(states),(n/states[j]))-states.begin()]%MOD;
			if(j!=0) b[j] = (b[j]+b[j-1])%MOD;
			last = states[j];
		}
		std::swap(a,b);
	}
	print(a[state_count-1]);
	return 0;
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
#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(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#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 int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int a, b; cin >> a >> b;
    if(a + b == 15) cout << "+";
    else if(a * b == 15) cout << "*";
    else cout << "x";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int ct = 0;
  REP(i, n)
  {
    int a;
    cin >> a;
    if (a % 2) ct++;
  }
  if (ct % 2) cout << "NO" << endl;
  else cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b, x;
	cin >> a >> b >> x;
	if ((x >= a) && (x <= a + b)) cout << "YES\n";
	else cout << "NO\n";

	return 0;
}


Measured memory_bytes: 384
N = int(input())
# スペース区切りの整数の入力
a=[]
a = list(map(int, input().split()))
a.sort()
#print(a[::-1])
a=a[::-1]
i=0
sum=0
while i<len(a):
  if i%2==0:
    sum=sum+a[i]
  else:
    sum=sum-a[i]
  i=i+1

print(sum)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(void){
    int i, A, B, K, k=0;
    scanf("%d %d %d", &A, &B, &K);
    if(A > B){
        i = A;
        A = B;
        B = i;
    }
    for(i=A; k!=K; i--){
        if(A%i==0 && B%i==0)k++;
    }
    printf("%d\n", i+1);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, d;
ll t[100005], f[100005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> d;
	FOR(i, n) {
		cin >> t[i] >> f[i];
		f[i]--;
	}
	ll ti = 0, pos = 0, ret = 0;
	int cnt = 0;
	FOR(i, n) {
		if (t[i] >= ti + pos + f[i]) {
			ti += pos;
			for (int j = i-1; j >= i-cnt; j--) ret += ti-t[j];
			cnt = 1;
		}
		else {
			if (cnt+1 > d || t[i] < ti + abs(f[i] - pos)) {
				cout << -1 << endl;
				return 0;
			}
			cnt++;
		}
		pos = f[i];
		ti = t[i];
	}
	ti += pos;
	for (int i = n-1; i >= n-cnt; i--) ret += ti-t[i];
	cout << ret << endl;
	return 0;
}

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

using namespace std;

const int oo = 1000000010;

int solve(const vector<int> xs)
{
    vector<int> order(5);
    iota(order.begin(), order.end(), 0);

    int ans = oo;

    do
    {
        int t = 0;

        // Avalia cada uma das permutações possíveis
        for (int i  = 0; i < 4; ++i)
        {
            t += 10 * ((xs[order[i]] + 9)/ 10);
        }

        t += xs[order.back()];

        ans = min(ans, t);

    } while (next_permutation(order.begin(), order.end()));

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    vector<int> xs(5);

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

    auto ans = solve(xs);

    cout << ans << endl;

    return 0;
}

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

#define ll long long
#define ldb long double
#define rep(i, x, n, j) for(int i=x;i<(int)n;i+=j)
#define F first
#define S second
#define per(i, x, n, j) for(int i=(int)n-1;i>=0;i-=j)
#define all(v) v.begin(),v.end()
#define sz(a) (int)a.size()

const int N = 2000100;
const ll MOD = 1e9+7;
const ll inf = 1e18+5;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

int _;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ldb a, b; cin >> a >> b;
	cout << (ll)(a*b) << endl;
	return 0;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define inf 1000000000
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
int main(){
lli n,i,j;
cin>>n;
lli a[n],b[n];
lli dp[n];
for(i=0;i<n;i++){
    cin>>a[i];
}
for(i=0;i<n;i++){
    cin>>b[i];
}
lli seg[2*(n+1)]={0};
for(i=0;i<n;i++){
        lli maxi=-inf;
        for(int l=1+n,r=a[i]+n+1;l<r;l>>=1,r>>=1){
            if(l&1) maxi=max(maxi,seg[l++]);
            if((r&1)) maxi=max(maxi,seg[--r]);
        }
        dp[i]=maxi+b[i];
        int p=a[i]+n+1;
        for(seg[p]=dp[i];p>1;p=p>>1){
            seg[p>>1]=max(seg[p],seg[p^1]);
        }
}
lli *maxi=max_element(dp,dp+n);
cout<<*maxi<<endl;
}


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

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


Measured memory_bytes: 764
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  string r,g,b;cin>>r>>g>>b;
  r+=g;r+=b;
  int a=stoi(r);
  if(a%4==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

using namespace std;

int a,b,w,x;

int main()
{
	scanf("%d %d %d",&w,&a,&b);
	if(a > b) swap(a,b);
	x = a + w;
	if(x >= b) {
		printf("0\n");
	}
	else printf("%d\n",b - x);
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#include<typeinfo>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

int main() {
	ll a, b;
	cin >> a >> b;
	ll ans = 0;
	if (b - a < 4) {
		for (ll i = a; i <= b; i++) {
			ans ^= i;
		}
		cout << ans << endl;
		return 0;
	}
	while (a % 4 != 0) {
		ans ^= a;
		a++;
	}
	while (b % 4 != 3) {
		ans ^= b;
		b--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int h, w, s;
	int[][] table;
	int[][][][] dp;
	int[][][][] dem;
	int max_dem;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			h = sc.nextInt();
			w = sc.nextInt();
			s = sc.nextInt();
			if( (h|w|s) == 0 ) break;
			table = new int[h+1][w+1];
			for(int i=1;i<=h;i++) for(int j=1;j<=w;j++) {
				table[i][j] = sc.nextInt() + table[i-1][j] + table[i][j-1] - table[i-1][j-1];
			}
			dp = new int[w][h][w][h];
			dem = new int[w][h][w][h];
			for(int[][][] a: dp) for(int[][] b: a) for(int[] c: b) fill(c, -1);
			max_dem = 0;
//			debug(table);
			System.out.println( dfs(0,0,w-1,h-1) + " " + dem[0][0][w-1][h-1] );
			
//			for(int i=0;i<w;i++) for(int j=0;j<h;j++) debug(dem[i][j]);
		}
	}
	
	int demand(int x, int y, int w, int h) {
		return table[y][x] - table[y][w+1] - table[h+1][x] + table[h+1][w+1];
	}

	int dfs(int x, int y, int w, int h) {
		if( dp[x][y][w][h] >= 0 ) return dp[x][y][w][h];
//		debug(x, y, w, h);
//		debug(table[this.h][this.w] - demand(x, y, w, h), demand(x,y,w,h));
		if( table[this.h][this.w] - demand(x, y, w, h) > s ) {
			dem[x][y][w][h] = INF;
			return dp[x][y][w][h] = 0;
		}
		
		int gr = 1;
		int demand = -1;
		for(int i=x;i<w;i++) {
			int f = dfs(x,y,i,h), s = dfs(i+1,y,w,h);
			if( f*s == 0 ) continue;
			if( gr < (f+s) ) {
				gr = f + s;
				demand = min( dem[x][y][i][h], dem[i+1][y][w][h] );
			}
			else if( gr == (f+s)) {
				demand = max( demand, min( dem[x][y][i][h], dem[i+1][y][w][h] ));
			}
//			debug(x,y,w,h,demand,demand(x,y,i,h),demand(i+1,y,w,h));
		}
		for(int i=y;i<h;i++) {
			int f = dfs(x,y,w,i), s = dfs(x,i+1,w,h);
			if( f*s == 0 ) continue;
			if( gr < (f+s) ) {
				gr = f + s;
				demand = min( dem[x][y][w][i], dem[x][i+1][w][h] );
			}
			else if( gr == (f+s)) {
				demand = max( demand, min( dem[x][y][w][i], dem[x][i+1][w][h] ));
			}
//			debug(x,y,w,h,demand,demand(x,y,w,i),demand(x,i+1,w,h));
		}
		dem[x][y][w][h] = (demand > -1)? demand: s - ( table[this.h][this.w] - demand(x, y, w, h) );
//		debug(demand(x,y,w,h),dem[x][y][w][h]);
		return dp[x][y][w][h] = gr;
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

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

using namespace std;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, l;
    cin >> n >> l;

    vector<string> s(n);

    for(int i=0;i<n;++i)
        cin >> s[i];

    sort(s.begin(), s.end());

    for(int i=0;i<n;++i)
        cout << s[i];
    cout << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>











const int M = 1000000007;
ll n, k, mx, mn, res;


void solve()
{
	cin >> n >> k;
	mx = 0;
	res = 0;
	for(ll i = 0, j = n; i <= n; i++, j--)
	{
		mx += j;
		mn += i;
		if(i >= k - 1)
		{
			res = (res + mx - mn + 1) % M;
		}
	}
	cout << res << "\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3648
N = input()


if N[-1] == "2" or N[-1] =="4" or N[-1] =="5" or N[-1] =="7" or N[-1] =="9":
  print("hon")
elif N[-1] == "0" or N[-1] =="1"  or N[-1] =="6" or N[-1] =="8":
  print("pon")
else:
  print("bon")

Measured memory_bytes: 9136
N,K=map(int,input().split())
C=[0]*(N+1)
#print(C)
for i in range(K):
  d=int(input())
  A= list(map(int, input().split()))
  for j in range(d):
    C[(A[j])]+=1

#print(C)
print(C.count(0)-1)

Measured memory_bytes: 8980
#ifndef VS
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<math.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {
	cww() { CIN_ONLY{ ios::sync_with_stdio(false); cin.tie(0); } }
}star;
#define DEBUG if(0)
#endif

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r) { bool a = l>r; if (a)l = r; return a; }
template <typename T>inline bool chmax(T &l, T r) { bool a = l<r; if (a)l = r; return a; }
namespace prime {
	const int size = 1123456;
	int p[size];
	struct prime {
		prime(){
			REP(i, size)p[i] = 1;
			p[0] = p[1] = 0;
			REP(i, size)if (p[i]) {
				for (int j = i + i; j < size; j += i)p[j] = 0;
			}
			FOR(i, 1, size) {
				p[i] += p[i - 1];
			}
		}
	}prime_init;
}
int main() {
	int n;
	while (cin >> n) {
		cout << prime::p[n] << endl;
	}
}

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

int main(void){

    int n, k, *hs;
    long *costs;
    scanf("%d %d", &n, &k);

    hs = malloc(n * sizeof(int));
    costs = malloc(n * sizeof(long));

    for(int c = getchar(), i = 0; i < n; c = getchar(), ++i){

        while(isspace(c)) c = getchar();
        int val = 0;
        for(; c >= '0'; c = getchar()) val = val * 10 + c - '0';
        hs[i] = val;
    }

    costs[0] = 0;
    int lim = k < n ? k : n;
    for(int i = 1; i < lim; ++i){

        int hi = hs[i];
        long min = LONG_MAX;
        for(int j = 0; j < i; ++j){

            int testing = costs[j] + abs(hi - hs[j]);
            if(testing < min) min = testing;
        }
        costs[i] = min;
    }

    for(int i = k; i < n; ++i){

        int hi = hs[i];
        long min = LONG_MAX;
        for(int j = i - k; j < i; ++j){

            int testing = costs[j] + abs(hi - hs[j]);
            if(testing < min) min = testing;
        }
        costs[i] = min;
    }

    printf("%li", costs[n - 1]);
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

struct int_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

struct pair_hash {
    size_t operator()(pii x) const {
        return int_hash{}(x.first) ^ (int_hash{}(x.second) << 16);
    }
};

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<cd> vcd;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pii>> vvpii;
typedef vector<vector<pll>> vvpll;
typedef unordered_map<int, int, int_hash> umpii;
typedef unordered_map<ll, ll, int_hash> umpll;
typedef unordered_set<int, int_hash> usi;
typedef unordered_set<ll, int_hash> usll;
typedef unordered_set<pii, pair_hash> uspii;
typedef queue<int> qi;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = numeric_limits<int>::max();
const int MX = 100001; //check the limits, dummy

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

    string s; cin >> s;
    string need = "AKIHABARA";
    int j = 0;
    for (int i = 0; i < sz(need); i++) {
        if (need[i] == s[j]) {
            j++;
        }
        else if (need[i] != 'A') {
                cout << "NO" << endl;
                return 0;
        }
    }
    if(j != sz(s)) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000000
#define mod 1000000007
using namespace std;
using LL = long long;

int main(){
    int n,k;cin>>n>>k;
    string s;cin>>s;
    
    if(s[k-1]=='A')s[k-1]='a';
    if(s[k-1]=='B')s[k-1]='b';
    if(s[k-1]=='C')s[k-1]='c';

    cout<<s<<endl;
}

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

int main() {
    int n, m;
    int s[5], c[5];
    cin >> n;
    cin >> m;
    
    int x[n];
    for (int i = 0; i < n; i++) {
        x[i] = -1;
    }

    for (int i = 0; i < m; i++) {
        cin >> s[i];
        cin >> c[i];

        if (x[s[i] - 1] == -1) {
            x[s[i] - 1] = c[i];
        } else if (x[s[i] - 1] != c[i]) {
            cout << -1;
            return 0;
        }
    }

    if (x[0] == 0 && n > 1) {
        cout << -1;
        return 0;
    }

    for (int i = 0; i < n; i++) {
        if (x[i] == -1) {
            if (i == 0 && n > 1) {
                cout << 1;
            } else {
                cout << 0;
            }
        } else {
            cout << x[i];
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h,n;
    cin>>h>>n;
    ll dp[2][h+1];
    ll a,b;
    for(int i=0;i<2;i++)for(int j=0;j<=h;j++)dp[i][j]=1e9;
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        for(int j=0;j<=h;j++){
            dp[(i+1)&1][j]=dp[i&1][j];
        }
        for(int j=0;j<=h;j++){
            dp[(i+1)&1][min(j+a,h)]=min(dp[(i+1)&1][min(j+a,h)],dp[(i+1)&1][j]+b);
        }
    }
    cout << dp[n&1][h]<<endl;
    return 0;
}


Measured memory_bytes: 384
N=gets.to_i
array=gets.chomp.split(" ").map(&:to_i)
maxim=array.max
ARRAY=Array.new(maxim+1, 0)
array.each do |a|
    ARRAY[a]+=1
end
setwise=false
c=2
while c<=maxim do
    count=0
    n=c
    while n<=maxim do
        count+=ARRAY[n]
        n+=c
    end
    if count == N
        puts "not coprime"
        exit
    end
    if count > 1
        setwise=true
    end
    c+=1
end
if setwise
    puts "setwise coprime"
else
    puts "pairwise coprime"
end


Measured memory_bytes: 98072
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef priority_queue<int> PQI;
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);

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

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int s;
    cin>>s;
    cout<<s/3600<<":"<<(s%3600)/60<<":"<<s%60<<endl;
    
}


Measured memory_bytes: 3176
//
// Created by hide on 2020/05/15.
//

//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード(アルファベット順,bits/stdc++.hは使わない派閥)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include <cstring>

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define PRINT(message) cout<<message<<endl //10^5:配列の最大のrange(素数列挙などで使用)

//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
//#define PB push_back //vectorヘの挿入
//#define MP make_pair //pairのコンストラクタ
//#define F first //pairの一つ目の要素
//#define S second //pairの二つ目の要素
int D, G;
int answer = std::numeric_limits<int>::max();
vector<int> p, c;

unordered_map<int, int> mp;

int main(){
    string s;
    cin >> s;
    int i,j;

    long long ans=0;
    long long tmp;  // ’＋’で分割したものを代入
    for(i=0;i<( 1 << ( (s.size()) - 1 ) );i++){ //　S="125"なら、i=(00)_2～(11)_2まで。
        //  strlen(s) にすると、i=(111)_2までになる。
        tmp = s[0] - '0';                       //　Sの１文字目を数値に変換して代入
        for(j=0;j<( (s.size()) - 1 );j++){
            if( i & ( 1 << j ) ){       //　例：(i,j)=(0,1) ⇒ (00) AND (10)
                ans += tmp;             //        　　    　⇒ (10) ⇒ 12 + 5
                tmp = 0;                //  分割した分を足して、tmpを初期化
            }
            tmp = tmp*10 + (s[j+1] - '0');
        }
        ans += tmp;// 最後の分割部分を足す。
    }
    PRINT(ans);

}

Measured memory_bytes: 3608
#include<iostream>
#include<map>
#include<string>
#include<algorithm>

int main(void){
    int n;
    std::cin >> n;

    std::map<std::string, int> mp;
    for(int i = 0; i < n; i++){
        std::string s;
        std::cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    long long ans = 0;
    for(auto &p : mp){
        int temp = p.second;
        ans += (long long) temp * (temp - 1) / 2;
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>

int main() 
{
    int a;
    scanf("%i",&a);
    
    int h,m,s;
    
    h=a/3600;
    m= (a-h*3600)/60;
    s=a-(h*3600+m*60);
    
    printf("%i:%i:%i\n",h,m,s);
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
mint choose(int n,int a){
  mint x = 1,y=1;
  rep(i,a){
    x*= n-i;
    y*= i+1;
  }
  return x/y;
}
int main(){
  int x,y;
   cin>>x>>y;
   if((x+y)%3!=0){
       cout<<0<<endl;
       return 0;
   }
   int n = (2*y-x)/3;
   int m = y-2*n;
   if(n<0||m<0){
     cout<<0<<endl;
     return 0;
   }
   mint v = choose(m+n,n);
   cout<<v.x<<endl;
}

Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {
	
	static DecimalFormat df = new DecimalFormat("0.0000000000000000000");
	
	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);
		
		while (true) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			
			if (op.equals("?")) break;
			
			if (op.equals("+"))
				System.out.println(a+b);
			else if (op.equals("-"))
				System.out.println(a-b);
			else if (op.equals("*"))
				System.out.println(a*b);
			else
				System.out.println(a/b);
			
		}
		
		sc.close();
	}

}

Measured memory_bytes: 26320
#include <algorithm>
#include <iostream>
#include <set>
#include <sstream>
#include <vector>

#define FOR(i, a, b) for (int i = a; i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define fst first
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define INIT                                                                   \
    cin.tie(0);                                                                \
    ios::sync_with_stdio(false)
#define int long long

using namespace std;

template <class T = int> T in() {
    T x;
    cin >> x;
    return (x);
}

template <class T> void print(T &x) { cout << x << '\n'; }

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

signed main() {
    INIT;
    int n = in();
    int a[200000] = {};
    REP(i, n) a[i] = in();

    int ans = 0;
    int acc_xor = 0;
    int acc_sum = 0;
    int r = 0;
    REP(i, n) {
        while (r < n && (acc_xor ^ a[r]) == (acc_sum + a[r])) {
            acc_xor ^= a[r];
            acc_sum += a[r];
            r++;
        }
        ans += r - i;
        acc_xor ^= a[i];
        acc_sum -= a[i];
    }
    print(ans);
}

Measured memory_bytes: 1792
#include<string>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	for (int i = 1; i < 10; i++)
	{
		for (int h = 1; h < 10; h++)
		{
			cout<<i<<"x"<<h<<"="<<i*h<<endl;
		}
}
	return false;
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, q; string s; cin >> n >> q >> s;
    vi at(n, 0);
    rep(i, n){
        if(i == 0) at[i] = 0;
        else if(s[i] == 'C' && s[i-1] == 'A') at[i] = at[i-1]+1;
        else at[i] = at[i-1]; 
    }
    rep(i, q){
        ll l, r; cin >> l >> r; l--; r--;
        cout << at[r]-at[l] << endl;
    }
}

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

using namespace std;

int LSOne(int n){
	return n&(-n);
}

class FenwickTree{
	private:
		vector<int> ft;
	public:
		FenwickTree(int n){
			ft.assign(n+1, 0);
		}
		int rsq(int b){
			int sum = 0;
			for(;b;b-=LSOne(b)){
				sum+=ft[b];
			}
			return sum;
		}
		int rsq(int a, int b){
			return rsq(b) - (a==1 ? 0 : rsq(a-1));
		}
		void adjust(int k, int v){
			for(;k<ft.size();k+=LSOne(k)){
				ft[k] += v;
			}
		}
};

int main(){
	int n, q;
	string s;
	cin>>n>>s>>q;
	vector<FenwickTree> F(30, FenwickTree(n+1));
	for(int i=1;i<=n;i++){
		F[s[i-1]-'a'].adjust(i, 1);
	}
	for(int i=0;i<q;i++){
		int t;
		cin>>t;
		if(t==1){
			int idx;
			char c;
			cin>>idx>>c;
			if(c-'a' != s[idx-1]-'a'){
				F[s[idx-1]-'a'].adjust(idx, -1);
				F[c-'a'].adjust(idx, 1);
				s[idx-1] = c;
			}
		}
		else{
			int l, r, cnt=0;
			cin>>l>>r;			
			for(int j=0;j<26;j++){
				if(F[j].rsq(l, r))
					cnt++;
			}
			cout<<cnt<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 61444
#include<iostream>
#include<cstring>
#include<cstdio>
#include<unordered_map>
#include<string>
using namespace std;

int a[100005];
int main(){
    int n, l, r;
    cin >> n;
    while(n --){
        cin >> l >> r;
        for(int i = l; i <= r; i++) a[i] = 1;
    }
    int cnt = 0;
    for(int i = 1; i < 100005; i++) if(a[i]) cnt++;
    cout << cnt << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void){
    int m,h,s;
    scanf("%d",&h);
    m=(h-(h/3600)*3600)/60;
    s=((h-(h/3600)*3600)%60);
    printf("%d:%d:%d\n",h/3600,m,s);
return 0;
}


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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

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

ld p[3005];
ld d[3005][3005];

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

    int n;
    cin >> n;

    d[0][0] = 1;

    FOR (i, 1, n) {
    	cin >> p[i]; 
    }

    FOR (i, 1, n) {
    	FOR (j, 0, i) {
    		d[i][j] = d[i - 1][j] * (1 - p[i]) + d[i - 1][j - 1] * p[i];
    	}
    }



    ld res = 0;

    FOR (i, n / 2 + 1, n) {
    	res += d[n][i];
    }

    cout << fixed << setprecision(11) << res << endl;
    
	
    return 0;
}

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

using namespace std;

int dp[1 << 11][1111];

int main() {
    int D, G;
    cin >> D >> G;
    G /= 100;
    vector<int> p(D), c(D);
    for (int i = 0; i < D; i++) {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }

    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < (1 << D); i++) {
        int sum_cnt = 0, sum_pnt = 0;
        for (int j = 0; j < D; j++) {
            if (i & (1 << j)) {
                sum_cnt += p[j];
                sum_pnt += p[j] * (1 + j) + c[j];
            }
        }
        dp[i][sum_cnt] = sum_pnt;
        for (int j = D - 1; j >= 0; j--) {
            if ((i & (1 << j)) == 0) {
                for (int k = 1; k < p[j]; k++) {
                    dp[i][sum_cnt + 1] = dp[i][sum_cnt] + (j + 1);
                    sum_cnt++;
                }
            }
        }
    }
    int ans = (int)1e9;
    for (int i = 0; i < (1 << D); i++) {
        for (int j = 0; j < 1111; j++) {
            if (dp[i][j] >= G) {
                ans = min(ans, j);
            }
        }
    }
    cout << ans << endl;
}


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

int main()
{
    vector<int> a(3), b(3), t(4);
    for (int i = 0; i < 4; i++)
        t[i] = 0;
    for (int i = 0; i < 3; i++)
    {
        cin >> a[i] >> b[i];
        t[a[i] - 1]++;
        t[b[i] - 1]++;
    }
    sort(t.begin(), t.end());
    if (t[0] == 1 && t[1] == 1 && t[2] == 2 && t[3] == 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

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

#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define init(x) memset(x,0,sizeof(x))
#define abs(x) (x<0?(-x):x)
#define lcm(x,y) ((1ll)*x*y)/__gcd(x,y)
#define maxv(v) *max_element(v.begin(),v.end())
#define minv(v) *min_element(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define tie() ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

const ll inf=1e18L +5;



void solve(){

     int n,w;
     cin>>n>>w;

     int tot_value=1000000+5;


     vector<ll> dp(tot_value+1,inf);
     dp[0]=0;

     for(int i=0;i<n;i++){
        int s,v;
        cin>>s>>v;
        //cout<<"new item with w and v as"<<s<<" "<<v<<endl;
        for(int j=tot_value; j>0;j--){

            if(v<=j){
                    //cout<<"checking = "<<dp[j]<<" "<<dp[j-v]<<endl;
                dp[j]=min(dp[j],dp[j-v]+s);

            }
            //cout<<"dp["<<j<<"]="<<dp[j]<<endl;
        }
     }

     int ans=0;
     for(int i=1;i<=tot_value;i++){
            //cout<<"dp["<<i<<"]="<<dp[i]<<endl;
        if(dp[i]<=w){
            ans=max(ans,i);
        }
     }

     cout<<ans;




}
int32_t main()
{
    //clock_t st = clock();
    tie();
    int t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
   // clog<<(long double)((clock() - st)/CLOCKS_PER_SEC)<<endl;
    return 0;
}


Measured memory_bytes: 11088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll h;
  cin >> h;

  ll ans = 0,count = 0;

  while(h != 0){
    h = h/2;
    count++;
    
  }

  ans = pow(2,count) -1;

  // cout << count << endl;

  cout << ans << endl;
  
}

Measured memory_bytes: 512
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

s=get_nsp.map(&:to_i)
N=s.size
ans=0
(N-1).times do|i|
    if s[i]==s[i+1]
        s[i+1]=(s[i+1]+1)%2
        ans+=1
    end
end
puts ans

Measured memory_bytes: 7676
#include <iostream>
using namespace std;
int main(void){
    int N,AC,WA,TLE,RE;
    string c;    
    cin >> N;
    AC=0;
    WA=0;
    TLE=0;
    RE=0;
 
    for(int i=0; i<N; i++){
        cin>>c;
        if(c == "AC")AC++;
        if(c == "WA")WA++;
        if(c == "TLE")TLE++;
        if(c == "RE")RE++;
    }
            cout<<"AC x "<<AC<<endl;
            cout<<"WA x "<<WA<<endl;
            cout<<"TLE x "<<TLE<<endl;
            cout<<"RE x "<<RE<<endl;
    return 0;
}

Measured memory_bytes: 3552
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"

string to_string_keta(const long long int l, const int keta) {
	ostringstream oss;

	oss << std::setw(keta) << std::setfill('0') << l;

	return oss.str();
}
int main() {
	cout << fixed << setprecision(22);
	while (1) {
		int h, m, s; cin >> h >> m >> s;
		if (h == -1)break;
		int n = h * 3600 + m * 60 + s;
		{
			int rest = 7200 - n;
			int nh = rest / 3600;
			rest -= nh * 3600;
			int nm = rest / 60;
			int ns = rest % 60;
			cout << to_string_keta(nh, 2) << ":" << to_string_keta(nm, 2) << ":" << to_string_keta(ns, 2) << endl;

		}
		{
			int rest = 7200 - n;
			rest *= 3;
			int nh = rest / 3600;
			rest -= nh * 3600;
			int nm = rest / 60;
			int ns = rest % 60;
			cout << to_string_keta(nh, 2) << ":" << to_string_keta(nm, 2) << ":" << to_string_keta(ns, 2) << endl;

		}
	}

	return 0;
}

Measured memory_bytes: 3100
N, C = [int(_) for _ in input().split()]
D = [[int(_) for _ in input().split()] for i in range(C)]
c = [[int(_) - 1 for _ in input().split()] for i in range(N)]

xs = [[], [], []]

for i, row in enumerate(c):
    for j, x in enumerate(row):
        xs[(i + j) % 3].append(x)

cs = [[sum(D[x][j] for x in xs[i]) for j in range(C)] for i in range(3)]

result = 1000000000000000000000000

for c1 in range(C):
    for c2 in range(C):
        if c2 == c1:
            continue
        for c3 in range(C):
            if c3 == c1 or c3 == c2:
                continue
            r = cs[0][c1] + cs[1][c2] + cs[2][c3]
            result = min(result, r)
    
print(result)



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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
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;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

int N, L[210];

int main(){
    cin >> N;
    REP(i,2*N)cin >> L[i];
    sort(L,L+2*N);
    int ans=0;
    for(int i=0;i<2*N-1;i+=2)
    {
        ans+=(L[i] > L[i+1] ? L[i+1]:L[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
// const ll mod = 1e9+7;

ll mod;
int fac[1000007];

int mul(int a,int b) {
	return a*(ll)b % mod;
}

int dv(int a ,int b) {
	return mul(a, pow(b,mod-2));
}

int power(int a, int b) {
	int rs=1;
	while(b) {
		if(b%2) 
			rs = mul(rs, a);
		a = mul(a,a);
		b/=2;
	}
	return rs;
}

int comb(int a,int b) {
	return dv(fac[a], mul(fac[a-b],fac[b]));
}

int add(int a,int b) {
	a+=b;
	if(a>=mod)
		a-=mod;
	if(a<0)
		a+=mod;
	return a;
}

void pre() {
	fac[0]=1;
	for(ll i=1;i<1e6+5;i++) {
		fac[i] = mul(fac[i-1],i);
	}
}

int32_t main() {
	ll n,i;
	cin>>n;
	string s;
	cin>>s;
	ll bit = 0,n1=0,n2=0;
	for(auto it:s) {
		if(it == '1')
			bit++;
	}
	// cout<<"q\n";
	ll k=0;
	mod = bit-1;
	for(i=0;i<n;i++) {
		if(s[i] == '1' && mod>0) {
			n1 = (power(2, n-i-1)+n1) % mod;
			// cout<<n1<<" ";
		}
	}
	// cout<<"p\n";
	// cout<<n1<<" "<<n2<<"\n";
	mod = bit+1;
	k=0;
	for(i=0;i<n;i++) {
		if(s[i] == '1') {
			n2 = (power(2, n-i-1)+n2) % mod;
		}
	}
	// cout<<n1<<" "<<n2<<"\n";
	for(i=0;i<n;i++) {
		ll temp =0;
		if(s[i] == '1') {
			if(bit-1 == 0) {
				cout<<"0\n";
				continue;
			}
			else {
				mod = bit-1;
				temp = (n1 + mod - power(2,n-i-1)) % mod;
			}
		}
		else {
			mod = bit+1;
			temp = (n2 + power(2,n-i-1)) % mod;
			// cout<<"ww\n";
		}
		// cout<<"w\n";
		int cnt=1,d;
		// cout<<temp<<" ";
		while(temp!=0) {
			d = __builtin_popcount(temp);
			temp%=d;
			cnt++;
		}
		cout<<cnt<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3828
using System;


namespace abc127_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] AB = Console.ReadLine().Split(' ');
            int B = Convert.ToInt32(AB[1]);
            if (Convert.ToInt32(AB[0]) >= 6 && Convert.ToInt32(AB[0]) <= 12)
            {
                B = B / 2;
            }
            else if(Convert.ToInt32(AB[0]) <= 5)
            {
                B = 0;
            }
            Console.WriteLine(B);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(ll i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)
using Graph = vector<vector<int>>;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin>>a>>b>>c;
  if(c<a or b<c) cout<<"No";
  else cout<<"Yes";
}  

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#define int long long
using namespace std;
signed main() {
	set<int>s;
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		int k, x; cin >> k >> x;
		if (k == 0) {
			s.insert(x);
			cout << s.size() << endl;
		}
		else if (k == 1) {
			if (s.lower_bound(x) != s.end()) {
				if (*s.lower_bound(x) == x)cout << "1\n";
				else cout << "0\n";
			}
			else cout << "0\n";
		}
		else if (k == 2) {
			if (s.lower_bound(x) != s.end()) {
				if (*s.lower_bound(x) == x)s.erase(s.lower_bound(x));
			}
		}
		else if (k == 3) {
			int y; cin >> y;
			for (auto i = s.lower_bound(x); i != s.upper_bound(y); i++)cout << *i << endl;
		}
	}
}


Measured memory_bytes: 12444
#include <stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX/2+2],R[MAX/2+2];


void merge(struct Card A[] , int n , int left , int mid , int right)
{
	int n1 = mid - left;
	int n2 = right -mid;
	for( int i = 0; i < n1; i++) L[i] = A[left+i];
	for( int i = 0; i < n2; i++) R[i] = A[mid+i];
	L[n1].value = R[n2].value = SENTINEL;
	int i = 0 , j = 0;
	for( int k = left; k < right; k++)
	{
		if(L[i].value <= R[j].value)
		{
			A[k] = L[i++];
		}
		else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[] , int n , int left , int right)
{
	if(left + 1 < right)
	{
		int mid = (left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}


int partition(struct Card A[] , int n , int p , int r)
{
	struct Card x = A[r];
	struct Card t;
	int i = p-1;
	int j;
	for( j = p; j < r; j++)
	{
		if(A[j].value <= x.value)
		{
			i++;
			t = A[i];
			A[i] = A[j];
			A[j] = t;
		}
	}
	t = A[i+1];
	A[i+1] = A[r];
	A[r] = t;
	return i+1;
}

void quickSort(struct Card A[], int n , int p , int r)
{
	int q;
	if(p < r){
		q = partition(A,n,p,r);
		quickSort(A,n,p,q-1);
		quickSort(A,n,q+1,r);
	}
}

int main(void)
{
	int n , i , v;
	struct Card A[MAX] , B[MAX];
	char S[10];
	int stable = 1;
	scanf("%d",&n);
	for( i = 0; i < n; i++)
	{
		scanf("%s %d",S,&v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	
	mergeSort(A,n,0,n);
	quickSort(B,n,0,n-1);
	
	for( i = 0; i < n; i++)
	{
		if(A[i].suit != B[i].suit) stable = 0;
	}
	
	if(stable == 1) printf("Stable\n");
	else printf("Not stable\n");
	for( i = 0; i < n; i++)
	{
		printf("%c %d\n",B[i].suit,B[i].value);
	}
	return 0;
}



Measured memory_bytes: 4028
N,M = map(int,input().split())
H = list(map(int,input().split()))
heighest = [1 for i in range(N)]

for i in range(M):
  A,B = map(int,input().split())
  A -= 1
  B -= 1
  H_A = H[A]
  H_B = H[B]
  if H_A > H_B:
    heighest[B] = 0
  elif H_A < H_B:
    heighest[A] = 0
  else:
    heighest[A] = 0
    heighest[B] = 0


ans = sum(heighest)
print(ans)

Measured memory_bytes: 20144