akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)((n>>m)&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll n,ans;
ll dp[1<<18][2];

int main(){
	scanf("%lld",&n);
	rep(i,0,1<<n)scanf("%lld\n",&dp[i][0]);
	rep(i,0,n)rep(k,0,1<<n)if(bit(k,i)){
		//dp[k]を、dp[k]とdp[k^(1<<i)]にマージしたものに取り替える
		ll temp[4];
		temp[0]=dp[k][0];
		temp[1]=dp[k][1];
		temp[2]=dp[k^(1<<i)][0];
		temp[3]=dp[k^(1<<i)][1];
		sortdown(temp,4);
		dp[k][0]=temp[0];
		dp[k][1]=temp[1];
	}
	dp[0][0]=0;
	rep(i,1,1<<n)dp[i][0]+=dp[i][1];
	rep(i,1,1<<n)dp[i][0]=max(dp[i-1][0],dp[i][0]);
	rep(i,1,1<<n)printf("%lld\n",dp[i][0]);
	return 0;
}

Measured memory_bytes: 7040
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9

int main(){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n, k);

    rep(i, q) {
        int p;
        cin >> p;
        a[p-1]++;
    }

    rep(i, n) {
        a[i] -= q;
        if(a[i] > 0) {
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }



    return 0;
}

Measured memory_bytes: 3792
N,M=map(int,input().split())
A = [0]*(N+1)

for _ in range(M):
  a = int(input())
  A[a] = 1

#初期化
dp=[0]*(N+1)
dp[0] = 1
if A[1] == 0:
  dp[1] = 1

#dp
for i in range(2,N+1):
  if A[i] == 0:
    dp[i] = dp[i-1] + dp[i-2]
      
print(dp[N]%1000000007)

Measured memory_bytes: 466200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};


int main(){
    ll n; cin >> n;
    ll mi = INF, ma = -1;
    vector<ll> v1(n), v2(n);
    rep(i, n){
        ll x, y; cin >> x >> y;
        v1[i] = x-y, v2[i] = x+y;
    }
    sort(all(v1));
    sort(all(v2));
    cout << lmax(v1[n-1]-v1[0], v2[n-1]-v2[0]) << endl;
}


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

int memo[501][501];
string in;

int solve(int s,int t) {
    if(s == t) return memo[s][t] = 1;
    if(memo[s][t] != 0) return memo[s][t];

    if(in[s] != 'm' || in[t-1] != 'w') return memo[s][t] = 2;

    for(int e = s+1; e < t-1; ++e)
        if(in[e] == 'e') {
            if(solve(s+1,e) == 1 && solve(e+1,t-1) == 1)
                return memo[s][t] = 1;
        }

    return memo[s][t] = 2;
}

int main() {
    memset(memo, 0, sizeof(memo));

    cin>>in;
    if(solve(0,in.length()) == 1) cout<<"Cat"<<endl;
    else cout<<"Rabbit"<<endl;
}

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

int main(){

  int N, K;
  vector<int> dice_v;
  int max_hope;

  cin >> N >> K;
  int inp_n;
  rep(i, N){
    cin >> inp_n;
    dice_v.push_back(inp_n);
  }
  
  int sum = 0;
  rep(i,N - K + 1){
    if(i == 0){
      rep(j,K){
        sum += dice_v[j];
      }
      max_hope = sum;
    }else{
      sum += dice_v[i + K - 1] - dice_v[i - 1];
      max_hope = max(max_hope, sum); 
    }
    }
  float ans = float(max_hope + K) / 2;
  cout << fixed << setprecision(6) << ans << endl; ;
}

Measured memory_bytes: 1400
import bisect
n= int(input())
a = list(map(int,input().split()))
a.sort()
b = list(map(int,input().split()))
b.sort()
c = list(map(int,input().split()))
c.sort()

ans = 0
for y in b:
    x = bisect.bisect_left(a, y)#挿入点はどの同じ値よりも左
    z = bisect.bisect_right(c, y) #挿入点はどの同じ値より右
    ans += x * (len(c) - z)#b<a * b > cの組み合わせ
print(ans)


Measured memory_bytes: 29484
def f(m,a,b,p):
    for i in range(m,0,-1):
        for j in range(2,-~int(i**.5)):
            if p[j] and i%j==0:
                q=i//j
                if a*q<=b*j and j<=q and p[q]:print(j,q);return
n=100000
p=[0]*2+[1]*(n-2)
for i in range(2,-~int(n**.5)):
    if p[i]:
        for j in range(i*i,n,i):
            p[j]=0
while 1:
    m,a,b=map(int,input().split())
    if m==0:break
    f(m,a,b,p)

Measured memory_bytes: 8704
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

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

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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(ll i = 0; i < n; i += k)




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

	vector<vector<ll>> imos(n + 5, vector<ll>(n + 5));
	REP(i, m) {
		ll l, r;
		cin >> l >> r;
		imos[0][r]++;
		imos[l + 1][r]--;
		imos[0][n + 2]--;
		imos[l + 1][n + 2]++;
	}

	for (ll i = 1; i < n + 3; i++) {
		for (ll j = 0; j < n + 3; j++) {
			imos[i][j] += imos[i - 1][j];
		}
	}

	for (ll i = 0; i < n + 3; i++) {
		for (ll j = 1; j < n + 3; j++) {
			imos[i][j] += imos[i][j - 1];
		}
	}

	/*
	REP(i, n + 3) {
		REP(j, n + 3) {
			cout << imos[i][j] << ' ';
		}
		cout << endl;
	}
	*/

	REP(i, q) {
		ll p, q;
		cin >> p >> q;
		cout << imos[p][q] << endl;
	}
}

Measured memory_bytes: 2944
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    lli t1,t2,a1,a2,b1,b2;
    cin>>t1>>t2;
    cin>>a1>>a2;
    cin>>b1>>b2;

    a1-=b1;
    a2-=b2;

    lli x=t1*a1+t2*a2;
    if(x==0)
    {
        cout<<"infinity"<<endl;
        return 0;
    }

    if(x<0)
    {
        a1*=-1;
        a2*=-1;
        x*=-1;
    }

    if(a1>0)
    {
        cout<<0<<endl;
        return 0;
    }

    dbg(a1,a2,t1*a1+t2*a2,x);
    lli ans=(-a1*t1)/x;
    ans*=2;
    ans++;
    ans-=((-a1*t1)%x==0);
    cout<<ans<<endl;

}   aryanc403();
    return 0;
}

Measured memory_bytes: 256
(defmacro defsolver (name vars &body body)
  `(defun ,name ()
     (let (,@(mapcar #'list
            vars
            (mapcar (constantly '(read))
                vars)))
       ,@body)))

(defsolver solution-c (a b c d)
  (let* ((ca (floor a c))
	 (cb (floor b c))
	 (da (floor a d))
	 (db (floor b d))
	 (l (lcm c d))
	 (la (floor a l))
	 (lb (floor b l))
	 (dup 0))
    (when (not (or (= (mod a c) 0)
		   (= (mod a d) 0)))
      (incf dup))
    (princ
     (+ dup
	(-
	 (+ (- b cb db) lb)
	 (+ (- a ca da) la))))))

(solution-c)

Measured memory_bytes: 17760
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;

ll calc( long n, char* str0, char* str1, long before )
{
    if(n==0) {
        return 1;
    }
    else if(n==1) {
        return 3-before;
    }
    else {
        ll val = 0;
        if(str0[0]==str1[0]) val += (3-before)* calc(n-1, str0+1, str1+1, 1) % MOD;
        if(str0[0]!=str1[0] && before==2) val += 3* calc(n-2, str0+2, str1+2, 2) % MOD;
        if(str0[0]!=str1[0] && before==1) val += 2* calc(n-2, str0+2, str1+2, 2) % MOD;
        if(str0[0]!=str1[0] && before==0) val += 3*2* calc(n-2, str0+2, str1+2, 2) % MOD;
        return (val % MOD);
    }
}

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    char s0[55]={0};
    char s1[55]={0};

    scanf("%s", s0);
    scanf("%s", s1);

    ll val = calc( n, s0, s1, 0 );

    printf("%lld\n", val);

    return 0;
}


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

using namespace std;

int main(){
    long long int N,K,sum=0;
    cin >> N >> K;
    pair<int,int> ab;
    vector<pair<int,int>> vec(N);
    for(int i=0;i<N;i++){
        cin >> ab.first >> ab.second;
        vec[i] = ab;
    }

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

    for(int i=0;i<N;i++){
        sum += vec[i].second;
        if(K<=sum){
            cout << vec[i].first << endl;
            break;
        }
    }
}

Measured memory_bytes: 1024
#include <iostream>
    #include <algorithm>
    using namespace std;
     
    int main(void){
        int n;
        cin >> n;
        int l[n];
        for (int i=0;i<n;i++) {
            cin >> l[i];
        }
        sort(l,l+n);
        int cnt = 0;
        for (int i=0;i<n-2;i++) {
            for (int j=i+1;j<n-1;j++) {
                for (int k=j+1;k<n;k++) {
                    if (l[k] < l[i] + l[j])
                        cnt++;
                }
            }
        }
     
        cout << cnt << endl;
        return 0;
    }

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	vector<int> res;
	while ((int)A.size() > 0) {
		bool ok = false;
		for (int i = (int)A.size() - 1; i >= 0; i--) {
			if (A[i] == i + 1) {


				//cerr << i + 1 << endl;
				res.push_back(i + 1);
				A.erase(A.begin() + i);
				ok = true;
				break;
			}
		}

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

	}
	reverse(res.begin(), res.end());
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << 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)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int a, p;
  cin >> a >> p;
  cout << (3 * a + p) / 2 << endl;
  return 0;
}

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

int main() {
    ll n,sum=0;
    cin >> n;
    for(ll i=1;i<=n;i++){
        if(i%3!=0&&i%5!=0)sum+=i;
    }
    cout << sum << endl;
    return 0;
}


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

int main() {
	// your code goes here
	long long h,w;
	cin>>h>>w;
	vector<vector<long long>> dp(h,vector<long long> (w,0));
	vector<vector<char>> T(h,vector<char> (w,'.'));
	for(long long i=0;i<h;i++){
	    for(long long j=0;j<w;j++){
	        char a;
	        cin>>T[i][j];
	    }
	}
	for(long long i=0;i<h;i++){
	    if(T[i][0]=='.') dp[i][0]=1;
	    else break;
	}
	for(long long j=0;j<w;j++){
	    if(T[0][j]=='.') dp[0][j]=1;
	    else break;
	}
	for(long long i=1;i<h;i++){
	    for(long long j=1;j<w;j++){
	        if(T[i][j]=='.'){
	            dp[i][j]=(dp[i-1][j]%1000000007+dp[i][j-1]%1000000007)%1000000007;
	        }
	        else dp[i][j]=0;
	    }
	}
	cout<<dp[h-1][w-1]%1000000007;
	return 0;
}


Measured memory_bytes: 9088
#include <iostream>

using namespace std;

void call(int n);

int main()
{
	int n;
	cin >> n;

	call(n);
	
	return 0;
}

void call(int n)
{
	int i = 1;
CHECK_NUM:
	int x = i;
	if (x % 3 == 0) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
INCLUDE3:
	if (x % 10 == 3) {
		cout << " " << i;
		goto END_CHECK_NUM;
	}
	x /= 10;
	if (x) goto INCLUDE3;
END_CHECK_NUM:
	if (++i <= n) goto CHECK_NUM;

	cout << endl;
}


Measured memory_bytes: 3088
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    ll n,m;
    ll ans=0;
    cin>>n>>m;

    if(n*2<m){
        ans=n;
        m-=n*2;
        ans+=m/4;
    }else{
        ans=m/2;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.math.BigInteger;
 
public class Main implements Runnable {
	
	static int mod = 1000000007;
    static boolean[] s;
	
    public static void main(String[] args) {
    	new Thread(null, new Main(), "", 1024 * 1024 * 1024).start();
    }
    
    public void run() {
       	PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        
        int n = sc.nextInt();
        int[] p = sc.nextintArray(n);

        int ans = 0;
        for(int i=1;i<n-1;i++){
        	if(p[i-1]<p[i] && p[i] < p[i+1]){
        		ans++;
        	}
        	else if(p[i-1] > p[i] && p[i] > p[i+1]){
        		ans++;
        	}
        }
        
        out.println(ans);
        
        out.flush();
    }

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public int[] nextintArray(int n){
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public long[] nextlongArray(int n){
		long[] a = new long[n];
		for(int i=0;i<n;i++){
			a[i] = nextLong();
		}
		return a;
	}
	public Integer[] nextIntegerArray(int n){
		Integer[] a = new Integer[n];
		for(int i=0;i<n;i++){
			a[i] = nextInt();
		}
		return a;
	}
	public int[][] nextintMatrix(int h, int w){
		int[][] mat = new int[h][w];
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				mat[i][j] = nextInt();
			}
		}
		return mat;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

using namespace std;

#define ll long long




void solve() {

	int n;
	cin >> n;
	int arr[n];
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	
	sort(arr, arr + n);
	double sum = arr[0];
	for(int i = 1; i < n; i++) {
		sum = (sum + arr[i]) / 2.0;
	}
	cout << sum;
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

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

using namespace std;

int main() {

	string s;

	cin >> s;

	int n = s.size();
	int num = 0;
	for (int i = 0; i < n; ++i) {

		num = num + 1;

	}
	cout << s[0] << num - 2 << s[num-1] << endl;

	}
	

Measured memory_bytes: 256
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let f x = if x % 10 = 0 then x else (x + 10) / 10 * 10

[<EntryPoint>]
let main argv =
    let xs = List.map (fun _ -> read int) [1..5]
    let (ps, qs) = List.partition (fun x -> x % 10 = 0) xs
    if List.isEmpty qs then
        ps
    else
        let r :: rs = List.sortBy (fun x -> x % 10) qs
        r :: ps @ List.map f rs
    |> List.sum
    |> printfn "%i"
    0

Measured memory_bytes: 14940
case = 1
while True:
    w_limit = int(input())
    if not w_limit:
        break
    n = int(input())
    treasures = [tuple(map(int, input().split(','))) for _ in range(n)]

    furoshiki = [0] * (w_limit + 1)
    for v, w in treasures:
        for j in range(w_limit, w - 1, -1):
            furoshiki[j] = max(furoshiki[j], furoshiki[j - w] + v)

    max_v = max_v_w = 0
    for w in range(w_limit + 1):
        if furoshiki[w] > max_v:
            max_v = furoshiki[w]
            max_v_w = w

    print('Case {}:'.format(case))
    print(max_v)
    print(max_v_w)
    case += 1

Measured memory_bytes: 7672
#include<stdio.h>
#include<map>
#include<set>
using namespace std;
map<int,int>mmp;
set<int>SS;
int main()
{
	int N;
	scanf("%d",&N); 
	while(N--)
	{
		int num;
		scanf("%d",&num);
		mmp[num]++;
		SS.insert(num); 
	}
	int sum=0;
	set<int>::iterator it=SS.begin();
	for(;it!=SS.end();it++)
	{
		if(mmp[*it]%2==1)
			sum++;
	 } 
	 printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

void solve() {
        string str; cin >> str;
        deque<char> dq;
        lp(i, str.size()) dq.push_back(str[i]);
        int q; cin >> q;
        bool rev= 0;
        while ( q-- ) {
                int x; cin >> x;
                if (x== 1) rev^= 1;
                else {
                        int a;
                        char c;
                        cin >> a>> c;
                        if (rev== 0)
                                if (a== 1) dq.push_front(c);
                                else dq.push_back(c);
                        else
                                if (a== 2) dq.push_front(c);
                                else dq.push_back(c);
                }
        }
        if (rev) for (int i= dq.size()- 1; i>= 0; i--) cout << dq[i];
        else lp(i, dq.size()) cout << dq[i];
        return;
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


Measured memory_bytes: 976
N = int(input())
X = list(map(int,input().split()))

Y = sorted(X)

a = Y[N//2-1]
b = Y[N//2]

ans = []

for x in X :
    if x <= a :
        ans.append(b)
    else :
        ans.append(a)

print(*ans,sep="\n")

Measured memory_bytes: 25224
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

long long u_find(vector<long long>& roots, long long id) {
	if (roots[id] == id) {
		return id;
	} else {
		return roots[id] = u_find(roots, roots[id]);
	}
}

long long u_union(vector<long long>& roots, vector<long long>& sizes, long long l, long long r) {
	long long l_id = u_find(roots, l);
	long long r_id = u_find(roots, r);
	if (l_id == r_id) {
		return 0;
	}
	if (sizes[l_id] < sizes[r_id]) {
		swap(l_id, r_id);
	}
	roots[r_id] = l_id;
	long long res = sizes[l_id] * sizes[r_id];
	sizes[l_id] += sizes[r_id];
	return res;
}

struct Op {
	long long a;
	long long b;
};

int main (int argc, char* argv[]) {
	long long n, m;
	cin >> n >> m;
	vector<long long> root_sizes(n, 1);
	vector<long long> roots(n);
	for (long long i = 0; i < n; i++) {
		roots[i] = i;
	}

	vector<Op> ops(m);
	for (long long i = 0; i < m; i++) {
		long long a, b;
		cin >> a >> b;
		a--; b--;
		ops[i] = Op { a, b };
	}
	vector<long long> res(m);
	long long rem = (n * (n - 1)) / 2;
	res[m - 1] = rem;
	for (long long i = m - 1; i > 0; i--) {
		rem -= u_union(roots, root_sizes, ops[i].a, ops[i].b);
		res[i - 1] = rem;
	}

	for (long long r : res) {
		cout << r << ' ';
	}
	cout << endl;
}


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

int main()
{
    array<long, 3> Edge; //3辺を入れる配列

    long result = 0;
    bool odd = true;

    cin >> Edge[0] >> Edge[1] >> Edge[2]; //配列に入力

    //配列のサイズ分forして、偶数があったらoddにfalseを入れる。
    for (int i : Edge)
    {
        if (i % 2 == 0)
        {
            odd = false;
        }
    }

    //奇数だったら、小さい順にソートして上から1,2の積を変数に代入
    if (odd)
    {
        // sort(Edge.begin(), Edge.end());
        result = min({Edge[0] * Edge[1], Edge[1] * Edge[2], Edge[2] * Edge[0]});
    }

    //出力。偶数の場合は、宣言する際に0を代入しているのでそのままで良い
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

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

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

	long long total_monsters = 0;
	for (int i = 0; i < n; ++i) {
		int m = min(b[i], a[i]);
		total_monsters += m;
		b[i] -= m;
		a[i] -= m;
		int m_next = min(b[i], a[i + 1]);
		total_monsters += m_next;
		a[i + 1] -= m_next;
	}

	cout << total_monsters << "\n";

	return 0;

}

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

int main(){
    ll A,B;cin>>A>>B;
    const ll tmp = 10*B;
    ll ans=-1;
    REP(i,10){
        if((int)((tmp+i)*0.08)==A) {
            ans=tmp+i;
            goto loopend;
        }
    }
    loopend:
    cout << ans <<endl;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    int maxx = x;
    rep(i, n){
        int a;
        cin >> a;
        if(a > maxx){
            maxx = a;
        }
        if(a >= y){
            cout << "War" << '\n';
            return 0;
        }
    }
    rep(i, m){
        int b;
        cin >> b;
        if(maxx >= b){
            cout << "War" << '\n';
            return 0;
        }
    }

    cout << "No War" << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, begin, end) for(int i=begin;i<end;i++)
#define Rep(i, n) For(i,0,n)
#define Sort(v) sort(v.begin(),v.end())
using namespace std;

int main(){
  
  int R,G;
  cin>>R>>G;
  cout<<2*G-R<<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)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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 int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
template<typename T>
class TwoDimCumsum {
public:
    int H,W;
    vector<vector<T>> d;
    TwoDimCumsum(T _H, T _W):H(_H),W(_W),d(_H+1,vector<T>(_W+1,0)){}
    // 1-indexed
    void add(int x, int y, int a){
        d[x][y] += a;
    }
    void build(){
        for(int i = 1; i <= H; ++i){
            for(int j = 1; j <= W; ++j){
                d[i][j] += d[i-1][j];
                d[i][j] += d[i][j-1];
                d[i][j] -= d[i-1][j-1];
            }
        }
    }
    //[sx, gx] & [sy, gy]
    //1-indexed
    T query(int sx, int sy, int gx, int gy){
        return d[gx][gy] - d[sx-1][gy] - d[gx][sy-1] + d[sx-1][sy-1];
    }
    //confirm the 2d vector
    void debug(){
        for(int i = 0;i <= H;++i){
            for(int j = 0; j <= W; ++j){
                cerr<<d[i][j]<<((j == W) ? "\n":" ");
            }
        }
    }
};

/*
使い方
https://atcoder.jp/contests/abc106/submissions/9873594
1. インスタンス生成 縦横決める
TwoDimCumsum<int> Cumsum(H,W);
2. 座標に埋める
Cumsum.add(x, y, 1)
3. 二次元累積和計算
Cumsum.build()
4. 区間のクエリを受ける
Cumsumq.uery(p, q)
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N, M, Q;
    cin >> N >> M >> Q;
    TwoDimCumsum<ll> Cum(N, N);
    rep(i,M){
        int l, r;
        cin >> l >> r;
        Cum.add(l,r,1);
    }
    Cum.build();
    while(Q --> 0){
        int p, q;
        cin >> p >> q;
        //[p, N] && [0, q]
        cout << Cum.query(p,0,N,q) << endl;
    }
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int count = 0;
		while (scanner.hasNext()) {
			if(count!=0){
				System.out.println();
			}
			int n = scanner.nextInt();
			int[] num = new int[5];
			int[] a = { 10000, 1000, 100, 10, 1 };
			for (int i = 0; i < 5; i++) {
				num[i] = n / a[i];
				n = n % a[i];
			}
			for (int i = 0; i < 5; i++) {
				if (num[i] < 5)
					System.out.print("*");
				else
					System.out.print(" ");
			}
			System.out.println();
			for (int i = 0; i < 5; i++) {
				if (num[i] > 4)
					System.out.print("*");
				else
					System.out.print(" ");
			}
			System.out.println();
			int t = 5;
			while (t-- > 0) {
				System.out.print("=");
			}
			System.out.println();
			for (int i = 0; i < 5; i++) {
				for (int j = 0; j < 5; j++) {
					if (!(num[j] % 5 == i))
						System.out.print("*");
					else
						System.out.print(" ");
				}
				System.out.println();
			}
			count++;
		}
	}
}

Measured memory_bytes: 28192
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>

using namespace std;

int main()
{
    int y, m, d;
    int meiji[3] = {1868, 9, 8};
    int taisho[3] = {1912, 7, 30};
    int showa[3] = {1926, 12, 25};
    int heisei[3] = {1989, 1, 8};
    while(cin >> y >> m >> d)
    {
        if(y < meiji[0] || (y == meiji[0] && m < meiji[1]) || 
          (y == meiji[0] && m == meiji[1] && d < meiji[2]))
            cout << "pre-meiji" << endl;
        else if(y < taisho[0] || (y == taisho[0] && m < taisho[1]) || 
               (y == taisho[0] && m == taisho[1] && d < taisho[2]))
            cout << "meiji " << y-meiji[0]+1 << " " << m << " " << d << endl;
        else if(y < showa[0] || (y == showa[0] && m < showa[1]) || 
               (y == showa[0] && m == showa[1] && d < showa[2]))
            cout << "taisho " << y-taisho[0]+1 << " " << m << " " << d << endl;
        else if(y < heisei[0] || (y == heisei[0] && m < heisei[1]) || 
               (y == heisei[0] && m == heisei[1] && d < heisei[2]))
            cout << "showa " << y-showa[0]+1 << " " << m << " " << d << endl;
        else
            cout << "heisei " << y-heisei[0]+1 << " " << m << " " << d << endl;
    }
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int x){
    if(x==2) return true;
    if(x<2 || x%2==0) return false;
    
    int i=3;
    while(i<=sqrt(x)){
        if(x%i==0) return false;
        i+=2;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    int count=0;
    for(int i=0;i<n;i++) {
        cin >> a[i];
        if(isPrime(a[i])) count++;
    }
    cout << count << endl;
    return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n == 1) cout << "Hello World" << '\n';
    else {
        int a, b;
        cin >> a >> b;
        cout << a + b << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int len=s.size();
    s=" "+s;
    int f=1;
    for(int i=1;i<=len;i++){
        if(i&1 && s[i]=='L'){
            f=0;
            break;
        }
        if((i%2==0) && s[i]=='R'){
            f=0;
            break;
        }
    }
    if(f) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <queue>
int n,m;
int a[100010];
std::priority_queue<int> Q;
int main(){
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		Q.push(a[i]);
	}
	for(int i=0;i<m;i++){
		int t = Q.top();
		Q.pop();
		Q.push(t/2);
	}
	long long ans = 0;
	while(!Q.empty()){
		ans += (long long)Q.top();
		Q.pop();
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1148
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#include <cassert>
#include <chrono>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head
int MAXN = 1000008;
vi gpd(MAXN);
void sieve() {
    for (int i = 2; i < sz(gpd); i++) {
        if (!gpd[i]) {
            for (int j = i; j < sz(gpd); j += i) {
                gpd[j] = i;
            }
        }
    } 
}

void fac(int x, vi& freq) {
    while (x > 1) {
        freq[gpd[x]]++;
        x /= gpd[x];
    }
}

bool check(int x, vi& freq) {
    while (x > 1) {
        int cnt = 0;
        int gp = gpd[x];
        while (x > 1 and x%gp == 0) {
            cnt++;
            x /= gp;
        }
        if (freq[gp] > cnt) {
            return true;
        }
    }
    return false;
}

void solve() {
    int n;
    cin >> n;
    sieve();
    vi a(n);
    for (auto &x: a)
        cin >> x;
    
    int gc = a[0];
    for (int i = 1; i < n; i ++) {
        gc = gcd(gc, a[i]);
    }
    vi freq(MAXN);
    for (auto x : a) {
        fac(x, freq);
    }

    bool pair = true;
    for (auto x : a) {
        if (check(x, freq)) {
            pair = false;
            break;
        }
    }
    if (pair) {
        cout << "pairwise coprime" << "\n";
    } else if (gc == 1) {
        cout << "setwise coprime" << "\n";
    } else {
        cout << "not coprime" << "\n";
    }
}

int main() {
    #ifdef LOCAL
    auto t1 = std::chrono::high_resolution_clock::now();
    #endif

    io;
    solve();

    #ifdef LOCAL
    auto t2 = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();

    std::cout << "Time Taken: " << duration << "\n";
    #endif

}
// check for edge cases in limits
// printing double may print 1.223232e9 like values, beware of that
// carefully observe simulation of test cases
// multiset erase is does not do what it is supposed to

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

const int INF = 1001001001;

int c[10][1005];

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int ans = INF;
    rep(bit,1<<(h-1)){
        int n = 0;
        vector<int> id(h);
        rep(i,h){
            id[i] = n;
            if (bit>>i&1) ++n;
        }
        ++n;
        rep(i,n)rep(j,w) c[i][j] = 0;
        rep(i,h)rep(j,w) c[id[i]][j] += (s[i][j]-'0');
        bool ok = true;
        rep(i,n)rep(j,w) if (c[i][j] > k) ok = false;
        if (!ok) continue;

        int num = n-1;
        if (num >= ans) continue;
        vector<int> now(n);
        auto add = [&](int j){
            rep(i,n) now[i] += c[i][j];
            rep(i,n) if (now[i] > k) return false;
            return true;
        };
        rep(j,w){
            if (!add(j)){
                num++;
                now = vector<int>(n);
                add(j);
            }
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

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

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

string s;
ll res = 0;
int a[30] = {1};

signed main(void){
  int i, j;
  rep1(i, 30)a[i] = a[i - 1] * 2;
  for(int testcase = 0;testcase >= 0;testcase++){
    cin >> s;

    rep(i, a[s.size() - 1]){
      ll tmp = 0;
      int x = i;
      rep(j, s.size() - 1){
        tmp += s[j] - '0';
        if(x & 1){
          res += tmp;
          //pri(tmp);
          tmp = 0;
        }else{
          tmp *= 10;
        }
        x /= 2;
      }
      tmp += s[j] - '0';
      res += tmp;
      //pri(tmp);
    }

    pri(res);



/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static String[] str;
	static int N;
	static boolean[][] g;

	public static void main(String[] args) throws Exception {
		while (true) {
			N = sc.nextInt();
			if (N == 0) break;
			str = new String[N];
			for (int i = 0; i < N; ++i) {
				str[i] = sc.next();
			}
			System.out.println(solve() ? "yes" : "no");
		}
	}

	static boolean solve() {
		g = new boolean[26][26];
		if (!construct(0, N, 0)) {
			return false;
		}
		for (int i = 0; i < 26; ++i) {
			boolean[] visited = new boolean[26];
			if (!dfs(i, visited)) {
				return false;
			}
		}
		return true;
	}

	static boolean dfs(int pos, boolean[] visited) {
		if (visited[pos]) return false;
		visited[pos] = true;
		for (int i = 0; i < 26; ++i) {
			if (g[pos][i]) {
				if (!dfs(i, visited)) {
					return false;
				}
			}
		}
		visited[pos] = false;
		return true;
	}

	static boolean construct(int s, int e, int pos) {
		// System.out.println(s + " " + e + " " + pos);
		if (e - s == 1) return true;
		while (s < e && str[s].length() == pos) {
			++s;
		}
		if (s >= e - 1) return true;
		int prev = s;
		for (int i = s + 1;; ++i) {
			if (i == e) {
				if (!construct(prev, i, pos + 1)) {
					return false;
				}
				break;
			}
			if (str[i].length() == pos) {
				return false;
			}
			if (str[i].charAt(pos) != str[prev].charAt(pos)) {
				g[str[prev].charAt(pos) - 'a'][str[i].charAt(pos) - 'a'] = true;
				// System.out.println(s + " " + e + " " + pos + " " + str[prev].charAt(pos) + " " + str[i].charAt(pos));
				if (!construct(prev, i, pos + 1)) {
					return false;
				}
				prev = i;
			}
		}
		return true;
	}

}

Measured memory_bytes: 41340
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LB lower_bound
#define UB upper_bound
#define EQ equal_range
#define prako ios::sync_with_stdio(0); cin.tie(0);
#define deb(x) cout<<x<<"\n";
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
typedef long long int ll;
typedef pair<int,int> pi;
#define rep(i,a,b) for(ll i=a; i<=b; i++)

void solve(){
	ll n,x,t;cin>>n>>x>>t;
	ll sum=0,ans=0;
	while(sum<n){
		sum+=x;
		ans+=t;
	}    
	cout<<ans<<"\n";
}
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    prako
    solve();
	return 0;
}

Measured memory_bytes: 3540
#include<stdio.h>
#include<string.h>

int main()
{
	char x[15], y[15], z[15];
	int i,j;
	scanf("%s %s", &x, &y);
	getchar();
	scanf("%d %d", &i, &j);
	getchar();
	scanf("%s", &z);
	
	if(strcmp(x, z)==0){
		printf("%d %d", i-1 , j);
	}
	else if(strcmp(y, z)==0){
		printf("%d %d", i, j-1);
	}
	return 0;
}

Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	string st[n];
	for(int i=0;i<n;i++){
		cin>>st[i];
	}
	vector<int> row(n),col(m);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(st[i][j] =='.'){
				row[i]++;
				col[j]++;
			}
		}
	}
	
	for(int i=0;i<n;i++){
		int flag=0;
		for(int j=0;j<m;j++){
			//cout<<row[i]<<col[j]<<endl;
			if(row[i]==m||col[j]==n){
				continue;
			}
			flag = 1;
			cout<<st[i][j];
		}
		if(flag ==1)
			cout<<endl;
	}
	return 0;	
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, '%d', $n);
$A = new \SplFixedArray($n);
$check = array();
for ($i = 0; $i < $n; $i++) {
    $line = trim(fgets(STDIN));
    $suit = $line[0];
    $m = (int)substr($line, 2);
    $A[$i] = array($suit, $m);

    //初期化
    if (!isset($check[$m])) {
        $check[$m] = array();
    }
    //値に対し絵柄が現れた順に代入
    $check[$m][] = $suit;
}

quickSort($A, 0, $n - 1);
$bool = true;
$arr = array();
foreach ($A as $a) {
    $arr[] = implode(' ', $a);
    if ($bool) {
        //入力で与えられた順序かチェック
        $bool = $a[0] === array_shift($check[$a[1]]);
    }
}

echo $bool ? 'Stable' : 'Not stable', PHP_EOL, implode(PHP_EOL, $arr), PHP_EOL;

function quickSort($A, $p, $r)
{
    global $A;
    if ($p < $r) {
        $q = partition($A, $p, $r);
        quickSort($A, $p, $q - 1);
        quickSort($A, $q + 1, $r);
    }
}

function partition($A, $p, $r)
{
    global $A;
    $x = $A[$r][1];
    $i = $p - 1;
    for ($j = $p; $j < $r; $j++) {
        if ($A[$j][1] <= $x) {
            $i++;
            $tmp = $A[$i];
            $A[$i] = $A[$j];
            $A[$j] = $tmp;
        }
    }

    $i++;
    $tmp = $A[$i];
    $A[$i] = $A[$r];
    $A[$r] = $tmp;

    return $i;
}

Measured memory_bytes: 99640
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

struct Point { double x, y; };
typedef Point Vector;
#define EPS (1e-10)
double dot(Vector a, Vector b) {
	return a.x * b.x + a.y * b.y;
}
int main()
{
	int q;
	Point p[3];
	Vector v1, v2;
	double dotv;
	double v1len;
	Point ans, ans2;

	cin >> p[1].x >> p[1].y >> p[2].x >> p[2].y;
	cin >> q;

	v1.x = p[2].x - p[1].x;
	v1.y = p[2].y - p[1].y;
	v1len = sqrt(v1.x * v1.x + v1.y * v1.y);

	rep(i, q) {
		cin >> p[0].x >> p[0].y;

		v2.x = p[0].x - p[1].x;
		v2.y = p[0].y - p[1].y;

		dotv = dot(v1, v2);

		ans.x = p[1].x + v1.x * dotv / v1len / v1len;
		ans.y = p[1].y + v1.y * dotv / v1len / v1len;

		ans2.x = p[0].x + (ans.x - p[0].x) * 2;
		ans2.y = p[0].y + (ans.y - p[0].y) * 2;

		printf("%.10lf %.10lf\n", ans2.x, ans2.y);
	}

	return 0;
}


Measured memory_bytes: 3280
M = 10 ** 6
d = [0] * (M+1)

for a in range(1, M+1):
    for b in range(a, M+1):
        n = a * b
        if n > M:
            break
        d[n] += 2 - (a==b)


N = int(input())
ans = 0
for c in range(1, N):
    ans += d[N - c]

print(ans)

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

int main() {
  string x,y ; 
  cin>>x>>y ; 
  
  int m = x.size() ; 
  int n = y.size() ; 

  int t[m+1][n+1] ; 
  memset(t, 0, sizeof(t)) ; 

  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      if(x[i-1] == y[j-1]){
        t[i][j] = 1 + t[i-1][j-1] ;  
      }else{
        t[i][j] = max(t[i-1][j], t[i][j-1]) ; 
      }
    }
  }

  int i = m, j=n ; 
  string s ; 

  while(i>0 && j>0){
    if(x[i-1] == y[j-1]){
        s.push_back(x[i-1]) ; 
        i-- ; 
        j-- ; 
    }else{
      if(t[i][j-1]> t[i-1][j]){
        j-- ; 
      }else{
        i-- ; 
      }
    }
  }

  reverse(s.begin(), s.end() ) ;  

  cout<<s ; 

}

Measured memory_bytes: 35456