akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    ll N;
    cin >> N;
    vector<ll> Pis;
    for (ll i = 0; i < N; i++) {
        ll Pi;
        cin >> Pi;
        Pis.push_back(Pi);
    }
    struct ValInfo {
        ll idx;
        ll value;
    };
    auto comp_val_info_0 = [](ValInfo lhs, ValInfo rhs){ return lhs.value > rhs.value; };
    auto comp_val_info_1 = [](ValInfo lhs, ValInfo rhs){ return lhs.value > rhs.value; };
    priority_queue<ValInfo, vector<ValInfo>, decltype(comp_val_info_0)> queue0(comp_val_info_0);
    priority_queue<ValInfo, vector<ValInfo>, decltype(comp_val_info_1)> queue1(comp_val_info_1);
    vector<ll> right_map0(N, N);
    vector<ll> right_map1(N, N);
    for (ll i = 0; i < N; i++) {
        ll Pi = Pis[i];
        while (!queue1.empty() && queue1.top().value < Pi) {
            ValInfo info = queue1.top();
            queue1.pop();
            right_map1[info.idx] = i;
        }
        while (!queue0.empty() && queue0.top().value < Pi) {
            ValInfo info = queue0.top();
            queue0.pop();
            right_map0[info.idx] = i;
            queue1.push(info);
        }
        queue0.push(ValInfo{i, Pis[i]});
    }
    while (!queue0.empty()) {
        queue0.pop();
    }
    while (!queue1.empty()) {
        queue1.pop();
    }
    vector<ll> left_map0(N, -1);
    vector<ll> left_map1(N, -1);
    for (ll i = N-1; i >= 0; i--) {
        ll Pi = Pis[i];
        while (!queue1.empty() && queue1.top().value < Pi) {
            ValInfo info = queue1.top();
            queue1.pop();
            left_map1[info.idx] = i;
        }
        while (!queue0.empty() && queue0.top().value < Pi) {
            ValInfo info = queue0.top();
            queue0.pop();
            left_map0[info.idx] = i;
            queue1.push(info);
        }
        queue0.push(ValInfo{i, Pis[i]});
    }
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        ll cnt = 0;
        cnt += (i - left_map0[i]) * (right_map1[i] - right_map0[i]);
        cnt += (right_map0[i] - i) * (left_map0[i] - left_map1[i]);
        ans += cnt * Pis[i];
    }
    cout << ans << endl;
}



Measured memory_bytes: 6260
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    vl h(n+1);
    exrep(i, 1, n) {
        cin >> h[i];
    }

    ll ans = 0;
    rep(i, n) {
        ans += max(0LL, h[i+1] - h[i]);
    }
    
    out(ans);
    re0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

vector<int> g[100];
int in[100];

int main() {
  int v, e;
  cin >> v >> e;
  REP(i, e) {
    int s, t;
    cin >> s >> t;
    g[s].push_back(t);
    in[t]++;
  }
  queue<int> que;
  REP(i, v) {
    if (in[i] == 0) que.push(i);
  }
  while (que.size()) {
    int p = que.front();
    que.pop();
    REP(i, g[p].size()) {
      int q = g[p][i];
      in[q]--;
      if (in[q] == 0) que.push(q);
    }
  }
  REP(i, v) {
    if (in[i] != 0) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 3160
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 998244353;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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;
}

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


//最大公約数
ll gcd(ll m, ll n) {
	if (n == 0)return m;
	return gcd(n, m % n);
}//gcd

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


void solve() {

	ll n;
	cin >> n;
	Array a(n);
	REP(i, n) cin >> a[i];

	ll d = a[0];
	rep(i, 1, n) d = lcm(d, a[i]);
	cout << d << en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


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

using namespace std;

const int maxn = 111111;
int p[maxn];
vector<int> G[maxn];
int v[maxn];
set<int> s[maxn];

void dfs(int cur, int num){
	v[cur] = num;
	s[num].insert(p[cur]);
	for(int i : G[cur]){
		if(!v[i]){
			dfs(i, num);
		}
	}
}

int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	for(int i = 0; i < m; i++){
		int x, y;
		cin >> x >> y;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	int k = 1;
	for(int i = 1; i <= n; i++) if(!v[i]){
		dfs(i, k++);
	}
	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(p[i] == i || s[v[i]].count(i)){
			ans++;
			// cout << i << endl;
		}
	}
	/*for(int i = 1; i < k ;i++){
		for(int j : s[i]) 
			cout << j << ' ';
		cout << endl;
	}*/
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 20736
import java.util.*;
public class Main {
	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
      double po=0;
      for(int i=0;i<a;i++){
         String b=sc.next();
        String c=sc.next();
        if(c.equals("BTC"))po+=Double.parseDouble(b)*380000;
        else po+=Integer.parseInt(b);
      }
		System.out.println(po);
	}
}


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

using namespace std;

int main(){

    string s;

    string t;

    cin >> s;

    cin >> t;
    
    int n=0;

    for (int i=0;i<3;i++){
        if (s[i] == t[i]) 
            n+=1;
    }

    cout << n << endl;

}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,ans=2,hanndann=2;
	cin >> N;
	while (1){
		hanndann *= 2;
		if (hanndann > N){
			break;
		}
		ans = hanndann;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef long double ld;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 3;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < b; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) exp(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;
#define flash ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define endl '\n'
ll prime[100000];
ll exp(ll a,ll b);
void sieve(ll n);
ll gcd(ll a ,ll b);
ll countdigit(ll n);
int main()
{
	flash
	ll arr[10][10];
	ll n;
	cin >> n;
	ll f=0;
	rep(i,1,10){
		rep(j,1,10){
			arr[i][j]=i*j;
		}
	}
	rep(i,1,10){
		rep(j,1,10){
			if(arr[i][j]==n){
				cout<<"Yes";
				f=1;
				break;
			}
		}
		if(f==1)break;
	}
	if(f==0)cout<<"No";
}
//
//
//
//
//
// IMPORTANT FUNCTIONS
ll exp(ll a, ll b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
void sieve(ll n) {
    for(ll i=0;i<=n;i++) {
        prime[i]=1;
    }
    prime[0]=0;prime[1]=0;
    for(ll i=2;i<=n;i++) {
        if(prime[i]==1) {
            for(ll j=2;i*j<=n;j++) {
                prime[i*j]=0;
            }
        }
    }
}
ll countdigit(ll  n) 
{ 
    return floor(log10(n) + 1); 
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/27  Problem: ABC 114 D / Link: http://abc114.contest.atcoder.jp/tasks/abc114_d  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N;
	cin >> N;
	map<int, int>Prime;
	FOR(i, 1, N + 1) {
		LL x = i;
		FOR(d, 2, i + 1) {
			while (x%d == 0) {
				Prime[d]++;
				x /= d;
			}
		}
	}
	VI pidx;
	for (auto it : Prime) {
		pidx.push_back(it.first);
	}
	DD(De(pidx));
	FOR(i, 0, SZ(pidx)) {
		FOR(j, i + 1, SZ(pidx)) {
			FOR(k, 0, SZ(pidx)) { //  5 5 3
				if (k == i || k == j)continue;
				if (Prime[pidx[i]] >= 4 && Prime[pidx[j]] >= 4 && Prime[pidx[k]] >= 2) {
					ans++;
				}
			}
			// 25 3
			if (Prime[pidx[i]] >= 24 && Prime[pidx[j]] >= 2) {
				ans++;
			}
			if (Prime[pidx[i]] >= 2 && Prime[pidx[j]] >= 24) {
				ans++;
			}
			// 15 5
			if (Prime[pidx[i]] >= 14 && Prime[pidx[j]] >= 4) {
				ans++;
			}
			if (Prime[pidx[i]] >= 4 && Prime[pidx[j]] >= 14) {
				ans++;
			}

		}
		// 75
		if (Prime[pidx[i]] >= 74)ans++;
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
vector<vector<int>>g[1005];
bool found[1005]={0};
int a[1005];

void solve(){
int n;
cin>>n;
int a[n];
for(int i=1;i<=n;i++){
	cin>>a[i];
}
int dp[n+3];
dp[1]=0;
dp[2]=abs(a[2]-a[1]);
for(int i=3;i<=n;i++){
	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
}
cout<<dp[n]<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)solve();
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	int MAX = 10000;
	void run() {
		Scanner sc = new Scanner(System.in);
		int[] cnt = new int[MAX+1];
		boolean[] isp = new boolean[MAX+1];
		isp[0] = isp[1] = true;
		ArrayList<Integer> ps = new ArrayList<Integer>();
		for(int i=2;i<=MAX;i++) if(!isp[i]) {
			for(int j=i*2;j<=MAX;j+=i) isp[j] = true;
			ps.add(i);
		}
		
		int[] sum = new int[ps.size()+1];
		for(int i=1;i<=ps.size();i++) sum[i] = sum[i-1] + ps.get(i-1);
		for(int i=0;i<=ps.size()-1;i++) for(int j=i+1;j<=ps.size();j++) {
			if(sum[j]-sum[i] <= MAX) cnt[sum[j]-sum[i]]++;
		}
		
		for(;;) {
			int n = sc.nextInt();
			if(n == 0) break;
			System.out.println(cnt[n]);
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 22304
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <ctime>
#include <set>
#include <map>
#include <vector>
using namespace std;

template <typename T>
T next_int() {
	T x = 0, p = 1;
	char ch;
	do { ch = getchar(); } while(ch <= ' ');
	if(ch == '-') {
		p = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return p * x;
}

const int max_int = (int)1e9 + 228;
const int max_n = (int)1e5 + 228;
const int mod = (int)1e9 + 7;

int main() {
//	freopen(".in", "r", stdin);

	int l = next_int<int>();
	int r = next_int<int>();

	int k = 0;

	for(int i = l; i <= min(r, 0); i++) {
		if(i < 0) k++;
		if(i == 0) k = -max_int;
	}

	if(k < 0) {
		puts("Zero");
		return 0;
	}

	if(k % 2) {
		puts("Negative");
		return 0;
	}

	puts("Positive");
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;

signed main(){
    int N;
    cin >> N;
    
    int A[N];
    map <int,int> mp;
    for(int i=0;i<N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }
    
    int ans = 0;
    for(auto it=mp.begin();it!=mp.end();it++){
        ans += (it -> second)*(it -> second-1)/2;
    }
    
    for(int i=0;i<N;i++){
        cout << ans - mp[A[i]] + 1 << endl;
    }
    return 0;
}



Measured memory_bytes: 11008
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int H, W, K;
  cin>>H>>W>>K;
  vector<string> room(H);
  int ansarr[H][W];
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      ansarr[i][j] = inf;
    }
  }
  for(int i=0;i<H;++i) cin>>room[i];
  queue<pair<int, int> > que;
  queue<int> numque;
  numque.push(0);
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(room[i][j]=='S') {
        que.push(mp(i, j));
      }
    }
  }
  pair<int, int> state;
  int x, y; // 0<=x<H, 0<=y<W;
  int num;
  while(!que.empty()){
    state = que.front();que.pop();
    num = numque.front();numque.pop();
    x = state.fi;
    y = state.se;
    if(ansarr[x][y]<inf) continue;
    ansarr[x][y] = num;
    if(num==K) continue;
    if(x>0 && room[x-1][y]=='.' && ansarr[x-1][y]==inf){
      que.push(mp(x-1, y));
      numque.push(num+1);
    }
    if(y>0 && room[x][y-1]=='.' && ansarr[x][y-1]==inf){
      que.push(mp(x, y-1));
      numque.push(num+1);
    }
    if(x<H-1 && room[x+1][y]=='.' && ansarr[x+1][y]==inf){
      que.push(mp(x+1, y));
      numque.push(num+1);
    }
    if(y<W-1 && room[x][y+1]=='.' && ansarr[x][y+1]==inf){
      que.push(mp(x, y+1));
      numque.push(num+1);
    }
  }
  int ans = inf;
  int tmp;
  int ue, shita, migi, hidari;
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(ansarr[i][j]==inf) continue;
      if(i==0 || i==H-1 || j==0 || j==W-1) ans = 1;
      else{
        tmp = ansarr[i][j];
        if(i%K==0){
          ue = 1+i/K;
        }
        else{
          ue = 2+i/K;
        }
        if(j%K==0){
          migi = 1+j/K;
        }
        else{
          migi = 2+j/K;
        }
        if((H-1-i)%K==0){
          shita = 1+(H-1-i)/K;
        }
        else{
          shita = 2+(H-1-i)/K;
        }
        if((W-1-j)%K==0){
          hidari = 1+(W-1-j)/K;
        }
        else{
          hidari = 2+(W-1-j)/K;
        }
        ans = min(ans, min(ue, min(shita, min(migi, hidari))));
      }
    }
  }
  cout<<ans<<endl;
}



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

int main(void) {
  int N;
  cin >> N;
  vector<int> x(N, 0), y(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
  }
  double ans = 0.0;

  vector<int> index(N);
  iota(index.begin(), index.end(), 0);
  int cnt = 0;
  do {
    double sum = 0.0;
    for (int i = 1; i < N; i++) {
      sum += sqrt(pow(x[index[i]] - x[index[i - 1]], 2) +
                  pow(y[index[i]] - y[index[i - 1]], 2));
    }
    ans += sum;
    cnt++;
  } while (next_permutation(index.begin(), index.end()));

  cout << fixed << setprecision(6) << ans / cnt << endl;
  return 0;
}

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

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int sum = 0;

    for(int i = 1; i <= N; i++){
        int n = 0;
        int I = i;
        while(I > 0){
            n += I % 10;
            I = I/10;
        }
        if(A <= n && n <= B){
            sum += i;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BMultipleOf9 solver = new BMultipleOf9();
        solver.solve(1, in, out);
        out.close();
    }

    static class BMultipleOf9 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] s = in.readDigits();
            int sum = 0;
            for (int x : s) {
                sum += x;
                sum %= 9;
            }

            out.println(sum == 0 ? "Yes" : "No");
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int[] readDigits() {
            char[] chars = next().toCharArray();
            int[] x = new int[chars.length];
            for (int i = 0; i < x.length; i++) {
                x[i] = chars[i] - '0';
            }
            return x;
        }

    }
}



Measured memory_bytes: 30800
n = int(input())
cards = list()
for i in range(1, 53):
    if i <= 13:
        cards.append("S %d" % i)
    elif i <= 26:
        cards.append("H %d" % (i-13))
    elif i <= 39:
        cards.append("C %d" % (i-26))
    else:
        cards.append("D %d" % (i-39))
for i in range(n):
    cards.remove(input())
if cards:
    print("\n".join(cards))


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


int main(){	
	int a[] ={0,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} ;
	int n;
	cin >> n;
	cout << a[n] ;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
struct data{
    string str;
    int n,p;
    data(string s,int a,int b){
        str=s;n=a;p=b;
    }
    data(){}

    bool operator>(const data &d)const{
        if(p!=d.p)return (p>d.p);
        else return (n<d.n);
    }
};
int main(){
    int n;
    bool flag=false;
    while(cin>>n,n){
        if(flag)cout<<endl;
        vector<data>V(n);
        for(int i=0;i<n;i++){
            string str;
            int w,l,d;
            cin>>str>>w>>l>>d;
            V[i]=data(str,i,w*3+d);
        }
        sort(V.begin(),V.end(),greater<data>());
        for(int i=0;i<n;i++){
            data d=V[i];
            cout<<d.str<<","<<d.p<<endl;
        }
        flag=true;
    }
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int A, B;
int main()
{
    scanf("%d %d", &A, &B);
    if(A > 0)
    {
        printf("Positive");
    }
    else if(B < 0)
    {
        if((B - A) % 2 == 0) printf("Negative");
        else printf("Positive");
    }
    else
    {
        printf("Zero");
    }
}


Measured memory_bytes: 256
i, o, t, j, l ,s, z = map(int,input().split())

ans1, ans2 = 2*o, 2*o

ans1+=4*((i//2)+ (j//2)+(l//2))

if i and j and l:
  ans2+=6
  ans2+=4*(((i-1)//2)+ ((j-1)//2)+((l-1)//2))

print(max(ans1,ans2)//2)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <stack>
using namespace std;
typedef long long LL;
const int N = 1e6+7 , INF = 0x3f3f3f3f , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
template<typename T1>
T1 gcd(T1 a , T1 b){ return b ? gcd(b,a%b) : a;}

int main(){
#ifdef LOCAL
    freopen("F:\\c++\\in.txt", "r", stdin);
//  freopen("F:\\c++\\out.txt","w",stdout);
#endif
    int x,a,b;
    scanf("%d%d%d",&x,&a,&b);
    if( b <= a ){
        puts("delicious");
    }else if( b-a <= x ){
        puts("safe");
    }else{
        puts("dangerous");
    }
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  var N = parseInt(input.split("\n")[0]);
  var K = parseInt(input.split("\n")[1]);
  var output = 1;
  for(var i = 0; i < N; i++){
    if((output * 2 -  output) <= K){
       output = output * 2;
    }else{
      output += K;
    }
    
  }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans = c - a + b;
  if(ans < 0) cout << "0" << endl;
  else cout << ans << endl;

}

Measured memory_bytes: 256
using CompLib.Util;
using System;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        var s = sc.Next();
        var t = sc.Next();
        int a = sc.NextInt();
        int b = sc.NextInt();

        string u = sc.Next();

        if (s == u) a--;
        if (t == u) b--;

        Console.WriteLine($"{a} {b}");

    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    
    vector<int> v(c);
    rep(i,c)cin>>v[i];
    
    priority_queue<pii> pq;
    rep(i,n){
        int c,w;
        cin>>c>>w;
        c--;
        pq.push(pii(w,c));
    }
    
    int used = 0;
    int ans = 0;
    while(used<m && pq.size()){
        int c,w;
        tie(w,c) = pq.top();
        pq.pop();
        if(v[c]>0){
            ans += w;
            v[c]--;
            used++;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_10B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var C = int.Parse(input[2]);

            var radOfC = C * Math.PI / 180.0;

            var bx = Math.Cos(radOfC) * b;
            var by = Math.Sin(radOfC) * b;

            var c = Math.Sqrt((bx - a) * (bx - a) + (by - 0) * (by - 0));
            var h = b * Math.Sin(radOfC);
            var S = a * h / 2.0;
            var L = a + b + c;

            Console.WriteLine("{0}", S);
            Console.WriteLine("{0}", L);
            Console.WriteLine("{0}", h);
        }
    }
}

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

int n,m;

const int maxn=1e5+5;

unordered_map<int,vector<int> >e[maxn];
set<int>g[maxn];//颜色 
unordered_map<int,int>d[maxn];

struct st
{
	int p,b,c;//点 颜色 花费 
	st(int x,int y,int z)
	{
		p=x;b=y;c=z;
	}
};
bool operator < (const st &a,const st &b)
{
	return a.c>b.c;
}
priority_queue<st>q;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u,v,c;cin>>u>>v>>c;
		e[u][c].push_back(v);
		e[v][c].push_back(u);
		g[u].insert(c);
		g[v].insert(c);
	}
	q.push(st(1,0,0));d[1][0]=0;
	while(!q.empty())
	{
		st tmp=q.top();q.pop();
		if(d[tmp.p][tmp.b]!=tmp.c)continue;
		if(!d[tmp.p].count(0)||d[tmp.p][0]>tmp.c)
		{
			d[tmp.p][0]=tmp.c;
			q.push(st(tmp.p,0,tmp.c));
		}
		if(tmp.b==0)
		{
			for(auto v:g[tmp.p])
			{
				if(!d[tmp.p].count(v)||d[tmp.p][v]>tmp.c+1)
				{
					d[tmp.p][v]=tmp.c+1;
					q.push(st(tmp.p,v,tmp.c+1)); 
				}
			}
		}
		else
		{
			for(auto v:e[tmp.p][tmp.b])
			{
				if(!d[v].count(tmp.b)||d[v][tmp.b]>tmp.c)
				{
					d[v][tmp.b]=tmp.c;
					q.push(st(v,tmp.b,tmp.c));
				}
			}
		}
	}
	int ans=INT_MAX;
	for(auto i:d[n])
	{
		ans=min(ans,i.second);
	}
	cout<<(ans==INT_MAX?-1:ans)<<'\n'; 
	
	return 0;
}

Measured memory_bytes: 97584
def keta_sum(n):
  sum = 0
  while n>0:
      sum += n%10
      n = n//10
  return(sum)

N,A,B=map(int,input().split())
sum=0
for i in range(1,N+1) :
  n=keta_sum(i)
  if A<=n and n<=B :
    sum+=i
print(sum)

Measured memory_bytes: 9096
#include <iostream>
#include <algorithm>
#include <queue>
#define f first
#define s second
#define INF (1e9)
#define N 7
using namespace std;
typedef pair<int,int> P;
int bfs(int,int,int,int,int,int);
bool check(int,int,int,int,int,int);
int w,h,data[N][N],d[N][N],cnt[N][N];
int dy[4]={-1,0,1,0};
int dx[4]={0,1,0,-1};
typedef struct data{
  int cy,cx,wy,wx;
} dat;

int main(){
  int sy,sx,gy,gx,wy,wx,ans;
  while(1){
    cin>>w>>h;
    if(!w&&!h) break;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
	cin >> data[i][j];
	if(data[i][j]==2) sy=i,sx=j;
	else if(data[i][j]==3) gy=i,gx=j;
	else if(data[i][j]==4) wy=i,wx=j;
	d[i][j]=INF;
      }
    ans=bfs(sy,sx,wy,wx,gy,gx);
    cout << ans << endl;
  }
  return 0;
}

int bfs(int sy,int sx,int wy,int wx,int gy,int gx){
  queue<dat > q;
  int flag;
  dat k={sy,sx,wy,wx};
  q.push(k);
  d[sy][sx]=0;
  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) cnt[i][j]=0;
  while(!q.empty()){
    dat u=q.front();
    q.pop();
    flag=0;
    for(int i=0;i<4;i++){
      int ny=u.cy+dy[i],nx=u.cx+dx[i];
      if(ny<0||nx<0||h<=ny||w<=nx||data[ny][nx]==1) continue;
      if(check(u.wy,u.wx,u.cy-dy[i],u.cx-dx[i],u.cy,u.cx)){
	d[ny][nx]=d[u.cy][u.cx]+1;
	cnt[nx][ny]++;
	if(cnt[nx][ny]==1000){
	  flag=1;
	  break;
	}
	if(d[gy][gx]!=INF){
	  flag=2;
	  break;
	}
	dat t={ny,nx,u.cy-dy[i],u.cx-dx[i]};
	q.push(t);
      }
    }
    if(flag) break;
  }
  if(flag==2) return d[gy][gx];
  if(flag) return -1;
  if(d[gy][gx]!=INF) return d[gy][gx];
  return -1;
}

bool check(int sy,int sx,int gy,int gx,int xy,int xx){
  if(gy<0||gx<0||h<=gy||w<=gx) return false;
  if(data[gy][gx]==1) return false;
  bool c[N][N];
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) c[i][j]=false;
  queue<P > q;
  q.push(make_pair(sy,sx));
  c[sy][sx]=true;
  while(!q.empty()){
    P u=q.front();
    q.pop();
    for(int i=0;i<4;i++){
      int ny=u.f+dy[i],nx=u.s+dx[i];
      if(ny<0||nx<0||h<=ny||w<=nx||data[ny][nx]==1||(ny==xy&&nx==xx)) continue;
      if(c[ny][nx]==true) continue;
      c[ny][nx]=true;
      q.push(make_pair(ny,nx));
    }
  }
  if(c[gy][gx]==true) return true;
  return false;
}

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

using namespace std;

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

	int n; cin >> n;
	cout << (2199 - n)/200 ;
    

  return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
using  namespace std;
int main() {
	string s;
	cin >> s;
	long long sum = 0;
	for (int i = 0;i < s.size();i++) {
		sum += s[i] - '0';
	}
	if (sum % 9 == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
int INF = 1000;
int main(){
  int N, M, K;
  cin >> N >> M >> K;
  vector<int> D(M);
  for (int i = 0; i < M; i++){
    cin >> D[i];
    D[i]--;
  }
  vector<int> id(N, -1);
  for (int i = 0; i < M; i++){
    id[D[i]] = i;
  }
  vector<vector<int>> v(N, vector<int>(K));
  for (int i = 0; i < N; i++){
    for (int j = 0; j < K; j++){
      cin >> v[i][j];
      v[i][j]--;
    }
  }
  int V = 1 << M;
  vector<vector<int>> E(V);
  for (int i = 0; i < V; i++){
    for (int j = 0; j < K; j++){
      int w = 0;
      for (int k = 0; k < M; k++){
        if (i >> k & 1){
          if (id[v[D[k]][j]] != -1){
            w |= 1 << id[v[D[k]][j]];
          }
        }
      }
      E[i].push_back(w);
    }
  }
  vector<int> d(V, INF);
  d[V - 1] = 0;
  queue<int> Q;
  Q.push(V - 1);
  while (!Q.empty()){
    int u = Q.front();
    Q.pop();
    for (int w : E[u]){
      if (d[w] == INF){
        d[w] = d[u] + 1;
        Q.push(w);
      }
    }
  }
  cout << d[0] << endl;
}


Measured memory_bytes: 38776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  ll judge = 0;
  if (w%2 == 0 && h%2 == 0 && x == w/2 && y == h/2) {
    judge = 1;
  }
  
  long double area = w*h/2.0;
  
  cout << area << ' ' << judge << endl;
}

Measured memory_bytes: 256
#include <iostream>
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; }
const long long INF = 1LL<<60;

// 入力
int N;
long long W, weight[110], value[110]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[110][100100] = {0};

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];
    
    // DPループ
    for (int i = 0; i < N; ++i) {
        for (int sum_w = 0; sum_w <= W; ++sum_w) {
            
            // i 番目の品物を選ぶ場合
            if (sum_w - weight[i] >= 0) {
                chmax(dp[i+1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }
            
            // i 番目の品物を選ばない場合
            chmax(dp[i+1][sum_w], dp[i][sum_w]);
        }
    }
    
    // 最適値の出力
    cout << dp[N][W] << endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/14  Problem: 062_arc_b / Link: https://arc062.contest.atcoder.jp/tasks/arc062_b?lang=en  ----- */
/* ------問題------

シカのAtCoDeerくんは友達のTopCoDeerくんとあるゲームをして対戦しています。 
このゲームは N ターンからなります。各ターンではそれぞれのプレイヤーはじゃんけんのグーかパーを出します。
ただし、各プレイヤーは次の条件を満たす必要があります。
(※) 各ターンの後で、(今までにパーを出した回数)≦(今までにグーを出した回数)　を満たす

このゲームでの各プレイヤーの得点は、(勝ったターンの数) − (負けたターンの数) です。
AtCoDeerくんは特殊能力を持っているので、ゲームが始まる前にTopCoDeerくんの出す N ターンの手を全て知ることが出来ました。
AtCoDeerくんの各ターンでの手を決めて、AtCoDeerくんの得点を最大化してください。 TopCoDeerくんの出す手の情報は文字列 s で与えられます。
s の i(1≦i≦N) 文字目が gのときは i ターン目でTopCoDeerくんがグーを出すことを、 pのときはパーを出すことを表します。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	string S;
	cin >>S;
	ans = SZ(S) / 2;
	FOR(i, 0, SZ(S)) {
		if (S[i] == 'p')
			ans--;
	}


	cout << ans << "\n";

	return 0;
}


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

#define dbg(x) cerr << #x"=" << x << endl;
typedef long long LL;
const int MAX_N = 1e5+100;
int color[MAX_N];
struct Edge{int v; LL c;};
vector<Edge> G[MAX_N];

void dfs(int u, int c){
    color[u] = c;
    for(Edge e : G[u]){
        int v = e.v;
        LL co = e.c;
        if(color[v] == -1){
            if(co&1) dfs(v, c^1);
            else dfs(v, c);
        }
    }
}

int main(){
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    memset(color, -1, sizeof color);
    int u,v,c;
    for(int i = 0; i < n-1; ++i){
        cin >> u >> v >> c;
        G[u].push_back((Edge){v, c});
        G[v].push_back((Edge){u, c});
    }
    dfs(1, 1);
    for(int i = 1; i <= n; ++i){
        cout << color[i] << " ";
    }
    cout << endl;
    return 0;
}


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

using namespace std;

int main()
{
	int a,b,n,m,N;
	while (cin >> n >> m, n || m) {
		vector<bool> seito(501, false);
		vector< vector<bool> > tomo(501, vector<bool>(501, false));

		for (int i = 1; i <= m; i++) {
			cin >> a >> b;
			tomo[a][b] = tomo[b][a] = true;
		}
		for (int i = 2; i <= n; i++) {
			if (tomo[1][i]) {
				seito[i] = true;
				for (int j = 2; j <= n; j++) {
					if (tomo[i][j])
						seito[j] = true;
				}
			}
		}
		N = 0;
		for (int i = 2; i <= n; i++)
			if (seito[i])
				N++;
		cout << N << endl;
	}
	return 0;
}

Measured memory_bytes: 1272
n=int(input())
a=list(enumerate(map(int,input().split())))
a.sort(key=lambda x: -x[1])
dp=[[0]*(n+1) for i in range(n+1)]
for idx,ix in enumerate(a):
    i,x=ix
    for j in range(idx+1):
        dp[j+1][idx-j]=max(dp[j+1][idx-j],dp[j][idx-j]+(i-j)*x)
        dp[j][idx-j+1]=max(dp[j][idx-j+1],dp[j][idx-j]+((n-1-(idx-j))-i)*x)
print(max([dp[i][n-i] for i in range(n+1)]))

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

using namespace std;

int main()
{
    int N, T;
    
    cin >> N >> T;
    vector<int> a(N);
    
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    
    int min = a[0];
    int profit = 0;
    int pattern = 0;
    
    for (int i = 1; i < N; i++)
    {
        if (a[i] < min)
        {
            min = a[i];
        }
        else if (a[i] - min > profit)
        {
            profit = a[i] - min;
            pattern = 1; // reset
        }
        else if (a[i] - min == profit)
        {
            pattern++;
        }
    }
    
    cout << pattern << endl;
    
    return 0;
}


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

int MaxHap(int arr[][3],int N)
{   int dp[N][3];
    for (int i=0;i<3;i++)
    dp[0][i] = arr[0][i];
    
    for (int i =1;i<N;i++)
    {
        for (int j = 0;j<3;j++)
        { int temp =0;
          for (int k =0;k<3;k++)
          {
              if ( j != k)
              {
                  if ( arr[i][j] + dp[i-1][k] > temp)
                  temp = arr[i][j] + dp[i-1][k];
              }
          }
          dp[i][j] = temp;
        }
    }
    return max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]));
}
int main()
{
    int N;
    cin >> N;
    int arr[N][3];
    
    for (int i = 0;i<N;i++)
    {
        for (int j = 0; j < 3; j++)
        cin >> arr[i][j];
    }
    cout << MaxHap(arr,N) << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}














string s;
int n;
ll ans=0;
void calc(ll x,ll y)
{
     if(x==n+1){
          ans+=y;
          return;
     }
     ll cur=0;
     for(int i=x;i<=n;i++){
          cur=cur*10+s[i]-'0';
          calc(i+1,y+cur);
     }
}
int main()
{
     cin>>s;
     s=' '+s;
     n=s.size()-1;
     calc(1,0);
     cout<<ans;

}



















 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;
    ll mypow(ll a,ll b){
        ll res=1;
        a%=mo;
        while(b){
            if(b&1)
                res=res*a%mo;
            a=a*a%mo;
            b>>=1;
        }
        return res;
    }
        const int MAX = 510000;
    const int MOD = 1000000007;
    long long fac[MAX], finv[MAX], inv[MAX];

    // テーブルを作る前処理
    void COMinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    // 二項係数計算
    long long COM(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
int main()
{
ll n,k;
cin >> n>>k;
    vector<ll> kaij;
    kaij.push_back(1);
    for(ll i = 1; i < k+5; i++){
        kaij.push_back((kaij[i-1]*i)%mo);
    }
COMinit();
rep(i,k){
    ans=COM(n-k+1,i+1);
    //ans*=kaij[k-1]*mypow((kaij[k-i-1]*kaij[i])%mo,mo-2);
    ans*=COM(k-1,i);
    ans%=mo;
    cout << ans << endl;
}
return 0;
}


Measured memory_bytes: 12288
#include<stdio.h>
#include<string.h>
#define mod 1000000007
char a[100010];
long long dp[100010][20];
//dp[i][j]=max(dp[i-1][k],dp[i][k]);
int main()
{
	scanf("%s",a);
	int l=strlen(a);
	memset(dp,0,sizeof(dp));
		if(a[0]>='0'&&a[0]<='9')
			dp[0][a[0]-'0']=1;
		else
		{
			for(int i=0;i<=9;i++)
			{
				dp[0][i]=1;
			}
		}
	
	for(int i=1;i<l;i++)
	{
		if(a[i]>='0'&&a[i]<='9')
		{
		     for(int j=0;j<=12;j++)
		     {
		     	int k=(j*10+(a[i]-'0'))%13;
		     	dp[i][k]+=dp[i-1][j];
		     	dp[i][k]=dp[i][k]%mod;
			 }
		}
		else
		{
			for(int j=0;j<=9;j++)
			{
				for(int k=0;k<=12;k++)
				{
					int w=(j+k*10)%13;
					dp[i][w]+=dp[i-1][k];
					dp[i][w]=dp[i][w]%mod;
				}
			}
		}
	}
	printf("%lld\n",dp[l-1][5]%mod);
	return 0;
}

Measured memory_bytes: 15872
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
#define INF 200000000

struct edge{
 int to,cap,rev;
 edge(int t, int c, int r){
  to=t;
  cap=c;
  rev=r;
 }
};

void add_edge(int from,int to,int cap, vector< vector<edge> > &g){
 g[from].push_back( edge(to,cap,g[to].size() ) );
 g[to].push_back(edge(from,0,g[from].size()-1));
}

int dfs(int v,int t, int f, vector< vector<edge> > &g, vector<int> &used){
 if(v==t)return f;
 used[v] = 1;
 for(edge &e : g[v]){
  if(!used[e.to] && e.cap>0){
   int d = dfs(e.to,t,min(f,e.cap),g,used);
   if(d>0){
    e.cap -= d;

	g[e.to][e.rev].cap +=d;
	return d;
   }
  }
 }
 return 0;//return 文忘れていた。
}

int max_flow(int s, int t, vector <vector<edge> > g){
 int flow=0;
 while(1){
  vector<int> used(g.size(),0);
  int f= dfs(s,t,INF,g,used);
 // cout<<f<<endl;
  if(f==0)return flow;
  flow+=f;
 }
}

int main(void){
 int N;
 int Rx[150];
 int Ry[150];
 int Bx[150];
 int By[150];
 
 cin>>N;
 vector< vector<edge>>g (2*N+2);

 for(int i=1; i<=N; i++)cin>>Rx[i]>>Ry[i];
 for(int i=1; i<=N; i++)cin>>Bx[i]>>By[i];
  

 for(int i=1; i<=N; i++){
  add_edge(0,i,1,g);
 }

 for(int i=N+1; i<=2*N; i++){
  add_edge(i,2*N+1,1,g);
 }
 for(int i=1; i<=N; i++)
  for(int j=1; j<=N; j++){
   if(Rx[i]<Bx[j] && Ry[i]<By[j]){
  //  std::cout<<'B'<<std::endl; 
    add_edge(i,N+j,1,g);
   }
  }

 std::cout<<max_flow(0,2*N+1,g)<<std::endl;
}

Measured memory_bytes: 384
/*
ID: Barry Wang
LANG: C++11
TASK: 
*/
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
#define X first
#define Y second
#define Chtolly return 0
/*---define types---*/
typedef long long ll;
typedef list<int> li;
typedef queue<int> qi;
typedef deque<int> dqi;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef unsigned int uint;
/*---define variables---*/
const int inf=(1<<29);
string s;
/*---define function---*/

/*---main code---*/
int main(){
	cin>>s;
	for(int i=0;i<s.size();++i){
		putchar('x');
	}
	puts("");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
int INF = 1e9;
int dp[(1 << 20) + 1][21];
int cost[20][20];
int V, E;
int dfs(int bit, int v){//vに行く時の最小値を返す
    if(bit == 0){//初期位置を0とする
        if(v == 0) return 0;
        else return INF;
    }
    //std::cout << dp[bit][v] << std::endl;
    if(dp[bit][v] != 1000000000 - 1) return dp[bit][v];//探索済の場合
    if(!(bit & (1 << v))) return INF;
    int prebit = bit ^(1 << v);//vを除いた集合
    int res = INF;//答えを格納
    for(int u = 0; u < V; u++){//vの前に来る街を探索
        res = std::min(res, dfs(prebit, u) + cost[u][v]);//値の更新
    }
    return dp[bit][v] = res;
}
int main(){
    std::cin >> V >> E;
    if(E == 0){
        std::cout << -1 << std::endl;
        return 0;
    }
    for(int i = 0; i < V; i++)for(int j = 0; j < V; j++) cost[i][j] = INF;
    for(int i = 0; i < E; i++){
        int s, t, d;
        std::cin >> s >> t >> d;
        cost[s][t] = d;
    }
    for(int bit = 0; bit < (1 << V); bit++)for(int i = 0; i < V; i++)dp[bit][i] = 1000000000 - 1;
    int ans = dfs((1 << V) - 1, 0);
    if(ans == INF) std::cout << -1 << std::endl;
    else std::cout << ans << std::endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

int main() {
  ll x, a, b;
  cin >> a >> b >> x;
  ll res = b / x + 1 - (a > 0 ? (a - 1) / x + 1 : 0);
  cout << res << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc121/tasks/abc121_b

#include <algorithm>
#include <cmath>
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

#define EPS (1e-7)
#define INF (1e9)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int rows, cols, c, t, sum = 0, ans = 0;
    cin >> rows >> cols >> c;
    vector<int> b(cols);
    for (int i = 0; i < cols; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < rows; i++) {
        sum = 0;
        for (int j = 0; j < cols; j++) {
            cin >> t;
            sum += t * b[j];
        }
        if (sum > -c) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256