akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main{

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		public String next(){
			try{
				while(st==null||!st.hasMoreElements()){
					st = new StringTokenizer(br.readLine());
				}
			}catch(Exception e){
				e.printStackTrace();
			}
			return st.nextToken();
	
		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		public String nextLine(){
			String s = "";
			try{
				s = br.readLine();
			}catch(Exception e){
				e.printStackTrace();
			}	
			return s;		
		}
	} 
	
	public static void main(String[] args){
		FastReader in = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		char[] a = in.next().toCharArray();
		char[] b = in.next().toCharArray();
		for(int i = 0 ; i < a.length+b.length;i++){
			if(i%2==0)
			out.print(a[i/2]);
			else{
			out.print(b[i/2]);
			}
		}		
		out.flush();
		out.close();  
	}

}





Measured memory_bytes: 22612
using System;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        new Program().Solve();
    }

    Scanner sc = new Scanner();
    void Solve()
    {
        int w = sc.NextInt();
        int h = sc.NextInt();
        int n = sc.NextInt();
        int maxX = w;
        int minX = 0;
        int maxY = h;
        int minY = 0;
        for (int i = 0; i < n; i++)
        {
            int x = sc.NextInt();
            int y = sc.NextInt();
            int a = sc.NextInt();
            if (a == 1) minX = Math.Max(minX, x);
            else if (a == 2) maxX = Math.Min(maxX, x);
            else if (a == 3) minY = Math.Max(minY, y);
            else if (a == 4) maxY = Math.Min(maxY, y);
        }
        int ans = (maxX - minX) * (maxY - minY);
        if (maxX - minX <= 0) ans = 0;
        if (maxY - minY <= 0) ans = 0;
        wl(ans);
        rk();
    }
    void SolveC()
    {
        int N = sc.NextInt();
        int T = sc.NextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) A[i] = sc.NextInt();
        int maxDiff = 0;
        int minV = A[0];
        int ans = 0;
        for (int i = 1; i < N; i++)
        {
            if (maxDiff < A[i] - minV)
            {
                maxDiff = A[i] - minV;
                ans = 0;
            }
            if (maxDiff == A[i] - minV)
            {
                ans++;
            }
            minV = min(minV, A[i]);
        }
        wl(ans);
        rk();
    }
    // ------------------------------------- //
    void wl(string v) { Console.WriteLine(v); }
    void wl(int v) { Console.WriteLine(v); }
    void rk() { Console.ReadKey(); }
    int max(int v1, int v2) { return Math.Max(v1, v2); }
    int min(int v1, int v2) { return Math.Min(v1, v2); }
    long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }
    long lcm(long a, long b) { return a / gcd(a, b) * b; }
}
class Scanner
{
    public Scanner() { }
    private string[] buff = null;
    private int bIndex = 0;
    public string Next()
    {
        if (buff == null || bIndex >= buff.Length)
        {
            buff = Console.ReadLine().Split(' ');
            bIndex = 0;
        }
        return buff[bIndex++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
}
class Pair<T, K>
{
    public Pair() { }
    public Pair(T f, K s)
    {
        first = f;
        second = s;
    }
    public T first {get; set;}
    public K second {get; set;}
}


Measured memory_bytes: 2904
N = int(input())
tasks = []
for i in range(0, N):
  t = list(map(int, input().split(' ')))
  tasks.append(t)
tasks = sorted(tasks, key=lambda x: x[1])
sum_time = 0
is_done = True
for t in tasks:
  sum_time += t[0]
  if sum_time > t[1]:
    is_done = False
    break
if is_done:
  print('Yes')
else:
  print('No')

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


namespace ac{
    class practice{
        static void Main(string[] args){
            var a = 0;
        	var b = 0;

       		string[] str = Console.ReadLine().Split(' '); //ここで半角スペース区切りで取る
      	    a = int.Parse(str[0]);
       	    b = int.Parse(str[1]);
          
            Console.Write(Math.Max(a+b,Math.Max(a-b,a*b)));
        }
    }
}

Measured memory_bytes: 13140
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素



signed main(){
  int X,Y;
  cin>>X>>Y;
  if(2*X<=Y&&4*X>=Y){
    if(Y%2==0){
      cout<<"Yes";
    }else{
      cout<<"No";
    }
  }else{
    cout<<"No";
  }
}

Measured memory_bytes: 3592
#include <stdio.h>

int main()
{
    char p[6];
    for(int i=1;i<=6;i++)
    {
        scanf("%s", &p[i]);}
    if((p[3]==p[4])&&(p[5]==p[6]))
    {
        printf("Yes");
    }
    else{
    printf("No");}
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<string> S(2);
  rep(i, 2) cin >> S[i];
  vector<ll> dp(n+1);
  dp[0] = 1;
  rep(i, n) {
    if(i) {
      if(S[0][i] == S[1][i]) {
        if(S[0][i-1] == S[1][i-1]) {
          (dp[i+1] = dp[i] * 2) %= mod;
        } else {
          (dp[i+1] = dp[i] * 1) %= mod;
        }
      } else {
        if(S[0][i-1] == S[1][i-1]) {
          (dp[i+1] = dp[i] * 2) %= mod;
        } else {
          (dp[i+1] = dp[i] * 3) %= mod;
        }
        dp[i+2] = dp[i+1];
        i++;
      }
    } else {
      if(S[0][i] == S[1][i]) {
        (dp[i+1] = dp[i] * 3) %= mod;
      } else {
        (dp[i+1] = dp[i] * 6) %= mod;
        dp[i+2] = dp[i+1];
        i++;
      }
    }
  }
  cout << dp[n] << "\n";
  return 0;
}


Measured memory_bytes: 3508
// @gaurav_512
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define bs(v,val) binary_search(v.begin(),v.end(),val)
#define mod 1e9+7
#define ff first
#define ss second
#define fi(n) for(int i=0;i<n;i++)
#define fj(n) for(int j=0;j<n;j++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define m_p make_pair
#define endl '\n'
 
ll power(ll x, ll y, ll p)
{  
    ll res = 1;
    x = x % p;  
    if (x == 0) return 0;
    while (y > 0){  
        if (y & 1)  res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p); 
}
// ********** CODE STARTS HERE ****************//
 
 
void solve()
{
	int n;
	cin>>n;
	vector<double>P(n);
	fi(n)	cin>>P[i];
	vector<vector<double>>dp(n+1,vector<double>(n+1,1));
	dp[0][0] = 1;
	for(int i=1;i<=n;i++)
		dp[i][i] = P[i-1]*dp[i-1][i-1];
	for(int j=1; j<=n; j++)
		dp[0][j] = dp[0][j-1]*(1-P[j-1]);
	for(int i=1; i<n; i++)
	{
		for(int j=i+1; j<=n; j++)
		{
			dp[i][j] = P[j-1]*dp[i-1][j-1]+(1-P[j-1])*dp[i][j-1];
		}
	}
	double ans = 0;
	for(int i=(n+1)/2; i<=n;i++)
		ans+=dp[i][n];
	cout<<setprecision(10)<<fixed<<ans;
}
int main()
{
	fastio;
//    int T;
//    cin>>T;
//    while(T--)
        solve();
	return 0;
}

Measured memory_bytes: 73708
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  cout << s.at(0) << s.at(1) << s.at(2) << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int x = B / A;
  
  if (x < C){
    cout << x << endl;
  }
  
  else {
    cout << C << endl;
  }
  
}

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

typedef long long ll;

class ll_mod {
public:
    typedef long long ll;
    static const ll MOD = 1e9+7;
    ll x;

    ll_mod() {
        this->x = 0;
    }
    ll_mod(ll x) {
        this->x = x;
    }

    ll_mod operator + (const ll_mod rhs) {
        return ll_mod((this->x + rhs.x) % ll_mod::MOD);
    }
    ll_mod operator - (const ll_mod rhs) {
        return ll_mod((this->x + rhs.x) % ll_mod::MOD);
    }
    ll_mod operator * (const ll_mod rhs) {
        return ll_mod((this->x * rhs.x) % ll_mod::MOD);
    }
    ll_mod operator * (const ll x) {
        return ll_mod((this->x * x) % ll_mod::MOD);
    }
    ll_mod operator / (const ll_mod rhs) {
        return ll_mod((this->x / rhs.x) % ll_mod::MOD);
    }
};

// x^n % MOD
ll_mod pow_MOD(ll_mod x, ll n) {
    if (n == 0) return ll_mod(1);
    if (n == 1) return x;

    ll_mod ret = pow_MOD(x, n/2);
    if (n%2 == 0) {
        return ret*ret;
    } else {
        return ret*ret*x;
    }
}

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

    int H, W, A, B; cin >> H >> W >> A >> B;
    vector<ll_mod> fact, inv_fact;
    fact.emplace_back(1); fact.emplace_back(1);
    for (ll i = 2; i < H+W; i++) {
        fact.emplace_back(fact[i-1]*i);
    }
    for (ll i = 0; i < H+W; i++) {
        inv_fact.emplace_back(pow_MOD(fact[i], ll_mod::MOD-2));
    }

    ll_mod ans(0);
    for (int i = B; i < W; i++) {
        ans = ans + fact[i+H-A-1]*inv_fact[i]*inv_fact[H-A-1] * \
            fact[A+W-i-2]*inv_fact[A-1]*inv_fact[W-i-1];
    }

    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 4848
import math
 
prime = [0 for i in range(11000)]
k = 0
r = 104900
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        prime[k] = i+1
        k += 1
        l = i
        for j in range(2*i+1,r,i+1):
            p[j] = 0


for i in range(l+1,r):
    if p[i]:
        prime[k] = i+1
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print sum(prime[:n])

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

int main()
{
    int T, D, L;
    while (cin >> T >> D >> L)
    {
        if (T == 0 && D == 0 && L == 0)
            return 0;
        vector<int> x(T);
        for (int i = 0; i < T; i++)
            cin >> x[i];
        vector<int> imos(222222);
        for (int i = 0; i < T; i++)
        {
            if (L <= x[i])
            {
                imos[i]++;
                imos[i + D]--;
            }
        }
        for (int i = 0; i < T + D + 1; i++)
        {
            imos[i + 1] += imos[i];
        }
        int ans = 0;
        for (int i = 0; i < T - 1; i++)
        {
            if (imos[i])
                ans++;
        }

        cout << ans << endl;
    }
}


Measured memory_bytes: 4356
N = int(input())
S = input()
A = []
a = 0
l = r = 0
for s in S:
    if s == '(':
        if a >= 0:
            a += 1
        else:
            l -= a
            a = 1
    else:
        # s == ')'
        a -= 1
if a != 0:
    if a < 0:
        l -= a
    else:
        r += a

# print(l, r)

print('('*l + S + ')' * r)


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

// {{{Template for Competitive Programming
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n; i >= 0; --i)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0 ,1 ,0,-1};
using vint = vector<int>;
using pint = pair<int, int>;
// }}}

signed main() {
	double w, h, x, y;
	cin >> w >> h >> x >> y;

	printf("%7f ", (w * h) / 2);
	if (x == w/2 and y == h/2) cout << 1 << endl;
	else cout << 0 << endl;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
$constList = array_map("intval", explode(" ", trim(fgets(STDIN))));;
$dp = array_pad([], count($constList), 0);
$dp[0] = 0;
$dp[1] = (int)(abs($constList[1] - $constList[0]));
for($i = 2; $i < count($constList); $i++){
    $dp[$i] = min($dp[$i - 1] + abs($constList[$i] - $constList[$i - 1]), $dp[$i - 2] + abs($constList[$i] - $constList[$i - 2]));
}
print($dp[count($dp) - 1]."\n");

Measured memory_bytes: 16884
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    "2 2" => "2",
    "1 10" => "10",
    "10 8" => "322828856"
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: u32,
        k: u32,
    }

    let ans = k * (k - 1).pow(n - 1);
    ans.to_string()
}

Measured memory_bytes: 4352
N = int(input())
A = [int(i) for i in input().split()]
A.sort()

l = 0
size = 0

for i in range(N - 1):
    size += A[i]

    if A[i + 1] > 2 * size:
        l = i + 1

ans = N - l

print(ans)

Measured memory_bytes: 14276
N, K = map(int, input().split())
A = list(map(int, input().split()))
a = A[0]
b = A[K-1]
ans = 0
if a*b < 0:
    ans = abs(min(-a, b)*2)+abs(max(-a, b))
else:
    ans = max(abs(a), abs(b))
for i in range(1, N-K+1):
    tmp = 0
    a = A[i]
    b = A[i+K-1]
    if a*b < 0:
        tmp = abs(min(-a, b)*2)+abs(max(-a, b))
    else:
        tmp = max(abs(a), abs(b))
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 14568
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // 標準入力からデータを読み込む準備
        Scanner sc = new Scanner(System.in);
        // 最初の文字の固まりを整数値と想定して読み込む
        int x = sc.nextInt();
        int answer = x*x*x;
        System.out.println(answer);
        sc.close();
    }
}


Measured memory_bytes: 26340
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

#define MAX_N 200000
int n;
int arr[MAX_N];
int all;

int main() {
    cin >> n;
    rep(i, n) {
        cin >> arr[i];
        all ^= arr[i];
    }
    rep(i, n) { cout << (all ^ arr[i]) << endl; }
    return 0;
}

Measured memory_bytes: 4400
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
using ll = long long;
#define mod  1000000007

#define whole(a) (a).begin(),(a).end()
#define rwhole(a) (a).rbegin(),(a).rend()

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define each(itr,ds) for(auto itr=(ds).begin();itr!=(ds).end();itr++)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";each(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";each(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm,char t){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,char t,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);if(t=='\n') cerr<<"  "<<name<<"\t: "<<x<<t;else cerr << name<<": "<<x<<","<<t;dump_f(nx,t,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,char t,Ts&&... ts){cerr<<"[ln: "<<ln<<"]"<<t;dump_f(nm,t,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\n',__VA_ARGS__)
#define dl(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\t',__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(whole(V),c))

int main() {
    ios::sync_with_stdio(false);//stdout<=>cout
    cin.tie(nullptr);//cin<=>cout


    int a,b,c;
    cin >>a>>b>>c;

    cout << ((a==b&&b!=c || a==c && b!=c || b==c && c!=a) ? "Yes" : "No") <<endl;


    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
const ll BetsuMOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	ll n, a, b;
	cin >> n >> a >> b;
	int now;
	cin >> now;
	ll ans = 0;
	rep(i, n - 1) {
		int d;
		cin >> d;
		ans += min((d - now) * a, b);
		now = d;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int h,w,m;
    cin>>h>>w>>m;
    vector<ll> hrow(h,0);
    vector<ll> wrow(w,0);
    vector<P> data;
    vector<ll> hb(m,0);
    vector<ll> wb(m,0);
    rep(i,m)
    {
        int ht,wt;
        cin>>ht>>wt;
        hrow[ht-1]++;
        wrow[wt-1]++;
        hb[i]=ht-1;
        wb[i]=wt-1;        
    }
    ll hindex=*max_element(hrow.begin(),hrow.end());
    ll windex=*max_element(wrow.begin(),wrow.end());

    ll ans=hindex+windex;
    ll num=count(hrow.begin(),hrow.end(),hindex)*count(wrow.begin(),wrow.end(),windex);
    rep(i,m)
    {
        if((wrow[wb[i]]+hrow[hb[i]])==ans)num--;
    }


    cout<<ans-(num==0);
}


Measured memory_bytes: 12764
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
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;
}
using namespace std;
 

void solve(){
   int n;
   cin>>n;
   int d,ans=0,mmin=24;
   map<int,int>mp;
   rep(i,n){
       cin>>d;
       if(d==0){
           cout<<0<<"\n";
           return;
       }
       mmin=min(mmin,d);
       mp[d]++;
   }
   vector<int>v;
   if(n>24){
       cout<<0<<"\n";
       return ;
   }
   for(auto x:mp){
       if(x.second>2){
           cout<<0<<"\n";
           return;
       }
       rep(i,x.second)v.pb(x.first);
   }
   for(auto x:mp){
       if(x.first==1){
           cout<<1<<"\n";
           return;
       }
   }
   v.pb(0);
   vector<int>w(n+1);
   for(int i=0;i<(1<<n);++i){
       rep(j,n+1){
           if((1<<j)&i)w[j]=24-v[j];
           else w[j]=v[j];
       }
       int minv=30;
       rep(j,n){
           for(int k=j+1;k<n+1;++k){
               minv=min(minv,abs(w[j]-w[k]));
           }
       }
       ans=max(ans,minv);
   }
   cout<<min(mmin,ans)<<"\n";
}
 
 
signed main(){
	ios::sync_with_stdio(false);
        cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;
using System.Numerics;
using System.Linq;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine(); //標準入力
            string[] str2 = str.Split(' ');
            int n = int.Parse(str2[0]);
            int x = int.Parse(str2[1]);
            int[] syouhi = new int[n];

            for(int i = 0; i < n; i++)
            {
                syouhi[i] = int.Parse(Console.ReadLine());
            }

            int saiteisyouhi = syouhi.Sum();

            if (saiteisyouhi > x)
            {
                Console.WriteLine(0);
                return;
            }

            int kosuu = n;
            int saiyasukakaku = syouhi.Min();
            x -= saiteisyouhi;
            int count = (int)(x / saiyasukakaku);


            //syouhi = 91;

            //int count = (int)(x / syouhi);
            Console.WriteLine(n + count);
        }
    }
}


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

template <typename T> class Segment_Tree {
private:
    int n; // n = ????????°???2*n-1 = ???????????°
    std::vector<T> SegTree;

public:
    Segment_Tree(int n_) {
	n = 1;
	while( n < n_ )  n *= 2;
	SegTree = std::vector<T>(2*n-1, 0);
    }
    
    void update(int k, T a) {
	k += n - 1; // ??????index
	SegTree[k] += a;
	while( k > 0 ) { // ????????§?????????????????´??°
	    k = (k-1) / 2;
	    SegTree[k] += a; // ????????????
	}
    }

    T range_query(int a, int b) { // [a,b)?????????????§£
	return query(a,b,0,0,n);
    }

    // [a,b)??????????±?????????¢??°
    // k:?????????index???l,r:????????????????????????????????????[l,r)
    // ?????£?????????????????? query(a,b,0,0,n) ????????¶
    T query(int a, int b, int k, int l, int r) {
	if( r <= a or  b <= l ) return 0;    // ?????????????????§??????
	if( a <= l and r <= b ) return SegTree[k]; // [a,b)???[l,r)????????¨???????????????????????´???

	T vl = query(a,b,k*2+1,l,(l+r)/2);
	T vr = query(a,b,k*2+2,(l+r)/2,r);
	return vl+vr;
    }

    void dump() {
	cout << "Tree : ";
	for( int i=0; i<n; i++ )
	    cout << SegTree[i] << " ";
	cout << endl;
    }
};



int main() {

    int n,q;
    cin >> n >> q;
    Segment_Tree<long long > seg(n);

    for( int i=0; i<q; i++ ) {
	long long c,x,y; cin >> c >> x >> y;
	if(c == 0)
	    seg.update(x-1,y);
	else
	    cout << seg.range_query(x-1,y) << endl;
    }
}

Measured memory_bytes: 7004
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<numeric>
#include<queue>
#include<string>
#include<sstream>

using namespace std;


int main(void) {

  int day[11] = {0, 20, 19, 20, 19, 20, 19, 20, 19, 20, 19};
  int total = 195;

  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    int y, m, d;
    cin >> y >> m >> d;
    int ans = 0;
    while(true){
      if( y == 1000 && m == 1 && d == 1 ) break;

      d++;
      if( y % 3 == 0 ) d %= 20 + 1;
      else d %= day[ m ] + 1;

      if( d == 0 ){
        d++;
        m++;
        m %= 11;
        if( m == 0 ){
          m++;
          y++;
        }
      }
      ans++;
    }
    cout << ans << endl;
  }

  return 0;
}










//

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin>>s;
    if(s=="SUN")    cout<<7<<endl;
    if(s=="SAT")    cout<<1<<endl;
    if(s=="FRI")    cout<<2<<endl;
    if(s=="THU")    cout<<3<<endl;
    if(s=="WED")    cout<<4<<endl;
    if(s=="TUE")    cout<<5<<endl;
    if(s=="MON")    cout<<6<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, T;
  cin >> S >> T;
if(S.size()+1 == T.size() && S.compare(0, S.size(), T, 0, S.size()) == 0){
  cout << "Yes" << endl;
  }
      else {
        cout << "No" << endl;
      }
}
      

Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

#define sd(n) scanf("%lld",&n) == 0
#define sl(n) scanf("%I64d",&n) == 0
#define ss(n) scanf("%s",n) == 0
#define sc(n) scanf(" %c",&n) == 0

#define pd(x) printf("%d", x)
#define ps(x) printf("%s", x)
#define pl(x) printf("%lld", x)

#define rep(i, begin, end) for (decltype(begin) i = begin; i < end; i++)
#define revrep(i, begin, end) for (decltype(begin) i = end - 1; i >= begin; i--)
#define all(a) a.begin(), a.end()


using namespace std;

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

struct bottle {
	ll vol, cost;
};

bottle bottles[4];

bool comp(bottle a, bottle b) {
	return (double)a.cost / (double)a.vol < (double)b.cost / (double)b.vol;
}

int main() {

	bottles[0] = { 1, 0 };
	bottles[1] = { 2, 0 };
	bottles[2] = { 4, 0 };
	bottles[3] = { 8, 0 };

	sd(bottles[0].cost), sd(bottles[1].cost), sd(bottles[2].cost), sd(bottles[3].cost);

	ll n;
	sd(n);
	n *= 4;

	sort(bottles, bottles + 4, comp);
	int i = 0;
	ll cost = 0;
	while (n > 0) {
		if (bottles[i].vol > n) {
			i++;
		}
		else {
			n -= bottles[i].vol;
			cost += (ll)bottles[i].cost;
		}
	}

	pl(cost);
}

Measured memory_bytes: 256
class Dice:
    def __init__(self,top,front,right,left,back,bottom):
        self.top, self.bottom=top,bottom
        self.right, self.left=right,left
        self.front, self.back=front,back
    def turn(self,order):
        if order=="N":
            self.top,self.front,self.bottom,self.back=self.front,self.bottom,self.back,self.top
        if order=="S":
            self.top,self.front,self.bottom,self.back=self.back,self.top,self.front,self.bottom
        if order=="E":
            self.top,self.right,self.bottom,self.left=self.left,self.top,self.right,self.bottom
        if order=="W":
            self.top,self.right,self.bottom,self.left=self.right,self.bottom,self.left,self.top

num=map(int,raw_input().split())
dice=Dice(num[0],num[1],num[2],num[3],num[4],num[5])
order=raw_input()
for i in order:
    dice.turn(i)
print dice.top


Measured memory_bytes: 4684
#include <stdio.h>
//  SUN,MON,TUE,WED,THU,FRI,SAT
int main()
{
  int d = 0;
  char s[5];
  scanf("%s", s);
  switch(s[0]) {
  case 'S':
    if(s[1]=='U') {
      d = 7;
    } else {
      d = 1;
    }
    break;
  case 'M':
    d = 6;
    break;
  case 'T':
    if(s[1]=='U') {
      d = 5;
    } else {
      d = 3;
    }
    break;
  case 'W':
    d = 4;
    break;
  case 'F':
    d = 2;
    break;
  default:
    d = 99999;
  }
  printf("%d\n", d);
  return 0;
}


Measured memory_bytes: 1708
#include <bits/stdc++.h>
	using namespace std;
	#define IOS ios::sync_with_stdio(false), cin.tie(0)
	#define REP(i, n) for (int i = 0; i < n; i++)
	#define FOR(i, a, b) for (int i = a; i < b; i++)
	#define ALL(x) (x).begin(), (x).end()
	#define dump(x) cout << (x) << endl
	#define LMAX 9223372036854775807LL
	#define LMIN -9223372036854775807LL

	using ll = long long;
	template<typename T>
	using vec = vector<T>;
	using P = pair<ll, ll>;

	template <typename A, size_t N, typename T>
	void Fill(A (&array)[N], const T &val){
		fill((T *)array, (T *)(array + N), val);
	}
	
	const ll INF = 1e16;
	const ll MOD = 1e9 + 7;

	//int dx[4] = {1,0,-1,0};
	//int dy[4] = {0,1,0,-1};
	//ll pas[51][52];
	
	signed main(){
		IOS;
		int n;
		cin >> n;
		ll unko;
		ll homo;
		for(int i = 1;i <= n;i++){
			int j = i * (i + 1) / 2;
			if(j >= n){
				unko = i;
				homo = j; 
				break;
			}
		}
		ll chokudai = homo - n;
		for(int i = 1;i <= unko;i++){
			if(i != chokudai)dump(i);
		}
	}

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

using namespace std;

int rs(vector<int> a) {
    int cnt = 0;
    int n = a.size();
    int m = n + 1;
    for (int i = 0; i < n; ++i) {
        if (a[i] < m) {
            cnt++;
            m = a[i];
        }
    }
    return cnt;

}
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    cout << rs(a) << endl;

    return 0;
}



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

int main() {
  int n, a, b;
  cin >> n >> a >> b;

  int ab = b-a;
  if (ab%2 == 1){
    cout << "Borys" << endl;
  }
  else{
    cout << "Alice" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cmath>
#include<deque>
#define debug cout<<"ok"<<endl
typedef long long ll;
const int maxn=1e7+10;
const int mod=1e9+7;
using namespace std;
string s;
bool flag[maxn];
int main()
{
    memset(flag,false,sizeof(flag));
    ios::sync_with_stdio(false);
    cin>>s;
    for(int i=0;i<=s.length();i++)
    {
        if(s[i]=='C')flag[0]=true;
        if(flag[0]&&s[i]=='F')flag[1]=true;
    }
    if(flag[1])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 9984
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
 
int main(void){
    char s[120],t[120],tmp[2],u[120];
    scanf("%s%s",s,t);
    for (int i=0; i<strlen(s); i++){
        if (strcmp(s,t)==0){
            printf("Yes\n");
            return 0 ;
        } else {
            tmp[0]=s[0];
            strcpy(u,s);
            strncpy(s,u+1,strlen(s)-1);
            s[strlen(s)-1]=tmp[0];
            s[strlen(s)]='\0';
        }
    }
    printf("No\n");
	return 0 ;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define repe(i,n) for(int i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(int i = a ; i < b ; i++)
#define repeb(i,a,b) for(int i = a ; i <= b ; i++)
#define rfor(i,n,a) for(int i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair<int,int> 
#define pll pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r){
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

ll nCr(ll n, ll r) { 
    ll res = 1; 
    if (r > n - r) {
        r = n - r; 
    }
    rep(i,r) { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
    return res; 
}

bool isPrime(long long n)
{
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
 
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
 
    return true;
}


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

void solve() {

	ll n, num = 0;
	cin >> n;
	vector<ll> ans;
	ll a[n];

	rep(i,n) {
		cin >> a[i];
		if(i != 0) {
			num ^= a[i];
		}
	}

	ans.pb(num);

	repb(i,1,n) {
		num = num ^ a[i-1] ^ a[i];
		ans.pb(num);
	}

	for(auto it : ans) {
		p0(it);
	}

	// cout << "\n";
}


int main()
{
	fastio;
	solve();
	return 0;
}

Measured memory_bytes: 6756
#include <iostream>
#include <string>
#include <map> //map<string, int> cnt; key とvalue
#include <set>//  set<int> s;
#include <cstdlib>  // abs() for integer
#include <vector>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
using namespace std;
using ll = long long;
/*
g++ -std=c++11 
*/
int main(){
  ll x,tmp,cnt = 0;
  cin >> x;
  tmp = 100;
  while(tmp < x) {
    cnt++;
    tmp += tmp/100;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3112
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):
    def combination(n, r, mod=10**9+7):
        n1, r = n+1, min(r, n-r)
        numer = denom = 1
        for i in range(1, r+1):
            numer = numer * (n1-i) % mod
            denom = denom * i % mod
        return numer * pow(denom, mod-2, mod) % mod
    
    
    from collections import defaultdict
    d = defaultdict(int)
    for i in range(1,N+1):
        s = str(i)
        d[int(s[0]+s[-1])] += 1

    ans = 0


    # for k, v in d.items():
    #     ans +=  combination(v, 2)
    for i in range(10):
        for j in range(10):
            ans += d[int(str(i)+str(j))]*d[int(str(j)+str(i))]

    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())



N,M = inpl()
dl = []
for d in range(1,int(math.sqrt(M))):
    if M%d == 0:
        dl.append(d)
        dl.append(M//d)

dl.sort()
ans = 1
for p in dl:
    if N*p <= M:
        ans = p
    else:
        break

print(ans)


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

int main()
{
  int n,m;
  scanf("%d%d",&n,&m);
  static vector<int> e[100000];
  for(int i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  int q;
  scanf("%d",&q);
  static int v[100000],d[100000],c[100000];
  for(int i=0;i<q;i++){
    scanf("%d%d%d",v+i,d+i,c+i);
    v[i]--;
  }
  static int V[100000][11];
  for(int i=0;i<n;i++){
    for(int j=0;j<=10;j++){
      V[i][j]=-1;
    }
  }
  for(int t=q-1;t>=0;t--){
    int s=v[t],dt=d[t];
    static queue<pair<int,int> > Q;
    if(V[s][dt]==-1){
      Q.push(make_pair(s,dt));
      V[s][dt]=t;
    }
    while(!Q.empty()){
      int i=Q.front().first,dd=Q.front().second;
      Q.pop();
      if(dd==0){
	continue;
      }
      for(int x=0;x<e[i].size();x++){
	int j=e[i][x];
	if(V[j][dd-1]==-1){
	  V[j][dd-1]=t;
	  Q.push(make_pair(j,dd-1));
	}
      }
    }
  }
  for(int i=0;i<n;i++){
    int ci=-1;
    for(int j=0;j<=10;j++){
      ci=max(ci,V[i][j]);
    }
    printf("%d\n",ci==-1?0:c[ci]);
  }
  return 0;
}


Measured memory_bytes: 12456
Q, H, S, D = map(int, input().split())
N = int(input())

price = [(8 * Q, 0.25), (4 * H, 0.5), (2 * S, 1.0), (D, 2.0)]
price.sort()

res = 0
if N % 2 == 0:
    res += N // 2 * price[0][0]
else:
    res += (N - 1) // 2 * price[0][0]
    for p in price:
        if p[1] == 2.0:
            continue
        res += p[0] // 2
        break

print(int(res))


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll W, H, x, y;
    cin >> W >> H >> x >> y;

    long double S = W * H * 0.5;
    cout << setprecision(10) << S << " ";
    if(x * 2 == W && y * 2 == H) _PR(1);
    else _PR(0);

    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 rrep(i, n) for (int i=1; i<n; i++)
using vi = vector<int>;

int main(){
    string s;
    int count = 0, max = 0;
    cin >> s;
    for (char x : s){
        if (x == 'R')count += 1;
            if (max < count)max = count;
        else count = 0;
    }
    cout << max << endl;

    

    return 0;
}

Measured memory_bytes: 3620
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include <fstream>
#include<unordered_set>
#include<stack>
#include <map>
#include<unordered_map>
#include<time.h>
#include <chrono>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;
#define MAX 1000001 
#define M 998244353
ll inverse(ll n)
{
	ll modu = M;
	ll m = modu;
	ll a = 0, b = 1;
	if (modu == 1)
		return 0;
	while (n > 1)
	{
		ll quo = n / modu;
		ll temp = modu;
		modu = n % modu, n = temp;
		temp = a; 
		a = b - (quo * a);
		b = temp;
	}
	if (b < 0)
		b += m;
	return b;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin >> n;
	ll ans = 0;
	ans += n / 2;
	ans += n % 2;
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n; ll l; cin >> l;
	ll a[100000];
	rep(i, n) {
		cin >> a[i];
	}
	int chk = -1;
	rep(i, n - 1) {
		if (a[i] + a[i + 1] >= l) {
			chk = i; break;
		}
	}
	if (chk == -1) {
		cout << "Impossible" << endl;
	}
	else {
		cout << "Possible" << endl;
		rep(i, chk) {
			cout << i + 1 << endl;
		}
		for (int i = n - 2; i > chk; i--) {
			cout << i + 1 << endl;
		}
		cout << chk+1 << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  vector<vector<ll>> A(N, vector<ll>(N));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      scanf("%lld", &A[i][j]);
    }
  }

  vector<vector<bool>> need(N, vector<bool>(N, true));
  for (int k = 0; k < N; ++k) {
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        if (i == k or j == k) { continue; }
        ll val = A[i][k] + A[k][j];
        if (A[i][j] == val) {
          need[i][j] = false;
        }
        else if (A[i][j] > val) {
          printf("-1\n");
          return 0;
        }
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      if (need[i][j]) { ans += A[i][j]; }
    }
  }
  printf("%lld\n", ans);
  return 0;
}


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

//#include "hash.h"
class Hash {
private:
	static const int MOD = 1046527;
	
	inline int my_ctoi(char c) {
		if (c == 'A') return 0;
		if (c == 'C') return 1;
		if (c == 'G') return 2;
		if (c == 'T') return 3;
		return 4;
	}
	
	inline int hash1(int key) {
		return key % MOD;
	}
	
	inline int hash2(int key) {
		return 1 + (key % (MOD - 1));
	}
	
public:
	Hash() {}
	
	
	int getKey(const string& str) {
		int key = 0;
		size_t len = str.size();
		for (size_t i = 0; i < len; ++i) key = 5 * key + my_ctoi(str[i]);
		return key;
	}
	
	int getHash(int key, int collision_count) {
		return (hash1(key) + collision_count * hash2(key)) % MOD;
	}
};

class Dictionary {
private:
	string NIL;
	vector< string > table;
	
	Hash hash;
	
public:
	Dictionary() {
		NIL = "#";
		table.assign(1046527, NIL);
	}
	
	void insert(string& str) {
		int key = hash.getKey(str);
		int collision_count = 0;
		
		while (1) {
			int hs = hash.getHash(key, collision_count);
			
			if (table[hs] == NIL) {
				table[hs] = str;
				break;
			} else {
				++collision_count;
			}
		}
	}
	
	bool find(string& str) {
		int key = hash.getKey(str);
		int collision_count = 0;
		
		while (1) {
			int hs = hash.getHash(key, collision_count);
			
			if (table[hs] == str) {
				return true;
			} else if (table[hs] == NIL) {
				return false;
			} else {
				++collision_count;
			}
		}
	}
};

int main() {
	Dictionary dict;
	
	int n;
	cin >> n;
	
	char buf1[128], buf2[128];
		
	for (int i = 0; i < n; ++i) {
		scanf("%s %s", buf1, buf2);
		
		string op(buf1), str(buf2);
		
		if (op == "insert") {
			dict.insert(str);
		}
		
		if (op == "find") {
			if (dict.find(str)) puts("yes");
			else puts("no");
		}
	}
}

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

int main() {
    string s;
    cin >> s;
    int y = 0;
    int m = 0;
    int d = 0;
    rep(i,4) {
        s[i] -= '0';
        y += s[i] * pow(10,3-i);
    }
    rep(i,2) {
        s[5+i] -= '0';
        m += s[5+i] * pow(10,1-i);
    }
    rep(i,2) {
        s[8+i] -= '0';
        d += s[8+i] * pow(10,1-i);
    }
    if (y < 2019) {
        cout << "Heisei" << endl;
        return 0;
    }
    else if (y == 2019 && m <= 4) {
        cout << "Heisei" << endl;
        return 0;
    }
    else cout << "TBD" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n;
  cin>>n;
  REP(i,2){
    if(n%10==9){
      cout<<"Yes"<<endl;
      return 0;
    }else{
      n /= 10;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;

int main ()
{
    int numro , numco , numro2 , numco2 , res1 = 0 , res2 = 0 ;

    cin >> numro >> numco ;
    cin >> numro2 >> numco2 ;

    res1 = numro - numro2 ;
    res2 = numco - numco2 ;

    cout <<  res1 * res2 << endl ;


    return 0 ;
}


Measured memory_bytes: 256