akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

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

signed main()
{
	int S;
	cin >> S;

	int a = S / 1000 % 10;
	int b = S / 100 % 10;
	int c = S / 10 % 10;
	int d = S % 10;

	if (a == b)
	{
		cout << "Bad" << endl;
	}
	else if(b == c)
	{
		cout << "Bad" << endl;
	}
	else if (c == d)
	{
		cout << "Bad" << endl;
	}
	else
	{
		cout << "Good" << endl;
	}
}









Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = long.Parse(line[0]);
        var m = long.Parse(line[1]);
        long a;
        if (n == 1 && m == 1) a = 1;
        else if (n == 1 && m != 1) a = m - 2;
        else if (n != 1 && m == 1) a = n - 2;
        else a = (n - 2) * (m - 2);
        Console.WriteLine(a);
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double area = Math.PI*r*r;
		double length = Math.PI*r*2;
		System.out.printf("%f %f%n",area,length);
	}
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(m);
  int s=0;
  for(int i=0;i<m;i++){
    cin >> a.at(i);
    s+=a.at(i);
  }
  if(n>=s){
    cout << n-s << endl;
  }else{
    cout << -1 << endl;
  }
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    cout << 0 << endl;
    string ans;
    cin >> ans;

    bool f;
    if(ans == "Vacant") {
        return 0;
    }
    if(ans == "Male") {
        f = true;

    } else {
        f = false;

    }

    int l, r;
    l = -1, r = n;
    while(r - l > 1) {
        int m = (r + l) / 2;
        cout << m << endl;
        cin >> ans;
        if(ans == "Vacant") {
            return 0;

        }
        if(ans == "Male") {
            if(m % 2 == 0 && f) l = m;
            else if(m % 2 == 1 && !f) l = m;
            else r = m;

        } else {
            if(m % 2 == 0 && !f) l = m;
            else if(m % 2 == 1 && f) l = m;
            else r = m;

        }
    }

    /*
    cout << l << endl;
    cin >> ans;
    if(ans == "Vacant") return 0;
    cout << r << endl;
    cin >> ans;
    */
    return 0;
}



Measured memory_bytes: 852
#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, m; cin >> n >> m;
  vector<ll> P(m), Y(m);
  vector<set<pair<ll, int>>> C(n);
  rep(i, m) {
    cin >> P[i] >> Y[i];
    P[i]--;
    C[P[i]].emplace(Y[i], i);
  }
  vector<int> ans(m);
  rep(i, n) {
    int j = 1;
    for(auto ele: C[i]) ans[ele.second] = j++;
  }
  rep(i, m) {
    cout << setfill('0') << right << setw(6) << P[i]+1;
    cout << setfill('0') << right << setw(6) << ans[i];
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 16116
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265358979323846

int main()
{
  
  int a, b, h, m;
  cin>>a>>b>>h>>m;
  double hour_degree = h*30+m*0.5;
  double min_degree = m*6;
  double degree = abs(hour_degree-min_degree);
  double radian = (degree*pi)/180;

  double c = sqrt(a*a + b*b - 2*a*b*cos(radian));
  cout<<setprecision(20)<<c<<endl;

  return 0;
}


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

int main(){

  for( ; ; ){

  int n,a,b,c,d,e,f,X,A,i;

  a=1;
  b=2;
  c=3;
  d=4;
  e=5;
  f=6;
  A=1;
  i=0;

  string N;

  cin>>n;

  if(n==0)break;

  for(i=0;i<n;i++){
     cin>>N;
     if(N=="North"){
       X=a;
       a=b;
       b=f;
       f=e;
       e=X;
       A=A+a;
     }
     if(N=="East"){
       X=a;
       a=d;
       d=f;
       f=c;
       c=X;
       A=A+a;
     }
     if(N=="West"){
       X=a;
       a=c;
       c=f;
       f=d;
       d=X;
       A=A+a;
     }
     if(N=="South"){
       X=a;
       a=e;
       e=f;
       f=b;
       b=X;
       A=A+a;
     }
     if(N=="Right"){
       X=b;
       b=c;
       c=e;
       e=d;
       d=X;
       A=A+a;
     }
     if(N=="Left"){
       X=b;
       b=d;
       d=e;
       e=c;
       c=X;
       A=A+a;
     }
   }
   cout<<A<<endl;
  }
  return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n;cin>>n;
    vector <ll> mp(100009,0);
    ll sum=0ll;
    for(int i=0;i<n;i++)
    {
        int x;cin>>x;
        sum+=x;
        mp[x]++;
    }
    int q;cin>>q;
    while(q--)
    {
        ll a,b;cin>>a>>b;
        ll x=mp[a];
        sum-= x*a;
        mp[a]=0;
        sum+= x*b;
        mp[b]+=x;
        cout<<sum<<endl;
    }
    return 0;
}

/*




*/


Measured memory_bytes: 4048
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void calc() {

	Int N, K; std::cin >> N >> K;
	std::vector<Int> h(N);
	rep(i, N)std::cin >> h[i];
	Int ans = INF;
	std::sort(all(h));
	rep(i, N - K + 1) {
		ans = std::min(ans, std::abs(h[i + K - 1] - h[i]));
	}
	std::cout << ans;

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 1024
D = int(input())
C = [int(x) for x in input().split()]
S = [[int(i) for i in input().split()] for D in range(D)]
T = [0]*D
for i in range(D):
    T[i] = int(input())

score = [0]*26
last = [-1]*26

for i in range(D):
    score[T[i]-1] += S[i][T[i]-1]
    last[T[i]-1] = i

    for j in range(26):
        score[j] -= C[j]*(i-last[j])
    print(sum(score))


Measured memory_bytes: 68696
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

class UnionFind{
    public:
        vector<int> rank,p;
        UnionFind(int n) : rank(n,0), p(n){
            for(int i=0;i<n;i++) p[i]=i;
        }
        int root(int x){
            if(p[x]==x) return x;
            else return p[x] = root(p[x]);
        }
        void unite(int x,int y){
            x=root(x);
            y=root(y);
            if(x==y) return;
            if(rank[x]<rank[y]) p[x]=y;
            else{
                p[y]=x;
                if(rank[x]==rank[y]) rank[x]++;
            }
        }
        inline bool same(int x,int y){
            return root(x)==root(y);
        }
};

int main(){
    int n,q;
    cin >> n >> q;
    UnionFind uf(n);
    for(int i=0;i<q;i++){
        int c,x,y;
        cin>>c>>x>>y;
        if(c==0){
            uf.unite(x,y);
        }else{
            bool f=uf.same(x,y);
            if(f) cout<<1<<endl;
            else cout<<0<<endl;
        }
    }
}



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

#define rep(i, N) for(int (i) = 0; (i) < (N); i++)
#define all(v) v.begin(), v.end()
using i64 = int_fast64_t;

int main(){
    int N;
    cin >> N;
    vector<vector<pair<int,int>>> G(N);
    vector<int> edge_color(N-1, -1);
    vector<set<int>> v_color(N);
    vector<int> degree(N, 0);
    
    int a, b;
    rep(i, N-1){
        cin >> a >> b; a--, b--;
        G[a].push_back({b, i});
        G[b].push_back({a, i});
        degree[a]++;
        degree[b]++;
    }

    int k = max_element(all(degree)) - degree.begin();

    int cnt = 0;
    queue<int> que;
    que.push(k);
    while(cnt < N-1){
        int now = que.front(); que.pop();
        int c = 1;
        for(auto& p : G[now]){
            int nxt, edge_num;
            tie(nxt, edge_num) = p;
            if(edge_color[edge_num] != -1) continue;
            
            if(v_color[now].count(c)) c++;
            edge_color[edge_num] = c;
            v_color[now].insert(c);
            v_color[nxt].insert(c);

            cnt++;
            que.push(nxt);
            c++;
        }
    }
    cout << *max_element(all(degree)) << endl;
    rep(i, N-1) cout << edge_color[i] << endl;
}

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

namespace ABC073A
{
    class Program
    {
        static void Main(string[] args)
        {
            String n;
            n = Console.ReadLine();

            if (n[0] == '9' || n[1] == '9')
                Console.WriteLine("Yes");

            else
                Console.WriteLine("No");

            Console.ReadKey();

        }
    }
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:
string s;

inline bool check(string cur, int len) {
	const int n = cur.size();
	const int m = s.size();
	int idx = 0, depth = 0;

	rep(i, n) {
		if (cur[i] == '(')
			depth++;
		else
			depth--;

		if (depth < 0) return false;
		if (idx < m and cur[i] == s[idx]) idx++;
	}


	while (idx < m) {
		if (s[idx] == '(') {
			idx++, depth++;
			cur +=  "(";
		} else {
			if (depth == 0) cur += "(", depth++;
			idx++, depth--;
			cur +=  ")";
		}
	}

	while (depth > 0) cur += ")", depth--;

	if (idx != m) return false;
	if (depth != 0) return false;
	if (int(cur.size()) > len) return false;
	return true;
}

int main(void) {
	int dummy;
	cin >> dummy;
	
	cin >> s;

	stack<int> stk;
	for (auto &c : s) {
		if (c == ')' and !stk.empty() and stk.top() == '(') {
			stk.pop();
		} else {
			stk.push(c);
		}
	}

	const int len = s.size() + stk.size();

	string ans = "";

	rep(loop, len) {
		for (auto &add : {"(", ")"}) {
			string nxt = ans + add;
			if (check(nxt, len)) {
				ans = nxt;
				break;
			}
		}
	}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;

int main(){
    while(1){
        int n,d;
        cin >> n >> d;
        if(n==0) break;

        vector<vector<int> > c(n);
        vector<int> sum(n, 0);
        for(int i=0; i<n; i++){
            int m;
            cin >> m;
            c[i].resize(m);
            for(int j=0; j<m; j++){
                cin >> c[i][j];
                sum[i] += c[i][j];
            }
        }

        while(1){
            bool dispose = false;
            for(int i=0; i<n; i++){
                if(c[i].empty()) continue;
                int smax=0;
                for(int j=0; j<n; j++){
                    if(j!=i) smax = max(smax, sum[j]);
                }
                if(smax - (sum[i]-c[i].back()) <= d){
                    sum[i] -= c[i].back();
                    c[i].pop_back();
                    dispose = true;
                }
            }
            if(!dispose) break;
        }

        bool success = true;
        for(int i=0; i<n; i++){
            if(!c[i].empty()) success = false;
        }
        if(success){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3072
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  vector<int> a(n+1);
  for(int i=1;i<=n;i++) cin >> a[i];
  vector<int> b(n+1);
  for(int i=n;i>=1;i--){
    int j=2;
    int sum=a[i];
    while(i*j<=n){
      sum+=b[i*j];
      j++;
    }
    sum%=2;
    b[i]=sum;
  }
  int m=0;
  vector<int> ans(0);
  for(int i=1;i<=n;i++){
    if(b[i]==1){
      m++;
      ans.push_back(i);
    }
  }
  cout << m << endl;
  rep(i,ans.size()){
    if(i==ans.size()-1){
      cout << ans[i] << endl;
      continue;
    }
    cout << ans[i] << " ";
  }
  
}

Measured memory_bytes: 3064
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) x[i] = scan.nextInt();
		int ans = Integer.MAX_VALUE;
		for(int j = 1; j <= 100; j++) {
			int res = 0;
			for(int i = 0; i < n; i++) {
				res += (x[i]-j)*(x[i]-j);
			}
			ans = Math.min(ans, res);
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 22612
N, u, v = (int(i) for i in input().split())
adj=[]
for i in range(N+1):adj.append([])
for i in range(N-1):
	a,b = map(int,input().split())
	adj[a]+=[b]
	adj[b]+=[a]

def distances(sommet):
	d = [-1]*(N+1)
	File = [sommet]
	d[sommet] = 0
	while File:
		s = File.pop()
		for x in adj[s]:
			if d[x]==-1:
				d[x] = 1+d[s]
				File.append(x)
	return d


t = distances(u)
a = distances(v)

# ~ print(t)
# ~ print(a)

ans = -1
for i in range(1,N+1):
	if t[i]<a[i]:
		ans = max(ans, a[i]-1)
		
print(ans)


Measured memory_bytes: 29104
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

char a, b;

int main(){
  cin >> a >> b;
  if(a == 'H' && b == 'H') puts("H");
  if(a == 'H' && b == 'D') puts("D");
  if(a == 'D' && b == 'H') puts("D");
  if(a == 'D' && b == 'D') puts("H");

  return 0;
}


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

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

int main(){
  
  int n;
  cin >> n;
  
  vector<int> score(n);
  
  for(int i=0; i<n;i++){
    cin >> score.at(i);
  }
  
  int answer = 0;
  
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      answer += score.at(i)*score.at(j);
    }
  }
  
  cout << answer << endl;
  
}

Measured memory_bytes: 256
// Danielxlr
// https://atcoder.jp/contests/abc174/tasks/abc174_b
// math

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    long long n, m, ans=0, x ,y;
    cin>>n>>m;
    for(int i=0; i<n; i++){
        cin>>x>>y;
        if(x*x+y*y<=m*m){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

#define ll long long int
#define ld long double
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define pi 3.14159265358979
#define pa pair<ll,ll>
//#define goodset tree<pa, null_type, less<pa>, rb_tree_tag, tree_order_statistics_node_update>
//#define FRE freopen("acm.in","r",stdin); freopen("acm.out","w",stdout);

const ll mod = 1e9+7 ;
const ll N = 1e7+5;
int main()
{
    FAST

    ll tc,i,j,k;
    //cin>>tc;
    tc=1;
    while(tc--)
    {
       ll n,k;
       cin>>n>>k;
       ll a[n];
       for(i=0; i<n; i++)
        cin>>a[i];
       sort(a,a+n);

       ll lo=0;
       ll hi=a[n-1];
       ll ans=a[n-1];
       while(lo<=hi)
       {
           ll mi=(lo+hi)/2;
           if(mi==0)
           {
               ans=1;
               break;
           }
           ll cnt=0;
           for(i=0; i<n; i++)
           {
               ll val=a[i]/mi;
               if(a[i]%mi!=0)
                val++;
                if(val>0)
                    cnt+=(val-1);
           }
           if(cnt<=k)
           {
               ans=min(ans,mi);
               hi=mi-1;
           }
           else
            lo=mi+1;
       }
       cout<<ans;



    }
    return 0;
}



Measured memory_bytes: 5220
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;

#define ll long long

int main()
{
    ll N;
    scanf("%lld", &N);

    ll i = 0;
    ll sum = 100;
    while (sum < N)
    {
        sum += sum / 100;
        i++;
    }

    printf("%lld", i);
}


Measured memory_bytes: 3760
m, k = map(int, input().split())

if k >= 2**m:
    print(-1)
    exit()

if m == 0:
    print(0, 0)
    exit()
if m == 1:
    if k == 0:
        print(0, 0, 1, 1)
        exit()
    else:
        print(-1)
        exit()

A = [k]
for i in range(2**m):
    if i == k:
        continue
    A.append(i)
A.append(k)
for i in range(2**m - 1, -1, -1):
    if i == k:
        continue
    A.append(i)

print(*A)


Measured memory_bytes: 19440
import time
start = time.time()

n = int(input())
a = list(map(int, input().split()))
# a = [i for i in range(n)]
st = set()
for i in range(n):
    st.add(a[i])
if len(st) == n: print("YES")
else: print("NO")

# print(time.time() - start)

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

using namespace std;

//#define endl '\n'
#define all(v) (v).begin(),v.end()
#define rall(v) (v).rbegin(),v.rend()
#define sz(v) (int)(v).size()
#define oo 1e15

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;

int a[101], n;

int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#ifdef LOCAL
  freopen("test.in", "rt", stdin);
//  freopen("o.txt", "wt", stdout);
#endif
  ll rem = 1000;
  cin >> n;
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  a[n++] = -1;
  for (int i = 0; i < n; ++i) {
    int mx = a[i];
    for (int j = i + 1; j < n; ++j) {
      mx = max(mx, a[j]);
      if (a[j] < mx) {
        ll cnt = rem / a[i];
        rem = cnt * mx + (rem % a[i]);
        i = j - 1;
        break;
      }
    }
  }
  cout << rem << endl;
  return 0;
}


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

#define PI 3.14159265358979323846

long N, M;
vector<list<long>> G;
vector<long> visited;

int main(void) {

    cin >> N >> M;
    G.resize(N+1, list<long>());
    for (long i = 0; i < M; i++) {
        long a, b; cin >> a >> b;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }

    visited.resize(N+1);
    visited.at(1) = 1;
    queue<long> q;
    for (auto e: G.at(1)) {
        q.push(e);
        visited.at(e) = 1;
    }

    while (q.size() > 0) {
        auto e = q.front();
        q.pop();
        for (auto f: G.at(e)) {
            if (visited.at(f)) continue;
            visited.at(f) = e;
            q.push(f);
        }
    }

    cout << "Yes" << endl;
    for (long i = 2; i <= N; i++) {
        cout << visited.at(i) << endl;
    }

    return 0;
}

Measured memory_bytes: 19492
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		String s=sc.next();
		StringBuffer buf = new StringBuffer();
		
		int l=s.length();
		for(int i=0;i<l;i++) {
			switch(s.charAt(i)){
			case('1'):
				buf.append("1");
				break;
			case('0'):
				buf.append("0");
				break;
			case('B'):
				int a=buf.length();
				if(a!=0) {
					buf.deleteCharAt(a-1);
				}
				break;
			}
			
				
			
		}
		String ans = buf.toString();
		System.out.println(ans);
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}





Measured memory_bytes: 20948
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 314159
#define  vi vector<int>
#define  v  vector

signed main() 
{
        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
        int n;
        cin>>n;
        set<int>dc;
        int sum=0;
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0){dc.insert(i);dc.insert(n/i);}
        }
        if(n!=1)dc.insert(n);
        for(auto i : dc)
        {
            int x = i*(n%(i-1));
            if(x==n)sum+=i-1;
        }
        cout<<sum;



        return 0;

}

//       g++ -g c.cpp ; ./a.exe

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

int main(){
    int N,L;
    cin >> N >> L;
    int T[210];
    int ans = 0;

    for(int i=0; i<N; i++){
        T[i] = L + i + 1 - 1;
        ans += T[i];
    }

    int P = 10000;

    for(int i=0; i<N; i++){
        if(abs(T[i]) < abs(P)) P = T[i];
    }

    cout << ans - P << endl;
}

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

int main(){
    int a,b;
    int c;
    cin>>a>>b;
    
    int rsum[100] = {};
    int csum[100] = {};
    int sum =0;
    for(int i=0; i<a; i++){
        cin >>c;
        cout<<c;
        rsum[i] += c;
        csum[0] += c;
        for(int j=1; j<b; j++){
            cin >> c;
            cout<< ' ' << c;
            rsum[i] += c;
            csum[j] += c;
        }
        cout<<' '<< rsum[i] <<endl;
        sum += rsum[i];
    }
    cout <<csum[0];
    for(int j=1; j<b; j++){
        cout << ' '<<csum[j];
    }
    cout <<' '<<sum <<endl;
    return 0;
}


Measured memory_bytes: 3092
// #include<iostream>
// #include<string>
// #include<algorithm>
// using namespace std;

// int main()
// {
//     int N;
//     cin >> N;
//     int d[110];
//     for (int i = 0; i < N; ++i){
//         cin >> d[i];
//     }
//     sort(d, d + N, greater<int>());
//     int ans = 1;
//     int cur = d[0];
//     for (int i = 1; i < N; ++i){
//         if (cur > d[i]) {
//             ans += 1;
//             cur = d[i];
//         }
//     }
//     cout << ans << endl;
//     return 0;
// }

// バケット法
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
    int N;
    int d[110];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> d[i];

    int num[110] = {0};
    for (int i = 0; i < N; ++i){
        num[d[i]]++;
    }

    int res = 0;
    for (int i = 1; i <= 100; ++i){
        if (num[i]){
            ++res;
        }
    }
    cout<< res << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
n = int(input())
L = [int(s) for s in input().split()]
# print(n)
# print(L)
npL = np.array(L)
# print(npL)
npL = np.sort(npL)
npLd = np.reshape(npL, (-1, 2))
# print(npLd)
cnt = 0
for i in npLd:
    cnt += i[0]
print(cnt)

Measured memory_bytes: 26996
#include <bits/stdc++.h>
#define r(i,n) for(long long i = 0; i<n; i++)
typedef long long ll;
using namespace std;

int main() {
  bool flag=true;
  string s;
  cin >> s;
  if(s.size()%2==1)flag=false;
  else{
  r(i,s.size()/2){
    if(s[i*2]!='h'||s[i*2+1]!='i')flag=false;
  }
  }
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


 int main(){

    IOS;
	
   #ifndef ONLINE_JUDGE
     freopen("input1.txt","r",stdin);
     freopen("output1.txt","w",stdout);
   #endif

   	int n,ac=0,re=0,tle=0,wa=0;
   cin>>n;
   string s;
   while(n--){
   		cin>>s;
   
  // for (int i = 0; i < n; ++i)
   
   		if(s=="AC")
   			ac++;
   		else if(s=="TLE")
   			tle++;
   		else if(s=="RE")
   			re++;
   		else if (s=="WA")
   		{
   				wa++;
   		}				
   }
   cout<<"AC x "<<ac<<endl;
   cout<<"WA x "<<wa<<endl;
   cout<<"TLE x "<<tle<<endl;
   cout<<"RE x "<<re<<endl;

   return 0;
 }   


Measured memory_bytes: 3544
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

N, P = map(int, input().split())
tmp = [p ** (k//N) for p, k in factorize(P) if k >= N]
gcd = 1
for t in tmp:
    gcd *= t
print(gcd)

Measured memory_bytes: 3064
function Main(input) {
  const inputArr = input.split(/\n| /);

  const n = parseInt(inputArr[0], 10);
  const k = parseInt(inputArr[1], 10);

  let pArr = [];
  for (let i = 0; i < n; i++) {
    pArr[i] = parseInt(inputArr[i + 2], 10);
  }

  pArr.sort(function (a, b) {
    if (a < b) {
      return -1;
    } else if (a > b) {
      return 1;
    } else {
      return 0;
    }
  });

  let sum = 0;
  for (let i = 0; i < k; i++) {
    sum += pArr[i];
  }

  console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

const int MOD = 1e9 + 7;

int add (int a, int b) { return (a + b) % MOD; }
int sub (int a, int b) { return (a - b + MOD) % MOD; } 

int main () {
  int n;
  string s;
  cin >> n >> s;
  vector <int> dp(n + 1, 1);
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    vector <int> newDP(n + 1, 0);
    for (int j = 1; j <= i + 1; j++) {
      if (s[i - 1] == '>') newDP[j] = dp[j - 1];
      else newDP[j] = sub(dp[n], dp[j - 1]);
    }
    for (int j = 1; j <= n; j++) newDP[j] = add(newDP[j], newDP[j - 1]);
    dp = newDP;
  }
  cout << dp[n] << endl;
  return (0);
}


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

int main() {
  int H, W;
  cin >> H >> W;
  char a[101][101], b[102][102];
  for(int i=0;i<H;i++) {
    for(int j=0;j<W;j++) {
      cin >> a[i][j];
    }
  }
  for(int i=0;i<=H+1;i++) {
    for(int j=0;j<=W+1;j++) {
      b[i][j] = '#';
    }
  }
  for(int i=0;i<H;i++) {
    for(int j=0;j<W;j++) {
      b[i+1][j+1] = a[i][j];
    }
  }
  for(int i=0;i<H+2;i++) {
    for(int j=0;j<W+2;j++) {
      cout << b[i][j];
    }
    cout <<endl;
  }
}

Measured memory_bytes: 256
// Problem: A - Repeat ACL
// Contest: AtCoder - ACL Beginner Contest
// URL: https://atcoder.jp/contests/abl/tasks/abl_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
 
using namespace std;
#define int long long
#define ll long long
const int N = 2e5+5;
const int mod = 1e9;
#define ld long double
#define PI 3.14159265358979323846
#pragma GCC optimize("-O2")
const int INF = 10000000;

int getIInput() {
	cout.flush();
	#ifdef LOCAL
	return generateLocalInputOrAnythingYouWant();
	#else
	int x;
	cin>>x;
	return x;
	#endif
}

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(9);
}
 
//3. Structure or classes
//3. Ends here
 
//1. Data structures declaration here
//1. Ends here
 
//2. Extra Functions here
//2. Ends here
 
 
void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    while(t--){
        solve();
        //cout<<"\n";
    }
    return 0;
}
 
 
 
void solve()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cout<<"ACL";
	}
    return;
}
// how r u bro

Measured memory_bytes: 3648
def cc(s,t):
	ans=0
	for i in range(len(s)):
		if s[i]!=t[i]:
			ans+=1
	return ans

a=input()
b=input()
tot=len(a)

i=0
j=len(b)-1

while j<len(a):
	tot=min(tot,cc(b,a[i:j+1]))
	i+=1
	j+=1

print(tot)

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

using namespace std;

int main() {
  string s;
  cin >> s;

  vector<size_t> s1;
  vector<pair<size_t, int> > s2;

  unsigned int area = 0;
  for (size_t i = 0; i < s.size(); ++i) {
    const char c = s[i];
    if (c == '\\') {
      s1.push_back(i);
    } else if (c == '/' && s1.size() > 0) {
      const size_t p = s1.back();
      s1.pop_back();
      area += (i - p);
      long a = i - p;
      while (s2.size() > 0 && s2.back().first > p) {
        a += s2.back().second;
        s2.pop_back();
      }
      s2.push_back(make_pair(p, a));
    }
  }

  cout << area << endl;
  cout << s2.size();
  for (size_t i = 0; i < s2.size(); ++i) {
    cout << " ";
    cout << s2[i].second;
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 1532
#include <iostream>
using namespace std;
const int Max = 200;

int a[Max], Count = 0;
void BubbleSort(int a[], int N)
{
     int flag = 1, i = 0;
     while(flag)
     {
         flag = 0;
         for(int j=N-1; j>i; j--)
         {
             if(a[j]<a[j-1])
             {
                 int temp = a[j];
                 a[j] = a[j-1];
                 a[j-1] = temp;
                 flag = 1;
                 Count++;
             }
         }
         i++;
     }

}
int main()
{
    int N;
    cin >> N;
    for(int i=0; i<N; i++)
    {
        cin >> a[i];
    }
    BubbleSort(a, N);
    for(int i=0; i<N-1; i++)
        cout << a[i] << " ";
     cout << a[N-1] << endl;
     cout << Count << endl;
    return 0;
}



Measured memory_bytes: 3120
#include <stdio.h>

int main(){
  int N;
  int K;
  int h[100000];
  int count=0;
  scanf("%d %d",&N,&K);
  for(int i=0;i<N;i++){
      scanf("%d",&h[i]);
  }
  for(int i=0;i<N;i++){
    if(h[i]>=K){
      count++;
    }
  }
  printf("%d",count);

	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
//    	File file = new File("src/in.txt");
//    	Scanner sc = new Scanner(file);

    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int H = sc.nextInt();
    	int M = sc.nextInt();

    	double radM = (double) (M*6.0);
    	double radH = (double) ((H*60+M)*0.5);

    	double rad = Math.abs(radM-radH);

    	double ans = Math.sqrt(A*A+B*B-2*A*B*Math.cos(rad/180*Math.PI));

    	System.out.println(ans);

    }
}

Measured memory_bytes: 27192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

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

    for(int i = 0; i < n-1; i++){
        int tmp = k - a[i+1] + a[i];
        if(ans > tmp) ans = tmp;
    }
    
    cout << ans << endl;

}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;
string s;
int main()
{
	cin>>s;
	if(s[1]!=s[0]||s[1]!=s[2]||s[2]!=s[0]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<ll>
#define vpi vector< pi >
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
const int N=100010;
ll a[N];

ll pwr(ll a, ll b)
{
  ll r=1;
  while(b)
  {
    	if(b%2)
          r=r*a%mod;
    	a=a*a%mod;
    	b/=2;
  }
  return r;
}
ll f[N];
ll solv(ll n,ll r)
{
	return f[n]*pwr(f[r],mod-2)%mod*pwr(f[n-r],mod-2)%mod;
}
int main()
{
  int n,k;
  cin>>n>>k;
  f[0]=1;
  for(int i=1;i<=n;i++)
    cin>>a[i], f[i] = 1ll*i*f[i-1]%mod;
  sort(a+1,a+n+1);
  
  ll res=0;
  for(int i=n;i>=k;)
  {
  	//cout<<i<<"\n";
  	int j=i-1;
  	while(j>0&&a[i]==a[j]) j--;
    for(int l=1;l<=min(i-j,k);l++)
    {
    	if(k-l>j) continue;
    	res=(res+a[i]*solv(i-j,l)%mod*solv(j,k-l)%mod)%mod;
    }
    i=j;
    //cout<<res<<"\n";

  }

  for(int i=1;i<=n-k+1;)
  {
  	int j=i+1;
  	while(j<=n&&a[i]==a[j]) j++;
    for(int l=1;l<=min(j-i,k);l++)
    { 
    	if(k-l>n-j+1) continue;
    	res=(res+mod-a[i]*solv(j-i,l)%mod*solv(n-j+1,k-l)%mod)%mod;
    	//cout<<res<<" j\n";
    }
    i=j;
    //cout<<res<<"\n";
  }

  cout<<res;
  
  return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

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

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

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

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 1e5 + 12; //check the limits, dummy

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

    ll n;
    cin >> n;
    vl in (n);
    FOR (i, 0, n) cin >> in[i];
    sort (all (in) );

    ll ans = 0;
    FOR (i, 0, n) {
        ll l = 0, r = i - 1;
        while (l < r) {
            if (in[l] + in[r] > in[i]) {
                ans += r - l;
                r--;
            } else {
                l++;
            }
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

A, B, C, X, Y = LI()


"""
A+BよりもCのほうがお得な場合、XまたはYを買い切るまでCを買う
その後は、AかBで残っているものとAB*2で安い方を買う
"""
result = 0
if A+B >= C*2:
    # Cを購入する
    reduce_amount = min(X,Y)
    X -= reduce_amount
    Y -= reduce_amount
    result += C*2*reduce_amount

if X > 0:
    result += min(C*2*X, A*X)

if Y > 0:
    result += min(C*2*Y, B*Y)


print(result)


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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000
//3
typedef long long ll;
typedef pair<int,int> pii;
priority_queue< int > pq;
priority_queue< int , vector<int> , greater<int> > rpq;
set<int>s;
set <int > :: iterator itr; 
vector<int> vec[1001];
int r,n,m,inp,tc;
int arr[1000007]= {};
map<int , int> mymap;


int main()
{
	int n,h;
	cin>>n>>h;
	
	for(int i=h-1 ; i<n+(h-1) ; i++){
		scanf("%d",&arr[i]);
	}
	
	for(int i=0 ;i<h-1 ; i++)
	arr[i] = arr[h-1];
	
	int dp[1000007]= {0};
	for(int i=0 ;i<h ; i++)
	dp[i] = 0;
	
	for(int i=h; i< n+(h-1) ; i++){
		dp[i] = INT_MAX;
		for(int j = 1; j<=h ; j++){
			dp[i] = min(dp[i] , dp[i-j] + (abs(arr[i] - arr[i-j])));
		}
	}
	cout<<dp[n+(h-2)]<<endl;
    return 0;
}

//65 900 17 13

Measured memory_bytes: 4608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()


int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int n; cin >> n;
	int ans = n * 2;
	if(n % 2 == 0) ans /= 2;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;

void Sort(int[],int[],int);

int main(){
   int n,m;
   int a[1000][100];
   int num[100];
   int sum[100];
   int i,l;
   
   for(;;){
      cin>>n>>m;
      if(n==0&&m==0) break;
      
      memset(sum,0,sizeof(sum));
      for(i=0;i<n;i++){
         for(l=0;l<m;l++){
            if(i==0) num[l] = l+1;
            cin>>a[i][l];
         }
      }
      for(i=0;i<m;i++){
         for(l=0;l<n;l++){
            sum[i]+=a[l][i];
         }
      }
      
      Sort(num,sum,m);
      printf("%d",num[0]);
      for(i=1;i<m;i++) printf(" %d",num[i]);
      puts("");
   }
   return 0;
}

void Sort(int num[],int sum[],int m){
   int i,l;
   int z;
   
   for(i=m;i>0;i--){
      for(l=0;l<i;l++){
         if(sum[l]<sum[l+1]){
            z=sum[l];
            sum[l] = sum[l+1];
            sum[l+1] = z;
            
            z=num[l];
            num[l]=num[l+1];
            num[l+1]=z;
         }
      }
   }
}

Measured memory_bytes: 0
import java.util.Scanner; 

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

    while (in.hasNext()) {
      int N = in.nextInt();
      int[] B = new int[N - 1];
      
      for (int i = 0; i < B.length; ++i) {
        B[i] = in.nextInt(); 
      } 

      int sum = B[0] + B[B.length - 1];

      for (int i = 1; i < B.length; ++i) {
        sum += Math.min(B[i - 1], B[i]);
      }
      
      System.out.println(sum);
    }
  }
}

Measured memory_bytes: 23636
#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int inputNum;
    cin >> inputNum;
    if (inputNum%100 >0 && inputNum%100<=12){
        if (inputNum/100<=12 && inputNum/100>0){
            cout<<"AMBIGUOUS"<<endl;
        }
        else if (inputNum/100>12 || inputNum/100<1){
            cout<<"YYMM"<<endl;
        }
    }else if (inputNum/100 >0 && inputNum/100<=12){
        if (inputNum%100<=12 && inputNum%100>0){
            cout<<"AMBIGUOUS"<<endl;
        }
        else if (inputNum%100>12 || inputNum%100==0){
            cout<<"MMYY"<<endl;
        }
    }else{
        cout<<"NA"<<endl;
    }
    return 0;
}



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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    int d[101];
    REP(i,n) cin>>d[i];

    ll ans=0;
    REP(i,n-1){
        FOR(j,i+1,n){
            ans += d[i]*d[j];
        }
    }


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

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const int N = 1e6+7 , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
char c[5];
int main()
{
    while(~scanf("%s",c))
    {
        if(c[0] == c[2])printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256