akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <stack>

#define MAX_N 100000

using namespace std;

typedef struct data{
	int kind;
	int num;
	data(){}
	data(int _kind,int _num){
		kind = _kind;
		num = _num;
	}

}data;


stack<data> stk;

int N;
int field[MAX_N + 1];

void add(int kind){
	if(stk.empty()){
		stk.push(data(kind,1));
		return ;
	}
	data d = stk.top();
	if(d.kind == kind){
		d.num++;
		stk.pop();
		stk.push(d);
	}
	else{
		stk.push(data(kind,1));
	}
	return ;
}

void query(int kind){
	if(stk.empty()){
		stk.push(data(kind,1));
		return ;
	}
	data d = stk.top();stk.pop();
	if(d.kind == kind){
		d.num++;
		stk.push(d);
	}
	else{
		d.kind = kind;
		d.num++;
		if(!stk.empty()){
			data d2 = stk.top();stk.pop();
			d.num += d2.num;
		}
		stk.push(d);
	}
	return ;
}

int main(){

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

		for(int i = 1;i <= N;i++){
			scanf("%d",field + i);
		}
		for(int i = 1;i <= N;i++){
			if(i % 2 == 1){
				add(field[i]);
			}
			else{
				query(field[i]);
			}
			//printf("###%d:::%d\n",stk.top().kind,stk.top().num);
		}
		
		int ans = 0;
		while(!stk.empty()){
			data d = stk.top();stk.pop();
			if(d.kind == 0) ans += d.num;
		}

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

	return 0;
}

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

typedef long long ll;

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	char a;
	cin >> a;
	if (a == 'a' || a == 'e' ||a == 'i' ||a == 'o' ||a == 'u') {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
	
	return 0;
}

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

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

    ll ans = 1;
    rep(i, n)
        ans = (ans * (i + 1)) % MOD;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
mojilist = []
ans = "No"
for x in range(n):
    moji = input()
    if moji in mojilist:
        break
    mojilist.append((moji))

if len(mojilist) == n:
    mae = list(mojilist[0])
    for x in range(1, n):
        tugi = list(mojilist[x])
        if mae[-1] != tugi[0]:
            break
        else:
            mae = tugi
        if x == n-1:
            ans = "Yes"

print(ans)
        

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

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

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

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

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

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

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

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

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

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

/*

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

  pow(a,b)=aのb乗

  */

bool ABC(int n) {
	if (0 < n && n < 13) {
		return true;
	}
	else {
		return false;
	}
}

int main(void) {

	int n;
	cin >> n;
	llint sum = 0;

	rop(i, n) {
		rop(j, n) {
			rop(k, n) {
				sum += GCD(i, GCD(j, k));
			}
		}
	}
	cout << sum << rt;

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

Measured memory_bytes: 3640
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()
    println(problem150b(n, s))
}

fun problem150b(n: Int, s: String): Int {
    var count = 0
    for (i in 0 until n - 2) {
        if ((s[i].toString() + s[i + 1] + s[i + 2]) == "ABC") count++
    }
    return count
}

Measured memory_bytes: 31260
# include "bits/stdc++.h"
 
using namespace std;
 
#define endl "\n"
typedef long long int ll;
#define f first
#define s second
 
inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}
 
//DEBUG
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
 
ll INF = 1e10;
int MOD = 1e9+7;

int main(){
    fastio();


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

    ll mv = 0;
    for(int i = 1; i < n; ++i){
    	if(a[i - 1] > a[i]){
    		mv += (a[i - 1] - a[i]);
    		a[i] = a[i - 1];
    	}
    }

    cout << mv;
    return 0;
}

/*

*/

Measured memory_bytes: 4448
//#pragma GCC optimize("trapv")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;
const int maxn = 2e6 + 55, mod = 1000000007;
int fact[maxn], inv[maxn];
void setup() {
	for(int i = 0; i < maxn; i++) {
		if(i < 2) inv[i] = fact[i] = 1;
		else inv[i] = mod - inv[mod%i]*1ll*(mod/i)%mod;
	}
	for(int i = 2; i < maxn; i++) fact[i] = fact[i-1]*1ll*i%mod, inv[i] = inv[i-1]*1ll*inv[i]%mod;
}
int nck(int n, int k) {
	if(n < k) return 0;
	return (fact[n]*1ll*inv[k]%mod)*inv[n-k]%mod;
}
int get(int l, int r, int t) {
	return (mod + nck(r+t+1, t+1) - nck(l+t, t+1))%mod;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	setup();
	int r1, r2, c1, c2, ans = 0;
	cin >> r1 >> c1 >> r2 >> c2;
	for(int x = r1; x <= r2; x++) {
		ans = (ans + get(c1, c2, x))%mod;
	}
	cout << ans;
}


Measured memory_bytes: 15872
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll pow5(ll a) {
    return a * a * a * a * a;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x; cin >> x;
    vll ppp5;
    set<ll> ppp5s;
    for (ll i = 0; i <= 4000; i++) {
        ppp5.push_back(pow5(i));
        ppp5s.insert(pow5(i));
    }

    for (int i = 0; i < (int)ppp5.size(); i++) {
        ll b5 = ppp5[i] - x;
        if (ppp5s.find(b5) != ppp5s.end()) {
            ll tb = lower_bound(ALL(ppp5), b5) - ppp5.begin();
            cout << i << ' ' << tb << '\n';
            break;
        } else if (ppp5s.find(-b5) != ppp5s.end()) {
            ll tb = lower_bound(ALL(ppp5), -b5) - ppp5.begin();
            cout << i << ' ' << -tb << '\n';
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3876
from itertools import  permutations

N,M = map(int,input().split())
d = [list(map(int,input().split())) for i in range(M)]

A = []
for i in range(2,N+1):
    A.append(i)

def f(m,n):  #(m,n)の組が結ばれているか
    if m > n:
        l = m
        m = n
        n = l
    for i in range(M):
        if d[i][0] == m and d[i][1] == n:
            return 1
    else:
        return 0

ans = 0
for i in permutations(A,N-1):
    for j in range(N-1):
        if j == 0:
            if f(1,i[0]) == 1:
                continue
            else:
                break
        else:
            if f(i[j-1],i[j]) == 1:
                continue
            else:
                break
    else:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    string s;
    cin >> s;
    vector<string> a={"Sunny","Cloudy","Rainy","Sunny"};
    rep(i,3){
        if(s==a.at(i)){
            cout << a.at(i+1) << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

static const int MAX = 5005;

/******* c++14 don't include *******/

template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }

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

ll arr[MAX][MAX];

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    ll n;
    string s;
    cin >> n;
    cin >> s;
    
    rep(i, n+2){
        rep(j, n+2){
            arr[i][j] = 0;
        }
    }
    
    ll ma = 0;
    rep(i, n){
        rep2(j, i+1, n){
            if(s[i] == s[j]){
                arr[i+1][j+1] = arr[i][j] +1;
                ll len = arr[i+1][j+1];
                if(len <= j-i)ma = max(ma, len);
            }
        }
    }
    
    cout << ma << endl;
    
    return 0;
}


Measured memory_bytes: 195840
n,a=map(int,raw_input().split())
ans=10**12+5
for eat_num in xrange(45):
    if 2**(eat_num-1)>n:break
    time=eat_num*a
    t=eat_num+1
    l=0;r=n
    while r-l>1:
        m=(r+l)/2
        if m**t>=n:r=m
        else:l=m
    for j in xrange(t+1):
        if r**(t-j) * (r-1)**j < n:break
        surplus=j
    ans=min(ans,time+r*(t-surplus)+(r-1)*surplus)
print ans

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
std::vector<int> G[10100];
int C[10100], D[10100];

void dfs(int v, int p, int &i){
    D[v] = C[i];
    i -= 1;
    
    for(int w : G[v]){
        if(w == p){
            continue;
        }

        dfs(w, v, i);
    }
}

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

    std::cin >> N;

    for(int i=0;i<N-1;++i){
        int A, B;
        std::cin >> A >> B;

        A -= 1;
        B -= 1;

        G[A].emplace_back(B);
        G[B].emplace_back(A);
    }

    for(int i=0;i<N;++i){
        std::cin >> C[i];
    }

    std::sort(C, C + N);

    int v = -1;

    for(int i=0;i<N;++i){
        if(G[i].size() == 1){
            v = i;
            break;
        }
    }

    int res = std::accumulate(C, C + N - 1, 0);
    int i = N - 1;

    dfs(v, -1, i);

    std::cout << res << std::endl;

    for(int i=0;i<N;++i){
        std::cout << D[i] << " \n"[i + 1 == N];
    }
}


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

int main(){
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3628
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
template <class t> inline void read(t &s)
{
	s=0;
	reg int f=1;
	reg char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	s*=f;
	return;
}
const long double pi=acos(-1);
signed main(void)
{
	long double a,b,h,m;
	cin>>a>>b>>h>>m;
	h*=30.0;
	h+=m*0.5;
	m*=6.0;
	reg long double th=fabs(h-m);
	if(th>=180.0)
		th=360.0-th;
//	printf("%.9Lf\n",th);
	reg long double ans=sqrt(a*a+b*b-2.0*a*b*cos(th*pi/180.0));
	printf("%.12Lf\n",ans);
	return 0;
}




Measured memory_bytes: 4164
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;                       
typedef long long ll;
ll a[215];
ll b[215];
  int main()
  {  ll x,t,t1,t2=0,i,j;
      cin>>x;
      for(i=-1000;i<=1000;i++)
      { for(j=i+1;j<=1000;j++)
        {  if(j*j*j*j*j-i*i*i*i*i==x)
           {   t2=1;
		     cout<<j<<" "<<i<<endl;
		}
		
		}
		if(t2==1)
		break;
		   
	  }
}

Measured memory_bytes: 3584
# -*- coding: utf-8 -*-

x1,y1,x2,y2 = map(int, input().split())

X = x2 - x1
Y = y2 - y1

if X > 0 and Y > 0:
    x3 = x2 - abs(Y)
    y3 = y2 + abs(X)
    x4 = x3 - abs(X)
    y4 = y3 - abs(Y)

elif X > 0 and Y < 0:
    x3 = x2 + abs(Y)
    y3 = y2 + abs(X)
    x4 = x3 - abs(X)
    y4 = y3 + abs(Y)
    
elif X < 0 and Y > 0:
    x3 = x2 - abs(Y)
    y3 = y2 - abs(X)
    x4 = x3 + abs(X)
    y4 = y3 - abs(Y)

elif X < 0 and Y < 0:
    x3 = x2 + abs(Y)
    y3 = y2 - abs(X)
    x4 = x3 + abs(X)
    y4 = y3 + abs(Y)

elif X > 0 and Y == 0:
    x3 = x2
    y3 = y2 + abs(X)
    x4 = x3 - abs(X)
    y4 = y3

elif X == 0 and Y > 0:
    x3 = x2 - abs(Y)
    y3 = y2
    x4 = x3
    y4 = y3 - abs(Y)

elif X < 0 and Y == 0:
    x3 = x2
    y3 = y2 - abs(X)
    x4 = x3 + abs(X)
    y4 = y3

elif X == 0 and Y < 0:
    x3 = x2 + abs(Y)
    y3 = y2
    x4 = x3
    y4 = y3 + abs(Y)

print(str(x3) + ' ' + str(y3) + ' ' + str(x4) + ' ' + str(y4))

Measured memory_bytes: 3064
//abc131_b.cpp
//Sun Sep 15 07:42:02 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int total = 0;
	int eat = INTINF;
	int acteat = 0;
	for (int i=0;i<n;i++){
		total += l+i;
		if (eat > abs(l+i)){
			eat = abs(l+i);
			acteat = l+i;
		}
	}

	cout << total - acteat << endl;
}

Measured memory_bytes: 256
h, w = map(int, input().split())

mm = ['#' + input() + '#' for i in range(h)]
m = ['#' * (w+2)] + mm + ['#' * (w+2)]

vertical = [[0] * (w+1) for i in range(h+1)]
for i in range(1, h+1):
    c = 0
    for j in range(1, w+2):
        if m[i][j] == '#':
            for k in range(c+1, j):
                vertical[i][k] = j-c-1
            c = j


horizontal = [[0] * (w+1) for i in range(h+1)]
for i in range(1, w+1):
    c = 0
    for j in range(1, h+2):
        if m[j][i] == '#':
            for k in range(c+1, j):
                horizontal[k][i] = j-c-1
            c = j

ans = 1
for i in range(1, h+1):
    for j in range(1, w+1):
        if m[i][j] == '#':
            continue
        ans = max(ans, vertical[i][j] + horizontal[i][j] - 1)

print(ans)


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int const R = a+b;
  int const L = c+d;

  if (R > L){
    cout << "Left" << endl;
  } else if (R == L){
    cout << "Balanced" << endl;
  } else if (R < L){
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
typedef long long lint;
using namespace std;

int main()
{
	int N,T;
	int t[200010]={};
	lint ans=0;
	
	cin >> N >> T;
	for(int i=0;i<N;i++)
		cin >> t[i];
	
	for(int i=0;i<N-1;i++)
		ans+=min(T,t[i+1]-t[i]);
	ans+=T;
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for i in range(len(A)-1):
    if A[i] + 1 == A[i+1]:
        ans += C[A[i]-1]

print(ans+sum(B))


Measured memory_bytes: 3060
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
using ld [[maybe_unused]] = long double;

[[maybe_unused]] static constexpr int mod = (int)1e9 + 7;
[[maybe_unused]] static constexpr int inf = 100100100;
[[maybe_unused]] static constexpr ll linf = 1e18;
[[maybe_unused]] static constexpr double eps = 1e-9;
[[maybe_unused]] static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, a, b) for (ll i = a; i < b; ++i)
#define rrrep(i, a, b) for (ll i = a; i >= b; --i)
#define all(obj) begin(obj), end(obj)
#define rall(obj) rbegin(obj), rend(obj)
#define pb push_back
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    string S;
    cin >> S;

    ll SS = S.size();
    ll cw = 0;
    ll ce = 0;
    vector<ll> vw(SS);
    vector<ll> ve(SS);
    rep (i, SS) {
        vw[i] = cw;
        if (S[i] == 'W') ++cw;
        ve[SS - i - 1] = ce;
        if (S[SS - i - 1] == 'W') ++ce;
    }
    ll ans = linf;
    rep (i, SS) {
        ans = min(ans, vw[i] + ((SS - i - 1) - ve[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 5380
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;



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

	cin >> H >> W;
	vector<string>s(H);
	for (auto &i : s)cin >> i;
	vector<vector<long long int>>dp(H, vector<long long int>(W, 0));
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			dp[i][j] %= MOD;
			if (i + 1 < H&&s[i + 1][j] == '.')dp[i + 1][j] += dp[i][j];
			if (j + 1 < W&&s[i][j + 1] == '.')dp[i][j + 1] += dp[i][j];
		}
	}
	cout << dp.back().back() % MOD << endl;
	return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int q, h, s, d;
	cin >> q >> h >> s >> d;
	int n;
	cin >> n;
	q *= 4;
	h *= 2;
	mins(s, q);
	mins(s, h);
	if (n % 2 == 0) {
		s *= 2;
		mins(d, s);
		cout << ll(n / 2) * d << endl;
	}
	else {
		if (2 * s >= d) {
			cout << ll((n - 1) / 2) * d + s << endl;
		}
		else {
			cout << (ll)n * s << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)

vector<ll> enum_div(ll n){
	vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i){
			if(n%i == 0){
				ret.push_back(i);
				if(i!=(n/i))ret.push_back(n/i);
			}
	}
	return ret;
}

int main(){
	ll N,ans=0;
	cin >> N;
	for(auto x:enum_div(N)){
		if(x==1)continue;
		ans += ((N/(x-1))==(N%(x-1)))*(x-1);
	}
	cout << ans << endl;
}


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

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int a, b;
    cin >> a >> b;
    if (a >= 13)
        cout << b << '\n';
    else if (6 <= a && a <= 12)
        cout << b / 2 << '\n';
    else
        cout << "0\n";

    return 0;
}


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

using namespace std;

int main(){

  priority_queue<int,vector<int>,greater<int>> cola;
  int arr[2] = {0,0};
  int n,input;
  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> input;
    cola.push(input);
  }

  for(int i = 0; i < n; i++){
    if(i%2==0){
      arr[0]+= cola.top();
    }else arr[1]+=cola.top();
    cola.pop();
  }

  cout << abs(arr[0] - arr[1]) << "\n";

  return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, K;
  vector<int> P;
  cin >> A >> B >> K;
  for (int i = 1; i <= min(A, B); i++) {
    if (A % i == 0 && B % i == 0) P.push_back(i);
  }
  cout << P[P.size() - K] << '\n';
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:52:46 2019

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

"""

b = input()

if b == 'A':
    print('T')
elif b== 'T':
    print('A')
elif b== 'C':
    print('G')
else:
    print('C')



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

int main(){
    string s, t;
    cin >> s >> t;

    if(s.size() < t.size()) {
        cout << ("UNRESTORABLE") << endl;
        return 0;
    }

    vector<int> start_index;
    for (auto i = 0; i <= (s.size() - t.size()); i++) {
        int count = 0;
        for (auto j = 0; j < t.size(); j++) {
            if(s[i + j] == '?' or s[i + j] == t[j]) count++;
        }
        if(count == t.size()) start_index.push_back(i);
    }

    if(start_index.empty()) {
        cout << ("UNRESTORABLE") << endl;
        return 0;
    }

    vector<string> key;
    for (int start : start_index) {
        string tmp = "";
        for (auto j = 0; j < s.size(); j++) {
            if(j > start and start + t.size() > j) continue;
            if(j == start) {
                tmp += t;
                continue;
            }
            if(s[j] == '?') {
                tmp += 'a';
            } else {
                tmp += s[j];
            }
        }
        key.push_back(tmp);
    }
    sort(key.begin(), key.end());
    cout << key[0] << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    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) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  sort(rALL(a));

  ll ans = a[0];

  for(int i = 0; i < n-2; ++i) {
    ans += a[i/2+1];
  }
  cout << ans << endl;
}

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

int main()
{
   int a , b;
   string s,t,u;
   cin>>s>>t;
   cin>>a>>b;
   cin>>u;
   int r=1;
   for(int i=0 ; i<s.size();i++){
    if(s[i]==u[i]){ r=1;}
    else {r=0;}
   }
   if(r==1){
    int y = a-1;
    cout<<y<<" "<<b;
   }
   else{
    int y=b-1;
    cout<<a<<" "<<y;
   }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A.sort()
mn = A[0]
i = 1
while i < N and mn > 1:
    div = A[i] % mn
    if div != 0 and mn > div:
        mn = div
        i = 0
    else:
        i += 1
print(mn)


Measured memory_bytes: 16888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll n;
    cin >> n;
    vector<ll> f(n, 0);
    for(ll x = 1; x * x <= n; ++x){
        for(ll y = 1; y * y <= n; ++y){
            for(ll z = 1; z * z <= n; ++z){
                ll v = x * x + y * y + z * z + x * y + y * z + z * x;
                if(v <= n){
                    f.at(v - 1)++;
                }
            }
        }
    }

    REP(i, n){
        cout << f.at(i) << endl;
    }
    return 0;
}


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

int n, r = -1, mc =0, counts = 0;
bool flag;
string s;
vector<int> a(400000);
vector<int> b(400000);
vector<int> c(400000);

int main() {
    cin >> n >> s;
    a.at(0) = 0;

    for (int i = 1; i < n; ++i)
    {
        int d;
        d = (s.at(i-1) == '#')? 1 : 0;
        a.at(i) = a.at(i-1) + d;
    } 

    b.at(n-1) = 0;

    for (int i = n-2; i >= 0; --i)
    {
        int d;
        d = (s.at(i+1) == '.')? 1 : 0;
        b.at(i) = b.at(i+1) + d;
    } 

    int mins = 10000000;
    for (int i = 0; i < n; ++i)
    {
        mins = min(mins, a.at(i) + b.at(i));
    }

    cout << mins << endl;

}


Measured memory_bytes: 5252
//╔╗───────────╔╗────────────────────╔╗─
//║║──────────╔╝╚╗──────────────────╔╝╚╗
//║╚═╗╔══╗╔══╗╚╗╔╝╔══╗╔═╗╔╗╔╗╔══╗ ╔╗╚╗╔╝
//║╔╗║║╔╗║║╔╗║─║║─║║═╣║╔╝║╚╝║║╔╗║─╣║─║║─
//║╚╝║║╔╗║║║║║─║╚╗║║═╣║║─║║║║║╚╝║─║║─║╚╗
//╚══╝╚╝╚╝╚╝╚╝─╚═╝╚══╝╚╝─╚╩╩╝╚══╝─╚╝─╚═╝ 

#include <bits/stdc++.h>

#define pb push_back
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define forn(i, n) for (int i = 0; i < (int) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

int main() {
    IO;
    string s;
    cin >> s;
    int val1 = 0, val2 = 0 , res = 0;

    forn(i,s.sz){
        if(s[i] == 'A'){
            val1 = i;
            break;
        }
    }
    for(int i = s.sz; i > 0;--i){
        if(s[i] == 'Z'){
            val2 = i;
            break;
        }
    }
    cout << val2 - val1 + 1;
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define LIM 100000
#define pii pair<int, int>
#define ff  first
#define ss  second

vector<int> adj[LIM+5];
int dp[LIM+5];
bool vis[LIM+5];

int f(int u){
    if(vis[u]) return dp[u];
    vis[u] = 1;
    int ans = 0;
    for(int i = 0; i < adj[u].size(); i++){
        int v = adj[u][i];
        ans = max(ans, 1+f(v));
    }
    return dp[u] = ans;
}
int main(){
    //freopen("ip.txt", "r", stdin);
    int n, e; cin>>n>>e;
    for(int i = 1; i <= e; i++){
        int u, v; cin>>u>>v;
        adj[u].push_back(v);
    }
    int mxLen = 0;
    for(int i = 1; i <= n; i++) mxLen = max(mxLen, f(i));

    cout<<mxLen<<'\n';
}


Measured memory_bytes: 11456
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, H; cin >> n >> H;
    vi a(n), b(n); rep(i, n) cin >> a[i] >> b[i];

    sort(_all(a));
    sort(_all(b));

    int amx = a.back();

    int res = 0;
    rrep(i, n){
        if(H <= 0 or b[i] < amx) break;
        H -= b[i];
        res++;
    }
    if(H > 0) res += (H + amx - 1) / amx;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024
from fractions import gcd
N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
ds = [xs[i+1]-xs[i] for i in range(N)]
ans = ds[0]
for i in range(1, N):
    ans = gcd(ans, ds[i])
print(ans)

Measured memory_bytes: 88596
s=int(input())
ans=True
a=[s]
i=0
while True:
    if a[i]%2==0:
        b=a[i]//2
    else:
        b=3*a[i]+1
    if b in a:
        break
    else:
        a.append(b)
        i+=1
print(i+2)

Measured memory_bytes: 38384
/*#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;
*/
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
//typedef unsigned long long ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int main(){

    ll a, b, c;

    cin >> a >>b >> c;

    ll d = c- b - a;

    if(d > 0 && d*d > 4 * a * b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int num[400],s=0,q,ok=0,ans=0;
  for(int i=1;i<=33;i++){
    for(int j=2;j<11;j++){
      num[s]=pow(i,j);
      s++;
    }
  }
  sort(num,num+400);
  cin>>q;
  for(int k=0;k<400;k++){
    if(num[k]>q){
      ans=num[k-1];
      ok++;
      break;
    }
  }
  if(ok==1)
    cout<<ans<<endl;
  else
    cout<<1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  cin>>a;
  if(a=="SUN"){
    cout<<7;
  }
  if(a=="MON"){
    cout<<6;
  }
  if(a=="TUE"){
    cout<<5;
  }
  if(a=="WED"){
    cout<<4;
  }
  if(a=="THU"){
    cout<<3;
  }
  if(a=="FRI"){
    cout<<2;
  }
  if(a=="SAT"){
    cout<<1;
  }
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;

ll Cc(ll n, ll m)
{
    if (m > n / 2)
        m = n - m;
    ll a = 1, b = 1;
    for (int i = 1; i <= m; i++)
    {
        a *= n + 1 - i;
        b *= i;
        if (a % b == 0)
        {
            a /= b;
            b = 1;
        }
    }
    return a / b;
}
const int maxn = 1e5 * 2 + 2;
int a[maxn], num[maxn];
ll c[maxn];
int main()
{
    int n;
    scanf("%d", &n);
    int mm = 0;
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        mm = max(a[i], mm);
        num[a[i]]++;
    }
    for (int i = 2; i <= n; i++)
        c[i] = Cc(i, 2);
    ll ans = 0;
    for (int i = 1; i <= mm; i++)
        if (num[i])
            ans += c[num[i]];

    for (int i = 1; i <= n; i++)
    {
        ll t = ans;
        t -= c[num[a[i]]];
        t += c[num[a[i]] - 1];

        // ll ansn = ans;
        // ansn -= c[num[a[i]]];
        // ansn += c[num[a[i]] - 1];
         printf("%lld\n", t);
    }
    return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  int L = 0, R = N;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  for (int i = 0; i < M; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  for (int i = 0; i < M; i++) {
    L = max(L, a.at(i));
    R = min(R, b.at(i));
  }
  if (R - L + 1<= 0) {
    cout << 0 << endl;
  }
  else {
    cout << R - L + 1<<endl;
  }
}

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

int main(){
	string s;
	vector<int> alphabet(26);
	cin >> s;
	for(int i =0;i < s.size(); i++)
		alphabet[s[i]-'a']++;
	for(int i = 0;i < 26;i++) {
		if((alphabet[i] & 1) != 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}



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

using namespace std;

typedef long long int lli ;

lli i,j,k,l,m,n,t,a,b,c,d,x,y,sum=0,total=0;

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

    //freopen("Input.txt","r",stdin);

    cin>>n>>m;
  
  	if(n==m)
    {
      cout<<"Yes\n";
    }
  	else
    {
      cout<<"No\n";
    }
}

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

#define MAX_V 100010
using namespace std;

struct edge{long long to,cost; };
vector<edge> G[MAX_V];

bool used[MAX_V];
long long d[MAX_V];
int n;

void dfs(int s){
	used[s] = true;
	int i = 0;
	while(true){
		edge e = G[s][i];
		if(e.to==-1){
			break;
		}
		if(!used[e.to]){
			i++;
			used[e.to] = true;
			d[e.to] = d[s]+e.cost;
			dfs(e.to);
		}else{
			i++;
		}
	}
}

int main(){
	int i,j,q,k,x,y;
	cin >> n;
	for(i=0;i<n-1;i++){
		long long a,b,c;
		cin >> a >> b >> c;
		a--; b--;
		edge e;
		e.to = b;
		e.cost = c;
		G[a].push_back(e);
		e.to = a;
		e.cost = c;
		G[b].push_back(e);
	}
	for(i=0;i<n;i++){
		edge e;
		e.to = -1; e.cost = 0;
		G[i].push_back(e);
	}
	for(i=0;i<n;i++){
		used[i] = false;
	}
	
	cin >> q >> k;
	d[k-1] = 0;
	dfs(k-1);
	for(i=0;i<q;i++){
		cin >> x >> y;
		x--; y--;
		cout << d[x] + d[y] << endl;
	}
}

Measured memory_bytes: 16000
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;

long long int N, M, K, W, H, L, R;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	bool flag[200] = {};
	cin >> H >> W >> L >> R;
	for (int i = H; i < W; i++) {
		flag[i] = true;
	}
	for (int i = L; i < R; i++) {
		if (flag[i])M++;
	}
	cout << M << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
//        long readhp = long.Parse(ReadLine());
//        string[] reader = ReadLine().Split(' ');
//        int monsterhp = int.Parse(reader[0]);
//        int magicnum = int.Parse(reader[1]);
/*        string[] reader = ReadLine().Split(' ');
        string[] reader1 = ReadLine().Split(' ');
        int a = int.Parse(reader1[0]);*/
        string[] a = ReadLine().Split(' ');
        string[] b = ReadLine().Split(' ');
        int dicenum = int.Parse(a[0]);
        int ren = int.Parse(a[1]);
        double[] c = new double[dicenum];
        for(int i=0;i<dicenum;i++){
            c[i] = double.Parse(b[i]);
            c[i] = (c[i]+1)/2;
        }
        double ans = 0;
        double temp = 0;
        for(int i=0;i<ren;i++){
            temp += c[i];
            ans = temp;
        }
        for(int i=1;i<dicenum - ren + 1;i++){
            temp = temp - c[i-1] + c[i+ren-1];
            ans = Max(ans,temp);
        }
        
        WriteLine(ans);
        


/*        string c = ReadLine();
        int a = c.Length;
        for(int i=0;i<a;i++){
            Write("x");
        }
        WriteLine();*/
//        string[] readerhp = ReadLine().Split(' ');
//        long total = 0;
//        int leng = readerhp.Length;
/*        int[,] map = new int[magicnum+10,monsterhp+10];
        for(int i=0;i<=monsterhp;i++){
            map[0,i] = 1000000000;
        }
        for(int i=1;i<=magicnum;i++){
            string[] reader2 = ReadLine().Split(' ');
            int magicdam = int.Parse(reader2[0]);
            int magicuse = int.Parse(reader2[1]);
            
            for(int j=1;j<=monsterhp;j++){
                if(j <= magicdam){
                    map[i,j] = Min(map[i-1,j],magicuse);
                }else{
                    map[i,j] = Min(map[i-1,j],map[i,j-magicdam]+magicuse);
                }
            }
        }
        /*for(int i=0;i<=magicnum;i++){
            for(int j=0;j<=monsterhp;j++){
                Write(map[i,j]);
                Write(" ");
            }
            WriteLine();
        }*/
        //WriteLine(map[magicnum,monsterhp]);*/
    }
}

Measured memory_bytes: 31068
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, X = I()
L = [0] + l()
l = list(itertools.accumulate(L))

for i in l:
    if i <= X:
        count += 1

print(count)


Measured memory_bytes: 10004
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
int A, B;
int main() {
	string a, b;
	cin >> a >> b;
	a += b;
	for (int i =0; i < a.size(); i++) {
		A += (a[i] - '0')*pow(10, a.size()-1-i);
	}
	B = sqrt(A);
	B *= B;
	cout << (A == B ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 1e5 + 10;
int num[N];
int main()
{
  // freopen("in.txt","r",stdin); 
 	int n;
 	while (~scanf("%d", &n))
 	{
 		for (int i = 0; i < n; i++)
 			scanf("%d", num + i);
 		int pre = num[0];
 		int dif = 0, ans = 1;
 		for (int i = 1; i < n; i++)
 		{
 			if (dif < 0)
 			{
 				if (num[i] - pre > 0)
 				{
 					// printf("dif %d num %d  pre:%d\n", dif, num[i], pre);
 					ans++;
 					dif = 0;
 				}
 			}else if (dif > 0)
 			{
 				if (num[i] - pre < 0)
 				{
 					// printf("dif :%d num %d  pre:%d\n", dif, num[i], pre);
 					ans++;
 					dif = 0;
 				}
 			}else
 				dif = num[i] - pre;
 			pre = num[i];
 		}
 		printf("%d\n", ans);
 	}
   return 0;
}


Measured memory_bytes: 640
import glob
import math


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\134\\B'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'


class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class B(Common):

    def resolve(self):

        tmp = [int(i) for i in self.input_data().split()]
        tree_num = int(tmp[0])
        D = int(tmp[1])

        result = math.ceil(tree_num / (2 * D + 1))
        print(str(result))

solver = B(REL_PATH)
solver.exec_resolve()


Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(l.begin(), l.end(), greater<int>());
  int sum = 0;
  rep(i, k) sum += l[i];
  cout << sum << endl;
  return 0;
}

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

int main()
{
  	int A, B;
	cin >> A >> B;
  	if(B == 1 & A == 1){
      cout << A+B << endl;
      return 0;
    }
	if(B%A == 0)
      cout << A+B << endl;
  	else
      cout << B-A << endl;

}

Measured memory_bytes: 256
N, A, B, C, D = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp

if s[A-1..C-1].include?("##") || s[B-1..D-1].include?("##") then
  puts "No"
else
  if D > C then
    puts "Yes"
  elsif s[B-2..D].include?("...") then
    puts "Yes"
  else
    puts "No"
  end
end


Measured memory_bytes: 2428
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < n; i++)
#define REPR(i,n) for (ll i = n-1; i >= 0; i--)
#define FOR(i,m,n) for (ll i = m; i < n; i++)

vector<int> x(3);

int main() {
    REP (i, 3) cin >> x[i];
    sort(x.begin(), x.end());
    cout << ((x[2] == x[0]) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256