akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n - 1); rep(i, n - 1)cin >> a[i];
	int ans = 0;
	ans += a[0]; ans += a[n - 2];
	rep(i, n - 2) {
		ans += min(a[i], a[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int dp[110000];
const int mod = 1000000007;
signed main(){
    int n,m;cin >> n >> m;
    vector<int> cnt(n+2);
    rep(i,m){
        int a;cin >> a;
        cnt[a]++;
    }
    dp[0] = 1;
    rep(i,n){

        if(cnt[i])continue;
        dp[i+1] = (dp[i+1]+dp[i])%mod;
        dp[i+2] = (dp[i+2] + dp[i])%mod;
    }
    cout << dp[n] << endl;
    // trace(cnt);

    return 0;
}

Measured memory_bytes: 4904
N, L = map(int, input().split())
a = list(map(int, input().split()))

f = 0
for i in range(N-1):
    if a[i] + a[i+1] >= L:
        f = 1
        t = i
        break
#print(t)
if f == 0:
    print("Impossible")
else:
    print("Possible")
    ans = []
    for i in range(t):
        ans.append(i+1)
    for i in range(N-1, t, -1):
        ans.append(i)
    #print(ans)
    for x in ans:
        print(str(x))


Measured memory_bytes: 91932
#include <iostream>

int main()
{
  int n;
  int s;
  int r=0;
  std::cin >> n;

for (int x=1; x <= n; ++x){
  s = x;
  if ( s > 0 && s < 10){
    r++;
  }
  s /= 100;
  if ( s > 0 && s < 10){
    r++;
  }
  s /= 100;
  if ( s > 0 && s < 10){
    r++;
  }
  s /= 100;
  if ( s > 0 && s < 10){
    r++;
  }
}

std::cout << r << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define FOR(i,a,b) for(int i=(a);i<(b);++i) 
#define REP(i,n) FOR(i,0,n)
#define EACH(x,a) for(auto& (x):(a))
#define ALL(obj) (obj).begin(),(obj).end()
#define Yes(n) cout<<((n)?"Yes":"No")<<endl;
using namespace std;
using ll=long long;
const int INF=1e9;
const ll LINF=1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  int N,A,B;
  int p[100];
  cin>>N>>A>>B;
  REP(i,N) cin>>p[i];

  int nOne=0;
  int nTwo=0;
  int nThree=0;
  REP(i,N){
    if(p[i]<=A) ++nOne;
    if(A+1<=p[i] && p[i]<=B) ++nTwo;
    if(B+1<=p[i]) ++nThree;
  }

  int ans=INF;
  ans=min(ans,nOne);
  ans=min(ans,nTwo);
  ans=min(ans,nThree);

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)
typedef long long ll;

int n_piece, n_x;

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

	cin >> n_piece >> n_x;

	if (n_piece >= n_x) {
		cout << 0 << endl;
		exit(0);
	}

	vector<int> xs(n_x);
	FOR(i, 0, n_x) {
		cin >> xs[i];
	}
	sort(xs.begin(), xs.end());

	//cout << "xs:" << endl;
	//FOR(i, 0, n_x) cout << xs[i] << endl;
	//cout << endl;

	vector<int> dxs(n_x-1);
	FOR(i, 0, n_x - 1) {
		dxs[i] = xs[i + 1] - xs[i];
	}
	sort(dxs.begin(), dxs.end(), greater<int>());

	//cout << "dxs:" << endl;
	//FOR(i, 0, n_x-1) cout << dxs[i] << endl;
	//cout << endl;

	//ans = x[M-1] - x[0] - max(2点間距離)
	int ans = xs.back() - xs[0];
	FOR(i, 0, n_piece - 1) {
		ans -= dxs[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
# coding: utf-8

from copy import deepcopy

N = int(input())


w = []


# def rec(word, appeared):
#     print(appeared)
#     print(word)
#     print(w)
#     input()
#     new_appeared = deepcopy(appeared)

#     length = len(word)

#     if length == N:
#         w.append(word)
#         return None

#     last = appeared[-1]
#     new_appeared.append(chr(ord(last) + 1))
#     for tail in new_appeared:
#         rec(word + tail, new_appeared)


# rec("a", ["a"])


def rec(word):
    # print(appeared)
    # print(word)
    # print(w)
    # input()

    appeared = []
    for c in word:
        if c not in appeared:
            appeared.append(c)

    length = len(word)

    if length == N:
        w.append(word)
        return None

    last = appeared[-1]
    appeared.append(chr(ord(last) + 1))
    for tail in appeared:
        rec(word + tail)


rec("a")

for word in sorted(w):
    print(word)


Measured memory_bytes: 14044
#include<stdio.h>
int main(void)
{
	int x,a,b;
	scanf("%d %d %d",&x,&a,&b);
	if(a>=b) printf("delicious\n");
	else if(b-a<=x) printf("safe\n");
	else if(b-a>=x) printf("dangerous\n");
	return 0;
}	

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

//ABC131
signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    int n,k; cin>>n>>k;
    if(k>(n-1)*(n-2)/2){
        cout<<-1<<endl; return 0;
    }

    int hen=n-1;
    vector<P> vec(hen);
    rep(i,n-1){
        vec[i]=P(1,i+2);
    }
    int now=(n-2)*(n-1)/2;
    for(int i=2; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            if(now>k){
                vec.push_back(P(i,j));
                hen++;
                now--;
            }
        }
    }

    cout<<hen<<endl;
    rep(i,hen){
        cout<<vec[i].first<<' '<<vec[i].second<<endl;
    }

    

}

Measured memory_bytes: 512
////////////////////////////////////
////////////////////////////////////
////                            ////
////                            ////
////     Please give me AC!     ////
////     Please give me AC!     ////
////                            ////
////                            ////
////////////////////////////////////
////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=13;
ll mod_pow(ll x,ll y){//x^yを返す//計算量は0(log(y))
  ll t=x,r=1;
  while(y){
    if(y%2){r=r*t%MOD;}
    y>>=1;
    t=t*t%MOD;
  }
  return r;
}
int main(){
  string S;
  cin>>S;
  ll dp[200020][26],mod=1e9+7;
  ll dpcopy[13];
  for(ll i=1;i<=(ll)S.size();i++){
    if(S.at(i-1)=='?'){
      for(ll j=0;j<13;j++){
        if(i==1 && j<10){
          ll w=(ll)S.size()-1;
          ll a=mod_pow(10,w)*j;
          a%=13;
          dp[1][a]=1;
        }
        else if(i>1){
          for(ll k=0;k<13;k++){
            dpcopy[k]=dp[i-1][k];
          }
          for(ll k=0;k<10;k++){
            ll w=(ll)S.size()-i;
            ll a=mod_pow(10,w)*k;
            a%=13;
            dp[i][j]+=dpcopy[(j-a+13)%13];
            dp[i][j]%=mod;
          }
          for(ll k=0;k<13;k++){
            dp[i-1][k]=dpcopy[k];
          }
        }
      }
    }
    else{
      if(i==1){
        ll w=(ll)S.size()-i;
        ll a=mod_pow(10,w)*(S.at(i-1)-'0');
        a%=13;
        dp[1][a]=1;
      }
      else{
        for(ll j=0;j<13;j++){
          dpcopy[j]=dp[i-1][j];
        }
        ll w=(ll)S.size()-i;
        ll a=mod_pow(10,w)*(S.at(i-1)-'0');
        a%=13;
        for(ll j=0;j<13;j++){
          dp[i][j]=dpcopy[(j-a+13)%13];
        }
        for(ll j=0;j<13;j++){
          dp[i-1][j]=dpcopy[j];
        }
      }
    }
  }
  cout<<dp[(ll)S.size()][5]%mod<<endl;
}

Measured memory_bytes: 24084
#include<bits/stdc++.h>
using namespace std;
#define ff(i,n) for(i=0;i<n;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
ll bg=998244353;
void updateBIT(ll BITree[], ll n, ll index, ll val) 
{ 
    index = index + 1; 
    while (index <= n) 
    { 
        BITree[index] += val; 
        index += index & (-index); 
    } 
} 
ll *constructBITree(ll arr[], ll n) 
{ 
    ll *BITree = new ll[n+1]; 
    for (ll i=1; i<=n; i++) 
        BITree[i] = 0; 
    for (ll i=0; i<n; i++) 
        updateBIT(BITree, n, i, arr[i]); 
    return BITree; 
} 
ll getSum(ll BITree[], ll index)  
{
	ll sum =0;
    index = index + 1; 
    while (index>0) 
    { 
        sum += BITree[index]; 
        index -= index & (-index); 
    } 
    return sum; 
} 
void update(ll BITree[], ll l, ll r, ll n, ll val) 
{ 
    updateBIT(BITree, n, l, val); 
    updateBIT(BITree, n, r+1, -val); 
} 
ll gcd(ll n1, ll n2) {
    if (n2 != 0)
        return gcd(n2, n1 % n2);
    else
        return n1;
}
ll pp(string str) 
{ 
    ll l = 0; 
    ll h = str.length() - 1; 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return 0; 
        } 
    } 
	return 1; 
}
int main()
{
    ll t;
    t=1;
    while(t--)
    {
    	ll i,j,n,q;
    	long double l;
    	cin>>l;
    	long double aa = l/3;
    	aa=aa*aa*aa;
		cout<<setprecision(10)<<aa;      
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  vector<int> P(n); rep(i, n) cin >> P[i];
  sort(all(P));
  cout << accumulate(begin(P), begin(P)+k, 0LL) << endk;
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
 int a,b;
 cin >> a >> b;
 if( a < b ){
    cout << "a < b" << endl;
 }else if(a > b){
    cout << "a > b" << endl;
 }else{
    cout << "a == b" << endl;
 };
 return 0;
}

Measured memory_bytes: 3052
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)


int main(){
   int n,m;
   string s;
   cin >> n >> m;
   vector<double> v(n);
   int sum=0;
   rep(i,n){
      int x;
      cin >> v[i];
      sum+=v[i];
   }
   int a=0;
   rep(i,n){
      if ( v[i] >= double(sum)/(4.0*m) ){
         a++;
      }
   }
   //cout << sum << endl;
   //cout << double(sum)/(4.0*m) << endl;
   //cout << a << endl;
   if (a >= m) cout << "Yes" << endl;
   else cout << "No" << endl; 
   

   
   return 0;
}


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

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

		while(true) {
			int n = sc.nextInt();
			if (n == 0) return;
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
			}
			int min = Integer.MAX_VALUE;
			Arrays.sort(a);
			for (int i = 0; i < n-1; i++) {
				min = Math.min(min, Math.abs(a[i]-a[i+1]));
			}
			System.out.println(min);

		}
	}
}


Measured memory_bytes: 46104
import java.util.Scanner;
import java.io.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] nums = new int[50];
        int[] temp = new int[50];
        
        while(true){
            int n;
            if((n=sc.nextInt())==0) break;
            int r=sc.nextInt();
            for(int i=0;i<n;i++) nums[i]=n-i;
            for(int i=0;i<r;i++){
                int p=sc.nextInt();
                int c=sc.nextInt();
                for (int j=0;j<p-1;j++) temp[j] = nums[j];
                for (int j=0;j<c;j++) nums[j] = nums[j+p-1];
                for (int j=0;j<p-1;j++) nums[c+j] = temp[j];
            }
            System.out.println(nums[0]);
        }
    }
}

Measured memory_bytes: 37224
// /*
// power code taken from geeks for geeks
// */
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>
#define MODD 1000000007LL
#define MAX_SIZE 100000000
#define MAX_N 1000001LL
using namespace std;
typedef long long ll;
typedef long double ld;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
    return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
    P = (P * k) % MODD;

return P;
}


struct p_str{
    ll a, b;
};


void solve(){
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }

    ll cost[n];
    memset(cost, 0, sizeof(cost));
    cost[0]=0;
    cost[1]=modd(a[1]-a[0]);
    for(ll i=2;i<n;i++){
        ll t1=modd(a[i]-a[i-2])+cost[i-2];
        ll t2=modd(a[i]-a[i-1])+cost[i-1];
        cost[i]=min(t1, t2);
    }

    cout<<cost[n-1]<<endl;
}



int main(){




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

    ll t=1;

    // init();

    // cin>>t;

    while(t--){

        solve();
    }
    return 0;
}


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

int main(){
  
  long long L,R;
  cin >> L >> R;
  
  vector<long long> pros = {};

  if (R-L >= 2019) cout << 0 << endl;
  else{
    for(long long i=L;i<R+1;i++){
      for(long long j=i+1;j<R+1;j++){
        pros.push_back(i*j);
      }
    }

    for(long long i=0;i<pros.size();i++){
      pros[i] %= 2019;
    }

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

    cout << pros[0] << endl;
  }
}

Measured memory_bytes: 18408
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
#define N 15
lint dp[200100][N+5],d2[200100][N+5];
lint a[200100];
lint inf=12345678901234LL;
/*int cal(lint x,lint y){
	int ret=0;
	if(y<x){
		while(y<x) y*=4,ret++;
	}
	else{
		while(x*4<=y) x*=4,ret--;
	}
	return ret;
}*/
int main()
{
	int n;cin>>n;rep(i,n) cin>>a[i];
	//rep(i,n+5) rep(j,N+2) dp[i][j]=d2[i][j]=inf;
	rep(i,N+1) dp[0][i]=i;
	rep(i,n-1){
		lint now=a[i+1],pre=a[i];int num=0;
		rep(j,N+1){
			while(pre<now) num++,pre*=4;
			if(num>N) dp[i+1][j]=dp[i][N]+(i+1)*(num-N)+j;
			else dp[i+1][j]=dp[i][num]+j;
			now*=4;
		}
	}
	rep(i,N+1) d2[n-1][i]=i;
	for(int i=n-1;i>0;i--){
		lint now=a[i-1],pre=a[i];int num=0;
		rep(j,N+1){
			while(pre<now) num++,pre*=4;
			if(num>N) d2[i-1][j]=d2[i][N]+(n-i)*(num-N)+j;
			else d2[i-1][j]=d2[i][num]+j;
			now*=4;
		}
	}
	//rep(i,n) rep(j,3) cout<<i<<' '<<j<<' '<<dp[i][j]<<' '<<d2[i][j]<<endl;
	lint out=min(d2[0][0],dp[n-1][0]+n-1)*2;
	rep(i,n-1){
		out=min(out,dp[i][0]*2+i+1+d2[i+1][0]*2);
	}
	cout<<out<<endl;
}


Measured memory_bytes: 64384
/*Bismillahir Rahmanir Rahim
->>Code by Ashraful Islam Paran
->>CUET,CSE
*/
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
#define f(a,b,x) for(int a=b;a<x;a++)
#define pb push_back
#define endl "\n"
#define MX 200000
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define vi vector<int>

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

    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0)
        cout<<"1"<<endl;
    else if(b==0)
        cout<<"2"<<endl;
    else if(c==0)
        cout<<"3"<<endl;
    else if(d==0)
        cout<<"4"<<endl;
    else
        cout<<"5"<<endl;

    return 0;
}


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

int main() {
  int a;
  cin >> a;
  int s1 = a / 100;
  int s2 = (a - s1 * 100) / 10;
  int s3 = (a - s1 * 100 - s2 * 10);
  
  cout << s1 + s2 + s3 << endl;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)

#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define pii pair<int, int>
#define vi vector<int>

using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T>& p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T>& vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
constexpr ll MOD = 1000000007;

int N, M;
constexpr int MAX = 3001;
ll dp[2][MAX][2];//m個取り出したあとにn個の赤球、左端経験

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

    if(N == 1){
        ll ans = 2;
        rep(i, M){
            ans = (ans*2)%MOD;
        }
        cout << ans << endl;
        return 0;
    }

    rep(r, N+1){
        if(r == 0){
            dp[0][0][1] = 1;
        } else {
            dp[0][r][0] = 1;
        }
    }
    rep1(m, M){
        rep(r, N+1){
            if(r == 0){
                dp[1][0][1] = (dp[0][0][1]+dp[0][1][0]+dp[0][1][1]) % MOD;
            } else if (r == N){
                dp[1][N][0] = (dp[0][N][0] + dp[0][N-1][0])%MOD;
                dp[1][N][1] = (dp[0][N][1] + dp[0][N-1][1])%MOD;
            } else if(r == 1){
                dp[1][1][0] = (dp[0][1][0] + dp[0][2][0])%MOD;
                dp[1][1][1] = (dp[0][0][0] + dp[0][1][0] + dp[0][0][1] + 2*dp[0][1][1] + dp[0][2][1])%MOD;
            } else {
                dp[1][r][0] = (dp[0][r-1][0] + 2*dp[0][r][0] + dp[0][r+1][0])%MOD;
                dp[1][r][1] = (dp[0][r-1][1] + 2*dp[0][r][1] + dp[0][r+1][1])%MOD;
            }
        }
        rep(r, N+1){
            dp[0][r][0] = dp[1][r][0];
            dp[0][r][1] = dp[1][r][1];
        }
    }
    ll sum = 0;
    rep(i, N+1){
        sum= (sum + dp[1][i][1])%MOD;
    }
    cout << sum << endl;

    return 0;
}


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

int main () {

    string s;
    cin >> s;

    int K;
    cin >> K;

    // 先頭から順にaにしたい
    // ただし、「aに変えるためのコスト >= K」のときはそのまま
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != 'a' && K > 'z' - s[i]) {
            K -= 'z' - s[i] + 1;
            s[i] = 'a';
        }
    }

    // 操作はちょうどK回行わなければならない
    // 末尾の文字をインクリメントしまくる
    // ただし、26回でループするので、26の剰余をとる
    K %= 26;
    while (K > 0) {
        if (s[s.size() - 1] != 'z') s[s.size() - 1]++;
        else s[s.size() - 1] = 'a';
        K--;
    }
    cout << s << endl;

    return 0;
}

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

#define ff first
#define ss second
#define pb push_back

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 100005;

int main() {
	int n;
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	printf("%s\n", a + b + c >= 22 ? "bust" : "win");
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

char a[802][808];

int main() {
    int h, w, k;
    cin >> h >> w >> k;

    int i0, j0;
    for (int i = 1; i <= h; i++) {
        cin >> a[i];
        for (int j = 0; j < w; j++) {
            if (a[i][j] == 'S') i0 = i, j0 = j, a[i][j] = '.';
        }
    }

    queue<pair<int, int>> q;
    q.push({ i0, j0 });
    int d = 800;

    for (int l = 0; l <= k; l++) {
        int n = (int)q.size();
        for (int m = 0; m < n; m++) {
            auto p = q.front(); q.pop();
            int i = p.first, j = p.second;
            if (a[i][j] != '.') continue;
            a[i][j] = '+';
            d = min(d, i - 1);
            d = min(d, h - i);
            d = min(d, j);
            d = min(d, w - 1 - j);
            q.push({ i - 1, j });
            q.push({ i, j - 1 });
            q.push({ i, j + 1 });
            q.push({ i + 1, j });
        }
    }

    cout << (d + k - 1) / k + 1 << endl;

    return 0;
}

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

ans = 0

def isAok(a, b):
    return True if a < b else False

def isCok(b, c):
    return True if c > b else False


for b in B:
    left = -1
    right = N
    while right-left > 1:
        mid = left + (right-left)//2
        if isAok(A[mid], b):
            left = mid
        else:
            right = mid
    acnt = left + 1

    left = -1
    right = N
    while right-left > 1:
        mid = left
        mid = left + (right-left)//2
        if isCok(b, C[mid]):
            right = mid
        else:
            left = mid
    ccnt = N-right
    ans += acnt * ccnt
print(ans)





Measured memory_bytes: 29336
#include<bits/stdc++.h>
using namespace std;
#define int long long 
int32_t main(){
   int n,k;
   cin>>n;
   string s;
   cin>>s;
   cin>>k;
   char t=s[k-1];
   for(int i=0;i<n;++i){
       if(s[i]!=t)
       s[i]='*';
   }
   cout<<s;
   return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n;
    cin>>n;
    set<string> a;
    string s;
    rep(i,n){
        cin>>s;
        a.insert(s);
    }
    cout<<a.size()<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 19248
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          int n = Input.ScanInt();
          int h = Input.ScanInt();
          int w = Input.ScanInt();
          Console.WriteLine((n-h+1)*(n-w+1));
          
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>

typedef signed char        int8;
typedef short              int16;
typedef int                int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned int       uint32;
typedef unsigned long long uint64;

int main(void) {
  int n, m;
  std::cin >> n >> m;
  std::cout << (n == m ? "Yes" : "No") << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define maxn 40005
#define pb push_back
using namespace std;

int main()
{
    ll x, sum = 0;

    cin >> x;

    ll t = (x / 500);
    x %= 500;

    sum += (t * 1000);
    sum += (x / 5) * 5;

    cout << sum << endl;

    return 0;
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

ll a[100001];
int main(){
    int N;
    cin >> N;
    ll inp;
    ll num = 0;
    REP(i,N){
        cin >> inp;
        if(inp > 100000)
            num++;
        else
            a[inp]++;
    } 
    REP(i,100001){
        if(a[i] > i)
            num += a[i] - i;
        else if(a[i] < i)
            num += a[i];
    }
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define rep(i,b) for(ll i=0;i<b;i++)
using namespace std;

int main(){
    string S;
    cin >>S;
    int n=S.size()-1;
    ll ans=0;

    for(int i=0;i<(1<<n);++i){
        ll a=S[0]-'0';
        ll b=0;
        for (int j=0;j<n;++j){//bitと1-n番目のbit数が一致するか
            if (i&(1<<j)){
                b+=a;
                a=S[j+1]-'0';//ある桁をそのまま数字にして足す
            }else{
                a=a*10+S[j+1]-'0'; //位を上げて連結した数字に
            }
        }
        b+=a;
        ans+=b;
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int a,b;
	cin >> a >> b;
	cout << a *b;
}

Measured memory_bytes: 3640
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

def dist(a,b):
    return abs(a[0]-b[0]) + abs(a[1]-b[1])
def calc(xy):
    mn1 = min(xy, key=lambda z: z[0]+z[1])
    mx1 = max(xy, key=lambda z: z[0]+z[1])

    mn2 = min(xy, key=lambda z: z[0]-z[1])
    mx2 = max(xy, key=lambda z: z[0]-z[1])

    return max(dist(mn1, mx1), dist(mn2, mx2))
    
print(calc(xy))

Measured memory_bytes: 106684
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.IArray           as IA
import qualified Data.Array.IO               as AI
import qualified Data.Array.MArray           as MA
import qualified Data.Array.ST               as STA
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import qualified Data.Graph                  as G
import           Data.Int
import qualified Data.IntMap                 as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence               as SQ
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Tree                   as T
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putLn :: Show a => a -> IO ()
putLn = print

putList :: Show a => [a] -> IO ()
putList [n] = put n
putList (n:ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n] = putStr n
putStrList (n:ns) = do
  putStr n
  putStr " "
  putStrList ns

main = do
  s <- getLine
  put $ '1' `count` s


Measured memory_bytes: 380
#include <iostream>
using namespace std;
int main(void){
    
    string S, T;
    int ans=0;
    cin >> S >> T;
    for(int i=0; i<S.size(); i++){
        if(S[i]==T[i]){
            ans+=1;
        }
    }
    if(S.size()==ans){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    
}

Measured memory_bytes: 3600
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
use std::io::prelude::*;

fn input<T>() -> T
    where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let x: usize = input();
    let mut tmp = x / 11 * 2;
    let ret = x % 11;
    if ret > 0 {
        tmp+=1;
    }
    if ret > 6 {
        tmp+=1;
    }
    println!("{}", tmp);
}


Measured memory_bytes: 4352
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.*;

public class Main {
	public Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		while(sc.hasNext()){
			new aoj0055().doIt();
		}
	}
	class aoj0055{
		void doIt() {
			double a[] = new double[10];
			a[0] = sc.nextDouble();
			double sum = a[0];
			for(int i = 1;i < 10;i++){
				if(i % 2 == 1) a[i] = a[i - 1] * 2;
				else a[i] = a[i - 1] / 3;
				sum = sum + a[i];
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 19228
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,k;
  cin>>n>>k;
  long long int a[n+1];
  for(long long int i=1;i<=n;i++)
  {
    cin>>a[i];
  }
  long long int b[n+1];
  b[1]=0;
  b[2]=abs(a[2]-a[1]);
  for(long long int i=3;i<=n;i++)
  {
  	long long int mini=99999999999999;
  	long long int j=i-1;
  	while(j<i&&j>0&&j>=i-k)
  	{
  		if((b[j]+abs(a[i]-a[j]))<mini)
  		mini=b[j]+abs(a[i]-a[j]);
  		j--;
	  }
    //b[i]=min((b[i-1]+abs(a[i]-a[i-1])),(b[i-2]+abs(a[i]-a[i-2])));
  b[i]=mini;
  }
  cout<<b[n];
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
    int x,y;

    scanf("%d %d",&x, &y);

    int max = x + y;
    if(x - y > max)
    max = x - y;
    if( x * y > max)
    max = x * y;

    printf("%d", max);

    return 0;
}

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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	int n;
	int d[105];
	int ans = 0;
	cin >> n;
	rep(i, n) cin >> d[i];
	qsort(d, n, sizeof(int), asc);
	rep(i, n-1){
		if(d[i] != d[i+1]){
			ans++;
		}
	}
	cout << ans+1 << endl;
}

Measured memory_bytes: 256
x = [59049, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6, 1]


a = [0]
(0...100000).each do |i|
  x.each do |j|
    a[i + j] = [a[i] + 1, a[i + j] || 99999999].min
  end
end

n = gets.to_i
puts a[n]

Measured memory_bytes: 5116
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n;
  ll a;
  ll c;
  cin >> n;
  c = 0;
  rep(i,n){
    cin >> a;
    if(c==a-1){
      c++;
    }
  }
  if(c==0) pri (-1);
  else pri(n-c);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	std::string s; cin >> s;
	
	if(s == "AAA" or s == "BBB") printf("No\n");
	else printf("Yes\n");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a[100010],dp[100010],k;
long long Abs(long long u)
{
    if(u>0) return u;
    else return u*(-1);
}
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        dp[i]=LONG_LONG_MAX;
    }
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(j>=i) break;
            if((dp[i]>dp[i-j]+Abs(a[i]-a[i-j]))) dp[i]=dp[i-j]+Abs(a[i]-a[i-j]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}



Measured memory_bytes: 5136
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>

using namespace std;


int main(void)
{
	string s;
	cin >> s;

	char a, b;
	int count_a;


	if (s[0] == s[1] && s[0] == s[2] && s[0] && s[3]) {
		cout << "No" << endl;
		return 0;
	}
	if ((s[0] == s[1]) && (s[2] == s[3])) {
		cout << "Yes" << endl;
		return 0;
	}
	else if((s[0] == s[2]) && (s[1] == s[3])) {
		cout << "Yes" << endl;
		return 0;
	} if ((s[0] == s[3]) && (s[1] == s[2])) {
		cout << "Yes" << endl;
		return 0;
	}
	
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define pl(n) printf("%lld",n)
#define psp printf(" ")
#define endc printf("\n")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn = 2e5 + 7; 
//const int md = 1e9 + 7;

ll z[maxn];

int main() {
	IOS;
	string a; cin>>a; ll n = a.size(); a = " " + a;
	ll ans = n*(n-1)/2;
	for (int i = 1; i <= n; i++) {
		z[a[i]]++;
	}
	for (int i = 0; i < maxn; i++) {
		ans -= z[i]*(z[i]-1)/2;
	}
	cout<<(ans+1)<<endl;
}


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

const long long MOD = 1000000007;

void solve(long long N, long long K){
    ll ans = 0;
    for(ll i = K;i <= N;i++){
        ll Min = (i - 1) * i / 2;
        ll Max = ((N + 1) * N - ((N - i) + 1) * (N - i)) / 2;
        ans += (Max - Min + 1);
        //cout<<Max<<" "<<Min<<endl;
        ans %= MOD;
    }
    cout<<(ans + 1)%MOD<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

const ll INF = 1e17;
const ll MOD = 1e9+7;

int main() {
    // input, ready
    int A1,A2,A3;
    cin >> A1 >> A2 >> A3;

    //resolve
    if ((A1+A2+A3) >= 22) cout << "bust" << endl;
    else cout << "win " << endl;
    return 0;
}


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

ll dp[50][5005];

int main(){
    ll n,m,s;
    cin >> n >> m >> s;
    ve<ve<pair<ll,P>>> e(n);
    rep(i,m){
        ll u,v,a,b;
        cin >> u >> v >> a >> b;
        u--;v--;
        e[u].push_back(pair<ll,P>(v,P(a,b)));
        e[v].push_back(pair<ll,P>(u,P(a,b)));
    }
    ve<P> cd(n);
    rep(i,n)cin >> cd[i].first >> cd[i].second;
    ll INF = (ll)2e15;
    memset(dp,-1,sizeof(dp));
    dp[0][min(s,(ll)5000)] = 0;
    queue<ll> q;
    q.push(0);
    while(!q.empty()){
        int now = q.front();
        q.pop();
        int c = cd[now].first;
        int d = cd[now].second;
        rep(i,5001){
            if(dp[now][i] == -1)continue;
            if(i+c >=5005) continue;
            if(dp[now][i+c] == -1){
                dp[now][i+c] = dp[now][i] + d;
                continue;
            }
            dp[now][i+c] = min(dp[now][i+c],dp[now][i]+d);
        }
        for(auto x: e[now]){
            int to = x.first;
            int a = x.second.first;
            int b = x.second.second;
            bool flag=false;
            rep(i,5001){
                if(dp[now][i] == -1)continue;
                if(i<a)continue;
                if(dp[to][i-a] == -1){
                    dp[to][i-a] = dp[now][i] + b;
                    flag = true;
                    continue;
                }
                if(dp[to][i-a] > dp[now][i]+b){
                    dp[to][i-a] = dp[now][i]+b;
                    flag = true;
                }
            }
            if(flag)q.push(to);
        }
    }
    rep(i,n-1){
        ll ans=INF;
        rep(j,5005){
            if(dp[i+1][j]==-1)continue;
            ans = min(ans,dp[i+1][j]);
        }
        cout << ans << endl;
    }
    return 0;
}

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

#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MN = 3000 + 5, LN = 17, MOD = 998244353, INF = 0x3f3f3f3f, BSZ = 320;
int N, S;
int a[MN];
ll dp[MN][MN];

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> N >> S;
    for (int i = 1; i <= N; i++) cin >> a[i];
    ll ret = 0;
    // dp[i][j], how many ways to place open brackets at [1,i] and sum of j
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= S; j++) dp[i][j] = dp[i - 1][j];
        (dp[i][a[i]] += i) %= MOD;
        for (int j = S; j >= a[i]; j--) {
            (dp[i][j] += dp[i - 1][j - a[i]]) %= MOD;
        }
        ret = (ret + dp[i][S]) % MOD;
    }
    cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 74048
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;

int main(){
int N,D;
cin>>N>>D;
int X[N][D];
rep(i,N)rep(j,D)cin>>X[i][j];
int count=0;
rep(i,N){
    rep2(j,i+1,N){
    
    int dist2=0;
    rep(k,D){
        dist2+=(int)pow(X[i][k]-X[j][k],2);
    }
    rep3(k,200){
        if(dist2==k*k){
            count++;
            break;
        }
        
    }
}
}
cout<<count<<endl;


return 0;
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  for (int i = 0;i < 1000;i++) {
    if(C-B*i<=0) {
      cout << "Yes" ;
      break;
    }
    else if(A-D*i<=0){
      cout << "No" ;
      break;
    }
    else {
      continue;
    }
  }
}


Measured memory_bytes: 3604
import bisect
while True:
    n,S = map(int, raw_input().split())
    if n == 0 and S == 0:
        break
    r = [input() for i in range(n)]
    ans = 0
    r.sort()
    for i in range(n):
        tmp = S - r[i] + 1
        if (tmp <= 0):
            ans += n - 1
        else:
            index = bisect.bisect_left(r, tmp)
            if (index <= i):
                ans += n - index - 1
            else:
                ans += n - index
    print ans / 2

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

int main() {

    int a,b,m;
    cin >> a >> b >> m;
    vector <int> ap(a);
    vector <int> bp(b);
    
    rep(i,a) cin >> ap.at(i);
    rep(i,b) cin >> bp.at(i);

    map<pair<int,int>,int> mp;

    rep(i,m){
        int ta,tb,tc;
        cin >> ta >> tb >> tc;
        pair<int,int> tmp = make_pair(ta,tb);

        int pre = mp[tmp];
        if(tc > pre){
            mp[tmp] = tc;
        }
    }

    int min_value = 100000000;
    int min_a = 1000000000;
    int min_b = 1000000000;

    rep(i,a) if(min_a > ap.at(i)) min_a = ap.at(i);
    rep(i,b) if(min_b > bp.at(i)) min_b = bp.at(i);

    int min_mp = 100000000;
    for(auto x = mp.begin(); x != mp.end(); ++x){

        int tmp = ap.at(x->first.first-1) + bp.at(x->first.second-1) - x->second;
        if(min_mp > tmp) min_mp = tmp;   
    }

    cout << min(min_mp, min_a + min_b)<< endl;
}

Measured memory_bytes: 7296