akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define pll pair <ll,ll>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

// FOR DEBUGGING
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", ";
	else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

const int mod = 1e9+7;
const long double PI = acos(-1);

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	int n,m,k;
	cin >> n >> m >> k;
	string s[n];
	rep0(i,n) cin >> s[i];

	int ans = 0;
	rep0(x,(1<<n)){
		rep0(y,(1<<m)){
			vector <int> r(n,0),c(m,0);
			int x1 = x, y1 = y;
			int val = 0;
			while(x1){
				if(x1%2) r[val] = 1;
				x1 /= 2;
				val++;
			}
			val = 0;
			while(y1){
				if(y1%2) c[val] = 1;
				y1 /= 2;
				val++;
			}

			int cnt = 0;
			rep0(i,n) rep0(j,m){
				if(r[i]==0 && c[j]==0 && s[i][j]=='#') cnt++;
			}
			if(cnt==k) ans++;
		}
	}
	cout << ans;

	return;
}
	
int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\;
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 3792
//ABC161 D

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

long long K;
long long run[200001];
long long cnt = 0;
long long ans = 0;

void chk_run(int keta,int sento,long long tmp){
  if(keta == 1){
    run[cnt] = tmp + sento;
    cnt++;
  }
  else{
    if(sento>0) chk_run(keta-1,sento-1,tmp+(sento * pow(10,keta-1)));
    chk_run(keta-1,sento,tmp+(sento * pow(10,keta-1)));
    if(sento<9) chk_run(keta-1,sento+1,tmp+(sento * pow(10,keta-1)));
    
  }
}

int main() {
  cin >> K;
  
  for(int i=1;i<50;i++){
    for(int j=1;j<=9;j++){
      chk_run(i,j,0);
      if(cnt > K) goto for_exit;
    }
  }
for_exit:
  
  printf("%lld\n",run[K-1]);
}


Measured memory_bytes: 1152
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
long a, b;
string ans = "";
int main()
{
	cin >> a; cin >> b;
	
	if (a >0 && b>0)ans = "Positive";
	if (a<=0 && b>=0)ans = "Zero";
	if (a < 0 && b < 0) {
		if ((b-a+1)%2==0)ans="Positive";
		else ans="Negative";
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&

//#define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
//#pragma GCC optimize "trapv" // abort() on (signed) integer overflow.

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&

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

/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
// find_by_order(), order_of_key() 

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#define int long long int 
#define ld long double
#define X first
#define Y second
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
const ld PI  = 3.141592653589793238463;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&

int n, m, x;
vector<int> cost;
vector<vector<int>> v;

void solve(){
	cin >> n >> m >> x;
	cost.resize(n);
	v.assign(n, vector<int>(m));
	for(int i = 0; i < n; ++i){
		cin >> cost[i];
		for(int j = 0; j < m; ++j){
			cin >> v[i][j];
		}
	}
	int LIM = (1<<n);
	int mncost = (int)1e18;
	for(int mask = 0; mask < LIM; ++mask){
		vector<int> fin(m, 0);
		int ct = 0;
		for(int i = 0; i < n; ++i){
			if( ((mask>>i)&1) ){
				ct += cost[i];
				for(int j = 0; j < m; ++j){
					fin[j] += v[i][j];
				}
			}
		}
		bool valid = true;
		for(auto &y: fin)
			valid &= (y >= x);
		if(valid){
			mncost = min(mncost, ct);
		}
	}
	if(mncost == (int)1e18){
		cout << -1 << '\n';
		return;
	}
	cout << mncost << '\n';


}

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    int T = 1; 
    //cin >> T;
    for(int i = 1; i <= T; ++i){
        solve();
    }
    return 0;
}
/*
Sample inp
*/

Measured memory_bytes: 3660
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
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"
vector<string> split(const string &str, char delim) {
	vector<string> res;
	size_t current = 0, found;
	while ((found = str.find_first_of(delim, current)) != string::npos) {
		res.push_back(string(str, current, found - current));
		current = found + 1;
	}
	res.push_back(string(str, current, str.size() - current));
	return res;
}

int main() {
	string st; 
	while (getline(cin,st)) {
		if (st == "0")break;
		vector<string>sts(split(st,' '));
		vector<int>nums(sts.size());
		for (int i = 0; i < sts.size(); ++i) {
			nums[i] = stoi(sts[i]);
		}
		bool ace = false;
		for (int i = 0; i < sts.size(); ++i) {
			if (nums[i] >= 10)nums[i] = 10;
		}
		int sum = 0;
		for (int i = 0; i < sts.size(); ++i) {
			if (nums[i] == 1) {
				ace = true;
			}

			sum += nums[i];
		}
		if (sum <= 11 && ace)sum += 10;
		if (sum >= 22)sum = 0;
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    S=input()
    a=0
    b=0

    for i in range(n):
        if(S[i]=='('):
            a+=1
        else:
            if(a>0): a-=1
            else: b+=1
    P='('*b

    a=0
    b=0
    for i in range(n-1,-1,-1):
        if(S[i]==')'):
            a+=1
        else:
            if(a>0): a-=1
            else: b+=1
    Q=')'*b
    print(P+S+Q)
resolve()

Measured memory_bytes: 38384
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair 
#define INF 1000000000
#define MOD 1000000007 

using namespace std;

const int maxn=1e5+5;

int Dp[maxn],deg[maxn];
vector<int>G[maxn];
int n;

void Dfs(int x,int p)
{
	int res=0,cnt=0;
	vector<int>v;
	
	for(int i=0;i<G[x].size();i++)if(G[x][i]!=p)
	{
		int y=G[x][i];
		Dfs(y,x);
		res+=Dp[y];
		if(!Dp[y])cnt++;
	}
	
	
	Dp[x]=res+max(cnt-1,0);

}


int main()
{
	scanf("%d",&n);
	for(int i=0;i<n-1;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x);
		deg[x]++;deg[y]++;
	}	
	
	int mx=0,root=0;
	
	for(int i=0;i<n;i++)if(deg[i]>mx)mx=deg[i],root=i;
	if(mx<=2)
	{
		printf("%d\n",1);
		return 0;
	}
	
	Dfs(root,-1);
	
	printf("%d\n",Dp[root]);


	return 0;	
} 

Measured memory_bytes: 12416
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<numeric>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
//int gcd ( int a, int b ) {
//    if ( a % b == 0 ) return b;
//    return gcd( b, a % b);
//}
//int lcm ( int a, int b ) {
//    return a * b / gcd(a, b);
//}
int main(){
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    ll gcd_num = __gcd(n, m);
//    int lcm_num = lcm(n, m);
    ll _n = n / gcd_num;
    ll _m = m / gcd_num;
    for ( int i = 0; i < gcd_num; ++i ) {
        if ( s[i*_n] != t[i*_m] ) {
            puts("-1");
            return 0;
        }
    }
    cout << _n * _m * gcd_num << endl;
    return 0;
}

Measured memory_bytes: 512
n,k = map(int,input().split())
r,s,p = map(int,input().split())
d={"r":p,"s":r,"p":s}
s=input()
memo=s[:k]
ans=0
for i,j in enumerate(s):
    if i<k:
        ans+=d[j]
    else:
        if memo[0]!=j:
            ans+=d[j]
            memo=memo[1:]+j
        else:
            memo=memo[1:]+"#"
print(ans)

Measured memory_bytes: 3316
/*
ID: little_10
LANG: C++
TASK: frac1
*/
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <queue>
#include <map>

using namespace std;

#define gc() getchar()
#define digit(x) ('0' <= x && x <= '9')

int read()
{
	int x=0, f=1;char c=gc();
	while(!digit(c)){if(c == '-') f=-1;c=gc();}
	while(digit(c))x=(x<<3)+(x<<1)+x-'0', c=gc();
	return x*f;
}

const int N = 160;

long long a;

int main()
{
	scanf("%lld", &a);
	long long p = sqrt(a);
	long long ans = 1e17;
	for(register long long i=1; i<=p; i++)
	{
		if(a%i) continue;
		ans = min(ans, i+a/i);
	}
	printf("%lld\n", ans-2);
	return 0;
}

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

int main(){
    int H, W;

    while(1){
        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 == 0 || i == H-1 || j == 0 || j == W-1){
                    cout << "#";
                }else {
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3092
fun main(arr:Array<String>) {
    val buttonCount = readLine()!!.toInt()
    val buttons = (1..buttonCount).map { readLine()!!.toInt()-1 }

    var current = 0
    for(i in (0..buttonCount)) {
        if(current == 1) {
            println(i)
            return
        }
        current = buttons[current]
    }
    println(-1)
}


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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << "" << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

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

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
// vll x(n); x[i]=a;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define INF 1e+12
#define EPS 1e-12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    string S;
    vc s, r, ans;
    ll q, t, f, x=1;
    char c;

    cin >> S;
    REP(i,S.length()) s.emplace_back(S[i]);
    cin >> q;
    REP(i,q){
        cin >> f;
        if(f==1){
            x*=-1;
            continue;
        }
        cin >> t >> c;
        t = t*2-3;
        if(x*t==1) s.emplace_back(c);
        else r.emplace_back(c);
    }

    if(x==1){
        RREP(i,r.size()) ans.emplace_back(r[i]);
        REP(i,s.size()) ans.emplace_back(s[i]);
    }
    else{
        RREP(i,s.size()) ans.emplace_back(s[i]);
        REP(i,r.size()) ans.emplace_back(r[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1532
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
ll a[400000];
int main() {
	cin >> n;
	for (int i = 0; i < 3*n; i++)cin >> a[i];
	sort(a, 3 * n);
	ll ans = 0;
	int cont = 0;
	for(int i=n*3-2;;i-=2){
		if (cont == n)break;
		cont++;
		ans += a[i];
}
	cout << ans << endl;
}

Measured memory_bytes: 2560
class node:
    def __init__(self,key=None):
        self.left=None
        self.right=None
        self.parent=None
        self.key=key

def insert(T,z):
    x=T
    y=None
    while isinstance(x,node):
        y=x
        if z.key<x.key:
            x=x.left
        else:
            x=x.right
    z.parent=y
    if y is None:
        T=z
    elif z.key<y.key:
        y.left=z
    else:
        y.right=z
    return T

def find(T,z):
    if T is None:
        return False
    else:
        y=None
        x=T
        while 1:
            y=x
            if x is None:
                return False
            elif z.key==x.key:
                return True
            elif z.key<x.key:
                x=x.left
            else:
                x=x.right
                
def delete(T,z,i):
    if i==0:
        x=T
        y=None
        while 1:    
            y=x
            if x is None:
                return 
            elif z.key==x.key:
                break
            elif z.key<x.key:
                x=x.left
            else:
                x=x.right
            z.parent=y
        z=x     
    if z.left is None and z.right is None:
        if z is z.parent.right:
            z.parent.right=None
        else:
            z.parent.left=None
    elif z.left is None:
        if z is z.parent.left:
            z.parent.left=z.right
            z.right.parent=z.parent
        else:
            z.parent.right=z.right
            z.right.parent=z.parent
    elif z.right is None:
        if z is z.parent.left:
            z.parent.left=z.left
            z.left.parent=z.parent
        else:
            z.parent.right=z.left
            z.left.parent=z.parent
    else:
        y=del_inorder(z.right)
        z.key=y.key
        delete(T,y,1)
           
def preorder(u):
    if u is None:
        return
    pripre.append(str(u.key))
    preorder(u.left)
    preorder(u.right)

def inorder(u):
    if u is None:
        return
    inorder(u.left)
    priin.append(str(u.key))
    inorder(u.right)
    
def del_inorder(u):
    if u is None:
        return
    del_inorder(u.left)
    Min.append(u)
    del_inorder(u.right)
    return Min[0]

m=input()
root=None
for i in xrange(m):
    cmd=map(str,raw_input().split())
    if cmd[0]=="print":
        pripre=[]
        priin=[]
        preorder(root)
        inorder(root)
        print(' '+' '.join(priin))
        print(' '+' '.join(pripre))
    elif cmd[0]=="find":
        key=int(cmd[1])
        z=node(key)
        if find(root,z):
            print('yes')
        else:
            print('no')
    elif cmd[0]=='delete':
        Min=[]
        key=int(cmd[1])
        z=node(key)
        delete(root,z,0)
    else:
        key=int(cmd[1])
        z=node(key)
        root=insert(root,z)

Measured memory_bytes: 209572
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int n, a[10000], b[10000];
ll num = 0;
string str = "Yes";

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

	if (num >= 0) {
		ll c = num;
		for (int i = 0; i < n; i++) {
			if (a[i]+2 <= b[i] && c >= (b[i] - a[i]) / 2) {
				c -= (b[i] - a[i]) / 2;
				a[i] += (b[i] - a[i]) / 2 * 2;
			}
			if (a[i] < b[i] && c > 0) {
				c--;
				a[i] += 2;
			}
		}
		c = num;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i] && c >= (a[i]-b[i])) {
				c -= (a[i] - b[i]);
				b[i] = a[i];
			}

			if (a[i] != b[i])str = "No";
		}
	}
	else {
		str = "No";
	}

	cout << str << endl;
	/*for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
	for (int i = 0; i < n; i++) {
		cout << b[i] << " ";
	}
	cout << endl;*/
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
long long A[200001];
 
int main(){
	ios::sync_with_stdio(0);
	int N;
	long long count=0,now=0,l,r=0;
	cin>>N;
	for(int i=0;i<N;++i)cin>>A[i];
	for(l=0;l<N;++l){
		while(r<N&&(now^A[r])==now+A[r]){
			now^=A[r++];
			++count;
		}
		count+=r-l-1;
		now^=A[l];
	}
	cout<<count<<"\n";
	return 0;
}

Measured memory_bytes: 1920
#include<iostream>
#include<string.h>
using namespace std;

int main(){
    int pre[33000];
    memset(pre,0,sizeof(pre));
    for(int i=2;i<33000;i++){
        for(int j=2;j*i<33000;j++){
            pre[i*j]=1;
        }
    }
    int n;
    while(cin>>n,n){
        int c=0;
        for(int i=2;i<=n/2;i++){
            if(pre[i]==0&&pre[n-i]==0){
                c++;
            }
        }
        cout<<c<<endl;
    }
}

Measured memory_bytes: 1296
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n+1);
    for (int i = 1; i < n+1; i++) {
        cin >> h[i];
    }

    vector<int> cost(n+1), checked(n+1);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i+j > n) continue;
            if (checked[i+j] == 0) {
                cost[i+j] = cost[i]+abs(h[i]-h[i+j]);
                checked[i+j] = 1;
            }
            else cost[i+j] = min(cost[i+j], cost[i]+abs(h[i]-h[i+j]));
        }
    }

    cout << cost[n] << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

using Graph = vector<vector<int>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main() {

    int S;
    cin >> S;
    ll sum = 0, t = 0;
    vector<int> num(4);
    num[0] = S / 1000;
    num[1] = (S - num[0] * 1000) / 100;
    num[2] = (S - num[0] * 1000- num[1] * 100) / 10;
    num[3] = (S - num[0] * 1000 - num[1] * 100 - num[2] * 10);

    char fomula[3];
    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < 8; ++bit) {
        int i = 0;
        sum = num[0];
        for (i = 0; i < 3; ++i) {
            if (bit & (1<<i)) { // 列挙に i が含まれるか
                sum += num[i+1];
                fomula[i] = '+';
            } else {
                sum -= num[i+1];
                fomula[i] = '-';
            }
        }
        if(sum == 7)break;
    }

    cout << num[0] << fomula[0] << num[1] << fomula[1] << num[2] << fomula[2] << num[3] << "=7" << endl;

    
    return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>

//ios::sync_with_stdio(false);

using namespace std;

const int INF = (1<<30) - 1;

int gcd(int a, int b){
    if(b == 0)
        return a;
    return gcd(b, a%b);
}

int lcm(int a, int b){
    long long int res = a;
    res *= b;
    return res/gcd(a, b);
}

int main(){
    int a, b;
    while(cin >> a >> b){
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
void rotation(string& t) {
	char c = t.back();
	string s = "";
	s += c;
	t.pop_back();
	t.insert(0, s);
}
int main() { // 問題文はしっかり読め!!!
	string s, t;
	cin >> s >> t;
	bool flag = false;
	rep(i, s.size() * 2) {
		if (s == t) flag = true;
		rotation(t);
	}
	puts(flag ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace Test01
{    
    class Program
    {       
        static void Main(string[] args)
        {
            int[] data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int N = data[0];
            int K = data[1];

            int[] h = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int cnt = 0;
            for(int i = 0; i < N; i++)
            {
                if (h[i] >= K) cnt++;
            }

            Console.WriteLine(cnt);
        }
    }
}


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

    int main() {
                int N,R=0;
        cin >> N;
        vector<int> L(N);
        for (int i=0; i<N; i++){
                cin >> L.at(i);
        }
        sort(L.begin(),L.end());
        for (int i=0; i<N-2; i++){
                for (int j=i+1; j<N-1; j++){
                  	auto Iter = lower_bound(L.begin()+j+1,L.end(),L.at(i)+L.at(j));
                        R += N-(j+1)-(L.end() - Iter );
                }
        }      
      
      	cout << R << endl;

    }


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	// "regexp"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var reader = bufio.NewReaderSize(os.Stdin, maxBufSize)
var writer = bufio.NewWriter(os.Stdout)

func main() {
	var r string
	r = readLine()
	fmt.Printf("%c", int(r[0])+1)
}

func join(ins []rune, c rune) (result []string) {
	for i := 0; i <= len(ins); i++ {
		result = append(result, string(ins[:i])+string(c)+string(ins[i:]))
	}
	return
}

func reverse(nums []int, start int) {
	i, j := start, len(nums)-1
	for i < j {
		nums[i], nums[j] = nums[j], nums[i]
		i++
		j--
	}
}

func nextPermutation(nums []int) {
	i := len(nums) - 2

	for i >= 0 && nums[i+1] <= nums[i] {
		i--
	}
	if i >= 0 {
		j := len(nums) - 1
		for j >= 0 && nums[j] <= nums[i] {
			j--
		}
		nums[i], nums[j] = nums[j], nums[i]
	}
	reverse(nums, i+1)
}

func prod(n int) int {
	switch {
	case n < 1:
		panic("illegal argument")
	case n == 1:
		return 1
	}
	return n * prod(n-1)
}

func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

func readLine() string {
	buf := make([]byte, 0, maxBufSize)
	for {
		l, p, e := reader.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func s2i(s string) int {
	var intVal, e = strconv.Atoi(s)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int) string {
	var strVal = strconv.Itoa(i)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func sum(i []int) int {
	sum := 0
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int {
	var ret = make([]int, 0, len(strs))
	for _, str := range strs {
		var intVal, e = strconv.Atoi(string(str))
		if e != nil {
			panic(e)
		}
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = strconv.Itoa(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i=0; i<(int)(n); i++)
#define REP2(i,x,n) for(int i=x; i<(int)(n); i++)
#define VSORT(v) sort(v.begin(), v.end());
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
int main(){
    int A, B, C, X;
    cin >>A>>B>>C;
    cin >> X;
    int counter = 0;
    
    REP(i,A+1){
        REP(j,B+1){
            REP(k,C+1){
                int s = 50*k+100*j+500*i;
                if (s == X){
                    counter++;
                }
            }
        }
    }

    cout << counter << endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 全探索


def check(pos):
    # 2つ目以降の条件について検討
    flg = True
    for x, y, h in xyh[1:]:
        if h != max(pos[2] - abs(x - pos[0]) - abs(y - pos[1]), 0):
            flg = False
            break
    return flg


def main(xyh):
    # Aは頂点候補のリスト
    A = []
    # 1つ目の条件から高さを求める
    # 1つ目の条件の高さが0だと、頂点の高さが分からないのでソート
    xyh.sort(key=lambda x: x[2], reverse=True)
    x, y, h = xyh[0]
    for i in range(101):
        for j in range(101):
            H = h + abs(x - i) + abs(y - j)
            A.append([i, j, H])
    # 全ての頂点候補について条件に合うかチェック
    for pos in A:
        if check(pos):
            break
    top = pos
    return top


n = int(readline())
xyh = [list(map(int, readline().split())) for _ in range(n)]

top = main(xyh)
print(*top)


Measured memory_bytes: 10168
N, M, K = map(int, input().split())
friend = {}
for i in range(M):
    A, B = map(lambda x: x-1, map(int, input().split()))
    if A not in friend:
        friend[A] = []
    if B not in friend:
        friend[B] = []
    friend[A].append(B)
    friend[B].append(A)

block = {}
for i in range(K):
    C, D = map(lambda x: x-1, map(int, input().split()))
    if C not in block:
        block[C] = []
    if D not in block:
        block[D] = []
    block[C].append(D)
    block[D].append(C)

first = {}
for i in range(N):
    if i not in first:
        first[i] = i
        if i in friend:
            queue = []
            queue.extend(friend[i])
            counter = 0
            while counter < len(queue):
                item = queue[counter]
                first[item] = i
                if item in friend:
                    for n in friend[item]:
                        if n not in first:
                            queue.append(n)
                counter += 1

size = {}
for key in first:
    if first[key] not in size:
        size[first[key]] = 1
    else:
        size[first[key]] += 1

for i in range(N):
    if i not in friend:
        print(0)
        continue
    no_friend = 0
    if i in block:
        for b in block[i]:
            if first[b] == first[i]:
                no_friend += 1
    print(size[first[i]] - len(friend[i]) - no_friend - 1)

Measured memory_bytes: 142836
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
struct Node{
  Int par,pp,cnt,ex;
  char c;
  vector<Int> nxt;
  Node(){}
  Node(Int par,char c):
    par(par),pp(par),cnt(0),ex(0),c(c),nxt(26,-1){}
};

Int a[26];
Node vs[500000];
string s[500000];
Int lst=0;

Int add(Int idx){
  Int v=0;
  for(Int i=0;i<(Int)s[idx].size();i++){
    if(vs[v].nxt[s[idx][i]-'a']<0){
      vs[v].nxt[s[idx][i]-'a']=++lst;
      vs[lst]=Node(v,s[idx][i]);
      assert(lst<500000);
    }
    v=vs[v].nxt[s[idx][i]-'a'];
  }
  vs[v].ex++;
  return v;
}

Int build(Int v,Int d){
  vs[v].cnt=vs[v].ex;
  vs[v].ex=d=vs[v].ex+d;
  for(Int i=0;i<26;i++)
    if(~vs[v].nxt[i])
      vs[v].cnt+=build(vs[v].nxt[i],d);
  return vs[v].cnt;
}

Int dfs(Int v){
  Int res=0,pp=vs[v].pp;
  //cout<<v<<":"<<pp<<endl;
  for(Int i=0;i<26;i++){
    if(vs[pp].nxt[i]<0||a[vs[v].c-'a']<=a[i]) continue;
    res+=vs[vs[pp].nxt[i]].cnt;
  }
  Int &p=vs[v].par;
  while(p&&vs[p].cnt==vs[vs[p].par].cnt) p=vs[p].par;
  if(p) res+=dfs(p);
  return res;
}

signed main(){
  Int n;
  cin>>n;
  for(Int i=0;i<n;i++) cin>>s[i];

  vs[0]=Node(-1,'$');
  vector<Int> pos(n);
  for(Int i=0;i<n;i++) pos[i]=add(i);

  //for(Int i=0;i<n;i++) cout<<i<<":"<<s[i]<<":"<<pos[i]<<endl;
  build(0,0);
  
  Int q;
  cin>>q;  
  for(Int i=0;i<q;i++){
    Int k;
    string t;
    cin>>k>>t;
    k--;
    for(Int j=0;j<26;j++) a[t[j]-'a']=j;
    cout<<dfs(pos[k])+vs[pos[k]].ex<<endl;
  }
  
  return 0;
}


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

struct Square {
	int x1, y1, x2, y2;
};
std::istream &operator>>(std::istream &is, Square &s) {
	return is >> s.x1 >> s.y1 >> s.x2 >> s.y2;
}
int main() {
	int n;
	std::cin >> n;
	constexpr int max_coord = 1000;
	std::vector<std::vector<int>> map(max_coord + 1, std::vector<int>(max_coord + 1, 0));
	Square s;
	for (auto i = 0; i < n; ++i) {
		std::cin >> s;
		map[s.x1][s.y1]++; map[s.x2][s.y1]--; map[s.x1][s.y2]--; map[s.x2][s.y2]++;
	}
	for (auto i = 1; i < map.size(); ++i) {
		for (auto j = 0; j < map[i].size(); ++j) {
			map[i][j] += map[i - 1][j];
		}
	}
	int max = 0;
	for (auto i = 0; i < map.size(); ++i) {
		if (max < map[i][0]) max = map[i][0];
		for (auto j = 1; j < map[i].size(); ++j) {
			map[i][j] += map[i][j - 1];
			if (max < map[i][j]) max = map[i][j];
		}
	}
	std::cout << max << std::endl;
}


Measured memory_bytes: 6828
#include<iostream>
using namespace std;
int main () {
  int N;
  cin >> N;
  int a = N % 10;
  int b = (N / 10) % 10;
  int c = N / 100;
  if (a == 7 || b == 7 || c == 7) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

#define NUM 2000

int N,test_case = 1;
int coin[50],dp[NUM],greedy[NUM];
int minimum;


int calc_greedy(int number){

	int ret = 0;
	int rest = number;

	for(int i = N-1; i >= 0; i--){
		if(coin[i] > rest)continue;

		ret += rest/coin[i];
		rest = rest%coin[i];

		if(rest == 0)break;
	}

	return ret;
}


void func(){

	for(int i = 0; i < N; i++)scanf("%d",&coin[i]);

	if(coin[0] != 1){
		printf("Case #%d: Cannot pay some amount\n",test_case);
		return;
	}

	for(int i = 1; i < NUM; i++)dp[i] = BIG_NUM;

	dp[0] = 0;
	for(int i = 0; i < N; i++){
		for(int k = 1; coin[i]*k < NUM; k++){
			for(int num = NUM-1; num-coin[i]*k >= 0; num--){
				if(dp[num-coin[i]*k] == BIG_NUM)continue;

				dp[num] = min(dp[num],dp[num-coin[i]*k]+k);
			}
		}
	}

	for(int number = 1; number < NUM; number++){
		greedy[number] = calc_greedy(number);
	}

	bool FLG = true;

	for(int i = 1; i < NUM; i++){
		if(dp[i] != greedy[i]){
			FLG = false;
			break;
		}
	}

	if(!FLG){
		printf("Case #%d: Cannot use greedy algorithm\n",test_case);
		return;
	}

	printf("Case #%d: OK\n",test_case);
}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
		test_case++;
	}
	return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,i;
  cin >> N >> i;
  cout << N - i + 1 << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define str string
#define vi vector<int>
#define vd vector<double>
#define vs vector<string>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define dump(x) cerr << #x << "=" << x <<endl
#define gcd __gcd
#define popcount __builtin_popcountll
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);

void solve() {
	int N, X, Y; cin >> N >> X >> Y;
    vi v(N - 1, 0);
	repi(i, 1, N) {
        repi(j, i + 1, N + 1) {
            int k = min(j - i, abs(i - X) + abs(j - Y) + 1);
            v[k - 1]++;
        }
    }
    rep(i, N - 1) {
        cout << v[i] << endl;
    }
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}

Measured memory_bytes: 256
# A - +-x

# 標準入力 A B

A, B = map(int, input().split())

if (A + B) <= (A - B):
    if (A - B) <= (A * B):
        answer = A * B
    else:
        answer = A -B
elif (A + B) <= (A * B):
    answer = A * B
else:
    answer = A + B

print(answer)


Measured memory_bytes: 9028
/*全域木*/
#include <stdio.h>
#include <stdlib.h>
#define N 101
#define INFTY 1000000000

int prim();

int M[N][N], n;


int prim(){
  int i, j, v, u, minv, sum;
  int d[N], p[N], c[N];
 
  for (i=0; i<n; i++){
    d[i] = INFTY;
    p[i] = -1;
    c[i] = 0;
  }

  d[0] = 0;

  while (1){
    minv = INFTY;
    u = -1;
    for (i=0; i<n; i++){
      if (minv > d[i] && c[i] != 2){
	u = i;
	minv = d[i];
      }
    }
    
    if (u == -1) break;
    c[u] = 2;
    for (v=0; v<n; v++){
      if (c[v] != 2 && M[u][v] != INFTY){
	if (d[v] > M[u][v]) {
	  d[v] = M[u][v];
	  p[v] = u;
	  c[v] = 1;
	}
      }
    }
  }
  sum = 0;
  for (i=0; i<n; i++){
    if (p[i] != -1) sum += M[i][p[i]];
  }
  

  return sum;
}

int main(){
  int i, j;
  
  scanf("%d", &n);
  
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d", &M[i][j]);
      if (M[i][j] == -1){
	M[i][j] = INFTY;
      }
    }
  }
  
  printf("%d\n", prim());

  return 0;
}



Measured memory_bytes: 2060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int res = n / 27;
		res = res * 25;

		int remain = n % 27;

		if (remain == 13 || remain == 26) {
			System.out.println(":(");
		} else if (remain < 13) {
			System.out.println(res + remain);
		} else {
			System.out.println(res = res + remain - 1);
		}
	}

}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>s;
const int mod=998244353;
int i,i0,n,m,L[200005],R[200005],L0[200005],R0[200005];
struct node
{
    int x,y;
}a[200005];
vector<int>vx,vy;
bool cmp(node a,node b)
{
    return a.x<b.x;
}
int sum[200005];
void add(int p, int x){while(p<=n)sum[p]+=x,p+=p&-p;}
int ask(int p)
{
    int res=0;
    while(p)res+=sum[p],p-=p&-p;
    return res;
}
int range_ask(int l, int r){return ask(r)-ask(l-1);}
long long qpow(long long a,long long b,long long mod){long long r=1,t=a; while(b){if(b&1)r=(r*t)%mod;b>>=1;t=(t*t)%mod;}return r;}
int main()
{
    scanf("%d",&n);
    for(i=1;i<=n;i++)scanf("%d %d",&a[i].x,&a[i].y),vx.push_back(a[i].x),vy.push_back(a[i].y);
    sort(vx.begin(),vx.end()),vx.erase(unique(vx.begin(),vx.end()),vx.end());
    sort(vy.begin(),vy.end()),vy.erase(unique(vy.begin(),vy.end()),vy.end());
    for(i=1;i<=n;i++)
    {
        a[i].x=lower_bound(vx.begin(),vx.end(),a[i].x)-vx.begin()+1;
        a[i].y=lower_bound(vy.begin(),vy.end(),a[i].y)-vy.begin()+1;
    }
    sort(a+1,a+1+n,cmp);
    long long ans=qpow(2,n-1,mod)*n%mod;
    for(i=1;i<=n;i++)
    {
        L[i]=range_ask(a[i].y,n);
        add(a[i].y,1);
    }
    memset(sum,0,sizeof(sum));
    for(i=n;i;i--)
    {
        R[i]=range_ask(1,a[i].y);
        add(a[i].y,1);
    }
    memset(sum,0,sizeof(sum));
    for(i=1;i<=n;i++)
    {
        L0[i]=range_ask(1,a[i].y);
        add(a[i].y,1);
    }
    memset(sum,0,sizeof(sum));
    for(i=n;i;i--)
    {
        R0[i]=range_ask(a[i].y,n);
        add(a[i].y,1);
        //ans+=(qpow(2,L[i],mod)-1)*(qpow(2,L[i],mod)-1);
        ans+=(qpow(2,L[i],mod)-1)*(qpow(2,R[i],mod)-1)%mod*qpow(2,L0[i]+R0[i],mod),ans%=mod;
        ans+=(qpow(2,L0[i],mod)-1)*(qpow(2,R0[i],mod)-1)%mod*qpow(2,L[i]+R[i],mod),ans%=mod;
        ans-=(qpow(2,L0[i],mod)-1)*(qpow(2,R0[i],mod)-1)%mod*(qpow(2,L[i],mod)-1)%mod*(qpow(2,R[i],mod)-1);
        ans%=mod;
    }
    ans%=mod,ans+=mod,ans%=mod;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 7532
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  char f, n;
  int fc = 0, nc = 0;
  rep(i, s.size()){
    if(i == 0){
      f = s.at(i);
      fc++;
    }else{
      if(s.at(i) == f) fc++;
      else{
        if(nc == 0){
          nc++;
          n = s.at(i);
        }else if(s.at(i) == n) nc++;
        else{
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  if(fc == nc && fc == 2){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
e=Hash.new [];n=gets.to_i;(n-1).times{|i|a,b=gets.split;e[a]+=[i];e[b]+=[i]};a=[0]*(n-1);(1..n).each{|w|u={};e[v=w.to_s].map{|j|u[a[j]]=1};t=1;e[v].map{|j|1>a[j]&&(t+=1until u[t].nil?;a[j]=t;t+=1)}};p a.max;a.map{|i|p i}

Measured memory_bytes: 191976
/*
  AOJ 0557
  Title:A First Grader
  @kankichi573
*/
#include <stdio.h>
int N,a[101];
long long count[100][21];
 
long long solve()
{
  int i,j,next;

  count[0][a[0]]=1;

  for(i=0;i<N-2;i++)
    {
      for(j=0;j<=20;j++)
	{
	  if((next=j-a[i+1])>=0)
	    count[i+1][next]+=count[i][j];
	  if((next=j+a[i+1])<=20)
	    count[i+1][next]+=count[i][j];
	}
    }
  return(count[N-2][a[N-1]]);
}

main()
{
  int i;
  long long ret;
  
  scanf("%d",&N);
	
  for(i=0;i<N;i++)
    scanf("%d",&a[i]);
  
  ret=solve();
  printf("%lld\n",ret);

  return(0);
}

Measured memory_bytes: 616
#include <iostream>

int n;
std::string s;
int num['z'-'a'+1];
int main(){
  std::cin>>n>>s;
  
  for(int i=0;i<n;++i)
    ++num[s[i]-'a'];
  
  long long ans=1;
  for(int i=0,end='z'-'a'+1;i<end;++i)
    if(num[i]>0)
      ans=(ans*(num[i]+1))%1000000007;
  
  std::cout<<ans-1<<std::endl;
  return 0;
}


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

int main() {
  int A, B;
  string S, T, U;
  
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  
  if (U == S)
  {
    A -= 1;
  }
  else if (U == T)
  {
    B -= 1;
  }

  cout << A << " " << B;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using static Prog;
using NX = System.Int64;

public class Solver
{
    public void Solve()
    {
        Console.WriteLine((Console.ReadLine().ToCharArray().Distinct().Count() == 2) ? "Yes" : "No");
    }
}

public class Prog
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Solver().Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 26620
#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;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = /*1'000'000'007;*/998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 100'000;
const int LOGN = 18;

int n, m, k;

void solve(int test)
{
  int64 s;
  cin >> s;
  int64 x2 = 1'000'000'000;
  int64 y3 = (s + x2 - 1) / x2;
  int64 x3 = 0, y2 = 0;
  for (;; ++y3) {
    int64 rest = x2 * y3 - s;
    if (!rest) {
      x3 = 1;
      y2 = 0;
      goto out;
    }
    for (int64 i = 1; i * i <= rest; ++i) {
      if (rest % i == 0) {
        x3 = rest / i;
        y2 = i;
        if(x2 != x3 || y2 != y3) {
          goto out;
        }
      }
    }
  }
out:
  cout << "0 0 " << x2 << ' ' << y2 << ' ' << x3 << ' ' << y3 << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


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


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define snd second
#define fst first
#define debug printf("--%d--\n",__LINE__)
#define ll long long int

int n;
int t[1024], a[1024];

int main(void){
	cin >> n;
	for(int i=0;i<n;i++) cin >> t[i] >> a[i];
	
	ll p = t[0], q = a[0];
	for(int i=1;i<n;i++){
		ll r = max((p-1)/t[i]+1, (q-1)/a[i]+1);
		p = max(p, r*t[i]);
		q = max(q, r*a[i]);
	}
	cout << p + q << endl;
	return 0;
}


Measured memory_bytes: 384