akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#define inf 2e9

using namespace std;

int w, h, k, n;
int dog[5005][10005];
int dp[5005][2];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> w >> h >> k;
	cin >> n;
	int x, y;
	for(int i = 1; i <= n; i++){
		cin >> x >> y;
		if(y%2) continue;
		dog[y/2][x] = 1;
	}
	if(w%2 == 0) w--;
	if(h%2 == 0) h--;
	int W = w/2+1;
	
	k -= W;
	if(k < 0){
		cout << -1 << endl;
		return 0;
	}
	
	int ans = 0;
	for(int i = 1; i <= h/2; i++){
		dp[0][0] = 0, dp[0][1] = inf;
		for(int j = 1; j <= W; j++){
			dp[j][0] = min(dp[j-1][0] + dog[i][j*2-1], dp[j-1][1] + dog[i][j*2-2]);
			if(j < W) dp[j][1] = dp[j-1][0] + dog[i][j*2];
		}
		ans += dp[W][0];
	}
	
	int base = h/2*W - ans;
	if(ans < k) k -= ans, ans = 0;
	else ans -= k, k = 0;
	cout << ans*2 + max(base - k, 0) << endl;
	
	return 0;
}


Measured memory_bytes: 135584
#include<stdio.h>
#define SIZE 1200

int main(){
    char str[SIZE];
    int i=0;

    fgets(str,SIZE,stdin);
    while(1){
        if('A'<=str[i] && str[i]<='Z')
            str[i]+=0x20;
        else if('a'<=str[i] && str[i]<='z')
            str[i]-=0x20;
        i++;
        if(str[i]==NULL)
            break;
    }
    printf("%s",str);
 return 0;
}

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

int main() {
  int N,K;
  int A[15];
  cin >> N >> K;
  rep(i, N) {
    cin >> A[i];
  }
  int comb = (1 << K) - 1;
  long long ans = 1e12;
  while(comb < (1 << N)) {
    long long sum = 0;
    int maxA = 0;
    rep(i, N) {
      if(comb & (1 << i)) {
        if(maxA < A[i]) {
          maxA = A[i];
        } else {
          sum += maxA - A[i] + 1;
          maxA++;
        }
      } else {
        maxA = max(maxA, A[i]);
      }
    }
    ans = min(ans, sum);
    int x = comb & (- comb), y = comb + x;
    comb = ((comb & ~y) / x >> 1) | y;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int S[]=new int[13];
        int H[]=new int[13];
        int C[]=new int[13];
        int D[]=new int[13];
        for(int i=0;i<n;i++){
            String M=sc.next();
            int number=sc.nextInt();
            if(M.equals("S")) S[number-1]=number;
            else if(M.equals("H")) H[number-1]=number;
            else if(M.equals("C")) C[number-1]=number;
            else D[number-1]=number;
            
        }
        for(int i=0;i<13;i++){
            if(S[i]==0)System.out.printf("S %d\n",i+1);
        }
        for(int i=0;i<13;i++){
            if(H[i]==0)System.out.printf("H %d\n",i+1);
        }
        for(int i=0;i<13;i++){
            if(C[i]==0)System.out.printf("C %d\n",i+1);
        }
        for(int i=0;i<13;i++){
            if(D[i]==0)System.out.printf("D %d\n",i+1);
        }
    }
}


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

#define ll long long
#define PB push_back
#define PII pair<int, int>
#define MP make_pair
#define all(x) x.begin(), x.end()
#define REP(x, y, z) for(int x = (y); x <= (z); x++)
#define REPP(x, y, z) for(int x = (y); x >= (z); x--)
#define F first
#define S second
#define MSET(x, y) memset(x, y, sizeof(x)) 
#define EB emplace_back
#define maxn 

//structure

//declaration

//functions

int main(void)
{
	#ifdef DBG
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
	#endif

    ll n;
    cin >> n;

    for(ll i = n; ;i++)
    {
        bool flag = true;
        for(ll j = 2; j <= sqrt(i); j++)
        {
            if(i%j == 0)
                {
                    flag = false;
                    break;
                }
        }

        if(flag)
        {
            cout << i << '\n';
break;        }
    }

	return 0;
}

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

using namespace std;
//int moreGcd

int main(){

    string s;
    cin >> s;
    //s1 = "!" + s1;
    //s2 = "@" + s2;
 
    //vector<vector<int> > T;
    //T = vector<vector<int> >(s1.length() + 1, vector<int>(s2.length() + 1,0));

    if(atoi(s.substr(0,4).c_str()) <= 2019){
        if(atoi(s.substr(5,2).c_str()) <= 4){
            if(atoi(s.substr(8,2).c_str()) <= 30){
                cout << "Heisei" << endl;
                return 0;
            }
        }
        cout << "TBD" << endl;
    }else{
        cout << "TBD" << endl;
    }

}

Measured memory_bytes: 384
A=int(input())
B=int(input())
C=int(input())
X=int(input())

answer =0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      #print(a,b,c,(500*a + 100*b + 50*c ==X))
      answer += (500*a + 100*b + 50*c ==X)
print(answer)

Measured memory_bytes: 3060
let a=Int(readLine()!)!
let s=Array(readLine()!.characters)

var ans = 0
var i = 0
for i in 0..<a {
  if ( (i + 3 <= a) ) {
  	if(s[i] == "A" && s[i + 1] == "B" && s[i + 2] == "C") {
      ans += 1
    }
  } else {
    break
  }
}

print(ans)

Measured memory_bytes: 640
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
p = inl()
c = 20001
a = [c*i for i in range(1,n+1)]
b = [c*(n+1-i) for i in range(1,n+1)]
for i in range(n):
    a[p[i]-1] += i
pad = ''
for i in range(n):
    printn(pad + str(a[i]))
    pad = ' '
print('')
pad = ''
for i in range(n):
    printn(pad + str(b[i]))
    pad = ' '
print('')


Measured memory_bytes: 43160
Date_lis = []
W_lis = []
while True:
    try:
        s,n = map(str,input().split())

        if s in W_lis:
            Date_lis[W_lis.index(s)][1].append(int(n))
        else:
            Date_lis.append([s,[int(n)]])
            W_lis.append(s)
        
    except :
        Date_lis = sorted(Date_lis)
        for i in range(len(Date_lis)):
            print(Date_lis[i][0])
            Num = sorted(Date_lis[i][1])
            for j in range(len(Date_lis[i][1]) - 1):
                
                print(Num[j],end = " ")
            print(Num[len(Date_lis[i][1]) - 1])
        
        break

Measured memory_bytes: 7536
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
x = factorization(n)
x.sort(key=lambda x: x[-1])
a = [0]
b = 3
for i in range(3,30):
    a.append(b)
    b += i
ans = 0
c = 1
for i in range(len(x)):
    for j in range(len(a)):
        if x[i][1] >= a[c]:
            c += 1
        else:
            break
    ans += c
if n == 1:
    print(0)
else:
    print(ans)

Measured memory_bytes: 63556
n = int(input())
A = list(map(int, input().split()))
cnt = 0
B = []
for i in range(n):
    tmp = A[i]
    if tmp<0:
        tmp*=-1
        cnt+=1
    
    B.append(tmp)
print(sum(B)-min(B)*2 if cnt%2!=0 else sum(B))


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

using namespace std;

int main(){
  vector<int> v;
  for(int i = 0;i<3;i++){
    int tmp;
    cin>>tmp;
    v.push_back(tmp);
  }
  sort(v.begin(),v.end());

  cout<<v[2]*10+v[1]+v[0]<<endl;
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
c = input()

num_w = c.count("W")
num_r = N - num_w

comp = "R"*num_r + "W"*num_w
ans = 0
for i in range(num_r):
    if c[i] != comp[i]:
        ans += 1

ans = min(num_w, num_r, ans)
print(ans)

Measured memory_bytes: 67800
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007
const int N = 2e5 + 5;
ll n,k;
ll a[N];
bool ok(ll x){
    ll cuts = k;
    for(int i = 0; i < n; i++){
        cuts -= ((a[i] + x - 1)/x - 1);
    }
    return cuts >= 0;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    
    cin>>n>>k;
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    ll l = 1;
    ll r = 1e9;
    while(l < r){
        ll mid = (l + r)/2;
        if(!ok(mid)){
            l = mid + 1;
        }else{
            r = mid;
        }
    }
    cout<<r;
}

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

using namespace std;

int main()
{
    int k, a, b;    cin >> k >> a >> b;
    for (int i = a; i <= b; i++)
    {
        if(i % k == 0)
        {
            cout << "OK\n";
            return 0;
        }
    }
    cout << "NG\n";
}

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

int main() {
    int A;
    int B;
    int K;
    int *X;
    scanf("%d%d%d", &A, &B, &K);
    for(int i = A;i <= B;i++) {
        if(A + K <= i && i <= B - K)continue;
        printf("%d\n", i);
    }
    return 0;
}


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

int main() {
	
	int A,B,C,D;
	
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> D;
	
	if(A*B >= C*D){
	    printf("%d",A*B);
	}
	else{
	    printf("%d",C*D);
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void READ() {
 #ifndef ONLINE_JUDGE
   freopen("IO/Input.in", "r", stdin);
  #endif
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    READ();
    string s;
    cin >> s;
    if (s.size() < 6) cout << "No" << endl;
    else {
        if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

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

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

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

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

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

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

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

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


fn main() {
    input! {
        N: usize,
    }
    let mut count = 0;
    for i in 1..N+1 { 
        let mut list = Vec::new();
        if i % 2 == 1 {
            let mut max_div = i + 2;
            for j in 1..i+1 {
                if j == max_div { break; }
                if j % 2 == 1 {
                    if i % j == 0 {
                        list.push(j);
                        if i / j != j { 
                            list.push(i / j);
                            max_div = i / j;
                        } else if i / j == j {
                            max_div = j + 1;
                        }
                    }   
                }
            }
            if list.len() == 8 { 
                count += 1; 
                //println!("{}", i);
                //println!("{:?}", list);
            }

        }
    }

    println!("{}", count);
}


Measured memory_bytes: 4352
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int A = one.get(0);
		int B = one.get(1);
		if(A + B >= 10){
			myout("error");
		}else{
			myout(A + B);
		}
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 25404
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPS(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
using ll = long long;
using ld = long double;

int main(void) {
    int N, M;
    cin >> N >> M;
    int sum = 0;
    REP (i, M) {
        int tmp;
        cin >> tmp;
        sum += tmp;
    }
    int ans;
    if (sum <= N) {
        ans = N - sum;
    }
    else {
        ans = -1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
using Graph=vector<vector<int>>;
typedef long long ll;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main(){
    string s;cin>>s;
    string t;cin>>t;
    int flag=0;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]) break;
        if(i==s.size()-1) flag=1; 
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    string S;
    cin >> S;
    int count = S.length();
    bool judge = true;
    for (int i = 0; i < count; i++)
    {
        if (i%2 == 0)
        {
            if (S[i] == 'L')
            {
                judge = false;
            }            
        }else{
            if (S[i] == 'R')
            {
                judge = false;
            }          

        }
        
    }
    if (judge == true)
    {
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 256
N = int(input())
AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB += [(A, B)]
sortA = sorted(AB, key=lambda x: x[0])
sortB = sorted(AB, key=lambda x: x[1])
if N % 2 == 0:
    mid = N//2-1
    A11,B11 = sortA[mid]
    A12,B12 = sortA[mid+1]
    # print(A11, B11)
    # print(A12, B12)
    A1 = (A11+A12) / 2
    B1 = (B11+B12) / 2
    A21,B21 = sortB[mid]
    A22,B22 = sortB[mid+1]
    A2 = (A21+A22) / 2
    B2 = (B21+B22) / 2
    # ans = (min(B1, B2) - max(A1, A2))*2 + 1
    ans = (B2 - A1)*2 + 1
    # print(B1, B2, A1, A2, ans)
    # if ans % 1 != 0:
    #     ans += 1
else:
    mid = (N+1)//2-1
    A1,B1 = sortA[mid]
    A2,B2 = sortB[mid]
    # print(A1, A1, B1, B2)
    ans = (B2 - A1) + 1

print(int(ans))



Measured memory_bytes: 109480
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    use itertools_num::ItertoolsNum as _;
    input! {
       N: usize,
       mut A : [usize;N],
    }

    A.sort();
    A.reverse();
    let mut tmp = vec![];
    tmp.push(A[0]);
    for i in 1..N {
        tmp.push(A[i]);
        tmp.push(A[i]);
    }
    let ans: usize = tmp.iter().take(N - 1).sum();
    echo!(ans);
}


Measured memory_bytes: 9412
#include <stdio.h>
#include <string.h>

int main(void){

  //char s[11];
  int a,b = 0;
  scanf("%d %d", &a, &b);
  //scanf("%d", &b);

  if((a+b)>=(a*b) && (a+b)>=(a-b)) printf("%d", a+b);
  else if((a-b)>=(a*b) && (a-b)>=(a+b)) printf("%d", a-b);
  else if((a+b)<=(a*b) && (a-b)<=(a*b)) printf("%d", a*b);

   

  return 0;
}

  

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

int main() {
  int64_t A,B,K;
  cin >> A>>B>>K;
  

  
  if(A-K>0){
      cout<<A-K<<" "<<B<<endl;
    
  }
  if(A-K<=0&&A+B>K){
   

    cout <<0<<" "<<B+A-K<< endl;
  }
  if(A-K<=0&&A+B<=K){
    cout <<0<<" "<<0<< endl;
  }
}




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

double a,b,n,m,de;

inline double pi()
{
	return M_PI;
}

inline double COS(double tmp)
{
	double k=tmp*pi()/180.00;
	return cos(k);
}

signed main()
{
	cin>>a>>b>>n>>m;
	de=double((30.00*n+(m/60.00)*30.00)-6.00*m);
	if (2*de>360)  de=360-de;
	double now=1.00*a*a+1.00*b*b-2.00*a*b*COS(de);
	cout<<fixed<<setprecision(10)<<sqrt(now)<<endl;
	
	return 0;
}

Measured memory_bytes: 4228
w = []
for i in range(ord("A"), ord("Z") + 1):
  w.append(chr(i))
  
a, b = map(int, input().split())
for i in range(a):
  row = input().split()
  for j in range(b):
    if row[j] == "snuke":
      print(w[j] + str(i + 1))

Measured memory_bytes: 9184
import math
n = int(input())
lis = [0] * n
for i in range(2,n+1):
    now = i
    for j in range(2,math.ceil(math.sqrt(i))+1):
        while now % j == 0:
            now //= j
            lis[j-1] += 1
    if now != 1:
        lis[now-1] += 1

def num(l):
    return len(list(filter(lambda x: x >= l-1, lis)))

print(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys

def calc(n):
    ret = 0
    while n % 2 == 0:
        ret += 1
        n //= 2
    return ret

def solve(N: int, A: "List[int]"):
    ret = 0
    for a in A:
        ret += calc(a)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
ll dp[3005][3005]={0};
int main(){
  ll n,t;
  cin>>n>>t;
  vector<P> vec;
  for(int i=0;i<n;i++){
    ll a,b;
    cin>>a>>b;
    vec.push_back(P(a,b));
  }
  sort(vec.begin(),vec.end());
  for(int i=0;i<t;i++){
    for(int j=0;j<n;j++){
      dp[i][j+1]=max(dp[i][j],dp[i][j+1]);
      ll idx=min(t,i+vec[j].first);
      dp[idx][j+1]=max(dp[idx][j+1],dp[i][j]+vec[j].second);
    }
  }
  ll ans=0;
  for(int i=0;i<=t;i++){
    for(int j=0;j<=n;j++) ans=max(ans,dp[i][j]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll n,k;cin >> n >>k;
    vl v(n);rep(i,n)cin >> v[i];
    vl pat;
    ll sum=0;rep(i,n)sum+=v[i],pat.pb(sum);
    ll subsum=0;
    rep(i,n){
        subsum+=v[i];
        repl(j,i+1,n)pat.pb(pat[j]-subsum);
    }
    per(i,60){
        ll cnt=0;
        rep(j,pat.size()){
            if((1LL<<i)&pat[j])cnt++;
        }
        if(cnt>=k){
            vl p;
            rep(j,pat.size()){
                if((1LL<<i)&pat[j])p.pb(pat[j]);
            }
            pat=p;
        }
    }
    ll ans=pat[0];
    rep(i,k)ans=ans&pat[i];
    cout <<ans <<endl;
}


Measured memory_bytes: 6388
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<ctime>

using namespace std;

#define ll long long
#define N 101000
#define RG register

inline int read(){
    RG int x=0,t=1;RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}

int n,K,A[N],B[N],L[N],R[N],yyb[N<<1],len; ll f[N],sum[N];

#define ls (now<<1)
#define rs ((now<<1)|1)
int val[N<<3];
inline void Pushdown(int now){
	if(!val[now]) return ;
	val[ls]=val[rs]=val[now],val[now]=0;
}
inline void Modify(int l,int r,int now,int L,int R,int w){
	if(L>R) return ; if(l>=L&&r<=R) { val[now]=w; return ; }
	int mid=(l+r)>>1; Pushdown(now);
	if(L<=mid) Modify(l,mid,ls,L,R,w);
	if(R>mid) Modify(mid+1,r,rs,L,R,w);
}
inline int Query(int l,int r,int now,int pos){
	if(l==r) return val[now]; int mid=(l+r)>>1; Pushdown(now);
	if(pos<=mid) return Query(l,mid,ls,pos);
	else return Query(mid+1,r,rs,pos);
}

int main(){
	n=read(),K=read();
	for(RG int i=1;i<=n;++i){
		A[i]=read(),B[i]=read(),sum[i]=sum[i-1]+A[i];
		if(B[i]==1&&2*A[i]>K) return puts("-1"),0;
		if(B[i]==1)	L[i]=(K-2*sum[i-1]%K)%K,R[i]=(K-2*sum[i]%K)%K;
		else L[i]=0,R[i]=K-1; yyb[++len]=L[i],yyb[++len]=R[i];
	}
	sort(yyb+1,yyb+1+len),len=unique(yyb+1,yyb+1+len)-yyb-1;
	for(RG int i=1;i<=n;++i) L[i]=lower_bound(yyb+1,yyb+1+len,L[i])-yyb,
								 R[i]=lower_bound(yyb+1,yyb+1+len,R[i])-yyb;
	for(RG int i=n;i;--i){
		int j=Query(1,len,1,L[i]);
		if(!j) f[i]=0; else f[i]=f[j]+(yyb[L[j]]-yyb[L[i]]+K)%K;
		if(L[i]>R[i]) Modify(1,len,1,R[i]+1,L[i]-1,i);
		else Modify(1,len,1,1,L[i]-1,i),Modify(1,len,1,R[i]+1,len,i);
	}   ll ans=f[1];
	for(RG int i=1;i<=len;++i){
		int j=Query(1,len,1,i);
		if(!j) ans=min(ans,0LL);
		else ans=min(ans,f[j]+(yyb[L[j]]-yyb[i]+K)%K);
	}   printf("%lld\n",ans+2LL*sum[n]);
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

string y="Yes\n", n="No\n";
int ok[202020];
int ans[450][450];

void solve(int num,int sr,int sc,int x){
  if(sr>=x||sc>=x-1) return;
  ans[sr][sc]=ans[sr+1][sc]=num;
  num++;
  for(int i=sc+1;i<x;i++) ans[sr][i]=num++;
  for(int i=sc+1;i<x;i++) ans[sr+1][i]=num++;
  for(int i=sr+2;i<=x;i++){
    ans[i][sc]=ans[sr][i-1];
    ans[i][sc+1]=ans[sr+1][i-1];
  }
  
  solve(num,sr+2,sc+2,x);
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  for(int i=1;i*(i+1)<=202020;i++){
    ok[i*(i+1)]=i;
  }
  int N; cin>>N;
  if(ok[N*2]==0){
    cout<<n<<endl;
    return 0;
  }
  int x=ok[N*2];
  cout<<y<<x+1<<endl;
  solve(1,0,0,x);
  if(ans[x][x-1]==0||ans[x][x-1]>N) ans[x-1][x-1]=ans[x][x-1]=N;
  rep(i,x+1){
    cout<<x<<" ";
    rep(j,x) cout<<ans[i][j]<<" ";
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
const double EPS=1E-8;
////////////////////////////////////////



int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    
    ll n;scanf("%lld",&n);
    ll a[n],b[n];rep(i,0,n-1)scanf("%lld",&a[i]);
    rep(i,0,n-1)scanf("%lld",&b[i]);
    ll ans=0;
    rep(k,1,29){
        ll p=(ll)1<<k;
        ll c[n],d[n];
        rep(i,0,n-1){
            d[i]=b[i]%p;
            c[i]=a[i]%p;
        }
        sort(d,d+n);
        ll sum=0;
        rep(i,0,n-1){
            sum+=lower_bound(d,d+n,p-c[i])-lower_bound(d,d+n,p/2-c[i]);
            sum+=lower_bound(d,d+n,2*p-c[i])-lower_bound(d,d+n,3*p/2-c[i]);
        }
        if(sum%2)ans+=1<<(k-1);
    }
    //cout<<ans<<endl;
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 6528
n=input()
n=list(n)
#print(n)
n1=[0 for i in range(len(n))]
for i in range(len(n)):
    if n[i]=='A' or n[i]=='C' or n[i]=='G' or n[i]=='T':
        n1[i]=1
#print(n1)

cnt=0
maxcnt=0
for i in n1:
    if i==1:
        cnt+=1
        maxcnt=max(maxcnt,cnt)
    else:
        cnt=0
        
print(maxcnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(false)
#define itt cin.tie(0)
#define now cout.tie(0)
using namespace std;
ll n,ans=0;
int main(){
	ll i,a;
	fast;itt;now;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a;
		if(a%2==1&&i%2==0)
		{
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i,x,y) for(int (i)=(x);(i)<(y);(i)++)

int main()
{

  while(true){
    vector<int> H[5];
    int n;

    cin>>n;
    if(n==0){
      break;
    }
    rep(i,0,n){
      rep(j,0,5){
        int temp;
        cin>>temp;
        H[j].insert(H[j].begin(),temp);
      }
    }

    int score=0;
    bool flag=true;
    while(flag==true){
      flag=false;
      rep(i,0,n){
        rep(j,0,3){
          if(H[j][i]==-1||H[j][i]==-2){
            continue;
          }
          int count=1;
          int k=j;
          while(true){
            k++;
            if(k>=5){
              break;
            }
            if(H[j][i]==H[k][i]){
              count++;
            }else{
              break;
            }
          }
          if(count>=3){
            flag=true;
            score+=count*H[j][i];
            rep(ii,j,k){
              H[ii][i]=-1;
            }
            break;
          }
        }
      }

      rep(i,0,5){
        int cnt=0;
        auto iter=H[i].begin();
        while(iter!=H[i].end())
          if(*iter==-1){
            iter=H[i].erase(iter);
            cnt++;
          }else{
            iter++;
          }
        rep(j,0,cnt){
          H[i].push_back(-2);
        }
      }
    }

    cout<<score<<endl;
  }
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int N; cin >> N;
	vector<int> A1(N), A2(N), B1(N+1, 0), B2(N+1, 0);
	rep(i, N) {
		cin >> A1[i];
		B1[i + 1] = B1[i] + A1[i];
	}
	rep(i, N) {
		cin >> A2[i];
		B2[i + 1] = B2[i] + A2[i];
	}

	int ans = 0;
	rep(i, N) {
		ans = max(ans, B1[i+1] + B2[N] - B2[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

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

    int n, m;
    cin >> n >> m;

    vector <P> vec;
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        vec.push_back(P(a, b));
    }

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

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (vec[i].second <= m) {
            ans += vec[i].first * vec[i].second;
            m -= vec[i].second;
        } else {
            ans += vec[i].first * m;
            break;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2420
#include <iostream>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;

  int ans = 0;
  int x;
  for (int i = 0; i < N; ++i) {
    cin >> x;
    const int d = min(x, K - x);
    ans += 2 * d;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		br.close();

		int n = s.length;
		if (s[0] == '0' || s[n - 2] == '0' || s[n - 1] == '1') {
			System.out.println(-1);
			return;
		}
		for (int i = 2; i <= n / 2; i++) {
			if (s[i - 1] != s[n - 1 - i]) {
				System.out.println(-1);
				return;
			}
		}

		PrintWriter pw = new PrintWriter(System.out);
		pw.println("1 " + n);
		int now = 1;
		for (int i = 2; i <= n / 2; i++) {
			pw.println(now + " " + i);
			if (s[i - 1] == '1') {
				now = i;
			}
		}
		for (int i = n / 2 + 1; i < n; i++) {
			pw.println(now + " " + i);
		}
		pw.flush();
	}
}


Measured memory_bytes: 38820
from collections import*
from heapq import*
import sys
input=sys.stdin.readline
 
def BFS(point,d):
    cost=[1e18]*(n+1)
    cost[point]=0
    Q=deque()
    Q.appendleft((0,point))
    
    while Q:
        c,p=Q.pop()
        for np,co in d[p]:
            if cost[np]==1e18:
                cost[np]=c+co
                Q.appendleft((c+co,np))
    return cost

n=int(input())
d=[[]for i in range(n+1)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
    d[b].append([a,c])
#print(d)
q,k=map(int,input().split())
y=BFS(k,d)
 
for i in range(q):
    a,b=map(int,input().split())
    print(y[a]+y[b])


Measured memory_bytes: 87200
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mo 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second
int main()
{
    ll n;cin >> n;
    ll cnt = 0;
    for(int i=0;i<n;i++)
    {
        ll x;cin >> x;
        if(i%2==0 && x%2==1) cnt++; 
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

int main(){
    ll n; cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll combn = a[n-1]+1, combr = 1000000009, c = combn/2, ind = -1;
    rep(i, n-1) b[i] = abs(a[i] - c);
    rep(i, n-1){
        if(b[i] < combr){
            ind = i;
            combr = b[i];
        }
    }
    cout << combn-1 << " " << a[ind] << endl;
    return 0;
}

Measured memory_bytes: 4704
#include<bits/stdc++.h>
#define $$ long long int
#define pb push_back
#define db pop_back
#define q2(n) (n%2)==0
#define vp vector<pair <$$,$$> >
#define vctr vector<$$>
#define in(a) cin>>a;
#define out(a) cout<<a<<"\n";
#define nxt() cout<<"\n";
#define no() cout<<"NO\n";
#define yes() cout<<"YES\n";
#define bug1() cout<<"@ ";
#define bug2() cout<<"# ";
#define ff first
#define ss second
#define ip(n) $$ n; cin>>n;
#define ipar(ar,n) $$ ar[n]; loop(i,0,n) cin>>ar[i];
#define opar(ar,n) loop(i,0,n) cout<<ar[i]<<" ";
#define loop(i,m,p) for ($$ i = m; i < p; i++)
#define loopn(i,m,p) for ($$ i = p-1; i >=m; --i)

using namespace std;

int main()
{
   // ip(t)
   $$ t=1;
    while(t--)
    {
          ip(x) ip(y) ip(z)
          cout<<z<<" "<<x<<" "<<y<<endl;



    }







return 0;
}




Measured memory_bytes: 256
program main;
var
    a, b, c, d, sum : int64;
begin
    sum := 0;
    readln(a, b, c, d);
    if d < a 
        then sum := sum + d
        else begin
            sum := sum + a;
            d := d - a -b;
            if d > 0
                then sum := sum - d;
        end;
    writeln(sum);
end.

Measured memory_bytes: 1388
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;
const ll mod = 1000000007;

template<typename T>
struct Dijkstra {
  int n;
  WeightedGraph<T> es;
  vector<T> dist;
  vector<int> prev;
  Dijkstra(int _n, WeightedGraph<T> _es) {
    init(_n, _es);
  }
  void init(int _n, WeightedGraph<T> _es) {
    n = _n; es = _es;
  }
  void reset() {
    dist.assign(n, inf);
    prev.assign(n, -1);
  }
  void run(int s) {
    reset();
    dist[s] = 0;
    using P = pair<T, int>;
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push(P(0, s));
    while (!pq.empty()) {
      P p = pq.top(); pq.pop();
      T v = p.second;
      if (dist[v] < p.first) continue;
      for (int i=0; i<(int)es[v].size(); i++) {
        edge<T> e = es[v][i];
        if (dist[e.to] > dist[v] + e.cost) {
          dist[e.to] = dist[v] + e.cost;
          pq.push(P(dist[e.to], e.to));
          prev[e.to] = v;
        }
      }
    }
  }
  vector<int> getpath(int t) {
    vector<int> path;
    if (dist[t] == inf) return path;
    for (; t!=-1; t=prev[t]) path.push_back(t);
    reverse(path.begin(), path.end());
    return path;
  }
};

int main()
{
  ll n; cin>>n;
  WeightedGraph<ll> g(n);
  rep(i, n-1) {
    ll a,b; cin>>a>>b; a--; b--;
    g[a].push_back(edge<ll>(b, 1));
    g[b].push_back(edge<ll>(a, 1));
  }

  Dijkstra dij1(n, g);
  Dijkstra dij2(n, g);

  dij1.run(0);
  dij2.run(n-1);

  ll aa = 0;
  ll bb = 0;
  rep(i, n) {
    if (dij1.dist[i] <= dij2.dist[i]) aa++;
    else bb++;
  }

  if (aa > bb) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;

  return 0;
}


Measured memory_bytes: 38444
import java.util.*;
public class Main {
	public static void myout(Object text){//standard output
		System.out.println(text);
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      
      String a = sc.next();
      String b = sc.next();
      int ab = Integer.parseInt(a + b);
      for(int i = 1; i <= 1000; i++){
        if(Math.pow(i,2) == ab){
          myout("Yes");
          return;
        }
      }
      myout("No");
	}
}


Measured memory_bytes: 23636
package main

import "fmt"

func main() {
	l, r := 0, 0
	fmt.Scanf("%d %d", &l, &r)
	minner := l * (l + 1)
	for i := l; i < r && i <= l+2019; i++ {
		for j := i + 1; j <= r && j <= i+2020; j++ {
			minner = min(minner, i*j%2019)
		}
	}
	fmt.Println(minner)
}
func min(i, j int) int {
	if i <= j {
		return i
	} else {
		return j
	}
}


Measured memory_bytes: 1856
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define rep2(i,a,n) for (int i = a; i < n; i++)
using namespace std;
int A, B, C, X, Y;
int main() {
    cin >> A >> B >> C >> X >> Y;
    long long ans = pow(10, 9);

    int maxMix = max(X, Y);
    for(int i = 0; i <= maxMix; i++) {
        long long crr = 2 * C * i + A*max(0, (X-i)) + B*max(0, (Y-i));
        if(crr < ans) ans = crr;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int a        = Integer.parseInt(tmp[0]);
		int b        = Integer.parseInt(tmp[1]);
		int c        = Integer.parseInt(tmp[2]);
		int k        = Integer.parseInt(scanner.nextLine());

		boolean flg = false;

		for(int i = 0; i < k; i++) {

			for(int j = k - i; j > 0; j--) {

				int bb = b * (int)Math.pow(2, i);
				int cc = c * (int)Math.pow(2, j);

				if(cc > bb && bb > a) {

					flg = true;
					break;
				}
			}
		}

		String ans = flg ? "Yes" : "No";

		System.out.println(ans);
	}
}


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

using namespace std;
#define ull unsigned long long
#define si short int
#define ll long long
#define pii pair<int, int>

/*-----------------------------------------------------MATH------------------------------------------------*/
inline ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline int pwm(ll xx, ll pow, int MD) {
    if (pow < 0) { pow = pow % (MD - 1) + MD - 1; }
    ll mlt = 1;
    while (pow) {
        if (pow & 1) {
            mlt *= xx;
            mlt %= MD;
        }
        xx *= xx;
        pow >>= 1;
        xx %= MD;
    }
    return (int) mlt;
}
inline ll gcdex(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll xx, yy;
    ll gc = gcdex(b, a % b, yy, xx);
    x = xx;
    y = yy - (a / b) * xx;
    return gc;
}
inline int inv(ll r, int _mod) { return pwm(r % _mod, _mod - 2, _mod); }
/*-----------------------------------------------------MATH------------------------------------------------*/

const int inf = 1e9;
const int MAXN = 2e5 + 10;
ll mod = 1e9 + 7;
vector<ll> arr;
vector<ll>  fact;
void solve(){
    int n,m;
    cin>>n>>m;
    arr.resize(n);
    fact.resize(n+5);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    fact[0]=1;
    for(int i=1;i<n+5;i++){
        fact[i]=fact[i-1]*i;
        fact[i]%=mod;
    }
    if(m==1) {
        cout<<0<<endl;
        return;
    }
    sort(arr.begin(), arr.end());
    ll mx=0;
    for(int i=m-1;i<n;i++){
        ll kk=fact[m-1]*fact[i-m+1];
        kk%=mod;
        kk=inv(kk,mod);
        kk%=mod;
        kk*=fact[i];
        kk%=mod;
        kk*=arr[i];
        kk%=mod;
        mx+=kk;
        mx%=mod;
    }
    ll mn=0;
    for(int i=0;i<n-m+1;i++){
        ll kk=fact[m-1]*fact[n-i-m];
        kk%=mod;
        kk=inv(kk,mod);
        kk%=mod;
        kk*=fact[n-i-1];
        kk%=mod;
        kk*=arr[i];
        kk%=mod;
        mn+=kk;
        mn%=mod;
    }
    mx-=mn;
    mx%=mod;
    cout<<(mx%mod+mod)%mod;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n=1;
    for (int i = 0; i < n; i++) solve();
    return 0;
}

Measured memory_bytes: 1792
n = int(input())
data = [list(map(int, input().split())) for _ in range(n - 1)]
for i in range(n - 1):
  t = 0
  for j in range(i, n - 1):
    c, s, f = data[j]
    if t < s:
      t = s + c
    else:
      if t % f != 0:
        t += f - (t % f)
      t += c
  print(t)
print(0)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B), x(M), y(M), c(M);
  vector<int> sum(M+1);
  for (int i = 0; i < A; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < B; i++) {
    cin >> b.at(i);
  }
  for (int i = 0; i < M; i++) {
    cin >> x.at(i) >> y.at(i) >> c.at(i);
  }
  for (int i = 0; i < M; i++) {
    sum.at(i) = a.at(x.at(i)-1) + b.at(y.at(i)-1) - c.at(i);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sum.at(M) = a.at(0) + b.at(0);
  sort(sum.begin(), sum.end());
  cout << sum.at(0) << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

bool compare(const pint p1, const pint p2) { return p1.second > p2.second; }

int main() {
  int n;
  cin >> n;
  vector<pint> red(n), blue(n);
  rep(i, 0, n) cin >> red[i].first >> red[i].second;
  rep(i, 0, n) cin >> blue[i].first >> blue[i].second;

  // blue は最小の x が必要なので昇順
  sort(blue.begin(), blue.end());
  // red は最大の y が必要なので降順
  sort(red.begin(), red.end(), compare);

  int ans = 0;
  vector<bool> used(n);
  rep(i, 0, n) {
    rep(j, 0, n) {
      if (used[j]) continue;
      if (blue[i].first > red[j].first && blue[i].second > red[j].second) {
        used[j] = true;
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main(){
	string S;
  cin>>S;
  int N=S.size();
  vector<char> str(N);
  
  vector<char> str1(N/2);
  vector<char> str2(N/2);
  
  for(int i=0;i<N;i++)
    str.at(i)=S.at(i);
  sort(str.begin(),str.end());
  
  if(N%2!=0)
    cout<<"No"<<endl;
  else{
    for(int i=0;i<N/2;i++){
    	str1.at(i)=str.at(2*i);
      	str2.at(i)=str.at(2*i+1);
    }
    if(str1==str2)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
"""


def solve(data):
    total = 0
    for b, e in data:
        num = e - b + 1
        total += num
    return total


def main():
    N = int(input())
    data = []
    for _ in range(N):
        data.append([int(x) for x in input().split(' ')])
    result = solve(data)
    print(result)


if __name__ == '__main__':
    main()
    


Measured memory_bytes: 3188
def selection_sort(lst):
    cnt = 0
    for i in range(len(lst)-1):
        minj = i
        for j in range(i+1, len(lst)):
            if lst[j] < lst[minj]:
                minj = j
        if lst[i] > lst[minj]:
            lst[i], lst[minj] = lst[minj], lst[i]
            cnt += 1
    return cnt

n = int(input())
lst = list(map(int, input().split()))
cnt = selection_sort(lst)
print(*lst)
print(cnt)


Measured memory_bytes: 5612
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

const ll MAX = 300000;
bool isPrime[MAX];
void makePrime(){
  for (ll i = 0; i < MAX; i++){
    isPrime[i] = true;
  }
  for (ll i = 2; i * i < MAX + 1; i++){
    if(isPrime[i]){
      for (ll j = 2 * i; j < MAX; j += i) {
        isPrime[j] = false;
      }
    }
  }
  return;
}

int main()
{
  makePrime();
  int n;
  while(cin>>n,n) {
    int ans = 0;
    FOR(i,n+1,2*n+1) if(isPrime[i]) ans++;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3344
from collections import defaultdict
n=int(input())
s=input()
s1=s[:n]
s2=s[::-1][:n]
d=defaultdict(int)
ans=0
def paint(str,ptn):
  p=['','']
  for i in range(n):
    p[int(2**i&ptn>0)]+=str[i]
  return tuple(p)
for i in range(2**n):
  d[paint(s1,i)]+=1
for i in range(2**n):
  ans+=d[paint(s2,i)]
print(ans)

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

const int MOD = 1000000007;
const int INF = 1e9;

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

  double ans = 0;
  int flag = 0;
  
  if(w/2 == x && h/2 == y) flag = 1;
  cout << fixed << w * h / 2 << " " << flag << endl;


  return 0;
}

Measured memory_bytes: 3780