akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const ll mod = 1e9+7;

ll H,W,A,B;
ll fac[202020];

ll mod_pow(ll x, ll n){
    // x^n % mod : O(logn)
    if(n == 0) return 1;
    ll res = mod_pow(x * x % mod, n/2);
    if(n & 1) res = res * x % mod;
    return res;
}

ll mod_comb(ll n, ll k){
    // requires fac[maxn](s.t. fac[i] = i! % mod)
    if(n < k) return 0;
    ll top = fac[n];
    ll bot = (fac[k]*fac[n-k]) % mod;
    return (top*mod_pow(bot, mod-2)) % mod;
}

int main()
{
    cin >> H >> W >> A >> B;

    fac[0] = 1;
    rrep(i, H+W-1) fac[i] = (i*fac[i-1]) % mod;

    ll ans;
    ll memo[101010] = {};
    rep(i, H-A){
        ll ad = (mod_comb(i+B-1, i) * mod_comb(H+W-2-B-i, H-1-i)) % mod;
        ans = (ans + ad) % mod;
    }
    cout << ans << endl;
}



Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;


signed main()
{
	int r;
	cin >> r;
	cout << r * r << endl;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    dic = {}
    l = raw_input().split()
    for i in range(n):
        if i+1 > int(l[i]) :
            if(dic.get("{}{}".format(i+1,l[i]))):
                dic["{}{}".format(i+1,l[i])] += 1
            else:
                dic["{}{}".format(i+1,l[i])] = 1
        else:
            if(dic.get("{}{}".format(l[i],i+1))):
                dic["{}{}".format(l[i]),i+1] += 1
            else:
                dic["{}{}".format(l[i],i+1)] = 1
    c = 0
    for k,v in dic.items():
        if v >= 2:
            c += 1
    print(c)
if __name__ == "__main__":
    main()


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

bool zorome(int n){
	int a=n%10;
	while(true){
		n/=10;
		if(n==0) break;
		if((n%10)!=a) return false;
	}
	return true;
}

int main(){
	int n;
	cin>>n;
	while(!zorome(n)){
		n++;
	}
	cout << n << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
#define MOD1 1000000007
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){
    return *(ll *)a>*(ll *)b?1:*(ll *)a<*(ll *)b?-1:0;}
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}
/*nをa進数にしたときの、i桁目の数*/
ll placenai(ll n, ll a, ll i){return i==1?n%a:placenai(n/a,a,i-1);}
/*aのn乗(mod)*/
ll modpow(ll a, ll n, ll mod){
    if(n==0) return 1;
    ll i,s[digits(n,2)],ans=1;
    for(i=0;i<digits(n,2);i++){
        if(i==0) s[i]=a;
        else s[i]=s[i-1]*s[i-1]%mod;
        ans*=placenai(n,2,i+1)==1?s[i]:1;
        ans%=mod;
    }
    return ans;
}
ll modfac(ll n, ll mod){
    if(n==1||n==0) return 1;
    if(n>=mod) return 0;
    ll i,x=1;
    for(i=2;i<=n;i++){
        x*=i%mod;
        x%=mod;
    }
    return x;
}
ll inv[200005],finv[200005];
void makeinv(ll n){
    inv[1]=1;
    finv[0] = finv[1] = 1;
    ll i;
    for(i=2;i<=n;i++){
        inv[i]=MOD1 - inv[MOD1%i] * (MOD1 / i) % MOD1;
        finv[i] = finv[i - 1] * inv[i] % MOD1;
    }
}

int main(void){
    ll n,a,b,i,ans=0,ra,rb,x=1;
    scanf("%lld%lld%lld",&n,&a,&b);
    makeinv(b);
    for(i=1;i<=b;i++){
        x*=(n-i+1)%MOD1;
        x%=MOD1;
        if(i==a) ra=x;
        if(i==b) rb=x;
    }
    // printf("%lld? %lld %lld ",rb,finv[a],finv[b]);
    ra*=finv[a];
    rb*=finv[b];
    ra%=MOD1;
    rb%=MOD1;
    ans=modpow(2,n,MOD1)-ra-rb-1;
    while(ans<0) ans+=MOD1;
    // printf("%lld %lld %lld ",power(n,MOD1),ra,rb);
    printf("%lld\n",ans%MOD1);
    return 0;
}


Measured memory_bytes: 3328
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, ans = INF, A[MAXN], ps[MAXN];

void calc(ll l, ll m, ll r) {
    if (l - 0 + 1 <= 0 || m - l <= 0 || r - m <= 0 || n - 1 - r <= 0) return;
    ll s1 = ps[l], s2 = ps[m] - ps[l], s3 = ps[r] - ps[m], s4 = ps[n - 1] - ps[r];
    ans = min(ans, max({s1, s2, s3, s4}) - min({s1, s2, s3, s4}));
}

int main() {
    fast_io;

    cin >> n;
    for (ll i = 0; i < n; i++) cin >> A[i];
    partial_sum(A, A + n, ps);

    for (ll i = 1; i < n; i++) {
        ll m1 = ps[i] / 2, m2 = (ps[n - 1] - ps[i]) / 2;
        ll ind = lower_bound(ps, ps + i, m1) - ps;
        ll ind2 = lower_bound(ps + i + 1, ps + n, ps[i] + m2) - ps;

        calc(ind, i, ind2);
        calc(ind - 1, i, ind2);
        calc(ind, i, ind2 - 1);
        calc(ind - 1, i, ind2 - 1);
    }
    cout << ans << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 5888
// #include <iostream>
// #include <fstream>
// #include <cstdio>
// #include <set>
// #include <vector>
// #include <algorithm>
// #include <cmath>
// #include <cstdlib>
// #include <queue>
// #include <string>
// #include <map>
// #include <unordered_map>
// #include <cstring>
// #include <numeric>
// #include <stack>
// #include <iomanip>
// #include <chrono>

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

#define sd(mark) scanf("%d",&mark)
#define ss(mark) scanf("%s",mark)
#define clr(mark) memset(mark,0,sizeof(mark))
#define setinf(mark) memset(mark,0x3f,sizeof(mark))
#define setneg(mark) memset(mark,-1,sizeof(mark))



#ifndef strange
#define trace(...)
// #define endl '\n'
#define start_routine() 
#define end_routine()
#endif
typedef long long ll;   
//__gcd


const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
#define PI 3.141592653589793238
#define mod 1000000007


#define F first 
#define S second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define trav(a,x) for(auto &a:x)
#define pii pair<int,int>

#define pb push_back
#define int long long

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)

#define sz(x) (int)(x).size()
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<vi> vii;
#define vp vector <pii>
int x;

int power(int x,  int y) 
{ 
    int res = 1;   
  
    x = x % mod;  
   
    if (x == 0) return 0; 

    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % mod;  
  
          
        y = y>>1; 
        x = (x*x) % mod;  
    }  
    return res;  
}
void solve(){
    int n;
    cin>>n;
    int a=power(10,n);
    int b=power(9,n);
    int c=power(8,n);

    cout<< (a-2*b+c+mod+mod)%mod<<"\n";
    
}


signed main(){
    int t=1;
    start_routine();
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(NULL);
    cout<<fixed<<setprecision(10);
    
    
    // cin>>t;
    
    fr(i,1,t) {
		// cout<<"Case #"<<i<<": ";
		solve();
	}

    end_routine();
    return 0;
}

Measured memory_bytes: 3648
n,l = map(int,input().split())
r = list(map(int,input().split()))
o = 0
flag = 1
for i in range(1,n):
    lr = r[i-1] +r[i]
    if lr >= l:
        o = i
        flag = 0
        break
if flag == 0:
    print('Possible')
    for j in range(1,o):
        print(j)
    for k in range(n-1,o,-1):
        print(k)
    print(o)
else:
    print('Impossible')

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

const long INF = 10e9 + 1;

struct Card {
  char suit;
  long num;

  bool operator<=(Card &c) { return num <= c.num; };
  bool operator>=(Card &c) { return num >= c.num; };
  bool operator==(Card &c) { return num == c.num && suit == c.suit; };
  void print() { std::cout << suit << " " << num << std::endl; };
};

template <typename T> int partition(std::vector<T> &a, int p, int r) {
  T x = a.at(r);
  int i = p - 1;
  for (int j = p; j < r; ++j) {
    if (a.at(j) <= x) {
      ++i;
      std::swap(a.at(i), a.at(j));
    }
  }
  std::swap(a.at(i + 1), a.at(r));
  return i + 1;
}

template <typename T> void quickSort(std::vector<T> &a, int p, int r) {
  if (p < r) {
    int q = partition(a, p, r);
    quickSort(a, p, q - 1);
    quickSort(a, q + 1, r);
  }
}

template <typename T>
int merge(std::vector<T> &a, int left, int mid, int right) {
  int nL = mid - left, nR = right - mid;
  std::vector<T> L(nL, Card{}), R(nR, Card{});
  for (int i = 0; i < nL; i++) {
    L[i] = a[left + i];
  }
  for (int i = 0; i < nR; i++) {
    R[i] = a[mid + i];
  }
  L.push_back(Card{'A', INF});
  R.push_back(Card{'A', INF});

  int i = 0, j = 0;
  for (int k = left; k < right; ++k) {
    if (L[i] <= R[j]) {
      a[k] = L[i];
      ++i;
    } else {
      a[k] = R[j];
      ++j;
    }
  }
  return i + j;
}

template <typename T> void mergeSort(std::vector<T> &a, int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
}

template <typename T>
bool isStable(std::vector<T> &orig, std::vector<T> &sorted) {
  std::size_t n = orig.size();
  std::vector<T> b(n, T{});
  std::copy(orig.begin(), orig.end(), b.begin());
  mergeSort<T>(b, 0, n);
  for (std::size_t i = 0; i < n; ++i) {
    if (!(sorted.at(i) == b.at(i)))
      return false;
  }
  return true;
}

int main() {
  int n;
  std::cin >> n;
  std::vector<Card> orig(n, Card{}), a(n, Card{});
  for (int i = 0; i < n; ++i) {
    Card c{};
    std::cin >> c.suit >> c.num;
    orig.at(i) = c;
  }

  copy(orig.begin(), orig.end(), a.begin());
  quickSort<Card>(a, 0, n - 1);
  std::cout << (isStable<Card>(orig, a) ? "Stable" : "Not stable") << std::endl;

  for (int i = 0; i < n; ++i) {
    a.at(i).print();
  }
}



Measured memory_bytes: 10656
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll a = in(), b = in(), c = in();
	cout << (a + b >= c ? "Yes" : "No") << endl;
}

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

using namespace std;

int main() {
	int N = 0;
	cin >> N;

	vector <int> t(N + 1);
	vector <int> x(N + 1);
	vector <int> y(N + 1);

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

	bool flag = true;
	for (int i = 0; i < N; i++) {
		int dt = t[i + 1] - t[i];
		int dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
		if (dt < dist) flag = false;
		if (dist % 2 != dt % 2) flag = false;
	}

	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1408
n = int(input())
l = list(map(int,input().split()))
l.sort()
mod = 10**9+7
if n % 2 == 1:
    if l[0] != 0:
        print(0)
        exit()
    count = 2
    for i in range(1,n-1,2):
        
        if l[i] != count or l[i] != l[i+1]:
            print(0)
            exit()
        count += 2
    print(pow(2,n//2,mod))
else:
    count = 1
    for i in range(0,n-1,2):
        if l[i] != count or l[i] != l[i+1]:
            print(0)
            exit()
        count += 2
    print(pow(2,n//2,mod))


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

int main (){
    char alpha;
    cin >> alpha;
    if('a' <= alpha && alpha <= 'z'){
        cout << 'a' << endl;
    }else{
        cout << 'A' << endl;
    }
}

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main()
{
    unsigned long long int x, temp;
    cin >> x;
    temp = 100;
    int t = 0;
    while (temp < x)
    {
        temp = temp + (long long int)(0.01 * (double)temp);
        t++;
    }
    cout << t;
    return 0;
}

Measured memory_bytes: 3592
import math

input_arr = list(map(int, input().rstrip().split()))

count = 0
count_d = 0
while count < input_arr[0]:
    
    coord_arr = list(map(int, input().rstrip().split()))
    x = coord_arr[0]
    y = coord_arr[1]
    d = math.sqrt(x**2 + y**2)
    # print(d)
    if d <= input_arr[1]:
        count_d += 1
    
    count += 1

print (count_d)

Measured memory_bytes: 69136
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A), t(B), x(Q);
    for (ll i = 0; i < A; i++) {
        cin >> s[i];
    }
    for (ll i = 0; i < B; i++) {
        cin >> t[i];
    }
    for (ll i = 0; i < Q; i++) {
        cin >> x[i];
    }

    vector<ll> s_to_min(A), t_to_min(B);
    for (ll i = 0; i < A; i++) {
        ll j = lower_bound(t.begin(), t.end(), s[i]) - t.begin();
        if (j == 0) {
            s_to_min[i] = abs(t[j] - s[i]);
        } else if (j == t.size()) {
            s_to_min[i] = abs(t[j - 1] - s[i]);
        } else {
            s_to_min[i] = min(abs(t[j] - s[i]), abs(t[j - 1] - s[i]));
        }
    }
    for (ll i = 0; i < B; i++) {
        ll j = lower_bound(s.begin(), s.end(), t[i]) - s.begin();
        if (j == 0) {
            t_to_min[i] = abs(s[j] - t[i]);
        } else if (j == s.size()) {
            t_to_min[i] = abs(s[j - 1] - t[i]);
        } else {
            t_to_min[i] = min(abs(s[j] - t[i]), abs(s[j - 1] - t[i]));
        }
    }



    for (ll i = 0; i < Q; i++) {
        ll ans = LLONG_MAX;

        //寺→神社
        ll j = lower_bound(s.begin(), s.end(), x[i]) - s.begin();
        if (j == 0) {
            ans = min(ans, abs(x[i] - s[j]) + s_to_min[j]);
        } else if (j == s.size()) {
            ans = min(ans, abs(x[i] - s[j - 1]) + s_to_min[j - 1]);
        } else {
            ans = min(ans, abs(x[i] - s[j]) + s_to_min[j]);
            ans = min(ans, abs(x[i] - s[j - 1]) + s_to_min[j - 1]);
        }

        //神社→寺
        j = lower_bound(t.begin(), t.end(), x[i]) - t.begin();
        if (j == 0) {
            ans = min(ans, abs(x[i] - t[j]) + t_to_min[j]);
        } else if (j == t.size()) {
            ans = min(ans, abs(x[i] - t[j - 1]) + t_to_min[j - 1]);
        } else {
            ans = min(ans, abs(x[i] - t[j]) + t_to_min[j]);
            ans = min(ans, abs(x[i] - t[j - 1]) + t_to_min[j - 1]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 5504
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);
    REP(i,n)cin >> h[i];
    SORT(h);
    ll answer = 0;
    FORR(i,n-1,0){
        if(k > 0){
            k--;
            continue;
        }
        answer+=h[i];
    }
    cout << answer << endl; 
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using CHY72;

namespace CHY72{
    
    public class PointXY<T>where T:IComparable {
        public T X , Y;
        public bool Flag = false;
        public PointXY(T _X,T _Y) {
            X = _X; Y = _Y;
        }
        public static bool operator ==(PointXY<T> P1, PointXY<T> P2) {
            return (P1.X.CompareTo( P2.X) == 0 && P1.Y.CompareTo (P2.Y) == 0);
        }
        public static bool operator !=(PointXY<T> P1, PointXY<T> P2) {return !(P1 ==P2);}
        public override int GetHashCode() {return X.GetHashCode() ^ Y.GetHashCode();}
        public override bool Equals(object obj) {
            if (obj == null || this.GetType() != obj.GetType()) {return false;}
            return (this == (PointXY<T>)obj);
        }         

    }
    

}    

public class Program {
    static bool ReadLine_1(ref int num1, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str);
        return (Fin0 && num1 == 0);
    }
    static int  ReadLine_1() {
        return  int.Parse(Console.ReadLine());
    }
    static bool ReadLine_2(ref int num1, ref int num2, char Spliter = ' ', bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }
    static int[] ReadLine72(char Spliter = ' ') {
        return Console.ReadLine().Split(Spliter).Select(s => int.Parse(s)).ToArray();
    }

    const int DefaultMax = 727272;
    static int FromYYYYMMDD10_MIRENIAM(int y, int m, int d) {
        int output;
        int y3 = (y-1) / 3;
        int ynot3 = (y-1) -y3;
        output = ynot3 * (19 + 20) * 5 + y3 * 20 * 10;

        if (y % 3 == 0) {
            output += (m-1) * 20; 
        }else {
            output += (m - 1) * 20;
            output -= (m - 1) / 2;
        }
        return output + d;


    } 

    static void Main(string[] args) {
        int iMax = ReadLine_1();
        int ai = FromYYYYMMDD10_MIRENIAM(1000,1, 1);
        for (int i = 0; i < iMax; i++) {
            int[] ymd = ReadLine72();
            int bi =FromYYYYMMDD10_MIRENIAM(ymd[0],ymd[ 1],ymd[2]);
            Console.WriteLine(ai -bi);
        }
    }
}

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

int main(){
  int K;
  string S;
  cin >> K >> S;
  
  if(S.size()<=K) cout << S << endl;
  else{
    for(int i=0;i<K;i++) cout << S[i];
    cout << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)/3
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n,a,b,A[5002],dp[5002], prev_dp[5002], at[5002], co[5002];

int main()
{
	FAST
	cin>>n>>a>>b;
	for(ll i=1;i<=n;++i){cin>>A[i];at[A[i]]=i;}
	FOR(k,1,n+1) {
		mmst(dp,0);
		ll p = at[k];
		for(ll i=1;i<p;i++)  dp[i] = prev_dp[i];
		for(ll i=p;i<=n;i++) {
			dp[i] = min(prev_dp[i]+a, prev_dp[p-1] + b * (co[i] - co[p]));
		}
		for(ll i=p;i<=n;i++) co[i] += 1;
		swap(dp,prev_dp);
	}
	cout<<prev_dp[n]<<'\n';
}


Measured memory_bytes: 512
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		Object[][] array = new Object[4][13];

		for(int i=0;i<x;i++) {
			String mark = sc.next();
			int num = sc.nextInt();

			if(mark.equals("S")) {
				array[0][num-1] = num;
			}else if(mark.equals("H")) {
				array[1][num-1] = num;
			}else if(mark.equals("C")) {
				array[2][num-1] = num;
			}else if(mark.equals("D")) {
				array[3][num-1] = num;
			}
		}

		for(int i=0;i<4;i++) {
			for(int j=0;j<13;j++) {
				if(array[i][j]==null) {
					if(i==0) {
						System.out.println("S " + (j+1));
					}else if(i==1) {
						System.out.println("H " + (j+1));
					}else if(i==2) {
						System.out.println("C " + (j+1));
					}else if(i==3) {
						System.out.println("D " + (j+1));
					}
				}
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 26216
def main():
    N = int(input())
    X = N
    sum = 0
    while True:
        amari = N%10
        sum += amari
        #print(amari,sum)
        N //= 10
        if N == 0:
            break

    if X%sum == 0:
        return 'Yes'
    else:
        return 'No'

print(main())


Measured memory_bytes: 9132
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int N=gi();
	    long[] A= new long[N];
	    
        for(int i=0; i<N;i++) {
            A[i]=gl();
	    }
	    
        long v=1;
        long b=A[0];
        int f=0;
        for(int i=1; i<N;i++) {
            long a=A[i];
        	if(a<b) {
        		if(f<0) { 
        			v++;
        			f=0;
        		} else {
        		    f=1;
        		}
        	} else if(a>b) {
        		if(f>0) {
        			v++;
        			f=0;
        		} else {
        		    f=-1;
        		}
        	}
        	b=a;
	    }
	    
		System.out.println(v);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 60216
#include <iostream>
#include <cstdlib>
using i64 = long long;

int main() {
    i64 a, v, b, w, t;
    std::cin >> a >> v >> b >> w >> t;

    if (a == b || (v > w && (v - w) * t >= llabs(a - b))) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3664
import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N,M = LI()
pS = [LS() for _ in range(M)]
count_AC = collections.defaultdict(int)
count_WA = collections.defaultdict(int)
for x in pS:
    p,S = int(x[0]),x[1]
    if p in count_AC:
        continue
    if S=='AC':
        count_AC[p] += 1
    else:
        count_WA[p] += 1
print(sum(count_AC.values()),sum([count_WA[k] for k in count_AC]))


Measured memory_bytes: 47784
#include <stdio.h>
#include <math.h>

#define PI	(3.14159265358979323846264338)

void calcPoint( double* x, double* y, int* dir, int len, int deg )
{
	double dirRad = *dir * PI / 180.0;
	
	*x += sin( dirRad ) * len;
	*y += cos( dirRad ) * len;
	
	*dir += deg;
}

int main(void)
{
	double x = 0;
	double y = 0;
	int dir = 0;
	int len;
	int deg;
	
	while( 1 )
	{
		scanf( "%d,%d", &len, &deg );
		if( len == 0 && deg == 0 )break;
		
		calcPoint( &x, &y, &dir, len, deg );
	}
	printf( "%d\n%d\n", (int)x, (int)y );//*/
	
	return (0);
}

Measured memory_bytes: 604
#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));

void solve(long long N, std::vector<long long> A, std::vector<long long> B) {
    SORT(A);
    SORT(B);
    if (N % 2 == 1) {
        ll a = A[N / 2], b = B[N / 2];
        cout << max(0LL, b - a + 1) << endl;
    } else {
        ll a1 = A[N / 2 - 1], b1 = B[N / 2 - 1], a2 = A[N / 2], b2 = B[N / 2];
        cout << max(0LL, b1 + b2 - a1 - a2 + 1) << endl;
    }
}

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


Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b;
	cin>>a>>b;
	if(a>b){
		swap(a,b);
	}
	for(ll i=0;i<b;i++){
		cout << a;
	}
	// your code goes here
	return 0;
}

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

int main(){
	int n,t;double a;
	cin>>n>>t>>a;
	double h[n];
	rep(i,n)cin>>h[i];
	int index=0;double mi=100000;
	rep(i,n){
		double temp=t-h[i]*0.006;
		if(mi>abs(a-temp)){
			index=i+1;
			mi=abs(a-temp);
		}
	}
	puts(index);
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; using ll = long long;
#define REP(i,n) for(int i=0,i##__=(n);i<i##__;++i)
#define ALL(o) (o).begin(),(o).end()
#define PUT(a) cout<<a<<"\n"
#define VEC2D(v,y,x,s) vector<vector<int>> v(y, vector<int>(x, s))
//ここまでテンプレ
int main() {
    priority_queue<int> pq; 
    int N,M;
    cin>>N>>M;
    VEC2D(AB,pow(10,5),0,0);

    REP(i,N){
        int A,B;
        cin>>A>>B;
        if(A<=M)AB.at(A-1).push_back(B);
    }

    REP(i,M) sort(ALL(AB[i]));
    
    int ans = 0;
    REP(i,M){
        REP(j,AB[i].size()){
            pq.push(AB[i][j]);
        }
        if(pq.size()>0){
            ans += pq.top();
            pq.pop();
        }    
    }

    PUT(ans);
}

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (s[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

namespace ABC_043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N;  //人数
            int S;  //必要な個数

            //人数を入力
            N = int.Parse(Console.ReadLine());

            //必要な個数を求める
            S = 0;  //合計を0に初期化
            for (int i = 1; i <= N; i ++)  // 1 → N の繰り返し
            {
                S = S + i;  // Sをi増やす  S += i でもいい
            }
            Console.WriteLine(S);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
s = list(str(input()))
flag = 0
for i in range(len(s)-1):
  if s[i] == '1' and s[i+1] == '1':
    s[i+1] = '0'
    flag += 1
  elif s[i] == '0' and s[i+1] == '0':
    s[i+1] = '1'
    flag += 1
print(flag)

Measured memory_bytes: 3956
//file_name:ABC96_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int h,w;
    scanf("%d%d",&h,&w);

    int box[h+2][w+2];
    rep(i,h+2){
        rep(j,w+2){
            box[i][j]=0;
        }
    }

    srep(i,1,h+1){
        string s;
        cin >> s;
        srep(j,1,w+1){
            if(s[j-1]=='.'){
                box[i][j] = 0;
            }else{
                box[i][j] = 1;
            }
        }
    }

    srep(i,1,h+1){
        srep(j,1,w+1){
            if(box[i][j]==1){
                if(box[i-1][j]+box[i+1][j]+box[i][j-1]+box[i][j+1]==0){
                    puts("No");
                    return 0;
                }
            }
        }
    }


    puts("Yes");
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
int n,m,cnt,ans,now,sx,sy;
bool fl=1;
int main()
{
	int i,s,a,b,j,k;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d%d%d",&k,&a,&b);
		j=abs(a-sx)+abs(b-sy);
		if(j>k-now){fl=0;break;}
		if((j&1)!=((k-now)&1)){fl=0;break;}
		now=k;sx=a;sy=b;
	}
	if(fl)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC159C
{
    class Program
    {
        static void Main(string[] args)
        {
            int L = RInt;

            double k = L / 3.0;
            double ans = k * k * k;

            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            string[,] map2 = new string[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0.ToString();
                    else if (i == 0) map2[i, j] = (j - 1).ToString();
                    else if (j == 0) map2[i, j] = (i - 1).ToString();
                    else map2[i, j] = map[i - 1, j - 1].ToString();
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j].Last());
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D<T>(T[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 11220
#!/usr/bin/env python3
import bisect

def solve(a, b, q, s, t, u, qa):

    INF = 3 * (10 ** 10)

    u.sort()
    ux = [x[0] for x in u]
    st = [s, t]
    len_st = [a, b]

    for x in qa:
        r = INF
        i = bisect.bisect_left(ux, x)
        ys = []
        if 0 < i:
            ys.append(u[i - 1])
        if i < a + b:
            ys.append(u[i])
        for v in ys:
            y, p = v
            j = bisect.bisect_left(st[p], y)
            if 0 < j:
                z = st[p][j - 1]
                r = min(r, abs(y - x) + abs(z - y))
            if j < len_st[p]:
                z = st[p][j]
                r = min(r, abs(y - x) + abs(z - y))
        print(r)


def main():
    a, b, q = input().split()
    a = int(a)
    b = int(b)
    q = int(q)
    s = []
    t = []
    u = []
    qa = []
    for _ in range(a):
        v = input()
        v = int(v)
        s.append(v)
        u.append((v, 1))
    for _ in range(b):
        v = input()
        v = int(v)
        t.append(v)
        u.append((v, 0))
    for _ in range(q):
        v = input()
        v = int(v)
        qa.append(v)

    solve(a, b, q, s, t, u, qa)


if __name__ == '__main__':
    main()



Measured memory_bytes: 32536
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
    sa=a[i]+a[i+1]-b[i]
    if a[i]<b[i]:
        if sa>0:
            ans+=b[i]
            a[i+1]=sa
        else:
            ans+=a[i]+a[i+1]
            a[i+1]=0
    else:
        ans+=b[i]
print(ans)

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

int main(){
     ios::sync_with_stdio(0);
     cin.tie(0);
    
     int a,b,c;
     
     cin >> a >> b >> c;
     
     
     if(a+b+c >= 22){cout << "bust";}
     else{cout << "win";}
 }



Measured memory_bytes: 256
#include <bits/stdc++.h>
	#include <string>
	#include <map>
    using namespace std;
     
    int main() {
      int N, M;
      int i, j, k;
      
      cin >> N;
      string s[N];
      for (i = 0; i < N; i++)
        cin >> s[i];
      
      cin >> M;
      string t[M];
      for (i = 0; i < M; i++)
        cin >> t[i];
      
      string temp;
      //点数配列
      map <string, int> score;
      // 青の中でもっとも良いものを探す
      for (i = 0; i < N; i++){
        temp = s[i];
        
        score[temp] = 0;
        
        // 青の中で探索
        for (j = 0; j < N; j++){
          if(s[j] == temp)
            score[temp] += 1;
        }
        
        // 赤の中で探索
        for (j = 0; j < M; j++){
          if(t[j] == temp)
            score[temp] -= 1;
        }
      }
      
      // 赤の中でもっとも良いものを探す
      for (i = 0; i < M; i++){
        temp = t[i];
        
        score[temp] = 0;
        
        // 青の中で探索
        for (j = 0; j < N; j++){
          if(s[j] == temp)
            score[temp] += 1;
        }
        
        // 赤の中で探索
        for (j = 0; j < M; j++){
          if(t[j] == temp)
            score[temp] -= 1;
        }
      }
      
      // 名前の数
      int name = score.size();
      
      // 最高点
      int max = 0;
      
      // 青の中でもっとも点数の高い名前を探す
      for (i = 0; i < N; i++){
        if ( score[s[i]] > max)
          max = score[s[i]];
      }
      // 赤の中でもっとも点数の高い名前を探す
      for (i = 0; i < M; i++){
        if ( score[t[i]] > max)
          max = score[t[i]];
      }
      
      // 最高点maxを返す
      cout << max << endl;
    }

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

int main()
{
	int n, x, i, a[101], count=0;
	cin>>n>>x;
	for(i=0;i<n;i++)cin>>a[i];
	sort(a, a+n);
	for(i=0;i<n;i++){
		if(x<a[i])break;
		else{
			x-=a[i];
			count++;
		}
	}
	if(x!=0 && i==n)count--;
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	ll a[3];
	ll k;
	REP(i, 3) cin >> a[i];
	cin >> k;	
	sort(a, a + 3);
	REP(i, k) a[2] *= 2;
	cout << a[0] + a[1] + a[2] << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin>>x;
  if(x>=1800){
    cout<<1<<endl;
  }
  else if(x>=1600){
    cout<<2<<endl;
  }
  else if(x>=1400){
    cout<<3<<endl;
  }
  else if(x>=1200){
    cout<<4<<endl;
  }
  else if(x>=1000){
    cout<<5<<endl;
  }
  else if(x>=800){
    cout<<6<<endl;
  }
  else if(x>=600){
    cout<<7<<endl;
  }
  else{
    cout<<8<<endl;
  }
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

typedef pair<int, int> P;

int main() {
    int N;
    cin >> N;
    int N2 = 1 << N;
    vector<int> a(N2);
    rep(i, N2) cin >> a[i];
    sort(a.begin(), a.end());

    vector<int> s; // 作成したスライムの集合
    s.push_back(a.back()); // 最初の世代に一番大きな数値を入れる
    a.back() = -1; // 使用済みフラグ

    rep(i, N) {
        vector<int> p = s; // p:親の世代
        sort(p.begin(), p.end());
        int ai = N2 - 1;
        while (p.size() > 0 && ai >= 0) {
            if (a[ai] == -1) {
                --ai;
                continue;
            }

            if (a[ai] < p.back()) {
                s.push_back(a[ai]); // p.back の子供としてa[ai]のスライムを作る
                p.pop_back();
                a[ai] = -1; // 使用済みフラグ
            }
            --ai;
        }

        if (p.size() > 0) { // 子供を作成出来ない親があった場合
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

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

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

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

typedef long long ll;

void solve(long long H, long long A)
{
    long long ans = 0;
    ans += H / A;
    if (H % A != 0)
    {
        ans += 1;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(int a, int b) {
	return a > b;
}

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


Measured memory_bytes: 256
import collections

N = int(input())
A = list(map(int,input().split()))
S = sum(A)
c = collections.Counter(A)

Q = int(input())

for i in range(Q):
    B, C = map(int, input().split())
    ans = S - B * c[B] + C * c[B]
    print(ans)
    S = ans
    c[C] += c[B]
    c[B] = 0

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

ll MOD = (ll) 10939;
const ll MAXN = (ll) 3e3 + 10;
const ll INF = (ll) 1e17;
const ll LOG = 20;

bool dp[MAXN][MAXN];

bool CMP(pll a, pll b){
	return a.F * b.S < a.S * b.F;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	dp[0][0] = true;
	pll ans;
	int fl = -1;
	for(int i = 0; i <= f; i++){
		for(int j = 0; j <= f; j++){
			if(i + 100 * a <= f) dp[i + 100 * a][j] |= dp[i][j];
			if(i + 100 * b <= f) dp[i + 100 * b][j] |= dp[i][j];
			if(j + c <= f) dp[i][j + c] |= dp[i][j];
			if(j + d <= f) dp[i][j + d] |= dp[i][j];
			if(dp[i][j] && i + j <= f && e * i >= 100 * j && min(i, j) > 0){
				if(fl == -1) ans = {j, i};
				if(CMP(ans, {j, i})) ans = {j, i};
				fl = 1;
			}
		}
	}
	if(fl == -1) return cout << 100 * a << " 0", 0;
	cout << ans.F + ans.S << " " << ans.F << '\n';
	return 0;
}


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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int MAX = 10000007;
const ll MOD = 998244353;

template <typename T>
struct FenwickTree{
	int size;
	vector<T> v;

	FenwickTree(int n){
		size = n;
		v.assign(size+1, 0); 
	}

	FenwickTree(vector<T> arr){
		size = arr.size();
		v.assign(size+1, 0);
		for(int i = 0; i < size; i++){
			upd(i+1, arr[i]);
		}
	}

	T operator[](int i){
		T ans = 0;
		for(; i; i-=(i&(-i))){
			ans = ((ll) ans + v[i]) % MOD;
		}
		return ans;
	}

	void upd(int i, T x){
		for(; i <= size; i+=(i&(-i))){
			v[i] = (v[i] + x + MOD) % MOD;
		}
	}
};

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

	int n, k; cin >> n >> k;
	vector<vi> v(k, vi(2, 0));
	FOR(i, k) cin >> v[i][0] >> v[i][1];

	sort(all(v), [](vi& a, vi& b){
		return a[0] < b[0];
	});

	FenwickTree<ll> ft(n+1);

	vi dp(n+1, 0);
	dp[1] = 1;

	for(int i = 1; i < n; i++){
		dp[i] = ((ll) dp[i] + ft[i]) % MOD;
		FOR(j, k){
			int now = dp[i];
			ft.upd(i+v[j][0], now);
			ft.upd(i+v[j][1]+1, -now);
		}
		//cout << dp[i] << " - ";
		//FOR(i, n) cout << ft[i+1] << " \n"[i==n-1];
	}

	cout << (dp[n] + ft[n]) % MOD << '\n';
	

	return 0;
}


Measured memory_bytes: 5572
import java.util.Scanner;

public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int n = stdIn.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++){
            a[i] = stdIn.nextInt();
        }

        int sum = 0;
        int prev = 0;
        for(int i=0; i<n; i++){
            if(i==0){
                sum = 0;
                for(int j=0; j<n; j++){
                    if(j % 2 == 0){
                        sum += a[(i+j) % n];
                    }else{
                        sum -= a[(i+j) % n];
                    }
                }
            }else{
               sum = 2 * a[(n + i - 1) % n] - prev; 
            }

            System.out.print(sum + " ");

            prev = sum;
        }
    }
}


Measured memory_bytes: 61700
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>
#include <map>
#include <set>
#include <functional>

using namespace std;

int main()
{
  int64_t a, b, c, d;

  cin >> a >> b >> c >> d;

  vector<int64_t> result_candidate{a * c, a * d, b * c, b * d};
  sort(result_candidate.begin(), result_candidate.end(), std::greater<int64_t>());
  cout << result_candidate[0] << endl;

  return 0;
}


Measured memory_bytes: 3628