akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> P(N);
  vector<int> Q(N);

  rep(i, N)
  {
    A[i] = i + 1;
    cin >> P[i];
  }

  rep(i, N)
  {
    cin >> Q[i];
  }

  int a, b;
  int count = 1;
  do
  { //順列列挙
    if (A == P)
      a = count;

    if (A == Q)
      b = count;
    count++;
  } while (next_permutation(A.begin(), A.end()));

  cout << abs(a - b) << endl;
  return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i

room = []
4.times do |b|
	room[b] = []
	3.times do |f|
		room[b][f] = []
		10.times do |r|
			room [b][f][r] = 0
		end
	end
end

n.times do
	b, f, r, v = gets.split.map(&:to_i)

	room[b-1][f-1][r-1] += v
end

4.times do |b|
	3.times do |f|
		10.times do |r|
			print " #{room[b][f][r]}"
		end
		puts
	end
	puts '####################' if b < 4-1
end

Measured memory_bytes: 6112
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int a,b;
    cin >> a >> b;

    int n = b-a;
    n--;

    int d = n*(n+1)/2;
    cout << d - a << endl;

    return 0;
}

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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


int main(){
    int K;
    cin>>K;
    queue<ll> Q;
    for(int i=1;i<=9;i++) Q.push(i);
    int i=0;
    ll a;
    while(i<K){
        a=Q.front();
        i++;
        Q.pop();
        ll n=a*10;
        if(a%10!=0) Q.push(n+a%10-1);
        Q.push(n+a%10);
        if(a%10!=9) Q.push(n+a%10+1);
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 5104
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll K,A,B;
	while(cin>>K>>A>>B) {
		ll ans = K+1;
		if(B-A>=3) {
			if(A-1 <= K) {
				ans = A;
				K -= A-1;
				ll t = K/2;
				ans += (B-A)*t;
				K -= t*2;
				ans += K;
			}
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


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

int main() {
  string s; cin>>s;
  int N=s.size();
  priority_queue<int> pq;
  priority_queue<int, vector<int>, greater<int>> qp;
  for(int i=0; i<N; i++){
    if(s.at(i)=='0' || s.at(i)=='1') pq.push(i);
    if(s.at(i)=='B' && !pq.empty()) pq.pop();
  }
  while(!pq.empty()){
    qp.push(pq.top());
    pq.pop();
  }
  string ans;
  while(!qp.empty()){
    ans+=s[qp.top()];
    qp.pop();
  }
  cout<<ans<<endl;
}

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

int main(){
  int n,x,sum=0,a,m[100]; cin>>n>>x;
  for(int i=0;i<n;i++){
    cin>>m[i];
  }
  for(int i=0;i<n;i++){
    sum+=m[i];
  }
  sort(m,m+n);
  a=m[0];
  x=x-sum;
  cout<<x/a+n<<endl;
  return 0;
}

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

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

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

#define MAX 500005

template<typename T>
struct SegTree {
  const T INF = numeric_limits<T>::max();
  int n;
  vector<T> dat, lazy;
  SegTree(int _n) : n(), dat(_n*4,0), lazy(_n*4,INF) {
    int x = 1;
    while (x < _n) x <<= 1;
    n = x;
  }
  void set(int i, int x) { dat[i+n-1] = x; }
  void build() { for (int k = n-2; k >= 0; k--) dat[k] = dat[k*2+1] + dat[k*2+2]; }

  void eval(int k, int p) {
    if (lazy[k] == INF) return;
    if (k < n-1) {
      lazy[k*2+1] = lazy[k];
      lazy[k*2+2] = lazy[k];
    }
    dat[k] = lazy[k] * p;
    lazy[k] = INF;
  }
  void update(int a, int b, int x, int k, int l, int r) {
    eval(k, r-l);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy[k] = x;
      eval(k, r-l);
    } else {
      int mid = (l+r)>>1;
      update(a,b,x,k*2+1,l,mid);
      update(a,b,x,k*2+2,mid,r);
      dat[k] = dat[k*2+1] + dat[k*2+2];
    }
  }
  void update(int a, int b, int x) { update(a,b,x,0,0,n); }

  T query(int a, int b, int k, int l, int r) {
    eval(k, r-l);
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return dat[k];
    int mid = (l+r)>>1;
    T vl = query(a,b,k*2+1,l,mid);
    T vr = query(a,b,k*2+2,mid,r);
    return vl + vr;
  }
  T query(int a, int b) { return query(a,b,0,0,n); }
  inline T operator[](int a) { return query(a,a+1); }
};

int main(int, char**)
{
  int n, q;
  cin >> n >> q;

  SegTree<ll> seg(n);

  vector<ll> ans;
  rep(i,q) {
    int command; cin >> command;
    if (command == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      seg.update(s,t+1,x);
    } else if (command == 1) {
      int s, t; cin >> s >> t;
      ans.push_back(seg.query(s,t+1));
    }
  }
  for (auto a : ans) cout << a << endl;

  return 0;
}



Measured memory_bytes: 10156
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int N, M;

int nijou(int a, int n)
{
	int tmp = 1;
	for (int i = 0; i < n; i++)
	{
		tmp *= a;
	}
	return tmp;
}

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

	int ans = (100 * (N - M) + 1900 * M) * nijou(2, M);

	cout << ans << endl;
}

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

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    boolean a[];
    a=new boolean[52];
    for(boolean b:a) b=false;
    for(int i=0;i<n;i++){
      String m=sc.next();
      char[] mark=m.toCharArray();
      int num=sc.nextInt();
      switch(mark[0]){
        case 'H':
          num+=13;
          break;
        case 'C':
          num+=26;
          break;
        case 'D':
          num+=39;
          break;
      }
      a[num-1]=true;
    }
    for(int i=0;i<52;i++){
      if(!a[i]){
        if(i<13) System.out.println("S "+(i+1));
        else if(i<26) System.out.println("H "+(i-12));
        else if(i<39) System.out.println("C "+(i-25));
        else System.out.println("D "+(i-38));
      }
    }
  }
}


Measured memory_bytes: 26324
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int K = in.nextInt();
        String S = in.next();

        long[] fact = new long[2000001];
        long[] factInv = new long[2000001];
        long[] pow25 = new long[2000001];
        long[] pow26 = new long[2000001];
        fact[0] = factInv[0] = pow25[0] = pow26[0] = 1;
        for (int i = 1; i < 2000001; i++) {
            fact[i] = (fact[i - 1] * i) % MOD;
            factInv[i] = mInv(fact[i]);
            pow25[i] = (pow25[i - 1] * 25) % MOD;
            pow26[i] = (pow26[i - 1] * 26) % MOD;
        }

        int length = S.length();
        long ans = 0;
        for (int k = 0; k <= K; k++) {
            long c = fact[length + k - 1];
            c *= factInv[k];
            c %= MOD;
            c *= factInv[length - 1];
            c %= MOD;
            c *= pow25[k];
            c %= MOD;
            c *= pow26[K - k];
            c %= MOD;
            ans += c;
            ans %= MOD;
        }
        out.println(ans);

        out.flush();
    }

    static final int MOD = 1_000_000_007;
    static long mPow(long a, long b) {
        long ret = 1;
        while (b > 0) {
            if (b % 2 == 1)
                ret = (ret * a) % MOD;
            a = (a * a) % MOD;
            b /= 2;
        }
        return ret;
    }
    static long mInv(long a) {
        return mPow(a, MOD - 2);
    }
    static long mFact(long a) {
        long ret = 1;
        for (long i = 2; i <= a; i++)
            ret = (ret * i) % MOD;
        return ret;
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}



Measured memory_bytes: 100720
#include <stdio.h>
#include <iostream>
// #include <math.h>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int a, b;
  cin >> a >> b;
  if(a+b >= 24) print(a+b-24);
  else print(a+b);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int n; cin >> n;
  double ans = 1;
  ans *= n; ans *= n; ans *= n;
  ans /= 27;
  cout << fixed << setprecision(10) << ans << endl;
  system("pause");
}

Measured memory_bytes: 504
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) ((a)>(b)?(b):(a))
#define max(a,b) ((a)>(b)?(a):(b))

using namespace std;

typedef pair<int, int> pii;

struct ST
{
	vector<long long int> data;
	vector<long long int> lazy;
	int size;

	ST(int n)
	{
		size = 1;
		while (size < n)size *= 2;
		data = vector<long long int>(2 * size - 1, 0);
		lazy = vector<long long int>(2 * size - 1, 0);
	}

	void apply(int k)
	{
		if (lazy[k] == 0)
		{
			return;
		}

		data[k] += lazy[k];

		if ((size - 1) > k)
		{
			lazy[2 * k + 1] += lazy[k] / 2;
			lazy[2 * k + 2] += lazy[k] / 2;
		}

		lazy[k] = 0;
	}

	void add(int s, int t, int x, int k, int l, int r)
	{
		if (r == -1)
		{
			r = size;
		}
		apply(k);
		if (t <= l || r <= s)
		{
			return;
		}
		if (s <= l&&r <= t)
		{
			lazy[k] += (x*(r - l));
			apply(k);
			return;
		}
		add(s, t, x, 2 * k + 1, l, (l + r) / 2);
		add(s, t, x, 2 * k + 2, (l + r) / 2, r);
		data[k] = data[2 * k + 1] + data[2 * k + 2];
	}

	long long int getSum(int s, int t, int k, int l, int r)
	{
		if (r == -1)
		{
			r = size;
		}
		apply(k);
		if (t <= l || r <= s)
		{
			return 0;
		}
		if (s <= l&&r <= t)
		{
			return data[k];
		}
		long long int sum = 0;
		sum += getSum(s, t, 2 * k + 1, l, (l + r) / 2);
		sum += getSum(s, t, 2 * k + 2, (l + r) / 2, r);
		return sum;
	}

	void draw()
	{
		printf("data\n");
		for (int i = 0; i != data.size(); i++)
		{
			printf("data[%d]:%d\n", i, data[i]);
		}
		printf("lazy\n");
		for (int i = 0; i != lazy.size(); i++)
		{
			printf("lazy[%d]:%d\n", i, lazy[i]);
		}
	}
};

int main() {
	int n, q;
	scanf("%d %d", &n, &q);

	ST st(n);

	int c, s, t, v;

	for (int i = 0; i < q; i++) {
		scanf("%d", &c);

		switch (c)
		{
		case 0:
			cin >> s >> t >> v;
			st.add(s - 1, t, v, 0, 0, -1);
			break;
		case 1:
			cin >> s >> t;
			cout << st.getSum(s - 1, t, 0, 0, -1) << endl;
			break;
		}

		//st.draw();
	}
}


Measured memory_bytes: 7024
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int N = 305;
int Mod;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b){ return 1ll * a * b % Mod; }
void Add(int &a, int b){ a = add(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
void Mul(int &a, int b){ a = mul(a,b); }
int n, K, C[N][N], f[N][N], sm[N][N];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d%d%d",&n,&K,&Mod);
	for(int i=0; i<=K; i++) f[1][i]=sm[1][i]=1;
	for(int i=K; i>=0; i--) Add(sm[1][i],sm[1][i+1]);
	
	for(int i=0; i<=n; i++) C[i][0]=1;
	for(int i=1; i<=n; i++)
	for(int j=1; j<=i; j++) 
	C[i][j]=add(C[i-1][j],C[i-1][j-1]);
	
	for(int i=2; i<=n+1; i++){
		for(int j=0; j<=K; j++){
			for(int k=1; k<i; k++){
				Add(f[i][j],mul(C[i-2][k-1],mul(f[i-k][j],sm[k][j+1])));
			} 
		} for(int j=K; j>=0; j--)
		sm[i][j]=add(sm[i][j+1],f[i][j]);
	} cout<<f[n+1][0]; return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int main()
{
    int n;
    int a, max, min;
    long long int sum = 0;
    
	scanf("%d%d", &n, &a);
	sum = min = max = a;
    while (1 < n--)
    {
        scanf("%d", &a);
        if (max < a)
            max = a;
        if (min > a)
            min = a;
        sum += a;
    }
    printf("%d %d %lld\n", min, max, sum);
}


Measured memory_bytes: 2140
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)

using namespace std;

int64_t kRem = 1000000007	;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n; cin >> n;
	int64_t ans = 0;
	int64_t sum = 0;
	FOR_LT(i, 0, n) {
		int64_t a; cin >> a;
		ans += sum * a;
		ans %= kRem;
		sum += a;
		sum %= kRem;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3648
while 1:
    try:
        a=map(int,raw_input().split())
        b=map(int,raw_input().split())
        hi=0
        bl=0
        for i in xrange(4):
            for j in xrange(4):
                if i==j:
                    if a[i]==b[j]:
                        hi+=1
                else:
                    if a[i]==b[j]:
                        bl+=1
        print hi,bl
    except:
        break

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

#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vvlli vector<vlli>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'


vector<int> vis;
vector<vector<int>> adj;
vector<long double > dis;
lli val;
lli paths;

void dfs(int v, int p, int lev){
    // vis[v] = 1;
    // cout<<"NODE STARTED "<<v<<endl;
    int flag = 0;
    for(auto u: adj[v]){
        if(u!= p){
            flag ++;
            dfs(u, v, lev+1);
            dis[v] += dis[u];
        }
    }
    if(flag == 0){
        dis[v] = 0;
    }
    else{
        dis[v] = (dis[v]/flag) + 1;
    }
}



void solve(){
    int n;
    cin>>n;
    vi a1(n, 0);
    vi a2(n, 0);
    rep(i, n, 0)cin>>a1[i]>>a2[i];
    rep(i, n-2, 0){
        if(a1[i] == a2[i] && a1[i+1] == a2[i+1] && a1[i+2] == a2[i+2]){
            cout<<"Yes"<<endl;
            return ;
        }
    }
    cout<<"No"<<endl;
    return ;
}


int main()
{
    fastio;
    int t;
    t = 1;
    // cin>>t;
    while(t--)solve();

}

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

int main(void) {
	long long int a;
	float b;
	scanf("%lld %f",&a,&b);
	//printf("%lld\n",a);
	//printf("%lf\n",b);
	printf("%lld",(a*(int)(100*b+0.5))/100);
	return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
long long n;
void dfs(vector < vector < long long > > f,vector < vector < long long > > p,long long step,long long c,long long &ans,vector < long long > &state)
{
    long long i,j;
    if (step>10)
    {
        if (!c) return ;
        j=0;
        for (i=1;i<=n;i++)
            j+=p[i][state[i]];
        ans=max(ans,j);
        return ;
    }
    dfs(f,p,step+1,c,ans,state);
    for (i=1;i<=n;i++)
        state[i]+=f[i][step];
    dfs(f,p,step+1,c+1,ans,state);
    for (i=1;i<=n;i++)
        state[i]-=f[i][step];
}
void solve()
{
    vector < vector < long long > > f,p;
    long long i,j,ans=-1000000000000000;
    vector < long long > state(n+1,0);
    for (i=0;i<=n;i++)
    {
        vector < long long > tmp1(11,0);
        f.push_back(tmp1);
    }
    for (i=0;i<=n;i++)
    {
        vector < long long > tmp2(11,0);
        p.push_back(tmp2);
    }
    for (i=1;i<=n;i++)
        for (j=1;j<=10;j++)
            cin>>f[i][j];
    for (i=1;i<=n;i++)
        for (j=0;j<=10;j++)
            cin>>p[i][j];
    dfs(f,p,1,0,ans,state);
    cout<<ans<<endl;
}
int main()
{
    while(cin>>n)
        solve();
}

Measured memory_bytes: 512
A,B = map(int, input().split())
X = int((A/0.08)+0.5)
Y = int((B/0.1)+0.5)
min = 0

if X > Y:
    if int(X*0.1) == B:
        min = X
    else :
        min = -1
elif X < Y:
    if int(Y*0.08) == A:
        min = Y
    else :
        min = -1
else :
    min = X

print(min)

Measured memory_bytes: 3064
n = int(input())
s = list(map(int, input().rstrip().split(" ")))

for i in range(0, n):
    s[i] = s[i] - (i+1)
s.sort()

b = s[n//2]

sm = 0
for i in range(0, n):
    sm = sm + abs(s[i] - b)

print(sm)


Measured memory_bytes: 26708
#include <iostream>
int main(void){
using namespace std;
char b;
cin >> b;
switch(b){
case 'A':
cout << 'T' << endl;
break;
case 'T':
cout << 'A' << endl;
break;
case 'G':
cout << 'C' << endl;
break;
case 'C':
cout << 'G' << endl;
break;
}
return 0;
}


Measured memory_bytes: 256
//package AtCoder;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();
		int[][] a=new int[n][3];
		
		for(int i=0;i<n;i++)
		{
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			a[i][2]=sc.nextInt();
		}
		//System.out.print("a");
		
		sc.close();
		int[][] dp=new int[n][3];
		
		dp[0][0]=a[0][0];
		dp[0][1]=a[0][1];
		dp[0][2]=a[0][2];
		
		for(int i=1;i<n;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(j==0)
				{
					dp[i][j]=a[i][j]+Math.max(dp[i-1][1], dp[i-1][2]);
				}
				else if(j==1)
				{
					dp[i][j]=a[i][j]+Math.max(dp[i-1][0], dp[i-1][2]);
				}
				else if(j==2)
				{
					dp[i][j]=a[i][j]+Math.max(dp[i-1][0], dp[i-1][1]);
				}
			}
		}
		

		System.out.println(maximum(dp[n-1]));

	}
	static int maximum(int[] dp)
	{
		int max=Integer.MIN_VALUE;
		
		max=Math.max(dp[0], dp[1]);
		max=Math.max(max, dp[2]);
		return max;
	}

}


Measured memory_bytes: 96968
import math
a=[input() for i in range(5)]
nzero=['99999']
for i in a:
    if i[-1]!='0':
        nzero+=[i[-1]]
ans=sum([math.ceil(int(i)/10)*10 for i in a])
h=min(nzero)

if h=='99999':
    print(ans)
else:
    print(ans-10+int(h))


Measured memory_bytes: 3060
/////////////////////////   _LeMur_
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 200005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n;
int a , b;

int main(){
    cin>>n>>a>>b;
    cout<<(n - a + 1) * (n - b + 1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#n = int(input()) #入力
#a, b = (int(x) for x in input().split())
#a, b = map(int, input().split())

#a = [int(x) for x in input().split()]
#a = list(map(int, input().split()))
#a = [list(map(int,input().split(" "))) for i in range(N)]   #2次元


#a.sort() # C++ の sort(a.begin(), a.end());
#a.append(3) # C++ の a.push_back(3);


#exit(0) # return 0 的な。終了できる。
## 整数の切り捨て除算は // (ダブルスラッシュ)


#a[始まりの位置: 終わりの位置: スライスの増分] # (a は配列)


#import numpy as np  #importに100 ms 程度かかる。
import math
import copy
import string
#math.gcd(a, b) で、gcd 計算できる。
#math.pi は円周率。

INF = int(10**18) #べき乗 C++ の pow(10, 18) or 1e18;
pi = math.pi

MOD = 1000000007
#MOD = 1000000009
#MOD = 998244353




#繰り返し2乗法
#N^aの、Mで割った余りを求める。
def my_pow(N, a, M):
    if(a == 0):
        return 1
    else:
        if(a % 2 == 0):
            tempo = my_pow(N, a/2, M)
            return (tempo * tempo) % M
        else:
            tempo = my_pow(N, a - 1, M)
            return (tempo * N) % M




#N_C_a を M で割った余り
def my_combination(N, a, M):
    res = 1

    for i in range(0, a):
        res *= N - i
        res %= M

    for i in range(0, a):
        res *= my_pow(i + 1, M - 2, M)
        res %= M

    return res




#N_C_i を M で割った余りを、v[i] に代入する。
def my_combination_table(N, M, v):
    if(len(v) < N + 1):
        l = N + 1 - len(v)
        tempo = [1] * l
        v.extend(tempo)

    for i in range(1, N + 1):
        v[i] = v[i - 1] * (N - (i - 1))
        v[i] %= M

        v[i] *= my_pow(i, M - 2, M)
        v[i] %= M

    return




#math.factorial で階乗は計算できる。
#math.gcd で gcd は計算できる。
#np.gcd.reduce(A) #(Aは配列) で、Aの全ての要素の gcd が計算できる。





D, T, S = (int(x) for x in input().split())

if(S * T >= D): print("Yes")
else: print("No")













Measured memory_bytes: 10140
#include<iostream>
// #include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<deque>


#define REP(i,a,b) for(int i = (a); i < b; ++i)
#define inf 1e9+10
#define MOD 1000000007

using ll = long long;
using ull = unsigned long long;
using namespace std;

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

inline ll mod(ll val, ll m) {
	ll res = val % m;
	if (res < 0) res += m;
	return res;
}

int main() {
	ll n;

	cin >> n;

	cout << mod((modpow(10, n, MOD) - 2 * modpow(9, n, MOD) +modpow(8, n, MOD)) ,MOD);

	return 0;
}

Measured memory_bytes: 3632
#include<set> 
#include<map> 
#include<vector>
#include<algorithm> // sort,reverse,min,lower_bound

#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=a;i<(n);i++)
typedef long int li;
// print_item
template<typename T>
void print_item(T x) {cout << x;}
// pair 型の print (map 含む)
template<typename F,typename S>
void print_item(pair<F,S> x);

// 汎用
void print(auto& vec,string str="");

int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  vector<li> vec(1,0),inv(n+1);
  rep(i,n){
    int a; cin >>a;
    vec.push_back(a);
    inv.at(a)=i+1;
  }
  vec.push_back(0);
  vector<li> lft(n+2,0),rgt(n+2,0);
  vector<int> lchain(n+2),rchain(n+2);
  rep(i,n+2){
    lchain.at(i)=i-1;
    rchain.at(i)=i+1;
  }
  for(int i=n;i>=1;i--){
    int j=inv.at(i); if(df)printf("%d(%d)\n",i,j);
    lft.at(j)=j-lchain.at(j);
    rgt.at(j)=rchain.at(j)-j;
    lchain.at(rchain.at(j))=lchain.at(j);
    rchain.at(lchain.at(j))=rchain.at(j);
    if(df)print(lchain,"lfc");
    if(df)print(rchain,"rgc");
  }
  if(df)print(lft,"lft");
  if(df)print(rgt,"rgt");
  li ans=0;
  rep(i,n+2){
    ans+=vec.at(i)*lft.at(i)*rgt.at(i);
  }
  printf("%ld\n",ans);
}

// pair 型の print (map 含む)
template<typename F,typename S>
void print_item(pair<F,S> x) {
  printf("(");
  print_item(x.first);
  printf(",");
  print_item(x.second);
  printf(")");
}



void print(auto& vec,string str){
  if(str!="") cout << str << ":";
  for(auto x: vec) {print_item(x); cout << " ";}
  cout << endl;
}


/// confirm df==0 ///


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

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

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, K;
    cin >> N >> K;

    vector<char> D(K);

    REP(i, K){
        cin >> D[i];
    }

    for(ll i=N; i<=10*N; i++){
        string s = to_string(i);
        
        bool check = true;
        REP(i, s.length()){
            bool flag = true;
            REP(j, K){
                if(D[j] == s[i]) flag = false;
            }
            if(flag == false){
                check = false;
                break;
            }
        }
        if(check){
            cout << i << endl;
            return 0;
        }

    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
for i in range(N):
    for j in range(i,N):
        for k in range(j,N):
            if(L[i] != L[j] and L[i] != L[k] and L[j] != L[k] and L[i] < L[j] + L[k] and L[j] < L[i] + L[k] and L[k] < L[i] + L[j]):
                ans += 1
print(str(ans))

Measured memory_bytes: 9204
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc059_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] N = Console.ReadLine().Split(' ');
            string A = N[0].ToUpper();
            string B = N[1].ToUpper();
            string C = N[2].ToUpper();
            char A1 = A[0];
            char B1 = B[0];
            char C1 = C[0];
            Console.WriteLine($"{A1}{B1}{C1}");
            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int> pii;

const int N=1e5+5;
int he[N],ver[N*2],nex[N*2],tot;
void add(int,int);

int mx=0;
int col[N];
void dfs(int,int,int);

void init();
void work();
int ca=1;
int main(){
//    freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
//    init();
//    int T;cin>>T;
//    while(T--)
    work();
    return 0;
}
void work(){
    int n;cin>>n;
    tot=2;
    int u,v;
    for(int i=1;i<n;i++){
        cin>>u>>v;
        add(u,v),add(v,u);
    }
    dfs(1,0,0);
    cout<<mx<<'\n';
    for(int i=1;i<n;i++) cout<<col[i]<<'\n';
}
void dfs(int u,int fa,int c){
    int j=0;
    for(int i=he[u];i;i=nex[i]){
        int v=ver[i];
        if(v==fa) continue;
        j++;
        if(j==c) j++;
        col[i/2]=j;
        mx=max(mx,j);
        dfs(v,u,j);
    }
}
void add(int u,int v){
    ver[tot]=v;nex[tot]=he[u];he[u]=tot++;
}


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


def main():
    n = str(input())
    digit = n[-1]

    if digit == '3':
        print('bon')
    elif digit == '0':
        print('pon')
    elif digit == '1':
        print('pon')
    elif digit == '6':
        print('pon')
    elif digit == '8':
        print('pon')
    else:
        print('hon')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600
#define MOD 1000000007

int main(){
  int n,m;
  cin>>n>>m;
  vector<long> x(n),y(m);
  rep(i,n) cin>>x[i];
  rep(i,m) cin>>y[i];

  long xx = 0, yy = 0;
  rep(i,n-1){ xx += (x[i+1]-x[i])*(i+1) %MOD *(n-i-1)%MOD; xx %=MOD; }
  rep(i,m-1){ yy += (y[i+1]-y[i])*(i+1) %MOD *(m-i-1)%MOD; yy %=MOD; }

  cout << xx * yy %MOD << endl;

  return 0;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	ll H, W; cin >> W >> H;
	vector<pair<ll, ll>> edges;

	F0R(i, W) {
		ll w; cin >> w;
		edges.push_back({w, 0});
	}
	F0R(i, H) {
		ll w; cin >> w;
		edges.push_back({w, 1});
	}

	sort(edges.begin(), edges.end());
	W++; H++;

	ll ans = 0;
	for (pair<ll, ll> edge : edges) {
		if (edge.second == 1) {
			ans += W * edge.first; --H;
		} else {
			ans += H * edge.first; --W;
		}
	}
	print(ans);
}

Measured memory_bytes: 7384
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    string s = to_string(n);
    int sz = (int)s.size();
    if(s[sz - 1] == '3') {
        cout << "bon" << endl;
    } else if(s[sz - 1] == '0' || s[sz - 1] == '1' || s[sz - 1] == '6' || s[sz - 1] == '8') {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

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

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	cin>>n>>m;
	unordered_map  <int, int> umap;
	unordered_set <int> done;
	int suc = 0, pen  = 0;
	for(int i=0; i<m; i++) {
		int a; string s;
		cin>>a>>s;
		if(done.find(a) == done.end()){
			if(s == "WA")
				umap[a]++;
			else {
				pen += umap[a];
				suc++;
				done.insert(a);
			}
		}
	}
	cout<<suc<<" "<<pen;
}

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

int main()
{
  std::string s;
  std::cin >> s;
  int ans = 0;
  for ( int i = 0; i < 3; i++ ) {
    if ( s[i] == '1' ) ans++;
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}

//INSERT ABOVE HERE
const Int MAX = 1010;
Int cnt[MAX][MAX];
Int dp1[MAX*3][MAX*3];
Int dp2[MAX*3][MAX*3];
signed main(){
  Int n,d;
  cin>>n>>d;
  vector<Int> x(n),y(n);
  for(Int i=0;i<n;i++) cin>>x[i]>>y[i];

  memset(cnt,0,sizeof(cnt));
  for(Int i=0;i<n;i++)
    cnt[x[i]%d][y[i]%d]++;

  Int num=0;
  for(Int i=0;i<d;i++)
    for(Int j=0;j<d;j++)
      chmax(num,cnt[i][j]);

  Int sq=0;
  {
    Int l=0,r=num+1;
    while(l+1<r){
      Int m=(l+r)>>1;
      if(m*m>=num) r=m;
      else l=m;
    }
    assert(r*r>=num);
    assert(l*l<num);
    sq=l;
  }

  memset(dp1,0,sizeof(dp1));
  memset(dp2,0,sizeof(dp2));

  for(Int i=0;i<d;i++){
    for(Int j=0;j<d;j++){
      //cout<<i<<" "<<j<<":"<<(cnt[i][j]>sq*(sq+1))<<endl;
      //cout<<i<<" "<<j<<":"<<(cnt[i][j]>sq*sq)<<endl;
      for(Int a=0;i+a<MAX*3;a+=d){
        for(Int b=0;j+b<MAX*3;b+=d){         
          dp1[i+a][j+b]=cnt[i][j]>sq*(sq+1);
          dp2[i+a][j+b]=cnt[i][j]>sq*sq;
        }
      }
    }
  }
  for(Int i=0;i<MAX*3;i++){
    for(Int j=1;j<MAX*3;j++){
      dp1[i][j]+=dp1[i][j-1];
      dp2[i][j]+=dp2[i][j-1];
    }    
  }
  for(Int i=1;i<MAX*3;i++){
    for(Int j=0;j<MAX*3;j++){
      dp1[i][j]+=dp1[i-1][j];
      dp2[i][j]+=dp2[i-1][j];
    }    
  }
  
  auto sum1=[&](Int x1,Int x2,Int y1,Int y2){
              return (dp1[x2][y2]+dp1[x1][y1])-(dp1[x1][y2]+dp1[x2][y1]);};
  auto sum2=[&](Int x1,Int x2,Int y1,Int y2){
              return (dp2[x2][y2]+dp2[x1][y1])-(dp2[x1][y2]+dp2[x2][y1]);};
  
  auto check=
    [&](Int b)->Int{
      for(Int i=1;i<=d;i++){
        for(Int j=1;j<=d;j++){          
          if(sum1(i+b,i+d-1,j-1,j+d-1)) continue;
          if(sum1(i-1,i+d-1,j+b,j+d-1)) continue;
          if(sum2(i+b,i+d-1,j+b,j+d-1)) continue;
          return 1;
        }
      }
      return 0;
    };
  
  Int l=-1,r=d;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(check(m)) r=m;
    else l=m;
  }
  cout<<sq*d+r<<endl;
  return 0;           
}


Measured memory_bytes: 153216
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main(){
    int K;cin >>K;
    // pow()は動的に値を変更できるのがメリット
    // 固定値ならば(x * x)で二乗したほうが速度は速い。
    if(K%2==0)
        cout << pow(K/2,2) << endl;
    else
        cout <<  (K/2)*(K/2+1) << endl;
}

Measured memory_bytes: 256
<?php
list($n) = ints();
$a = ints();
for ($i = 0; $i < $n; ++$i) {
    if (isset($cnt[$a[$i]])) $cnt[$a[$i]]++;
    else $cnt[$a[$i]] = 1;
}
krsort($cnt);
$st = [];
foreach ($cnt as $i => $v) {
    if (count($st) === 0) {
        if ($v >= 4) {
            $st = [$i, $i];
            break;
        } elseif ($v >= 2) {
            $st[] = $i;
        }
    } else {
        if ($v >= 2) {
            $st[] = $i;
            break;
        }
    }
}
if (count($st) < 2) exit('0');
echo $st[0] * $st[1];
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 19444
let () =
  let hash = Hashtbl.create 1000000 in
  let n = read_int ()
  in
  let rec read = function
      0 -> ()
    | i ->
       let (op, key) = Scanf.scanf "%s %s\n" (fun x y -> (x,y)) in
       if op = "insert" then
         Hashtbl.add hash key key
       else
         if Hashtbl.mem hash key then Printf.printf "%s\n" "yes"
         else Printf.printf "%s\n" "no"
       ;read (i-1)
  in read n;;

Measured memory_bytes: 44176
import math
n,k = list(map(int,input().split()))
p = 0 

for i in range(1, n+1):
    if i<k:
        t = math.ceil(math.log2(k/i))
        p +=(1/n)*(1/2)**t
    else:
        p += 1/n
print(p)

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

using namespace std;

int main(int argc, char **argv)
{
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	
	int ans = 0xff;
	for(int i = 0; i < n; i++)
	{
		int count;
		for(count = 0; a[i] % 2 == 0; a[i] /= 2) count++;
		ans = min(ans, count);
	}
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pie acos(-1)
#define loop(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x) for(auto &a:x)
#define vi vector<int>
#define vl vector<ll>
#define pii pair<ll,ll>
#define endl "\n"


int main() {
	ll n,w;
    cin>>n>>w;
    vector<ll>weight(n+1),value(n+1);
    loop(i,0,n)
    cin>>weight[i]>>value[i];
    ll sum_value=0;
    for(auto i:value)
    sum_value+=i;
    vector<ll>dp(sum_value+1,1e18L);
    dp[0]=0;
    // dp[i] --> the minimum weight with value as i
    for(ll item=0;item<n;item++)
    {
        for(ll val=sum_value-value[item];val>=0;val--)
        {
            dp[val+value[item]]=min(dp[val+value[item]],weight[item]+dp[val]);
        }
    }
    ll ans=-1;
    for(ll i=0;i<dp.size();i++)
    {
        
        if(dp[i]<=w)
        ans=max(ans,i);
    }
   
    cout<<ans;
	return 0;
}


Measured memory_bytes: 1152
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef long double            ld;
typedef pair<int, int>         pi;
typedef vector<int>            vi;
typedef vector<pair<int, int>> vpi;

#define pb       push_back
#define all(x)   begin(x), end(x)
#define sz(x)    (int)(x).size()
#define ff       first
#define ss       second
#define mp       make_pair
#define lb       lower_bound
#define ub       upper_bound
#define tcase()  int t; cin >> t; while(t--)

const int MOD = 1e9 + 7; // 998244353;
const int MX  = 2e5 + 5;
const ll  INF = 1e18;
const ld  PI  = acos((ld) -1);

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main(){

    setIO();

    int n, m;
    cin >> n >> m;

    bool ok = true;



    int mpp[n + 1] = {0};

    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;

        if(x > n){
            ok = false;
        }

        if(mpp[x] != 0 && mpp[x] != y){
            ok = false;
        }

        if(x == 1 && y == 0) ok = false;

        else mpp[x] = y;
    }

    if(n == 1 && mpp[1] == 0){
        cout << 0;
        return 0;
    }

    if(m == 0 && n == 1){
        cout << 0;
        return 0;
    }

    if(m == 0 && n > 1){
        if(n == 2) cout << "10";
        else cout << "100";
        return 0;
    }

    if(!ok){
        cout << -1;
        return 0;
    }

    if(mpp[1] == 0){
        mpp[1] = 1;
    }

    for(int i = 1; i <= n; i++) cout << mpp[i];
}


Measured memory_bytes: 3636
T = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))

S = [0]*2
for i in range(2):
    S[0] += T[i]*A[i]
    S[1] += T[i]*B[i]
if S[0]==S[1]:
    print("infinity")
else:
    if S[0]<S[1]:
        A,B = B,A
        S = S[::-1]
    if A[0]==B[0] or A[1]==B[1]:
        print(0)
    elif A[0]>B[0] and A[1]>B[1]:
        print(0)
    elif A[0]>B[0] and A[1]<B[1]:
        print(0)
    elif A[0]<B[0] and A[1]>B[1]:
        S = S[0]-S[1]
        T = T[0]*(B[0]-A[0])
        print(T//S*2-1+(1 if T%S==0 else 2))

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

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

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

int main() {
    // input, ready
    ld L;
    cin >> L;

    cout << setprecision(20) << (L*L*L)/27 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool isFSF(int a, int b, int c) {
	int f = 2;
	int s = 1;
	if(a == 5) f--;
	if(a == 7) s--;
	if(b == 5) f--;
	if(b == 7) s--;
	if(c == 5) f--;
	if(c == 7) s--;
	return f == 0 && s == 0;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
    if(isFSF(a, b, c)) {
		cout << "YES";
	} else {
		cout << "NO";
	}
}

Measured memory_bytes: 256