akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n, x;
    cin >> n >> x;

    vector<int> want(n);

    rep(i,n) cin >> want[i];

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

    int ans = 0;

    while(x > 0){
        if(ans == n-1){
            if(x == want[n-1]){
                ans++;
                break;
            }
            else break;
        }
        if(x >= want[ans]){
            x =  x - want[ans];
            ans++;
        }
        else break;
    }

    cout << ans << endl;

}

    

Measured memory_bytes: 256
X=int(input())
check=0
maxx=0

if(X<=3):
    print(1)
    quit()

for i in range(2,1001):
    for j in range(2,1001):
       check=i**j
       if(check>X):
           break
       if(maxx<check ):
           maxx=check

print(maxx)
        


Measured memory_bytes: 2940
#include <iostream>
#include <string>

using namespace std;

int main(void) {
  int a, b;

  cin >> a;
  cin >> b;

  int r;
  if (b == 1) {
    r = 0;
  } else {
    r = 1;
    while(r * (a - 1) + 1 < b) {
      r++;
    }
  }

  cout << r;

  return 0;
}

Measured memory_bytes: 256
/*  

    IITAPOORV094

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
|                                        |
|   *******     *******     ********     |
|      |           |            |        |
|      |           |            |        |
|      |           |            |        |
|   *******     *******         |        |
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

*/
  // This will work only for g++ compiler. 
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>



#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based

//short hand for usual tokens
#define pb push_back
#define fi first
#define se second

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())


using namespace std;

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;



ll solve(ll a[],ll b[],ll n)
{
	ll dp[n+1];
	map<ll ,ll>mp;
	dp[1]=b[1];
	mp[a[1]]=b[1];
	ll ans=0;
	forc(i,2,n)
	{
		auto it =mp.lower_bound(a[i]+1);
		dp[i]=b[i];
		if(it!=mp.begin())
		{
			it--;
			dp[i]=dp[i]+it->second;
		}
		mp[a[i]]=dp[i];
	    it=mp.upper_bound(a[i]);
		while(it!=mp.end()&&it->second<=dp[i])
		{
			auto temp=it;
			temp++;
			mp.erase(it);
			it=temp;
		}
	}
	forr1(i,n)
	{
		if(dp[i]>ans)
		{
			ans=dp[i];
		}
	}
	return(ans);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
    

    ll n;
    cin>>n;
    ll a[n+1];
    for1(i,n)
    {
    	cin>>a[i];
    }    
    ll b[n+1];
    for1(i,n)
    {
    	cin>>b[i];
    }
    cout<<solve(a,b,n);
    return 0;
}


Measured memory_bytes: 17408
var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
  
process.stdin.on('end', function() {
  input = input.split("\n");
  i = 0
   
  while (true) {
    arr = input[i].split(" ");
    if (arr[1] == "?") { break; }
 
    arr[0] = Number(arr[0]);
    arr[2] = Number(arr[2]);
  
    switch (arr[1]) {
      case "+":
        console.log(arr[0] + arr[2]);
        break;
      case "-":
        console.log(arr[0] - arr[2]);
        break;
      case "*":
        console.log(arr[0] * arr[2]);
        break;
      case "/":
        console.log(Math.floor(arr[0] / arr[2]));
        break;
    }
  
    i++;
  }
});

Measured memory_bytes: 16112
//Classic
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"AA Baju Smit------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>
#define mod 1000000007
#define ciN cin
#define X INT_MAX
#define N INT_MIN
////////////////////////////////////////////////////////////////
vector<bool> visited(200001, false);
vi adj[200001];
ll cnt = 0;
void dfs(int s) {
	visited[s] = 1;
	cnt++;
	for (auto x : adj[s]) {
		if (!visited[x]) {
			//debug("HERE");

			//cnt++;
			dfs(x);
		}
	}
	//debug(cnt);
	//debug("END");
}
void solve() {
	int n, m; ciN >> n >> m;
	For(i, 0, m) {
		int x, y; ciN >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		if (!visited[i]) {
			visited[i] = 1;
			cnt = 0;
			dfs(i);
			//	debug(i);
			ans = max(cnt, ans);
			//debug(cnt);
			cnt = 0;
		}
	}
	cout << ans << endl;
}




////////////////////////////////////////////////////////////////


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

	//int t; cin >> t;
	//while (t--)
	solve();


	return 0;
}





///////////////////////////////////////////////////////////////////////////////////////////
//Kai baju bhai???



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

int main(){

  int h,w;
  string s[100];
  int ans[100][100];

  cin >> h >> w;

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

  ans[0][1] = s[0][1] - '0';
  ans[1][0] = s[1][0] - '0';

  for(int i=1;i<w;i++) ans[0][i] = s[0][i] - '0' + ans[0][i-1];
  for(int i=1;i<h;i++) ans[i][0] = s[i][0] - '0' + ans[i-1][0];


  for(int i=1;i<h;i++){
    for(int j=1;j<w;j++) ans[i][j] = (s[i][j] - '0') + min(ans[i-1][j],ans[i][j-1]);    
  }

  cout << ans[h-1][w-1] << endl;

}

Measured memory_bytes: 1236
/*input
10
33 18 45 28 8 19 89 86 2 4
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}

void solve(){
	ll i,j,k;
	ll n;
	cin>>n;
	ll a[n];
	rep(i,0,n)cin>>a[i];
	sort(a,a+n);
	map<ll,ll> mp;
	ll ans=0;
	rep(i,0,n){
		if(mp[a[i]])continue;
		if(i==n-1||a[i]!=a[i+1])ans++;
		for(j=a[i];j<=a[n-1];j+=a[i]){
			mp[j]=1;
		}
	}
	cout<<ans<<endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}




Measured memory_bytes: 67420
#include<bits/stdc++.h>
#define REP(i, n) for (int i=0; i<n; ++i)
#define print(x) cout << x << endl;
typedef long long ll;

using namespace std;

void solve() {
    int X;
    cin >> X;
   
    int t = 0;
    int total = 0;
    while (total < X) {
        t++;
        total += t;
    }
    print(t);
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using  namespace std;
inline int getsum(register int k){
	int summ=0;
	while(k!=0){
		summ+=k%10;
		k/=10;
	}
	return summ;
}
int main(){
	int n,a,b,sum=0;
	scanf("%d%d%d",&n,&a,&b);
	for(register int i=1;i<=n;i++){
		int temp=getsum(i);
		if(temp>=a&&temp<=b) sum+=i;
	}
	printf("%d\n",sum);
	return 0;
}

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

int main(){
    long S;
    cin >> S;
    long h = S/3600;
    long m = (S-3600*h)/60;
    long s = (S-3600*h-60*m);
    
    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3100
#include<iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int main(){
  int n ;
  cin >> n;
  int odd[n/2];
  int even[n/2];
  for(int i = 0; i < n; i++){
    if(i % 2) cin >> odd[i/2];
    else cin  >> even[i/2];
  }
  vector<pair<int,int> > oddCnt(100100);
  vector<pair<int,int> > evenCnt(100100);
  for(int i = 0; i < 100100; i++){
    oddCnt[i].first = 0;
    evenCnt[i].second = 0;
  }
  
  for(int i = 0; i < n/2; i++){
    oddCnt[odd[i]].second = odd[i];
    oddCnt[odd[i]].first ++;
    evenCnt[even[i]].second = even[i];
    evenCnt[even[i]].first ++;
  }
  
  sort(oddCnt.begin(),oddCnt.end(),greater<pair<int,int> >());
  sort(evenCnt.begin(),evenCnt.end(),greater<pair<int,int> >());

  if(oddCnt[0].second == evenCnt[0].second){
    cout << n - max(oddCnt[0].first + evenCnt[1].first,oddCnt[1].first + evenCnt[0].first) << endl;
  }else cout << n - oddCnt[0].first - evenCnt[0].first << endl;
  
}


Measured memory_bytes: 2176
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#define REP(i,n) for (int i=1;i<=(n);++i)
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,a,b) for (int i=(a);i>=(b);--i)
#define FEC(p,u) for (edge*p=head[u];p;p=p->nxt)
using namespace std;
typedef long long LL;

int n, m, q, a[110000];
int cur[110000], pre[110000], pr[110000], nx[110000];
bool vst[110000], ans = true;
int main(){
	scanf("%d%d%d", &n, &m, &q);
	REP(i,m) cur[i] = -i;
	REP(i,q) {
		scanf("%d", a+i);
		pre[i] = cur[a[i]];
		cur[a[i]] = i;
	}
	REP(i,m) cur[i] = q+1;
	REP(i,m) pr[i] = i-1, nx[i] = i+1;
	int step(0);
	ROF(i,q,1) if (!vst[a[i]]) {
		vst[a[i]] = true;
		nx[pr[a[i]]] = nx[a[i]], pr[nx[a[i]]] = pr[a[i]];
		++step;
		int k = 1, j = i;
		while (k <= n) {
			while (j > 0 && j > cur[k]) j = pre[j];
			if (cur[k] < 0 && j != -nx[-cur[k]]) ans = false;
			if (cur[k] < 0) { cur[k] = j; break; }
			else cur[k] = j;
			++k; if (j > 0) j = pre[j];
		}
	}
	REP(i,m) if (cur[i]<-step) ans = false;
	if (ans) printf("Yes\n"); else printf("No\n");
	return 0;
}


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

using namespace std;

int N,K;
bool ok[10];
vector<int>v;

bool check(int x)
{
	do
	{
		if (!ok[x % 10]) return false;
		x /= 10;
	}while(x > 0);
	return true;
}

int main()
{
	scanf("%d%d",&N,&K);
	memset(ok,true,sizeof(ok));
	for (int i=1;i<=K;i++)
	{
		int tmp;
		scanf("%d",&tmp);
		ok[tmp] = false;
	}
	for (int i=N;;i++)
	{
		if (check(i))
		{
			printf("%d\n",i);
			return 0;
		}
	}
}


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

int main(void){
  vector<string> str;
  vector<int> cnt;
  string buf, maxstr;
  int max = 0, ans, i;

  while(cin >> buf){
    bool f = true;

    if(max < buf.length()){
      max = buf.length();
      maxstr = buf;
    }
    for(i = 0; i < str.size(); i++){
      if(str[i] == buf){
	f = false;
	break;
      }
    }
    if(f){
      str.push_back(buf);
      cnt.push_back(1);
    }
    else{
      cnt[i]++;
    }
  }

  max = 0;
  for(i = 0; i < cnt.size(); i++){
    if(cnt[i] > max){
      max = cnt[i];
      ans = i;
    }
  }

  cout << str[ans] << ' ' << maxstr << endl;

  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
   
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define deb(x) cout << #x << "=" << x << endl
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define int long long
//const int N=1e5+5;

const int N = 5e5 + 5;
 	int connected;
	int par[N], sz[N];
 
struct DSU
{
 
	void init(int n) 
	{
		for(int i=1;i<=n;i++)
		{
			par[i]=i;
			sz[i]=1;
		}
		connected=n;
	}
 
	int getPar(int k)
	{
		while(k!=par[k])
		{
			par[k]=par[par[k]];
			k=par[k];
		}
		return k;
	}
 
	int getSize(int k)
	{
		return sz[getPar(k)];
	}
 
	void unite(int u, int v)
	{
		int par1=getPar(u), par2=getPar(v);
 
		if(par1==par2)
			return;
 
		connected--;
 
		if(sz[par1]>sz[par2])
			swap(par1, par2);
 
		sz[par2]+=sz[par1];
		sz[par1]=0;
		par[par1]=par[par2];
	}
};
 DSU dsu;
vector<int>a;
int solve(int l,int r)
{
    if(l>r)return 0;
    if(l==r)return a[l];
   
    
    int ans=INT_MAX;
    int mi=1e18;
    for(int i=l;i<=r;i++)
    {
        mi=min(mi,a[i]);
    }
    
    for(int i=l;i<=r;i++)
    {
        a[i]-=mi;    
    }
    int val=mi;
    int lst=l;
    for(int i=l;i<=r;i++)
    {
        if(a[i]==0)
        {
            val+=solve(lst,i-1);
            lst=i+1;
        }
    }
    val+=solve(lst,r);
    return min(ans,val);
    
}
 


void solve()
{
    int n,m;
    cin>>n>>m;
    //vector<pair<int,int>>v(m);
    //for(auto &x:v)cin>>x.ff>>x.ss;
    dsu.init(n);
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        dsu.unite(x,y);
    }
    
    
    for(int i=1;i<=n;i++)
    {
       int x=dsu.getPar(i);
       if(x==i)a.pb(sz[i]);
    }
    
  cout<<*max_element(a.begin(),a.end());
}

int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    
	int t=1;
//	cin>>t;
	while(t--)solve();
	    
  
}




Measured memory_bytes: 8428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, FN) for(int i = 0; i < ( FN ); i++)

int main() {
    ll n, m;
    ll ans = 0;
    cin >> n >> m;
    if(2 + n <= m) {
        ans += n;
        m -= 2 * n;
        ans += m / 4;
    } else {
        ans += m / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
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 dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(18);

	int X, Y;
	cin >> X >> Y;
	if(2*X <= Y && 4*X >= Y && Y%2 == 0)Yes;
	No;

	return 0;
}

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

using namespace std;

int n, k, sol = 1, br;
string s;
vector <int> oni;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
cin >> s;
oni.push_back(0);
for(int i = 1 ; i < n ; ++i){
	if(s[i] != s[i - 1]){
		oni.push_back(i);
	}
}
if(s[0] == '0'){
	br = 1;
	for(int i = 1 ; i < n ; ++i){
		if(s[i] != s[i - 1]){
			if(s[i] == '0'){
				br++;
			}
			if(br > k)
				break;
		}
		sol = max(sol, i + 1);
	}
}
if(s[n - 1] == '0'){
	br = 1;
	for(int i = n - 2 ; i >= 0 ; --i){
		if(s[i] != s[i + 1]){
			if(s[i] == '0'){
				br++;
			}
			if(br > k)
				break;
		}
		sol = max(sol, n - i);
	}
}
for(int i = 0 ; i < (int)oni.size() ; ++i){
	if(s[oni[i]] == '0')
		continue;
	int l = oni[i];
	int r = (i + 2 * k + 1 >= (int)oni.size() ? n : oni[i + 2 * k + 1]);
	sol = max(sol, r - l);
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 1020
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
#include<map>
using namespace std;
 
#define int long long
#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long
 
signed main() {
	int N;
	cin >> N;
	
	map<int, int> mp;
 
	int A;
	REP(i, N) {
		cin >> A;
 
		if (mp[A] == 0) mp[A] = 1;
		else if (mp[A] == 1) mp[A] = 0;
		else cout << "aaaaa" << endl;
	}
	
	int ans = 0;
	for(pair<int,int> i : mp) {
		//cout << mp[i] << " ";
		if (i.second == 1) ans++;
	}
 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

struct mint{
  ll x;
  mint(ll x = 0): x((x % MOD + MOD) % MOD){}
  mint operator-() const {return mint(-x);}
  mint& operator+=(const mint a){
    if((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD - a.x) >= MOD) x-= MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a){
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a){
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a){
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if(t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a){
    mint res(*this);
    return res/=a;
  }
};
struct combination{
  vector<mint> fact, ifact;
  combination(int n): fact(n+1), ifact(n+1){
    assert(n < MOD);
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k){
    if(k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  combination c(100010);
  ll N, K;
  cin >> N >> K;
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  sort(ALL(A));
  mint ans;
  for(int i = 0; i < N; i++){
    mint plus, minus;
    if(i >= K - 1){
      plus += c(i, K-1);
    }
    if(i + K - 1 < N){
      minus += c(N-i-1, K-1);
    }
    ans += mint(A.at(i)) * (plus - minus);
    
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <iterator>
#include <utility>
#include <algorithm>

using namespace std;

typedef map< string, set<string> > SectionMap;

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		SectionMap sections;
		string firstSection;
		for(int i = 0; i < n; ++i){
			string line;
			cin >> line;
			int idx = 0;
			string section;
			for(; line[idx] != ':'; ++idx){ section.push_back(line[idx]); }
			if(firstSection == ""){ firstSection = section; }
			++idx;
			string name;
			set<string> names;
			for(; line[idx] != '\0'; ++idx){
				if(line[idx] == ',' || line[idx] == '.'){
					names.insert(name);
					name = "";
				}else{
					name.push_back(line[idx]);
				}
			}
			sections.insert(make_pair(section, names));
		}
		while(true){
			bool combined = false;
			for(SectionMap::iterator it = sections.begin(); it != sections.end(); ++it){
				set<string> &names = it->second;
				for(set<string>::iterator jt = names.begin(); jt != names.end(); ++jt){
					SectionMap::iterator sec = sections.find(*jt);
					if(sec != sections.end()){
						for(
							set<string>::iterator kt = sec->second.begin();
							kt != sec->second.end(); ++kt
						){
							names.insert(*kt);
						}
						names.erase(jt);
						combined = true;
						break;
					}
				}
			}
			if(!combined){ break; }
		}
		cout << sections.find(firstSection)->second.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1104
#include<stdio.h>

int main(void){
    char b;
    scanf("%c",&b);
    switch (b){
        case 'A':
            printf("T");
            break;
        case 'T':
            printf("A");
            break;
        case 'C':
            printf("G");
            break;
        case 'G':
            printf("C");
            break;    
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#define MN 210
#define MM 21000

int h[MN], nxt[MM], to[MM], cap[MM], K = 1;
int q[MN], hh = 0, tt = 0;
int iter[MN], d[MN];
int A[MN][MN], B[MN][MN], C[MN][MN];
std::vector<int> cnt[MN][MN];

void ins(int u, int v, int c) {nxt[++K] = h[u]; h[u] = K; to[K] = v; cap[K] = c;}
void insw(int u, int v, int c) {ins(u, v, c); ins(v, u, 0);}

bool bfs(int S, int T)
{
	memcpy(iter, h, sizeof(h));
	memset(d, 0, sizeof(d)); d[S] = 1;
	hh = tt = 0; q[tt++] = S;
	while(hh < tt)
	{
		int u = q[hh++]; 
		for(int i = h[u]; i; i = nxt[i])
			if(cap[i] && !d[to[i]])
			{
				d[to[i]] = d[u] + 1;
				q[tt++] = to[i];
			}
	}
	return d[T];
}

int dfs(int u, int T, int f)
{
	if(u == T) return f;
	int used = 0;
	for(int &i = iter[u]; i; i = nxt[i])
	{
		if(cap[i] && d[to[i]] == d[u] + 1)
		{
			int w = dfs(to[i], T, std::min(cap[i], f - used));
			if(w)
			{
				cap[i] -= w; cap[i ^ 1] += w; used += w;
				if(f == used) return f;
			}
		}
	}
	return used;
}

int dinic(int S, int T)
{
	int w, f = 0;
	while(bfs(S, T))
		while(w = dfs(S, T, 1e9)) f += w;
	return f;
}

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			scanf("%d", &A[i][j]);
			cnt[i][(A[i][j] - 1) / m + 1].push_back(A[i][j]);
		}
	int S = 2 * n + 1, T = 2 * n + 2;
	for(int i = 1; i <= m; i++)
	{
		memset(h, 0, sizeof(h)); K = 1;
		for(int j = 1; j <= n; j++)
			for(int k = 1; k <= n; k++)
				if(cnt[j][k].size()) insw(j, n + k, 1);
		for(int j = 1; j <= n; j++) insw(S, j, 1), insw(j + n, T, 1);
		dinic(S, T); 
		for(int j = 1; j <= n; j++)
			for(int x = h[j]; x; x = nxt[x])
				if(!cap[x] && n + 1 <= to[x] && to[x] <= 2 * n)
					B[j][i] = cnt[j][to[x] - n].back(), cnt[j][to[x] - n].pop_back();
	}
	for(int i = 1; i <= n; i++, puts(""))
		for(int j = 1; j <= m; j++)
		{
			C[(B[i][j] - 1) / m + 1][j] = B[i][j];
			printf("%d ", B[i][j]);
		}
	for(int i = 1; i <= n; i++, puts(""))
		for(int j = 1; j <= m; j++)
			printf("%d ", C[i][j]);
}

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

using namespace std;

using ll = long long;
// const int mod = 1e9 + 7;

#define mem(a, b) memset(a, b, sizeof(a))
#define REP(i, a) for (int i = 0; i < a; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(a) a.begin(), a.end()

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(10);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void print_array(const int A[], int n) {
    REP(i, n) {
        if (i < n - 1) {
            cout << A[i] << " ";
        } else {
            cout << A[i] << endl;
        }
    }
}

inline void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll res = -INT64_MAX;
    res = max(res, a * c);
    res = max(res, a * d);
    res = max(res, b * c);
    res = max(res, b * d);

    cout << res << endl;
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t = 1;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3644
import sys
s=input()
l = len(s)
c=0
for i in range(l):
    if i%2==0:
        if s[i]=="R" or s[i]=="U" or s[i]=="D":
            continue
        else:
            c=1
            break
    if i%2==1:
        if s[i]=="L" or s[i]=="U" or s[i]=="D":
            continue
        else:
            c=1
            break
            
if c==1:
    print("No")
if c==0:
    print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main()
{
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n],dp[W+1];
    for(int i=0;i<=W;i++)dp[i]=0;
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
        for(int j=W-w[i];j>=0;j--){
            dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i]);
        }
    }
    ll ans=0;
    for(int i=0;i<=W;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N, M, L, Q;
long long A[90000];
long long B[90000];
long long C[90000];
long long S[90000];
long long T[90000];
long long d[305][305];
long long d2[305][305];

vector<long long> tree[305];

int main(){
	cin >> N >> M >> L;
	rep(i, M) {
		cin >> A[i] >> B[i] >> C[i];
		A[i]--;B[i]--;
	}
	cin >> Q;
	rep(i, Q) {
		cin >> S[i] >> T[i];
		S[i]--;T[i]--;
	}

	rep(i, N) {
		rep(j, N) {
			d[i][j] = LONG_MAX/3;
			d2[i][j] = LONG_MAX/3;
		}
		d[i][i] = 0;
		d2[i][i] = 0;
	}

	rep(i, M) {
		d[A[i]][B[i]] = C[i];
		d[B[i]][A[i]] = C[i];
	}

	for(int k = 0; k < N; ++k){
		for(int i = 0; i < N; ++i){
			for(int j = 0; j < N; ++j){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	rep(i, N) {
		rep(j, N) {
			if(i == j) continue;
			if(d[i][j] <= L) {
				d2[i][j] = 1;
			}
		}
	}


	for(int k = 0; k <N; ++k){
		for(int i = 0; i < N; ++i){
			for(int j = 0; j < N; ++j){
				d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
			}
		}
	}

	rep(i, Q) {
		if(d2[S[i]][T[i]] == LONG_MAX/3) {
			cout << -1 << endl;
			continue;
		}
		cout << d2[S[i]][T[i]]  - 1<< endl;
	}

}


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

#define N 200000

int main(void){
	int a[N];
	int i, n;

	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d", &a[i]);
	}
	
	for(i=n-1; i>=0; i=i-2){
		printf("%d ", a[i]);
	}
	for(i=n%2; i<n; i=i+2){
		printf("%d ", a[i]);
	}
	
	printf("\n");


	return 0;
}

Measured memory_bytes: 2816
s = input()
n = len(s)
MOD = 10 ** 9 + 7
dp = [[0] * 4 for _ in range(n + 1)]
dp[0][0] = 1

for i, x in enumerate(s):
    if x == 'A' or x == '?':
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][2]
        dp[i + 1][3] += dp[i][3]
        dp[i + 1][1] += dp[i][0]
    if x == 'B' or x == '?':
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][2]
        dp[i + 1][3] += dp[i][3]
        dp[i + 1][2] += dp[i][1]
    if x == 'C' or x == '?':
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][2]
        dp[i + 1][3] += dp[i][3]
        dp[i + 1][3] += dp[i][2]

    for j in range(4):
        dp[i + 1][j] %= MOD

print(dp[n][3])


Measured memory_bytes: 27632
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
use std::collections::BinaryHeap;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn main(){
    let line = read_as_vec::<usize>();

    let (n, m) = (line[0], line[1]);

    let mut edges = vec![vec![];n];

    for _ in 0..m{
        let line = read_as_vec::<usize>();
        let (l, r, c) = (line[0]-1, line[1] - 1, line[2] as i64);
        edges[l].push((r, c));
    }

    for i in 1..n{
        edges[i].push((i-1,0));
    }


    let mut heap = BinaryHeap::new();
    let mut min_paths = vec![std::i64::MAX;n];
    min_paths[0] = 0;
    heap.push((0, 0));

    while let Some((cost, u)) = heap.pop(){
        let cur_cost = -cost;
        for &(next_v, next_cost) in &edges[u]{
            if cur_cost + next_cost < min_paths[next_v]{
                min_paths[next_v] = cur_cost + next_cost;
                heap.push((-(cur_cost + next_cost), next_v));
            }
        }
    }
    if min_paths[n-1] == std::i64::MAX{
        println!("{}", -1);
    }else{
        println!("{}", min_paths[n-1]);
    }
}


Measured memory_bytes: 16636
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		List<Integer> arr = new ArrayList();
		for(int i=0;i<N;i++) {
			arr.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(arr);

		int totalMin =0;
		for(int i=0;i<K;i++) {
			totalMin+= arr.get(i);
		}

		System.out.println(totalMin);
	}
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  ll H, W;
  cin >> H >> W;
  if (H == 1 || W == 1)
    cout << 1 << endl;
  else if (H % 2 == 0)
    cout << (H / 2) * W << endl;
  else if (W % 2 == 0)
    cout << (H / 2) * (W / 2) + ((H + 1) / 2) * (W / 2) << endl;
  else
    cout << (H / 2) * (W / 2) + ((H + 1) / 2) * (W - (W / 2)) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
	static int ans;
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		try{
			while(true){
				int n=scan.nextInt();
				int s=scan.nextInt();
				if(n==0 && s==0)break;
				ans=0;
				func(0,n,s);
				System.out.println(ans);
			}
		}catch(NumberFormatException e){
			System.out.println(e);
		}
	}
	private static void func(int min,int n,int s){
		if(s<min*n)return;
		switch(n){
			case 1:
				if(s<10)ans+=1;
				break;
			default:
				for(int i=min;i<=s/n;i++)func(i+1,n-1,s-i);
				break;
		}
	}
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<pii> xy(n);
    REP(i,n){
        int32 x,y;
        cin >> x >> y;
        xy[i] = pii(x,y);
    }
    double sum = 0;
    int64 factorial = 1;
    vector<int32> perm;
    FOR(i,1,n+1)factorial *= i;
    REP(i,n-1){
        FOR(j,i+1,n){
            int32 dx = abs(xy[i].first - xy[j].first);
            int32 dy = abs(xy[i].second - xy[j].second);
            sum += sqrt(dx  * dx + dy * dy) / n;
        }
    }
    cout << fixed << setprecision(10) << sum * 2 << endl;
    return 0;
}

Measured memory_bytes: 256
a, b, x = map(int, input().split())
y = x / (a ** 2)
import math
ans = math.atan((2 * b - 2 * y) / a) * 360 / 2 / math.pi
if 2 * b - 2 * y > b:
  ans = math.atan((b ** 2) / (2 * a * y)) * 360 / 2 / math.pi
print(ans)

Measured memory_bytes: 9284
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < S.size(); i++) {
    if (cnt == 0 && S.at(i) == 'C') {
      cnt++;
    }
    if (cnt == 1 && S.at(i) == 'F') {
      cnt++;
    }
  }
  if (cnt == 2) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 2000;

struct P{
    double x,y,z;
};

inline double sq(double x){
    return x*x;
}

inline double dist(P p, P q){
    return sqrt(sq(p.x-q.x)+sq(p.y-q.y)+sq(p.z-q.z));
}

double distSP(P p, P q){
    double l=0, r=1;
    rep(_,40){
        double m1 = (2*l+r)/3, m2 = (l+2*r)/3;

        P a1({m1*p.x, m1*p.y, m1*p.z}), a2({m2*p.x, m2*p.y, m2*p.z});
        if(dist(q,a1) < dist(q,a2)) r=m2;
        else l=m1;
    }

    return dist(q, P({l*p.x, l*p.y, l*p.z}));
}

int main(){
    int n,m,r;
    while(scanf(" %d %d %d", &n, &m, &r),n){
        vector<P> s(n);
        vector<int> sr(n);
        rep(i,n) scanf(" %lf %lf %lf %d", &s[i].x, &s[i].y, &s[i].z, &sr[i]);

        vector<P> t(m);
        vector<int> tb(m);
        rep(i,m) scanf(" %lf %lf %lf %d", &t[i].x, &t[i].y, &t[i].z, &tb[i]);

        P E;
        scanf(" %lf %lf %lf", &E.x, &E.y, &E.z);

        rep(i,n){
            s[i].x -= E.x;
            s[i].y -= E.y;
            s[i].z -= E.z;
        }
        rep(i,m){
            t[i].x -= E.x;
            t[i].y -= E.y;
            t[i].z -= E.z;
        }
        E = {0,0,0};

        vector<vector<double>> d(m,vector<double>(n));
        rep(i,m)rep(j,n) d[i][j] = distSP(t[i],s[j]);

        vector<bitset<N>> rem(m);
        rep(i,m){
            rep(j,n){
                if(d[i][j]<sr[j] && sr[j]<max(dist(E,s[j]),dist(t[i],s[j]))) rem[i].set(j);
            }
        }

        double ans = 0;
        rep(mask,1<<m){
            bitset<N> must;
            rep(i,m)if(mask>>i&1){
                must |= rem[i];
            }

            if(must.count()<=r){
                double tmp = 0;
                rep(i,m)if(mask>>i&1) tmp += tb[i]/sq(dist(E,t[i]));
                ans = max(ans,tmp);
            }
        }
        printf("%.10f\n", ans);
    }
    return 0;
}



Measured memory_bytes: 3372
#include <iostream>
using namespace std;
int a[86];
int main () {
	int N;
	cin >> N;
	for (int i=0; i<N; i++) {
		cin >> a[i];
	}
	long long int sum=1000, stk=0;
	for (int i=0; i<N; i++) {
		if (a[i]<a[i+1]) {
			stk+=sum/a[i];
			sum=sum-(sum/a[i]*a[i]);
		}
		else {
			sum+=stk*a[i];
			stk=0;
		}
	}
	cout << sum << endl;	
}

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

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    int a,b,c,d;
    cin >> a >>b >> c >>d;
    int n1 = c/b;
    if(n1*b != c){
        n1++;
    }
    int n2 = a/d;
    if(n2*d != a){
        n2++;
    }
    if(n1 <= n2 ){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

const int N = int(2e5) + 2;
const int nAlpha = 'z' - 'a' + 1;

typedef pair<int, int> pii;
int odd = 0, posodd = -1;
int n, t[N];
vector<int> pos[nAlpha];
vector<pii> e;
string s;

void Update(int x, int val) {for(; x > 0; x -= (x & -x)) t[x] += val;}
int Get(int x) {int res = 0; for(; x < N; x += (x & -x)) res += t[x]; return res;}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> s; n = s.size(), s = ' ' + s;
    for(int i = 1; i <= n; ++i) s[i] -= 'a', pos[s[i]].pb(i);
    for(int i = 0; i < nAlpha; ++i) {
        odd += int(pos[i].size()) & 1;
        int s = 0, t = pos[i].size() - 1;
        while(s < t) e.pb(mp(pos[i][s ++], pos[i][t --]));
        if(s == t) posodd = pos[i][s];
    }
    if(odd > 1) return cout << -1, 0;
    sort(e.begin(), e.end());
    for(int i = 1; i <= n; ++i) if(i != posodd) Update(i, 1);
    ll res = 0;
    for(pii p: e) {
        if(odd && (p.fi > posodd || p.se < posodd)) ++res;
        res += Get(p.se + 1);
        Update(p.se, -1);
    }
    cout << res;
}


Measured memory_bytes: 3916
#include<stdio.h>
int main(void)
{
	int v,h2,m2,s2,s,h,m,g,e,f,d,a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	while(a!=-1 && b!=-1 && c!=-1){
	e=a*60;
	g=(e+b)*60+c;
	f=(2*3600)-g;
	h=f/3600;
	m=(f-(h*3600))/60;
	s=f-(h*3600+m*60);
	v=(3600*2-g)*3;
	h2=v/3600;
	m2=(v-h2*3600)/60;
	s2=(v-h2*3600)%60;;
	printf("%02d:%02d:%02d\n",h,m,s);
	printf("%02d:%02d:%02d\n",h2,m2,s2);
	scanf("%d %d %d",&a,&b,&c);
	}
	return 0;
}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
#define int long long

class dsu{
    vector<int>par;
public:
    dsu(int n){
        par.resize(n);
        iota(par.begin(), par.end(), 0);
    }

    int find(int u){
        if(u==par[u])return u;
        return par[u]=find(par[u]);
    }

    void join(int a, int b){
        a=find(a);
        b=find(b);
        if(a!=b)par[b]=a;
    }
};

signed main(){
    int n, m;
    cin>>n>>m;
    dsu u(n);
    int a, b;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        --a, --b;
        u.join(a,b);
    }
    vector<int>x(n);
    for(int i=0;i<n;i++)x[u.find(i)]++;
    int mx=0;
    for(auto i:x)mx=max(mx, i);
    cout<<mx<<endl;
}

Measured memory_bytes: 6688
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;



int main(void)
{
	//変数の宣言
	int n;
	int a=0;
	int b=0;
	int c=0;
	char s[15];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;



	//データの読み込み


	scanf("%d",&n);
//	scanf_s("%d",&n);


	//	scanf("%s",&s);
	//	scanf_s("%s",&s,200010);

//	scanf("%c",&dummy);
//	scanf_s("%c",&dummy);


	for(i=0;i<n;i++){
		scanf("%s",&s);
//		scanf_s("%s",&s,15);
		
		len=strlen(s);
		for(j=0;j<len-1;j++){
			if(s[j]=='A'&&s[j+1]=='B'){
				ans++;
			}
		}

		if(s[0]=='B'){
			if(s[len-1]=='A'){
				c++;
			}else{
				b++;
			}
		}else if(s[len-1]=='A'){
			a++;
		}

	}

/*	for(i=0;i<n;i++){
//		scanf("%c",&t[i]);
		scanf_s("%c",&t[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

//	printf("a=%d b=%d c=%d ans=%d\n",a,b,c,ans);

	ans=ans+c+min(a,b);
	if(a==0&&b==0&&c!=0){
		ans=ans-1;
	}

	
	//	printf("計算部分終了\n");

	//出力

	printf("%d",ans);

//C	printf("\nL=%d,R=%d,D=%d,U=%d\n",L,R,D,U);

	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N; cin>>N;
  ll X;	cin>>X;
  vector<ll> L(N) ;
  REP(i,N) cin>>L[i];

  int ans = 1;
  ll D = 0;
  REP(i,N) {
    D =	D + L[i];
    if(D > X) break;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n,l;
  cin>>n>>l;
  string s[n];
  
  for(int i = 0; i < n; i++)
  {
    cin>>s[i];
  }
  sort(s, s + n);
  
  for(int i = 0; i < n; i++)
  {
    cout<< s[i];
  }
  cout << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
typedef long long ll;
int a[maxn];
int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + 1 + n);
    ll ans = a[n];
    int cnt = n - 2;
    for (int i = n - 1; i >= 1; i--) {
        if(cnt == 0) break;
        ans += a[i];
        cnt--;
        if(cnt == 0) break;
        ans += a[i];
        cnt--;
    }

    printf("%lld\n", ans);
}


Measured memory_bytes: 4516
// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma")

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

#define ll long long
#define ull unsigned long long
#define dd double
#define ld long double
#define sl(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define sd(n) scanf("%lf", &n)
#define pll pair <ll, ll>
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define inf (1LL << 62)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define for1(i, stop) for(ll i = 1; i <= stop; ++i)
#define for0(i, stop) for(ll i = 0; i < stop; ++i)
#define rep1(i, start) for(ll i = start; i >= 1; --i)
#define rep0(i, start) for(ll i = (start-1); i >= 0; --i)
#define ms(n, i) memset(n, i, sizeof(n))
#define casep(n) printf("Case %lld:", ++n)
#define pn printf("\n")
#define pf printf
#define EL '\n'
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const ll sz = 3009;
ll dp[sz][sz][4], grid[sz][sz], r, c, k;

ll solve(ll row, ll col, ll take)
{
    if(row > r || col > c || row < 1 || col < 1)
        return 0;

    ll &ret = dp[row][col][take];
    if(ret != -1)
        return ret;

    ret = solve(row+1, col, 0);
    ret = max(ret, solve(row, col+1, take));

    if(take < 3) {
        ret = max(ret, grid[row][col] + solve(row+1, col, 0));
        ret = max(ret, grid[row][col] + solve(row, col+1, take+1));
    }

    return ret;
}

int main()
{
    cin >> r >> c >> k;
    for1(i, k) {
        ll r2, c2, v;
        sl(r2), sl(c2), sl(v);

        grid[r2][c2] = v;
    }

    ms(dp, -1);
    cout << solve(1, 1, 0) << EL;

    return 0;
}


Measured memory_bytes: 357524
#include <stdio.h>
#include <string.h>
  
int E[6] = {3,0,-2,2,0,-3};
int N[6] = {1,4,0,0,-4,-1};
int lsp[6] = {0,1,2,-2,-1,0};
  
  
void DICE(int a,int d[]){
      
int d2[6];
int i;
  
    if(a == 0){
    for(i = 0;i < 6; i++){
        d2[i] = d[i + E[i]];
        }
        }   
    if(a == 1){
    for(i = 0;i < 6; i++){
        d2[i] = d[i + N[i]];
        }
        }   
    memcpy(d,d2,6 * sizeof(int));
}
  
  
void l_spin(int d[]){
    int d2[6];
    int i;
      
    for(i = 0; i < 6; i++){
        d2[i] = d[i + lsp[i]];
    }
      
    memcpy(d,d2,6 * sizeof(int));
}
  
  
  
  
int main(void){
    int d[6];
    int n, i, a, b;
      
  
  
    for(i = 0; i < 6; i++){
scanf("%d",&d[i]);
}
  
scanf("%d",&n);
  
  
for(i = 0; i < n; i++){
scanf("%d",&a);
scanf("%d",&b);
  
  
while(1){
    DICE(0,d);
    if(d[0] == a) break;
    DICE(1,d);
    if(d[0] == a) break;
}
  
  
while(1){
    l_spin(d);
    if(d[1] == b) break;
}
  
  
printf("%d\n",d[2]);
  
}
  
return 0;
}


Measured memory_bytes: 2048