akhauriyash/Code-Regression huggingface dataset:
// Date: 2020-02-26

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

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO ios::sync_with_stdio(false);cin.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 10;
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int n, k, a[N];
int main() {
    scanf("%d%d", &n, &k);
    int pos;
    rep(i, 1, n) {
        scanf("%d", &a[i]);
        if(a[i] == 1) pos = i;
    }
    int ans = inf;
    rep(i, 1, k) {
        int tp = 1;
        if(pos-i > 0) tp += (pos-i+k-2)/(k-1);
        if(pos-i+1+k <= n) tp += (n-pos+i-2)/(k-1);
        ans = min(ans, tp);
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
		String data[] = br.readLine().split(" ");
		int a = Integer.parseInt(data[0]);
		int b = Integer.parseInt(data[2]);

		String s = (data[1]);
		if(s.equals("?"))break;

		else if (s.equals("+")) {
			System.out.println(a + b);
			}
		else if (s.equals("-")) {
			System.out.println(a - b);
			}

		else if (s.equals("*")) {
			System.out.println(a * b);
			}
		else if (s.equals("/")) {
			System.out.println(a / b);
		}
	}
  }
}

Measured memory_bytes: 24324
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cerr << #x " = " << (x) << endl;
#define P(x) cerr << #x << endl;    
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;

const int maxn = 1e5 + 10;
vector<vector<int>> adj(maxn);
vector<int> vis(maxn);
vector<pii> edges(maxn);

struct node
{
	int v;
	int pcol;
};

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(9);
    
    int n;
	cin >> n;
	
	for(int i = 0; i < n - 1; ++ i)
	{
		int a, b;
		cin >> a >> b;
		-- a; -- b;
		adj[a].push_back(b);
		adj[b].push_back(a);
		edges[i] = {min(a, b), max(a, b)};
	}
	
	queue<node> q;
	q.push({0, -1});
    vis[0] = 1;
	int mx = -1;
	map<pii, int> mp;
	while(!q.empty())
	{
		node cur = q.front();
		q.pop();
		int v = cur.v; int pcol = cur.pcol;
		int col = 1;
		for(int u : adj[v])
		{
			if(vis[u] == 0)
			{
				if(col == pcol) ++ col;
				q.push({u, col});
				mx = max(mx, col);
				mp[{min(u, v), max(u, v)}] = col;
				++ col;
				vis[u] = 1;
				
				
			}
		}
	}
	
	cout << mx << '\n';
	for(int i = 0; i < n - 1; ++ i)
	{
		cout << mp[edges[i]] << '\n';
	}
	
    
    return 0;
}






Measured memory_bytes: 15232
#include <stdio.h>
const char* right="yuiophjklnm";
int x[128];
int main(void)
{
    int i;
    for(i=0;right[i];++i) x[right[i]]=1;
    while (1) {
        int res;
        char s[64];
        scanf("%s", s);
        if (*s=='#') break;

        res=0;
        for(i=1;s[i];++i) res+=x[s[i-1]]^x[s[i]];
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 540
#include <stdio.h>
 
int main(int argc,char* argv[]){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n,i;
  double s_x1,s_y1,s_x2,s_y2,suc;
   
  scanf("%d",&n);
 
  for(i = 0;i < n; ++i){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
     
    s_x1 = x1 - x2;
    s_y1 = y1 - y2;
    s_x2 = x3 - x4;
    s_y2 = y3 - y4;
     
    suc = s_x1 * s_y2 - s_y1 * s_x2;
     
    if(suc <= 1e-10 && suc >= -1e-10){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
     
  }
   
  return 0;
}


Measured memory_bytes: 1988
#include <stdio.h>

int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	(((a>=-1000)&&(a<=1000))&&((b>=-1000)&&(b<=1000)));
	if(a<b)
	{
		printf("a < b\n");

	}
	else
	{
		if(a>b)
		{
			printf("a > b\n");
		}
		else
		{
			printf("a == b\n");
		}
	}
	return 0;
}

Measured memory_bytes: 580
S = input()
s = list(S)
k = []
a = round(len(s) / 2)
b = len(s) % 2
if b == 0:
    for i in range(a):
        k.append(s[i * 2]+s[i * 2 + 1])
    n = 0
    for j in range(a):
        if k[j] == "hi":
            n = n + 1
    if n == 0:
        print("No")
    elif n == a:
        print("Yes")
    else:
        print("No")
    
else:
    print("No")   


Measured memory_bytes: 3064
s  = input()

n = len(s)

a = s[:n-1//2]
b = a[::-1]

x = s[(n+3)//2-1:]
y = x[::-1]

for i in range(len(s)):
    if s[i] ==s[-i-1] and a  == b and x == y:
        print('Yes')
        break

else:print('No')

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

using namespace std;
using Int = long long;

#ifdef ABHI
  #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
  #define trace(...)
#endif

template<class T, int SZ> struct Seg { // SZ should be power of 2
  T seg[2 * SZ], ID = 0;

  Seg() { 
    for(int i = 0; i < 2 * SZ; ++i) seg[i] = ID;
  }
  
  T comb(T a, T b) { 
      return max(a, b);
  }
  // easily change this to min or max
  // comb(ID,b) must equal b

  void build() { for(int i = SZ - 1; i >= 0; --i) { seg[i] = comb(seg[2*i],seg[2*i+1]); } }

  void upd(int p, T value) {  // set value at position p
    for (seg[p += SZ] = value; p > 1; p >>= 1)
      seg[p >> 1] = comb(seg[(p|1)^1],seg[p|1]);
      // make sure non-commutative operations work
  }

  T query(int l, int r) {  // query on interval [l, r]
    T res1 = ID, res2 = ID; r++;
    for (l += SZ, r += SZ; l < r; l >>= 1, r >>= 1) {
      if (l&1) res1 = comb(res1,seg[l++]);
      if (r&1) res2 = comb(seg[--r],res2);
    }
    return comb(res1,res2);
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<Int> h(n), a(n);
  for(Int &x: h) {
    cin >> x;
  }
  for(Int &x: a) {
    cin >> x;
  }
  vector<Int> dp(n);
  Seg<Int, 1 << 18> S;
  Int res = 0;
  for(int i = 0; i < n; ++i) {
    dp[i] = a[i];
    Int z = S.query(0, (int) h[i]);
    trace(dp[i], z, a[i] + z);
    dp[i] = max(dp[i], z + a[i]);
    S.upd((int) h[i], dp[i]);
    res = max(res, dp[i]);
  }
  //~for(Int x: dp) {
    //~cerr << x << ' ';
  //~}
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 9088
#include<stdio.h>
char ban[52][52];
int ans[52][52];
int main(void){
    int i,j,h,w,d,sum;
    int dx[8]={0,1,1,1,0,-1,-1,-1};
    int dy[8]={1,1,0,-1,-1,-1,0,1};
    for(i=0;i<52;i++){
        for(j=0;j<52;j++){
            ban[i][j]=0;
            ans[i][j]=0;
        }
    }
    scanf("%d %d",&h,&w);
    for(i=1;i<=h;i++){
        scanf("%s",&ban[i]);
        for(j=w;j!=0;j--){
            ban[i][j]=ban[i][j-1];
        }
        ban[i][0]=0;
    }
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            sum=0;
            if(ban[i][j]=='#'){
                printf("#");
                continue;
            }
            for(d=0;d<8;d++){
                if(ban[i+dy[d]][j+dx[d]]=='#'){
                    sum++;
                }
            }
            printf("%d",sum);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    map<char, int> memo;
    rep(i, s.size()) memo[s[i]]++;
    
    ll ans = 1;
    for(auto x : memo) {
        ans *= (x.second + 1);
        ans %= MOD;
    }
    ans--;
    cout << ans << endl;

    return 0;
}

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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> v(N, 0);
  for (int i = 0; i < M; i++) {
    int A;
    cin >> A;
    v[A]++;
  }
  for (int i = X + 1; i < N; i++) {
    v[i] += v[i - 1];
  }
  for (int i = X; i > 0; i--) {
    v[i - 1] += v[i];
  }
  cout << min(v[0], v[N - 1]) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
using namespace std;

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


int main() {
	int n;
	cin >> n;
	int S[n];
	int sum = 0;
	rep(i, n) {
		cin >> S[i];
		sum += S[i];
	}
	sort(S, S+n);
	if (sum%10==0) {
		bool flg = false;
		rep(i, n) {
			if (S[i]%10!=0) {
				sum -= S[i];
				flg = true;
				break;
			}
		}
		if (!flg) sum = 0;
	}
	cout << sum << endl;
}

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

int main(void){
    ll n, m;
    cin >> n >> m;

    ll ans = 1;
    if(abs(n - m) == 1){
        rep(i, min(m, n)){
            ans *= (n - i);
            ans %= 1000000007;
            ans *= (m - i);
            ans %= 1000000007;
        }
    }

    if(n == m){
        rep(i, n){
            ans *= (n - i);
            ans %= 1000000007;
            ans *= (m - i);
            ans %= 1000000007;
        }
        ans *= 2;
        ans %= 1000000007;
    }

    if(abs(n - m) > 1){
        ans = 0;
    }


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


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

int main() {
  int a,b,x;
  cin >>a>>b>>x;
  if(a<=x && a+b>=x) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


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

#define N 1000000
int isHamming(int x){
  while (x%2==0) x /= 2;
  while (x%3==0) x /= 3;
  while (x%5==0) x /= 5;
  return x==1;
}

int main(void){
  int cnt[N+1], a, b;
  
  cnt[0] = 0;
  for (int i=1; i<=N; i++){
    cnt[i] = cnt[i-1] + isHamming(i);
  }
  while (cin >> a){
    if (a==0) break;
    cin >> b;
    cout << (cnt[b] - cnt[a-1]) << endl;
  } 
  return 0;
}
  
  



Measured memory_bytes: 6940
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	_ = readString()
	s := readString()
	_ = readString()

	printf("A%cC\n", []byte(s)[0])
}


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

int main(void){
	int n;
	vector<int> a;
	int i;
	int count=0;
	int in;

	cin >> n; if(n<0||n>100) return 0;
	for(i=0;i<n;i++){
		cin >> in;
		a.push_back(in);
		count++;
	}
	reverse(a.begin(),a.end());
	for(i=0;i<count;i++){
		if(i==count-1) cout << a.at(i) << endl;
		else cout << a.at(i) << " ";
	}
	return 0;
}

Measured memory_bytes: 1220
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
  let _n: u32 = read();
  let _s: String = read();
  let e_num = _s.chars().filter(|&c| c == 'E').count();
  let mut right_e_num = e_num;
  let mut left_w_num = 0;
  let s: Vec<char> = _s.chars().collect();
  let mut res = Vec::new();
  for i in s {
    if i == 'E'{
      right_e_num -= 1;
    } 
    res.push(left_w_num + right_e_num);
    if i=='W' {
      left_w_num += 1;
    }
  }
  println!("{}", res.iter().min().unwrap());
  
}


Measured memory_bytes: 12268
S = input()
S2 = ""
Q = int(input())
reverse = 1
for i in range(Q):
    list = input()
    if list[0] == "1":
        reverse *= -1
    else:
        if reverse == 1:
            if list[2] == "2":
                S += list[4]
            else:
                S2 += list[4]
        else:
            if list[2] == "2":
                S2 += list[4]
            else:
                S += list[4]
if reverse == 1:
    print(S2[::-1] + S)
else:
    print(S[::-1] + S2)


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++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;

    }
}

LL comb(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;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    combInit();
    int n, k;
    cin >> n >> k;
    for( int i = 1; i <= k; ++i ) {
        LL c1 = comb(n - k + 1, i);
        LL c2 = comb(k - 1, i - 1);
        cout << c1 * c2 % MOD << endl;

    }
    return 0;
}



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

using namespace std;

int main(){
	ios_base::sync_with_stdio (false);
	cout << fixed;
	cout.precision(10);
	if(fopen("joke.in", "r")){
		freopen ("joke.in","r",stdin);
		freopen ("joke.out","w",stdout);
	}

	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	int x;
	for(int i = 0; i < n; ++i){
		cin >> x;
		a[i] = {x, i + 1};
	}

	sort(a.begin(), a.end());
	for(int i = 0; i < n; ++i){
		cout << a[i].second << " ";
	}

    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt {
	fint64 x;
	ModInt():x(0){}
	ModInt(fint64 x):
		x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
		{}
	// 負号
	ModInt operator -() const{
		return ModInt(-x);
	}
	// 加算
	ModInt &operator +=(const ModInt &rhs){
		x+=rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator +(const ModInt &rhs) const{
		return ModInt(*this)+=rhs;
	}
	// 減算
	ModInt &operator -=(const ModInt &rhs){
		x+=MOD-rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator -(const ModInt &rhs) const{
		return ModInt(*this)-=rhs;
	}
	// 乗算
	ModInt &operator *=(const ModInt &rhs){
		x*=rhs.x;
		if(x>=MOD) x%=MOD;
		return (*this);
	}
	ModInt operator *(const ModInt &rhs) const{
		return ModInt(*this)*=rhs;
	}
	// 除算
	ModInt &operator /=(const ModInt &rhs){
		(*this)*=rhs.inverse();
		return (*this);
	}
	ModInt operator /(const ModInt &rhs) const{
		return ModInt(*this)/=rhs;
	}
	// 等号
	bool operator ==(const ModInt &rhs){
		return x==rhs.x;
	}
	bool operator !=(const ModInt &rhs){
		return x!=rhs.x;
	}
	// 累乗
	ModInt pow(fint64 n) const{
		fint64 tmp=x;
		fint64 ret=1;
		while(n>0){
			if(n&1) ret=ret*tmp%MOD;
			tmp=tmp*tmp%MOD;
			n>>=1ll;
		}
		return ModInt(ret);
	}
	// 逆元
	ModInt inverse() const{
		fint64 a=x,b=MOD,s=1,t=0;
		while(b>0){
			fint64 u=a/b;
			a-=u*b;
			s-=u*t;
			swap(a,b);
			swap(s,t);
		}
		return ModInt(s);
	}
	// 入出力
	friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
		fint64 x; lhs>>x;
		rhs=ModInt<MOD>(x);
		return lhs;
	}
	friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
		return lhs<<rhs.x;
	}
};
using mint = ModInt<MOD>;

int main() {
	int n; cin >> n;
	mint t = 10, q = 9, e = 8;
	mint ans = t.pow(n) - q.pow(n) - q.pow(n) + e.pow(n);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  int a, b;
  cin >> a >> b;
  cout << max(max(a + b, a - b), a * b) << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];
 
int main()  {

  long long N;
  std::cin >> N;
  
  std::vector<float> A(N);
  std::vector<string> B(N);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i] >> B[i];
  }
  float sum=0;
  
  for (int i = 0; i < N; i++) {
    if(B[i]=="JPY"){
		sum+=A[i];
	}
	else{
		sum+=A[i]*380000;
	}	
  }
  printf("%f\n",sum);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define nt _int128
#define mod 1000000007
# define ppi pair<int,pair<int,int>>
int main()
{
#ifndef ONLINE_JUDGE
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    // cin >> t;
    t  = 1;
    while(t--)
    {
    	int n,m,c1,c2,d1,d2;
    	cin>>n>>m;
    	cin>>c1>>c2;
    	cin>>d1>>d2;
    	int arr[n+1][m+1];
    	for(ll i=1;i<=n;i++)
   		{
   			for(ll j=1;j<=m;j++)
   			{
   				char c;
   				cin>>c;
   				if(c=='.')
   					arr[i][j]=INT_MAX;
   				else
   					arr[i][j]=-1;
   			}
   		}
   		priority_queue<ppi,vector<ppi>,greater<ppi>>q;
   		
   		q.push({0,{c1,c2}});

   		while(!q.empty())
   		{
   			ppi p=q.top();
   			q.pop();
   			int val=p.first;
   			int x=p.second.first,y=p.second.second;
   			if(arr[x][y]<=val)
   				continue;
   			arr[x][y]=val;
   			if(x==d1 and y==d2)
   				continue;
   			// cout<<x<<" "<<y<<endl;
   			for(int i=max(x-2,1);i<=min(x+2,n);i++)
   			{
   				for(int j=max(y-2,1);j<=min(y+2,m);j++)
   				{
   					if(arr[i][j]==-1 or (i==x and j==y))
   						continue;
   					if(i==x-1 and j==y)
   					{
   						q.push({arr[x][y],{i,j}});
   					}
   					else if(i==x+1 and j==y )
   					{
   						q.push({arr[x][y],{i,j}});
   					}
   					else if(i==x and j==y-1)
   					{
   						q.push({arr[x][y],{i,j}});
   					}
   					else if(i==x and j==y+1 )
   					{
   						q.push({arr[x][y],{i,j}});
   					}
   					else
   					{
   						q.push({arr[x][y]+1,{i,j}});
   					}
   				}
   			}
   		}
   		if(arr[d1][d2]==INT_MAX)
   			cout<<-1;
   		else
   			cout<<arr[d1][d2];


    }
    return 0;
}

Measured memory_bytes: 8644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    // 偶数番目が正数になる
    ll bf_e = 0;
    ll cnt_e = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0)
        {
            if (bf_e + a[i] <= 0)
            {
                ll num; // 変化量
                num = 1 - bf_e - a[i];
                cnt_e += num;
                bf_e = 1;
            }
            else
            {
                bf_e = bf_e + a[i];
            }
        }
        else
        {
            if (bf_e + a[i] >= 0)
            {
                ll num; // 変化量
                num = bf_e + a[i] + 1;
                cnt_e += num;
                bf_e = -1;
            }
            else
            {
                bf_e = bf_e + a[i];
            }
        }
    }
    // 奇数番目が整数になる
    ll bf_o = 0;
    ll cnt_o = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 1)
        {
            if (bf_o + a[i] <= 0)
            {
                ll num; // 変化量
                num = 1 - bf_o - a[i];
                cnt_o += num;
                bf_o = 1;
            }
            else
            {
                bf_o = bf_o + a[i];
            }
        }
        else
        {
            if (bf_o + a[i] >= 0)
            {
                ll num; // 変化量
                num = bf_o + a[i] + 1;
                cnt_o += num;
                bf_o = -1;
            }
            else
            {
                bf_o = bf_o + a[i];
            }
        }
    }
    cout << min(cnt_o, cnt_e) << endl;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    static InputStream is;
    static PrintWriter out;
    static String INPUT = "";

    final int INF = Integer.MAX_VALUE;
    final int MIN = Integer.MIN_VALUE;

    static void solve() {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int ia = (int) 'a';
        int iz = (int) 'z';
        int iA = (int) 'A';
        int iZ = (int) 'Z';
        int d = iA - ia;
        String res = "";
        for (int i = 0, l = line.length(); i < l; i++) {
            char c = line.charAt(i);
            int ci = (int) c;
            String r = c + "";
            if (ia <= ci && ci <= iz) {
                r = ((char) (ci + d)) + "";
            } else if (iA <= c && c <= iZ) {
                r = ((char) (ci - d)) + "";
            }
            res += r;
        }
        System.out.println(res);
    }

    public static void main(String[] args) throws Exception {
        solve();
    }

}

Measured memory_bytes: 24196
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    double a,b;
    cin>>a>>b;
    if(floor((a+b)/2)==(a+b)/2) cout<<fixed<<setprecision(0)<<floor((a+b)/2)<<endl;
    else cout<<fixed<<setprecision(0)<<floor((a+b)/2)+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    while (cin >>a>>b){
    
    c=a+b;
    
    if(c<10) cout << "1" <<endl;
    else if (c<100) cout << "2" <<endl;
    else if (c<1000) cout << "3" <<endl;
    else if (c<10000) cout <<"4" <<endl;
    else if (c<100000) cout<<"5" <<endl;
    else if (c<1000000) cout <<"6"<<endl;
    else cout <<"7" <<endl;
    
    }
    
}
    
    
    



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

int main() {
	int Number = 0;//カードの枚数
	int Alice = 0;//Aliceの得点
	int Bob = 0;//Bobの得点
	int Max = 0;//最適な戦略
	int Cheak = 0;//この数が最大かどうか確認
	int Max_index = 0;//一回使用した配列の要素番号を記録
	cin >> Number;
	vector<int> Card(Number);//カードの数字を記録  
	for (int Loop = 0; Loop < Number; Loop++) {
    	cin >> Card.at(Loop);
    }  
	for (int Loopi = 0; Loopi < Number; Loopi++) {
        Max = 0;
        Max_index = 0;
		for (int Loopii = 0; Loopii < Number; Loopii++) {
        	Cheak = Card.at(Loopii);
    		if (Cheak > Max) {
            	Max = Cheak;
        		Max_index = Loopii;
            }
        }
        //cout << Max << endl;
        //cout << Max_index << endl;
        	if (Loopi % 2 == 0) {
            	Alice += Max;
            }
      		else {
            	Bob += Max;
            }
         	Card.at(Max_index) = 0;
    }
    cout << Alice - Bob << endl;
    //cout << Alice << endl;
    //cout << Bob << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> h(N + 1);
    rep(i, N) cin >> h[i];
    h[N] = 0;
    bool all_zero = false;
    int ans = 0;
    while (true) {
        pair<int, int> range;
        range.first = -1;
        all_zero = true;
        int mini = 0;
        rep(i, N + 1) {
            if (range.first == -1 && h[i] != 0) {
                range.first = i;
                mini = h[i];
                continue;
            }
            if (range.first != -1 && h[i] != 0) {
                mini = min(mini, h[i]);
            }
            if (range.first != -1 && h[i] == 0) {
                range.second = i - 1;
                break;
            }
        }
        FOR(i, range.first, range.second + 1) {
            h[i] -= mini;
        }
        ans += mini;
        if (!mini) break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        vector<Int> A(N), B(N), C(N - 1);
        for (int i = 0; i < N; ++i) {
            cin >> A[i];
            A[i]--;
        }

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

        for (int i = 0; i + 1 < N; ++i) {
            cin >> C[i];
        }

        Int ans = 0;
        for (int i = 0; i < N; ++i) {
            ans += B[A[i]];
            if (i > 0) {
                if (A[i - 1] + 1 == A[i]) {
                    ans += C[A[i] - 1];
                }
            }
        }
        cout << ans << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
import sys;sys.setrecursionlimit(int(1e7))
from sys import stdin
from collections import deque

input = stdin.readline
N = int(input())
tree = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b, c = map(int,input().split())
    tree[a].append((b,c))
    tree[b].append((a,c))

Qn,K = map(int,input().split())
XY = [tuple(map(int,input().split())) for _ in range(Qn)]

dist = [-1]*(N+1)
dist[K] = 0
Q = deque()
Q.append(K)
while len(Q):
    p = Q.popleft()
    for q,c in tree[p]:
        if dist[q] != -1: continue
        dist[q] = dist[p]+c
        Q.append(q)

for i in range(Qn):
    print(dist[XY[i][0]] + dist[XY[i][1]])

Measured memory_bytes: 57272
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}

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


    
     int solve()
     {  
        int n,k,s;cin>>n>>k>>s;
        rep0(k) cout<<s<<" ";
        int z=1;
        if(s<=100000){z=1e9;}
        rep0(n-k) cout<<z<<" ";

        r0   
     }
    signed main()
    {   
        asdf
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	long long a[n],zero=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==0)zero++;
	}
	if(zero>0){cout<<0<<'\n';return 0;}
	long long res = 1;
	for(int i=0;i<n;i++)
	{
		if(a[i] <= 1000000000000000000/res)
			res *=a[i];
		else 
		{
			cout<<-1<<'\n';
			return 0;
		}
	}
	cout<<res<<'\n';
}


Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}


void solve(long long N, long long M, std::vector<long long> s, std::vector<long long> c){
    bool f=true;
    ll ret;
    ll ini;
    if(pow(10,N-1)==1){
        ini=0;
    }else{
        ini=pow(10,N-1);
    }
    for (long long i = ini; i < pow(10,N); i++) {
        f=true;
        for (long long j = 0; j < M; j++) {
            string t=to_string(i);
            int d=digit(i);
            string ch=to_string(c[j]);
            // if(i==702){
            // debg(t);
            // debg(d);
            // debg(s[j]);
            // debg(t[s[j]-1]);
            // debg(c[j]);
            // }
            if(s[j] <= d && t[s[j]-1] == ch[0]) {
                continue;
            }else{
                f=false;
                break;
            }
        }
        if(f){
            ret=i;
            break;
        }
    }
    if(f==false){
        cout << -1 << endl;
    }else{
        cout << ret << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> s(M);
    std::vector<long long> c(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&s[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, M, std::move(s), std::move(c));
    return 0;
}


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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    ll k,n;
    cin >> k >> n;
    vector<ll> a(n);
    vector<ll> sub(n);
    REP(i,n)cin >> a[i];
    REP(i,n){
        if(i == n - 1){
            sub[i] = a[0] + (k - a[i]);
            break;
        }
        sub[i] = a[i+1] - a[i]; 
    }

    sort(all(sub));

    ll ans = 0;
    for(int i = 0;i < a.size()-1;i++){
        ans += sub[i];
    }

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

Measured memory_bytes: 3456
INT_MAX=10**18+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
#################################################################################
from math import pi
n=int(input())
print(2*pi*n)


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

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

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

    int ans = 0;
    for (int i = 0; i < n; i++){
        if ((i + 1) % 2 && a[i] % 2)
            ans += 1;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
    int n,x,cnt=0;
    cin>>n>>x;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    long long ans=0;
    for(int i=0;i<n-1;i++)
    {
        ans+=a[i];
        if(ans<=x) cnt++;
    }
    if((x-ans)==a[n-1]) cnt++;
    printf("%d\n",cnt);
}


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

#define ll long long

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

    int n, m; cin>>n>>m;
    vector<int> adj[n+1];
    while (m--)
    {
        int x, y; cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    int par[n+1] = {};
    queue<int> Q;
    Q.push(1);
    par[1] = -1;
    while (!Q.empty())
    {
        int x = Q.front(); Q.pop();
        for (auto y: adj[x])
        {
            if (par[y]) continue;
            par[y] = x;
            Q.push(y);
        }
    }

    printf("Yes\n");
    for (int i = 2; i <= n; i++)
    {
        printf("%d\n", par[i]);
    }
}


Measured memory_bytes: 10540
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)

    print((1000 - n) % 1000)


if __name__ == "__main__":
    main()


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

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

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

  string s; cin >> s;
  int n = s.size();
  ll ans = 0;

  rep(i, 1<<(n-1)) {
    ll now = s[0]-'0';
    rep(j, n-1) {
      if(i & 1<<j) {
        ans += now;
        now = s[j+1]-'0';
      } else {
        now = now*10 + (s[j+1]-'0');
      }
    }
    ans += now;
  }

  cout << ans << '\n';
  return 0;
}


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

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    int lowest = 1e8, ans = 0;
    rep(i, n) {
        if (lowest > p[i]) {
            ans++;
            lowest = p[i];
        }
    }

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

Measured memory_bytes: 1024
/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
//#define =1e9 =(int)1e9
const ll mod = 1000000007;
const ll nmax=1000003;
#define int ll
int n, a[200002], mx[2];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n;
    for(int i=1; i<=n; i++){
        cin>>a[i];
        int x=a[i];
        for(int id=0; id<2; id++) if(mx[id]<x) swap(mx[id], x);
    }
    for(int i=1; i<=n; i++) if(a[i]==mx[0]) cout<<mx[1]<<" "; else cout<<mx[0]<<" ";
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int x,a,b;
           cin>>x>>a>>b;
           a=abs(x-a);
           b=abs(x-b);
           cout<<(a<b ? 'A':'B')<<endl;
}

Measured memory_bytes: 3540
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;


int main()
{
	ll N, M, V, P;
	ll A[100000];
	cin >> N >> M >> V >> P;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	sort(A, A+N);
	
	ll S[100000];
	fill(S, S+N, 0);
	S[0] = A[0];
	for(int i = 1; i < N; i++){
		S[i] = S[i-1] + A[i];
	}
	
	int count = 0;
	for(int i = 0; i < N; i++){
		if(A[N-P] <= A[i]){
			count++;
			continue;
		}
		
		if(N-P-i <= N-V){
			if(A[N-P] <= A[i] + M){
				count++;
			}
			continue;
		}
		
		ll sum = S[N-P]-S[i] - A[i]*(N-P-i);
		if(sum <= (N-V) * M && A[N-P] <= A[i] + M){
			count++;
		}
	}
	cout << count << endl;
	
	return 0;
}

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

using namespace std;

int main(){
  int n;
  string s;
  cin>>n;
  cin>>s;
  int ans = -1;
  int tmp = 0;
  for(int i = 0;i<n;i++){
    ans = max(ans,tmp);
    if(s[i] == 'I')
      tmp++;
    else
      tmp--;
    // ans = max(ans,tmp);
  }
  ans = max(ans,tmp);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
N,x=map(int,raw_input().split())
#print N,x
a=map(int,raw_input().split())
#print a

cnt=0
for i in range(N-1):
	t_sum=a[i]+a[i+1]
	t_erase=t_sum-x
	if t_sum<=x:
		continue
	else:
		if a[i+1]>=t_erase:
			a[i+1]-=t_erase
		else:
			a[i]-=(t_erase-a[i+1])
			a[i+1]=0
	cnt+=t_erase

print cnt
		

Measured memory_bytes: 11316
import collections
n=int(input())
a=sorted(list(map(int,input().split())))
c=collections.Counter(a)
counter=0
for i in range(a[0],a[n-1]+1):
    sum=c[i-1]+c[i]+c[i+1]
    if sum>counter:
        counter=sum

print(counter)


Measured memory_bytes: 20704
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn solve() -> bool {
    let n = read::<usize>();
    let a = read_vec::<usize>();
    let mut count = vec![0; n];
    for num in a {
        count[num] += 1;
    }
    if n % 2 == 1 {
        if count[0] != 1 {
            return false;
        }
        for i in 1..n / 2 + 1 {
            if count[i * 2] != 2 {
                return false;
            }
        }
    } else {
        for i in 0..n / 2 {
            if count[i * 2 + 1] != 2 {
                return false;
            }
        }
    }
    let mut ans = 1;
    for _ in 0..n / 2 {
        ans *= 2;
        ans %= 1000_000_000 + 7;
    }
    println!("{}", ans);
    true
}

fn main() {
    if !solve() {
        println!("0");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 6396