akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int a[4];
char s[300];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i];
		if(s[i]=='P') a[0]++;
		if(s[i]=='W') a[1]++;
		if(s[i]=='G') a[2]++;
		if(s[i]=='Y') a[3]++;
	}
	int cnt=0;
	for(int i=0;i<4;i++){
		if(a[i]!=0) cnt++; 
	}
	if(cnt==1) cout<<"One"<<endl;
	if(cnt==2) cout<<"Two"<<endl;
	if(cnt==3) cout<<"Three"<<endl;
	if(cnt==4) cout<<"Four"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

int main() {
    ll A, B, V, W, T;
    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    if (A < B) {

        if (A + V * T >= B + W * T)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    } else if (A == B) {
        cout << "YES" << endl;
    } else {
        if (B - W * T < A - V * T) {
            cout << "NO" << endl;
        } else {
            cout << "YES" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
template<class T> istream& operator>>(istream &is,vector<T> &st){
  for(size_t i=0;i<st.size();++i) is >> st[i];
  return is;
}
template<class T> istream& operator>>(istream &is,vector<vector<T>> &st){
  for(size_t i=0;i<st.size();++i) is >> st[i];
  return is;
}
template<class T> ostream& operator<<(ostream &os, const vector<T> &st){
  for(size_t i=0;i<st.size();++i){
    if(i==st.size()-1) os << st[i];
    else os << st[i] << " ";
  }
  return os;
}
template<class T> ostream& operator<<(ostream &os, const vector<vector<T>> &st){
  for(size_t i=0;i<st.size();++i){
    os << st[i];
    if(i!=st.size()-1) os << endl;
  }
  return os;
}
int N;
vvi dp;
vi w;
int solve(){
  for(int W = 2; W <= N; W++){ //区間の大きさ
  for(int l = 0; l < N; l++){
    int r = l + W;
    if(r > N) continue;
    if(dp[l+1][r-1]==W-2 && abs(w[l]-w[r-1]) <= 1) dp[l][r] = W; //遷移1
    for(int m = l+1; m < r;m++) //遷移2
    dp[l][r] = max(dp[l][r],dp[l][m]+dp[m][r]);
  }
}
return dp[0][N];
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(cin >> N,N){
    dp.assign(N+1,vi(N+1,0));
    w.resize(N);
    cin >> w;
    cout << solve() << endl;
  }
}



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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int k = sc.nextInt();
		
		char[][] c = new char[h][w];
		Arrays.setAll(c, i -> sc.next().toCharArray());
		
		int cnt = 0;
		
		for (int maskR = 0; maskR < 1 << h; maskR++) {
			for (int maskC = 0; maskC < 1 << w; maskC++) {
				int black = 0;
				
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < w; j++) {
						if (((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0
								&& c[i][j] == '#')
							black++;
					}
				}
				
				if (black == k) cnt++;
			}
		}
		System.out.println(cnt);
		
		sc.close();
	}
	
}



Measured memory_bytes: 32300
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
	string a, b;
	cin >> a >>b;
	if (a.size()> b.size() ||(a.size() == b.size() && a > b)) cout << "GREATER" << endl;
	else if(a == b) cout << "EQUAL" << endl;
	else cout << "LESS" << endl;
	
	//cout << ans << endl;
}

Measured memory_bytes: 256
//
// Created by yuu on 2019-04-17.
//

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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; }

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 0; i < N; ++i) {
        chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        chmin(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>

using namespace std;

int main() {
	int N; cin >> N;
	int* a = new int[N];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int count = 0;
	int* b = new int[N];
	for (int i = N; i >= 1; i--) {
		int c = 0;
		for (int j = i * 2; j <= N; j += i) {
			c += b[j - 1];
		}
		if ((c % 2) == 0) {
			b[i - 1] = a[i - 1];
		}
		else {
			b[i - 1] = 1 - a[i - 1];
		}

		if (b[i - 1] == 1) {
			count++;
		}
	}
	cout << count << endl;
	if (count == 0) { return 0; }
	for (int i = 0; i < N; i++) {
		if (b[i] != 0) {
			cout << i + 1 << " ";
		}
	}
	return 0;
}


Measured memory_bytes: 2432
package main

import (
	"fmt"
)

func main() {
	var N, Y int
	var exist bool
	var kumi = make(map[string]int)

	fmt.Scan(&N)
	fmt.Scan(&Y)

	max_a := Y / 10000
	if max_a > N {
		max_a = N
	}
	max_b := Y / 5000
	if max_b > N {
		max_b = N
	}
	max_c := Y / 1000
	if max_c > N {
		max_c = N
	}
	
	for a := 0; a <= max_a && !exist; a++ {
		for b := 0; b <= max_b-a && !exist; b++ {
			c := N - a - b
			if a + b + c== N && a * 10000 + b * 5000 + c * 1000 == Y {
				exist = true
				kumi["a"] = a
				kumi["b"] = b
				kumi["c"] = c
				break;
			}
		}
	}

	if ! exist {
		kumi["a"] = -1
		kumi["b"] = -1
		kumi["c"] = -1
	}

	fmt.Printf("%d %d %d", kumi["a"], kumi["b"], kumi["c"])
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;



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


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



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}

int main() {

	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (i % 2 == 0) {
			cout << s[i];
		}
	}
	cout << endl;





}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, x;
  cin >> n >> x;
  
  vector <int> L(n);
  
  int sum = 0;
  
  int i;
  
  for(i = 0; i < n; i++){
    if(sum <= x){
      cin >> L.at(i);
      sum += L.at(i);
    }
    else{
      break;
    }
  }
  if (sum <= x){
    cout << i+1 << endl;
  }
  else {
    cout << i <<endl;
  }
  
}

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

#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)

// int dig(char a)
// {
//     return a - 'a';
// }

int main()
{
    int N;
    cin >> N;
    int v[N][3];
    for(int i = 0; i < N; i++)
        for(int j = 0; j < 3; j++)
            cin >> v[i][j];

    vector<vector<int>> dp(N + 1, vector<int>(3));
    for(int i = 0; i < 3; i++)
        dp[0][i] = v[0][i];

    for(int n = 0; n < N; n++)
    {
        for(int i = 0; i < 3; i++)
        {
            int i1 = (i + 4) % 3, i2 = (i + 2) % 3;
            MAX(dp[n + 1][i1], v[n + 1][i1] + dp[n][i]);
            MAX(dp[n + 1][i2], v[n + 1][i2] + dp[n][i]);
        }
    }

    cout << max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]});
    return 0;
}


    // for(int i = 0; i < N - 1; i++)
    // {
    //     for(int j = 0; j < 3; j++)
    //     {
    //         int temp = 0;
    //         for(int k = 0; k < 3; k++)
    //             if(k == j) continue;
    //             else MAX(temp, dp[i][k]);

    //         for(int k = 0; k < 3; k++)
    //             if(k == j) continue;
    //             else MAX(dp[i + 1][j], temp + v[i][k]);
    //     }
    // }

    // cout << max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]});

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (true)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0)
        {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, K;
    cin >> N >> K;
    int D[10] = {0};
    for(int i=0; i<K; ++i){
        int tmp;
        cin >> tmp;
        D[tmp]=1;
    }
    //for(int i=0; i<10; ++i)  cout << D[i] << " ";
    //cout << "\n";
    int L[10] = {0};
    for(int i=0; i<10; ++i){
        if(D[i]==0){
            L[i]=1;
        }
    }
    //for(int i=0; i<10; ++i) if(L[i]) cout << i << " ";
    //cout << "\n";
    int Lmin = 9;
    int Lmax = 0;
    int nonzeroLmin = 9;
    for(int i=0; i<10; ++i){
        if(L[i]){
            Lmin = min(Lmin, i);
            Lmax = max(Lmax, i);
            if(i){
                nonzeroLmin = min(nonzeroLmin, i);
            }
        }
    }
    bool ans=false;
    int res = 0;
    for(int i=1; i<100000; ++i){
        bool like = true;
        int tmp = i;
        while(tmp){
            if(L[tmp%10]){
                tmp /=10;
            }
            else{
                like =false;
                break;
            }
        }
        if(like and i>=N){
            ans = true;
            res = i;
            break;
        }
    }
    if(ans){
        cout << res << endl;
    }
    else{
        int order = 0;
        int tmpN = N;
        while(tmpN>=10){
            order++;
            tmpN/=10;
        }
        res = 1;
        for(int i=0; i<order; ++i){
            if(i==0){
                res = nonzeroLmin;
            }
            else{
                res *= 10;
                res += Lmin;
            }
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
    int a;
    int b;
    cin>>a>>b;
    if(a>b){
        for(int i=0;i<a;i++){
            cout<<b;
        }
    }else{
        for(int i=0;i<b;i++){
            cout<<a;
        }
    }
}



Measured memory_bytes: 888
N = int(input())
H = list(map(int, input().split()))

H.reverse()
last = H[0]
for h in H[1:]:
    if last >= h:
        last = h
    
    elif last+1 == h:
        continue

    else:
        print('No')
        exit()
else:
    print('Yes') 

Measured memory_bytes: 15020
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>

using namespace std;


int main(void) {
	char S[101], S_repeated[201], T[101];
	int len;
	int ans;
	scanf("%s %s", S, T);

	len = strlen(S);

	for (int i = 0; i < len; i++) {
		S_repeated[i] = S[i];
		S_repeated[i + len] = S[i];
	}

	for (int i = 0; i < len; i++) {
		ans = 1;
		for (int j = 0; j < len; j++) {
			if (S_repeated[i + j] != T[j]) {
				ans = 0;
			}
		}
		if(ans == 1){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");

}









Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define PLL pair<ll,ll>
#define rep(i,n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i,n) for (ll i = 1; i <= (ll)(n); i++)
#define repR(i,n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define rep1R(i,n) for (ll i = (ll)(n); i >= 1; i--)
#define loop(i,a,B) for (ll i = a; i B; i++)
#define loopR(i,a,B) for (ll i = a; i B; i--)
#define all(v) v.begin(), v.end()
#define fcout cout<<fixed<<setprecision(15)
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078160628620899
const unsigned int BIT_FLAG_0 = (1 << 0);
const unsigned int BIT_FLAG_1 = (1 << 1);
const unsigned int BIT_FLAG_2 = (1 << 2);
const unsigned int BIT_FLAG_3 = (1 << 3);
const unsigned int BIT_FLAG_4 = (1 << 4);
const unsigned int BIT_FLAG_5 = (1 << 5);
const unsigned int BIT_FLAG_6 = (1 << 6);
const unsigned int BIT_FLAG_7 = (1 << 7);
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1000000000000000000;

string S, T, U;
char V[1100000];
ll ANS = 0, SUM = 0, NOW = 0, N, M, A, B, C, D, E, F[1100000] = { 0 }, G[1100000] = { 0 };
double n, m, a, b, c, d, e;
bool ans = 0, now = 0, sum = 0;
PLL ARM[1100000];
int main(void) {
	cin >> N;
	cout << (N - 2) * 180;
	return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int  // ranges from (0 - twice of long long int)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define mod 1000000007LL
#define llpair pair<ll,ll>
#define INF 1000000000000000000ll
#define np next_permutation
#define PI acos(-1)
#define deb(x) cout<<#x<<" "<<x<<endl;
//ALWAYS USE ll DATA TYPE FOR INTEGER(FASTER THAN INTEGER AS WELL AS SOMETIMES WITHOUT USE LONG UR ANSWER WILL NOT ACCEPTED) && DOUBLE FOR DECIMAL VALUE
template<typename T> // for removing front element from the vector
void pop_front(std::vector<T> &v)
{
    if (v.size() > 0) {
        v.erase(v.begin());
    }
}
template<typename R> // for removing back element from the vector or can directly
void pop_back(std::vector<R> &v) // use vec.pop_back() function...
{
    if (v.size() > 0) {
        v.erase(v.begin()+v.size()-1);
    }
}

bool isprime(ll n)  //IN  O(sqrt(n))
{
    if(n<=1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;

    return true;
}

vector<ll> factors(ll n){    //IN  O(sqrt(n))

    vll v;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            v.pb(i);
            if((n/i)!=i)
            v.pb(n/i);
        }
    }
    return v;
}

ll power(ll a, ll n)  // using Binary Exponential in TC O(logn)
{                     // Self Written By </ME> :)
    ll res=1;
    while(1)
    {
        if(n%2){
            res=res*a; n--;
        }
        if(n==0) break;
        a=a*a; n/=2;
    }
    return res;
}

ll ts(ll arr[],int l,int r,int x) // ternary search to find x in sorted array arr
{
    
    while(l<=r)
    {
        ll mid1= l+(r-l)/3;
        ll mid2= r -(r-l)/3;
        if(arr[mid1]==x || arr[mid2]==x)
            return 1;
        if(x<arr[mid1])
            r=mid1-1;
        else if(x>arr[mid2])
            l=mid2+1;
        else
        {
            l=mid1+1;
            r=mid2-1;
        }
    }

    return -1;
}

int main() {
    auto start = chrono::high_resolution_clock::now();
    fio;
    
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll arr[32]= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        ll k; cin>>k;
        cout<<arr[k-1]<<"\n";

    }
    
    auto finish = chrono::high_resolution_clock::now();
    cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
    return 0;
}





Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N,K=mi()
    G = []

    X=[]
    Y=[]
    for i in range(N):
        x,y = mi()
        G.append((x,y))
        X.append(x)
        Y.append(y)

    def count(downx,upx,downy,upy):
        _count = 0
        for i in range(N):
            x,y = G[i]
            if downx<=x<=upx and downy<=y<=upy:
                _count += 1
        
        return _count

    ans = INF
    for downx in X:
        for upx in X:
            if upx <= downx: continue
            for downy in Y:
                for upy in Y:
                    if upy <= downy: continue

                    if count(downx,upx,downy,upy) >= K:
                        ans = min(ans,abs(upx-downx) * abs(upy-downy))
                        



    print(ans)

            



if __name__ == "__main__":
    main()

Measured memory_bytes: 74556
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    ll X;
    cin >> X;
    ll n = 0;
    while (n * n * n * n * n < X) ++n;
    for (ll a = 0;; ++a) {
        for (ll b = -n + 1; b < a; ++b) {
            ll x = a * a * a * a * a - b * b * b * b * b;
            if (X == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1E9 + 7, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    ll a, b, c, n ;
    cin >> a >> b >> c >> n ;

    while (a >= b and n > 0) {
        b *= 2 ;
        n-- ;
    }

    while (b >= c and n > 0) {
        c *= 2 ;
        n-- ;
    }

    if (b > a and c > b)    cout << "Yes\n" ;
    else    cout << "No\n" ;

    return 0 ;
}


Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to,cap,rev; 
	edge (int from, int to, int cap, int rev){
		this->from=from; this->to=to; this->cap=cap; this->rev=rev;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;



int main(){
	string s;
	cin >> s;
	set<char> ss;
	FORI(0, s.length()) {
		int c = s[i];
		ss.insert(c);
	}
	if (ss.size() == s.size())
		cout << "yes" << endl;
	else
		cout << "no" << endl;
	return 0;
}


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

const int N = 4;

int main(){
  int h, w;
  int k;
  cin >> h >> w >> k;
  vector<string> a(h);
  rep(i,h){cin >> a[i];}
  int ans = 0;

  for(int row=0; row < (1<<h); row++){
    for(int col=0; col < (1<<w); col++){
      vector<string> now = a;
      rep(i,h){
        if((row & (1<<i)) == (1<<i)){
          rep(j,w){
            now[i][j] = '$';
          }
        }
      }
      rep(j,w){
          if((col & (1<<j)) == (1<<j)){
            rep(i,h){
              now[i][j] = '$';
            }
          }
      }
      int cnt = 0;
      rep(i,h){
        rep(j,w){
          if(now[i][j] == '#') cnt++;
        }
      }
      if(cnt == k) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pi;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head




void solve(){
    int n;
    cin >> n;
    map<int, int> m;
    int a;
    rep(i,0,n){
        cin >> a;
        auto itr = m.find(a);
        if (itr != m.end()){
            cout << "NO\n";
            return;
        }
        else m.emplace(pair<int, int> (a, 1));
    }
    cout << "YES\n";
}
int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(0);

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


Measured memory_bytes: 12860
#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0){
      break;
    }
    int leg[2]={},last=0,ans=0;
    string s;
    for(int i=0;i<n;i++){
      cin>>s;
      if(s=="lu"){
        leg[0]=1;
      }else if(s=="ru"){
        leg[1]=1;
      }else if(s=="ld"){
        leg[0]=0;
      }else{
        leg[1]=0;
      }
      if(leg[0]==leg[1]&&leg[0]!=last){
        ans++;
        last=leg[0];
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3140
n=int(input())

m=0
a=0
r=0
c=0
h=0
for i in range(n):
    s=input()
    if s[0]=="M":
        m+=1
    elif s[0]=="A":
        a+=1
    elif s[0]=="R":
        r+=1
    elif s[0]=="C":
        c+=1
    elif s[0]=="H":
        h+=1
        
ans=m*a*(r+c+h)+m*r*(c+h)+m*c*h
ans=ans+a*r*(c+h)+a*c*h+r*c*h

print(ans)


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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation;
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define puf push_front
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){ll c; while(b!=0){c=a%b; a=b; b=c;} return a;}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a * c%mod;} a=a * a%mod; b>>=1;} return c;}
vi calc(ll x){vi res; while(x>0){res.pb(x%10); x/=10;} reverse(all(res)); return res;}

void solve() {
  int x,A,B,C; cin>>A>>B>>C>>x;
  int p=x/500, ans=0;
  rep(a,min(p+1,A+1)){
    int q=(x-500*a)/100;
    rep(b,min(q+1,B+1)){
      if((x-500*a-100*b)%50==0 && (x-500*a-100*b)/50<C+1) ans++;
    }
  }
  out(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  int count = 0;
  for (int i = 0; i < N; i++){
    if(vec.at(i) >= K){
      count++;
    }
  }
  
  cout << count << endl;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    int mx = (N - 2) * (N - 1) / 2;
    if (mx < K) {
        puts("-1");
        return 0;
    }

    vector<P> ans;
    rep(i, N-1) ans.emplace_back(i+1, N);
    vector<P> edge;
    rep(i, N-1) rep(j, i) edge.emplace_back(j+1, i+1);
    int add = mx - K;
    rep(i, add) ans.push_back(edge[i]);

    cout << ans.size() << endl;
    for (auto e : ans) {
        cout << e.first << " " << e.second << endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;

int main(void){
    int n,a,b,c,d;
    string s;
    cin>>n>>a>>b>>c>>d>>s;
    a--,b--,c--,d--;
    bool ans=true;
    for(int i=a;i<c;i++){
        if(s[i]=='#'&&s[i+1]=='#') ans=false;
    }
    for(int i=b;i<d;i++){
        if(s[i]=='#'&&s[i+1]=='#') ans=false;
    }
    if(c>d){
        bool kari=false;
        for(int i=b-1;i<d;i++){
            if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.') kari=true;
        }
        if(kari==false) ans=false;
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
#define MAX_M 10
#define MAX_N 10
#define MAX_K 10
int ans = 0;
int N, M;
int k[MAX_M + 1], s[MAX_M + 1][MAX_K + 1], p[MAX_M + 1];
bool on_off[MAX_N + 1];

void dfs(int sw , bool b_on_off){


 	on_off[sw - 1] = b_on_off; //sw番目のスイッチが押されているか

	if(sw == N){
	 	int keep1 = 0; //ついている電球の個数
		for(int i = 0 ; i < M ; i++){

		  int keep2 = 0;  //onになっているスイッチの数
		  for(int j = 0 ; j < k[i] ; j++)
			if(on_off[s[i][j] - 1]) keep2 += 1;
		  
		  //電球がついているかの判定
		  if(keep2 % 2 == p[i]) keep1 += 1;

		}

		if(keep1 == M) ans += 1;

	}else{

		dfs(sw + 1 , true);   //sw番目のスイッチを押している
		dfs(sw + 1 , false);  //sw番目のスイッチは押さない
	}	

}

int main(void){

  cin >> N >> M;
  for(int i = 0 ; i < M ; i++){
	cin >> k[i];
	for(int j = 0 ; j < k[i] ; j++){
	 cin >> s[i][j];
	}
  }
  for(int i = 0 ; i < M ; i++)
	cin >> p[i];

  dfs(1 , true);
  dfs(1 , false);

  cout << ans << endl;


 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    map<ll, int> m, n;
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        ll sum = A.at(i) + i;
        decltype(m)::iterator it_sum = m.find(sum);
        if (it_sum != m.end()) m[sum]++;
        else m.insert(make_pair(sum, 1));

        ll dif = i - A.at(i);
        decltype(m)::iterator it_dif = m.find(dif);
        if (it_dif != m.end()) ans += m[dif];
        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 17164
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.insert(0, X)
distance = []
for i in range(1, len(x)):
    distance.append(abs(x[i] - x[i - 1]))

ans = distance[0]
for i in range(1, len(distance)):
    ans = gcd(ans, distance[i])
print(ans)

Measured memory_bytes: 14224
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())

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

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

	rrep(i,s.size()  - 1, 0 )
		cout << s[i];
	cout << endl;
	ret 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define cer(x) cerr << x <<endl
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define pb push_back
#define MOD 1e9+7
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template<class T>inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<class T>inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

int main()
{
	int a1, a2, a3; cin >> a1 >> a2 >> a3;
	if (a1 + a2 + a3 >= 22)co("bust");
	else co("win");
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	a := make([]int, 5)
	for i := range a {
		a[i] = getInt()
	}

	ans := 0
	min := 10
	for _, v := range a {
		if v%10 == 0 {
			ans += v
		} else {
			ans += (v/10)*10 + 10
			if v%10 < min {
				min = v % 10
			}
		}
	}
	fmt.Println(ans - (10 - min))
}


Measured memory_bytes: 640
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp;

const W: usize = 100_000;
// const W: usize = 10;

#[fastout]
fn main() {
    input! {
        n: usize,
        item: [(i64, usize); n],
        q: usize,
        query: [(Usize1, usize); q],
    }
    let m = cmp::min(n, 1024) as usize;
    let mut max_val = vec![vec![0i64; W + 1]; m + 1];
    for (i, &(a, b)) in item.iter().take(m).enumerate() {
        for w in 0..=W {
            max_val[i + 1][w] =
                cmp::max(max_val[(i + 1) / 2][w], max_val[i + 1][w.saturating_sub(1)]);
            if let Some(pw) = w.checked_sub(b) {
                max_val[i + 1][w] = cmp::max(max_val[i + 1][w], max_val[(i + 1) / 2][pw] + a);
            }
        }
    }
    for &(v, l) in &query {
        if v < m {
            println!("{}", max_val[v + 1][l]);
        } else {
            let mut vs = vec![v];
            let mut v = v;
            loop {
                v = (v - 1) / 2;
                if v < m {
                    break;
                }
                vs.push(v);
            }
            let last_v = v;
            let mut ret = 0i64;
            for pat in 0..1 << vs.len() {
                let mut value = 0i64;
                let mut w = 0usize;
                for (i, &v) in vs.iter().enumerate() {
                    if (pat >> i) & 1 != 0 {
                        value += item[v].0;
                        w += item[v].1;
                    }
                }

                if let Some(pw) = l.checked_sub(w) {
                    ret = cmp::max(ret, value + max_val[last_v + 1][pw]);
                }
            }
            println!("{}", ret);
        }
    }
}


Measured memory_bytes: 816332
#include <cstdio>
#include <cstring>
#include <iostream>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define inver(a) power(a,mod-2)
using namespace std;
inline char gc() {
	return getchar();
	static char buf[100000],*l=buf,*r=buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void rd(T &x) {
	x=0; int f=1,ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=gc();}
	x*=f;
}
typedef long long ll;
const int maxn=200+5;
int n,K,mod;
int fac[maxn],inv[maxn],C[maxn][maxn];
int dp[maxn][maxn];
inline int add(int x) {return x>=mod?x-mod:x;}
ll power(ll x,ll y) {
	ll re=1;
	while(y) {
		if(y&1) re=re*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return re;
}
int sol(int k,int l,int K) {
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int j=1;j<=l;++j) {
		int sum=0;
		for(int i=0;i<k;++i) {
			sum=add(sum+dp[i][j-1]);
			if((l-j+1)+(i-1)<=K&&(k-i)+(j-1)<=K) dp[i][j]=sum;
		}
	}
	int an=0;
	for(int i=1;i<k;++i) an=add(an+dp[i][l]);
	return an;
}
int sol(int n,int K) {
	if(n==1) return 1;
	int an=0;
	for(int i=1;i<=K+1;++i) an=add(an+sol(i,n-i,K));
	an=(ll)an*fac[n-1]%mod;
//	debug("%d %d %d\n",n,K,an);
	return an;
}
void init() {
	fac[0]=1;
	for(int i=1;i<=n;++i) fac[i]=(ll)fac[i-1]*i%mod;
	inv[n]=inver(fac[n]);
	for(int i=n;i>=1;--i) inv[i-1]=(ll)inv[i]*i%mod;
	for(int i=0;i<=n;++i) {
		C[i][0]=C[i][i]=1;
		for(int j=1;j<i;++j) C[i][j]=add(C[i-1][j-1]+C[i-1][j]); 
	}
}
int main() {
	rd(n),rd(K),rd(mod);
	init();
	int an=0;
	for(int i=0;i<=K;++i) an=(an+(ll)sol(n-i,K-i)*C[n][i]%mod*fac[i])%mod;
	printf("%d\n",an);
	return 0;
} 

Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    if(A >= K){
        cout << K << endl;
    }else if(A + B >= K){
        cout << A << endl;
    }else{
        cout << A - (K - A - B) << endl;
    }
}

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

int main(){
  int a,b,c; cin>>a>>b>>c;
  cout<<c<<" "<<a<<" "<<b<<endl;
  //cout<<(s[0]=='7'||s[1]=='7'||s[2]=='7'?"Yes":"No");

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<string> a[1000005];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int b;
		string q;
		cin>>b>>q;
		a[b].push_back(q);
	} 
	int ans = 0, pen = 0;
	for(int i = 1;i<=n; ++i){
	    if(!a[i].size())continue;
	    else {
	        for(int q = 0; q<a[i].size(); ++q){
	            if(a[i][q]=="AC"){ans++;pen+=q;break;}
	        }
	    }
	}
	cout<<ans<<' '<<pen;
	return 0;
}

Measured memory_bytes: 31488
import sys
input = sys.stdin.readline

X = int(input())

count_n = 0
count_i = 0

while count_n < 1:
    for i in range(1,X):
        if X % i == 0:
            count_i += 1

    if count_i == 1:
        count_n += 1
    
    count_i = 0

    X += 1

print(X-1)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define dump(x) cout << (x) << endl;
typedef long long ll;

int cnt;
string n;

void f(string s, bool a, bool b, bool c) {
  if (s.size() > n.size()) return;
  if (s != "" && stoi(n) >= stoi(s) && a && b && c) cnt++;
  f(s + "3", true, b, c);
  f(s + "5", a, true, c);
  f(s + "7", a, b, true);
}

int main() {
  cin >> n;
  f("", false, false, false);
  dump(cnt);
  return 0;
}


Measured memory_bytes: 256
use std::collections::HashMap;
use std::cmp::max;

fn input_one<T: std::str::FromStr> () -> Result<T, T::Err> {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).unwrap();
    n.trim().parse()
}

fn main() {
    let n: usize = input_one().unwrap();
    let mut m: HashMap<String, usize> = HashMap::with_capacity(n);
    let mut max_size = 1;
    for _ in 0..n {
        let s: String = input_one().unwrap();
        if let Some(v) = m.get_mut(&s) {
            *v += 1;
            max_size = max(max_size, *v);
        } else {
            m.insert(s, 1);
        }
    }
    let mut m: Vec<_> = m.into_iter().filter_map(|(s, c)| if max_size == c { Some(s)} else { None }).collect();
    m.sort();
    for s in m.into_iter() {
        println!("{}", s);
    }
}


Measured memory_bytes: 21616
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 sys.stdin.readline().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(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

S = S()
#  S = ''
#  for i in range(10**5):
#      if i % 2 == 0:
#          S += '011'
#      else:
#          S += '1'
#  S = '011'*100000

#  print(S)
result = 0
# 0と1すくない方の数になる絶対
print(min(S.count('1'), S.count('0'))*2)
#  while True:
#      print('loop;')
#      if S.find('01') < 0 and S.find('10') < 0:
#          print(result)
#          exit()
#      if S.find('01') >= 0:
#          idx = S.find('01')
#          S = S[:idx] + S[idx+2:]
#          result += 2

#      if S.find('10') >= 0:
#          idx = S.find('10')
#          S = S[:idx] + S[idx+2:]
#          result += 2




Measured memory_bytes: 67692
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

vector<ll> mod_table;

ll all_1(ll num) {
    ll temp = mod_table[num - 1];
    return (temp + 2) % mod;
}

ll solve(queue<ll> &q) {
    ll num = q.front();
    q.pop();
    if (q.empty()) {
        return all_1(num);
    } else {
        return (all_1(num) + 2 * solve(q) - 2) % mod;
    }
}

int main() {
    // input

    string l;
    cin >> l;
    queue<ll> q;
    ll n = l.length();

    rep(i, n) {
        ll index = n - i - 1;
        if (l[i] == '1') {
            q.push(index + 1);
        }
    }

    mod_table.resize(n + 1);
    mod_table[0] = 1;
    repd(i, 1, n + 1) {
        ll temp = mod_table[i - 1] * 3;
        if (temp > mod) {
            temp %= mod;
        }
        mod_table[i] = temp;
    }

    ll ans = solve(q) % mod;

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 5120
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }


template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) {}
	ModInt(signed sig) { int sigt = sig % MOD; if(sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if(sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	ModInt &operator+=(ModInt that) { if((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }

	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
};
typedef ModInt<1000000007> mint;

int main() {
	int N; int M;
	while(~scanf("%d%d", &N, &M)) {
		char S[3001];
		scanf("%s", S);
		vector<pair<int, int>> lrs(M);
		rep(i, M) {
			int l; int r;
			scanf("%d%d", &l, &r), -- l;
			lrs[i] = { l, -r };
		}
		sort(lrs.begin(), lrs.end());
		vector<int> nextR(N);
		rep(i, N)
			nextR[i] = i + 1;
		{
			int prevR = 0;
			rep(i, M) {
				int l = lrs[i].first, r = -lrs[i].second;
				if(prevR < r) {
					reu(j, l, r)
						nextR[j] = r;
					prevR = r;
				}
			}
		}
		vector<int> prefix(N + 1);
		rep(i, N)
			prefix[i + 1] = prefix[i] + (S[i] == '1');
		vector<mint> dp, ndp(N + 1);
		ndp[0] = 1;
		rep(i, N) {
			dp.swap(ndp);
			ndp.assign(N + 1, mint());
			int r = nextR[i], jR = prefix[r], jL = i + 1 - (r - prefix[r]);
			rer(j, 0, i) {
				mint x = dp[j];
				if(x.x == 0) continue;
				rep(b, 2) {
					int nj = j + (b == 1);
					if(jL <= nj && nj <= jR)
						ndp[nj] += x;
				}
			}
		}
		mint ans = ndp[prefix[N]];
		printf("%d\n", ans.get());
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int x, a = 0, b = 0;

int main()
{
  for (int i = 1; i <= 3; i++)
  {
    cin >> x;
    if (x == 5) a++;
    if (x == 7) b++;
  }
  if (a == 2 && b == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	while(cin >> n >> k){
		int ans=0;
		for(int i=0;i<n;i++){
			int num;
			cin >> num;
			if(num>=k) ans++;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a=in.nextInt();
        int b=in.nextInt();
        double c=1.0*a/b;
        System.out.println(a/b+" "+a%b+" "+String.format("%.5f",c));
    }
}


Measured memory_bytes: 26612
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int sum = 0;
		for(int i = 0; i < S.length(); i++) {
			if(S.charAt(i) == 'o') {
				sum++;
			}
		}
		
		if(15 - S.length() + sum >= 8) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 23892
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding
	int n,m;
	cin>>n>>m;
	if(n<=m){
		cout<<"unsafe"<<endl;
	}else{
		cout<<"safe"<<endl;
	}
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

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

int main() {
	int x;
	int i = 1;
	
	while(1){
		cin >> x;
		if(x==0) break;
		else{
			cout << "Case" << " " << i << ":" << " " << x << endl; 
		}
		i++;
	}
		
	return 0;
}


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

N,M = list(map(int, input().rstrip().split()))
ks_list = [list(map(int, input().rstrip().split())) for i in range(M)]
p_list = list(map(int, input().rstrip().split()))
#-----

total_count=0
for sw in range(2**N):
    bin_str = format(sw, 'b').zfill(N)
    
    for i in range(M):
        k = ks_list[i][0]
        s_list = ks_list[i][1:]
        
        cnt_on=0
        for j in s_list:
            if bin_str[j-1] == "1":
                cnt_on += 1
        
        if cnt_on % 2 != p_list[i]:
            break
    
    else:
        total_count += 1    

print(total_count)


Measured memory_bytes: 3188
def gcd(a,b):
  if(a<b):
    a,b=b,a
  if(a%b==0):
    return b
  return gcd(a%b,b)

K=int(input())
ans=0
for i in range(K):
  for j in range(K):
    a=gcd(i+1,j+1)
    for n in range(K):
      ans+=gcd(a,n+1)
print(ans)

Measured memory_bytes: 71220
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int count(int i, int k) {
    int counting = 0;
    while (i < k) {
        i = i*2;
        counting++;
    }
    return counting;
}

int main() {
    int n=0, k=0;
    scanf("%d %d", &n, &k);
    double ans = 0;
    for (int i=1; i<=n; i++) {
        ans += pow(0.5, count(i, k)) / (double)n;
    }
    printf("%.15f\n", ans);
    return 0;
}


Measured memory_bytes: 384
import java.io.*;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String input = br.readLine();
			String[] numbers = input.split(" ");
			Integer a = Integer.parseInt(numbers[0]);
			Integer b = Integer.parseInt(numbers[1]);
			if(a == 0 && b == 0){
				break;
			}
			for(int i=1; i <= a; i++){
				String line = "";
				for(int j=1; j <= b; j++){
					if(i == 1 || i == a || j == 1 || j == b){
						line += "#";
					}
					else{
						line += ".";
					}
				}
				System.out.println(line);
			}
			System.out.println("");
		}

	}

}

Measured memory_bytes: 46948