akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

struct LAKE {
	int start;	// start is negasitive integer.
	int end;	// end is positive integer.
	int square;
};

bool isInLake(int left, int right, vector<LAKE>& L, int& targetL) {
	for(int i=0; i<(int)L.size(); ++i) {
		if(L[i].start > left && L[i].end > right) {
			targetL=i;
			return true;
		}
	}
	targetL = -1;
	return false;
}

int main() {
	int n,max,min,h,k=0,S=0,idxL;
	string buf;
	LAKE tempL;
	vector<LAKE> L;
	vector<queue<int> > land;
	cin >> buf;
	n=(int)buf.size()+1;
	land.resize(2*n);
	h=0;
	max=n;
	min=n;
	for(int i=1; i<=n; ++i) {
		if(buf[i-1]=='/' ) {
			if(i!=1&&buf[i-2]=='/') ++h;
			land[n+h].push(i);
			if(n+h>max) { max=n+h; }
		} else if (buf[i-1]=='\\') {
			if(i!=1&&buf[i-2]!='/') --h;
			land[n+h].push(-i);
			if(n+h<min) { min=n+h; }
		} else if (buf[i-1]=='_') {
			if(i!=1&&buf[i-2]=='/') {
				++h;
			}
		}
	}
	for(int i=max; i>=min; --i) {
		int temp_l,temp_r;
		while(!(land[i].empty())) {
			temp_l=land[i].front();
			land[i].pop();
			if(temp_l<0 && !(land[i].empty()) ) {
				temp_r=land[i].front();
				land[i].pop();
				if(isInLake(temp_l,temp_r,L,idxL)==false) {
					tempL.start=temp_l;
					tempL.end=temp_r;
					tempL.square=temp_r+temp_l;
					L.push_back(tempL);
					++k;
				} else {
					L[idxL].square+=temp_r+temp_l;
				}
			}
		}
	}
	sort(L.begin(),L.end(),[](LAKE L1,LAKE L2) {
		return L1.end<L2.end;
	});
	for(int i=0; i<k; ++i) {
		S+=L[i].square;
	}
	printf("%d\n%d",S,k);
	for(int i=0; i<k; ++i) {
		printf(" %d",L[i].square);
	}
	printf("\n");
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5+10;
const ll INF = 1e18;

int A[N], n;
ll ans;

ll dfs(int d, ll cur) {
    if (2*cur < A[d]) return -1;
    if (d == n) {
        return min(cur, 1LL*A[d]);
    }
    ll tans = dfs(d+1, min(INF, 2*cur-A[d]));
    if (tans < 0) {
        return -1;
    }
    ans += tans;
    return min(cur, A[d]+tans);
}

void solve() {
    scanf("%d", &n);
    for (int i = 0; i <= n; i++) scanf("%d", A+i);

    if (n == 0) {
        if (A[0] == 1) {
            printf("1\n");
        } else {
            printf("-1\n");
        }
        return ;
    }
    if (A[0] != 0) {
        printf("-1\n");
        return ;
    }

    ans = 1;
    ll ret = dfs(1, 1);
    if (ret < 0) {
        printf("-1\n");
    } else {
        for (int i = 1; i <= n; i++) ans += A[i];
        printf("%lld\n", ans);
    }

}

int main() {

    int T = 1;
    // scanf("%d", &T);
    while (T--) solve();

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n;
ll c[101010],s[101010],f[101010];

int main(){
	cin>>n;
  rep(i,n-1)cin>>c[i]>>s[i]>>f[i];
  rep(i,n){
    ll t=0;
    repl(j,i,n-1){
      t=((max(s[j],t)+f[j]-1)/f[j])*f[j]+c[j];
    }
    cout<<t<<endl;
  }
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int n, k;
    vector<int> a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> k;
        a.push_back(k);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int alice = 0, bob = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0) alice += a[i];
        else           bob   += a[i];
    }
    cout << alice - bob << endl;
    return 0;
}

Measured memory_bytes: 256
/*
They turn the lights down low,
In shadows hiding from the world,
Only coming out when it gets cold

The seas part when they hit the floor,
The voices carry on and out the door
And everything you touch turns into gold

Like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(your answer's always 'maybe')
That's when I got up and left

A beating heart and a microphone,
A ticking clock in an empty home
Still tells of these times so long ago,

Even though I've come so far,
I know I've got so far to go
And any day now I'll explode

Like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(your answer's always 'maybe')
That's when I got up and left

And each and everyday will lead into tomorrow
Tomorrow brings one less day without you
But don't wait up just leave the light on
'Cause all the roads that I might take
Will all one day lead back to you

And like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(never cease to amaze me)
That's when I got up and left
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);

	int x,t;
	cin>>x>>t;
	cout.precision(12);
	cout<<fixed<<x*1.0/t<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kishan Sairam Adapa
 */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ll long long int
#define MOD ((int)(1e9) + 7)

using namespace std;

class BFoodsLovedByEveryone {
public:
    void solve(istream& cin, ostream& cout) {
        int n, m;
        cin >> n>> m;
        vector<int> a(m+1, 0);
        for(int i=0; i<n; i++) {
            int k;
            cin >> k;
            for(int j=0; j<k; j++) {
                int tp; cin >> tp;
                a[tp]++;
            }
        }
        int cnt = 0;
        for(auto k: a) {
            if(k == n) cnt++;
        }
        cout << cnt << '\n';
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    BFoodsLovedByEveryone solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string.h>

using namespace std;

#define _ABS(X) (((X) < 0) ? -(X) : (X))

int N;
int A[505];
int K;
int sum;
int ans;

bool can(int num)
{
	priority_queue<int> pq;
	int sum = 0;
	int temp;

	for (int i = 0; i < N; ++i)
	{
		pq.push(num - A[i] % num);
		sum += num - (A[i] % num);
	}

	temp = sum;

	while (sum)
	{
		temp -= pq.top();
		sum -= num;
		pq.pop();
	}

	return temp <= K;
}

int main()
{
	scanf("%d %d", &N, &K);

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

	for (int i = 1; i*i <= sum; ++i)
	{
		if (sum%i) continue;

		if (can(i))
		{
			if (i > ans) ans = i;
		}
		if (can(sum / i))
		{
			if (sum / i > ans) ans = sum / i;
		}
	}

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

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		long ar[]=new long[n+1];
		long[][] sumtill=new long[100001][2];
		
		for(int i=1;i<=n;i++)
		{
			ar[i]=scan.nextLong();
		}
		sumtill[1][0]=ar[1];
		sumtill[1][1]=ar[1];
		sumtill[2][1]=-ar[1]-ar[2];
		sumtill[2][0]=ar[1]+ar[2];
		for(int i=3;i<=n;i++)
		{
			long maxwithout=Math.max(sumtill[i-2][0],sumtill[i-2][1]);
			
			sumtill[i][0]=ar[i]+Math.max(ar[i-1]+maxwithout,sumtill[i-1][1]);
			sumtill[i][1]=-ar[i]+Math.max(-ar[i-1]+maxwithout,sumtill[i-1][1]+2*ar[i-1]);
			
		}
		long answer=Math.max(sumtill[n][0],sumtill[n][1]);
		System.out.println(answer);
		
	}
}


Measured memory_bytes: 66180
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define debug(x_) cerr << #x_ << ":" << x_ << endl;
#define debug2(x__) for(auto a__ : x__) cerr << a__ << " "; cerr << endl;
#define debug3(x___ , sx___) rep(i, sx___) cerr << x___[i] << " "; cerr << endl;

vector<pii> around = {MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1)};

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

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n == 1) cout << "Hello World" << endl;
    else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}



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


public class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int L = scan.nextInt();
        String str[] = new String[N];
        String ans = "";

        for(int i=0; i<N; i++){
            str[i] = scan.next();
        }
        Arrays.sort(str);
      
        for(int i=0; i<N; i++){
            ans = ans + str[i];
        }
    System.out.println(ans);
    }
}


Measured memory_bytes: 13908
import sys

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[-1] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
    if(p > 10 ** 18):
      print(-1)
      sys.exit()
  print(p)

Measured memory_bytes: 21596
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int pow2[33];
int ans[33];
int range[33];

double sign(double A){
    return (A>0)-(A<0);
}

signed main(void) {
    int N; cin >> N;
    if (N==0) {
        cout << 0 << endl;
        return 0;
    }
    int rest = N;
    pow2[0] = 1;
    ans[0] = 0;
    Rep(i, 1, 33) {
        pow2[i] = pow2[i-1] * (-2);
        ans[i] = 0;
    }
    range[0] = 1;
    range[1] = 2;
    Rep(i, 2, 33) {
        range[i] = range[i-2] + (1LL<<i);
//        cout << "range[" << i << "]=" << range[i] << endl;
    }

    while(rest != 0) {
        int dig;
        for(dig=0; dig<33; dig++) {
            if (rest >= 0 && dig % 2 == 1) continue;
            if (rest < 0 && dig % 2 == 0) continue;
            if (abs(range[dig]) >= abs(rest) && abs(rest) > abs(range[dig-2])) {
                break;
            }
        }
        ans[dig] = 1;
        rest -= pow2[dig];
    }

    bool flag=false;
    for(int dig=32; dig>=0; dig--) {
        if (ans[dig] == 1) flag = true;
        if (flag) cout << ans[dig];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX (52)

int main(void) {
	char SUITS[] = "SHCD";
	char suit;
	int cards[MAX] = {};
	int count, number;
	int i;
	
	scanf("%d\n", &count);
	for (i = 0; i < count; i++) {
		scanf("%c %d\n]", &suit, &number);
		switch (suit) {
		case 'H': number += 13; break;
		case 'C': number += 13 * 2; break;
		case 'D': number += 13 * 3; break;
		default: break;
		}
		cards[number - 1] = 1;
	}
	for (i = 0; i < MAX; i++) {
		if (!cards[i]) {
			printf("%c %d\n", SUITS[i / 13], (i % 13) + 1);
		}
	}

	return 0;
}

Measured memory_bytes: 596
function Main(input) {
  var hotels = input.split("\n")[1].split(" ");
  var max = 0;
  var count = 0;
  for(var i=0; i<hotels.length; i++){
  	if(parseInt(hotels[i])>=max){
    	max = hotels[i];
        count++;
    }
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

p = 10 ** 9 + 7
p2 = 10 ** 9 + 9
q = 1007
q2 = 2009

def rollingHash(N, M, A, ans):
	mul1 = 1
	mul2 = 1
	for i in range(M):
		mul1 = (mul1 * q) % p
		mul2 = (mul2 * q2) % p2

	Droll1 = defaultdict(lambda:-1)
	Droll2 = defaultdict(lambda:-1)
	val1 = 0
	val2 = 0
	for i in range(M):
		val1 = val1 * q + A[i]
		val1 %= p
		val2 = val2 * q2 + A[i]
		val2 %= p2

	Droll1[val1] = 0
	Droll2[val2] = 0
	rolling_Hash1 = [None] * (N - M + 1)
	rolling_Hash1[0] = val1
	rolling_Hash2 = [None] * (N - M + 1)
	rolling_Hash2[0] = val2

	for i in range(N - M):
		val1 = (val1 * q - A[i] * mul1 + A[i + M]) % p
		val2 = (val2 * q2 - A[i] * mul2 + A[i + M]) % p2
		rolling_Hash1[i + 1] = val1
		rolling_Hash2[i + 1] = val2

		if Droll1[val1] == -1:
			Droll1[val1] = i + 1
		else:
			if rolling_Hash1[i + 1] == rolling_Hash1[Droll1[val1]] and rolling_Hash2[i + 1] == rolling_Hash2[Droll1[val1]] and i + 1 - Droll1[val1] >= M:
				return M

	return ans

#処理内容
def main():
	N = int(input())
	S = list(input())
	for i in range(N):
		S[i] = ord(S[i]) - 97

	ans = 0
	for i in range(1, int(N // 2) + 1):
		ans = rollingHash(N, i, S, ans)

	print(ans)



if __name__ == '__main__':
	main()

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

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

#define int ll

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

	
	for(int i=0;i<s.length();i++){
		if(i%2==0&&s[i]!='h'){
			cout << "No" << endl;
			return 0;
		}
		if(i%2==1&&s[i]!='i'){
			cout << "No" << endl;
			return 0;
		}
		if(s.length()%2!=0){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i,0,n){
		cin >> p[i];
	}
	int cnt = 0;
	int set_idx = 0;
	rep(i, 0, n) {
		if (p[set_idx] >= p[i]) {
			set_idx = i;
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 1152
open System

let L,R=stdin.ReadLine().Split()|>fun c -> int c.[0],int c.[1]
[<EntryPoint>]
let main argv =
    match R-L>=2019 with
    |true -> 0
    |false -> [for i in [L..R-1] do for j in [i+1..R] do yield ((i%2019)*(j%2019))%2019]|>List.min
    |>stdout.WriteLine
    0

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

using namespace std;

using ll = long long;

bool Solve() {
    constexpr int n = 5;
    int k;
    vector<int> p(n);
    for (int i = 0; i < n; ++i) cin >> p[i];
    cin >> k;

    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (k < p[j] - p[i]) return true;
        }
    }
    return false;
}

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

    if (Solve()) cout << ":(\n";
    else cout << "Yay!\n";

    return 0;
}


Measured memory_bytes: 256
//Hasherd Number

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

int main()
{
  int N;
  cin >> N;
  int c, t;
  t = N;
  while (t > 0)
  {
    c += t % 10;
    t /= 10;
  }
  if (N % c == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int a,b;
        cin >> a >> b;
        int x=(a*b)/(__gcd(a,b));
        cout << x;
        

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            out.print(Math.min(in.nextInt() * in.nextInt(), in.nextInt()));
        }

    }
}



Measured memory_bytes: 21844
#include<stdio.h>
int main(){
	int a,b,result;
	char op;

	while(1){
		scanf("%d %c %d",&a,&op,&b);
	
		if(op=='+'){
			result=a+b;
		}else if(op=='-'){
			result=a-b;
		}else if(op=='*'){
			result=a*b;
		}else if(op=='/'){
			result=a/b;
		}else if(op=='?'){
			break;
		}
		printf("%d\n",result);
	}
	return 0;
}

Measured memory_bytes: 600
#include<cstdio>
int main(){
    int n,a[5]={0x7fff0000,0x7f00ff00,0x70f0f0f0,0x4ccccccc,0x2aaaaaaa};
    scanf("%d",&n);
    for(int i=0;i<5;i++)n=((n&a[i])!=0)?(n&a[i]):n;
    printf("%d",n);
    return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string l;
	cin >>l;
	
	int n=sz(l);
	VL dp = {1, 0};
	rep(i, n){
		VL np(2);
		// a+b =0
		if(l[i]=='0'){
			np[0] += dp[0];
			np[1] += dp[1];
		}else np[1] += dp[0] + dp[1];
	//a+b =1
		if(l[i]=='0') (np[1] += dp[1] * 2) %=MD;
		else{
			(np[0] += dp[0] * 2) %=MD;
			(np[1] += dp[1] * 2) %=MD;
		}
		swap(dp, np);
	}
	cout << (dp[0] + dp[1]) %MD <<"\n";
	return 0;
}


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

#define int long long

#define inf 1000000007LL
#define mod 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
#define rfor(i, s, t) for(int i = (t) - 1; i >= (s); i--)

int d[114514];

signed main() {
  int n, m;
  cin >> n >> m;
  rep(i, n) {
    d[i] = 0;
  }
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    d[a - 1]++;
    d[b - 1]++;
  }
  rep(i, n) {
    if(d[i] % 2 == 1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 1024
object Main extends App {

  val n = scala.io.StdIn.readInt()
  val a = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val b = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val c = scala.io.StdIn.readLine.split(" ").map(_.toInt)

  def solve(): Int = {
    var satisfiedValue = 0
    for(i <- 0 until n) {
      val index = a(i) - 1
      satisfiedValue += b(index)
      if(i != 0 && a(i) - a(i-1) == 1)
        satisfiedValue += c(index-1)
    }
    satisfiedValue
  }
  println(solve)
}


Measured memory_bytes: 27200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = k; i < n; i++)  
#define repp(i,k,n) for(int i = k; i <= n; i++) 
#define per(i,k,n) for(int i = k; i >= n; i--)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii; 
typedef vector<ii> vii;
typedef vector<char> vchar;
typedef vector<int> vi;
#define ff first
#define ss second

#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));

#define INF 1000000000
#define mod 998244353
//#define mod 1000000007
#define endl "\n"


   //=\/=\/=\/=\/=\/=\/=\/=\/=\/=\        Jai Hind Dosto        /=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\
  //=\/=\/=\/=\       RETARDED     ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿      NISHAN                 /=\/=\/=\/=\\
 //=\/=\/=\/=\         APE                                           SINGH                   /=\/=\/=\/=\\
//=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\


int modPow(int a, int b);
void solve(){


    int n;
    int ans=1;
    cin >> n;
    int prens=1;
    int aa[n];
    rep(i,0,n)cin >> aa[i];
    sort(aa,aa+n);
    reverse(aa,aa+n);
    while(n--){
        int tt;
        tt=aa[n];
        prens = ans;
        ans*=tt;
        if(prens!=0){
            if(ans%prens!=0 || ans/prens != tt){
                cout <<"-1\n";
                return; 
            }
        }
        if(ans> 1000000000000000000 || ans<0 || (prens>ans && tt!=0)){
            cout << "-1\n";
            return;
        }
    }
    cout << ans <<endl;









}






signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(2);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
   // int test=1; cin >> test;
   // while(test--)
    solve();
}


int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}


Measured memory_bytes: 4348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    
   ll n; cin >> n;

   ll ans = 9223372036854775807LL;
   for (ll i = 0; i < n; i++) {
       ll tmp_a; cin >> tmp_a;
       ll cnt = 0;
       while (true) {
           ll tmp = tmp_a % 2;
           if (tmp != 0) {
               break;
           }
           cnt++;
           tmp_a /= 2;
       }
       ans = min(ans, cnt);
   }

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

Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
  int K, S;
  int i, j, k;
  int cnt = 0;
  
  scanf("%d %d", &K, &S); 
  
  for (i=0; i <= K; i++) {
    for (j=0; j<=K; j++) {
      k = S-i-j;
        if (k<= K && k>=0) cnt++;
    }
  }
  
  printf("%d\n", cnt);
  
  return 0;
}

Measured memory_bytes: 128
N = int(input())

S = {}
ans_n = 0

for i in range(N):
    s = input()
    if s not in S:
        S[s] = 0
    else:
        S[s] += 1

    ans_n = max(ans_n, S[s])

S = sorted(S.items(), key=lambda x: x[0])


for s in S:
    if s[1] == ans_n:
        print(s[0])


Measured memory_bytes: 44696
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC061D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = ReadLong();
            long N = NM[0];
            long M = NM[1];

            long[] a = new long[M];
            long[] b = new long[M];
            long[] c = new long[M];
            for (long i = 0; i < M; i++)
            {
                var abc = ReadLong();
                a[i] = abc[0] - 1;
                b[i] = abc[1] - 1;
                c[i] = abc[2];
            }

            long SMALL = long.MinValue / 2;
            long[] cost = new long[N];
            for (int i = 0; i < N; i++)
            {
                cost[i] = SMALL;
            }
            cost[0] = 0;

            bool isNegative = false;
            for (int j = 0; j < N; j++)
            {
                bool update = false;
                for (int i = 0; i < M; i++)
                {
                    long start = a[i];
                    long end = b[i];
                    long can = cost[start] + c[i];
                    if (can > cost[end])
                    {
                        cost[end] = can;
                        update = true;

                        //負の検出
                        if (j == N - 1 && end == N - 1)
                        {
                            isNegative = true;
                        }
                    }
                }
                if (!update) break;
            }

            if (isNegative) Console.WriteLine("inf");
            else
            {
                Console.WriteLine(cost[N - 1]);
            }

            Console.ReadKey();
        }




        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}


Measured memory_bytes: 13380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,-1,sizeof(i));
#define pb push_back
int main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	int Min=1e9;
	ll sum =0;
	int f=0;
	f(n){
		int add;
		cin >>add;
		sum += abs(add);
		if(add<0){
			f^=1;
		}
		Min=min(Min,abs(add));
	}
	if(!f){
		cout<<sum<<endl;
	}
	else{
		cout<<sum-Min*2<<endl;
	}
}

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

public class Main{
  public static void main(String[] args) throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] s = br.readLine().split(" ");
    int a = Integer.parseInt(s[0]);
    int b = Integer.parseInt(s[1]);
    
    if(b % a == 0){
      System.out.println(a + b);
    }else{
      System.out.println(b - a);
    }
  }
}

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

bool big_order(const int &a, const int &b) {return a > b;}

int main(void) {
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector <int> p(A), q(B), r(C);
  for (int i = 0; i < A; i++) cin >> p[i];
  for (int i = 0; i < B; i++) cin >> q[i];
  for (int i = 0; i < C; i++) cin >> r[i];

  sort(p.begin(), p.end(), big_order);
  sort(q.begin(), q.end(), big_order);
  sort(r.begin(), r.end(), big_order);

  vector <int> eat(X+Y);
  for (int i = 0; i < X; i++) eat[i] = p[i];
  for (int i = 0; i < Y; i++) eat[i+X] = q[i];

  sort(eat.begin(), eat.end());

  int endpos = min(eat.size(), r.size());
  for (int i = 0; i < endpos; i++) {
    if (eat[i] < r[i]) {
      eat[i] = r[i];
    } else {
      break;
    }
  }
  long long ans = 0;
  for (int i = 0; i < eat.size(); i++) ans += eat[i];
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2176
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    [n, m] <- map read.words <$> getLine :: IO [Int]
    xs <- U.unfoldrN m (B.readInt.B.dropWhile isSpace) <$> B.getLine
    print $ solve n m xs

solve n m xs = sum . take (m - n) . sort $ zipWith (-) (tail ys) ys
  where
    ys = sort $ U.toList xs


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

int main()
{
  int N, M;
  cin >> N >> M;
  
  int sum = 0;
  for(int i = 0; i < M; ++i)
  {
    int a;
    cin >> a;
    sum += a;
  }
  
  if(N < sum)
  {
    cout << "-1" << endl;
  }
  else
  {
    cout << N - sum << endl;
  }
}

Measured memory_bytes: 3584
from collections import defaultdict
N, X, Y = [int(i) for i in input().split()]
X, Y = X-1, Y-1

dd = defaultdict(int)
for i in range(N):
    for j in range(N):
        ans = min(abs(j - i),
                  abs(X - i)+1+abs(j-Y),
                  abs(Y - i)+1+abs(j-X))
        dd[ans] += 1

for i in range(1, N):
    print(dd[i] // 2)


Measured memory_bytes: 55516
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<complex>
#include<algorithm>
#include<vector>
#include<math.h>
#include<set>
#include<map>

int main()
{
	int r, g, b;
	scanf("%d%d%d", &r, &g, &b);
	if (!((g * 10 + b) % 4)) printf("YES\n");
	else printf("NO\n");

	return 0;
}

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

int main() {
  int N, ans = 0, l, n;
  cin >> N;
  for(int i = 0; i < N;i++) {
    char s;
    cin >> s;
    if(s == 'Y') {
      ans++;
    }
  }
  if(ans == 0) {
    cout << "Three" << '\n';
  }
  else {
    cout << "Four" << '\n';
  }
}


Measured memory_bytes: 256
def q(s, l, r)
  a = s[r] - s[l-1]
  b = (r-l+1) - a
  (a + 2*b) % 3
end
S=[0]+gets.chop.chars.map{|c|c==?A ? 1 : 0}
T=[0]+gets.chop.chars.map{|c|c==?A ? 1 : 0}
(1...S.size).each{|i|S[i]+=S[i-1]}
(1...T.size).each{|i|T[i]+=T[i-1]}
gets.to_i.times do
  a,b,c,d=gets.split.map &:to_i
  puts q(S,a,b)==q(T,c,d) ? :YES : :NO
end


Measured memory_bytes: 22604
#include <bits/stdc++.h>
    #define Mod 1000000007
    #define INF 1e9
    #define INFL 9e18
    #define EPS 1e-9
    #define pb push_back
    #define mp make_pair
    #define SET(a) memset(a,-1,sizeof(a))
    #define CLR(a) memset(a,0,sizeof(a))
    #define CPY(a,b) memcpy(a,b,sizeof(a))
    #define all(a) (a).begin(),(a).end()
    #define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 //   #define N 100005
    #define fs first
    #define sc second
    using namespace std;

    typedef  long long int ll;
    typedef pair<ll,ll> ii;
    typedef vector <ii> vii;
    typedef vector <ll> vi;
  
ll _sieve_size; // ll is defined as: typedef long long ll;
bitset<10000010> bs; // 10^7 should be enough for most cases
vi primes; // compact list of primes in form of vector<int>
void sieve(ll upperbound) { // create list of primes in [0..upperbound]
_sieve_size = upperbound + 1; // add 1 to include upperbound
bs.set(); // set all bits to 1
bs[0] = bs[1] = 0; // except index 0 and 1
for (ll i = 2; i <= _sieve_size; i++) if (bs[i]) {
// cross out multiples of i starting from i * i!
for (ll j = i * i; j <= _sieve_size; j += i) bs[j] = 0;
primes.push_back((int)i); // add this prime to the list of primes
} } // call this method in main method
bool isPrime(ll N) { // a good enough deterministic prime tester
if (N <= _sieve_size) return bs[N]; // O(1) for small primes
for (int i = 0; i < (int)primes.size(); i++)
if (N % primes[i] == 0) return false;
return true; // it takes longer time if N is a large prime!
}
ll arr[100005],dp[100005];
 
    int main()
    {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
   ios;
   ll a,b;
   sieve(100005);
   for(int i=1;i<=100005;i++)
   {
    if(isPrime(i) && isPrime((i+1)/2))
      arr[i]=1;
   }
   dp[0]=0;
for(int i=1;i<=100005;i++)
  dp[i]=dp[i-1]+arr[i];
ll q,ans;
cin>>q;
while(q--)
{
  cin>>a>>b;
   ans=dp[b]-dp[a];
   if(arr[a]==1)
    ans++;
  cout<<ans<<endl;
}



    return 0;


    }

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

llint n,a,b;

void solve(){
  cin >> n;
  int ans=0;
  while(n>10){
    ans+=n%10;
    n/=10;
  }
  ans+=n;
  cout << ans << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()

for x in range(N+1):
    if int(x * 1.08) == N:
        print(x)
        sys.exit()


print(":(")


Measured memory_bytes: 4324
#include<stdio.h>
int sorted(int arr[],int a)
{
    int min,flag=1;
    min=arr[0];
    for(int i=1; i<a; i++)
    {
        if(min>arr[i])
        {
            flag=0;
            break;
        }
        else
        {
            min=arr[i];
        }
    }
    return flag;

}
int main()
{
    int n,min,temp,flag=0;
    scanf("%d",&n);
    int a[n];
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    if(sorted(a,n)==1)
    {
        flag=1;
    }
    else
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                temp=  a[i];
                a[i] = a[j];
                a[j] = temp;
                if(sorted(a,n)==1)
                {
                    flag=1;
                    break;
                }
                else
                {
                    temp=a[j];
                    a[j]=a[i];
                    a[i]=temp;
                }
            }
            if(flag==1)
            {
                break;
            }
        }
    }
    if(flag==1)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }

}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=2e5;
const int INF=1e9;
int main(){
	int A,B;cin>>A>>B;
	cout<<(B+A-3)/(A-1)<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String []args) throws Exception {
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        // int n = Integer.parseInt(br.readLine());
        // long [][] dp = new long[n+1][n+1];
        // ArrayList<String> list = new ArrayList<>();
        int n = sc.nextInt();
        double d = sc.nextDouble();
        long x;
        long y ;
        double dis;
        int ans = 0;
        for(int i = 0 ; i < n ; i++){
            x = sc.nextInt();
            y = sc.nextInt();
            x = x*x;
            y = y*y;
            dis = Math.sqrt(x+y);
            if(dis <= d){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

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

int h, w;
vector<string> c;
int d[50][50];

int di[4] = {0, -1, 0, 1};
int dj[4] = {1, 0, -1, 0};

const int INF = 100000;

int main() {
    cin >> h >> w;
    c.resize(h);
    int cnt = 0;
    for(int i=0;i<h;i++){
        cin >> c[i];
        for(int j=0;j<w;j++){
            if(c[i][j] == '.'){
                cnt++;
            }
        }
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            d[i][j] = INF;
        }
    }
    d[0][0] = 0;

    queue<pair<int, int>> q;
    q.push({0, 0});
    while(!q.empty()){
        int i = q.front().first;
        int j = q.front().second;
        q.pop();

        for(int k=0;k<4;k++){
            int ni = i + di[k];
            int nj = j + dj[k];

            if(ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if(c[ni][nj] == '#') continue;

            if(d[ni][nj] > d[i][j] + 1){
                d[ni][nj] = d[i][j] + 1;
                q.push({ni, nj});
            }
        }
    }

    if(d[h-1][w-1] == INF){
        cout << -1 << endl;
        return 0;
    }

    cout << cnt - d[h-1][w-1] - 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[4][4],pd[4][4],tot[101];
int hh()
{
	for(int i=1;i<=3;i++)
	if((pd[i][1]&&pd[i][2]&&pd[i][3])||(pd[1][i]&&pd[2][i]&&pd[3][i]))
	return 1;
	if(pd[1][1]&&pd[2][2]&&pd[3][3])
	return 1;
	if(pd[3][1]&&pd[2][2]&&pd[1][3])
	return 1;
	return 0;
}
signed main()
{
	int x;
	for(int i=1;i<=3;i++)
	for(int j=1;j<=3;j++)
	scanf("%lld",&a[i][j]);
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&x);
		tot[x]=1;
	}
	for(int i=1;i<=3;i++)
	for(int j=1;j<=3;j++)
	if(tot[a[i][j]])
	pd[i][j]=1;
	if(hh())
	printf("Yes");
	else
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define INF 1100000000

int A, B, C, X, Y;

int solve(){
    int ans = 0;
    int min_v = min(X,Y);
    ans += (C * min_v * 2 <= (A + B) * min_v ? C * min_v * 2 : (A + B) * min_v);
    if ((X - min_v) > 0)
        ans += (A * (X - min_v) <= C * 2 * (X - min_v) ? A * (X - min_v) : C * 2 * (X - min_v));
    else if ((Y - min_v) > 0)
        ans += (B * (Y - min_v) <= C * 2 * (Y - min_v) ? B * (Y - min_v) : C * 2 * (Y - min_v));
    
    return ans;
}

int main(){
  cin >> A >> B >> C >> X >> Y;
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N);
  REP(i, N) cin >> A[i];
  ll max1 = 0;
  ll maxid = 0;
  ll max2 = 0;
  REP(i, N) {
    if (max1 < A[i])
      maxid = i;
    max1 = max(max1, A[i]);
  }
  REP(i, N) {
    if (i != maxid)
      max2 = max(max2, A[i]);
  }
  REP(i, N) {
    if (A[i] == max1)
      cout << max2 << endl;
    else
      cout << max1 << endl;
  }

  return 0;
}


Measured memory_bytes: 3200
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll,ll> P;

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

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
const int MAX_N=150000;

int n, dat[2*MAX_N-1];

void init(int n_){
    n=1;
    while(n<n_) n*=2;

    for(int i=0; i<2*n-1; i++) dat[i]=INFint;
}

void update(int k, int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        if(dat[k*2+2]==INFint) {
            dat[k] = a;
        }else {
            dat[k] = gcd(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
}

int query(int a, int b, int k, int l, int r){
    if(r<=a || b<=l){
        return 1;
    }

    if(a<=l && r<=b){
        return dat[k];
    }else{
        int vl = query(a, b, k*2+1, l, (l+r)/2);
        int vr = query(a, b, k*2+2, (l+r)/2, r);
        return gcd(vl, vr);
    }
}
int N;
vector<int>a(100010);

int main() {
    cin >> N;
    rep(i,N){
        cin >> a[i];
    }
    init(N);
    rep(i,N) {
        update(i, a[i]);
    }

    int maximum=0;
    for(int i=0; i<N; i++){
        int temp=a[i];

        if(i==N-1) {
            update(i, a[N-2]);
        }else {
            update(i, a[i+1]);
        }
        maximum=max(maximum, query(0,N,0,0,N));
        update(i, temp);
    }

    cout << maximum << endl;
    return 0;
}


Measured memory_bytes: 1664
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int N;
	int A[1010];

	cin >> N;

	bool ans = true;

	rep(i, N)
	{
		cin >> A[i];
		if (!(A[i] % 2))
		{
			if ((A[i] % 3) && (A[i] % 5))
			{
				ans = false;
				break;
			}
		}
	}

	if (ans)
		cout << "APPROVED";
	else
		cout << "DENIED";

	return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    let stdin = std::io::stdin();
    stdin.lock().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a = iter.next().unwrap().parse::<i32>().unwrap();
    let b = iter.next().unwrap().parse::<i32>().unwrap();
    let result: i32 = a * b;
    if result % 2 == 0 {
        println!("{}", "Even".to_string());
    } else {
        println!("{}", "Odd".to_string());
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e3 + 5;
int main()
{
    ios::sync_with_stdio(false);
    ll n , k;
    cin >> n >> k;
    cout << min(n % k , k - n % k) << endl;
    return 0;
}


Measured memory_bytes: 256