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

int main()
{
  int n;
  cin>>n;
  std::vector<string> vec(n);
  set<string> st;
  for (int i = 0; i < n; ++i)
  {
    string tmp;
    cin>>tmp;
    sort(tmp.begin(), tmp.end());
    vec[i]=tmp;
    st.insert(tmp);
  }
  sort(vec.begin(), vec.end());
  int64_t ans=0;
  for(auto &e: st) {
    auto u=upper_bound(vec.begin(), vec.end(),e);
    auto l=lower_bound(vec.begin(), vec.end(),e);
    if(u-l==1) continue;
    ans+=(u-l)*(u-l-1)/2;
  }
  cout<<ans;
}

Measured memory_bytes: 15104
#include <iostream>
#include <algorithm>
using namespace std;
int x,y,n,a[100010],i,flag;
main()
{
	cin>>n;
	/*if (n==1)
	{
		cout<<"First"<<endl;
		return 0;
	}*/
	for (i=1;i<=n;i++) cin>>a[i];
	/*flag=1;
	for (i=1;i<=n;i++)
	  if (a[i]!=1) 
	  {
	  	flag=0;
	  	break;
	  }
	if (flag==1)
	{
		cout<<"First"<<endl;
		return 0;
	}*/
	sort(a+1,a+1+n);
	i=1;
	while (a[i]+i<n+1) i++;
	x=i;y=n+1-i;
	//cout<<x<<" "<<y<<endl;
	flag=-1;
	if ((a[x]-y)%2==1) 
	{
		cout<<"First"<<endl;
		return 0;
	}
	//cout<<i<<endl;
	while (y==a[i-1])
	{
		i--;
		flag*=-1;
	}
	//cout<<i<<endl;
	if (flag==-1) cout<<"Second"<<endl;
	else cout<<"First"<<endl;
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> p(n);
  std::cin >> p;

  int64_t c = 0;
  for (int64_t i = 1; i < n - 1; i++) {
    if (p[i - 1] < p[i] && p[i] < p[i + 1]) {
      c++;
    } else if (p[i + 1] < p[i] && p[i] < p[i - 1]) {
      c++;
    }
  }
  std::cout << c << std::endl;
  return 0;
}


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

using namespace std;
int n, a[200001],k;
int main(){
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = k + 1; i <= n; i++){
        if(a[i] > a[i - k]){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }
}


Measured memory_bytes: 4392
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}

int N, M, K;
string S, T;
vector<int> V;
void input() {
  cin>>N;
  V.resize(N);
  rep(i,0,N-1){
    cin>>V[i];
  }
}
void solve() {
  vector<int> ss(N,0);
  rrep(i,N-1,0){
    if (i==N-1) ss[i]=0;
    else {
      if (V[i] >= V[i+1])  ss[i]=ss[i+1]+1;
      else {
        ss[i]=0;
      }
    }
  }

  int ans = -INF;
  for(auto x : ss){
    chmax(ans,x);
  }
  cout<<ans<<endl;


  // int ans = -INF;
  // int cnt=0;
  // int prev=-1;
  // rrep(i,N-1,0){
  //   if (V[i]>=prev){
  //     cnt++;
  //     ans=max(ans,cnt);
  //     prev=V[i];
  //   }
  //   else {
  //     prev = V[i];
  //     cnt=0;
  //   }
  // }
  // cout<<ans-1<<endl;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<cstring>
typedef long long LL;
using namespace std;

bool is_ok(LL N,LL A,LL B){
	if(N == 1 && A == B)
		return true;
	else if(N > 1 && A <= B)
		return true;
	return false;
}


int main(){
	LL N,A,B;
	cin >> N >> A >> B;
	
	if(is_ok(N,A,B)){
		if(N == 1 || A == B)
			cout << 1 << endl;
		else{
			LL diff = B-A;
			cout << diff*(N-2)+1 << endl;
		}
			
	}
	else
		cout << 0 << endl;
	return 0;
} 

Measured memory_bytes: 256
// <------------- Template -----------------------> //


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(0);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	2 * 1e18;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAX5];

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, y, q, m, k;
string s, t, d;
ll sum = 0;
ll cou = 0;


// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> x;
	vll a(n);
	for(ll i=0;i<n;i++) cin>>a[i];
		sort(all(a));
	reverse(all(a));
	ll sum = 0;
	for(ll i=0;i<x;i++) sum+=a[i];
	cout<<sum;
}

int main() {
	fastio; randomINT;
	//cin>>T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 5968
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
using ull = uint64_t;

int main(){
    int n; cin >> n;
    const ull lim = 1e18;
    ull a[n];
    bool has_zero = false;
    rep(i, n){
        ull aa; cin >> aa;
        if(!aa) has_zero = true;
        a[i] = aa;
    }

    if(has_zero) cout << 0 << endl;
    else {
        ull ans = 1;
        rep(i, n){
            ans *= a[i];
            if(ans > lim || ans <= 0){
                cout << -1 << endl;
                return 0;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 4416
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  vector<pair<ll,ll>> vec(n) ;
  REP(i,n){
    ll a, b ;
    cin >> a >> b ;
    vec[i] = MP(b,a) ;
  }
  sort(ALL(vec)) ;
  ll sum = 0 ;
  REP(i,n){
    sum += vec[i].SE ;
    if(sum>vec[i].FI){
      no() ;
      return 0 ;
    }
  }
  yes() ;
  
  
  
  
  return 0 ;
}




Measured memory_bytes: 3456
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


int main(){

	int row,col,div,count,a,b,c,d;
	char buf[200],table[10][11];

	while(true){
		scanf("%s",buf);
		if(buf[0] == '#')break;

		for(int i = 0; i < 10; i++){
			for(int k = 0; k < 11; k++)table[i][k] = '\0';
		}

		row = 0,col = 0;
		for(int i = 0; buf[i] != '\0';i++){
			if(buf[i] >= '0' && buf[i] <= '9'){
				div = buf[i] - '0';
				for(int k = 0; k < div; k++){
					table[row][col] = ' ';
					col++;
				}
			}else if(buf[i] == 'b'){
				table[row][col] = 'b';
				col++;
			}else{ //buf[i] == '/'
				row++;
				col = 0;
			}
		}

		scanf("%d %d %d %d",&a,&b,&c,&d);
		table[a-1][b-1] = ' ';
		table[c-1][d-1] = 'b';


		for(int h = 0; h <= row; h++){
			for(int w = 0; w < 11; w++){
				if(table[h][w] == ' '){
					count = 0;
					for(int p = w; table[h][p] == ' ';p++){
						count++;
						w++;
					}
					w--;
					printf("%c",'0' + count);
				}else if(table[h][w] == 'b'){
					printf("b");
				}else{ //table[h][w] == '\0'
					if(h != row){
						printf("/");
						break;
					}
				}
			}
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 2572
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int mod=998244353;
int pw2[233],dp[233];
map<string,int>rem;
int calc(const string&s)
{
	if(rem.find(s)!=rem.end())return rem[s];
	if(s=="")return 1;
	int cnt=0;for(int i=0;i<(int)s.size();i++)cnt+=(s[i]=='1');
//	if(cnt==0)return dp[(int)s.size()];
	int ret=calc(s.substr(1));if(s[0]=='1')ret=(ret+ret)%mod;int sz=(int)s.size();
	for(int l=1;l<=sz/2;l++)
	{
		string now=s.substr(0,l);
		for(int i=2;i*l<=sz;i++)
		{
			for(int j=l*(i-1);j<l*i;j++)if(s[j]=='0')now[j-(i-1)*l]='0';
			ret=(ret+1ll*calc(now)*calc(s.substr(i*l)))%mod;
		}
	}
	rem[s]=ret;
	return ret;
}
int main()
{
	pw2[0]=1;for(int i=1;i<233;i++)pw2[i]=pw2[i-1]*2%mod;
	dp[0]=1;
	for(int i=1;i<233;i++)
	{
		dp[i]=dp[i-1];
		for(int j=2;j<=i;j++)for(int k=j;k<=i;k+=j)
			dp[i]=(dp[i]+1ll*dp[k/j]*dp[i-k])%mod;
	}
	string s;cin>>s;
	cout<<calc(s);
	return 0;
}

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

const int MAX_X = 1000;
const int MOD = 1000000007;

bool isPrime[MAX_X+1];
int pcount[MAX_X+1];

int main() {
  long long N, ans = 1;
  cin >> N;
  for (int i=0; i<=N; i++) {
    isPrime[i] = true;
    pcount[i] = 0;
  }
  isPrime[0] = isPrime[1] = false;

  for (int i=2; i<=N; i++) {
    int tmp = i;
    if (isPrime[i]) {
      // cout << i << endl;
      pcount[i]++;
      for (int j=i*2; j<=N; j+=i) {
        isPrime[j] = false;
      }
    } else {
      for (int j=2; 1<tmp; j++) {
        if (isPrime[j]) {
          while (tmp && (tmp % j == 0)) {
            // cout << tmp << endl;
            tmp /= j;
            pcount[j]++;
          }
        }
      }
    }
  }
  for (int i=2; i<=N; i++) {
    if (!isPrime[i]) continue;
    ans *= (pcount[i] + 1);
    ans %= MOD;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import collections
n, m = map(int, input().split())
ls = [0] * m
for i in range(n):
    a = list(map(int, input().split()))
    for j, v in enumerate(a):
        if j != 0:
            ls[v-1] += 1
cnt = 0
for i in ls:
    cnt += 1 if i == n else 0
print(cnt)


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

#define pb push_back
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

using namespace std;
using ll = long long;

void solve() {
}

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

  int n, m1 = 0, m2 = 0;
  vector<int> a_s;
  cin >> n;
  rep(i, 0, n-1) {
    int a;
    cin >> a;
    a_s.pb(a);
    if (a >= m1) {
      m2 = m1;
      m1 = a;
    } else if (a >= m2) {
      m2 = a;
    }
  }
  rep(i, 0, n - 1) {
    if (a_s[i] == m1) {
      cout << m2 << "\n";
    } else {
      cout << m1 << "\n";
    }
  }

  return 0;
}


Measured memory_bytes: 2548
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int a[4] = { 0 };
	while (true) {
		int l[3] = { 0 };
		cin >> l[0] >> l[1] >> l[2];
		sort(l, l + 3);
		int le = l[0] * l[0] + l[1] * l[1];
		int ri = l[2] * l[2];
		if (l[0] + l[1] <= l[2]) break;
		if (le == ri) a[1]++;
		if (le > ri) a[2]++;
		if (le < ri) a[3]++;
	}
	cout << a[1] + a[2] + a[3] << " " << a[1] << " " << a[2] << " " << a[3] << endl;
	return 0;
}


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


void Down_heap(int *tree, int pos, int n)
{
	int x = tree[pos];
	int left_pos = pos * 2;


	while(left_pos <= n){
		if(left_pos + 1 <= n && tree[left_pos] < tree[left_pos + 1])
			left_pos++;

		if(x < tree[left_pos]){
			tree[pos] = tree[left_pos];
			pos = left_pos;
			left_pos *= 2;
		}else
			break;
	}
		tree[pos] = x;
}


int main()
{
	int n;
	int *tree;
	int key;
	int i;

	scanf("%d", &n);

	tree = (int *)malloc(sizeof(int) * (n + 1));

	// parent, left, rightの情報を付加
	for(i = 1; i <= n; i++)
		scanf("%d", &tree[i]);

	// 小さい値を沈める
	for(i = n / 2; i > 0; i--)
		Down_heap(tree, i, n);

	for(i = 1; i <= n; i++)
		printf(" %d", tree[i]);
	printf("\n");

	return 0;
}


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

template<typename T>
T gcd(T a, T b) {
    T tmp;
    if (a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }

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

template<typename T>
std::vector<std::pair<T, int>> factorize(T n) {
    std::vector<std::pair<T, int>> result;
    for (T i = 2; i * i <= n; i++) {
        if (n % i) {
            continue;
        }
        result.push_back(std::pair<T, int>(i, 0));

        while (n % i == 0) {
            n /= i;
            result.back().second++;
        }
    }
    if (n != 1) {
        result.push_back(std::pair<T, int>(n, 1));
    }

    return result;
}

void Main() {
    long int a, b;
    std::cin >> a >> b;

    long int n = gcd(a, b);
    std::vector<std::pair<long int, int>> f = factorize(n);

    std::cout << f.size() + 1 << std::endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
//to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

bool inte(double n) {//整数かどうかの判定
	if (ceil(n) == floor(n)) {//切り上げ関数,切り下げ関数
		return true;
	}
	else return false;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */

int a = 0, n = 0, x = 0, y = 0, ans = 0, cnt = 0, sum = 0;
string s="";

int main(void) {

	int n, h, w;
	cin >> n >> h >> w;
	int cnt = 0, a, b;
	rep(i, n) {
		cin >> a >> b;
		if (h <= a && w <= b) {
			cnt++;
		}
	}
	cout << cnt << rt;

	please AC;
}
//参考：---;

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int mod=998244353;
int par[100010];
int depth[100010];
void init(int n){
  for(int i=0;i<=n;i++){
      par[i]=i;
      depth[i]=0;
  }
}
int root(int x){
  return par[x]==x?x:par[x]=root(par[x]);
}
bool same(int x,int y){
  return root(x)==root(y);
}
void unite(int x,int y){
  x=root(x);
  y=root(y);
  if(x==y)return;
  if(depth[x]<depth[y]){
      par[x]=y;
  }else{
      par[y]=x;
      if(depth[x]==depth[y])depth[x]++;
  }
}
int main(){
    char x,y;cin>>x>>y;
    if(x>y)cout<<'>'<<endl;
    else if(x<y)cout<<'<'<<endl;
    else cout<<'='<<endl;
}

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

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

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

const ll maxn=2e5+10, maxm=5e4+10, lg=21, mod=998244353, inf=1e18;

ll n,m,d[2][maxn];
vector<ll> g[maxn];
bool rem[maxn],F=1;
string S;
set<pll> s[2];

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n>>m>>S;
	while(m--){
		ll v,u; cin>>v>>u; v--,u--;
		d[S[v]-'A'][u]++, d[S[u]-'A'][v]++;
		g[v].pb(u), g[u].pb(v);
	}
	for(int i=0;i<n;i++) s[0].insert({d[0][i],i}), s[1].insert({d[1][i],i});
	while(F){
		F=0;
		for(int b:{0,1})if(!s[b].empty()){
			auto it=s[b].begin();
			if((it->F)==0){ F=1;
				ll v=it->S; bool c=S[v]-'A';
				rem[v]=1;
				s[0].erase({d[0][v],v});
				s[1].erase({d[1][v],v});
				for(auto u:g[v])if(!rem[u]){
					s[c].erase({d[c][u],u});
					s[c].insert({--d[c][u],u});
				}
			}
		}
	}
	if(!s[0].empty()) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}



 


Measured memory_bytes: 41788
#include<bits/stdc++.h>
using namespace std;
int main(){
  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];
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

        return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
    long long a,b,k,answer;
    cin>>a>>b>>k;
    if(a<=k){
        if(b<=k-a) b=0;
        else b=b-(k-a);
		a=0;
	}
    else a=a-k;
	cout<<a<<" "<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#include<climits>

int main() {
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int ans = INT_MAX;
    for(int i = 0; i < n - t.size() + 1; i++){
        int maybe = 0;
        for(int j = 0; j < t.length(); j++){
            if(s[i + j] != t[j]){
                maybe++;
            }
        }
        ans = min(ans, maybe);
    }
    cout << ans << endl;
	return 0;
}


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

typedef long long ll;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

int main(){
    int A,B;
    string A_B,B_A;
    cin >> A >> B;

    rep(i,0,B) A_B += to_string(A);
    rep(i,0,A) B_A += to_string(B);
    if(A_B >= B_A){
        cout << B_A << endl;
    }else{
        cout << A_B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
//const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);
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 (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

int calc(const vector<bool>& exist){
    int ans = 340;
    for (int i = 0; i < 24; ++i) {
        for (int j = i+1; j < 24; ++j) {
            if(exist[i]&&exist[j]){
                //cout<<i<<" "<<j<<endl;
                ans=min(ans,min(j-i,i+24-j));
            }
        }
    }
    return ans;
}

void solve(int ca){
    int N; cin>>N;
    int cnt[13]={0};
    cnt[0]++;
    for (int i = 0; i < N; ++i) {
        int d; cin>>d;
        cnt[d]++;
    }

    vector<bool> exist(24,false);
    
    exist[0]=true;

    if(cnt[0]>=2||cnt[12]>=2){
        cout<<0<<endl;
        return;
    }

    vector<int> select;

    for(int i=1;i<=12;++i){
        if(cnt[i]>2){
            cout<<0<<endl;
            return;
        }
        if(cnt[i]==2){
            exist[i]= true;
            exist[24-i]= true;
        }
        if(cnt[i]==1) select.push_back(i);
    }

    int ans=0;
    if(select.empty()){
        cout<<calc(exist)<<endl;
        return;
    }
    for (int bit = 0; bit < (1<<select.size()); ++bit) {
        vector<bool> ex_cp=exist;
        for (int i = 0; i < select.size(); ++i) {
            if((bit>>i)&1){
                ex_cp[select[i]]= true;
            }else{
                ex_cp[24-select[i]]=true;
            }
        }
        /*
        for(auto i:ex_cp){
            cout<<i<<" ";
        }
        cout<<endl;
        cout<<calc(ex_cp)<<endl;
         */
        ans=max(ans,calc(ex_cp));
    }
    cout<<ans<<endl;

}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


Measured memory_bytes: 256
//
// Created by ?????°?????? on 2016/04/15.
//

#include<iostream>
#include <algorithm>

using namespace std;
const int MAX = 2000000;

int H,A[MAX+1];

void maxHeapify(int i){
    int l,r,largest;
    l = 2 * i;
    r = 2 * i +1;

    if (l <= H && A[l] > A[i]){
        largest = l;
    } else {
        largest = i;
    }
    if (r <= H && A[r] > A[largest]){
        largest = r;
    }

    if(largest != i){
        swap(A[i],A[largest]);
        maxHeapify(largest);
    }
}

int main(){
    cin >> H;
    for (int i = 1; i <= H ; ++i) {
        cin >> A[i];
    }

    for (int i = H/2 ; i >= 1 ; i--) {
        maxHeapify(i);
    }
    for (int i = 1; i <= H ; ++i) {
        cout << " " << A[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3116
import java.util.*;
class Main {
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        int[] ar = new int[n];
        for(int i=0;i<n;i++)
        {
            arr[i] = sc.nextInt();
            ar[i] = sc.nextInt();
        }
        int c=0;
        int m=1;
        for(int i=0;i<n;i++)
        {
            if(arr[i]==ar[i])
            {
                c++;
                if(i==n-1)
                {
                    if(c>=3)
                        System.out.println("Yes");
                }
            }
            else
            {
                if(c>=3)
                {
                    System.out.println("Yes");
                    break;
                }
                else
                    c=0;
            }
        }
        if(c<3)
            System.out.println("No");
        
    }
}


Measured memory_bytes: 36016
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1]*n 
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def roots(self):
        return [i for i, x in enumerate(self.par) if x<0]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)      
        if x==y:
            return        
        if self.par[x] > self.par[y]:
            x, y = y, x       
        self.par[x] += self.par[y]
        self.par[y] = x
    def group_count(self):
        return len(self.roots())

N, M = map(int, input().split())
UF = UnionFind(N)
for _ in range(M):
  a, b = map(int, input().split())
  UF.union(a-1, b-1)
print(UF.group_count()-1)

Measured memory_bytes: 12804
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut ans = 0;
    let mut hash = HashMap::new();
    for _ in 0..n {
        let s: String = read();
        let mut s: Vec<char> = s.chars().collect();
        s.sort();
        *hash.entry(s).or_insert(0) += 1;
    }
    for (_, i) in hash {
        ans += (1..i).sum::<usize>();
    }
    println!("{}", ans);
}


Measured memory_bytes: 13944
H, W = map(int, input().split())
A = [input() for _ in range(H)]
x = 0
for h in range(H):
    if '#' in A[h][:x]:
        print('Impossible')
        exit()
    if A[h][x] != '#':
        print('Impossible')
        exit()
    while x+1 < W and A[h][x+1] == '#':
        x += 1

    if '#' in A[h][x+1:]:
        print('Impossible')
        exit()

print('Possible')


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

#define rep(i,c) for(int i = 0; i < (int)c; ++i)
using llint = long long int ;
using namespace std;

int main(){
    int  A[4][4];
    int N;
    int b;

    rep(i,3){
        for (int j = 0; j < 3; j++)
        {
            cin>>A[i][j];
        }
        
    }
    cin>>N;
    for (int w = 0; w < N; w++)
    {
        cin>>b;
        rep(i,3){
            for (int j = 0; j < 3; j++)
            {
                int I=1;
                if (b==A[i][j])
                {
                A[i][j]=0;
                }
            
            }
        }
    }
    bool check=false;
    rep(i,3){
        if (A[i][0]==A[i][2]&&A[i][1]==A[i][0]) check=true;
        
    }

    rep(i,3){
        if (A[0][i]==A[1][i]&&A[2][i]==A[0][i]) check=true;
    }

    if (A[0][0]==A[1][1]&&A[2][2]==A[1][1])
    {
        check=true;
    }
    if (A[0][2]==A[1][1]&&A[2][0]==A[1][1])
    {
        check=true;
    }
    
    check?cout<<"Yes"<<endl:cout<<"No"<<endl;
    

    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()
max1 = 0
cnt1 = 0
for c in s:
    cnt1 += 1 if c == ')' else - 1
    max1 = max(max1, cnt1)
s = '(' * max1 + s

max2 = 0
cnt2 = 0
for c in reversed(s):
    cnt2 += 1 if c == '(' else - 1
    max2 = max(max2, cnt2)
s = s + ')' * max2

print(s)


Measured memory_bytes: 3060
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>N) {
		vector<PII> A(N);
		REP(i, N) {cin>>A[i].FI;A[i].SE=i+1;}
		sort(ALL(A));
		REP(i, N) cout<<A[i].SE<<" ";
		cout<<endl;
	}
	
	return 0;
}


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

char str[603][603]; int N , len[603][603][2];

int qry(int x1 , int y1 , int tp){
	if(len[x1][y1][tp] != -1) return len[x1][y1][tp];
	int &l = len[x1][y1][tp] = !tp;
	int p = x1 , q = y1 , r = x1 - tp , s = y1 + tp;
	while(str[p + l][q - l] && str[r - l][s + l] && str[p + l][q - l] == str[r - l][s + l])
		++l;
	return l;
}

int main(){
	scanf("%d" , &N); memset(len , -1 , sizeof(len));
	for(int i = 1 ; i <= N ; ++i) scanf("%s" , str[i] + 1);
	for(int i = 1 ; i <= N ; ++i)
		for(int j = 1 ; j <= N ; ++j)
			str[i + N][j] = str[i][j + N] = str[i + N][j + N] = str[i][j];
	int ans = 0;
	for(int i = 1 ; i <= N ; ++i)
		for(int j = 1 ; j <= N ; ++j){
			bool flg = 1;
			for(int k = 0 ; k < N ; ++k) flg &= qry(i + k , j + k , 0) >= min(k + 1 , N - k);
			for(int k = 1 ; k < N ; ++k) flg &= qry(i + k , j + k - 1 , 1) >= min(k , N - k);
			ans += flg;
		}
	cout << ans; return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    for(int i=n-1;i>=0;i--) {
       if (i!=0) 
        cout << v[i] << " ";
       else
         cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3100
#include <stdio.h>

int main() {
    int r, c, sum;
    scanf("%d %d", &r, &c);
    int v[r][c], xsum[r], ysum[c];
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            v[i][j] = 0;
        }
    }
    for (int i = 0; i < r; i++) {
        xsum[i] = 0;
    }
    for (int i = 0; i < c; i++) {
        ysum[i] = 0;
    }
//------------------------------------------
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            scanf("%d", &v[i][j]);
        }
    }
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            xsum[i] = xsum[i] + v[i][j];
        }
    }
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < r; j++) {
            ysum[i] = ysum[i] + v[j][i];
        }
    }
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            printf("%d ", v[i][j]);
        }
        printf("%d\n", xsum[i]);
    }
    for (int i = 0; i < c; i++) {
        printf("%d ", ysum[i]);
    }
    for (int i = 0; i < r; i++) {
        sum = sum + xsum[i];
    }
    printf("%d\n", sum);
}



Measured memory_bytes: 2040
import std.algorithm;
import std.bigint;
import std.bitmanip;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long N) {
    auto fac = factorize(N);
    long[] a;
    foreach (k; fac.keys) {
        foreach (i; 0 .. fac[k])
            a ~= k;
    }

    long dig(long i, long x, long y) {
        if (i == a.length)
            return x + y - 2;
        
        return min(
            dig(i + 1, x * a[i], y),
            dig(i + 1, x, y * a[i])
        );
    }

    if (fac.keys.count == 1)
        return fac.keys.front ^^ (fac.values.front / 2)
            + fac.keys.front ^^ ((fac.values.front + 1) / 2) - 2;

    return dig(0, 1, 1);
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(N);
    else
        solve(N).writeln;
}


pure long[long] factorize(long n) {
    long[long] counter;
    const sqN = n.to!float.sqrt.ceil.to!long;

    while ((n & 1) == 0) {
        counter[2]++;
        n /= 2;
    }
    for (long i = 3; i < sqN + 1; i += 2) {
        while (n % i == 0) {
            counter[i]++;
            n /= i;
        }
        if (n == 1)
            break;
    }
    if (n != 1)
        counter[n] = 1;

    return counter;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e6;
ll n;

int main() {
	cin >> n;
	if(n % 2 == 0 || n % 5 == 0) {
		puts("-1");
		return 0;
	}
	
	ll num = 7 % n, ans = 1;
	while(num != 0) {
		ans++;
		num = num*10 + 7;
		num %= n;
	}
	cout << ans << endl;
	
	return 0;
} 

Measured memory_bytes: 3176
#include<bits/stdc++.h>
 
using namespace std;
 
using   ll=long long;
using   ld=long double;
 
#define fast           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl           "\n"
#define int            long long 
#define pb             push_back
#define mp             make_pair
#define vll            vector<ll>
#define ff              first
#define ss              second
#define pll            pair<ll,ll>
#define ALL(v)         v.begin(),v.end()
#define ALLR(v)        v.rbegin(),v.rend()
#define pii            3.14159265358979323
 
void solve()
{
    ll n,x=0,y=0,cur=0;
    
    cin>>n;
    
    vector<ll> a(n);
    
    for(int i=0;i<n;i++)    a[i]=i+1;
    
    vector<ll> p(n),q(n);
    
    for(int i=0;i<n;i++)    cin>>p[i];
    for(int i=0;i<n;i++)    cin>>q[i];
    
    do{
        if(a==p)    x=cur;
        if(a==q)    y=cur;
        
        cur++;
    }while(next_permutation(ALL(a)));
    
    cout<<abs(x-y);
}

 
signed main()
{
 
    fast;
 
    ll t;
    
    t=1;
    
    //cin>>t;
    
    while(t--)
    {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	boolean[] used = new boolean[4];
	int[] node = new int[4];
	int un = 0;

	int ope(int a, int b, int oper) {
		if (oper == 0) {
			return a + b;
		} else if (oper == 1) {
			return a - b;
		} else {
			return a * b;
		}
	}

	String opep(String a, String b, int oper) {
		if (oper == 0) {
			return "( "+a + " + " + b+" )";
		} else if (oper == 1) {
			return "( "+a + " - " + b+" )";
		} else {
			return "( "+a + " * " + b+" )";
		}
	}

	String dec(int order1, int order2, int order3, int order4, int ope1,
			int ope2, int ope3, int structure) {
		if (structure == 0) {
			return opep(
					opep(opep(node[order1] + "", node[order2] + "", ope1), node[order3] + "",
							ope2), node[order4] + "", ope3);
		} else {
			return opep(opep(node[order1] + "", node[order2] + "", ope1),
					opep(node[order3] + "", node[order4] + "", ope3), ope2);
		}
	}

	int decode(int order1, int order2, int order3, int order4, int ope1,
			int ope2, int ope3, int structure) {
		if (structure == 0) {
			return ope(ope(ope(node[order1], node[order2], ope1), node[order3], ope2), node[order4],
					ope3);
		} else {
			return ope(ope(node[order1], node[order2], ope1), ope(node[order3], node[order4], ope3),
					ope2);
		}
	}

	boolean check(int order1, int order2, int order3, int order4, int ope1,
			int ope2, int ope3, int structure) {
		boolean[] b = new boolean[4];
		b[order1] = true;
		b[order2] = true;
		b[order3] = true;
		b[order4] = true;
		boolean check = true;
		for (int i = 0; i < 4; i++) {
			check &= b[i];
		}
		if (!check) {
			return false;
		} else {
			return 10 == decode(order1, order2, order3, order4, ope1, ope2,
					ope3, structure);
		}
	}

	void run() {
		for (;;) {
			int zero = 0;
			used = new boolean[4];
			node = new int[4];
			un = 0;
			for (int i = 0; i < 4; i++) {
				node[i] = sc.nextInt();
				zero |= node[i];
			}
			if (zero == 0) {
				break;
			}
			boolean z = true;
			for (int i = 0; i < 4 && z; i++)
				for (int j = 0; j < 4 && z; j++)
					for (int k = 0; k < 4 && z; k++)
						for (int l = 0; l < 4 && z; l++)
							for (int m = 0; m < 3 && z; m++)
								for (int n = 0; n < 3 && z; n++)
									for (int o = 0; o < 3 && z; o++)
										for (int p = 0; p < 2 && z; p++)
											if (check(i, j, k, l, m, n, o, p)){
												System.out.println(dec(i, j, k,
														l, m, n, o, p));
												z=false;
											}
			if(z) System.out.println("0");
		}
	}

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

	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <set>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

ll n, m, v, p, a[100010];

int main() {
  cin >> n >> m >> v >> p;
  REP(i, n) cin >> a[i];
  sort(a, a + n, greater<ll>());

  ll ans = p - 1, sum = 0;
  v -= p - 1;
  for(ll i = p - 1; i < n; ++i) {
    int tv = v - (n - i);
    if (tv <= 0) {
      if(a[i] + m >= a[p - 1]) ++ans;
    } else {
      // 累積和をとる。それとインデックスを合わせて、そこまでの
      ll need = tv * m;
      if ((i - p + 1) * (a[i] + m) - sum >= need && a[i] + m >= a[p - 1]) ++ans;
    }
    sum += a[i];
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N, A[21] = {}, B, C[20] = {}, ans = 0;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++)cin >> A[i];
	rep(i, N) {
		cin >> B;
		ans += B;
	}
	for (int i = 1; i < N; i++)cin >> C[i];
	for (int i = 1; i < N; i++) {
		if (A[i + 1] == A[i] + 1)ans += C[A[i]];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

#define forsn(i,s,n) for (int i = (s);i < (int)(n);i++)
#define forn(i,n) forsn(i,0,n)
#define dforsn(i,s,n) for (int i = (n-1);i >= (int)(s);i--)
#define dforn(i,n) dforsn(i,0,n)
#define all(v) (v).begin(), (v).end()
#define F first
#define S second

typedef long long int tint;

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

	tint x, y;
	cin >> x >> y;
	if (!(x % y)) { cout << -1 << endl; }
	else { cout << x << endl; }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int n;
  cin >> n;
  ll t = 1;
  ll a = 1;
  rep(i, n) {
    int ti, ai;
    cin >> ti >> ai;
    // 1. (t + a) は (ti + ai) の倍数
    // 2. t / ti = a / ai

    if (t % ti != 0) {
      t = ti * ((t / ti) + 1);
    }

    if (a % ai != 0) {
      a = ai * ((a / ai) + 1);
    }

    if (t / ti > a / ai) {
      a = ai * (t / ti);
    } else if (t / ti < a / ai) {
      t = ti * (a / ai);
    }

    // cerr << ti << ":" << ai << " = " << t << ":" << a << endl;
  }

  cout << t + a << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=3e5+10;
struct node {
	int x,y;
}a[N];
int n,W,H;
int ql,qr,qt;
namespace tr {
	const int M=N*4;
	int tg[M],mx[M];
	inline void add(int c,int t) { mx[c]+=t,tg[c]+=t; }
	inline void push_down(int c) { if(tg[c]) add(c<<1,tg[c]),add(c<<1|1,tg[c]),tg[c]=0; }
	inline void push_up(int c) { mx[c]=max(mx[c<<1],mx[c<<1|1]); }
	void build(int l,int r,int c) {
		tg[c]=0;
		if(l==r) return (void)(mx[c]=2*a[l+1].x+2*H);
		int mid=l+r>>1;
		build(l,mid,c<<1),build(mid+1,r,c<<1|1);
		push_up(c);
	}
	void add(int l,int r,int c) {
		if(ql<=l&&qr>=r) return add(c,qt);
		int mid=l+r>>1; push_down(c);
		if(ql<=mid) add(l,mid,c<<1);
		if(qr>mid) add(mid+1,r,c<<1|1);
		push_up(c);
	}
	int query(int l,int r,int c) {
		if(ql<=l&&qr>=r) return mx[c];
		int mid=l+r>>1,ans=-1e9; push_down(c);
		if(ql<=mid) ans=max(ans,query(l,mid,c<<1));
		if(qr>mid) ans=max(ans,query(mid+1,r,c<<1|1));
		return ans;
	}
	void debug(int l,int r,int c) {
		if(l==r) return (void)(printf("%d ",mx[c]));
		int mid=l+r>>1; push_down(c);
		debug(l,mid,c<<1),debug(mid+1,r,c<<1|1);
	} 
}
int ans;
bool cmp(node A,node B){ return A.x<B.x; }
int stk1[N],top1;
int stk2[N],top2;
int lim;
void push(int p) {
//	cerr<<"push:"<<p<<' '<<a[p].y<<endl;
	if(a[p].y<=lim) {
		ql=p,qr=stk1[top1]-1,qt=-2*a[p].y;
		tr::add(1,n,1);
		while(top1&&a[stk1[top1]].y<=a[p].y) {
			ql=stk1[top1],qr=stk1[top1-1]-1,qt=2*(a[stk1[top1]].y-a[p].y);
//			cerr<<"upd:"<<p<<' '<<ql<<' '<<qr<<' '<<qt<<endl;
			tr::add(1,n,1);
			top1--;
		}
		stk1[++top1]=p;
	}
	else {
		ql=p,qr=stk2[top2]-1,qt=2*a[p].y-2*H;
		tr::add(1,n,1);
		while(top2&&a[stk2[top2]].y>=a[p].y) {
			ql=stk2[top2],qr=stk2[top2-1]-1,qt=2*(a[p].y-a[stk2[top2]].y);
//			cerr<<"upd:"<<p<<' '<<ql<<' '<<qr<<' '<<qt<<endl;
			tr::add(1,n,1);
			top2--;
		}
		stk2[++top2]=p;
	}
}
void sol() {
	sort(a+1,a+n+1,cmp);
	a[n+1].x=W;
	tr::build(1,n,1);
	stk1[top1=0]=n+1;
	stk2[top2=0]=n+1;
	int p=n;
	while(p>=1) {
		ql=p,qr=n;
		ans=max(ans,tr::query(1,n,1)-2*a[p].x);
//		cerr<<p<<':'; tr::debug(1,n,1); puts("");
		push(p--);
	}
}
int main() {
	rd(W),rd(H),rd(n);
	for(int i=1;i<=n;++i) rd(a[i].x),rd(a[i].y);
	ans=2*(max(W,H)+1);
	a[++n]=(node){W,H};
	a[++n]=(node){W,0};
	a[++n]=(node){0,H}; 
	lim=H/2; sol();
	lim=H/2+1; sol();
	lim=H/2-1; sol();
	for(int i=1;i<=n;++i) swap(a[i].x,a[i].y);
	swap(W,H);
	lim=H/2; sol();
	lim=H/2+1; sol();
	lim=H/2-1; sol();
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	vi v(n);
	int msk = 0;
	rep(i,0,n){
		cin >> v[i];
		msk ^= v[i];
	}
	rep(i,0,n){
		cout << (v[i] ^ msk) << ' ';
	}
	cout << '\n';
}


Measured memory_bytes: 3972