akhauriyash/Code-Regression huggingface dataset:
class Node:
    def __init__(self, id):
        self.id = id
        self.type = ''
        self.depth = 0
        self.height = 0
        self.parent = -1
        self.sibling = -1
        self.degree = 0
        
        self.left = -1
        self.right = -1
def walk_tree(node, depth, parent):
    if node == None:
        return 0
    if node.left == -1 and node.right == -1:
        node.type = 'leaf'
        node.degree = 0
    elif node.left == -1 and node.right > -1:
        node.type = 'internal node'
        node.degree = 1
        nodes[node.right].sibling = -1
    elif node.left > -1 and node.right == -1:
        node.type = 'internal node'
        node.degree = 1
        nodes[node.left].sibling = -1
    elif node.left > -1 and node.right > -1:
        node.type = 'internal node'
        node.degree = 2
        nodes[node.left].sibling = node.right
        nodes[node.right].sibling = node.left
    node.depth = depth
    node.parent = parent
    height_from_left = walk_tree(nodes.get(node.left), depth+1, node.id)
    height_from_right = walk_tree(nodes.get(node.right), depth+1, node.id)
    height = max(height_from_left, height_from_right)
    
    node.height = height
    height += 1
    return height

n = int(input())
nodes = {}
for _ in range(n):
    id, left, right = [int(x) for x in input().split(' ')]
    node = Node(id)
    node.left = left
    node.right = right
    nodes[id] = node
is_child_table = {node_id:False for node_id in range(n)}
for id in nodes:
    if nodes[id].left > -1:
        is_child_table[nodes[id].left] = True
    if nodes[id].right > -1:
        is_child_table[nodes[id].right] = True
root_id = [node_id for node_id in is_child_table.keys() if is_child_table[node_id] == False][0]
root_node = nodes[root_id]
walk_tree(root_node, 0, -1)
root_node.type = 'root'
for id in range(len(nodes)):
    print("node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}".format(id,
                                                                                                nodes[id].parent,
                                                                                                nodes[id].sibling,
                                                                                                nodes[id].degree,
                                                                                                nodes[id].depth,
                                                                                                nodes[id].height,
                                                                                                nodes[id].type))


Measured memory_bytes: 5624
from collections import deque

H,W = map(int,input().split())
maze = list(list(input()) for i in range(H))
maze_s = [[-1] * W for i in range(H)]
queue = deque([])
for i,row in enumerate(maze):
  for j,value in enumerate(row):
    if value == "#":
      queue.append([i, j])
      maze_s[i][j] = 0
def bfs(maze, maze_s):
  while queue:
    y,x = queue.popleft()
    for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
      new_y,new_x= y+i,x+j
      if 0 <= new_y <= H-1 and 0<= new_x <= W-1:
        if maze[new_y][new_x] == "." and maze_s[new_y][new_x] == -1:
          maze_s[new_y][new_x] = maze_s[y][x] + 1
          queue.append([new_y,new_x])
  c = 0
  for row in maze_s:
    m = max(row)
    c = max(c,m)
  print(c)

bfs(maze,maze_s)

Measured memory_bytes: 209444
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<i32>();
  let mut a = vec![];
  for _ in 0..n {
    let a_i = read::<i32>();
    a.push(a_i);
  }

  let max_a = a.iter().max().unwrap();
  let sum: i32 = a.iter().sum();

  if *max_a < sum - *max_a {
    println!("Yes");
  } else {
    println!("No")
  }
}



Measured memory_bytes: 4352
from collections import defaultdict
from math import gcd

def is_prime_miller_rabin(n):  # ミラー-ラビン素数判定法
    if n < 2:
        return False
    elif n in {2, 3, 5, 7, 11}:
        return True
    elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0 or n % 7 == 0 or n % 11 == 0:
        return False

    if n < 4_759_123_141:
        witnesses = [2, 7, 61]
    elif n < 341_550_071_728_321:
        witnesses = [2, 3, 5, 7, 11, 13, 17]
    else:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]

    d = n - 1
    d = d // (d & -d)

    for a in witnesses:
        y = pow(a, d, n)
        if y == 1:
            continue
        t = d
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1:
                return False
            t <<= 1
    return True

def find_factor_rho(n):  # ポラード・ロー素因数分解法
    if n < 2:
        return None
    m = 1<<n.bit_length() // 8 + 1
    for c in range(1, 99):
        def f(x):
            return (x * x + c) % n

        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if is_prime_miller_rabin(g):
                return g
            elif is_prime_miller_rabin(n // g):
                return n // g
    return None

def prime_factorize_dict(n):
    prime_dict = defaultdict(int)
    i = 2
    while i * i <= n:
        while n % i == 0:
            n //= i
            prime_dict[i] += 1
        i += 1 + i % 2
        if i != 101 or n < 1<<20:
            continue
        while n > 1:
            if is_prime_miller_rabin(n):
                prime_dict[n] = n = 1
                break
            j = find_factor_rho(n)
            while n % j == 0:
                n //= j
                prime_dict[j] += 1
    if n > 1:
        prime_dict[n] += 1
    return prime_dict

# ---------------------- #

n = int(input())
ans = 1
for value in prime_factorize_dict(n - 1).values():
    ans *= value + 1
ans -= 1  # 1を除くn-1の約数の数

def get_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            lower_divisors.append(i)
            if n // i != i:
                upper_divisors.append(n // i)
    return lower_divisors + upper_divisors[::-1]

for divisor in get_divisors(n)[1:]:
    tmp = n
    while tmp % divisor == 0:
        tmp //= divisor
    if tmp % divisor == 1:
        ans += 1

print(ans)


Measured memory_bytes: 71228
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i += 2) {
        if (s[i] == 'L') {
            cout << "No\n";
            return;
        }
    }
    for (int i = 1; i < s.length(); i += 2) {
        if (s[i] == 'R') {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
  long long int a,b;
  cin>>a>>b;
  
  long long int ans = (a+b)/2;
  if(abs(a-ans) == abs(b-ans)){
  	cout<<ans;
  }else if(abs(a-ans+1)== abs(b-ans+1)){
  	cout<<ans+1;
  } else if(abs(a-ans-1)== abs(b-ans-1)){
  	cout<<ans-1;
  }else{
  	cout<<"IMPOSSIBLE";
  }
}

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

// #define multitest 1
// #define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

void solve()
{
	int n, x;
	cin >> n;
	vector<int> dp(n + 1), h(n + 1);
	for (int i = 1; i <= n; ++i)
	{
		cin >> h[i];
		if (i == 1)
			dp[i] = 0;
		else if (i == 2)
			dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
		else
			dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[n];
}

int main()
{
#ifndef Debug
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 1152
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n,i,c,x=0,j,al[26];
    string s,tmp;
    cin>>n>>s;
    for(i=0;i<26;i++)
        al[i]=0;
    for(i=1;i<s.length();i++){
        c=0;
        for(j=0;j<i;j++){
            if(s.find(s[j],i)!=-1){
                if(al[s[j]-97]==0){
                    c++;
                    al[s[j]-97]=1;
                }
            }
        }
        for(j=0;j<26;j++)
            al[j]=0;
        if(c>x)
            x=c;
    }
    cout<<x<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h=0, w=0;
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0){
				break;
			}
			for (h = 0; h < H; h++) {
				for (w = 0; w < W; w++) {
					if (h == 0 || h == H-1 || w == 0 || w == W-1){
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}
				System.out.println("");
			}
			System.out.println("");
		}

	}

}

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

using namespace std;



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, sm=0;
  cin >> n;
  k = n;
  while (k) {
    sm += k%10;
    k /= 10;
  }
  cout << (n%sm ? "No" : "Yes") << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;


int wlim = 100010;

void push(vector<P>& res, const P& p) {
    if (p.first < wlim && (res.size() == 0 || p.second > res[(int)res.size() - 1].second)) {
        res.push_back(p);
    }
}

vector<P> update(const vector<P>& lis, int v, int w) {
    int sz = lis.size();
    int p1 = 0, p2 = 0;
    vector<P> res;
    while (p1 < sz || p2 < sz) {
        if (p2 == sz) {
            push(res, lis[p1]);
            ++p1;
        }
        else if (p1 == sz) {
            push(res, { lis[p2].first + w, lis[p2].second + v });
            ++p2;
        }
        else {
            if (lis[p1].first < lis[p2].first + w) {
                push(res, lis[p1]);
                ++p1;
            }
            else if (lis[p1].first > lis[p2].first + w) {
                push(res, { lis[p2].first + w, lis[p2].second + v });
                ++p2;
            }
            else {
                push(res, { lis[p1].first, max(lis[p1].second, lis[p2].second + v) });
                ++p1;
                ++p2;
            }
        }
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> v(n), w(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i] >> w[i];
    }
    int q;
    cin >> q;
    vector<vector<P>> que(n, vector<P>());
    for (int i = 0; i < q; ++i) {
        int u, l;
        cin >> u >> l;
        --u;
        que[u].push_back({ l, i });
    }
    int lm = 1 << 10;
    vector<vector<P>> vs(lm);
    vs[0] = { { 0, 0 } };
    vector<int> ans(q);
    for (int i = 0; i < n; ++i) {
        if (i < lm) {
            vs[i] = update(vs[(i - 1) / 2], v[i], w[i]);
            for (auto& p : que[i]) {
                int ma = 0;
                for (auto& j : vs[i]) {
                    if (j.first <= p.first) {
                        ma = max(ma, j.second);
                    }
                }
                ans[p.second] = ma;
            }
        }
        else {
            int a = i;
            vector<P> lis = { { 0, 0 } };
            while (a >= lm) {
                lis = update(lis, v[a], w[a]);
                a = (a - 1) >> 1;
            }

            for (auto& p : que[i]) {
                int l = p.first;
                int k = (int)vs[a].size() - 1;
                int ma = 0;
                for (int j = 0; j < (int)lis.size(); ++j) {
                    while (k >= 0 && lis[j].first + vs[a][k].first > l) {
                        --k;
                    }
                    if (k < 0) break;
                    ma = max(ma, lis[j].second + vs[a][k].second);
                }
                ans[p.second] = ma;
            }
        }
    }
    for (auto& i : ans) {
        cout << i << '\n';
    }
    return 0;
}


Measured memory_bytes: 20132
from math import fabs, sqrt


while True:
    D, E = map(int, input().split())
    if D==0 and E==0:
        break

    ans = 10e8
    for x in range(D):
        y = D - x
        dist = fabs(sqrt(x**2 + y**2) - E)
        ans = min(ans, dist)
    print(ans)



Measured memory_bytes: 5676
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

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

int main()
{
	int n;
	cin>>n;
	if(n==0){
		cout<<0<<endl;
		return 0;
	}
	string s;
	while(n!=0){
		if(n%2==0){
			s+='0';
		}else{
			s+='1';
			n-=1;
		}
		n/=2;
		n=-n;
	}
	reverse(s.begin(), s.end());
	cout<<s<<endl;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

struct UnionFind {
    vector<int> par, rank, _size;
    UnionFind(int n):par(n), rank(n), _size(n, 1) { for (int i = 0; i < n; ++i) par[i] = i; }
    int find(int x) {
        if (par[x] == x) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return;
        if (rank[x] > rank[y]) swap(x, y);
        par[x] = y; _size[y] += _size[x];
        if (rank[x] == rank[y]) rank[y]++;
    }
    int size(int x) { return _size[find(x)]; }
    bool same(int x, int y) { return find(x) == find(y); }
};

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

    UnionFind uf(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        uf.unite(a, b);
    }

    int ans = 0;
    rep(i, N) {
        chmax(ans, uf.size(i));
    }

    cout << ans << endl;
}

Measured memory_bytes: 5564
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define sort(vec) sort(vec.begin(),vec.end())
#define reverse(vec) reverse(vec.begin(),vec.end())
int gcd(int x,int y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
int n,t,a,h[2000],ans;
double mini=10000000000;
double def[2000];
signed main(){
    cin>>n>>t>>a;
    rep(i,n){
        cin>>h[i];
        def[i]=abs(a-(t-h[i]*0.006));
        if(def[i]<mini){
            mini=def[i];
            ans=i+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

    

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let mut s: Vec<char> = input::<String>().chars().collect();
    let mut t: Vec<char> = input::<String>().chars().collect();
    s.sort();
    t.sort_by(|a, b| b.cmp(a));

    let s1: String = s.iter().cloned().collect();
    let t1: String = t.iter().cloned().collect();
    println!("{}", if s1 < t1 { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
fun swap(ary: IntArray, p: Int, q: Int) {
  val tmp = ary[p]
  ary[p] = ary[q]
  ary[q] = tmp
}

fun bubbleSort(ary: IntArray, n: Int): Int {
  var count = 0
  var flag = true
  var sorted = 0
  while (flag) {
    flag = false
    for (i in n-1 downTo sorted+1) {
      if (ary[i] < ary[i-1]) {
        swap(ary, i, i-1)
        flag = true
        ++count
      }
    }
    ++sorted
  }
  return count
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val ary = readLine()!!.split(' ').map(String::toInt).toIntArray()

  val ans = bubbleSort(ary, n)

  for (i in 0 until n) {
    if (i > 0) print(' ')
    print(ary[i])
  }
  println()
  println(ans) 
}



Measured memory_bytes: 32188
#include<cstdio>
#include<stack>
using namespace std;
const char N_MAX = 105;
char n;
unsigned char time=0;
stack<int> sta;
bool matrix[N_MAX][N_MAX];
struct Node{
    //0:undiscovered 1:active 2:end
    char state;
    unsigned char stTime, endTime;
};
Node V[N_MAX];
void buildMatrix(){
	for(char i=0; i<n;i++){
		int degree, index;
		scanf("%u%u", &index, &degree);
		for(char j=0; j<degree; j++){
			int temp;
			scanf("%d", &temp);
			matrix[index-1][temp-1] = true;
		}
	}
}
char next(char num){
    for(char i=0;i<n;i++){
        if(matrix[num][i]&&V[i].state==0){
            return i;
        }
    }
    return -1;
}
void dfs() {
    for(char i = 0; i < n; i++) {
        if(V[i].state == 0) {
            sta.push(i);
            V[i].stTime = ++time;
            V[i].state = 1;
            while(!sta.empty()) {
                char active = sta.top();
                char nex = next(active);
                if(nex != -1) {
                    sta.push(nex);
                    V[nex].stTime = ++time;
                    V[nex].state = 1;
                } else {
                    sta.pop();
                    V[active].endTime = ++time;
                    V[active].state = 2;
                }
            }
        }
    }
}
int main(){
    scanf("%d", &n);
    buildMatrix();
    dfs();
    for(char i=0;i<n;i++){
        printf("%d %d %d\n", i+1, V[i].stTime, V[i].endTime);
    }
}



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

int main() {
	int k,a,b;
	cin>>k>>a>>b;
	bool can = true;
	for(int i = a; i<b+1; i++)
	if(i%k == 0){
		 cout << "OK" << endl;
		 can = false;
		 break;}
	if (can){
		cout<<"NG"<<endl;}
}


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

int main( void ) {
	char str1[ 100000 ], str2[ 100000 ], fig, tmp;
	int n, idx1, idx2, sum;

	while ( scanf( "%d", &n ), n ) {
		scanf( "%s", str1 );

		while ( n-- ) {
			idx1 = idx2 = 0;
			while ( ( fig = str1[ idx1 ] ) != '\0' ) {
                for ( sum = 1; ( tmp = str1[ ++idx1 ] ) != '\0' && fig == tmp; sum++ ) ;

				sprintf( str2 + idx2++, "%d%c", sum, fig );
				do {
					idx2++;
				} while ( sum /= 10 );
			}

			strcpy( str1, str2 );
		}

		printf( "%s\n", str1 );
	}

	return 0;
}

Measured memory_bytes: 712
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(n){
		if(n%10==7){
			cout << "Yes" << endl;
			return 0;
		}
		n=n/10;
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mp(a,b) make_pair(a,b)
#define vi vector<int>
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define vp vector<pair<int,int> >
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define F first
#define S second
#define endl "\n"
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define dom 998244353
#define pi 3.14159265
#define sl(a) (int)a.length()
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define pii pair<int,int> 
#define mini 2000000000000000000
#define time_taken 1.0 * clock() / CLOCKS_PER_SEC
//mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
void shikhar7s(int cas)
{
    int n,i;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    fr(i,n)
    {
        if(s[i]=='W')
            c++;
    }
    int ans=0;
    fr(i,n-c)
    {
        if(s[i]=='W')
            ans++;
    }
    cout<<ans;
}
signed main()
{
    fast;
    int t=1;
    //cin>>t;
    int cas=1;
    while(cas<=t)
    {
    shikhar7s(cas);
    cas++;
    }
    return 0;
}

Measured memory_bytes: 3768
a,b,c,x,y = map(int,input().split())

ANS = []
#ABがめっちゃ安くて c*max(x,y)*2 が最安
ans = c*max(x,y)*2
ANS.append(ans)

#ABが安くて c*min(x,y)*2 + (max(x,y)-min(x,y))*(a or b)
if x > y:
  ans = c*y*2 + (x-y)*a
else:
  ans = c*x*2 + (y-x)*b
ANS.append(ans)

#ABが別に安くないなら、a*x+b*y
ans = a*x+b*y
ANS.append(ans)

print(min(ANS))


Measured memory_bytes: 3060
#include <iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cmath>
using namespace std;

int main(void){
    int n,k;
    cin >>n>>k;
    int number[k];
    
    for(int i=0;i<k;i++){
        number[i]=0;
    }
    
    int i=k,cnt=0;
    int last=n+1;
    double ans=0;
    while(1){
        if(last-i<0){
            i = ceil(double(i)/2);
            cnt++;
            // cout <<i<<endl;
            continue;
        }else{
            ans+= 1/double(n) * double(last-i) * pow(0.5,cnt);
            cnt++;
            // cout <<"ans;"<<ans<<endl;
        }
        if(i==1){
            // ans+= 1/double(n) * double(last-i) * pow(0.5,cnt);
            break;
        }
        last = i;
        i = ceil(double(i)/2);
        // cout <<i<<endl;
    }
    std::cout << std::fixed;
    printf("%.15f",ans);
}


Measured memory_bytes: 640
#include <cstdio>
#include <map>
using namespace std;

int n, x, ans;
map<int,int> mp;

int main() {
	scanf("%d", &n);
	while ( n-- ) {
		scanf("%d", &x);
		if ( mp[x] ) ans--;
		else ans++;
		mp[x] ^= 1;
	}
	printf("%d", ans);
}

Measured memory_bytes: 4864
import sys
import random
import math
#file = open('test.in', 'r') 
file = sys.stdin

def gcd(x, y):
	if (y == 0):
		return x
	else:
		return gcd(y, x % y)


n = (int)(input())
v = list(map(int, input().split()))
lcm = 1
for i in range(n):
	lcm = (v[i] * lcm) // gcd(v[i], lcm)
sm = 0
for i in range(n):
	sm = sm + (lcm // v[i])
print(sm % 1000000007)

Measured memory_bytes: 4468
x = [[int(input()) , 0]  for _ in range(5)]
m = 0
s = 0
for i in range(5):
    x[i][1] = x[i][0] % 10
    if x[i][1] != 0:
        x[i][1] = 10 - x[i][1]
    m = max(m , x[i][1])
    s += x[i][0] + x[i][1]
print(s-m)

Measured memory_bytes: 3064
/*
СТРОИМ СТЕНУ РАБОТЯГИ!
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
*/

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
    
     
     
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
/** Interface */
     
inline int readChar();
template <class T = int> inline T readInt(); 
template <class T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x ); 
inline void writeWord( const char *s );
     
/** Read */
     
static const int buf_size = 4096;
     
inline int getChar() {
    static char buf[buf_size];
    static int len = 0, pos = 0;
    if (pos == len) {
        pos = 0, len = fread(buf, 1, buf_size, stdin);
    }
    if (pos == len) {
        return -1;
    }
    return buf[pos++];
}
     
inline int readChar() {
    int c = getChar();
    while (c <= 32) {
        c = getChar();
    }
    return c;
}
     
template <class T>
inline T readInt() {
    int s = 1, c = readChar();
    T x = 0;
    if (c == '-')
        s = -1, c = getChar();
    while ('0' <= c && c <= '9')
        x = x * 10 + c - '0', c = getChar();
    return s == 1 ? x : -x;
}
     
/** Write */
     
static int write_pos = 0;
static char write_buf[buf_size];
     
inline void writeChar( int x ) {
    if (write_pos == buf_size)
        fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
    write_buf[write_pos++] = x;
}
     
template <class T> 
inline void writeInt( T x, char end ) {
    if (x < 0)
        writeChar('-'), x = -x;
     
    char s[24];
    int n = 0;
    while (x || !n)
        s[n++] = '0' + x % 10, x /= 10;
    while (n--)
        writeChar(s[n]);
    if (end)
        writeChar(end);
}
     
inline void writeWord( const char *s ) {     while (*s)
writeChar(*s++); }
     
struct Flusher {
    ~Flusher() {
        if (write_pos)
            fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
    }
} flusher;   
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define rank rank228
#define prev prev228
#define y1 y1228  





int main() {
    int r, g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
    return 0;
}


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

int main(){
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;
    int ans=1000000001;
    int dekai=max(X,Y);

    ans = min(ans,A*X+B*Y);
    for(int i=2;(dekai-i/2)>=0;i+=2){
        if(X-i/2>=0 && Y-i/2>=0){
            ans=min(ans,A*(X-i/2)+B*(Y-i/2)+C*i);
        }else if(X-i/2<0){
            ans=min(ans,A*0+B*(Y-i/2)+C*i);
        }else if(Y-i/2<0){
            ans=min(ans,A*(X-i/2)+B*0+C*i);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

// a+b=x
// 2*a+4*b=y

// 2*b = y-x

void solve() {
    int x, y;
    cin >> x >> y;

    int a, b;
    b = (y-2*x)/2, a = x-b;

    if (2*a+4*b == y && a >= 0 && b >= 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

}

int main(){

    solve();
	return 0;
}


Measured memory_bytes: 3588
s=[i for i in input().split()]
k=[]

for i in range(len(s)):
    if s[i]=="+":
        b=k.pop()
        a=k.pop()
        k.append(int(a)+int(b))
    elif s[i]=="-":
        b=k.pop()
        a=k.pop()
        k.append(int(a)-int(b))
    elif s[i]=="*":
        b=k.pop()
        a=k.pop()
        k.append(int(a)*int(b))

    else:
        k.append(s[i])

print(k[0])


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

#define Rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PrintLn(X) cout << X << endl
int main(void)
{
	int a, b, c;
	cin >> a >> b >> c;
	if((10 * b + c) % 4 == 0){
		PrintLn("YES");
	}else{
		PrintLn("NO");
	}
	return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

int main (){
    char c;
    cin >> c;

    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }


    return 0;
}

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

int main() {
	while(true){
		int x,y;
    	cin>>x>>y;
    	if(x==0&&y==0) return 0;
    	if(x>y) swap(x,y);
    	cout<<x<<" "<<y<<endl;
	}
}


Measured memory_bytes: 2992
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int H, W, h, w;
    cin >> H >> W >> h >> w;

    int res = (H - h) * (W - w);

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
typedef long long ll;
const int MN=404;
int N,A[MN];
ll psa[MN],dp[MN][MN];
int main() {
    scanf("%d",&N);
    memset(dp,0x3f,sizeof dp);
    for(int i=1;i<=N;++i) {
        dp[i][i]=0;
        scanf("%d",&A[i]);
        psa[i] = psa[i - 1] + A[i];
    }
    for(int i=1;i<N;++i) {
        for(int j=1;i+j<=N;++j) {
            for(int k=0;k<i;++k)
                dp[j][i+j] = std::min(dp[j][i+j],dp[j][j+k]+dp[j+k+1][i+j]+psa[i+j]-psa[j-1]);
        }
    }
    printf("%lld\n",dp[1][N]);
}


Measured memory_bytes: 1536
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String op;
      String[] words;
      Tree tree = new Tree();

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        op  = words[k++];
        if ( op.equals("insert") ) { 
          tree.insert(Integer.parseInt(words[k++]));
        }
        else {
          tree.dispRoundPath();
        }
      }

    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final BTreeNode NIL = new BTreeNode(-1);
  BTreeNode root;
  StringBuilder buf;

  public Tree() {
    root = NIL;
    buf = new StringBuilder();
  }

  public void insert(int val) {
    BTreeNode y = NIL;
    BTreeNode x = root;
    BTreeNode z = new BTreeNode(val);

    while( !x.equals(NIL) ) {
      y = x;
      if( z.key < x.key )
        x = x.left;
      else
        x = x.right;
    }
    z.parent = y;

    if( y.equals(NIL) ){
      root = z;
    }
    else if( z.key < y.key )
      y.left = z;
    else
      y.right = z;
  } 
  void preParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      buf.append(" ").append(u.key);
      preParse(u.left);
      preParse(u.right);
    }
  }
  void inParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      inParse(u.left);
      buf.append(" ").append(u.key);
      inParse(u.right);
    }
  }

  void dispRoundPath() {

    inParse(root);
    buf.append("\n");
    preParse(root);
    buf.append("\n");

    System.out.print(buf);
    buf.setLength(0);
  }
}

class BTreeNode {
  int key;
  BTreeNode parent,left,right;

  public BTreeNode(int key) {
    this.key = key;
    this.parent =
    this.left =
    this.right = Tree.NIL;
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof BTreeNode)) return false;

    BTreeNode node = (BTreeNode)o;
    if(!(this.key == node.key)) return false;

    return true;
  }
}


Measured memory_bytes: 125452
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */

using i64=std::int_fast64_t;
using u64=std::uint_fast64_t;
 
#define rep(i, a, b) for (i64 i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, u64 b,Num id=1) {
  if(b==0)return id;
  Num x = id;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

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

  i64 n,k;
  std::cin>>n>>k;

  std::vector<i64> p(n),c(n);
  for(auto&& e:p){
    std::cin>>e;
    e--;
  }
  for(auto&& e:c)std::cin>>e;

  std::vector<bool> visit(n,false);

  i64 ans=std::numeric_limits<i64>::min();

  rep(i,0,n){
    if(visit[i])continue;

    visit[i]=true;
    i64 now=i;

    std::vector<i64> cost;
    cost.emplace_back(c[i]);
    while(!visit[p[now]]){
      now=p[now];
      visit[now]=true;
      cost.emplace_back(c[now]);
    }

    debug(cost);

    i64 sum=std::accumulate(all(cost),0l);

    i64 len=cost.size();

    i64 mod=k%len;

    rep(start,0,len){
      i64 tmp=0;
      rep(j,0,len){
        tmp+=cost[(start+j)%len];
        i64 val=tmp;
        if(j>=k)continue;
        if(sum>0)val+=sum*((k-j-1)/len);
        chmax(ans,val);
      }
    }


  }

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

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

string n;
int Sum;
bool Can;

int main(){
    cin>>n;
    int Len = n.length();
    for(int i = 1; i < Len ; ++i) if(n[i] != '9') Can = 1;
    
    Sum = n[0] -'0';
    if(Can) Sum--;
    Sum += (Len-1) * 9;
    cout<<Sum;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
main(){
int h,w,z,r;
while(scanf("%d %d %d",&h,&w,&z),h){
if(h>w&&h>z)h=z;if(w>h&&w>z)w=z;
scanf("%d ",&z);
while(z--){
scanf("%d ",&r);
printf(w*w+h*h<r*r*4?"OK\n":"NA\n");
}}}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int q,z,y=0;
  cin>>q;//qはN桁の数字
  z=q;
  while(z>0){
    y = y + z % 10;//qを10で割った余り(1の位)をyに足す　最終的にf(x)になる
    z = z / 10;//f(x)を作るために桁を一つ下げてる
  }
  if(q%y==0) cout<<"Yes"<<endl;//qをyで割ると0
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


// int factrial(int n){
//   if(n == 0) return 1;
//   return n*factrial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   return fact(n) / (fact(n-k)*fact(k));
// }


int main(){
  int N;
  string s;
  cin >> N;
  cin >> s;
  int ans = 1;
  rep(i,N-1){
    if(s[i] != s[i+1]){
      ans++;
    }
  }
  cout << ans << endl;
}
  





Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("Sample.txt")
    N = Scanner.int()
    for h in range(1, 3501):
        for n in range(1, 3501):
            a = N * h * n
            b = 4 * h * n - N * n - N * h
            if b != 0 and a % b == 0:
                w = a // b
                if w > 0:
                    print(h, n, w)
                    return
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 39916
N , K = map(int, input().split())
h = list(map(int, input().split()))

Dp = [None]*N
Dp[0] = 0

for i in range(1,N):
  Dp[i] =min([Dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-K),i)])

print(Dp[-1])


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

int main()
{
	string s;
	cin >> s;
	int d = 1000;
	for(int i = 0;i < s.length()-2;i++){
		int t = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 +
				s[i + 2] - '0';
		if(abs(t - 753) < d)
			d = abs(t - 753);
	}
	cout << d;
	return 0; 
} 

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

int main() {
	int N; cin >> N;
	vector<int> h(N);
	int dp[111111] = { 0 };

	for(int i=0; i<N; i++) cin >> h[i];
	dp[1] = abs(h[1]-h[0]);
	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	}

	cout << dp[N-1] << endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define intt long long 
using namespace std;
const int maxx = 100001;
intt a[maxx];
int read(){int k;scanf("%d",&k);return k;}
int main(){
	int n=read();intt L=read();
	for(int i=1;i<=n;i++)a[i]=read();
	for(int i=1;i<=n-1;i++){
		if(a[i]+a[i+1]>=L){
			cout<<"Possible"<<endl;
			for(int z=1;z<=i-1;z++)cout<<z<<endl;
			for(int z=n-1;z>=i+1;z--)cout<<z<<endl;
			cout<<i<<endl;
			return 0;
		}	
	}
	cout<<"Impossible"<<endl;
}

Measured memory_bytes: 1536
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    LL a, p; cin >> a >> p;
   	LL ans = (3 * a) + p;
   	cout << ans / 2 ;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a+b>9) cout<<"error"<<endl;
    else cout<<a+b<<endl;
    return 0;
}


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

int N, A[200000];
unordered_map<int, int> A_cnt;

int main(){
    cin >> N;
    long long ans = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        A_cnt[A[i]]++;
    }
    sort(A, A + N);
    for(int i = N - 1; i >= 0; i--){
        if(A_cnt[A[i]] == 0){
            continue;
        }
        A_cnt[A[i]]--;
        int k = 0;
        while((1 << k) <= A[i]){
            k++;
        }
        int target = (1 << k) - A[i];
        //cout << "A[i] = " << A[i] << ", target = " << target << endl;
        if(A_cnt[target] > 0){
            A_cnt[target]--;
            ans++;
        }
    }
    cout << ans << endl;
}


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


int main(){
    int n,m; cin >> n >> m;
    if(m==1){
        cout << n*(n-1)/2 << endl;
    }else{
        cout << n*(n-1)/2 + m*(m-1)/2 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

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

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int main() {
    double v;
    while(cin>>v){
        double t;
        t=v/9.8;
        double y=t*t*4.9;
        y+=5.0;
        cout<<(int)y/5+1<<endl;
    }
    
  
    return 0;
}



Measured memory_bytes: 3084
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
using namespace std;
int main(void)
{
	int n,i,j,a,aa[3],flg,x;
	scanf("%d",&n);
	aa[0]=0;	aa[1]=0;	aa[2]=0;
	for(i=0;i<n;i++)	{
		scanf("%d",&a);
		if(a%4==0)	aa[2]++;
		else if(a%2==0)	aa[1]++;
		else aa[0]++;
	}
//	printf("  %d %d %d\n",aa[0],aa[1],aa[2]);
	if(n%2==1 && aa[0]==n/2+1 && aa[2]==n/2)	flg=1;
	else if(aa[0]<=aa[2])	flg=1;
	else flg=0;
	if(flg==0)	printf("No\n");
	else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
class Uf:
    def __init__(self, N):
        self.p = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def root(self, x):
        if self.p[x] != x:
            self.p[x] = self.root(self.p[x])

        return self.p[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        u = self.root(x)
        v = self.root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
            self.size[v] += self.size[u]
            self.size[u] = 0
        else:
            self.p[v] = u
            self.size[u] += self.size[v]
            self.size[v] = 0

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

    def count(self, x):
        return self.size[self.root(x)]


N, M = map(int, input().split())
if M%2==1:
    print(-1)
    exit()
E = [set() for _ in range(N+1)]
E_mst = [set() for _ in range(N+1)]
#Closed = [False] * (N+1)
uf = Uf(N+1)
for _ in range(M):
    a, b = map(int, input().split())
    E[a].add(b)
    E[b].add(a)
    if not uf.same(a, b):
        E_mst[a].add(b)
        E_mst[b].add(a)
        uf.unite(a, b)

Cnt = [len(e) for e in E_mst]
q = {i for i, c in enumerate(Cnt) if c==1}
Used = set()
Ans = []
while q:

    v = q.pop()

    #print(E_mst, v)
    # vp = None#E_mst[v][0]
    # for vp_ in E_mst[v]:
    #     if not ((v,vp_) if v<vp_ else (vp_,v)) in Used:
    #         vp = vp_
    #         break
    # else:
    #     break

    if len(E_mst[v])==1:
        vp = E_mst[v].pop()
    else:
        vp = -1

    l = len(E[v])
    #print(v, l)
    for u in E[v].copy():
        if u!=vp:
            v_, u_ = (v,u) if v<u else (u,v)
            if (v_, u_) not in Used:
                Ans.append((v, u))
                E[u].remove(v)
                E[v].remove(u)
                Used.add((v_, u_))
    if l%2==0:
        try:
            E[vp].remove(v)
            E[v].remove(vp)
        except:
            break
        Ans.append((v, vp))
        Used.add((v,vp) if v<vp else (vp,v))
    # Cnt[vp] -= 1
    # if Cnt[vp]==1:
    #     q.add(vp)
    #print(Cnt)

    E_mst[vp].remove(v)
    if len(E_mst[vp])==1:
        q.add(vp)


#print(E_mst)
if len(Ans)!=M:
    print(Ans)
    print(-1)
    assert False
    exit()
for a in Ans:
    print(" ".join(map(str, a)))


Measured memory_bytes: 79692
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] ch = sc.next().toCharArray();
        int length = ch.length;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            if (i == 0 || i % 2 == 0) {
                sb.append(ch[i]);
            }
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 26488