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

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int[] num = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        int k = scanner.nextInt();
        System.out.println(num[k-1]);
    }
}

Measured memory_bytes: 22864
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a, b) << " " << max(0, a + b - n) << endl;

    return 0;
}


Measured memory_bytes: 256
W,H,N=map(int,input().split())

x=[0]*W
y=[0]*H


for _ in range(N):
    xi,yi,ai=map(int,input().split())

    if ai==1:
        for i in range(xi):
            x[i]=1
    elif ai==2:
        for i in range(xi,W):
            x[i]=1
    elif ai==3:
        for i in range(yi):
            y[i]=1
    elif ai==4:
        for i in range(yi,H):
            y[i]=1

print(y.count(0)*x.count(0))
    

Measured memory_bytes: 3064
S = input()

ans = "WA"
if S[0] == "A":
    if S[2:-1].count("C") == 1:
        ans = "AC"
        for i in range(len(S)):
            if i==0:
                continue
            if S[i]=="C":
                continue
            if S[i].isupper():
                ans = "WA"

print(ans)



Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int sum[330][330],p[330][330];
signed main(){
	int n;cin >> n;
	vector<int> a;
	rep(i,n){
		string s;cin >> s;
		int m = s.size();
		int rest = 0;
		int tmp = 0;
		rep(j,m){
			if(s[j] != '.'){
				tmp *= 10;
				tmp += (s[j] - '0');
			}
			else{
				rest = m - j-1;
				

			}
		}
		rest = max(0ll,9 - rest);
		while(rest--)tmp*= 10;
		a.push_back(tmp);
	}
	vector<int> ts(n),fs(n);
	rep(i,n){
		int t = 0;
		while(a[i]%2 == 0){
			t++;
			a[i]/= 2;
		}
		int f = 0;
		while(a[i]%5 == 0){
			f++;
			a[i]/= 5;
		}
		p[t][f]++;
		ts[i] = t;
		fs[i] = f;
	}
	// int ret = 0;
	// rep(i,n)rep(j,i){
	// 	if(ts[i] + ts[j] >= 18 && fs[i] + fs[j] >= 18)ret++;
	// }
	// cout << ret << endl;
	//trace(a);
	//1e18 == 0
	rep(i,301)rep(j,301){
		sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + (p[i][j]);
	}
	int ret = 0;
	rep(i,n){
		// trace(ts[i],fs[i],ret);
		int M = 300,A = max(0ll,18 - ts[i]),B = max(0ll,18 - fs[i]);
		// trace(A,B);
		ret += sum[M][M] - sum[A][M] - sum[M][B] + sum[A][B];
		if(ts[i] >= A && fs[i] >= B)ret--;
	}
	// trace(ts,fs);
	cout << ret/2	 << endl;
	
	return 0;
}

Measured memory_bytes: 9040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ll long long
#define ull unsigned long long int
#define db double
#define fi first
#define se second
#define pb push_back
#define vec vector<ll>
#define pr pair<ll,ll>
#define pq priority_queue<ll,vector<ll> >
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
typedef priority_queue<ll,vector<ll>,greater<ll>> pqlg;
#define GS(s)   string s; getline(cin,s);
#define lll __int128_t
#define endl "\n"

struct compare_queue
{
    bool operator()(const ll& a, const ll& b)
    {
        return a>b;
    }
};

// ll gcd(ll u,ll v)
// {
// 	if(v==0)
// 	return u;
	
// 	else
// 	return gcd(v,u%v);
// }

    // ll power(ll x,ll y){
    //     ll i;
    //     ll ans=1;
    //     for(i=0;i<y;i++){
    //         ans=ans*x;
    //     }
    //     return ans;
    // }

// // // #define MAX 1000000
// int primes[100009],cnt=0;
// // vector<int> factors[1000009];
// char str[1000009];
// void pre()
// {
//     // calcualting primes
//     int n=1000000;
//     for(int i=2; i*i<=n; i++)
//         if(str[i]==0)
//             for(int j=i; j*i<=n; j++)
//                 str[i*j]=1;
//     for(int i=2; i<=n; i++)
//         if(str[i]==0)primes[cnt]=i,cnt++;
// }


// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
// vector<ll> getFactorization(ll x) 
// { 
//     vector<ll> ret; 
//     while (x != 1) 
//     { 
//         ret.push_back(spf[x]); 
//         x = x / spf[x]; 
//     } 
//     return ret; 
// } 

// C:\Users\A\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\lambda

ll power(ll x,ll y,ll p) 
{ 
	ll res = 1;	

	x = x % p; 

	if (x == 0) return 0;

	while (y > 0) 
	{ 
		
		if (y & 1) 
			res = (res*x) % p; 

		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
} 

// struct node{
// int val;
// node* left;
// node* right;
// };

// node* getNode(int k){
//     node* temp =new node;
//     temp->left=NULL;
//     temp->right=NULL;
//     temp->val=k;
// }



ll Fun(string& x,string& t){
    ll i=0,c=0;
    while(t[i]!='\0'){
        if(x[i]!=t[i]){c++;}
        i++;
    }
    return c;
}

void Function(){

string s,t;
cin >> s >> t;

ll i=0;
ll l=t.length();
ll ans=t.size();
while(s[i]!='\0'){
    if(i+l>s.size()){break;}
    string x=s.substr(i,l);
    ans=min(ans,Fun(x,t));
    i++;
}

cout << ans << endl;

}

int main(){ 
fast;
ll t=1,i=0,j=0,k=0,h,n;
// pre();
// cin >> t;
for(h=1;h<=t;h++){
Function();
}
return 0;
}

Measured memory_bytes: 3644
#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, a;
    cin >> n;
    a = n%10;
    switch (a)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl;
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;

    case 3:
        cout << "bon" << endl;
        break;
    default:
        break;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define tc ll t;cin>>t;while(t--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007

int main()
{
  io;
  string s;
  cin>>s;
  if(s[2]==s[3]&&s[4]==s[5])
  {
    cout<<"Yes";
  }
  else
  {
    cout<<"No";
  }
  return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int n, x; std::cin >> n >> x;
    vi a(n); rep(i, n) std::cin >> a[i];
    sort(rng(a));
    int ans = 0;
    rep(i, n-1) {
        if (a[i] <= x) x -= a[i], ans++;
        else break;
    }
    if (a[n-1] == x) ans++;
    std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll mod = 1e9+7;

int main(){
    int n,m;
    cin >> n >> m;
    int ans=0;
    ans=1900*m+100*(n-m);
    ans*=1 << m;
    cout << ans << endl;

     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=5001;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 
 
 
 
int main()
{
  int n;
  cin>>n;
  int fg=0;
  while(n)
  {
	  if(n%10==7)
	  {
		  fg=1;
	   break;
	  }
	  n=n/10;
  }
  if(fg) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string S = Console.ReadLine();
            string T = Console.ReadLine();
            var l = S.Length;
            var diff = 0;
            for(int i=0; i<l; i++)
            {
                if (S[i] != T[i]) diff++;
            }

            Console.WriteLine(diff.ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27524
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int N, L;
string A[100];

int main(void){
	//IO("test.in", "test.out");
	scanf("%d%d", &N, &L);
	cin.get();
	for(int i = 0; i < N; i++) getline(cin, A[i]);
	sort(A, A + N);
	for(int i = 0; i < N; i++) cout << A[i];
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int tc;

int main()
{
    FIO
    ll n; cin>>n;
    ll ans = 0;
    for(int i = 1 ; i <= n ; i++ )
        ans += (n-1) / i;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	ll cnt1[26], cnt2[26];
	for(int i=0; i<26; i++){
		cnt1[i]=0;
		cnt2[i]=0;
	}
	string s, t;
	cin >> s >> t;
	for(ll i=0; i<s.length(); i++){
		cnt1[s[i]-'a']++;
	}
	for(ll i=0; i<t.length(); i++){
		cnt2[t[i]-'a']++;
	}
	sort(cnt1, cnt1+26);
	sort(cnt2, cnt2+26);
	for(int i=0; i<26; i++){
		if(cnt1[i]!=cnt2[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 776
//#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const ll INF=1000000000000005;
const ll maxn=5e5+5;
const int mod=1e9+7;
ll n,m,p;
struct node{
    ll s,e;
    bool friend operator<(node a,node b)
    {
        return a.e<b.e;
    }
}num[maxn];
inline bool read(ll &num)
{
        char in;bool IsN=false;
        in=getchar();
        if(in==EOF) return false;
        while(in!='-'&&(in<'0'||in>'9')) in=getchar();
        if(in=='-'){ IsN=true;num=0;}
        else num=in-'0';
        while(in=getchar(),in>='0'&&in<='9'){
                num*=10,num+=in-'0';
        }
        if(IsN) num=-num;
        return true;
}

int main()
{
    scanf("%lld%lld%lld",&n,&m,&p);
    if(n==m){
        for(int i=1;i<=n;i++)
            printf("%lld ",p);
    }
    else{
        if(p==1)
        {
            for(int i=1;i<=m;i++)
                printf("1 ");
            for(int i=m+1;i<=n;i++)
                printf("2 ");
        }
        else
        {
            for(int i=1;i<=m+1;i++)
            {
                if(i%2==1) printf("%lld ",p-1);
                else printf("%lld ",1ll);
            }
            for(int i=m+2;i<=n;i++)
                printf("%lld ",p+1>1000000000ll?p-7ll:p+1ll);
        }
    }
    return 0;
}
/***
***/


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<long>num(N,0);
  
  for(int i=0;i<N;i++){
    cin >> num[i];
  }
  
  int ans = 0;
  
  for(int i=0;i<N;i++){
    while(num[i] % 2 == 0){
      num[i] /= 2;
      ans++;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long W = sc.nextInt();
    final int V = 1000;
    long[] w = new long[N];
    int[] v = new int[N];
    for(int i = 0; i < N; i++){
      w[i] = sc.nextLong();
      v[i] = sc.nextInt();
    }
    long[][] memo = new long[N+1][N*V+1];
    for(int i = 0; i <= N; i++){
      Arrays.fill(memo[i], 10000000000L);
      memo[i][0] = 0;
    }
    System.out.println(solve(memo, w, v, W, N));
  }
  
  public static long solve(long[][] memo, long[] w, int[] v, long W, int N){
    for(int i = 1; i < memo.length; i++){
      for(int j = 0; j < memo[i].length; j++){
        memo[i][j] = memo[i-1][j]; 
        if(j - v[i-1] >= 0){
          memo[i][j] = Math.min(memo[i][j], memo[i-1][j-v[i-1]] + w[i-1]);
        }
      }
    }
    for(int i = memo[N].length-1; i >=0; i--){
      if(memo[N][i] <= W){
        return i;
      }
    }
    return 0;
  }
}

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

int N,K;
bool f[100000];
void solve(){
    fill_n(f,N,false);
    bool white=false;
    for(int i=0;i<K;i++){
        int a;scanf("%d",&a);
        if(a)f[--a]=true;
        else white=true;
    }
    int ma=0;
    int prev=0,cur=0,val=0;

    while(cur<N){
        if(!f[cur]){cur++;continue;}
        int next=cur;
        while(next<N&&f[next])next++;
        int x=next-cur;
        if(white&&prev+1==cur)x+=val+1;
        ma=max(ma,x);
        val=next-cur;
        prev=next;
        cur=next;
    }

    printf("%d\n",ma);
}
int main(){
    while(scanf("%d%d",&N,&K),N||K)solve();

    return 0;
}

Measured memory_bytes: 1284
#include<bits/stdc++.h>
using namespace std;
#define mx 1000000000000000000
#define ll long long int
//ll a[40001000];
//ll number[20],used[20];
int main()
{
    ll a,b,c;
    cin>> a;
    if(a%1000==0)
        cout << '0' << endl;
    else{
         b= a/1000;
    c= (b+1)*1000 - a;
    cout << c << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main(){
    
    int n;
    string s;
    cin>>n>>s;
    
    if(n<3200){
        cout<<"red";
    }
    else{
        cout<<s<<endl;
    }
    
    
    return 0;
    
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <stdio.h>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORa(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define FORs(i,st) for(auto i : st)
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

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

    ll q;
    cin>>q;

    vector<ll> v;
    FOR(i,0,q){
      ll in;
      cin>>in;
      if(in == 0){
        ll x = 0;
        cin>>x;
        v.push_back(x);
      }
      else if(in == 1){
        ll x = 0;
        cin>>x;
        cout<<v[x]<<endl;
      }
      else{
        v.pop_back();
      }


    }
}



Measured memory_bytes: 4924
xysort (x:y:_)
  | x < y = [x,y]
  | otherwise = [y,x]

ft [] = []
ft [x] = show(x)
ft (x:xs) = show (x) ++ " " ++ ft xs

main = do
  xy <- getLine
  if xy == "0 0"
    then
      return []
    else do
      let ss = map (read :: String -> Int) $ words xy
      putStrLn $ ft $ xysort ss
      main

Measured memory_bytes: 4072
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1e18;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcd(ll a, ll b){return abs(a*b)/gcd(a,b);}

int main(void) {
    ll N, M;
    cin >> N >> M;
    vector<ll> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    ll lcd_a = a[0];
    for (int i = 1; i < N; ++i) {
        lcd_a = lcd(lcd_a, a[i]);
    }
    ll a2 = a[0];
    ll a2c0 = 0;
    while (a2 % 2 == 0) a2 /= 2, a2c0++;
    for (int i = 1; i < N; ++i) {
        a2 = a[i];
        ll a2ci = 0;
        while (a2 % 2 == 0) a2 /= 2, a2ci++;
        if (a2c0 != a2ci) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << max(0ll, (M - lcd_a/2) / lcd_a + (M >= lcd_a/2 ? 1 : 0)) << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}


void solve(long long N, std::vector<long long> V, std::vector<long long> C){
    ll ans = 0;
        for (int i = 0; i < N; i++)
        {
            if(V[i] - C[i] > 0){
                ans+= V[i]-C[i];
            }
        }
        
        cout << ans << endl;
}

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


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

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



int main()
{
    int N;
    cin >> N;
    if (N % 2) {
        cout << N / 2 + 1 << endl;
    }
    else
    {
        cout << N / 2 << endl;
    }
    return 0;
}

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

int main()
{
	int N, i, redCount;
	redCount = 0;
	string s;
	cin >> N;
	cin >> s;
	for (i = 0; i < N; i++)
	{
		if (s[i] == 'R')
		{
			redCount += 1;
		}
	}
	cout << ((redCount > (N - redCount)) ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toInt)
    val alist = readLine()!!.split(' ').map(String::toInt)

    var count = 0
    val lengthList = alist.groupBy { it }
            .map { entry -> entry.value.size }.sorted()
    val sliced = lengthList.slice(0..(lengthList.size - k - 1)).sum()
    println(sliced)
}


Measured memory_bytes: 108456
#include<stdio.h>
#define INF 100000000
int A[101][101];
int P[101];
int n;
void bfs(int s,int c){
  int i;
  for(i=0;i<n;i++){
    if(A[s][i+1]==1 && P[i+1] > c){
      P[i+1] = c;
      bfs(i+1,c+1);
    }
  }
}
int main(){
  int i,j;
  int u,k,v;
  for(i=0;i<100;i++){
    P[i+1] = INF;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u][v] = 1;
    }
  }
  P[1]=0;
  bfs(1,1);
  for(i=0;i<n;i++){
    printf("%d ",i+1);
    if(P[i+1]==INF) printf("-1");
    else printf("%d",P[i+1]);
    printf("\n");
  }
  return 0;
}



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

int sirqule(int W,int H,int x,int y,int r){
    int sum=0,sum2=0;
    sum=x+r;
    sum2=y+r;
    if(sum<=W){
        if(sum2<=H){
            return 1;
        }
        return 0;
    }
    return 0;
}

int main(){
    int x,y,r,W,H;
    cin>>W>>H>>x>>y>>r;
    if (x <= 0 || y <= 0) {
		cout << "No" << endl;
		return 0;
	}
    if(sirqule( W,H,x,y,r)==1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
    
    
}


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

#define STRING(str) #str
#define ll long long

template <typename T >
void print_vec_1d(vector<T> x, string name) {
	cout << name << endl;
	cout << "[ ";
	for (int i=0;i<x.size();i++) {
		cout << x[i];
		if (i != x.size()-1) cout << ", ";
		else cout << " ]" << endl;
	}
}

int main() {
	int N, D;
	cin >> N >> D;
	vector<int> X(N), Y(N);
	for (int i=0;i<N;i++) {
		cin >> X[i];
		cin >> Y[i];
	}

	two_sat ts(N);
	for (int i=0;i<N;i++) {
		for (int j=i+1;j<N;j++) {
			if (abs(X[i]-X[j]) < D) {
				ts.add_clause(i, false, j, false);
			}
			if (abs(X[i]-Y[j]) < D) {
				ts.add_clause(i, false, j, true);
			}
			if (abs(Y[i]-X[j]) < D) {
				ts.add_clause(i, true, j, false);
			}
			if (abs(Y[i]-Y[j]) < D) {
				ts.add_clause(i, true, j, true);
			}
		}
	}

	if (ts.satisfiable()) {
		cout << "Yes" << endl;
		vector<bool> ans = ts.answer();
		for (int i=0;i<N;i++) {
			if (ans[i]) {
				cout << X[i] << endl;
			} else {
				cout << Y[i] << endl;
			}
		}
	} else {
		cout << "No" << endl;
	}
}

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

const long long p = 1000000007;
long long dp[100000];
long long sum[100000];


int main() {
	long long n, k;
	long long m = 1;
	cin >> n >> k;
	while(m*m <= n) m++;
	m--;
	for(int i=0;i<n/(m+1);i++) dp[i] = 1;
	for(int i=0;i<m;i++) dp[n/(m+1)+i] = n/(m-i) - n/(m-i+1);
	sum[0] = dp[0];
	for(int i=1;i<m+n/(m+1);i++) sum[i] = dp[i] + sum[i-1];
	for(int l=1;l<k;l++) {
		for(int i=0;i<n/(m+1);i++) dp[i] = sum[n/(m+1)+m-i-1];
		for(int i=0;i<m;i++) dp[n/(m+1)+i] = (n/(m-i) - n/(m-i+1)) * sum[m-i-1] % p;
		sum[0] = dp[0];
		for(int i=1;i<m+n/(m+1);i++) sum[i] = (dp[i] + sum[i-1]) % p;
	}
	cout << sum[m+n/(m+1)-1] << endl;
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main() {
    int G[6][2] = {
        { 3, 4 },
        { 4, 3 },
        { 1, 4 },
        { -1, 5 },
        { 3, -1 },
        { 2, 1 }
    };

    for(string s; cin >> s, s != "#"; ) {
        int cur = 0;
        for(int i = 0; i < (int)s.length(); i++) {
            cur = G[cur][s[i] - '0'];
            if(cur == -1) break;
        }
        cout << (cur == 1 ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<ll,ll> pint;

ll a[200001];
int main(){
    int n,ai;
    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    ll ans=0;
    ll l=0,r=0;
    ll sum=0,x=0;
    while(r<n){
        sum+=a[r],x^=a[r];
        if(sum==x) ;
        else{
            while(l<=r&&sum!=x){
                sum-=a[l],x^=a[l];
                ++l;
            }
        }
        ans+=r-l+1;++r;
    }
    cout<<ans<<endl;
    return 0;
}

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


int main() {
    int N,cnt=0;
    cin >> N;
    vector<int> A(N);
    
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    
    sort(A.begin(),A.end());
    
    for(int i=0;i<N-1;i++){
        if(A.at(i) == A.at(i+1))cnt++;
            }
    
    if(cnt > 0)cout << "NO" << endl;
    else cout << "YES" << endl;
    
    
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define fi first
#define se second
#define vi vector< int > 
#define pii pair<int,int>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	int x,n; cin >> x >> n;
	vector<int> a(n),vis(500);
	for (int i = 0; i < n; i++) cin >> a[i],vis[a[i]] = 1;
	int dif = 1000,ans;
	for (int i = 0;i <= 200; i++) {
		if (!vis[i])
		if (dif > abs(x - i)) {
			dif = abs(x-i);
			ans = i;
		}
	}
	cout << ans;
	
	
}

Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll a, b;
	cin >> a >> b;
	int q;
	cin >> q;
	vector<ll> s(a), t(b);
	rep(i, a) cin >> s[i];
	rep(i, b) cin >> t[i];
	rep(i, q){
	    ll x;
	    cin >> x;
	    int p = lb(all(s), x) - s.begin();
	    int p1 = lb(all(t), x) - t.begin();
	    int p2 = p - 1;
	    int p3 = p1 - 1;
	    ll ans = 1e18;
	    if(p < a && p1 < b) ans = min(ans, max(abs(x - s[p]), abs(x - t[p1])));
	    if(p2 >= 0 && p3 >= 0) ans = min(ans, max(abs(x - s[p2]), abs(x - t[p3])));
	    if(p < a && p3 >= 0) ans = min(ans, min(abs(x - t[p3]) + abs(s[p] - t[p3]), abs(x - s[p]) + abs(s[p] - t[p3])));
	    if(p2 >= 0 && p1 < b) ans = min(ans, min(abs(x - t[p1]) + abs(s[p2] - t[p1]), abs(x - s[p2]) + abs(s[p2] - t[p1])));
	    cout << ans << endl;
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/

Measured memory_bytes: 2944
package main

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

func bsearch(a []int, x int) bool {
	n := len(a)
	// invariants: [l, r)
	l := 0 // ok
	r := n // ng
	for r-l > 1 {
		mid := (l + r) / 2
		if a[mid] <= x {
			l = mid
		} else {
			r = mid
		}
	}
	return a[l] == x
}

func main() {
	var n, q int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n)
	for i := range a {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	sc.Scan()
	q, _ = strconv.Atoi(sc.Text())

	ans := 0
	for i := 0; i < q; i++ {
		sc.Scan()
		t, _ := strconv.Atoi(sc.Text())
		if bsearch(a, t) {
			ans++
		}
	}
	fmt.Println(ans)
}



Measured memory_bytes: 2760
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

int n, p[21];

int main() {
    cin >> n;
    rep(i, n) cin >> p[i];
    int ans = 0;
    rep(i, n-2) {
        int a=p[i], b=p[i+1], c=p[i+2];
        if ((a < b && b < c) || (a > b && b > c)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 764
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int N = scan.nextInt();
        int K = scan.nextInt();
        long cnt = 0;
        
        cnt = (long)(K*Math.pow( (K-1) , N-1 ));
        
        System.out.println(cnt);
	  }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n, m, max, ans = 0, k = 0;
    cin >> n >> m;
    vector<ll> x(m), y(m - 1);
    for (int i = 0; i < m; i++)
    {
        cin >> x[i];
    }
    if (n >= m)
    {
        cout << "0" << endl;
    }
    else
    {
        sort(x.begin(), x.end());
        for (int i = 0; i < m - 1; i++)
        {
            y[i] = x[i + 1] - x[i];
        }
        sort(y.begin(), y.end());
        for (int i = 0; i < m - n; i++)
        {
            ans += y[i];
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(){

	string s; cin >> s;
	string ans;
	for(auto c : s){
		if(c == 'B'){
			if(ans.size() != 0) ans.pop_back();
		}else{
			ans += c;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

using P = pair<double,double>;
P merge(P a,P b){
  return P((a.first+b.first)/2,(a.second+b.second)/2);
}

bool check(P a,P b){
  return max(abs(a.first-b.first),abs(a.second-b.second)) < 0.00001;
}

int main(){
  int n = in();
  if(n&1){
    cout << "NA" << endl;
    return 0;
  }
  vector<P> line(n);
  foreach(i,line)cin>>i;
  vector<P> mids;
  rep(i,n/2){
    mids.emplace_back(merge(line[i],line[i+n/2]));
  }
  rep(i,n/2){
    rep(j,n/2){
      if(!check(mids[i],mids[j])){
        cout << "NA" << endl;
        return 0;
      }
    }
  }
  printf("%.20lf %.20lf\n",mids[0].first,mids[0].second);
  return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int main()
{
    int x;
    cin >> x;
    if( x >= 30 )
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;    
}

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

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

  int c[N]; 
  rep(i,N){
    c[i]=0;
  }
  int M = sqrt(N);
  rep(i,M) {
    int x = i + 1;
    int xx = x*x;
    if (xx > N) break;
    rep(j,M){
      int y = j + 1;
      int yy = y*y;
      int xy = x*y;
      if (xx + yy + xy > N) break; 
      rep(k,M){
        int z = k + 1;
        int n = xx + yy + z*z + xy + y*z + z*x;
        if (n > N) break;
        rep(l,N){
          if (l+1==n) c[l]++;
        }
      }
    }
  }
  rep(i,N){
    cout << c[i] << endl;
  }
}


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

int main() {
  string S,T;
  cin >> S >> T;
  int ans=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3916
N, K = map(int, input().split())

prob = 0
for now_ in range(1, N+1):
  times = 0
  if now_ >= K:
    prob += (1/N) * (N - now_ + 1)
    break
    
  while K > now_:
    now_ *= 2
    times += 1
  prob += (1/N) * (1/2)**times
print(prob)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int a, b, c, x, y;

signed main() {
	cin >> a >> b >> c >> x >> y;
	
	int ans1 = 0;
	ans1 = min(a + b, 2 * c) * min(x, y);
	
	int ans2 = 0;
	ans2 += a * (x - min(x, y));
	ans2 += b * (y - min(x, y));
	
	cout << min(ans1 + ans2, 2 * c * max(x, y)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<string>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll N;
	cin >> N;
	ll d[N + 100];
	for (ll i = 0; i < N; i++){cin >> d[i];}
	map<ll, ll>mp;
		for (ll i = 0; i < N; i++) {
			mp[d[i]]++;
		}
	ll res = 0;
	for(auto p:mp){
      ll x=p.second;
      if(x>0)res++;}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    // 整数の入力
    int N;
    int H[20];
    int num,max_hight;

    cin >> N ;
    for (int i =0 ; i<N ; i++){
        cin >> H[i];
    }
    num = 0;
    max_hight = 0;
    for(int i = 0 ; i < N ; i++){
        if(H[i] >= max_hight){
            num = num + 1;
            max_hight = H[i];
        }
    }

    cout << num;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main{
	public static void main(String[] args){
		int[] a = new int[3];
		Scanner in = new Scanner(System.in);
		
		for(int i=0; i<3; i++){
			a[i] = in.nextInt();
		}
		
		Arrays.sort(a);
		
		System.out.println(a[0]+" "+a[1]+" "+a[2]);
		
		in.close();
	}
}

Measured memory_bytes: 17164
#include<stdio.h>

int main(){

  int a,b,c,i = 1;
  scanf("%d %d",&a,&b);


  c = a;

  if( b == 1 ){
    i = 0;
  }else{
    while(c < b){
      c = c + a;
      c--;
      i++;
    }
  }

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

  return 0;

}



Measured memory_bytes: 128
import java.io.*;
import java.util.*;

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;
	
	boolean can(int max, int sum) {
		long total = (long)max * (max + 1) / 2;
		
		
		boolean ret = sum <= total;
		
		if (ret) {
			
			for (int i = max; i >= 1; i--) {
				if (sum >= i) {
					out.println(i);
					sum -= i;
				}
			}
			
		}
		
		return ret;
	}

	void solve() throws IOException {
		int n = nextInt();
		
		int ans = 1;
		while (true) {
			if (can(ans, n)) {
//				out.println(ans);
				return;
			}
			ans++;
		}
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 8912
def binarysearch(n,key,A):
    left=0
    right=n
    while left<right:
        mid=int((left+right)/2)
        if A[mid]==key:
            return 1
        elif key<A[mid]:
            right=mid
        else:
            left=mid+1
    return 0

if __name__=="__main__":
    n=int(input())
    S=list(map(int,input().split()))
    q=int(input())
    T=list(map(int,input().split()))
    result=0
    for i in range(q):
        result+=binarysearch(n,T[i],S)
    print(result)



Measured memory_bytes: 16708
import java.util.Scanner;
public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int X=(sc.nextInt())-1;
		int Y=(sc.nextInt())-1;
		int ans[]=new int[N-1];

		for(int start=0;start<N-1;start++) {
			for(int goal=start+1;goal<N;goal++) {
				if(start<=X) {
				if(goal<=X) {
					ans[goal-start-1]++;
				}else {
					if((X+Y+1)/2>=goal) {
						ans[goal-start-1]++;
					}else {
						//System.out.println("a");
						ans[X-start+Math.abs(goal-Y)]++;
					}
				}}else {
					if(start-X+Math.abs(goal-Y)+1<=goal-start) {
						ans[start-X+Math.abs(goal-Y)]++;
					}else {
						ans[goal-start-1]++;
					}
				}

			}
		}
		for(int i=0;i<N-1;i++) {
			System.out.println(ans[i]);
		}

	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int k; cin>>k;
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    k--;
    cout << a[k] << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void){
    string S;
    cin >> S;
    string result;
    if( S == "Sunny"){
        result = "Cloudy";
    }
    if( S=="Cloudy"){
        result = "Rainy";
    }
    if(S=="Rainy"){
        result = "Sunny";
    }

    cout << result << endl;
}

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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define pb push_back


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alpha = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
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; }




/* main */


signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);


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

    rep(i,0,n - 1){
        int plus = i;
        int minus = n - 1 - plus;

        if(d * minus * - 1 + c * plus <= b - a && b - a <= c * minus * - 1 + d * plus){
            print("YES");
            return 0;
        }


    }
    print("NO");






    



    





    


    

}



Measured memory_bytes: 256