akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 
#define ALL(a)  (a).begin(),(a).end()



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  string X;
  cin>>X;
  int s=0;
  int sum=0;
  for(int i=0;i<X.size();i++){
    if(X[i]=='S'){
      s++;
    }else{
      if(s>0){
        s--;
        sum++;
      }
    }
  }
  cout<<X.size()-2*sum<<endl;



}






Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharp_AtCoder
{


    class Program
    {



        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();

            // 一番右からi番目までで何個あるのか
            int[] west = new int[N];
            int[] east = new int[N];

            for(int i = 0; i < N; i++)
            {
                if(i > 0)
                {
                    west[i] = west[i - 1];
                    east[i] = east[i - 1];
                }

                if (S[i] == 'W') west[i]++;
                else east[i]++;

            }

            int ans = 1000000000;
            for(int i = 0; i < N; i++)
            {
                int sum = 0;
                if(S[i] == 'W')
                {
                    sum += west[i] - 1;
                    sum += east[N - 1] - east[i];
                }
                else
                {
                    sum += west[i];
                    sum += west[N - 1] - west[i];
                }
                ans = Math.Min(ans, sum);
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 14432
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B;
    string S;
    cin >> A >> B;
    cin >> S;
    bool ok_flg = true;
    string ans;
    if(S[A]=='-'){
        for (int i = 0; i < A; i++) {
            if(S[i]=='-'){
                ok_flg = false;
                goto ok_flg_input;
            }
        }
        for (int i = A+1; i < A+B+1; i++) {
            if(S[i]=='-'){
                ok_flg = false;
                goto ok_flg_input;
            }            
        }
        goto ok_flg_input;
    }else{
        ok_flg = false;
        goto ok_flg_input;
    }
ok_flg_input:
    if(ok_flg){
        ans = "Yes";
    }else {
        ans = "No";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M;

  std::cin >> N >> M;

  std::vector<std::string> A(N), B(M);

  for (auto& s : A)
    std::cin >> s;

  for (auto& s : B)
    std::cin >> s;

  for (int i = 0; i < N; i ++)
    if (i + M - 1 < N)
      for (int j = 0; j < N; j ++)
        if (j + M - 1 < N) {
          bool valid = true;
          
          for (int k = 0; k < M; k ++)
            for (int l = 0; l < M; l ++)
              if (A[i + k][j + l] != B[k][l]) {
                valid = false;

                goto endloop;
              }

        endloop:
          if (valid) {
            std::cout << "Yes" << std::endl;

            return 0;
          }
        }

  std::cout << "No" << std::endl;
              
  return 0;
}


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

const int INF = 1e9;

int n, minv[100005], maxv[100005], color[100005];
vector<int> G[100005];

void dfs1(int x, int px, int dep){
  
  color[x] = dep % 2;
  
  for(int nx : G[x]){
    
    if( nx == px ) continue;
    
    dfs1( nx, x, dep + 1 );
    
    if( minv[x] == maxv[x] ) continue;
    
    minv[x] = max( minv[x], minv[nx] - 1 );
    
    maxv[x] = min( maxv[x], maxv[nx] + 1 );
    
  }
  
}

void dfs2(int x, int px){
  
  for(int nx : G[x]){
    
    if( nx == px && minv[x] != maxv[px] ){
      
      minv[x] = max( minv[x], minv[px] - 1 );
      
      maxv[x] = min( maxv[x], maxv[px] + 1 );
      
    }
    
    if( nx == px ) continue;
    
    dfs2( nx, x );
    
  }
  
}

int ans[100005];

int flag = 1;

void dfs3(int x, int px){
  
  if( minv[x] == maxv[x] ){
    
    if( color[x] != abs( minv[x] ) % 2 ) flag = 0;
    else ans[x] = minv[x];
    
    if( px != -1 ){
      
      if( minv[x] + 1 != ans[px] && minv[x] - 1 != ans[px] ) flag = 0;
      
    }
    
  }
  
  if( minv[x] != maxv[x] ){
    
    if( abs( ans[px] ) % 2 == color[x] ) flag = 0;
    
    if( minv[x] <= ans[px] + 1 && ans[px] + 1 <= maxv[x] ) ans[x] = ans[px] + 1;
    
    if( minv[x] <= ans[px] - 1 && ans[px] - 1 <= maxv[x] ) ans[x] = ans[px] -1;
    
  }
  
  for(int nx : G[x]){
    if( nx != px )  dfs3( nx, x );
  }
  
}

signed main(){
  
  cin>>n;
  
  for(int i=0;i<n-1;i++){
    
    int a, b;
    cin>>a>>b;
    
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
    
  }
  
  for(int i=0;i<n;i++){
    minv[i] = -INF;
    maxv[i] = INF;
  }
  
  int root = -1;
  
  int K;
  cin>>K;
  
  while(K--){
    
    int v, p;
    cin>>v>>p;
    
    minv[v-1] = maxv[v-1] = p;
    
    root = v-1;
  }
  
  int dep = 0;
  
  if( minv[root] % 2 ) dep = 1;
  
  dfs1( root, -1, dep );
  
  dfs2( root, -1 );
  
  dfs3( root, -1 );
  
  for(int i=0;i<n;i++){
    if( abs(ans[i]) % 2 != color[i] ) flag = 0;
  }
  
  for(int i=0;i<n;i++){
    
    for(int ni : G[i] ){
      
      if( abs( ans[i] - ans[ni] ) > 1 ) flag = 0;
      
    }
    
  }
  
  if( flag == 0 ) cout<<"No"<<endl;
  else{
    
    cout<<"Yes"<<endl;
    
    for(int i=0;i<n;i++) cout<<ans[i]<<endl;
    
  }
  
  return 0;
}


Measured memory_bytes: 15744
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
using namespace std;
int main( void )
{
	int T;
	cin >> T;

	for ( int lpc = 0; lpc < T; lpc++ )
	{
		// }bv
		int W, H;
		cin >> H >> W;

		vector <string> map(H);
		for ( int i = 0; i < H; i++ )
			cin >> map[i];

		// ú»
		int x;
		int y;
		int a;
		for ( int i = 0; i < H; i++ )
		{
			for ( int j = 0; j < W; j++ )
			{
				// íÔÌê
				a = (map[i][j]=='^')?1:(map[i][j]=='v')?2:(map[i][j]=='<')?3:(map[i][j]=='>')?4:a;
				switch(map[i][j]) { case '^':case 'v':case '<':case '>': x = j; y = i;map[i][j]='.'; }
			}
		}

		// ì
		int N;
		cin >> N;
		
		string ops;
		cin >> ops;
		istringstream is(ops);
		for ( int i = 0; i < N; i++ )
		{
			char op;
			is >> op;
			if ( op == 'U' )
			{
				a = 1;
				if ( y-1 >= 0 && map[y-1][x] == '.' )
				{
					y--;
				}
			}
			else if ( op == 'D' )
			{
				a = 2;
				if ( y+1 < H && map[y+1][x] == '.' )
					y++;
			}
			else if ( op == 'L' )
			{
				a = 3;
				if ( x-1 >= 0 && map[y][x-1] == '.' )
					x--;
			}
			else if ( op == 'R' )
			{
				a = 4;
				if ( x+1 < W && map[y][x+1] == '.' )
					x++;
			}
			else if ( op == 'S' )
			{
				int nx = x;
				int ny = y;
				while (1)
				{
					nx = ((a==3)?nx-1:(a==4?nx+1:nx));
					ny = ((a==1)?ny-1:(a==2?ny+1:ny));
					if ( nx < 0 || nx >= W || ny < 0 || ny >= H )
						break;

					if ( map[ny][nx] == '#' )
						break;
					if ( map[ny][nx] == '*' )
					{
						map[ny][nx] = '.';
						break;
					}
				}
			}

		}

		map[y][x] = ((a==1)?'^':(a==2)?'v':(a==3)?'<':(a==4)?'>':' ');

		// oÍ
		for ( int i = 0; i < H; i++ )
		{
			for ( int j = 0; j < W; j++ )
			{
				cout << map[i][j];
			}
			cout << endl;
		}

		if ( lpc < T-1 )
			cout << endl;

	} // while
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;


int main(){
    int h, w, n;
    cin >> h >> w >> n;
    vector<string> in(h);
    for(int i = 0; i < h; i++) cin >> in[i];
    for(int p = 0; p < h; p++) for(int q = 0; q < w-1; q++){
        vector<string> s = in;
        if(s[p][q] == s[p][q+1])continue;
        swap(s[p][q], s[p][q+1]);
        while(1){//落下->消滅
            for(int j = 0; j < w; j++){
                int cnt = 0;
                for(int i = h-1; i >= 0; i--){
                    if(s[i][j] == '.') cnt++;
                    else if(cnt) swap(s[i][j], s[i+cnt][j]); // 落下
                }
            }

            int v[30][30] = {};
            for(int i = 0; i < h; i++) for(int j = 0; j < w-n+1; j++){
                if(s[i][j] != '.' && s[i][j] == s[i][j+1]){
                    int t = j+1;
                    while(t < w && s[i][j] == s[i][t])t++;
                    if(t-j >= n){
                        for(int k = j; k < t; k++)v[i][k]++;
                    }
                    j = t-1;
                }
            }
            for(int j = 0; j < w; j++) for(int i = 0; i < h-n+1; i++){
                if(s[i][j] != '.' && s[i][j] == s[i+1][j]){
                    int t = i+1;
                    while(t < h && s[i][j] == s[t][j])t++;
                    if(t-i >= n){
                        for(int k = i; k < t; k++)v[k][j]++;
                    }
                    i = t-1;
                }
            }

            int cnt = 0;
            for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) if(v[i][j]){
                cnt++;
                s[i][j] = '.';
            }

            if(cnt == 0) break;

        }

        int num = 0;
        for(int j = 0; j < w; j++) if(s[h-1][j] != '.') num++;
        if(num == 0){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}



Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, m;
	cin >>n>> m;
	vector<long long> d(n,0);
	int ba;
	cin >> ba;
	ba--;
	for (int i = 1; i < m; i++) {
		int a;
		cin >> a;
		a--;
		d[min(ba, a)]++;
		d[max(ba, a)]--;
		ba = a;
	}
	vector<long long> ti(n - 1);
	ti[0] = d[0];
	for (int i = 1; i < n - 1; i++) {
		ti[i] = ti[i - 1] + d[i];
	}
	long long ans = 0;
	for (int i = 0; i < n - 1; i++) {
		long long a, b, c;
		cin >> a >> b >> c;
		ans = ans+min(a*ti[i], b*ti[i] + c);
	}
	cout << ans << endl;
}



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

#define SRVGCNT 100
#define SKWRCNT (2 * SRVGCNT)

int sv, sc, sl[SKWRCNT];
int ic;

void read(void)
{
    int i;
    
    if (scanf("%d", &sv) != 1)
        exit(EXIT_FAILURE);
    for (sc = 2 * sv, i = 0; i < sc; ++i)
        if (scanf("%d", &sl[i]) != 1)
            exit(EXIT_FAILURE);
}

int comp(const void *v0, const void *v1)
{
    int i0, i1;
    
    i0 = *(int *)v0, i1 = *(int *)v1;
    return (i0 < i1) ? -1 : ((i0 > i1) ? +1 : 0);
}

int min(int a, int b)
{
    return (a < b) ? a : b;
}

void exec(void)
{
    int i, j;
    
    qsort(sl, sc, sizeof sl[0], comp);
    for (ic = 0, j = 0, i = 0; i < sv; ++i, j += 2)
        ic += sl[j];
}

void print(void)
{
    printf("%d\n", ic);
}

void repl(void)
{
    read();
    exec();
    print();
}

int main(void)
{
    repl();
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

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

typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  string n;
  cin >> n;

  int digits = 0;
  rep(i, n.size()) {
      digits += n[i] - '0';
  }
  ll orig = stoll(n);
  string ans = (orig%digits == 0) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
  int N;
  cin >> N;
  vector<ll>A(N);
  for (int i = 0; i < N; i ++) cin >> A[i];
  sort(A.begin(), A.end());
  ll ans = 0;
  ll lef = A[0];
  ll rig = A[0];
  ll mi = 1;
  ll ma = N - 1;
  ll ans_ = 0;
  for (int i = 1; i < N; i ++) {
    if (i % 2) {
      ll kj = A[ma];
      ans += kj - min(lef, rig);
      if (lef < rig) lef = kj;
      else rig = kj;
      ma --;
    }
    else {
      ll kj = A[mi];
      ans += max(lef, rig) - kj;
      if (rig > lef) rig = kj;
      else lef = kj;
      mi ++;
    }
  }
  mi = 0;
  ma = N - 2;
  lef = A[N - 1];
  rig = A[N - 1];
  for (int i = 1; i < N; i ++) {
    if (i % 2 == 0) {
      ll kj = A[ma];
      ans_ += kj - min(lef, rig);
      if (lef < rig) lef = kj;
      else rig = kj;
      ma --;
    }
    else {
      ll kj = A[mi];
      ans_ += max(lef, rig) - kj;
      if (rig > lef) rig = kj;
      else lef = kj;
      mi ++;
    }
  }
  cout << max(ans, ans_) << endl;
}


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

int main() { //a
    int n;
    cin >> n;
    string s = to_string(n);
    for(int i = 0; i < 3; i++) {
        if(s.at(i) == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

int main(void){
  int A,B,C,D,P;
  cin>>A;
  cin>>B;
  cin>>C;
  cin>>D;
  cin>>P;
  int X,Y;
  X=P*A;
  if(C>=P){
    Y=B;
  }
  else{
    Y=B+D*(P-C);
  }
  if(X<=Y){
    cout<<X<<endl;
  }
  else{
    cout<<Y<<endl;
  }
}



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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

/*
cin.tie(0);
ios::sync_with_stdio(false);
*/
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, a, b, i;
	cin >> n >> a >> b;
	vi t(n);
	for (i = 0; i < n; i++) {
		cin >> t[i];
	}
	ll ans = 0;
	for (i = 0; i < n; i++) {
		if (t[i] < a || t[i] >= b) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const ll mod = 998244353;

ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
ll rev2 = (mod+1)/2;
void FWT(ll *a,int n){
    for (int d = 1 ; d < n ; d <<= 1){
        for (int m = d << 1 ,i = 0;i < n ; i+=m){
            for (int j = 0 ; j < d ; j++){
                int x = a[i+j],y = a[i+j+d];
                //xor;
                a[i+j] = (x+y) % mod,a[i+j+d] = (x-y+mod)%mod;
            }
        }
    }
}
void UFWT(ll *a,int n){
    for (int d = 1 ; d < n ; d<<=1){
        for (int m = d <<1, i = 0; i < n; i+=m){
            for (int j = 0 ; j < d ; j++){
                int x = a[i+j],y = a[i+j+d];
                //xor
                a[i+j] = 1LL*(x+y)*rev2%mod,a[i+j+d] = (1LL*(x-y)*rev2%mod + mod) % mod;
            }
        }
    }
}
int n;
ll p[(1<<18)];
ll v[(1<<18)];
ll hadamard_ans[(1<<18)];
int main(){
	scanf("%d",&n); n = (1<<n);
	ll sum = 0;
	rep(i,n){
		scanf("%lld",&p[i]);
		sum += p[i];
	}
	ll rev = modpow(sum,mod-2);
	rep(i,n){
		p[i] = p[i] * rev % mod;
		if(i == 0) p[i] --;
	}
	
	//2^N-1, -1 ... -1
	memset(v,-1,sizeof(v));
	v[0] = n-1;
	
	FWT(p,n);
	FWT(v,n);
	ll hoge = 0;
	rep(i,n){
		hadamard_ans[i] = v[i] * modpow(p[i],mod-2)%mod;
		hoge -= hadamard_ans[i];
		//cout << i << " " << hadamard_ans[i] << endl;
	}
	hadamard_ans[0] = (hoge%mod+mod)%mod;
	UFWT(hadamard_ans,n);
	rep(i,n){
		printf("%lld\n", (hadamard_ans[i]%mod+mod)%mod );
	}
}

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


int main(){
   char S[11],T[11],U[11];
   int a,b;
   cin>>S>>T>>a>>b>>U;
   if(strlen(S)==strlen(U)){
   for(int i=0;i<strlen(U);i++){
       if(S[i]!=U[i]){b--;break;}
       if(i==strlen(U)-1)a--;
   }
   }
   else b--;
   printf("%d %d\n",a,b);
}

Measured memory_bytes: 3700
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ame = sc.nextInt();
		int[] arr = new int[N];

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

		int cnt = 0;
		for (int i = 0; i < arr.length; i++) {
			ame -= arr[i];
			if (ame >= 0) {
				cnt++;
			} else {
				break;
			}
		}

		if (ame > 0) {
			cnt--;
		}
		System.out.println(cnt);
	}

	public static int[] sort(int[] arr) {

		int temp = 0;
		for (int i = 0; i < arr.length; i++) {
			for (int j = arr.length - 1; j > i; j--) {
				if (arr[i] > arr[j]) {
					temp = arr[i];
					arr[i] = arr[j];
					arr[j] = temp;
				}
			}
		}
		return arr;
	}
}

Measured memory_bytes: 23252
# https://onlinejudge.u-aizu.ac.jp/problems/2013


def to_my_time_unit(time_str: str):
    hour, minute, second = map(int, time_str.split(sep=':'))
    return int(hour) * 60*60 + int(minute) * 60 + int(second)


def solve(n):
    A = [0 for _ in range(24 * 60 * 60+1)]
    for _ in range(n):
        start_str, end_str = input().split()
        start = to_my_time_unit(start_str)
        end = to_my_time_unit(end_str)
        A[start] += 1
        A[end] -= 1
    B = [0 for _ in range(24 * 60 * 60+1)]
    tmp = 0
    for i in range(24 * 60 * 60+1):
        tmp += A[i]
        B[i] = tmp
    print(max(B))


if __name__ == "__main__":
    while True:
        n = int(input())
        if n == 0:
            break
        solve(n)



Measured memory_bytes: 9612
import sys

if(__name__ == "__main__"):

    N = int( input().strip() )
    sums = 0
    for i in range(1, N+1):
        sums += i * (N-i+1)
    for i in range(N-1):
        p, q = map( int, input().strip().split() )
        if(p > q):
            p, q = q, p #小さい方をpに
        sums -= p * (N-q+1)
    print(sums)


Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,z,x,y,fa[N];
inline int find(int x)
{
    while(x!=fa[x]) x=fa[x]=fa[fa[x]];
    return x;
}
int num[N];
int ans;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;++i) 
    	fa[i]=i;
    while(m--)
    {
        cin>>x>>y;
        int a=find(x),b=find(y);
        	fa[a]=b;
    }
    for (int i=1;i<=n;i++) num[find(i)]++;
    for (int i=1;i<=n;i++) ans=max(ans,num[i]);
    cout<<ans<<endl;
}

Measured memory_bytes: 5024
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
ll a[1000],x[1010];
ll n,ans=0x7f7f7f7f;
ll _abs(ll a,ll b){
	if(a>b)return a-b;
	else return b-a;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],x[i]=x[i-1]+a[i];
//	for(int i=1;i<=n;i++)cout<<x[i]<<' ';cout<<'\n';
	for(int i=1;i<n;i++)ans=min(_abs(x[n]-x[i],x[i]),ans);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
list=input().split()
sum=0
for i in range(n):
 sum+=int(list[i])
sum=sum*sum
sum2=0
for i in range(n):
 sum2+=int(list[i])*int(list[i])
sum-=sum2
sum//=2
sum%=1000000007
print(int(sum))

Measured memory_bytes: 25064
#include<bits/stdc++.h>
using namespace std;
int main() {
double a,b;
	cin>>a;
         cin>>b;
	if(a>b){
		cout<<"GREATER";
	}
	else  {
		if(a<b){
			cout<<"LESS";
		}
		else
		{
			cout<<"EQUAL";
		}
}
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#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 mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  map<char, ll> cnt;
  cnt['M'] = 0; cnt['A'] = 0; cnt['R'] = 0; cnt['C'] = 0; cnt['H'] = 0;
  int n;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    cnt[s[0]]++;
  }

  ll ans = 0;
  char c[] = {'M', 'A', 'R', 'C', 'H'};
  for(int i=0; i<3; i++) {
    for(int j=i+1; j<4; j++) {
      for(int k=j+1; k<5; k++) {
        ans += cnt[c[i]] * cnt[c[j]] * cnt[c[k]];
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    cout << (s == "abc" ? "Yes" : "No") << endl;
}

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


using namespace std;

int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n%2!=0){
        cout << "No" << endl;
        return 0;
    }
    string t = s.substr(0, n / 2);
    if(s == t+t){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

class bipartite_matching {
public:
    int n;
    std::vector<std::vector<int>> g;
    std::vector<int> match;

    bipartite_matching(int n_) : n(n_), g(n_), match(n_), used(n_) {}

    void add_edge(int u, int v) {
        g[u].push_back(v);
        g[v].push_back(u);
    }

    int maximum_matching(void) {
        int res = 0;
        fill(begin(match), end(match), -1);
        for (int v = 0; v < n; ++v) {
            if (match[v] == -1) {
                fill(begin(used), end(used), false);
                if (dfs(v)) res++;
            }
        }
        return res;
    }

private:
    std::vector<int> used;
    bool dfs(int v) {
        used[v] = true;
        for (int u : g[v]) {
            int w = match[u];
            if (w == -1 || (!used[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }
};


int main () {
    ll h, w;
    while (cin >> h >> w) {
        ll ans;
        if (h > 1 && w > 1) {
            ans = h*w - (2*(h+w) - 4);
        } else if (h >= 2 || w >= 2) {
            ans = max(h, w) - 2;
        } else {
            ans = 1;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <queue>

using namespace std;

const int INFTY=1<<29;

void bfs(vector<string>& grid,int r,int c,vector<vector<int> >& d)
{
	int h=grid.size(),w=grid[0].size();
	queue<pair<int,int> > q;
	d[r][c]=0;
	q.push(make_pair(r,c));
	while(q.size()){
		int ci=q.front().first,cj=q.front().second;
		q.pop();
		int di[]={-1,1,0,0},dj[]={0,0,-1,1};
		for(int k=0;k<4;k++){
			int ni=ci+di[k],nj=cj+dj[k];
			if(ni<0 || h<=ni || nj<0 || w<=nj)
				continue;
			if(d[ni][nj]!=INFTY || grid[ni][nj]=='x')
				continue;
			if(0<=ni && ni<h && 0<=nj && nj<w && d[ni][nj]==INFTY){
				d[ni][nj]=d[ci][cj]+1;
				q.push(make_pair(ni,nj));
			}
		}
	}
}

int main()
{
	for(int w,h;cin>>w>>h,w|h;){
		vector<string> grid(h);
		for(int i=0;i<h;i++)
			cin>>grid[i];
		vector<int> rs,cs;
		for(int i=0;i<h;i++)
			for(int j=0;j<w;j++){
				if(grid[i][j]=='o'){
					rs.insert(rs.begin(),i);
					cs.insert(cs.begin(),j);
				}
				else if(grid[i][j]=='*'){
					rs.push_back(i);
					cs.push_back(j);
				}
			}
		
		int n=rs.size();
		vector<vector<int> > dist(n,vector<int>(n));
		for(int i=0;i<n;i++){
			vector<vector<int> > d(h,vector<int>(w,INFTY));
			bfs(grid,rs[i],cs[i],d);
			for(int j=0;j<n;j++)
				dist[i][j]=d[rs[j]][cs[j]];
		}
		
		vector<vector<int> > dp(1<<n,vector<int>(n,INFTY));
		dp[1][0]=0;
		for(int i=1;i<(1<<n);i++){
			for(int j=0;j<n;j++)
				for(int k=0;k<n;k++){
					if(!(i&1<<j) || (i&1<<k))
						continue;
					dp[i|1<<k][k]=min(dp[i|1<<k][k],dp[i][j]+dist[j][k]);
				}
		}
		
		int res=INFTY;
		for(int i=0;i<n;i++)
			res=min(res,dp.back()[i]);
		cout<<(res==INFTY?-1:res)<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 992
#include <iostream>
using namespace std;
int main() {
    long long i, min, max, sum, n, x;
    cin >> n;
    min = 1000001;
    max = -1000001;
    sum = 0;
    for (i = 1; i <= n; ++i) {
        cin >> x;
        if (x > max) 
            max = x;
        if (x < min)
            min = x;
        sum = sum + x;
    }
    cout << min << " " << max << " " << sum << "\n";
}


Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



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

  string s, t;
  cin >> s >> t;

  cout << t+s << "\n";
  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string S;cin>>S;
    int N=S.size();
    bool ok=true;
    rep(i,N-1)if(S[N-1-i-1]!=S[i])ok=false;
    if(S[0]!='1'||S[N-1]=='1')ok=false;
    if(!ok){
        cout<<-1<<endl;
        return 0;
    }

    int n=1;
    for(int i=2;i<=N;i++){
        if(i!=N&&S[i-1]=='0')continue;
        cout<<n<<" "<<i<<endl;
        while(true){
            n++;
            if(n==i)break;
            cout<<n<<" "<<i<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1664
import sys
input = lambda: sys.stdin.readline().rstrip()
from decimal import *

N, K = map(int, input().split())

x = Decimal("0.5")
ans = 0
for i in range(1, N+1):
    p = 1
    while i < K:
        i *= 2
        p *= x
    ans += p   
ans /= N
print(ans)

Measured memory_bytes: 153000
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	String s= sc.next();
      	String t=sc.next();
      	int ans=0;
      	for (int i = 0; i < s.length(); i++) {
			if((s.charAt(i))!=(t.charAt(i))){ans++;}
		}
      	System.out.println(""+(ans));
}
}

Measured memory_bytes: 42344
/*@authored by: Subham Pratap*/

/* ************************************************************************************************************************** */

#include <bits/stdc++.h>
using namespace std;
#define PKMKB ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define lli long long int
#define ull unsigned long long
#define INT_MAX 2147483647
#define all(a) begin(a),end(a)
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define MOD 1000000007

/* Look Bitch, Don’t mess with any of the code from here
   to the end of the function. None of us understand it,
   and any change seems to break the program in ways
   we don’t fuckin' understand. */

  int main()
  {
    PKMKB;
    lli n;
    cin >> n ;
   // lli a[n+10];
    vector<lli>v,a;
    for(lli i=0;i<n;i++)
    {
        lli k;
        cin >> k;
        v.pb(k);
        a.pb(k);
    }
    sort(all(v));
    for(lli i=0;i<n;i++)
    {
        if(a[i]!=v[n-1])
            cout << v[n-1] << endl;
        else
            cout << v[n-2] << endl;
    }
    return 0;
}


Measured memory_bytes: 4964
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
const int N = 1e5 + 5;

int n, m;
pair <int, int> x[N];

set <int> day;
ll ans;

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

    cin >> n >> m;
    for(int i = 1; i <= n; i++)
    {
        cin >> x[i].second >> x[i].first;
        x[i].second = m - x[i].second;
    }
    for(int i = 0; i < m; i++)
        day.insert(-i);

    sort(x + 1, x + n + 1);
    for(int i = n; i >= 1; i--)
    {
        set <int>::iterator it = day.lower_bound(-x[i].second);
        if(it == day.end())
            continue;
        ans += x[i].first;
        day.erase(it);
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

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

int main(){
  long n,a,b;
  cin >> n >> a >> b;
  
  vector<long> x(n);
  
  rep(i,n) cin >> x[i];
  
  long res=0;
  rep(i,n-1) res+=min(a*(x[i+1]-x[i]),b);
  
  cout << res << endl;
  
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
ll N, M, V, P;
vector<ll> A, S;

int main(){
    cin >> N >> M >> V >> P;
    A.resize(N);
    rep(i, 0, N) cin >> A[i];
    sort(all(A));
    ll lb = -1, ub = N - 1;
    while(ub-lb > 1){
        ll mid = (lb + ub) / 2;
        vector<ll> b;
        rep(i, 0, N) if(mid != i) b.push_back(A[i]);
        ll base = A[mid] + M;
        ll ok = 0;
        reverse(all(b));
        bool bad = 0;
        rep(i, 0, b.size()){
            if(i < P - 1) ok += M;
            else if(base >= b[i]) ok += min(M, base-b[i]);
            else bad = 1;
        }
        if(bad) lb = mid;
        else if(ok >= M * (V-1)) ub = mid;
        else lb = mid;
    }
    cout << N - ub << endl;
}

Measured memory_bytes: 2896
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	BigInteger[][] base = new BigInteger[2][2];
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		helper(n);
	}

	private static void helper(int n) {
		// TODO Auto-generated method stub
		for (int i = 1; i <= 3500; i++) {
			for (int j = 1; j <= 3500; j++) {

				long up = 4*(long)i * (long)j -(long) j * (long)n - (long)i * (long)n;
				long down = (long)i * (long)j * (long)n;
				if(i==3498&&j==3498){
					System.out.println(up);
					System.out.println(down);
					System.out.println(down/up);
				}
				if (up>0&&down % up==0) {
					System.out.println("" + i + " " + j + " " + down/up);
					return;
				}

			}
		}
	}

	private BigInteger[][] matrixMult(BigInteger[][] leftmatrix, BigInteger[][] rightMatrix) {
		// TODO Auto-generated method stub
		BigInteger[][] res = new BigInteger[2][2];
		res[0][0] = leftmatrix[0][0].multiply(rightMatrix[0][0]).add(leftmatrix[0][1].multiply(rightMatrix[1][0]));
		res[0][1] = leftmatrix[0][0].multiply(rightMatrix[0][1]).add(leftmatrix[0][1].multiply(rightMatrix[1][1]));
		res[1][0] = leftmatrix[1][0].multiply(rightMatrix[0][0]).add(leftmatrix[1][1].multiply(rightMatrix[1][0]));
		res[1][1] = leftmatrix[1][0].multiply(rightMatrix[0][1]).add(leftmatrix[1][1].multiply(rightMatrix[1][1]));
		return res;
	}

	public BigInteger[][] fib(int n) {
		if ((n) <= 1)
			return base;
		BigInteger[][] res = ((n) % 2 == 1 ? fib((n - 1) / 2) : fib(n / 2));
		res = matrixMult(res, res);
		if ((n) % 2 == 1)
			res = matrixMult(res, base);
		return res;
	}

}


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

int main(){
	int a,b;
	cin>>a>>b;
	int flag=min(a*25/2,b*10);
	while(flag!=0&&flag<=1250){
		double aa=0.08,bb=0.1;
		int c=flag*aa;
		int d=flag*bb;
		//cout<<c<<" "<<d;
		if(c!=a||d!=b){
		
		flag++;
		}
		if(c==a&&d==b){
			cout<<flag<<endl;
			
			break;
		}
		if(flag==1250&&c!=d){
			cout<<-1<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.math.*

fun main(args: Array<String>) {
    var (D, G) = readInputLine().split(" ").map{it.toInt()}
    G /= 100
    
    // (問題数, ボーナス)
    val problems = Array(D, {Pair(0, 0)})
    
    for (i in 0 until D) {
        val tmp = readInputLine().split(" ").map{it.toInt()}
        problems[i] = Pair(tmp[0], tmp[1] / 100)
    }

    var ans = Int.MAX_VALUE
    
    for (i in 0 until (1 shl D)) {
        var score = 0
        var cnt = 0
        for (j in 0 until D) {
            if (i and (1 shl j) != 0) {
                score += problems[j].first * (j + 1) + problems[j].second
                cnt += problems[j].first
            }
        }

        if (score >= G) {
            ans = Math.min(ans, cnt)
            continue
        }
        
        for (j in D - 1 downTo 0) {
            if (i and (1 shl j) != 0) {
                continue
            }
            for (k in 1 until problems[j].first) {
                score += j + 1
                cnt++
                if (score >= G) {
                    break
                }
            }
            if (score >= G) {
                break
            }
        }
        
        if (score >= G) {
            ans = Math.min(ans, cnt)
        }
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37992
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

int main(){
  int in(n);
  char list_input(a, n);
  set<char> s(a, a + n);
  out(s.size() == 3 ? "Three" : "Four");
}


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

int main(){
	
	
	string str;
	int i;
	
	while(cin>>str){
		int a[27]={0};
		
		for(i=0;i<str.length();i++)
			{
				a[str[i]-'a']++;
			}
		
		for(i=0;i<26;i++){
		
			if(a[i]%2){
				cout <<"No"<<endl;
				break;
			}
		}
		if(i==26)
			cout<<"Yes"<<endl;
	}
	
	
	return 0;
}

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

#define STRING(str) #str
#define ll long long

template <typename T >
void print_vec_1d(vector<T> x, string name) {
	cout << name << endl;
	cout << "[ ";
	for (int i=0;i<x.size();i++) {
		cout << x[i];
		if (i != x.size()-1) cout << ", ";
		else cout << " ]" << endl;
	}
}

int main() {
	int N;
	cin >> N;

	ll ans = 0LL;
	for (int A=1;A<N;A++) {
		ans += (N-1)/A;
	}
	cout << ans << endl;
}

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

using namespace std;

int main() {
  int64_t N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  if (A > B) swap(A, B);

  int l = 0, r = N;
  for (int i = 0; i < 100; i++) {
    int upCount = (l + r) / 2;
    int downCount = N - 1 - upCount;
    int64_t small = A + C * upCount - D * downCount;
    int64_t large = A + D * upCount - C * downCount;
    if (small <= B and B <= large) {
      printf("YES\n");
      return 0;
    } else if (B < small) {
      r = upCount;
    } else {
      l = upCount;
    }
  }

  printf("NO\n");

  return 0;
}


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

int main() {
  double n;
  cin >> n;
  vector<double> a(n);
  double sum = 0;
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  double k = sum / n;
  double dis = -10000;
  int ans = -1;
  for(int i = 0; i < n; i++){
    double now = abs(k - a.at(i)), old = abs(k - dis);
    if(now < old) ans = i, dis = a.at(i);
  }
  
  cout << ans << endl;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

ll dp[4020][4020];

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

    string S;
    cin >> S;
    ll N = S.size();

    dp[0][0] = 1;

    ll R=0, B=0;
    REP(i, 2*N){
    	if(i<N){
    		if(S[i] == '0') R += 2;
    		else if(S[i] == '2') B += 2;
    		else R++, B++;
    	}


    	REP(j, i+1){
    		ll idx = j;
    		ll jdx = i-j;
    		if(idx<R){
    			dp[idx+1][jdx] += dp[idx][jdx]; 
    			dp[idx+1][jdx] %= mod;
    		}
    		if(jdx<B){
    			dp[idx][jdx+1] += dp[idx][jdx]; 
    			dp[idx][jdx+1] %= mod;	
    		}
    	}
    }

    ll res = 0;
    REP(i, 2*N+1){
    	res += dp[i][2*N-i];
    	res %= mod;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 125312
using System;
using System.Linq;
class MainClass {
  public static void Main (string[] args) {
    string n = Console.ReadLine();
    long[] inputs = Console.ReadLine().Split(' ').Select<string,long>(long.Parse).ToArray();
    long totalHeight = 0;
    long max = 0;
    for(long i = 0; i < inputs.Length; i++){
      if(max >= inputs[i]){
        totalHeight += max-inputs[i];
      }else{
        max = inputs[i];
      }
    } 
    Console.WriteLine(totalHeight);
  }
}

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

using namespace std;

int main()
{
    long long int t;
    cin>>t;
    int a,b;
    int flag=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%t==0)
        {
            cout<<"OK";
            flag=1;
            break;

        }
    }
    if(flag!=1)
    {
        cout<<"NG";
    }
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int n = ReadInt();
        int[] a = ReadInt(n).ToArray();
        int xor = 0;
        foreach (var x in a)
        {
            xor ^= x;
        }
        foreach (var x in a)
        {
            Console.WriteLine(x ^ xor);
        }
    }
}


static class Scanner
{
    static Queue<string> que = new Queue<string>();

    public static string Read()
    {
        if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s);
        return que.Dequeue();
    }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());

    public static IEnumerable<string> Read(long n)
    {
        for (long i = 0; i < n; i++) yield return Read();
    }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}

Measured memory_bytes: 65980
#include <bits/stdc++.h>
using namespace std;
vector<vector<char>> conv1(string S){
  int N = S.size();
  vector<vector<char>> A(1);
  for (int i = 0; i < N; i++){
    if (S[i] == '/'){
      A.push_back(vector<char>());
    } else if (S[i] == 'b'){
      A.back().push_back('b');
    } else {
      int cnt = S[i] - '0';
      for (int j = 0; j < cnt; j++){
        A.back().push_back('.');
      }
    }
  }
  return A;
}
string conv2(vector<vector<char>> A){
  int H = A.size();
  int W = A[0].size();
  string S;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (A[i][j] == 'b'){
        S += 'b';
      } else {
        if (j == 0){
          S += '1';
        } else if (A[i][j - 1] == 'b'){
          S += '1';
        } else {
          S.back()++;
        }
      }
    }
    if (i < H - 1){
      S += '/';
    }
  }
  return S;
}
int main(){
  while (1){
    string S;
    cin >> S;
    if (S == "#"){
      break;
    }
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<vector<char>> A = conv1(S);
    A[a - 1][b - 1] = '.';
    A[c - 1][d - 1] = 'b';
    cout << conv2(A) << endl;
  }
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define speed ios::sync_with_stdio(false)
#define pb push_back
#define mp make_pair
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) (x).begin(), (x).end()
#define uint usigned int
typedef vector <pair<ll,ll>> vi;
ll mod=1918;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n,m,k,a,b,i,x=101,p,y,j,z=0,ans=0,sum=0,c=0;
	cin>>a>>b>>c;
	if(a==b && b==c){
	    cout<<"Yes";
	}
	else cout<<"No";
//	cout<<ans;
    return 0; 
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int binary(long long Arr[],long long left,long long right,long long target)
{
    while(left<=right)
    {
        long long mid=int((left+right)/2);
        if(Arr[mid]==target)
            return mid;
        else if(Arr[mid]<target)
            left=mid+1;
        else
            right=mid-1;
    }
    return right;
}
int main()
{
    int N,M;
    long long X;
    cin>>N>>M>>X;
    long long ArrA[N+1]={0};
    long long ArrB[M+1]={0};
    int bookA=0,bookB=0;
    for (int i=1;i<=N;i++)
    {
        long long a;
        cin>>a;
        ArrA[i]=ArrA[i-1]+a;
    }
    for (int i=1;i<=M;i++)
    {
        long long b;
        cin>>b;
        ArrB[i]=ArrB[i-1]+b;
    }
    int total=0;
    for(int i=0;i<=N;i++)
    {
        long long timeB=X-ArrA[i];
        if(timeB<0)
        {
            continue;
        }
        int tempB=binary(ArrB,0,M,timeB);
        total=max(total,tempB+i);
    }
    cout<<total<<endl;
}

Measured memory_bytes: 6716