akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

const int MX = 307;
long double DP[MX + 5][MX + 5][MX + 5];

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

    int numDishWith1Piece = 0, numDishWith2Piece = 0, numDishWith3Piece = 0;
    for (int dish = 1; dish <= N; dish++) {
        int pieces;
        cin >> pieces;
        
        if (pieces == 1) numDishWith1Piece++;
        else if (pieces == 2) numDishWith2Piece++;
        else numDishWith3Piece++;
    }

    for (int dishWith3Piece = 0; dishWith3Piece <= numDishWith3Piece; dishWith3Piece++)
        for (int dishWith2Piece = 0; (dishWith2Piece + dishWith3Piece) <= (N - numDishWith1Piece); dishWith2Piece++)
            for (int dishWith1Piece = 0; (dishWith1Piece + dishWith2Piece + dishWith3Piece) <= N; dishWith1Piece++) {
                if (dishWith1Piece == 0 && dishWith2Piece == 0 && dishWith3Piece == 0) continue;

                long double wait = 1.0 * N / (dishWith1Piece + dishWith2Piece + dishWith3Piece);
                long double pi = 1.0 * dishWith1Piece / (dishWith1Piece + dishWith2Piece + dishWith3Piece);
                long double pj = 1.0 * dishWith2Piece / (dishWith1Piece + dishWith2Piece + dishWith3Piece);
                long double pk = 1.0 * dishWith3Piece / (dishWith1Piece + dishWith2Piece + dishWith3Piece);

                if (dishWith1Piece) DP[dishWith1Piece][dishWith2Piece][dishWith3Piece] += pi * DP[dishWith1Piece - 1][dishWith2Piece][dishWith3Piece];
                if (dishWith2Piece) DP[dishWith1Piece][dishWith2Piece][dishWith3Piece] += pj * DP[dishWith1Piece + 1][dishWith2Piece - 1][dishWith3Piece];
                if (dishWith3Piece) DP[dishWith1Piece][dishWith2Piece][dishWith3Piece] += pk * DP[dishWith1Piece][dishWith2Piece + 1][dishWith3Piece - 1];

                DP[dishWith1Piece][dishWith2Piece][dishWith3Piece] += wait;
            }

    cout.precision(14);
    cout << fixed << DP[numDishWith1Piece][numDishWith2Piece][numDishWith3Piece];
    return 0;
}

Measured memory_bytes: 456832
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (sc.hasNext()) {
			char query = sc.next().charAt(0);
			String tree1 = sc.next();
			String tree2 = sc.next();
			Node root = new Node();
			parse(tree1, 0, root, 1);
			parse(tree2, 0, root, 2);
			root.write(query == 'u');
			System.out.println();
		}
	}

	static int parse(String tree, int pos, Node cur, int val) {
		cur.val += val;
		++pos;
		if (tree.charAt(pos) == '(') {
			if (cur.left == null) {
				cur.left = new Node();
			}
			pos = parse(tree, pos, cur.left, val);
		}
		++pos;
		if (tree.charAt(pos) == '(') {
			if (cur.right == null) {
				cur.right = new Node();
			}
			pos = parse(tree, pos, cur.right, val);
		}
		return pos + 1;
	}

	static class Node {
		Node left;
		Node right;
		int val = 0;

		boolean match(boolean union) {
			if (union) {
				return this.val > 0;
			} else {
				return this.val == 3;
			}
		}

		void write(boolean union) {
			if (!match(union)) return;
			System.out.print("(");
			if (this.left != null) this.left.write(union);
			System.out.print(",");
			if (this.right != null) this.right.write(union);
			System.out.print(")");
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int count(int N)
{
        int cnt = 0;
        while (N)
        {
                cnt += N % 10;
                N /= 10;
        }
        return cnt;
}

int main()
{
        string N;
        cin >> N;
        vector<int> alpha(26);
        rep(i, N.size()) alpha[N[i] - 'a']++;
        rep(i, 26)
        {
                if (alpha[i])
                        continue;
                else
                {
                        cout << char(i + 'a') << endl;
                        return 0;
                }
        }
        cout << "None" << endl;

        return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// Shojin
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			long k = sc.nextLong();
			long[] A = new long[n];
			long max = 0;
			long min = 0;
			for (int i = 0; i < n; i++) {
				long next = sc.nextLong();
				A[i] = next;
				max = Math.max(next, max);
			}
			while (max - min > 1) {
				long mid = (max + min) / 2;
				long cnt = 0;
				boolean ok = true;
				for (int i = 0; i < n; i++) {
					long div = A[i] / mid;
					if (A[i] % mid == 0) {
						cnt += Math.max(div - 1, 0);
					} else {
						cnt += div;
					}
					if (cnt > k) {
						min = mid;
						ok = false;
						break;
					}
				}
				if (ok) {
					max = mid;
				} else {
					min = mid;
				}
			}
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 61492
N = int(input())
L = [int(x) for x in input().split()]
sum = 0
for i in range(N):
    for j in range(i+1,N):
        if L[i] == L[j]:
            continue
        for k in range(j+1,N):
            if L[i] == L[k] or L[j] == L[k]:
                continue
            if L[i]+L[j]>L[k] and L[i]+L[k]>L[j] and L[k]+L[j]>L[i]:
                sum += 1
print(sum)


Measured memory_bytes: 9200
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.ArrayLong(3);

            var can = a[2] * a[1];
            
            Console.WriteLine(can>=a[0]?"Yes":"No");
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 27500
import sys
def main():
    N = int(input())
    H = list(map(int, input().split()))
    if N == 1:
        print('Yes')
        sys.exit()
    H_edit = [0]*N
    H_edit[0] = H[0] - 1
    for i in range(1, N):
        h_prev = H_edit[i-1]
        h = H[i]
        H_edit[i] = h-1 if h_prev+1 <= h else h
    for i in range(N-1):
        if H_edit[i] > H_edit[i+1]:
            print('No')
            break
    else:
        print('Yes')
main()

Measured memory_bytes: 14396
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}
int main(){
    cout << fixed << setprecision(10);
    ll n;
    cin >> n;
    ll ans = 1;
    map<ll ,ll> mll;
    rep(i, n ){
        for(auto u : prime_factorize(i + 1)){
            mll[u.first] += u.second;
        }
    }
    for(auto u : mll){
        //cout << u.first << " " << u.second << endl;
        ans *= (u.second + 1);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define sz(v) ll(v.size())


void solve(ll N, ll x, vector<ll> a){
    ll counter = 0;
    rep(i, N - 1) {
        if (a[i] + a[i + 1] > x) {
            counter += a[i] + a[i + 1] - x;
            a[i+1] = max(ll(0), - a[i] + x);
        }
    }
    cout << counter << endl;
}

int main() {
    ll N;
    scanf("%lld",&N);
    ll x;
    scanf("%lld",&x);
    vector<ll> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, x, move(a));
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
inline i64 gcd(i64 a, i64 b) { if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline vi32 plist(i32 n) { vi32 f(n, 1); f[0] = f[1] = 0; repi(i, 2, n) for (int j = i * 2; j < n; j += i) f[j] = 0; return f; }
inline bool isprime(i32 n) { if (n < 2) return 0; for (i32 i = 2; i * i <= n; i++) if (n % i == 0) return 0; return 1; }
template<class T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<class T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<class T> inline bool amax(T &x, T y) { if (x >= y) return 0; x = y; return 1; }
template<class T> inline bool amin(T &x, T y) { if (x <= y) return 0; x = y; return 1; }
template<class T> inline i64 lbi(vector<T> &v, T e) { return lower_bound(all(v), e) - v.begin(); }
template<class T> inline i64 ubi(vector<T> &v, T e) { return upper_bound(all(v), e) - v.begin(); }
template<class T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }

int main() {
  ioinit();
  int n;
  cin >> n;
  vi32 a(n);
  rep(i, n) cin >> a[i];
  int mn = 1e9 + 1;
  int mns = 0;
  i64 sum = 0;
  rep(i, n) {
    if (a[i] < 0) mns++;
    amin(mn, abs(a[i]));
    sum += abs(a[i]);
  }
  if (mns % 2 == 1) {
    cout << sum - mn * 2 << '\n';
  } else {
    cout << sum << '\n';
  }
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),k2=nxt();
    vector <pair<int,int> > v1(n),v2(n);
    unsigned long long int test=4e18;
    for(int i=0;i<n;i++)
    {
        cin>>v1[i].first>>v1[i].second;
        v2[i]={v1[i].second,v1[i].first};
    }
    sort(all(v1));
    sort(all(v2));
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
            for(int k=0;k<n;k++)
                for(int m=k+1;m<n;m++)
                {
                    int x1=v1[i].first,x2=v1[j].first,y1=v2[k].first,y2=v2[m].first;
                    int c=0;
                    for(auto i:v1)
                    {
                        if(i.first>=x1&&i.first<=x2&&i.second>=y1&&i.second<=y2)
                        c++;  
                    }
                    if(c>=k2)
                    {
                        unsigned long long int temp=x2-x1;
                        temp*=(y2-y1);
                        if(temp<test)
                            test=temp;
                    }
                }
        cout<<test<<endl;
    
    
    
    return 0;   
}




 
 


Measured memory_bytes: 256
def tapdance(s):
    for i in range(len(s)):
        if i % 2 == 0:
            if s[i] == 'L':
                return 'No'
        else:
            if s[i] == 'R':
                return 'No'
    return 'Yes'
s = input()
print(tapdance(s))


Measured memory_bytes: 2940
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string str=Console.ReadLine();
      if((str.IndexOf("a")!=-1)&&(str.IndexOf("b")!=-1)&&(str.IndexOf("c")!=-1)){
        Console.WriteLine("Yes");
      }
         else{
           Console.WriteLine("No");
         }

    }
  }
}

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

int prime[1000001];
bool is_prime[1000001];

int res(int n)
{
	int p=0;
	for(int i=0;i<n+1;i++){
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for(int i=2;i<n+1;i++){
		if(is_prime[i]){
			prime[p++] = i;
			for(int j=2*i;j<n+1;j+=i){
				is_prime[j] = false;
			}
		}
	}
	return p;
}
int binsearch(int key,int left,int right)
{
	while(left<=right){
		int middle = (left+right)/2;
		if(key == prime[middle])
			return 1;
		else if(key<prime[middle])
			right = middle-1;
		else
			left = middle+1;
	}
	return 0;
}
int main()
{
	int n;
	int count;
	int p = res(1000000);
	while(cin >> n){
		if(n==0)
			break;
		count = 0;
		for(int i=0;i<p;i++){
			if(prime[i] < n/2+1)
				count+=binsearch(n-prime[i],i,p);
			else
				break;
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 2148
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N = lread();
    auto A = aryread();
    long[long] D;
    foreach (a; A)
    {
        D[a] = (a in D) ? D[a] + 1 : 1;
    }
    long ans;
    foreach (k, v; D)
    {
        if (v < k)
        {
            ans += v;
        }
        else
        {
            ans += v - k;
        }
    }
    writeln(ans);
}


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

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  ll ans = 0;
  rep(i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    auto itr = mp.find(s);
    if ( itr != mp.end()) {
      ans += mp[s];
      mp[s] += 1;
    } else {
      mp[s] = 1;
    }
  }
  cout << ans << '\n';
  return 0;
}

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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<63;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << 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; }

int main(void){
    ll k,q; cin >> k >> q;
    vector<ll> dd(k); REP(i,k) cin >> dd[i];

    REP(j,q){
        ll n,x,m; cin >> n >> x >> m;
        vector<ll> d(k); REP(i,k) d[i] = dd[i] % m;
        ll n_d0 = 0; REP(i,k) if(d[i] == 0) n_d0++;
        n_d0 *= (n-1) / k;
        REP(i,(n-1)%k) if(d[i] == 0) n_d0++;
        ll sd = 0; REP(i,k) sd += d[i];
        ll an_1 = x + ((n-1) / k) * sd;
        REP(i,(n-1)%k) an_1 += d[i];
        ll n_d = an_1 / m - x / m;
        ll ans = n-1 - n_d0 - n_d;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
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;
}
template <class T> inline void in(T& a) { cin >> a; }
template <class T, class U> inline void in(T& a, U& b) { cin >> a >> b; }
template <class T, class U, class V> inline void in(T& a, U& b, V& c) {
	cin >> a >> b >> c;
}
template <class T> inline void out(T a) { std::cout << a << endl; }
template <class T, class U> inline void out(T a, U b) {
	cout << a << ' ' << b << endl;
}
template <class T, class U, class V> inline void out(T a, U b, V c) {
	cout << a << ' ' << b << ' ' << c << endl;
}
#define inf 1e9
using ll = int64_t;
#define waru 1000000007

void Main() {
	int n, k;
	in(n, k);

	int num = 1;
	rep(i, n) 
	{
		if (k > num * 2 - num)
		{
			num *= 2;
		}
		else
		{
			num += k;
		}
	}

	out(num);

	return; 
}

int main() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int num[3];

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

    sort(num, num+3);
    
    for (int i = 0; i < 3; i++){
        printf("%d", num[i]);
        
        if (i == 2){
            printf("\n");
        }
        else {
            printf(" ");
        }
    }

    return 0;
}

Measured memory_bytes: 1044
package main

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

const mod = 998244353
const facNum = 300001

func main() {
	sc := newScanner(os.Stdin)
	a := sc.i()
	fmt.Println(a + (a * a) + (a * a * a))
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//------------------------------

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

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

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


Measured memory_bytes: 1776
fn rec(x: usize, v: &mut Vec<usize>) {
    if x == 1 {
        return;
    }

    let mut div = x;
    for i in 2..(x as f64).sqrt() as usize + 1 {
        if x % i == 0 {
            div = i;
            break;
        }
    }
    v[div] += 1;
    rec(x / div, v);
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let n: usize = buf.trim().parse().unwrap();
    let mut v = vec![0_usize; n + 1];
    for i in 2..n + 1 {
        rec(i, &mut v);
    }

    let mut ans = 1;
    for &i in v.iter() {
        ans *= i + 1;
        ans %= 1_000_000_007;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
/*
	Code written by Talant I.D.
*/
 
#include <bits/stdc++.h> 
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tiii;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define lb lower_bound 
#define ub upper_bound 
#define mp make_pair
#define mt make_tuple
#define mod ll(1e9+7)
#define eps double(1e-9)
#define PI 2*acos(0.0)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define curMod 998244353
 
inline bool isvowel(char ch){
	ch = tolower(ch);
	return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y');
}
 
inline bool isprime(int n){
	if(n < 2 || (n % 2 == 0 && n != 2))
		return false;
	for(int i = 3; i*i <= n; i += 2)
		if(n%i == 0) return false;
	return true;
}

int main(){
	do_not_disturb
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	ll n, m, i;
	cin >> n >> m;
	vector <ll> v(n);
	
	for(i = 0; i < n; i++){
		cin >> v[i];
	}
	
	ll lcm = v[0]/2;
	for(i = 1; i < n; i++){
		lcm = lcm/__gcd(lcm, v[i]/2)*(v[i]/2);
	}
	
	for(i = 0; i < n; i++){
		if(lcm % v[i] == 0){
			cout << 0;
			return 0;
		}
	}
	
	cout << m/lcm-m/(lcm*2);
	
	return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n, k;
  cin >> n;
  bool result = false;
  for(i = 0; i <= 25; i++)
    for(j = 0; j <= 15; j++)
      if(n == 4 * i + 7 * j)
        result = true;
  if(result)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

#print(A)

for _ in range(M):
    m = heapq.heappop(A)
    #print(m)
    heapq.heappush(A, -(-m // 2))
    #print(A)

print(-sum(A))


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int K;
    cin >> K;
    ll ans = 0;
    rep(i, K) {
        rep(j, K){
            ll x = gcd(i+1, j+1);
            rep(k, K) {
                ans += gcd(x, k+1);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long double a, b, h, m, ans;
main() {
  file("threesum");
  ios;
  cin >> a >> b >> h >> m;
  h = 30.0 * h + 0.5 * m;
  m = 6.0 * m;
  double angl = min(abs(360.0 - abs(h - m)), abs(h - m));
//  cerr << angl << "\n";
  double co = cos(angl * PI / 180.0);
  ans = sqrtl(a * 1.0 * a + b * 1.0 * b - 2.0 * a * b * 1.0 * co);
  cout << fixed << setprecision(12) << ans;
  return 0;
}
/**
359 1

358 2
*/


Measured memory_bytes: 4280
n, y=map(int, input().split())
a=y//10000
b=y//5000
c=y//1000

for i in range(c+1):
    for j in range(n+1-i):
        k=n-i-j
        if 0<=k<=a and 1000*i + 5000*j + 10000*k == y:
            print(k, j, i)
            exit()

print(-1, -1, -1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector> 
#include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;

int keta[25];
int b[MX];
signed main(){
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    rep(i,n) {
        cin >> a[i];
        sum ^= a[i];
    }

    rep(i,n) cout << (a[i]^sum) <<" " << flush;
    cout << "" << endl;


    return 0;
}


Measured memory_bytes: 5112
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int t = 0;
  for (int &x : a) {
    cin >> x;
    t ^= x;
  }
  for (int &x : a) {
    cout << (t ^ x) << " ";
  }
  cout << endl;
  return 0;
}



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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

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

int dp[3005];

int main() {
	int n;
	scanf("%d", &n);
	string s;
	cin >>s;
	for (int i=0 ; i<n ; i++) dp[i] = 1;
	for (int i=0 ; i<n-1 ; i++) {
		if (s[i] == '<') {
			int sum = 0;
			for (int k=n ; k>=0 ; k--) {
				int o = dp[k];
				dp[k] = sum;
				sum = (sum + o) % MOD;
			}
		} else {
			int sum = 0;
			for (int k=0 ; k<=n ; k++) {
				sum = (sum + dp[k]) % MOD;
				if (k>=n-i-1) dp[k] = 0;
				else dp[k] = sum;
			}
		}
		/*for (int i=0 ; i<=n ; i++) {
			cout <<dp[i]<<" ";
		}
		cout <<endl;*/
	}
	printf("%d\n", dp[0]);
	return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    double a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    double b=0;
    for(int i=0;i<n;i++) b+=1/a[i];
    printf("%.6f", 1/b);
}


Measured memory_bytes: 256
#hashing method
n=int(input())
dic=set()
for i in range(n):
    meirei,string=input().split()
    suuzi=string.replace("A","1").replace("C","2").replace("G","3").replace("T","4")
    num=int(suuzi)

    if meirei=="insert":
        dic.add(num)
    elif meirei=="find":
        if num in dic:
            print("yes")
        else:
            print("no")



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

MOD = 1000000007  # type: int

def solve(n: int, a: int, b: int):
    def combination_with_mod(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

    ans = pow(2, n, MOD)-combination_with_mod(n, a)-combination_with_mod(n, b)-combination_with_mod(n, 0)

    if ans < 0:
        print((MOD+ans)%MOD)
    else:
        print(ans%MOD)

    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
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(n, a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int a,b,c,d;
  a=0;
  b=0;
  c=0;
  d=0;
  vector<int> p(6);
  rep(i,6){
  cin>>p[i];
    if(p[i]==1)a++;
    if(p[i]==2)b++;
    if(p[i]==3)c++;
    if(p[i]==4)d++;
  }  
  
  cout << ((a==1&&b==1&&c==2&&d==2)||(a==1&&b==2&&c==1&&d==2)||
           (a==2&&b==1&&c==1&&d==2)||(a==1&&b==2&&c==2&&d==1)||
          (a==2&&b==1&&c==2&&d==1)||(a==2&&b==2&&c==1&&d==1)?"YES":"NO")<<endl;
  
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();
        if (a>=k)System.out.println((a-k)+" "+b);
        else if (a+b>=k)System.out.println(0+" "+(a+b-k));
        else System.out.println("0"+" "+"0");
    }
}


Measured memory_bytes: 38740
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		double n = scan.nextDouble();

		double output = 0;

		if (n == 1) {

			output = 1;

		} else if (n == 2) {

			output = 0.5;
		}

		if (n % 2 == 1) {

			output = ((int) (n / 2) + 1) / n;

		} else {

			output = (n / 2) / n;

		}

		System.out.println(output);
	}

}

Measured memory_bytes: 24532
import java.util.*;
public class Main {
	static char[] l = new char[] {'q','w','e','r','t','a','s','d','f','g','z','x','c','v','b'};
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			boolean isl = false;
			int counter = 0;
			String a = stdIn.next();
			if(a.equals("#")) break;
			if(isl(a.charAt(0))) isl = true;
			
			for(int i = 1; i < a.length(); i++) {
				boolean b = isl(a.charAt(i));
				if(isl && !b) {
					counter++;
					isl = false;
				}
				if(!isl && b) {
					counter++;
					isl = true;
				}
			}
			System.out.println(counter);
			
			
		}
	}
	public static boolean isl(char a) {
		for(int i = 0; i < l.length; i++) {
			if(l[i] == a) return true;
		}
		return false;
	}

}

Measured memory_bytes: 19920
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using ld = long double;
using namespace std;

ll memo[70][70];
ll comb( int x, int y ){
	if( memo[x][y] ) return memo[x][y];
	if( y == 0 || y == x ) return memo[x][y] = 1;
	return memo[x][y] = comb(x-1, y)+comb(x-1, y-1);
} 

int main(){
	int n, a, b; cin >> n >> a >> b;
	vector<ll> v(n);
	for( auto &i : v ) cin >> i;
	sort( v.begin(), v.end(), greater<ll>() );
	ll sum = 0;
	for( int i = 0; i < a; ++i ) sum += v[i];
	ld avr = (ld)sum/(ld)a;
	cout << fixed << setprecision(6) << avr << endl;
	ll target = v[a-1];
	if( v[0] != target ){
		int x = 0, y = 0;
		for( int i = 0; i < n; ++i ) if( v[i] == target ) ++x;
		for( int i = 0; i < a; ++i ) if( v[i] == target ) ++y;
		cout << comb(x, y) << endl;
	} else {
		int x = 0;
		ll ans = 0;
		for( int i = 0; i < n; ++i ) if( v[i] == target ) ++x;
		for( int i = a; i <= min(b, x); ++i ) ans += comb(x, i);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# ans

N = int(input())
H = list(map(int, input().split()))
cnt = 1

for i in range(N):
  flg = False
  for j in range(0, i):
    if H[j] <= H[i]:
      flg = True
    else:
      flg = False
      break
  if flg == True:
    cnt += 1
        
print(cnt)

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

#define mem(t, v)   memset ((t) , v, sizeof(t))
#define all(x)      x.begin(),x.end()
#define un(x)       x.erase(unique(all(x)), x.end())
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sl(n)       scanf("%lld", &n)
#define sll(a,b)    scanf("%lld %lld", &a, &b)
#define slll(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define D(x)        cerr << #x " = " << (x) << '\n'
#define DBG         cerr << "Hi" << '\n'
#define pb          push_back
#define PI          acos(-1.00)
#define xx          first
#define yy          second
#define eps         1e-9

typedef unsigned long long int ULL;
typedef long long int LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;


inline int setBit(int N, int pos) { return N=N | (1<<pos); }
inline int resetBit(int N, int pos) { return N= N & ~(1<<pos); }
inline bool checkBit(int N, int pos) { return (bool)(N & (1<<pos)); }

//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction
int A, B, C, D, E, F;
int vis[3010][3010];
void dfs(int sugar, int water)
{
    if(sugar + water > F)
        return;
    if(vis[sugar][water])
        return;
    vis[sugar][water] = true;
    int a = sugar, b = water + 100*A;
    dfs(a,b);
    a = sugar, b = water + 100*B;
    dfs(a,b);
    a = sugar + C, b = water;
    dfs(a,b);
    a = sugar + D, b = water;
    dfs(a, b);
}
int main()
{
//    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    sfff(A,B,C);
    sfff(D,E,F);
    dfs(0,0);
    double ans = 0;
    pii sltn = {0,0};
    for(int i = 0; i<=F; i++)
    {
        for(int j = 0; j<=F; j++)
        {
            if(vis[i][j] && (100*i) <= j * E)
            {
                double density = ((double)i)/(i+j);
                if((i*sltn.xx) >= (sltn.yy*(i+j)) )
                    sltn = {i+j,i};
            }
        }
    }
    cout << sltn.xx << " " << sltn.yy << endl;
    return 0;
}



Measured memory_bytes: 33792
/**
 * @File   : atcoder.cpp
 * @Author : pasnger 
 * @Date   : 13/9/2020, 5:10:33 pm 
 */

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

#define INF 2e18
#define int long long
#define f(i, a, b) for(int i=(a); i<(b); (i)++)
#define fe(i, a, b) for(int i=(a); i<=(b); (i)++)
#define rf(i, a, b) for(int i=(a); i>(b); (i)--)
#define rfe(i, a, b) for(int i=(a); i>=(b); (i)--)
#define ff(ele, cont) for(auto (ele): (cont))
#define pb push_back;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef set<int> si;
typedef multiset<int> msi;

const int mxn = 1e6+4;
const int mod = 1e9+7;
const double pi = acos(-1);

#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() {
  cerr << "]\n";
}
template<typename T, typename ...Args> void DBG(T first, Args... args) {
  cerr << first; if (sizeof...(args))cerr<<", "; DBG(args...);
}

/////////////////////////// GLOBAL ///////////////////////////

/////////////////////////// GLOBAL ///////////////////////////

void solve() {
  
  int arr[4];
  f(i, 0, 4) cin>>arr[i];
  int m = -INF;
  f(i, 0, 2){
    f(j, 2, 4){
      m = max(arr[i]*arr[j], m);
    }
  }
  cout<<m<<"\n";
}


int32_t main() {
  #ifndef ONLINE_JUDGE
  clock_t tStart = clock();
  freopen("in.txt", "r", stdin);
  //freopen("output.txt","w",stdout);
  #endif 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  // cin >> t;
  for (int tt=1;tt<=t;tt++) {
    //cout << "Case #"<<tt<<": ";
    solve();
  }
  #ifndef ONLINE_JUDGE
    cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
  #endif
}


Measured memory_bytes: 3648
#include <stdio.h>

const int Mod = 1000000007;

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

int main()
{
	int S;
	scanf("%d", &S);
	if (S <= 2) {
		printf("0\n");
		fflush(stdout);
		return 0;
	}
	
	int i, N = S * 3 / 2;
	long long fact[3001], fact_inv[3001];
	for (i = 1, fact[0] = 1; i <= N; i++) fact[i] = fact[i-1] * i % Mod;
	for (i = N - 1, fact_inv[N] = div_mod(1, fact[N], Mod); i >= 0; i--) fact_inv[i] = fact_inv[i+1] * (i + 1) % Mod;
	
	long long ans = 0;
	for (i = 1; i <= S / 3; i++) ans = (ans + fact[S-i*3+i-1] * fact_inv[i-1] % Mod * fact_inv[S-i*3]) % Mod;
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1776
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#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;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#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 INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int N;
long long h[100010];
long long dp[100010];

int main()
{
  int N;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> h[i];
  }
  for (int i = 0; i < 100010; ++i)
    dp[i] = INF;
  dp[0] = 0;
  for (int i = 1; i < N; ++i)
  {
    if (i == 1)
    {
      dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
    }
    else
    {
      dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
  }
  cout << dp[N - 1] << endl;
  return 0;
}

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

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


int main(){
   long double a,b,c,d,a1,a2,angle,ans;
   cout<<fixed<<setprecision(20);
   cin>>a>>b>>c>>d;
   a1=c*30+(float)d/2.0;
   a2=d*6;
   if(a1>a2) angle=(a1-a2);
   else angle=(a2-a1);
   if(angle>180.0) angle=360.0-angle;
   ans=sqrt(a*a+b*b-2*a*b*cos(M_PI*angle/180.0));
   cout<<ans;
   return 0;
}


Measured memory_bytes: 4176
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long X, Y;
    cin >> X >> Y;
    if(X % Y == 0){
        cout << -1 << endl;
        return 0;
    }
    cout << X << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
K = int(input())
N = len(s)
l = list(s)
abc = "abcdefghijklmnopqrstuvwxyz"
M = {}
for i in range(len(abc)):
  M[abc[i]] = i
for i in range(N):
  c = l[i]
  n = (26-M[c])%26
  if K >= n:
    l[i] = "a"
    K -= n
K = K%26
l[-1] = abc[(M[l[-1]]+K)%26]
print("".join(l))


Measured memory_bytes: 4212
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
string s, t;
int q, a[100010], b[100010];
int l1, r1, l2, r2;
signed main() {
	cin >> s >> t;
	rep(i, s.size()) {
		if (s[i] == 'A')a[i] = 1;
		else a[i] = 2;
		if (i)a[i] += a[i - 1];
		a[i] %= 3;
	}
	rep(i, t.size()) {
		if (t[i] == 'A')b[i] = 1;
		else b[i] = 2;
		if (i)b[i] += b[i - 1];
		b[i] %= 3;
	}
	cin >> q;
	rep(i, q) {
		cin >> l1 >> r1 >> l2 >> r2;
		l1--; r1--; l2--; r2--;
		int sh, th;
		if (l1)sh = (a[r1] - a[l1 - 1] + 3) % 3;
		else sh = a[r1];
		if (l2)th = (b[r2] - b[l2 - 1] + 3) % 3;
		else th = b[r2];
		if (sh == th)puts("YES");
		else puts("NO");
	}
}

Measured memory_bytes: 2432
#include<stdio.h>
void sort(int box[]){
	int i,j,temp;
	for(i=0;i<7;i++){
		for(j=7;j>i;j--){
			if(box[j]>box[j-1]){
				temp=box[j];
				box[j]=box[j-1];
				box[j-1]=temp;
			}
		}
	}
	
}
int main(void){
	int n,i,origin,box[10],max,min;
	scanf("%d",&n);
	while(n--){
		scanf("%d",&origin);
		max=0;min=0;
		for(i=0;i<8;i++){box[i]=origin%10;origin/=10;}
		sort(box);
		for(i=0;i<8;i++){max+=box[i];max*=10;}
		max/=10;
		for(i=7;i>=0;i--){min+=box[i];min*=10;}
		min/=10;
		printf("%d\n",max-min);
	}
	return 0;
}

Measured memory_bytes: 600