akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	int ct=0,i=0;
	cin >> s;
	while(i<s.length()){
		if((s[i]=='0'&&s[i+1]=='1')||(s[i]=='1'&&s[i+1]=='0')){
			s.erase(i,2);
			ct+=2;
			if(i>0){
				i--;
			}else{
				i=0;
			}
		}else{
			i++;
		}
	}
	cout << ct << endl;
}


Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

func main() {
	lim := nextInt()
	now := nextInt()
	c := nextInt()

	if lim == now {
		fmt.Println(c)
		return
	}

	if now+c <= lim {
		fmt.Println(0)
		return
	} else {
		fmt.Println(c - (lim - now))
	}
}


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

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

    static class Recording {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int c = in.nextInt();

            int[][] tv = new int[31][100009];
            for (int i = 0; i < n; i++) {
                int s = in.nextInt();
                int t = in.nextInt();
                int cc = in.nextInt();
                for (int j = s; j <= t; j++) {
                    tv[cc][j] = 1;
                }
            }

            for (int i = 1; i <= 30; i++) {
                for (int j = 1; j <= 100000; j++) {
                    if (tv[i][j] == 0 && tv[i][j] == 1) {
                        tv[i][j] = 1;
                    }
                }
            }

            long result = 0;
            for (int j = 1; j <= 100000; j++) {
                long cal = 0;
                for (int i = 1; i <= 30; i++) {
                    if (tv[i][j] == 1) {
                        cal++;
                    }
                }
                result = Math.max(result, cal);
            }

            out.println(result);
        }

    }
}



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

unsigned int n;
unsigned long i;
unsigned long j;

std::vector<short> ub;

int main(int argc, char const *argv[]) {

	//最初の問題を読み取る
    std::cin >> n;
    std::cin >> i;
    std::cin >> j;

    //問題が正規の間続ける
    while (n > 0) {
        ub.resize(n);
        unsigned long length = 1ul << n;
        for (int k = 0; k < n; k++) {
            length >>= 1;
            if (i <= length) {
                ub[k] = 0;
                i = length - i + 1;
            } else {
                ub[k] = 1;
                i -= length;     
            }
        }

        length = 1ul << n;
        for (int k = 0; k < n; k++) {
            length >>= 1;
            if (j <= length) {
                if (ub[n-k-1] == 0) {
                    j = length - j + 1;
                    std::cout << "L";
                } else {
                    std::cout << "R";
                }
            } else {
                if (ub[n-k-1] == 0) {
                    j = length - j + length + 1;
                    std::cout << "R";
                } else {
                    j -= length;
                    std::cout << "L";
                }
            }
        }
        std::endl(std::cout);


	    //次の問題を読み取る
	    std::cin >> n;
        std::cin >> i;
    	std::cin >> j;
	}
	return 0;
}



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

public class Main {
    
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] X = new int[sc.nextInt()];
        sc.nextLine();
        for (int i = 0; i < X.length; i++) {
        	X[i] = sc.nextInt();
        }
        
        int[] sortX = X.clone();
        
        Arrays.sort(sortX);
        
        if (X.length == 2) {
        	System.out.println(sortX[1]);
        	System.out.println(sortX[0]);
        	return;
        }
        
        int harf = sortX[X.length / 2];
        int under = sortX[X.length / 2 - 1];
        for (int i = 0; i < X.length; i++) {
        	if (harf > X[i]) {
        		System.out.println(harf);
        	} else {
        		System.out.println(under);
        	} 
        }
    }
}


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

using namespace std;
using ll = long long;

int main(){
    ll N,A,B; cin >> N >> A >> B;
    vector<ll> X(N);
    for(int i=0;i<N;i++) cin >> X[i];

    ll ans = 0ll;
    for(int i=0;i<N-1;i++){
        if((X[i+1] - X[i])*A > B){
            ans += B;
        }else{
            ans += A*(X[i+1] - X[i]);
        }
    }

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

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	nums := make([]int, n)

	count := 0
	for i:=0; i<len(nums); i++{
		fmt.Scan(&nums[i])
		if primenum(nums[i]){
			count++
		}
	}
	fmt.Println(count)
}

func primenum(x int)bool{
	for i := 2; i <= int(math.Sqrt(float64(x))); i++{
		if x % i == 0{
			return false
		}
	}

	return true
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	string s;
	cin>>n>>s;
	int ans=0;
	rep(i,n){
		string x=s.substr(0,i),y=s.substr(i);
		set<char> st1,st2;
		int cnt=0;
		rep(j,x.size()) st1.insert(x[j]);
		rep(j,y.size()) st2.insert(y[j]);
		for(char c='a';c<='z';c++){
			if(st1.count(c) && st2.count(c)){
				cnt++;
			}
		}
		chmax(ans,cnt);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
l = []
for i in range(len(s)):
    l.append("x")
print("".join(l))


Measured memory_bytes: 5592
#include<iostream>

using namespace std;

#define REP(i, n) for(int i=0; i<n; i++)

int a, b, c;

int main(){
    cin >> a >> b >> c;

    int output = 0;
    output += min(a+b+1, c);
    output += b;
    cout << output << endl;
}


Measured memory_bytes: 256
N = gets.to_i
scores = gets.split.map(&:to_i)

# 灰, 茶, 緑, 水, 青, 黄, 橙, 赤, 自由
color = Array.new(9, 0)

scores.each do |i|
	if i < 400
		color[0] += 1
	elsif i < 800
		color[1] += 1
	elsif i < 1200
		color[2] += 1
	elsif i < 1600
		color[3] += 1
	elsif i < 2000
		color[4] += 1
	elsif i < 2400
		color[5] += 1
	elsif i < 2800
		color[6] += 1
	elsif i < 3200
		color[7] += 1
	else
		color[8] += 1
	end
end

ans_min = color[0..7].count {|i| 0 < i}
ans_max = ans_min + color[8]
ans_min = [ans_min, 1].max

puts "#{ans_min} #{ans_max}"

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    int N = get<int>(), L = get<int>();
    int x;

    if (L < 0 && (L+N-1) >= 0)
        x = 0;
    else if (L < 0 && (L+N-1) < 0)
        x = (L+N-1);
    else if (L >= 0)
        x = L;

    long sum = 0;
    for (int i = 0; i < N; i++)
        sum += L + i;

    cout << sum - x << endl;
    return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

ll a[111111],b[111111];
int n;

int main(){
	cin.sync_with_stdio(false);
	cin>>n;
	rep(i,n)cin>>a[i]>>b[i];
	ll res=0,sum=0;
	for(int i=n-1;i>=0;i--){
		if((a[i]+sum)%b[i]==0)continue;
		res+=b[i]-(a[i]+sum)%b[i];
		sum+=b[i]-(a[i]+sum)%b[i];
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1792
import numpy as np
import math
import statistics
import collections

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        bit = 0
        if i % 3 != 0:
            bit += 1
        if i % 5 != 0:
            bit += 1
        if bit == 2:
            ans += i
    print(ans)
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 27280
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a); (i)<=(b); (i)++)
#define REP(i,N) FOR((i), 0, (N)-1)

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    cout << ( (A*C <= B) ? C : B/A) << endl;
    return 0;
}

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

int main()
{
    int a;
    int b;
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    } else if(a > b) {
        cout << "a > b" << endl;
    } else {
        cout << "a == b" << endl;
    }

    return 0;
}



Measured memory_bytes: 3048
#include <iostream>
#include <cmath>
using namespace std;
int n;
int h[100001];
int f[100001];

int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>h[i];
	}
	f[1]=0;
	f[2]=abs(h[2]-h[1]);
	for (int i=3;i<=n;i++){
		f[i]=min(f[i-1]+abs(h[i]-h[i-1]),f[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<f[n]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int cnt[4] = {0,0,0,0};	// N,S,E,W
	char path[1007];
	scanf("%s",path);
	for (int i = 0; i < strlen(path); ++i)
	{
		switch(path[i]){
			case 'N':
				++cnt[0];
				break;
			case 'S':
				++cnt[1];
				break;
			case 'E':
				++cnt[2];
				break;
			case 'W':
				++cnt[3];
		}
	}
	if(cnt[0] > 0 && cnt[1] > 0 && cnt[2] > 0 && cnt[3] > 0)	puts("Yes");
	else if(cnt[0] > 0 && cnt[1] > 0 && cnt[2] == 0 && cnt[3] == 0)	puts("Yes");
	else if(cnt[0] == 0 && cnt[1] == 0 && cnt[2] > 0 && cnt[3] > 0)	puts("Yes");
	else puts("No");
	return 0;
}


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

using pii = pair<int, int>;

int main() {
    int n, m; cin >> n >> m;
    vector<int> a(m + 1), b(m);
    for(auto& x : a) cin >> x;
    for(auto& x : b) cin >> x;

    vector<map<pii, int>> dp(n + 1);
    // consider ['l', 'r'), 'd' is depth, 'final_rank' represents this block winner's rank (2^r)
    function<int(int, int, int, int)> solve = [&] (int l, int r, int d, int final_rank) {
        if(final_rank == d && dp[final_rank].count({l, r})) return dp[final_rank][{l, r}];
        const int i = lower_bound(begin(a), end(a), r) - begin(a) - 1;
        int res = 0;
        if(0 <= i && a[i] <= l && r <= a[i + 1]) { // contain completely
            if(b[i] >= d + 1) {
                res = r - l - (r - l) / (1 << (n - b[i] + 1));
            } else {
                res = r - l - (b[i] == final_rank);
            }
        } else { // choose which block win
            const int mid = (l + r) / 2;
            res = min(solve(l, mid, d + 1, final_rank) + solve(mid, r, d + 1, d + 1),
                      solve(l, mid, d + 1, d + 1) + solve(mid, r, d + 1, final_rank));
        }
        if(final_rank == d) return dp[final_rank][{l, r}] = res;
        else return res;
    };

    cout << solve(0, 1 << n, 0, 0) << endl;
}



Measured memory_bytes: 22236
#include <stdio.h>

int d[4],e[9],f,k;
char s[30];

int f2(void){
	int a,b;
	a=e[f++];
	if(a<10){
		s[k++]=a+'0';
	}
	else{
		int b,c;
		s[k++]='(';
		b=f2();
		s[k++]=a;
		c=f2();
		s[k++]=')';
		a=a-'+'?a-'-'?b*c:b-c:b+c;
	}
	return a;
}
int f1(int op,int num,int i){
	int j;
	if(i==7){
		f=k=0;
		if(f2()==10){
			s[k]=0;
			puts(s);
			return 1;
		}
		return 0;
	}
	if(op){
		for(j=0;j<3;j++){
			e[i] = "+-*"[j];
			if(f1(op-1,num+1,i+1))return 1;
		}
	}
	if(num||i==6){
		for(j=0;j<4;j++){
			if(e[i]=d[j]){
				d[j]=0;
				if(f1(op,num-1,i+1))return 1;
				d[j]=e[i];
			}
		}
	}
	return 0;
}

int main(void){
	for(;scanf("%d%d%d%d",d,d+1,d+2,d+3),*d;)
		if(!f1(3,0,0))puts("0");
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef     long double      dl;
typedef		vector<ll>      vll;
#define		pb              push_back
#define		PB              pop_back
#define		nn              "\n"
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)
typedef     pair <int, int>   pii;
typedef     pair <ll, ll>      pll;
int main()
{
 O_O ;
   int t,n;
   cin>>t>>n;
   if(t>n)
     cout<<"No"<<nn;
   else
    cout<<"Yes"<<nn;

    return 0;
}


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

int main(){
    char str[100005];
    while(~scanf("%s",str)){
        int ans=0;
        for(int i=1;str[i];i++){
            ans+=str[i]!=str[i-1];
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 3320
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; string S; cin>>N>>S;
	map<char,ll> ct;
	for (int i=0; i<N; i++)
		ct[S[i]]++;
	ll ret=1;
	string lst="RGB";
	for (char ch : lst)
		ret*=ct[ch];
	for (int i=0; i<N; i++)
		for (int t=1; i+t+t<N; t++) {
			set<char> st={S[i],S[i+t],S[i+t+t]};
			if(st.size()==3)
				ret--;
		}
/*
	int ret2=0;
	for (int i=0; i<N; i++)
		for (int j=i+1; j<N; j++)
			for (int k=j+1; k<N; k++)
				if(j-i!=k-j && S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k])
					ret2++;
*/
	cout<<ret<<"\n";
//	cout<<ret<<"\n";
	return 0;
}

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

struct Node {
    int index = -1;
    int depth = -1;
    int parent = -1;
    vector<int> child;
};

int get_depth(Node *node, int index) {
    if (node[index].parent < 0) {
        return 0;
    } else if (node[index].depth > 0){
        return node[index].depth;
    }else {
        int d = get_depth(node, node[index].parent) + 1;
        for (auto& i : node[node[index].parent].child) {
            node[i].depth = d;
        }
        return node[index].depth;
    }
}

int main() {
    int n;
    cin >> n;
    Node a[n];
    
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        a[x].index = x;
        for (int j = 0; j < y; ++j) {
            int b;
            cin >> b;
            a[x].child.push_back(b);
            a[b].parent = x;
        }
    }
    
    for (auto& i : a) {
        string child = "";
        for (auto& j : i.child) {
            string c = child == "" ? "" : ", ";
            child += c + to_string(j);
        }
        cout << "node " << i.index << ": ";
        cout << "parent = " << i.parent << ", ";
        cout << "depth = " << get_depth(a, i.index) << ", ";
        cout << (i.parent < 0 ? "root" : (i.child.size() < 1 ? "leaf" : "internal node")) << ", ";
        cout << "[" << child << "]" << endl;
    }
    
    return 0;
}

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

int A[100005];
int partition(int p, int r)
{
    int x = A[r];
    int i = p - 1;
    for (int j = p; j < r; j++)
    {
        if (A[j] <= x)
        {
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i + 1], A[r]);
    return i + 1;
}

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &A[i]);
    }
    int q;
    q = partition(0, n - 1);
    for (int i = 0; i < n; i++)
    {
        if (i < q)
        {
            printf("%d ", A[i]);
        }
        else if (i == q)
        {
            printf("[%d]", A[i]);
            if (i == n - 1)
                printf("\n");

            else
                printf(" ");
        }
        else
        {
            if (i < n - 1)
                printf("%d ", A[i]);
            else
                printf("%d\n", A[i]);
        }
    }
    return 0;
}


Measured memory_bytes: 3580
/**********

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*********/

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

long long gcd(long long a,long long b){
    return b?gcd(b,a%b):a;
}

long long primechk[10000];

void preprocess(long long N){
    long long i,j;
    for(i=2;i<=N;i++){
        primechk[i]=1;
    }
    for(i=2;i<=N;i++){
        if(primechk[i]==1){
            for(j=2;i*j<=N;j++){primechk[i*j]=0;}
        }
    }
}

long long Binexpo(long long a,long long b){
    if(b==0)
        return 1;
    long long res=Binexpo(a,b/2);
    if(b%2){return res*res*a;}
    else{return res*res;}
}
long long Pwr(long long a,long long b,long long m){
    a%=m;
    long long res=1;
    while(b>0){
        if(b%2){res=res*a%m;}
        a=a*a%m;
        b>>=1;
    }
    return res;
}
int main()
{   long long a,b,c,d,e,f,g,h,i,j,k,x,y,z,sum,cnt=0;
    char ch;
    cin>>ch;
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){cout<<"vowel";}
    else{cout<<"consonant";}

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

ll comb(ll n,ll k){
  ll res=1;
  REP(i,k) res=res*(n-i)/(i+1);
  return res;
}

int main()
{
  int n,p;
  cin>>n>>p;
  ll a0=0,a1=0;
  REP(i,n){
    int a;
    cin>>a;
    (a%2)? a1++:a0++;
  }

  ll ans=0;
  if(p){
    ll temp1=0;
    for(ll i=1;i<=a1;i+=2) temp1+=comb(a1,i);
    ans=pow(2,a0)*temp1;
  }else{
    ll temp1=0;
    for(ll i=0;i<=a1;i+=2) temp1+=comb(a1,i);
    ans=pow(2,a0)*temp1;
  }
  cout<<ans<<endl;

  return 0;
}

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

using namespace std;

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

    long long ans = 0;
    for(int i = 0; i < N-1; ++i){
        // cout << i << " " << min(ts[i+1], T) << endl;
        ans += min(ts[i+1]-ts[i], T);
    }
    ans += T;
    cout << ans << endl;
    return 0;
}

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

int fuctrial(int n){
  if (n == 1 || n == 0) return 1; 
  else return n * fuctrial(n - 1);
}

int ordinal(vector<int> str, int N){
  vector<int> recordNum(8);
  int count = 0;
  int Ans = 0;
  
  for (int i = 0; i < N; i++){
    for (int j = 1; j <= N; j++){
      if (str.at(i) == j) break;
      else if (!(recordNum.at(j - 1))) count++;  
    }
    Ans = Ans + count * fuctrial(N - i - 1);
    recordNum.at(str.at(i) - 1)++;
    count = 0;
  }
  
  return Ans;
}
 
int main(){
  int N;
  vector<int> P(8);
  vector<int> Q(8);
  
  cin >> N;
  
  for (int i = 0;i < N; i++)
    cin >> P.at(i);
  for (int i = 0;i < N; i++)
    cin >> Q.at(i);
  
  cout << abs(ordinal(P, N) - ordinal(Q, N));
  
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef struct {
    int to;
    ll cost;
} edge;
ll INF = 99999999999;
typedef pair<ll,int> P;

vector<vector<edge> > G;
vector<ll> dist, par;


//nは頂点数　sは出発点
void bfs(int n, int s) {
    for (int i = 0; i < n; i++)
        dist[i] = INF;
    dist[s] = 0;

    queue<P> que;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.front();  que.pop();
        ll d = p.first;
        int u = p.second;

        if (dist[u] < d)
            continue;

        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i].to;
            ll c = G[u][i].cost;

            if (dist[v] <= d + c)
                continue;

            dist[v] = d + c;
            que.push(P(dist[v], v));
            par[v] = u;
        }
    }
}

int main() {
    int n, m;   cin >> n >> m;
    G.resize(n);
    dist.resize(n);
    par.resize(n);

    for (int i = 0; i < m; i++) {
        int a, b;   cin >> a >> b;  a--, b--;

        edge e1 = {b, 1}, e2 = {a, 1};
        G[a].push_back(e1);
        G[b].push_back(e2);
    }

    bfs(n, 0);

    cout << "Yes" << endl;
    for (int i = 1; i < n; i++)
        cout << par[i]+1 << endl;

    return 0;
}

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

int main(){
    long long A[3];
    cin >> A[0] >> A[1] >> A[2];
    long long ans = A[0] * A[1] * A[2];
    if(ans % 2){
        sort(A, A + 3, greater<int>()); 
        long long a = A[0] / 2 * A[1] * A[2]; 
        long long b = ans - a;
        ans = b - a;
    }else ans = 0;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


s = S()
no_x = ''.join(s.split('x'))
if no_x[::-1] != no_x:
    print(-1)
else:
    L = []
    cnt = 0
    if not no_x:
        print(0)
        exit()
    for i in s:
        if i == 'x':
            cnt += 1
        else:
            L += [cnt]
            cnt = 0
    L += [cnt]
    ans = 0
    for i in range(len(no_x) + 1):
        ans += abs(L[i] - L[len(no_x) - i])
    print(ans // 2)

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

using namespace std;
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;

#define IOSWORK ios::sync_with_stdio(0); cin.tie(0)
#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())
#define VAR(v, n) typeof(n) v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAXSIZE 

int a,b;
int main(){

	cin>>a>>b;
	
	if(a>b)
		cout<<a-1<<"\n";
	else
		cout<<a<<"\n";
	
	return 0;
}


Measured memory_bytes: 256
// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue> 
#include <string.h>
#include <string>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl
 
const ll mod=1e9+7;
#define inf 9999999999999
#define MAXN   100001 
  
// stores smallest prime factor for every number 
 
 
ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}
 
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b,b%a);}
inline void fastio(){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
// Template ends
const int MN = 2e5+7;
int dp[2001];
int fun(int s){
    if(s==0){
        return 1;
    }
    if(dp[s]!=-1){
        return dp[s];
    }
    ll temp=0;
    for(int i=3;i<=2000;i++){
        if(s>=i){
            temp+=fun(s-i);
            if(temp>mod) temp%=mod;
        }
    }
    dp[s]=temp;
    return temp;
}
void solve(){
    int n; cin>>n;
    for(int i=0;i<2001;i++){
        dp[i]=-1;
    }
    fun(n);
    cout<<dp[n]%mod<<endl;
}
int main(){
    fastio();
    //write code
    int t; t=1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3184
import sys
sys.setrecursionlimit(1000000)

S = input()

T = ['dream', 'dreamer', 'erase', 'eraser']
lenT = [len(i) for i in T]

def dayDream(pin):
    global isGoal               #;print('dayDream: ', pin, S[pin:])
    for i, d in enumerate(T):
        if isGoal:
            return
        #print('i, d:', i, d)
        if S[pin:pin+lenT[i]] == d:            
            pout = pin + lenT[i] #;print(d, pout)
            if pout == len(S):                
                isGoal = True    #;print('YES')
                return 
            else:
                dayDream(pout)
    #print('dayDream return', pin)
    return
    
isGoal = False
dayDream(0)
if isGoal:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 21348
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int grow(vector<int> &h, int n)
{
  int index = -1;
  int count = 0;
  bool allzero = true;
  for(int i = 0; i < n; i++)
  {
    if(h[i] > 0){
      allzero = false;
    }
  }
  if(allzero)
  {
    return 0;
  }
  for(int i = 0; i < n; i++)
  {
    if(h[i] <= 0)
    {
      index = i;
      break;
    }
  }
  if(index == -1)
  {
    cerr << "全範囲" << endl;
    for(int i = 0; i < n; i++)
    {
      h[i]--;
      cerr << h[i] << " ";
    }
    cerr << endl;
    count += grow(h, n);
    count++;
  }else{
    vector<int> temp;
    cerr << "indexまで" << endl;
    for(int i = 0; i < index; i++)
    {
      temp.push_back(h[i]);
      cerr << h[i]<< " ";
    }
    cerr << endl;
    count += grow(temp, temp.size());
    vector<int> temp2;
    cerr << "indexあと" << endl;
    for(int i = index + 1; i < n; i++)
    {
      temp2.push_back(h[i]);
      cerr << h[i] <<  " ";
    }
    cerr << endl;
    count += grow(temp2, temp2.size());
  }
  return count;
}

int main()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i = 0; i < n; i++)
  {
    cin >> h[i];
  }
  int result = grow(h, n);
  cout << result << endl;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define MAXN 205
//#define N 262144
#define ULL unsigned long long
#define ll long long
int main(){
    int a,v,b,w,t;
    scanf("%d %d %d %d %d",&a,&v,&b,&w,&t);
    if(v<=w){
        printf("NO\n");
    }
    else{
        if(abs(a-b)>(v-w)*1ll*t)printf("NO\n");
        else printf("YES\n");
    }
}
/*
1000000000000000000
1000000000000000000 1 1 1 1000000000
*/


Measured memory_bytes: 3764
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W,N;
    cin >> H >> W >> N;
    ll v = max(H,W);
    print((N + v-1) / v);


    

}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

vector<ll> prime_factorization(ll n){
    vector<ll> v;
    ll num = n;
    for(ll i=2; i*i<=n; i++){
        while(num % i == 0){
            num /= i;
            v.emplace_back(i);
        }
    }

    if(num != 1){
        v.emplace_back(num);
    }

    return v;
}

ll modpow(ll a, ll b){
    if(b == 0) return 1;
    else if(b % 2 == 0){
        ll d = modpow(a, b/2) % MOD;
        return (d * d) % MOD;
    }
    else{
        return (a * modpow(a, b-1)) % MOD;
    }
}

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

    int n; cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    vector<int> num(1000010, -1);

    for(int i=0; i<n; i++){
        auto v = prime_factorization(a[i]);

        vector<P> p4cnt;
        for(int j=0; j<v.size(); j++){
            int cnt = 1;
            int cur = v[j];
            while(j + 1 < v.size() && v[j] == v[j+1]){
                cnt++;
                j++;
            }
            p4cnt.emplace_back(cur, cnt);
        }

        for(int j=0; j<p4cnt.size(); j++){
            chmax(num[p4cnt[j].first], p4cnt[j].second);
        }
    }

    ll ans = 1;
    for(int i=2; i<=1000005; i++){
        if(num[i] == -1) continue;
        ans *= modpow(i, num[i]);
        ans %= MOD;
    }

    ll fians = 0;
    for(int i=0; i<n; i++){
        fians += (ans * modpow(a[i], MOD - 2));
        fians %= MOD;
    }

    cout << fians << endl;

    return 0;
}

Measured memory_bytes: 4224
import java.util.*;
public class Main {
	//0350 start
	//0413 end
	int INF = 1 << 24;

	class State implements Comparable<State>{
		int now, tick;
		double cost;
		public State(int now, int tick, double cost) {
			this.now = now;
			this.tick = tick;
			this.cost = cost;
		}
		@Override
		public int compareTo(State o) {
			if(this.cost < o.cost)return -1;
			if(this.cost > o.cost) return 1;
			return 0;
		}
		@Override
		public String toString() {
			return "State [now=" + now + ", tick=" + tick + ", cost=" + cost
					+ "]";
		}


	}

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int p = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if((n|m|p|a|b) == 0)break;
			a--;
			b--;
			int [] t = new int[n];
			for(int i = 0; i < n; i++){
				t[i] = sc.nextInt();
			}
			int [][] pass = new int[m][m];
			for(int i = 0; i < m; i++){
				Arrays.fill(pass[i], INF);
				pass[i][i] = 0;
			}
			for(int i = 0; i < p; i++){
				int from = sc.nextInt() - 1;
				int to = sc.nextInt() - 1;
				int dis = sc.nextInt();
				pass[from][to] = dis;
				pass[to][from] = dis;
			}
			PriorityQueue<State> open = new PriorityQueue<State>();
			open.add(new State(a, (1 << n) - 1, 0.0));
			double [][]close = new double[m][(1 << n)];
			for(int i = 0; i < m; i++){
				if(a == i) continue;
				Arrays.fill(close[i], INF);
			}

			double ans = INF;
			while(! open.isEmpty()){
				State now = open.poll();
				//System.out.println(now);
				if(now.now == b){
					ans = now.cost;
					break;
				}

				for(int i = 0; i < m; i++){
					if(pass[now.now][i] == INF){
						continue;
					}
					//System.out.println("i = " + i);
					for(int j = 0; j < n; j++){
						if((now.tick & (1 << j)) == 0) continue;
						int nexttick = (now.tick ^ (1 << j));
						double value = (double)pass[now.now][i] / t[j];
						double nextcost = now.cost + value;
						//System.out.println("c = " + close[i][nexttick]);
						if(close[i][nexttick] <= nextcost) continue;
						//System.out.println("nexttick = " + nexttick + " " + now.tick + " " + j);
						open.add(new State(i, nexttick, nextcost));
						close[i][nexttick] = nextcost;
					}
				}
			}
			if(ans == INF){
				System.out.println("Impossible");
			}
			else{
				System.out.printf("%.3f\n", ans);
			}
		}
	}

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

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

using namespace std;
using ll = long long;
using vs = vector<string>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vvpl = vector<vpl>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ld = long double;
using vd = vector<ld>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;

#define R(a,i) for(ll a=0; a < (i); (a)++)
#define FOR(a,i,j) for(ll a=(i); a < (j); (a)++)
#define RD(a,i) for(ll a=(i)-1; (a) >= 0; (a)--)
#define FORD(a,i,j) for(ll a=(j)-1; (a) >= (i); (a)--)

#define xx first
#define yy second
#define pb push_back

#define all(X) begin(X),end(X)
#define sz(X) (X).size()

const ll oo = 0x3f3f3f3f3f3f3f3f;
const ld eps = 1e-9;

#define DBG 0
#define TR(X) {if(DBG) cerr << (#X) << " = " << (X) << "\n";}
#define TRM(X,i,j) {if(DBG) cerr << (#X) << "[" << i << "][" << j << "] = " << (X[i][j]) << "\n";}
#define hline {if(DBG) cerr << "----------------------------------------------------------------------" << "\n";}
#define PK(X) {if(DBG) cerr << (X) << "\n";}

const ll mod = 1e9+7;

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

	ll N, K;
	cin >> N >> K;

	TR(N);
	TR(K);

	vvl dp(N+2, vl(K+2,0));
	ll bisher = 0;
	FOR(i,1,N+1){
		ll ai;
		cin >> ai;
		bisher += ai;
		dp[i][0] = 1;
		FOR(j,1,K+1){
			if(j <= ai) {
				dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
			} else if(j <= bisher) {
				dp[i][j] = (dp[i-1][j] + dp[i][j-1] - dp[i-1][j - ai-1] + mod) % mod;
			}
			TRM(dp,i,j);
		}


	}

	cout << dp[N][K] << endl;
}


Measured memory_bytes: 81024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
using ll = long long;

const int INIT = 2 * 10000;

int main() {
	ll N;
	int K;
	cin >> N >> K;
	vector<int> h(N), dp(N);
	rep(i, N) {
		cin >> h[i];
		dp[i] = INIT;
	}
	dp[0] = 0;
	for (int i = 1; i < N; ++i) {
		dp[i] = dp[i-1] + abs(h[i] - h[i - 1]);
		for (int j = i - 2; j >= i - K && j>=0; --j) {
			int a = dp[j] + abs(h[i] - h[j]);
			dp[i] = min(dp[i], a);
		}
	}
	cout << dp[N - 1] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define call(x) (x).cbegin(), (x).cend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) {if (b<a) {a=b; return 1;} return 0;}
const int INF = INT_MAX;
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

const string alphabet = "abcdefghijklmnopqrstuvwxyz";

int count(string x) {
    set<char> list;
    for (auto a : x) {
        list.insert(a);
    }
    return list.size();
}

vs standard(int n) {
    if (n == 1) {
        return {"a"};
    }
    vs res;
    vs pre = standard(n-1);
    for (auto s : pre) {
        rep(i, count(s)+1) {
            res.push_back(s+alphabet[i]);
        }
    }
    return res;
}

void solve(long long N){
    vs ans = standard(N);
    for (auto x : ans) {
        cout << x << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 9164
fn main() {
    let r = read::<i32>();
    let g = read::<i32>();
    println!("{}", g * 2 - r);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    char c;
    cin >> c;
    cout << ++c << "\n";

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(key=lambda x: -x)
q.sort(key=lambda x: -x)
r.sort(key=lambda x: -x)

i_p = 0
i_q = 0
i_r = 0

ans = 0
for _ in range(X + Y):
    cand = []
    if i_p < X: cand.append((p[i_p], 'A'))
    if i_q < Y: cand.append((q[i_q], 'B'))
    if i_r < C: cand.append((r[i_r], 'C'))
    #
    cand.sort(key=lambda x: x[0])
    ans_tmp, color = cand[-1]
    ans += ans_tmp
    # print("#", ans_tmp, color)
    if color == 'A': i_p += 1
    elif color == 'B': i_q += 1
    else: i_r += 1

print(ans)

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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int taka = (c + b - 1) / b;
    int aoki = (a + d - 1) / d;
    if (taka <= aoki)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main()
{
    
    int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
    return 0;

}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
using namespace std;
int dtoi(string date)
{
  int ans=0;
  ans =stoi(date.substr(0,4))*12*31+stoi(date.substr(5,2))*31+stoi(date.substr(8,2));
  return ans;
}

int main()
{
  int n;
  cin>>n;
  string t[n], a[n],d[n];
  for(int i=0;i<n;i++){
    cin>>t[i]>>a[i]>>d[i];
  }
  int q;
  cin>>q;
  for(int x=0;x<q;x++){
    string tt,qq,df,dt;
    cin>>tt>>qq>>df>>dt;
    for(int i=0;i<n;i++){
      if(tt!="*"&& t[i].find(tt)==string::npos)
	continue;
      if(qq!="*"&& a[i].find(qq)==string::npos)
	continue;
      int d1 = dtoi(d[i]);
      if(df!="*" && d1<dtoi(df))
	continue;
      if(dt!="*" && d1>dtoi(dt))
	continue;
      cout<<t[i]<<endl;
    }
    if(x!=q-1)
      cout<<endl;
  }

}

Measured memory_bytes: 1248
N = int(input())
A = list(map(int, input().split()))

ans = float('inf') 
sum_A = sum(A)
CumSum = 0


for i in range(N-1):
  CumSum = CumSum + A[i]
  ans = min(ans,(abs((sum_A - CumSum)-(CumSum))))

print(ans)


Measured memory_bytes: 26764
n,m = map(int, input().split())
flag = [False] * (10**5 + 100)
wa = [0] * (10**5 + 100)
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)

    if flag[p] == False:
        if s == "AC":
            flag[p] = True
        else:
            wa[p] += 1

ans = 0
for i in range(10**5+1):
    if flag[i]:
        ans += wa[i]
print(sum(flag), ans)

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

using namespace std;

int mv[5][5];
int viz[5][5];

int main(){
    int n,i,j,k,x;

    for(i=1;i<=3;i++)
        for(j=1;j<=3;j++)
            cin>>mv[i][j];

    cin>>n;

    for(k=1;k<=n;k++){
        cin>>x;

        for(i=1;i<=3;i++)
            for(j=1;j<=3;j++)
                if(x==mv[i][j])
                    viz[i][j]=1;
    }

    if((viz[1][1] && viz[1][2] && viz[1][3]) || (viz[2][1] && viz[2][2] && viz[2][3]) || (viz[3][1] && viz[3][2] && viz[3][3]) || (viz[1][1] && viz[2][2] && viz[3][3]) ||
       (viz[1][3] && viz[2][2] && viz[3][1]) || (viz[1][1] && viz[2][1] && viz[3][1]) || (viz[1][2] && viz[2][2] && viz[3][2]) || (viz[1][3] && viz[2][3] && viz[3][3]))
        cout<<"Yes";
    else
        cout<<"No";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,r;

int main(void){
	scanf("%d%d",&n,&r);
	if(n>=10){
		printf("%d\n",r);
	}else{
		printf("%d\n",r+100*(10-n));
	}
	return 0;
}


Measured memory_bytes: 256
import kotlin.math.*

fun main() {
    val (a, b, h, m) = readLine()!!.split(" ").map{ it.toInt() }
    var deg = abs((h*30+m*0.5) - (m*6))
    if(deg >= 180) deg = 360 - deg
    print(sqrt(a*a + b*b - 2*a*b*cos(PI*deg/180)))
}

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

int n, a[20];

bool solve(int x, int y){ //???x???????????¨???,?????????y
	if(y==0) return true;
	
	if(x==n) return false;
	
	bool ret = solve(x+1, y) || solve(x+1, y-a[x]);
	return ret;
}

int main(){
	scanf(" %d", &n);
	for(int i=0; i<n; ++i) scanf(" %d", &a[i]);
	
	int q;
	scanf(" %d", &q);
	for(int i=0; i<q; ++i){
		int m;
		scanf(" %d", &m);
	
		if(solve(0, m)) printf("yes\n");
		else printf("no\n");
	}
	
}

Measured memory_bytes: 1168
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std; 
#define MAXN 9999
vector<long long>luc(87,0);
bool ok=false;
vector<char> op(3,'?');
vector<int> numbers(4,0);
void bfs(int loc,int calc)
{
  if(loc==3)
    {
      if(calc==7 && ok==false)
	{
	  ok=true;
	  for(int i=0;i<4;i++)
	    {
	      cout<< numbers[i];
	      if(i<3)cout <<op[i];
	    }
	   cout << "=7" << endl;
	  return;
	}
      else{}
    }
  else
    {
      op[loc]='+';
      bfs(loc+1,calc+numbers[loc+1]);
      op[loc]='-';
      bfs(loc+1,calc-numbers[loc+1]);
    }
}
int main(int argc,char const* argv[])
{
  int n;
  cin >> n;
  numbers[0]=n/1000;
  numbers[1]=(n/100) %10;
  numbers[2]=(n%100) /10;
  numbers[3]=(n%10);
  bfs(0,numbers[0]);
  return 0;
}


Measured memory_bytes: 256