akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 2002;

ll inv[MAX_N],fac[MAX_N],finv[MAX_N];
ll dp[MAX_N][MAX_N];
ll sm[MAX_N][MAX_N];
ll times[MAX_N];

void make()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2;i<MAX_N;i++){
		inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
}

int main()
{
    make();
    while(1){
        int n,x;
        ll D;
        cin >> n >> D >> x;
        if(n == 0){
            break;
        }
        rep(i,n+1){
            rep(j,n+1){
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;
        rep(i,n){
            rep(j,n+1){
                sm[i+1][j] = 0;
            }
        }
        rep(j,n+1){
            sm[0][j] = 1;
        }
        rep(i,n){
            for(int j = i+1;j <= n;j++){
                if(j >= i+x){
                    dp[i+1][j] = (sm[i][j-1] + MOD - sm[i][j-x]) % MOD;
                }else{
                    dp[i+1][j] = sm[i][j-1];
                }
            }
            ll bf = 0;
            for(int j = i+1;j <= n;j++){
                bf = (bf + dp[i+1][j]) % MOD;
                sm[i+1][j] = bf;
            }
        }
        ll bf = 1;
        rep(i,n){
            bf = bf * ((D-i)%MOD) % MOD;
            times[i] = bf;
        }
        ll ans = 0;
        for(int i=1;i<=n;i++){
            ans = (ans + (dp[i][n] * times[i-1] % MOD) * finv[i]) % MOD;
        }
        cout << ans << "\n";
    }
}

Measured memory_bytes: 65636
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  string s;

  cin >> s;

  int cnt = 0;
  int max = -1;

  rep(i,sz(s))
  {
    switch(s[i])
    {
      case 'A':
      case 'G':
      case 'C':
      case 'T':
        cnt++;
        break;
      default:
        if(max < cnt)
          max = cnt;
          cnt = 0;
        break;
    }
  }

  if(cnt)
  {
    if(max < cnt)
    {
      max = cnt;
      cnt = 0;
    }
  }

  cout << max << endl;
  
  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

int main() {

    int n, m;
    cin >> n >> m;
    int connection[10];
    int p[10];
    for (int i = 0; i < m; i++) {
        int k;
        cin >> k;
        connection[i] = 0;
        for (int j = 0; j < k; j++) {
            int s;
            cin >> s;
            connection[i] += (1 << (s-1));
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }
    int count = 0;
    // スイッチ状態について、bit全探索
    for (int bit = 0; bit < (1 << n); bit++) {
        bool allIlluminate = true;
        // i番目の電球がついているか調べる
        for (int i = 0; i < m; i++) {
            int switchCount = __builtin_popcount(bit & connection[i]);
            if (switchCount % 2 != p[i]) {
                allIlluminate = false;
                break;
            }
        }
        if (allIlluminate) count++;
    }
    cout << count << endl;
    return 0;

}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] d = new int[n];
        for(int i=0;i<n;i++){
            d[i] = Integer.parseInt(sc.next());
        }

        int sum = 0;
        for(int i=0;i<n-1;i++){
            int a = d[i];
            for(int j=i+1;j<n;j++){
                int b = d[j];
                sum += a*b;
            }
        }
        
        System.out.println(sum);
        
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
}

Measured memory_bytes: 23508
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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 (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N;
lint dp[200][200];
bool visited[200];
set<lint> st0, st1;

void dfs(lint i, lint pos) {
	REP(j, N) {
		if (dp[i][j]) {
			if (pos == 0) {
				st1.insert(j);
			}
			else {
				st0.insert(j);
			}
			if (!visited[j]) {
				visited[j] = true;
				dfs(j, pos ^ 1);
			}
		}
	}
}

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		REP(j, N) {
			char c;
			cin >> c;
			dp[i][j] = (c - '0');
		}
	}

	st0.insert(0);
	visited[0] = true;
	dfs(0, 0);
	REP(i, N) {
		if (!((st0.find(i) == st0.end()) ^ (st1.find(i) == st1.end()))) {
			cout << -1 << endl;
			return 0;
		}
	}

	REP(i, N) {
		REP(j, N) {
			if (i == j) continue;
			if (!dp[i][j]) dp[i][j] = INF;
		}
	}

	REP(k, N) {
		REP(i, N) {
			REP(j, N) {
				chmin(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}

	lint maxv = 0;
	REP(i, N) {
		REP(j, N) {
			chmax(maxv, dp[i][j]);
		}
	}
	cout << maxv + 1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i)  
#else
  #define DUMP(i)  
#endif

#define GETTYPE(i) 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

const int EPS = 1e-9;

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a;
  while(cin >> n >> a){
    cout << n * n - a << endl;
  }
  return 0;
}


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


int main() {
    int n;
    cin >> n;
    vector<int> vec_a(n);
    vector<int> vec_b(n);
    vector<int> vec_c(n-1);
    for (int i = 0; i < n; i++) {
        cin >> vec_a.at(i);
    }

    for (int i = 0; i < n; i++) {
        cin >> vec_b.at(i);
    }

    for (int i = 0; i < n - 1; i++) {
        cin >> vec_c.at(i);
    }

    int sum = 0;
    for (int i = 0; i < n; i++) {
        int current_sum = 0;
        current_sum += vec_b.at(vec_a.at(i)-1);
        if (i > 0 && vec_a.at(i) == vec_a.at(i-1) + 1) {
            current_sum += vec_c.at(vec_a.at(i-1)-1);
        }
        sum += current_sum;
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int K=sc.nextInt();
    int A=sc.nextInt();
    int B=sc.nextInt();
    int N=1;
    boolean judge=false;
    boolean judge1=true;
    while(judge1==true){
      if(K*N>=A&K*N<=B){
          judge=true;
          break;
      }
      if(K*N-B>0){
        judge=false;
        break;
      }
       N++;
    }
    if(judge==true){
      System.out.println("OK");
    }else{
      System.out.println("NG");
    }




  }
}


Measured memory_bytes: 35820
#include <iostream>
using namespace std;
using ll = long long;

int main(){
    ll sum = 0;
    ll N;
    cin >> N;
    ll a[N];
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        sum += a[i];
    }
    ll tmp = 0;
    ll ans = INT_MAX;
    if(N == 2){
        cout << abs(a[0]-a[1]) << endl;
        return 0;
    }
    for(int i = 0; i < N-1; ++i){
        tmp += a[i];
        ans = min(ans, abs(sum-2*tmp));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

//To be solved using Bottom up Dynamic programming approach
void Compute(ll n)
{
    KAKA
    vector<ld> p(n);
    pragi(0,n)
    {
        cin>>p[i];
    }
    ld dp[n][n+1];
    memset(dp,-1,sizeof(dp));
    dp[0][1] = p[0];
    dp[0][0] = 1 - p[0];
    //cout<<dp[0][1]<<"\n";
    pragi(2,n+1)
    {
        dp[0][i] = 0.0;
    }
    pragi(1,n)
    {
        pragj(0,n+1)
        {
         if(dp[i][j] != -1)
         {
            if((i > 0) and (j > 0)) dp[i][j] = ((ld)(p[i]*dp[i-1][j-1])) + ((ld)((1-p[i])*(dp[i-1][j])));
            else if(j == 0) dp[i][j] = (ld)(dp[i-1][j] * (1 -p[i]));
         }
        }
    }
    /*pragi(0,n)
    {
        pragj(0,n+1)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<"\n";
    }*/
    ld prob = 0.0;
    pragi(n/2+1,n+1)
    {
      prob+=dp[n-1][i];
    }
    cout<<fixed<<setprecision(9)<<prob<<"\n";
}
int main()
{
    KAKA
    ll n;
    cin>>n;
    Compute(n);
}

Measured memory_bytes: 140928
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define pb push_back
using namespace std;
const int P=139;
const int mod=149;
const int maxn=1e6+5;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
ll a,b,n,k,t,res,sum;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    int num=0;
    int flag=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b;
        if(a==b)
        {
            num++;
            if(num>=3) 
			flag=1;
        }
        else
            num=0;
    }
    if(flag)
		cout<<"Yes"<<endl;
    else
		cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3648
N = int(input())

CSF = [list(map(int, input().split())) for _ in range(N-1)]
CSF.append([0,0,0])

ans = [0] * N

for i in range(N-1):
    now = 0
    for j in range(i,N-1):
        if j == i:
            now = CSF[j][1] + CSF[j][0]
        else:
            if now <= CSF[j][1]:
                now = CSF[j][1] + CSF[j][0]
            else:
                if (now - CSF[j][1]) % CSF[j][2] == 0: #すぐ乗れる
                    now += CSF[j][0]
                else:
                    wait = CSF[j][2] - ((now - CSF[j][1]) % CSF[j][2])
                    now += wait + CSF[j][0]
                    
    ans[i] = now
    


for i in range(N):
    print(ans[i])

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e18
#define mod 1000000007

ll n,c;
ll x[101010],v[101010];
ll s[101010];

int main(){
  cin>>n>>c;
  rep(i,n)cin>>x[i]>>v[i];
  ll res=0;
  {
    set<P> st,rst;
    memset(s,0,sizeof(s));
    rep(i,n){
      s[i+1]=v[i]-(x[i]-(i>0?x[i-1]:0));
    }
    rep(i,n)s[i+1]+=s[i];
    rep(i,n+1){
      st.insert(P(s[i],i));
      rst.insert(P(i,s[i]));
    }
    ll crt=0;
    for(ll i=n;i>=0;i--){
      P p=*st.rbegin();
      maxch(res,p.fi+crt);
      P k=*rst.lower_bound(P(i,-INF));
      rst.erase(k);
      st.erase(P(k.se,k.fi));
      if(i==0)break;
      crt+=v[i-1]-((i==n?c:x[i])-x[i-1])*2;
    }
  }

  rep(i,n){
    x[i]=c-x[i];
  }

  reverse(x,x+n);
  reverse(v,v+n);

  {
    set<P> st,rst;
    memset(s,0,sizeof(s));
    rep(i,n){
      s[i+1]=v[i]-(x[i]-(i>0?x[i-1]:0));
    }
    rep(i,n)s[i+1]+=s[i];
    rep(i,n+1){
      st.insert(P(s[i],i));
      rst.insert(P(i,s[i]));
    }
    ll crt=0;
    for(ll i=n;i>=0;i--){
      P p=*st.rbegin();
      maxch(res,p.fi+crt);
      P k=*rst.lower_bound(P(i,-INF));
      rst.erase(k);
      st.erase(P(k.se,k.fi));
      if(i==0)break;
      crt+=v[i-1]-((i==n?c:x[i])-x[i-1])*2;
    }
  }
  cout<<res<<endl;
  return 0;
}


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

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

using namespace std;

int main(){
	int n,k;
    string s;
	cin>>n>>s>>k;
	
    char target = s[k-1];

	string result;
    REP(i,n){
        if( s[i] != target ){
            result += "*";
        }
        else{
            result += s[i];
        }
    }

    cout << result << endl;
	
	return 0;
}

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

#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <bitset>

#include <cmath>
#include <functional>

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for(int i = int(a); i < int(b); ++i)
#define RFOR(i, a, b) for(int i = int(b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define IN(a, x ,b) (a<_x && x < b)
template<class T> inline T CHMAX(T& a, T& b){return a=(a<b)?b:a;}
template<class T> inline T CHMIN(T& a, T& b){return a=(a>b)?b:a;}

using ll = long long;
constexpr double PI = 3.1415926535897;

using std::vector;
using std::cout;
using std::endl;
using std::cin;

int M;
ll ans = 0;
ll f(std::vector<int> &x,std::vector<int> &y,std::vector<int> &p){
  std::vector<std::vector<std::pair<int,int>>>pp(M/2);
  /*REP(i,M){
    cout<<p[i]<<" ";
  }cout<<endl;*/
  REP(i,M){
    pp[p[i]].push_back({x[i],y[i]});
  }
  std::map<double,int>mp;
  std::vector<double> v;
  for(auto e:pp){
    if(e.size()==1)continue;
    //mp[atan((e[0].second-e[1].second)/(e[0].first-e[1].first))]++;
    //v.push_back(atan((e[0].second-e[1].second)/(e[0].first-e[1].first)));
    double theta = atan2((e[0].second-e[1].second),(e[0].first-e[1].first));
    if(theta<0.0)theta+=PI;
    v.push_back(theta);
  }
  int ret = 0;
  REP(i,v.size()){
    FOR(j,i+1,v.size()){
      if(fabs(v[i]-v[j])<1e-6)ret++;
      if(PI-fabs(v[i]-v[j])<1e-6)ret++;
    }
  }
  return ret;
}

void dfs(int now,int cnt,std::vector<int>&x,std::vector<int> &y,std::vector<int>&p,int odd){
/*
  cout<<now<<" "<<cnt<<endl;
  REP(i,M){
    cout<<p[i]<<" ";
  }cout<<endl;*/
  if(now==M){
    ans=std::max(ans,f(x,y,p));
  }
  else{
    if(p[now]!=-1){
      dfs(now+1,cnt,x,y,p,odd);
    }else{
      int left=-1;
      REP(i,M){
        if(p[i]==-1){
          left=i;
          break;
        }
      }
      p[left]=cnt;
      if(odd){
        dfs(now+1,cnt+1,x,y,p,0);
      }
      REP(i,M){
        if(p[i]==-1){
          p[i]=cnt;
          dfs(now+1,cnt+1,x,y,p,odd);
          p[i]=-1;
        }
      }
      p[left]=-1;
    }
  }
}

int main(){
  cin>>M;
  std::vector<int>x(M),y(M);
  REP(i,M)cin>>x[i]>>y[i];
  std::vector<int>p(M,-1);
  dfs(0,0,x,y,p,M%2);
  cout<<ans<<endl;
  return 0;
}



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

int main(){
  int N;
  cin >> N;
  uint64_t A[N],B[N],C[N];
  uint64_t numA=0,numB=0;
  uint64_t ans=0,sumB[N];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) cin >> B[i];
  for(int i=0; i<N; i++) cin >> C[i];
  for(int i=0; i<N; i++) sumB[i] = 0;
  sort(A,A+N);
  sort(B,B+N);
  sort(C,C+N);
  for(int i=0; i<N; i++){
    while(C[i]>B[numB] && numB<N){
      if(numB!=0) sumB[numB] = sumB[numB-1];
      while(B[numB]>A[numA] && numA<N){
        numA++;
      }
      sumB[numB] += numA;
      numB++;
    }
    if(numB!=0) ans += sumB[numB-1];
  }
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    double S = W * H / 2.;
    cout << fixed << setprecision(15) << S << ' ';
    if ((W % 2 == 0) && (H % 2 == 0) && (x == W / 2) && (y == H / 2))
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}

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

using namespace std;
int main(void) {
	int a, b, k;
	cin >> a >> b >> k;

	bool flg = 0;
	for (int i = 0; i < k; i++) {
		if (!flg) {
			if (a % 2 == 1) a--;
			a /= 2;
			b += a;
			flg = 1;
		}
		else {
			if (b % 2 == 1) b--;
			b /= 2;
			a += b;
			flg = 0;
		}

	}

	cout << a <<" "<< b << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

const ll mod = 1e9+7;

ll modpow(ll x, ll n, ll mod){
    ll res = 1;
    while (n>0){
        if (n&1) res = res* x % mod;
        x = x* x% mod;
        n = n>>1;
    }
    return res;
}

int main(){
    ll n,k;
    cin >> n>>k;
    vector<ll> di(k+1,0);
    
    
    for (ll i=1; i<=k; i++){
        di[i] = modpow( k/i, n, mod);
    }
    
    
    for (int i=k; i>0;i--){
        for (int j=2*i; j<=k; j+=i){
            di[i] -= di[j];
            if (di[i]<0) di[i] += mod;
            di[i] %= mod;
        }
    }
    
    //for (auto x:di) cout<<x<<" ";
    ll ans=0;
    for(int i=1; i<=k;i++){
        ans = ( ans+ i*di[i]) % mod;
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main(){
  int R=-1, G=4501;
  cin >> R >> G;
  if(R<0||4500<G) cout << "入力エラー(制約 : 0≦R, G≦4500)" << endl;  
  else cout << G*2.0 -R << endl;
}


Measured memory_bytes: 3796
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(input())
def pf(s): return print(s, flush=True)


N = I()
b = LI()

result = []
while True:
    #  print(b)
    for i in range(1, len(b)+1):
        #  print(i)
        if b[-i] == len(b)-i+1:
            #  print('break')
            result.append(b[-i])
            b.pop(-i)
            break
    else:
        if not b:
            break
        print(-1)
        exit()
for i in result[::-1]:
    print(i)


Measured memory_bytes: 5460
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

    static int N;
    static int K;
    static int Q;
    static int A;
    static long B;
    static long C;
    //    static int[][] map;
    static int min = 9999999;
    static long ans = 0;


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String s = scanner.nextLine();
        String t = scanner.nextLine();

        int[] map = new int[26];
        for (int i = 0; i < 26; i++) {
            map[i] = -1;
        }

        boolean ans = true;
        for (int i = 0; i < s.length(); i++) {
            if(map[s.charAt(i) - 'a'] == -1){
                map[s.charAt(i) - 'a'] = t.charAt(i) - 'a';

            }else{
                if(map[s.charAt(i) - 'a'] != t.charAt(i) - 'a'){
                    ans = false;
                }
            }
        }

        String temp = s;
        s = t;
        t = temp;

        for (int i = 0; i < 26; i++) {
            map[i] = -1;
        }

        for (int i = 0; i < s.length(); i++) {
            if(map[s.charAt(i) - 'a'] == -1){
                map[s.charAt(i) - 'a'] = t.charAt(i) - 'a';

            }else{
                if(map[s.charAt(i) - 'a'] != t.charAt(i) - 'a'){
                    ans = false;
                }
            }
        }

        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}



Measured memory_bytes: 29676
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static ConsoleReader;

class Program
{
    static void Main(string[] args)
    {
        var n = Read<long>() - 1;

        var div = 26;
        var res = new List<char>();
        while (n > 0)
        {
            var d = n % div;
            var c = (char)('a' + d);
            res.Add(c);

            n /= div;
            n--;
        }
        if (n == 0)
        {
            res.Add('a');
        }
        res.Reverse();
        res.ForEach(Console.Write);
    }
}

public static class IntExtentions
{
    public static void Times(this int n, Action<int> action)
    {
        for (var i = 0; i < n; i++)
        {
            action(i);
        }
    }

    public static void Times(this (int n, int m) dimensions, Action<int, int> action)
    {
        var (n, m) = dimensions;
        n.Times(i => m.Times(j => action(i, j)));
    }
}

public static class ConsoleReader
{
    public static T Read<T>()
        where T : IConvertible
    {
        var inputBuffer = new StringBuilder();
        int currChar;

        while ((currChar = Console.Read()) != -1)
        {
            if (!char.IsWhiteSpace((char)currChar))
            {
                inputBuffer.Append((char)currChar);
            }
            else if (inputBuffer.Length != 0)
            {
                break;
            }
        }

        return (T)Convert.ChangeType(inputBuffer.ToString(), typeof(T));
    }

    public static T[] ReadArray<T>(int count)
        where T : IConvertible
    {
        if (count < 0)
        {
            throw new ArgumentOutOfRangeException(nameof(count), $"'{nameof(count)}' must be >= 0");
        }

        var result = new T[count];

        for (var i = 0; i < count; i++)
        {
            result[i] = Read<T>();
        }

        return result;
    }
}

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, k; cin >> n >> k;
    map<int,int> cnt;
    for (int i = 0; i < n; i++) {
        int ai; cin >> ai;
        cnt[ai]++;
    }
    vector<int> v;
    for (auto p: cnt) {
        v.push_back(p.second);
    }
    sort(v.begin(),v.end());
    int ans = 0;
    for (int i = 0; i < (int)v.size()-k; i++) {
        ans += v[i];
    }
    cout << ans << '\n';
}



Measured memory_bytes: 10744
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    sort(all(L));

    ll ans = 0;
    rep(i, N - 1) rep(j, i + 1, N) {
        int lsum = L[i] + L[j];

        int h = upper_bound(all(L), lsum - 1) - L.begin();
        int l = lower_bound(L.begin() + j + 1, L.end(), max(L[i], L[j])) - L.begin();
        
        if (l > h) continue;
        ans += h - l;
    }

    write(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

int main() {
    string s;
    cin>>s;
    s=s.substr(0,s.size()-1);
    while(true){
        if(s.size()%2==0 && s.substr(0,s.size()/2)==s.substr(s.size()/2,s.size()/2)) break;
        else s=s.substr(0,s.size()-1);
    }
    
    cout<<s.size()<<endl;
}

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

int Frog(int a[],int n){

  int dp[n];
  //base case
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++){
    int option1=dp[i-1]+abs(a[i]-a[i-1]);
    int option2=dp[i-2]+abs(a[i]-a[i-2]);
    dp[i]=min(option1,option2);
  }

  return dp[n-1];

}

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

  int ans=Frog(a,n);
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  int h, w; cin >> h >> w;
  int a[h][w];
  rep(i, h)rep(j, w) cin >> a[i][j];
  rep(i, h){
    if(i%2 == 0) continue;
    rep(j, w/2) swap(a[i][j], a[i][w-j-1]);
  }
  int n = 0;
  queue<int> que;
  rep(i, h*w-1){
    int x = i/w, y = i%w;
    if(a[x][y]%2 == 1){
      que.push(i);
      int cur = i+1;
      int nx = cur/w, ny = cur%w;
      while(cur<h*w-1 && a[nx][ny]%2==0){
        que.push(cur);
        cur++; nx = cur/w; ny = cur%w;
      }
      n += cur - i;
      i = cur;
    }
  }
  cout << n << endl;
  while(!que.empty()){
    int i = que.front(); que.pop();
    int x = i/w, y = i%w;
    if(x%2 == 1) y = w-1-y;
    int nx = (i+1)/w, ny = (i+1)%w;
    if(nx%2 == 1) ny = w-1-ny;
    cout << x+1 << " " << y+1 << " " << nx+1 << " " << ny+1 << endl;
  }
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    ll N, M; cin >> N >> M;
    ll ans = 0;
    ll a = 0;
    ll A = 0;
    int i = 0;

    while (i < M)
    {
      cin >> a;
      A += a;
      i++;
    }
    
    if (N < A)
    {
      cout << -1 << endl;
      return 0;
    }
    


    cout << N-A << endl;
    return 0;
    
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<cmath>
#include<array>
#include<vector>

using ll = long long;
using std::cin;
using std::cout;
using std::endl;


int main(){
    int N;
    cin>>N;
    auto calcindex = [=](int i,int j) {
        if(i>j){
            return i*N+j;
        }else{
            return j*N+i;
        }
    };

    std::vector<std::vector<int>> g(N*N);
    std::vector<int> h(N*N);
    std::vector<int> st;
    for(int i=0;i<N;++i){
        int last=0;
        for(int j=0;j<N-1;++j){
            int a;
            cin>>a;
            if(last){
                g.at(calcindex(i,last-1)).push_back(calcindex(i,a-1));
                h.at(calcindex(i,a-1))++;
            }
            last=a;
        }
    }
    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
           if(h[calcindex(i,j)]==0){
               st.push_back(calcindex(i,j));
           }
        }
    }
    int ans=0;
    std::vector<int> depth(N*N,0);
    int cnt=0;
    // for(auto& x:h) cout<<x<<endl;
    while(st.size()){
        int i = st.back();
        st.pop_back();
        cnt++;
        if(g[i].size()==0){
            if(ans<depth[i]){
                ans=depth[i];
            }
        }
        for(auto& j:g[i]){
            --h[j];
            depth[j]=std::max(depth[j],depth[i]+1);
            if(h[j]==0){
                st.push_back(j);
            }
        }
    }
    ans+=1;
    if(cnt!=N*(N-1)/2){
        ans=-1;
    }

    cout<<ans<<endl;
}

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

using ll = long long;
// #define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

int d[10][10];

void WarshallFloyd() {
  REP(i,10) REP(j,10) REP(k,10) {
    d[j][k] = min(d[j][k], d[j][i]+d[i][k]);
  }
}

/***** MAIN *****/
signed main() {
  int H, W;
  cin >> H >> W;
  int wall[H][W];
  REP(i,10) REP(j,10) {
    cin >> d[i][j];
  }
  REP(i,H) REP(j,W) {
    cin >> wall[i][j];
  }
  WarshallFloyd();
  ll ans = 0;
  REP(i,H) REP(j,W) {
    if(wall[i][j] == -1) continue;
    ans += d[wall[i][j]][1];
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 384
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int i;
        Scanner sc= new Scanner(System.in);
        String sarr1="";

        while(sc.hasNext()){
            String sarr2=sc.nextLine();
            if(sarr2.length()==0){
                break;
            }
            sarr1 += sarr2;
        }
        
        String sarr=sarr1.toLowerCase();

        int num[]=new int[26];

        for(i=0;i<sarr.length();i++){
            if(sarr.charAt(i) - 'a'>=0 && sarr.charAt(i) - 'a'<26){
                num[sarr.charAt(i)-'a']++;
            }
        }

        for(i=0;i<26;i++){
            System.out.printf("%c : %d\n",'a'+i,num[i]);
        }
        sc.close();
    }    
}


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

int main() {
    ios::sync_with_stdio(false);
    if (fopen("input.in", "r")) {
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }

    int n, d;
    cin >> n >> d;

    int mat[n][d];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++) {
            cin >> mat[i][j];
        }
    }

    int counter = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            int sum = 0;
            for (int k = 0; k < d; k++) {
                sum += (mat[i][k] - mat[j][k]) * (mat[i][k] - mat[j][k]);
            }
            int intRoot = sqrt(sum);
            if (intRoot * intRoot == sum) {
                counter += 1;
            }
        }
    }

    cout << counter;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;
  string s;
  cin >> n >> s;

  string t = s;
  vector<vector<int>> dp(n+1);
  rep(i,n+1) dp[i].assign(n+1,0);

  rep1(i,n){
    rep1(j,n){
      if(s[i-1]==t[j-1]&&dp[i-1][j-1]<abs(i-j)){
	dp[i][j] = dp[i-1][j-1] + 1;
      }
    }
  }

  int res = 0;
  rep(i,n+1){
    rep(j,n+1){
      res = max(res,dp[i][j]);
    }
  }
  
  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 98176
(* q log(max a b) *)
let kInf = 20202020202
let a, b, q = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let ns = [|a; b|]
let sts = Array.init 2 @@ fun i ->
  let ds = Array.make (ns.(i) + 2) 0 in
  ds.(0) <- -kInf + i; ds.(ns.(i) + 1) <- kInf + i;
  for j = 1 to ns.(i) do ds.(j) <- Scanf.scanf " %d" @@ (+) 0 done;
  ds
let xs = Array.init q @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let is_ok i key a = a.(i) >= key
let binary_search key a =
  let left, right = ref @@ -1, ref @@ Array.length a in
  while !right - !left > 1 do
    let mid = !left + (!right - !left) / 2 in
    if is_ok mid key a then right := mid
    else left := mid done;
  !right
let f x =
  let si1, ti1 = binary_search x sts.(0), binary_search x sts.(1) in
  let s0, s1, t0, t1 = sts.(0).(si1 - 1), sts.(0).(si1), sts.(1).(ti1 - 1), sts.(1).(ti1) in
  let ans = ref kInf in
  ([s0; s1] |> List.iter @@ fun s ->
    [t0; t1] |> List.iter @@ fun t ->
      ans := min !ans @@ min (abs (x - s)) (abs (x - t)) + abs (t - s));
  Printf.printf "%d\n" !ans
let _ = Array.iter f xs

Measured memory_bytes: 6912
#include<bits/stdc++.h>
#define Nmax int(1e5+1000)

using namespace std;

int n, a[Nmax], ans;
bool avail[Nmax];

int main() {
    memset(avail, true, sizeof(avail));
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    int stand = 1;
    while (true) {
        ans++;
        avail[stand] = false;
        stand = a[stand];
        if (!avail[stand]) {cout << -1; return 0;}
        else if (stand == 2) {cout << ans; return 0;}
    }
}


Measured memory_bytes: 768
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };
typedef pair<ll, ll> P;
const int MAX_N = 1000;
int dp[MAX_N + 1][MAX_N + 1];

int solve(string s, string t)
{
    int n = s.size(), m = t.size();
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i <= n; i++) {
        dp[i][0] = i;
    }
    for (int j = 0; j <= m; j++) {
        dp[0][j] = j;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            int cost = (s[i] == t[j] ? 0 : 1);
            // dp[i][j+1]+1のとき，tに文字を挿入する
            // dp[i+1][j]+1のとき，sの文字を削除する
            // dp[i][j]+costのとき，文字を置換する(同じ時は置換しない)
            dp[i + 1][j + 1] = min(min(dp[i][j + 1] + 1, dp[i + 1][j] + 1), dp[i][j] + cost);
        }
    }
    return dp[n][m];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s1, s2;
    cin >> s1 >> s2;
    cout << solve(s1, s2) << endl;
    return 0;
}


Measured memory_bytes: 7136
#define _CRT_SECURE_NO_WARNINGS


#include <stdio.h>
#include <cstdio>
#include <string>
#include <math.h>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

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

std::vector<int> Data;




int main()
{
	int A, B;
	char buf;

	scanf("%c%c%c", &A, &buf, &B);



	if (A < B) puts("<");
	else if (A == B) puts("=");
	else puts(">");

	return 0;
}

Measured memory_bytes: 256
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n;
	cin >> n;
	vector<pii> arr(n+1);
	for(int i = 0; i < n; i++) cin >> arr[i].F >> arr[i].S, arr[i].S+=arr[i].F;
	arr[n].F=2e9+25;
	sort(all(arr));

	stack<int> stk;
	stk.push(n);
	vector<ll> dp(n+1);
	dp[n]=1;
	for(int i = n-1; ~i; i--) {
		while(arr[stk.top()].F < arr[i].S) stk.pop();
		dp[i]=(dp[i+1]+dp[stk.top()])%998244353;
		stk.push(i);
	}
	cout <<dp[0];


	return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

int main (void) {
  std::string w; std::cin >> w;
  std::unordered_map<char,int> k;
  for(int i=0; i<w.size(); i++) {
    if ( k.count(w[i]) == 0 ) k[w[i]] = 1;
    else k[w[i]]++;
  }

  for(auto itr = k.begin(); itr != k.end(); ++itr) {
    if ( itr->second % 2 == 1 ) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }
  std::cout << "Yes" << std::endl;
  return 0;
}

Measured memory_bytes: 256
import math

n = int(input())

def koch(c, px, py, qx, qy):
  if c > 0:
    sx = (2*px+qx)/3
    sy = (2*py+qy)/3
    tx = (px+2*qx)/3
    ty = (py+2*qy)/3
    ux = (tx-sx)*math.cos(math.radians(60))-(ty-sy)*math.sin(math.radians(60))+sx
    uy = (tx-sx)*math.sin(math.radians(60))+(ty-sy)*math.cos(math.radians(60))+sy
    koch(c-1, px, py, sx, sy)
    S = [sx, sy]
    print(" ".join(map(str, S)))
    koch(c-1, sx, sy, ux, uy)
    U = [ux, uy]
    print(" ".join(map(str, U)))    
    koch(c-1, ux, uy, tx, ty)
    T = [tx, ty]
    print(" ".join(map(str, T)))
    koch(c-1, tx, ty, qx, qy)

print("0 0")
koch(n, 0, 0, 100, 0)
print("100 0")


Measured memory_bytes: 5736
n,m=map(int,input().split())
ka=[0]*n
a=[0]*n
for i in range(n):
  ka[i]=list(map(int,input().split()))
  a[i]=(ka[i][1::])
cnt=0
for j in range(1,m+1):
  if (sum(a[i].count(j) for i in range(n))) == n:
    cnt+=1
print(cnt)

Measured memory_bytes: 3188
/*

                         YATIN KWATRA                   _03_08_14


Let's Hoop..

------------------------------------------------

           o
 /|   o         o
 \|=--            o
    ##
                    \\
                 /   \O
                O_/   T
                T    /|
                |\  | |
 _______________|_|________

------------------------------------------------

o- - -  \o          __|
   o/   /|          vv`\
  /|     |              |
   |    / \_            |
  / \   |               |
 /  |                   |


------------------------------------------------

HOOPER_4_LYF..

*/

// AC BAKSHI RABBA

// #pragma GCC optimize "trapv"

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

#define FIO                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pbds                    tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll                      long long
#define ld                      long double
#define ull                     unsigned long long
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                     vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                     unordered_map
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int>
#define pll                     pair<ll,ll>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define MIN                     -1e9
#define pi                      3.1415926535897932384626433832795

using namespace std;
using namespace __gnu_pbds;

void INPUT()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

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

   -> Check For Overflows
   -> Out of Bounds
   -> Initialisations of global arrays and variables
   -> Read the Question and the sample test cases carefully
   -> Its not Always Complex, Try to simplify
   -> write it down and try to solve
   -> Have Faith in urself and in ur approach
   -> If it seems totally out of reach, switch to next :)
   -> And Come Back later, if possible ..

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


void solve()
{

  int n;
  cin >> n;

  vii v(n);

  fo(i, 0, n - 1) cin >> v[i];

  ll ans = 0;

  fo(i, 1, n - 1)
  {
    if (v[i] < v[i - 1])
    {
      ans += -v[i] + v[i - 1];
      v[i] = v[i - 1];
    }
  }

  cout << ans << endl;
}

int main() {

  FIO
  INPUT();

  int t;
  t = 1;
// cin >> t;

  fo(i, 0, t - 1)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3972
#include<cstdio>
#include<cstring>
const int MAXN=15+3;
char s[MAXN];
int len;
int cnt1,cnt2;
int main(){
	scanf("%s",&s);
	len=strlen(s);
	for(int i=0;i<len;i++){
		if(s[i]=='o')
			cnt1++;
		else
			cnt2++;
	}
	if(15-cnt2>=8)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<map>
using namespace std;
int n,a[100100],b[11];
map<int,int>mp;
int main()
{
  cin>>n;
  int t=0;
  for(int i=1;i<=n;i++)
    scanf("%d",&a[i]),t|=a[i];
  if(t==0){cout<<"Yes"<<endl; return 0;}
  if(n%3!=0){cout<<"No"<<endl; return 0;}
  for(int i=1;i<=n;i++)
  	mp[a[i]]++;
  if(mp.size()>3){cout<<"No"<<endl; return 0;}
  int tot=0;
  for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
    if(it->second%(n/3)!=0){cout<<"No"<<endl; return 0;}
    else 
	{
	  b[++tot]=it->first;
      if(it->second>=n/3*2) b[++tot]=it->first;
      if(it->second>=n) b[++tot]=it->first;
	}
  if((b[1]^b[3])==b[2] && (b[2]^b[3])==b[1] && (b[1]^b[2])==b[3]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

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

	vector<int> rsl;
	while(true) {
		int D, n, m;
		cin >> D;
		if(D == 0) break;
		cin >> n >> m;

		vector<int> d, d_prime, k;
		d.push_back(0);
		d.push_back(D);
		d_prime.push_back(-D);
		d_prime.push_back(0);
		rep(i, 0, n - 1) {
			int tmp_d;
			cin >> tmp_d;
			d.push_back(tmp_d);
			d_prime.push_back(-tmp_d);
		}

		rep(i, 0, m) {
			int tmp_k;
			cin >> tmp_k;
			k.push_back(tmp_k);
		}

		vsort(d);
		vsort(d_prime);

		int total_distance = 0;
		rep(i, 0, m) {
			int locate1 = lower_bound(d.begin(), d.end(), k[i]) - d.begin();
			int locate2 = lower_bound(d_prime.begin(), d_prime.end(), -k[i]) - d_prime.begin();
			int tmp1 = 1e9, tmp2 = -1e9;
			if(locate1 < d.size()) {
				tmp1 = *lower_bound(d.begin(), d.end(), k[i]);
			}
			if(locate2 < d_prime.size()) {
				tmp2 = *lower_bound(d_prime.begin(), d_prime.end(), -k[i]);
			}

			int distance = min(abs(tmp1 - k[i]), abs(tmp2 + k[i]));
			total_distance += distance;
		}

		rsl.push_back(total_distance);
	}

	rep(i, 0, rsl.size()) cout << rsl[i] << endl;
}



Measured memory_bytes: 3952