akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int R;
  cin>>R;
  cout<<3*R*R<<endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t a,b,c; char u; cin>>a>>b>>u>>c;
	b*=100; b+=c;
	cout<<a*b/100<<"\n"s; 
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <unordered_map> 
#include <iomanip>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
//#define int long long


//booooooooooooost
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)



int inv_mod(int a, int m)
{
	int b, x, u, q, tmp;

	b = m; x = 1; u = 0;
	while (b > 0) {
		q = a / b;
		tmp = u; u = x - q * u; x = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}

	return (x < 0) ? m + x : x;
}



LL N, A;
vector<LL> x;
LL dp[51][51][3000];

signed main() {
 
	
	cin >> N >> A;
	REP(i, N) {
		int tmp;
		cin >> tmp;
		x.PSB(tmp);
	}
 
	dp[0][0][0] = 1;
	LL sum = 0;
	REP(i, x.size()) sum += x[i];
	REP(j, N) {
		REP(k, N + 1) {
			REP(l, sum + 1) {
				if(l < x[j]) dp[j + 1][k][l] = dp[j][k][l];
				else if(k >= 1) dp[j + 1][k][l] = dp[j][k][l] + dp[j][k - 1][l - x[j]];
			}
		}
	}

	LL ans = 0;
	for (LL k = 1; k <= N; ++k) ans += dp[N][k][A * k];
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 59008
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cassert>
#include<vector>
#define ll long long
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
int a[800010],lazy[800010];
void update(int num){
	a[num]=max(a[num<<1],a[num<<1|1]);
}
void push(int l,int r,int num){
	if(l==r||!lazy[num]) return;
	a[num<<1]+=lazy[num];lazy[num<<1]+=lazy[num];
	a[num<<1|1]+=lazy[num];lazy[num<<1|1]+=lazy[num];
	lazy[num]=0;
}
void build(int l,int r,int num){
	if(l==r){
		a[num]=l;return;
	}
	int mid=(l+r)>>1;
	build(l,mid,num<<1);build(mid+1,r,num<<1|1);
	update(num);
}
void change(int l,int r,int ql,int qr,int num,int val){
	push(l,r,num);
	if(l>=ql&&r<=qr){
		a[num]+=val;lazy[num]+=val;return;
	} 
	int mid=(l+r)>>1;
	if(mid>=ql) change(l,mid,ql,qr,num<<1,val);
	if(mid<qr) change(mid+1,r,ql,qr,num<<1|1,val);
	update(num);
}
int query(int l,int r,int ql,int qr,int num){
	push(l,r,num);
	if(l>=ql&&r<=qr) return a[num];
	int mid=(l+r)>>1,re=0;
	if(mid>=ql) re=max(re,query(l,mid,ql,qr,num<<1));
	if(mid<qr) re=max(re,query(mid+1,r,ql,qr,num<<1|1));
	return re;
}
int n,m;
vector<int>q[200010];
int main(){
	n=read();m=read();int i,j,t1,t2;
	for(i=1;i<=n;i++){
		t1=read();t2=read();
		q[t1].push_back(t2);
	}
	build(1,m+1,1);
	int ans=1e9;
	for(i=0;i<=m;i++){
		for(j=0;j<q[i].size();j++) change(1,m+1,1,q[i][j],1,1);
		ans=min(ans,i+m+1-query(1,m+1,i+1,m+1,1));
	}
	ans+=n;ans=min(ans,min(n,m));
	printf("%d\n",n-ans);
}

Measured memory_bytes: 14080
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
	int n;

	scanf("%d", &n);
	vector<vector<int> > v(3, vector<int>(n, 0));
	for(int i = 0; i < n; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		v[0][i] = x;
		v[1][i] = y;
		v[2][i] = z;
	}

	vector<int> old_dp(3);
	old_dp[0] = v[0][0];
	old_dp[1] = v[1][0];
	old_dp[2] = v[2][0];

	for(int i = 1; i < n; i++) {
		vector<int> dp(3, 0);
		for(int z = 0; z < 3; z++) {
			for(int j = 0; j < 3; j++) {
				if(z != j) {
					dp[z] = max(dp[z], old_dp[j] + v[z][i]);
				}
			}
		}
		old_dp = dp;
	}

	int res = max(old_dp[0], old_dp[1]);
	res = max(res, old_dp[2]);
	cout << res << '\n';
	return 0;
}


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

int main(){
	
	int a,b;
	cin >> a >> b;
	int c=abs(b+a);
	
	if(c%2==0){
		cout << c/2 << endl;
	}
	else{
		cout << "IMPOSSIBLE" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}

//check modulo
int main(){
	IOS;
	cout.precision(30) ;
	int n ; cin >> n; 
	vll a(n);for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	vll x(n) ;
	ll sum = 0 ;
	for(int i = 0 ; i < n ; i++){
		if(i % 2 == 0) sum += 2 * a[i] ;
		else sum -= 2 * a[i] ;
	}
	x[0] = sum / 2 ;
	for(int i = 1 ; i < n ; i++){
		x[i] = 2 * a[i - 1] - x[i - 1] ;
	}
	for(int i = 0 ; i < n ; i++) cout << x[i] <<" " ;
	cout << endl ;
	return 0;
}


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

int main() {
    
    ll n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    bool can = true;
    while (true) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 1 || a[i] == 0) {
                can = false;
                break;
            }
            else {
                a[i] /= 2;
            }
        }
        if (!can) break;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 87;
vector<pii> V;
int A[MAXN], B[MAXN];
bool flip[MAXN];
deque<int> opos[MAXN], epos[MAXN];

int get(deque<int> &V1) {
    int ans = 0;
    int N = (int)V1.size();
    for (int i = 0; i < N; i++) {
        int cur = 0;
        while (V1[cur] != i)
            cur++;
        ans += cur;
        for (int j = cur; j > 0; j--)
            swap(V1[j], V1[j - 1]);
        V1.pop_front();
    }
    return ans;
}

int solve() {
    vector<int> nV;
    int N = (int)V.size();
    for (int i = 0; i <= 50; i++) {
        opos[i].clear();
        epos[i].clear();
    }
    for (int i = 0; i < N; i++) {
        int tmp = V[i].first;
        if (flip[i]) tmp = V[i].second;
        nV.push_back(tmp);
    }
    sort(nV.begin(), nV.end());
    for (int i = 0; i < N; i++) {
        int cur = nV[i];
        if (i % 2) opos[cur].push_back(i);
        else epos[cur].push_back(i);
    }
    deque<int> idx;
    for (int i = 0; i < N; i++) {
        int take = (i % 2) ^ flip[i];
        int cur = V[i].first;
        if (flip[i]) cur = V[i].second;
        if (take) {
            if (opos[cur].empty()) return -1;
            idx.push_back(opos[cur].front());
            opos[cur].pop_front();
        } else {
            if (epos[cur].empty()) return -1;
            idx.push_back(epos[cur].front());
            epos[cur].pop_front();
        }
    }
    return get(idx);
}

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
        scanf("%d", &A[i]);
    for (int i = 0; i < N; i++)
        scanf("%d", &B[i]);
    for (int i = 0; i < N; i++)
        V.push_back(make_pair(A[i], B[i]));

    int ans = -1;
    for (int S = 0; S < (1 << N); S++) {
        memset(flip, 0, sizeof(flip));
        for (int j = 0; j < N; j++)
            if ((1 << j) & S)
               flip[j] = 1;
        int cur_ans = solve();
        //printf("cur_ans = %d\n\n", cur_ans);
        if (cur_ans == -1) continue;
        else if (ans == -1) ans = cur_ans;
        else ans = min(ans, cur_ans);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <functional>

using namespace std;


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

    int N,A,B;
    scanf("%d %d %d",&N,&A,&B);

    int sum=0;

    for(int i=1;i<=N;i++){
        int tmpSum=0;
        int value=i;
        while(value!=0){
            tmpSum+=value%10;
            value/=10;
        }
        if((A<=tmpSum)&&(tmpSum<=B)){
            sum+=i;
        }
    }

    printf("%d\n",sum);

    return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;

struct Graph {
  vector<vector<p>> cost;
  vector<bool> visited;
  vector<int> min_cost;
  int node_num, edge_num;

  Graph(int nn, int en) : node_num(nn), edge_num(en){
    min_cost = vector<int> (node_num, INT_MAX);
    cost = vector<vector<p>> (node_num, vector<p>());
  }


  void dijkstra(int start){
    priority_queue<p, vector<p>, greater<p>> pq;
    pq.push({0, start});
    min_cost[start] = 0;

    while(!pq.empty()) {
      int now_cost = pq.top().first;
      int now = pq.top().second;
      pq.pop();
      if(min_cost[now] < now_cost) continue;

      for(auto e : cost[now]){
        if(min_cost[e.first] > now_cost + e.second){
          min_cost[e.first] = now_cost + e.second;
          pq.push({min_cost[e.first], e.first});
        }
      }
    }
  }
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int node_num, edge_num, r;
  cin >> node_num >> edge_num >> r;
  // r--;

  Graph g(node_num, edge_num);

  for (int i = 0; i < edge_num; i++) {
    int from, to, weight;
    cin >> from >> to >> weight;
    // from--;
    // to--;
    g.cost[from].push_back({to, weight});
    // g.cost[to].push_back({from, weight});
  }
  // cout << g.node_num << endl;
  g.dijkstra(r);
  for (int i = 0; i < node_num; i++) {
    if(g.min_cost[i] == INT_MAX) cout << "INF" << endl;
    else cout << g.min_cost[i] << endl;
  }
}



Measured memory_bytes: 13052
#include<bits/stdc++.h>
#include<vector>
using namespace std;
typedef long long ll; 
int main(void)
{
	ll n,r;
	scanf("%lld%lld",&n,&r);
	if(10-n<0)
	{
		printf("%lld",r);
	}
	else
	{
		printf("%lld",r+100*(10-n));
	}
}

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

std::vector<int> b,res;

int n,t;

int main(){

    std::cin>>n;

    for(int i=0;i<n;i++){
    std::cin>>t;
    b.push_back(t);
    }

    t=n;
    bool flag;

    for(int j=0;j<n;j++){
        flag=false;
    for(int i=0;i<t;i++){
        if(i+1<b[i]){
            std::cout<<-1<<std::endl;
            return 0;
            }
        if(i+1==b[i]){
            if(i+1==t){
            res.insert(res.begin(),b[i]);
            b.erase(b.begin() + i);
            flag=true;
            goto fl;
        }
        else
        if(i!=t-1){
            bool ff=false;
            for(int k=i+1;k<t;k++){
            if(k+1<=b[k])ff=true;
        }
            if(ff!=true){
            res.insert(res.begin(),b[i]);
            b.erase(b.begin() + i);
            flag=true;
            goto fl;
            }
        }
        }
    }
    fl:;
    if(flag==false){
        std::cout<<-1<<std::endl;
        return 0;
    }
    t--;
    }

    for(auto&& x:res)
    std::cout<<x<<std::endl;

    return 0;
}

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

int main(){
	
    int n,d;
    cin >> n >> d;
    vector<vector<float> > A(n, vector<float>(d));
    bool ok = false;

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

    float count = 0;
    float tmp = 0;
    //double unchi = 1;
    int ans=0;


    for(int i = 0; i < n-1; i++){
        for (int j = i+1; j < n; j++){
            for(int k = 0; k < d; k++){
                count+=(A[i][k]-A[j][k])*(A[i][k]-A[j][k]);
            }
        tmp=sqrt(count);
        if(fmod(tmp,1)==0){
            ans++;
        }
        count = 0;
        }
    }

    cout << ans <<endl;
    
}
		




Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, long long K){
    if(K % 2){ //* K is odd
        ll c = N/K;
        cout << c*c*c<< endl;
    }
    else{   //* K is even
        ll c = (N-K/2)/K+1;
        if(N < K/2) c=0;
        cout << (N/K) * (N/K) * (N/K) + c*c*c << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var v1 = int.Parse(s.Substring(0, 2));
            var v2 = int.Parse(s.Substring(2, 2));
            var v1CanBeMM = 1 <= v1 && v1 <= 12;
            var v2CanBeMM = 1 <= v2 && v2 <= 12;

            if (v1CanBeMM && v2CanBeMM)
            {
                Console.WriteLine("AMBIGUOUS");
            }
            else if (v1CanBeMM)
            {
                Console.WriteLine("MMYY");
            }
            else if (v2CanBeMM)
            {
                Console.WriteLine("YYMM");
            }
            else
            {
                Console.WriteLine("NA");
            }
        }
    }
}


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

int main() {
	string S;
	cin >> S;
	if (S.at(S.size()-1) == 's') std::cout << S << "es" << '\n';
	else std::cout << S << "s" << '\n';
}


Measured memory_bytes: 3624
#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 fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long 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())
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrepn(i, n) for (int i = ((int)(n)); i > 0; --i)
#define SZ(x) ((int)(x).size())
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
vector<pair<string, P>> vec;
// vector<vector<int>> data(3, vector<int>(4));

int main() {
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];

    vector<int> t(D);
    rep(i, D) {
        cin >> t[i];
        t[i]--;
    }
    vector<int> last(26);
    int score = 0;
    rep(i, D) {
        score += s[i][t[i]];
        last[t[i]] = i + 1;
        int m = 0;
        rep(j, 26) m += c[j] * (i + 1 - last[j]);
        score -= m;
        cout << score << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
import java.io.*;

public class Main {
    public static void main(String[] a) throws NumberFormatException, IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int[] intArrayLef = new int[200];
        int[] intArrayRig = new int[200];

        String line;
        int num = 0;
        // データ読み込み
        while ((line = in.readLine()) != null && num < 200) {
            intArrayLef[num] = Integer.parseInt(line.split(" ")[0]);
            intArrayRig[num] = Integer.parseInt(line.split(" ")[1]);
            num++;
        }

        for (int i = 0; i < num; i++) {
            String res = String.valueOf(intArrayLef[i] + intArrayRig[i]);
            System.out.println(res.length());
        }
    }
}

Measured memory_bytes: 17084
using System;
using System.Linq;

namespace ConsoleApp6
{
    class Program
    {
        static void Main()
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var c = int.Parse(Console.ReadLine());
            var x = int.Parse(Console.ReadLine());
            var p = from s in Enumerable.Range(0, a + 1).Select(y => y * 500)
                    from t in Enumerable.Range(0, b + 1).Select(y => y * 100)
                    from u in Enumerable.Range(0, c + 1).Select(y => y * 50)
                    where s + t + u == x
                    select x;

            Console.WriteLine(p.Count());
        }
    }
}


Measured memory_bytes: 13524
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	LL Q,H,S,D;
	cin >> Q >> H >> S >> D;
	LL N;
	cin >> N;
	vector<LL> one,two;
	one.push_back(Q*4);
	one.push_back(H*2);
	one.push_back(S);
	two.push_back(Q*8);
	two.push_back(H*4);
	two.push_back(S*2);
	two.push_back(D);
	LL minOne = LINF;
	LL minTwo = LINF;
	minOne = *min_element(one.begin(),one.end());
	minTwo = *min_element(two.begin(),two.end());
	LL ans = minTwo*(N/2) + minOne * (N&1);
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
    public static void main(String[] args){
        boolean[][] t = new boolean[24][60];
        Scanner sc = new Scanner(System.in);
         
        for (int t1 = 0; t1 < 2; t1++){
            int n = sc.nextInt();
             
            for (int i = 0; i < n; i++){
                int h = sc.nextInt();
                int m = sc.nextInt();
                t[h][m] = true;
            }
        }
         
        boolean z = false;
        for (int h = 0; h < 24; h++){
            for (int m = 0; m < 60; m++){
                if (t[h][m]){
                    if (z){
                        System.out.print(" ");
                    }
                    else {
                        z = true;
                    }
                    System.out.printf("%d:%02d", h, m);
                }
            }
        }
         
        System.out.println("");
    }
}

Measured memory_bytes: 20948
s = str(input())
n = len(s)

s_inv = s[::-1]

t = s[0:(n-1)//2]
t_inv = t[::-1]

u = s[(n+3) // 2 - 1:]
u_inv = u[::-1]

if s==s_inv and t == t_inv and u == u_inv:
    print('Yes')
else:
    print("No")

Measured memory_bytes: 3060
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<string> A;


  return (A[0] >= 'A' && A[0] <= 'Z' ? "A" : "a");
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    int a, b, c, x;
    std::cin >> a >> b >> c >> x;

    int count = 0;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (500 * i + 100 * j + 50 * k == x) {
                    count++;
                }
            }
        }
    }

    std::cout << count << std::endl;
}


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


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		String os = in.next(), es = in.next();
		StringBuilder sb = new StringBuilder();
		int olen = os.length(), elen = es.length();
		int i = 0, j = 0;
		
		while (i < olen) {
			sb.append(os.charAt(i));
			if (j < elen)
				sb.append(es.charAt(j));
			++i;
			++j;
		}
		
		out.println(sb.toString());
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
}


Measured memory_bytes: 21332
<?php
fscanf(STDIN, "%d", $d);
fscanf(STDIN, "%s", $s);

$insert = function ($s, $num) {
    return substr_replace($s, ',', $num, 0);
};
$max = 0;
$str = '';
for ($i = 1; $i <= $d; ++$i) {
    $str = $insert($s, $i);
    list($a, $b) = explode(',', $str);
    $same = array_intersect(str_split($a), str_split($b));
    $res = count(array_unique($same));
    $max = max($res, $max);
};

echo $max;

Measured memory_bytes: 5112
#include<stdio.h>
#include<string.h>
int main()
{
    int i,j;
    char str[11];

    for(i=0;i<11;i++)
    {

        scanf("%c",&str[i]);
    }

    printf("%c%c%c",str[0],str[5],str[10]);

return 0;
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
/* テンプレートここまで */

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

int main() {
  int N, W;
  cin >> N >> W;

  vector<int> v(N+1, 0), w(N+1, 0);

  FOR(i, 1, N+1){
    cin >> w[i] >> v[i];
  }

  vector<vector<ll>> dp(N+1, vector<ll>(W+1,0));

  FOR(i, 0, N){
    REP(j, W+1){
      if(j+w[i+1] <= W ) chmax(dp[i+1][j+w[i+1]], dp[i][j] + v[i+1]);
      chmax(dp[i+1][j], dp[i][j]);
    }
  }

  ll ans = 0;
  REP(i, W+1){
    chmax(ans, dp[N][i]);
  }

  cout << ans << endl;

}


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

#define INF 1e9

typedef vector <int> vi;

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

    int v[n][3];
    for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			scanf("%d", &v[i][j]);
		}
	}

    int dp[n][3];
	memset(dp, 0, sizeof(dp));

	for (int j = 0; j < 3; j++) dp[0][j] = v[0][j];

    for (int i = 1; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			dp[i][j] = v[i][j] + max(dp[i-1][(j+1)%3], dp[i-1][(j+2)%3]);
		}
    }

	int res = 0;
	for (int j = 0; j < 3; j++) res = max(res, dp[n-1][j]);

	// for (int i = 0; i < n; i++) {
	// 	for (int j = 0; j < 3; j++) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

    cout << res << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
typedef long long ll;
typedef long double ld;


#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
ll S[1000] = { 0 };
ll N,M,Q;


int main() {
	vector<ll>A;
	cin >> N;
	rep(i, N) {
		ll a;
		cin >> a;
		A.push_back(a);
	}
	vector<ll>B;
	cin >> M;
	rep(i, M) {
		ll b;
		cin >> b;
		B.push_back(b);
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.begin());
	vector<ll>C;
	set_intersection(A.begin(),A.end(),B.begin(),B.end(),back_inserter(C));
	for (int i = 0; i <C.size();++i) {
		cout << C[i] << endl;
	}
	return 0;
}


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

using namespace std;
const long long mod = 1e9 + 7;

int main(void){
    long long n, k;
    cin >> n >> k;
    
    long long ans = 0;
    
    for (long long x = k; x <= n+1; x++){
        
        long long A = x * (x-1) / 2;
        long long B = x * (2*n - x + 1) / 2;
        
        long long temp = (B - A + 1);
        ans += temp;
        ans %= mod;
    }
    
    cout << ans << endl;
}

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

int main(){
	int n;
	long a[3];
	
	scanf(" %d", &n);
	for(int i=0; i<n; ++i) scanf(" %ld",  &a[i]);
	sort(a, a+n);
	
	for(long i=1; i<=a[0]; ++i){
		bool flag=true;
		
		for(int j=0; j<n;++j){
			if(a[j] % i != 0) {
				flag=false;
				break;
			}
		}	
		
		if(flag) printf("%ld\n", i);
	}
	
	return 0;
}

Measured memory_bytes: 1204
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<assert.h>
#include<deque>
#include<algorithm>

using namespace std;

char sl[100010];
int n;

int check(int k) {
  if (k > n) {
    for (int i = 0; i < n; i++) {
      if (sl[i] == '1') {
        return 0;
      }
    }
    return 1;
  }

  int b = k - 1;
  int a = n - (k - 1);
  if(a > b) {
    return 1;
  }
  int flag = 0;
  for (int i = 0; i < a; i++) {
    if (flag == 0 && sl[i] == '1') {
      flag = 1;
    } else if (flag == 1 && sl[i] == '0') {
      flag = 0;
    }
  }
  for (int i = a; i <= b; i++) {
    if ((sl[i] == '1') != flag) {
      return 0;
    }
  }
  return 1;

  /*
  deque<int> q;
  for (int i = 0; i <= n - k; i++) {
    bool inv = false;
    if (q.size() % 2 == 1) {
      inv = true;
    }
    if ((sl[i] == t) ^ inv) {
      q.push_back(i);
    }
  }
  for (int i = n - k + 1; i < n; i++) {
    bool inv = false;
    if (q.size() % 2 == 1) {
      inv = true;
    }
    if ((sl[i] == t) ^ inv) {
      if (q.size() == 0) {
        return 0;
      }
      if (i - q.front() < k) {
        return 0;
      }
      q.pop_front();
    }
  }
  return 1;
  */
}

int ans;
void ru(int l, int r) {
  if (l > r) {
    return;
  }
  int mid = (l + r) / 2;
  if (check(mid)) {
    ans = mid;
    ru(mid + 1, r);
  } else {
    ru(l, mid - 1);
  }
}

int main() {
  scanf("%s", sl);
  n = strlen(sl);
  ans = -1;
  ru(1, n);
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;

int main()
{
    int n, k; cin >> n >> k;
    vector<int> s(n, 0);

    for (int i = 0; i < k; ++i) {
        int d; cin >> d;
        for (int j = 0; j < d; ++j) {
            int tmp; cin >> tmp;
            --tmp;
            ++s[tmp];
        }
    }

    cout << count(s.begin(), s.end(), 0) << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <queue>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#define INF 1000000000000
using namespace std;
using ll = long long;
int main(){
    ll n,m;
    cin >> n >> m;
    vector<pair<ll,ll>> p(m);
    bool val[200010] ={};
    bool ans = false;
    for(ll i=0;i<m;i++){
        ll x,y;
        cin >> x >> y;
        p[i]=make_pair(x,y);
        if(x==1){
            val[y]=true;
        }else if(y==1){
            val[x]=true;
        }
    }
    for(ll i=0;i<m;i++){
        if(val[p[i].first]==true){
            if(p[i].second==n){
                ans = true;
            }
        }else if(val[p[i].second]==true){
            if(p[i].first==n){
                ans = true;
            }
        }
    }
    if(ans == true){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 3584
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <queue>
# include <stack>
# include <map>
# include <math.h>
# include <algorithm>
using namespace std;
# define MAXN 55
# define MAXM 100005
# define INF 1000000000
# define MIN(a,b) (a)>(b)?(b):(a)
# define MAX(a,b) (a)<(b)?(b):(a)
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
typedef long long LL;
int _MAX(int a, int b){return a>b?a:b;}
int _MIN(int a, int b){return a>b?b:a;}

int a[20005], b[20005], c[20005];

int main()
{
    int n;
    scanf("%d",&n);
    FO(i,0,n) scanf("%d",a+i);
    FO(i,0,n) b[i]=1+i*n, c[n-i-1]=b[i];
    FO(i,0,n) {
        c[a[i]-1]+=i;
    }
    FO(i,0,n) printf(i==0?"%d":" %d",b[i]);
    putchar('\n');
    FO(i,0,n) printf(i==0?"%d":" %d",c[i]);
    putchar('\n');
}


Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while (x->left != NIL) {
    x = x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while (x->right != NIL) {
    x = x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}


void insert(int k){
  Node y = NIL; //xの親
  Node x = root; //root
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL) {
    y = x;
    if (z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if (y == NIL) root = z; // T empty
  else if (z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if (u != NIL) {
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }
}

void preorder(Node u){
  if (u != NIL) {
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25168
N = int(input())
A = list(map(int, input().split()))
ind2clus = {}
clus2ind = {}
for i in range(N):
    if A[i] not in clus2ind:
        clus2ind[A[i]]=[]
    clus2ind[A[i]].append(i)
    ind2clus[i] = A[i]
ma = 0
for one in clus2ind:
    num = len(clus2ind[one])
    ma+=num*(num-1)//2
    
    
for i in range(N):
    num = len(clus2ind[ind2clus[i]])
    print(ma-num*(num-1)//2+(num-1)*(num-2)//2)
         

Measured memory_bytes: 121928
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int k = int.Parse(Console.ReadLine());

        string[] strarray = Console.ReadLine().Split(' ');
        int[] array = new int[strarray.Length];

        int start = -1;
        int end = -1;

        for (int t = 0; t < strarray.Length; t++)
        {
            array[t] = int.Parse(strarray[t]);
        }

        for (int t = 0; t < strarray.Length; t++)
        {
            array[t] = int.Parse(strarray[t]);
            if (t != strarray.Length -1 && array[t]> array[t + 1])
            {
                start = t;
                break;
            }
        }

        for (int t = 0; t < strarray.Length; t++)
        {
            if (t != strarray.Length - 1 && array[strarray.Length - 1 - t] < array[strarray.Length - 2 - t])
            {
                end = strarray.Length - 1 - t;
                break;
            }
        }

        if (start == -1)
        {
            Console.WriteLine("YES");
            return;
        }



        int tmp = array[start];
        array[start] = array[end];
        array[end] = tmp;

        for (int t = 0; t < strarray.Length; t++)
        {
            if (t != strarray.Length - 1 && array[t] > array[t + 1])
            {
                Console.WriteLine("NO");
                return;
            }
        }

        Console.WriteLine("YES");
        return;


    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
  long long n,mul=1;
  cin>>n;
  vector<long long> a(n);
  for(int i=0;i<n;++i) {
    cin>>a[i];
    if (a[i]==0) {
      cout<<0<<endl;
      return 0;
    }
  }
  for(int i=0;i<n;++i) {
    if(a[i]>1000000000000000000LL/mul) {
      cout<<-1<<endl;
      return 0;
    }
    mul*=a[i];
  }
  cout<<mul<<endl;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
#define MSG(a) cout << #a << " " << a << "\n";


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

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll unsigned long long int
#define pp long long int
#define pb push_back
#define mp make_pair
#define eb emplace_back

int binaryExponentiation(int x,int n)//function to calculate x raise to power n
{
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int n,m;
   cin>>n>>m;
   double a[n];
   double sum=0;
   for(int i=0;i<n;i++)
   {
   	  cin>>a[i];
   	  sum+=a[i];
   }
   double x=sum/(4*m);
   ll cnt=0;
   for(int i=0;i<n;i++)
   {
   	if(a[i]>=x)
   	{
   		cnt++;
	   }
   }
   if(cnt>=m)
   {
   	cout<<"Yes"<<endl;
   }
   else
   {
   	cout<<"No"<<endl;
   }
  return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;

namespace Algo
{
    class Program
    {
        static void Main()
        {
            var n = long.Parse(Console.ReadLine()!);
            var a = Console.ReadLine()?.Split().Select(long.Parse).ToArray();
            var current = 1000L;
            for (var i = 0; i < n-1; i++)
            {
                if (a[i] < a[i + 1])
                {
                    current += (a[i + 1] - a[i]) * (current / a[i]);
                }
            }
            Console.WriteLine(current);
        }
    }
}


Measured memory_bytes: 28152
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	vector<LL> a(n);

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

		sum += a[i];
	}

	LL sunuke = 0;
	LL arai = 0;


	LL ans = INF2;
	for (int i = 0; i < n-1; i++) {
		sunuke += a[i];
		arai = sum - sunuke;

		ans = min(ans, abs(sunuke - arai));
	}
	
	cout << ans << endl;

}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int bit = 0;
		for (int i = 0; i < n; i++) {
			bit |= Integer.parseInt(sc.next());
		}

		System.out.println(Integer.numberOfTrailingZeros(bit));
	}

}

Measured memory_bytes: 35536
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



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

  ll x;
  cin >> x;

  ll res = 100, ans = 0;
  while (res < x) {
    ans++;
    res = floor(res * 1.01);
  }
  cout << ans << '\n';




  
  return 0;
}

Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli temp1,temp2,t,x,y,b,temp,a,q,d,p,mx,n,k;
    cin>>n;
    cout<<n+(n*n)+(n*n*n)<<endl;
}

	

Measured memory_bytes: 3648
def solve():
  N = int(input())
  ans = [0]*N
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        left = x*x+y*y+z*z+x*y+y*z+z*x
        if left<=N:
          ans[left-1] += 1
  return ans
print(*solve(),sep='\n')

Measured memory_bytes: 9332
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func abs(x int) int {
	if x < 0 {
		return -1 * x
	} else {
		return x
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 10000000000)

	nString := nextString()

	sum := 0
	for _, v := range nString {
		if v == '0' {
			sum += 0
		} else if v == '1' {
			sum += 1
		} else if v == '2' {
			sum += 2
		} else if v == '3' {
			sum += 3
		} else if v == '4' {
			sum += 4
		} else if v == '5' {
			sum += 5
		} else if v == '6' {
			sum += 6
		} else if v == '7' {
			sum += 7
		} else if v == '8' {
			sum += 8
		} else if v == '9' {
			sum += 9
		}
	}
	if sum%9 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 2480
N = int(input())
A = list(map(int, input().split())) 
import fractions


#累積GCD
L = [0]*(N+2)
R = [0]*(N+2)
for i in range(N):
    L[i+1] = fractions.gcd(L[i],A[i])
    R[i+1] = fractions.gcd(R[i],A[N-i-1])

M = []

# print(L,R)

for i in range(N):
    ans = fractions.gcd(L[i],R[N-i-1])
    M.append(ans)

print(max(M))

    
    



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

using namespace std;

typedef long long ll;

ll x;
ll ans = 0;
int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> x;

    while (x >= 500){
        x -= 500;
        ans += 1000; 
    }
 
    while (x >= 5){
        x -= 5;
        ans+= 5;
    }

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

Measured memory_bytes: 3604
N = gets.to_i
a = gets.split.map(&:to_i)
ans = []

max = a.max
min = a.min
if max.abs > min.abs
  b = max
  reverse = false
else
  b = min
  reverse = true
end
index = a.index(b)
N.times do |i|
  ans << [i+1, index+1]
end
arr = (1..N).to_a
arr = arr.reverse if reverse
arr.each_cons(2) do |i,j|
  ans << [j,i]
end

p ans.size
ans.each do |i,j|
  puts "#{j} #{i}"
end


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, l; cin >> n >> l;
    ll a[n+1];
    for(int i=1;i<=n;i++) cin >> a[i];

    bool pos = false;
    int idx = 1;
    while(idx < n){
        if(a[idx] + a[idx+1] >= l){
            pos = true;
            break;
        }
        idx++;
    }
    if(!pos){
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    for(int i=1;i<=idx-1;i++) cout << i << endl;
    for(int i=n-1;i>=idx;i--) cout << i << endl;
}

Measured memory_bytes: 1664