akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <stdio.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

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

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int N;
    cin >> N;
    
    double ans = 0.0;
    for (int i = 0; i < N; i++) {
        double x; string u;
        cin >> x >> u;
        if ( u.compare("JPY") == 0 ) {
            ans += x;
        } else {
            ans += x * 380000;
        }
    }

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

    return;
}

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


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long t = 0L;
        long[][] a = new long[n][2];
        for (int i = 0; i < n; i++) {
            a[i][0] = sc.nextLong();
            a[i][1] = sc.nextLong();
        }
        Arrays.sort(a, (x, y) -> Long.compare(x[1], y[1]));
        String ans = "Yes";
        for (int i = 0; i < n; i++) {
            t += a[i][0];
            if(a[i][1] < t){
                ans = "No";
                break;
            }
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 108496
#include <bits/stdc++.h>
#define LL long long int
using namespace std;
int const MAXN = 1e6+5;
vector<vector<int>> adj;
vector<set<int>> un;
int vis[20];
vector<int> v;
void DFS (int node){
    vis[node] = 1;
    v.push_back(node);
    for (auto child : adj[node]){
        if (!vis[child]) DFS(child);
    }
}
int main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    adj.resize(n+5);
    un.resize(n+5);
    int ans = 0;
    for (int i = 0; i < n;i++){
      int x,a,b;
        cin >> x;
        for (int j = 0; j < x; j++){
            cin >> a >> b;
            if (b == 1){
                adj[i+1].push_back(a);
            }else {
                un[i+1].insert(a);
            }
        }
    }
    int mx = (1<<n);
    for (int i = 1; i < mx ; i++){
        v.clear();
        memset(vis,false,sizeof vis);
        for (int j = 0; j <= 15; j++){
            int bit = ((i) &(1 << j))>>j;
            if (bit){
                if (!vis[j+1])
                DFS(j+1);
            }
        }
        bool cond = true;
        for (auto cur : v){
            for (auto x : un[cur])
                if (vis[x]) cond = false;
        }
        if (cond){

                ans = max((int)v.size(),ans);
                }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
   

using namespace std;

int main(){
 string S; cin >> S; int cnt1 = 0; int cnt2 = 0;
  for(int i = 0; i < S.size(); i++){
    if(i%2==0){
      if(S[i] == '0'){cnt1++;}
      else{cnt2++;}}
    else{
      if(S[i] == '1'){cnt1++;}
      else{cnt2++;}} }
    
    cout << min(cnt1,cnt2) << endl; return 0;}

Measured memory_bytes: 512
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	n, m := getInt(), getInt()

	out((n - 1) * (m - 1))

}


Measured memory_bytes: 640
number = gets.to_i
building_information =[
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
]
number.times do
    info = gets.split.map(&:to_i)
    building_information[info[0]-1][info[1]-1][info[2]-1] += info[3]
end

building_information.each_with_index do |building_number,index|
    building_number.each do |floor|
        puts " "+floor.join(" ")
    end
    if index!=3
        puts "####################"
    end
end


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

#define pb  push_back
#define ll  long long
#define INF 0x3f3f3f3f
#define pii pair<int, int>
#define ull unsigned long long int

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string s, t;
    cin >> s >> t;
    int ss = s.size();
    int tt = t.size();
    
    vector<vector<int>> pd(ss + 1, vector<int>(tt + 1, 0));
    for (int i = ss - 1; i >= 0; i--) {
        for (int j = tt - 1; j >= 0; j--) {
            if (s[i] == t[j])
                pd[i][j] = pd[i + 1][j + 1] + 1;
            else pd[i][j] = max(pd[i + 1][j], pd[i][j + 1]);
        }
    }
    
    string ans = "";
    int resp = pd[0][0];
    for (int i = 0; i < ss; i++) {
        for (int j = 0; j < tt; j++) {
            if (pd[i + 1][j + 1] == resp - 1 && s[i] == t[j]) {
                ans += s[i];
                resp--;
                break;
            }
        }
    }
    cout << ans << "\n";
    
    //cerr << "\n" << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}

Measured memory_bytes: 35584
nq, *process = readlines.map(&:chomp).map {|l| l.split}
n, q = nq.map(&:to_i)
process = process.map {|p| {name: p.first, time: p.last.to_i}}

finished = []
time = 0
while(true)
  head = process.shift
  if head[:time] > q
    head[:time] -= q
    time += q
    process << head
  else
    time += head[:time]
    finished << {name: head[:name], time: time }
  end
  break if process.empty?
end

finished.each do |v|
  puts "#{v[:name]} #{v[:time]}"
end


Measured memory_bytes: 39756
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		int max = 0;
		for (int i = 1; i < N - 1; i++) {
			String X = S.substring(0, i);
			String Y = S.substring(i);
			int result = 0;
			int min = Math.min(X.length(), Y.length());
			for (int j = 0; j < 26 && result < min; j++) {
				char alphabet = (char) ((char)'a' + j);
				if (X.contains(String.valueOf(alphabet)) && Y.contains(String.valueOf(alphabet))) {
					result++;
				}
			}
			max = Math.max(max, result);
		}
		System.out.println(max);
	}
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int K = nextInt();
  int X = nextInt();

  int a = X - K + 1;
  int b = X + K - 1;
  for (int i = a; i <= b; i++) {
    if (i != a) cout << " ";
    cout << i;
  }
  cout << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

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

  ll H; cin >> H;
  ll W; cin >> W;
  vector<vector<ll>> cells(H, vector<ll>(W, 0));
  for (ll i = 0; i < H; i++) {
    string S; cin >> S;
    for (ll j = 0; j < W; j++) {
      if (S[j] == '#') cells[i][j] = 1;
    }
  }

  ll MOD = 1e9 + 7;
  vector<vector<ll>> ans(H, vector<ll>(W, 0));
  ans[0][0] = 1;
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      if (i + 1 < H && cells[i + 1][j] == 0) (ans[i + 1][j] += ans[i][j]) %= MOD;
      if (j + 1 < W && cells[i][j + 1] == 0) (ans[i][j + 1] += ans[i][j]) %= MOD;
    }
  }
  cout << ans[H - 1][W - 1] << '\n';
  return 0;
}

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

typedef long long int ll;
typedef long double ld;
typedef unsigned long long uli;

#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define test ll t;cin>>t;while(t--)
#define nin ll n;cin>>n;
#define ain ll n;cin>>n;ll arr[n];for(ll i=0;i<n;i++){cin>>arr[i];}
#define out(arr,n) for(ll i=0;i<n;i++){cout<<arr[i]<<" ";}cout<<'\n';
#define fr(i,n) for(ll i=0;i<n;i++)
#define fri(i,l,n) for(ll i=l;i<n;i++)
#define sr(a,n) sort(a,a+n);
#define gr(a,n) sort(a,a+n,greater<ll>());
#define cen cout<<endl;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>


const ll MAX = 1e5 + 10;
const ll mod = 1e9 + 7;


int main() {
    fastio;
    map<string, int> m;
    test{
        string s;
        cin >> s;
        m[s]++;

    }
    //test{ ain;}
    cout << m.size() << endl;






}

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

int main() {
  int A, B; cin >> A >> B;
  int coins = 0;
  
  if (A > B) {
    coins += A;
    A--;
  } else {
    coins += B;
    B--;
  }
  if (A > B) {
    coins += A;
    A--;
  } else {
    coins += B;
    B--;
  }
  
  cout << coins << endl;
  
  return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#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 int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}
    
    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ModInt<mod> pow(ModInt<mod> n, ll k) {
    return ModInt<mod>(n.mod_pow(n.v, k));
}

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end
using mint = ModInt<MOD>;

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

    mint ans(0);
    vector<mint> rec(K+1);
    for(int g=K; g>=1; g--) {
        mint val = pow(mint(K/g), N);
        for(int a=g<<1; a<=K; a+=g) val -= rec[a];
        rec[g] = val;
        ans += mint(g) * rec[g];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4068
#include <stdio.h>
#include <stdlib.h>

int main(){
	int A, B, N, i, L, sp;
	char res[2];
	scanf("%d%d", &A, &B);
	if(A <= B){
		printf("Impossible\n");
		return 0;
	}
	N = A + B;
	int *next = (int *)malloc(sizeof(int) * N);
	int *is_left = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		next[i] = -1;
		is_left[i] = 1;
	}
	sp = 0;
	L = 0;
	is_left[0] = 0;
	while(L < B){
		for(i = 0; is_left[i] == 0; i++){}
		printf("? %d %d\n", i, sp);
		fflush(stdout);
		scanf("%s", res);
		if(res[0] == 'Y'){
			next[i] = sp;
			is_left[i] = 0;
			sp = i;
			L++;
		}
		else{
			is_left[i] = 0;
			if(L == 0){
				for(sp = 0; is_left[sp] == 0; sp++){}
				is_left[sp] = 0;
			}
			else{
				sp = next[sp];
				L--;
			}
			B--;
		}
	}
	while(next[sp] >= 0){
		sp = next[sp];
	}
	char *s = (char *)malloc(sizeof(char) * (N + 1));
	s[N] = '\0';
	for(i = 0; i < N; i++){
		printf("? %d %d\n", sp, i);
		fflush(stdout);
		scanf("%s", res);
		if(res[0] == 'Y'){
			s[i] = '1';
		}
		else{
			s[i] = '0';
		}
	}
	printf("! %s\n", s);
	return 0;
}

Measured memory_bytes: 724
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ll x; scanf("%lld", &x);
	ll a = 100;
	FOR(i, 1, 114514){
		a += a/100;
		if(a >= x){
			printf("%d\n", i);
			return 0;
		}
	}
}


Measured memory_bytes: 3824
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
int main(){
  ll l,r,ii,jj,tmp,loop;
  ll min = 3000;
  cin >> l >> r;

  if(l+2020 <= r){
    loop = l+2020;
  }
  else{
    loop = r;
  }
  //cout << "loop" << loop << endl;
  for(ii=l;ii<=loop-1;ii++){
    for(jj=ii+1;jj<=loop;jj++){
      //cout << "ii:" << ii << "jj:" << jj << endl;
      tmp = (ii*jj) % 2019;
      if(tmp < min){
	min = tmp;
      }
    }
  }

  cout << min << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
std::vector<int> factors(1007,0);
std::vector<int> primes(1007,0);
void funcFactors(int number) {
	while (true) {
		if (primes[number] == 0) {
			factors[number]++;
			break;
		}
		else {
			factors[primes[number]]++;
			number/=primes[number];
		}
		
	}
}
void sieve(int number) {
	for (int x = 2; x <= number; x++) {
		if (primes[x]==0) {
			for (int z = x + x; z <= number; z += x) {
				primes[z] = x;
			}
		}
	}
}
int main() {
	long long num,count=1;
	int E = 1e9 + 7;
	std::cin >> num;
	if (num == 1)std::cout << 1;
	else {
		sieve(num);
		for (int x = 2; x <= num; x++) {
			funcFactors(x);
		}
		for (int x = 2; x <= num; x++) {
			if(factors[x])count = (count * (factors[x] + 1)) % E;
		}
		std::cout << count;
	}
}

Measured memory_bytes: 3516
n = int(input())
ab = []
x = 0
for i in range(n):
  a,b = map(int,input().split())
  x -= b
  ab.append(a+b)
ab.sort()
ab.reverse()
for i in range(n):
  if i%2==0:
      x+=ab[i]
print(x)


Measured memory_bytes: 7388
#include <stdio.h>
int main()
{
	int i=0,x,y;
	int tmp;
	while(1){
		i++;
		scanf("%d %d",&x,&y);
		if(x>y){
			tmp=x;
			x=y;
			y=tmp;
		}
		if(x==0 && y==0) break;
		printf("%d %d\n",x,y);
	}
	return 0;
}


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

using namespace std;

const int N = 1e5 + 2;

int n, m, dp[N], used[N], ans;
vector <int> g[N], gr[N];

void dfs(int v, int pr = 0){
    used[v] = 1;
    for(int to : gr[v]){
        if(to == pr)
            continue;
        if(!used[to])
            dfs(to, v);
        dp[v] = max(dp[v], dp[to] + 1);
    }
    ans = max(ans, dp[v]);
}

int main(){
    scanf("%d %d", &n, &m);

    for(int i = 1; i <= m; i ++){
        int x, y;
        scanf("%d %d", &x, &y);
        g[x].push_back(y);
        gr[y].push_back(x);
    }

    for(int i = 1; i <= n; i ++){
        if(g[i].empty()){
            dfs(i);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 18176
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <vector>
using namespace std;

namespace zyt
{
	typedef long long ll;
	const int N = 410, P = 998244353;
	int A[N], B[N], S, n, fac[N], finv[N], st[N][N], L[N];
	vector<int> g[N];
	vector<int> operator * (vector<int> &a, vector<int> &b)
	{
		vector<int> ans(a.size() + b.size() - 1);
		for (int i = 0; i < a.size(); i++)
			for (int j = 0; j < b.size(); j++)
				ans[i + j] = (ans[i + j] + (ll)a[i] * b[j]) % P;
		return ans;
	}
	vector<int> operator + (vector<int> &a, vector<int> &b)
	{
		vector<int> ans(max(a.size(), b.size()));
		for (int i = 0; i < ans.size(); i++)
			ans[i] = ((i < a.size() ? a[i] : 0) + (i < b.size() ? b[i] : 0)) % P;
		return ans;
	}
	int power(int a, int b)
	{
		int ans = 1;
		while (b)
		{
			if (b & 1)
				ans = (ll)ans * a % P;
			a = (ll)a * a % P;
			b >>= 1;
		}
		return ans;
	}
	int inv(const int x)
	{
		return power(x, P - 2);
	}
	int C(const int n, const int m)
	{
		if (n < m)
			return 0;
		else
			return (ll)fac[n] * finv[m] % P * finv[n - m] % P;
	}
	void init()
	{
		fac[0] = 1;
		for (int i = 1; i < N; i++)
			fac[i] = (ll)fac[i - 1] * i % P;
		finv[N - 1] = inv(fac[N - 1]);
		for (int i = N - 1; i > 0; i--)
			finv[i - 1] = (ll)finv[i] * i % P;
		
	}
	int work()
	{
		scanf("%d", &n);
		init();
		for (int i = 1; i <= n; i++)
			scanf("%d%d", &A[i], &B[i]), S += A[i];
		g[0].push_back(1);
		for (int i = 1, sum = A[i]; i <= n; sum += A[++i])
		{
			int c = (ll)A[i] * inv(S) % P;
			vector<int> tmp;
			for (int j = 0; j < B[i]; j++)
				tmp.push_back((ll)(P - power(c, j)) * finv[j] % P);
			for (int j = sum; j >= 0; j--)
			{
				g[j] = g[j] * tmp;
				if (j >= A[i])
					g[j] = g[j] + g[j - A[i]];
			}
		}
		st[0][0] = 1;
		for (int i = 1; i < N; i++)
			for (int j = 1; j <= i; j++)
				st[i][j] = (st[i - 1][j - 1] + ll(i - 1) * st[i - 1][j]) % P;
		int ans = 0;
		for (int i = 0; i < g[0].size(); i++)
			ans = (ans + (ll)g[0][i] * fac[i]) % P;
		for (int d = 1; d < S; d++)
		{
			int c = (ll)d * inv(S) % P, invc = inv(c);
			L[0] = inv(P + 1 - c);
			for (int i = 1; i <= S; i++)
			{
				L[i] = 0;
				for (int j = 0; j < i; j++)
					L[i] = (L[i] + (ll)L[j] * C(i, j)) % P;
				L[i] = (ll)L[i] * c % P * inv(P + 1 - c) % P;
			}
			for (int k = 0, v = 1; k < g[d].size(); k++, v = (ll)v * invc % P)
				for (int i = 0; i <= k; i++)
					ans = (ans + 
						(ll)g[d][k] * v % P * st[k][i] % P 
						* L[i] % P * ((k - i) & 1 ? P - 1 : 1)) % P;
		}
		printf("%d", (P - ans) % P);
		return 0;
	}
}
int main()
{
	return zyt::work();
}

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

int main(){
    string s,t;
    cin >> s >> t;
    int n=s.size();
    int cnt=0;
    for (int i=0;i<n;++i){
       if (s[i]!=t[i]){
           cnt++;
       }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3912
#include<stdio.h>
int main(void)
{
    int a[300000]={0},n,i,b;
    scanf("%d",&n);
    for(i=2;i<=n;i++)
    {
        scanf("%d",&b);
        a[b]++;
    }
    for(i=1;i<=n;i++)
        printf("%d\n",a[i]);
}


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

ll dfs(string s, ll ans){
    ll q=ans;
    if(s.size()==1){
        return ans+stoll(s);
    }
    for(int i=1;i<s.size();i++){
        q+=dfs(s.substr(i),ans+stoll(s.substr(0,i)));
    }
    q+=stoll(s);
    return q;
}

int main(){
    string s;
    cin>>s;
    
    ll ans=0;
    
    cout<<dfs(s,ans)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    rep(i, 0, N) cin >> V[i];

    int ans = 0;

    for (int l = 0; l <= N; ++l)
    {
        for (int r = 0; l + r <= N; ++r)
        {
            if (l + r > K) continue;

            int enqueueNum = K - (l + r);
            priority_queue<int, vector<int>, greater<int>> q;
            rep(i, 0, l) q.push(V[i]);
            rep(i, 0, r) q.push(V[N - 1 - i]);

            while (enqueueNum > 0 && !q.empty() && q.top() < 0)
            {
                --enqueueNum;
                q.pop();                
            }

            int sum = 0;
            while (!q.empty())
            {
                sum += q.top();
                q.pop();
            }

            chmax(ans, sum);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c) cout << "Yes";
    else cout << "No";
}

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

using namespace std;
typedef pair<int,int> pii;
const int N = 510;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
int _w;

int n, p[N*N], a[N][N], d[N][N], inq[N][N], ans;
queue<pii> q;

bool inside( int x, int y ) {
	return x >= 1 && x <= n && y >= 1 && y <= n;
}

void update( int sx, int sy ) {
	q.push( pii(sx, sy) );
	inq[sx][sy] = 1;
	while( !q.empty() ) {
		pii tmp = q.front(); q.pop();
		int x = tmp.first, y = tmp.second;
		inq[x][y] = 0;
		for( int dir = 0; dir < 4; ++dir ) {
			int nx = x + dx[dir];
			int ny = y + dy[dir];
			if( inside(nx, ny) && d[x][y] + a[nx][ny] < d[nx][ny] ) {
				d[nx][ny] = d[x][y] + a[nx][ny];
				if( !inq[nx][ny] ) {
					inq[nx][ny] = 1;
					q.push( pii(nx, ny) );
				}
			}
		}
	}
}

int calc_init( int x, int y ) {
	return min(min(abs(x-1), abs(x-n)), min(abs(y-1), abs(y-n))) + 1;
}

void init() {
	for( int i = 1; i <= n; ++i )
		for( int j = 1; j <= n; ++j ) {
			a[i][j] = 1;
			d[i][j] = calc_init(i, j);
		}
	ans = 0;
	for( int i = 1; i <= n*n; ++i ) {
		int now = p[i];
		int x = (now-1)/n+1;
		int y = (now-1)%n+1;
		ans += d[x][y] - 1;
		--d[x][y];
		a[x][y] = 0;
		update(x, y);
	}
	cout << ans << endl;
}

void solve() {
	init();
}

int main() {
	cin >> n;
	for( int i = 1; i <= n*n; ++i )
		_w = scanf( "%d", p+i );
	solve();
	return 0;
}


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

#define int long long

#define f first
#define s second
#define x first
#define y second

int R, C, N;

int hoge(pair<int,int> z){
  // cout<<z.x<<" <> "<<z.y<<endl;

  if(z.y == 0) return z.x;
  if(z.x == R) return R + z.y;
  if(z.y == C) return R + C + R - z.x;
  if(z.x == 0) return R + C + R + C - z.y;

  // cout<<"error"<<endl;
  exit(2);

  return 0;
}

signed main(){
  vector<pair<pair<int,int>,pair<int,int>>> in, D;
  vector<pair<int,int>> A, B;
  stack<int> st;

  cin>>R>>C>>N;

  in.resize(N);

  for(int i = 0; i < N; i++) {
    cin>>in[i].f.x>>in[i].f.y>>in[i].s.x>>in[i].s.y;

    if(
       (in[i].f.x == 0 || in[i].f.x == R || in[i].f.y == 0 || in[i].f.y == C ||
        in[i].f.x == R || in[i].f.x == 0 || in[i].f.y == C || in[i].f.y == 0) &&
       (in[i].s.x == R || in[i].s.x == 0 || in[i].s.y == C || in[i].s.y == 0 ||
        in[i].s.x == 0 || in[i].s.x == R || in[i].s.y == 0 || in[i].s.y == C
        )
       ){
      D.push_back(in[i]);
    }
  }

  // cout<<"Dsize "<<D.size()<<endl;


  if(D.size() == 0){
    cout<<"YES"<<endl;
    return 0;
  }


  for(int i = 0; i < (int)D.size(); i++){
    int a = hoge(D[i].f), b = hoge(D[i].s);

    if(a > b) swap(a,b);

    //A.push_back({a,b});
    A.push_back({a,i});
    A.push_back({b,i});
  }

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


  for(int i = 0, maximum = -1, minimum = -2; i < (int)A.size(); i++){
    st.push(A[i].s);

    while(st.size() >= 2){
      int a = st.top(); st.pop();
      int b = st.top(); st.pop();

      if(a != b) {
        st.push(b);
        st.push(a);
        break;
      }
    }

    /*
    if(maximum < A[i].f) {
      minimum = A[i].f;
      maximum = A[i].s;
    } else if(minimum < A[i].f && A[i].f < maximum && maximum < A[i].s) {
      cout<<"NO"<<endl;
      return 0;
    }
    */
  }



  if(st.size() == 0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 14700
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef unsigned long ul;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i,n) for(int i=0;i<n;i++)

int N, M;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ans = 0;
    cin >> N ;
    if(N >= 105 && N<135){
      ans = 1;
    }
    if(N >= 135 && 165 > N){
      ans = 2;
    }
    if(N >= 165 && 189 > N){
      ans = 3;
    }
    if(N >= 189 && 195 > N){
      ans = 4;
    }
    if(N >= 195 ){
      ans = 5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))
sl_dct = Counter(sl)
m = 0
for i in sl_dct.values():
    m = max(m,i)

sl_s =  list(set(sl))
sl_s.sort()
for i in sl_s:
    if sl_dct[i] == m:
        print(i)

Measured memory_bytes: 52944
#include <cstdio>
#include <cstring>
using namespace std;
char s1[110],s2[110];
int la,lb;
int main() {
	scanf("%s %s",s1,s2);
	la=strlen(s1); lb=strlen(s2);
	if (la>lb)
		printf("GREATER\n");
	else if (la<lb)
		printf("LESS\n");
	else {
		bool t=true;
		for (int i=0;i<la;i++) {
			if (s1[i]>s2[i]) {
				printf("GREATER\n");
				t=false;
				break;
			}
			if (s1[i]<s2[i]) {
				printf("LESS\n");
				t=false;
				break;
			}
		}
		if (t)
			printf("EQUAL\n");
	}
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))

count = 0
ans = []
mi = min(a)
ma = max(a)
plus = True
if ma >= 0 and mi <= 0:
    if abs(mi) < ma:
        plus = True
        idx = a.index(ma)+1
    else:
        plus = False
        idx = a.index(mi)+1
    for i in range(1, n+1):
        if i == idx:
            continue
        ans.append([idx, i])
    count += n-1
else:
    plus = ma > 0
if plus:
    for i in range(1, n):
        ans.append([i, i+1])
else:
    for i in range(n-1):
        ans.append([n-i, n-i-1])
print(count+n-1)
for a in ans:
    print("{} {}".format(a[0], a[1]))


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

using namespace std;
const int N = 1e6+100;
typedef long long ll;
int main(){
	string s;
	cin>>s;
	int a,b;
	a=b=0;
	a=(s[0]-'0')*10+(s[1]-'0');
	b=(s[2]-'0')*10+(s[3]-'0');
	if(a>12||a==0){
		if(b>12||b==0){
			cout<<"NA"<<endl;
		}
		else{
			cout<<"YYMM"<<endl;
		}
	}
	else{
		if(b>12||b==0){
			cout<<"MMYY"<<endl;
		}
		else{
			cout<<"AMBIGUOUS"<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
s  = input()

t  = s[2:-1]
count  = 0
k = 0
for i in range(len(t)):
  if t[i] == "C":
    count += 1
    k = i
s = list(s)
s.pop(k+2)
if s[0] == "A":
  s.pop(0)
  if str(s).islower() and count == 1:
    print("AC")
    exit()
    
print("WA")

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> p(n),d(n);
    vector<int> jisu(n,0);
    for(int i=1;i<n;i++){
      cin >> p[i];
      p[i]--;
      jisu[i]++,jisu[p[i]]++;
    }
    for(int i=1;i<n;i++){
      cin >> d[i];
    }
    vector<list<pair<int,int>>> e(n);
    int ans=0;
    int sta=0;
    for(int i=1;i<n;i++){
      if(jisu[i]>1&&jisu[p[i]]>1){
        e[i].push_back({p[i],d[i]});
        e[p[i]].push_back({i,d[i]});
        ans+=2*d[i];
        sta=i;
      }
      ans+=d[i];
    }
    vector<int> dist(n,-1);
    dist[sta]=0;
    queue<pair<int,int>> bfs;
    pair<int,int> now;
    bfs.push({sta,0});
    while(!bfs.empty()){
      now=bfs.front();
      bfs.pop();
      for(auto it:e[now.first]){
        if(dist[it.first]==-1){
          dist[it.first]=now.second+it.second;
          bfs.push({it.first,now.second+it.second});
        }
      }
    }
    int ma=0,maid=0;
    for(int i=0;i<n;i++){
      if(ma<dist[i]){
        ma=dist[i],maid=i;
      }
    }
    dist=vector<int>(n,-1);
    dist[maid]=0;
    bfs.push({maid,0});
    while(!bfs.empty()){
      now=bfs.front();
      bfs.pop();
      for(auto it:e[now.first]){
        if(dist[it.first]==-1){
          dist[it.first]=now.second+it.second;
          bfs.push({it.first,now.second+it.second});
        }
      }
    }
    // for(int i=0;i<n;i++) cout << dist[i] << " ";
    // cout << endl;
    ma=0;
    for(int i=0;i<n;i++){
      ma=max(ma,dist[i]);
    }
    cout << ans-ma << endl;
  }
  return 0;
}



Measured memory_bytes: 3180
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[310];
double dp[310][310][310];

double f(int i,int j,int k){
	if(dp[i][j][k]!=-1)return dp[i][j][k];
	if(i==0&&j==0&&k==0)return 0.0;
	double res=0.0;
	if(i>0)res+=f(i-1,j,k)*i;
	if(j>0)res+=f(i+1,j-1,k)*j;
	if(k>0)res+=f(i,j+1,k-1)*k;
	res+=N;
	res*=1.0/(i+j+k);
	return dp[i][j][k]=res;
}

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	int a=0,b=0,c=0;
	REP(i,N){
		if(A[i]==1){
			a++;
		}
		else if(A[i]==2){
			b++;
		}
		else{
			c++;
		}
	}
	REP(i,310)REP(j,310)REP(k,310){
		dp[i][j][k]=-1;
	}
	setdouble(10,f(a,b,c));cout<<endl;
	return 0;
}


Measured memory_bytes: 233088
#include<stdio.h>
int main(){
  int i,j,minj,n,a[100],tmp,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    minj=i;
    for(j=i+1;j<n;j++){
      if(a[j]<a[minj]){
	minj=j;
      }
    }
    if(i!=minj){
      sum++;
    }
    tmp=a[i];
    a[i]=a[minj];
    a[minj]=tmp;
  }
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i==n-1){
      printf("\n");
    }else{
      printf(" ");
    }
  }
  printf("%d\n",sum);
}




Measured memory_bytes: 2144
#include <stdio.h>

int main(){
	char s[1100];
	while(1){
		scanf("%s",s);
		if(s[0] == '0'){
			break;
		}
		int sum = 0;
		for(int i=0;s[i] != '\0';i++){ //\0(空文字)に達するまで処理
			sum += s[i] -'0';	
		}
		printf("%d\n",sum);
	}
	return 0;
}



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

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep_3(i, initial, n) for (int i = (int)(initial); i < (int)(n); ++i)
#define repeat(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int i = (int)(n); i > 0; i--)
#define rep_r_3(i, initial, n) for (int i = (int)(initial); i > (int)(n); i--)
#define repeat_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define variable
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double EPS = numeric_limits<double>::epsilon();
// 最大公約数
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }

int main() {
	string O, E;
	cin >> O >> E;

	string result = "";
	repeat(i, O.length()) {
		string o = "";
		if (i < O.length()) {
			o = O.substr(i, 1);
		}

		string e = "";
		if (i < E.length()) {
			e = E.substr(i, 1);
		}

		result += o + e;
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define  INF 1e9

using namespace std;

int n, a, n_min = INF, n_max = -INF;
long sum = 0;

int main() {
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    n_min = min(a, n_min);
    n_max = max(a, n_max);
    sum += a;
  }
  cout << n_min << " " << n_max << " " << sum << endl;
}

Measured memory_bytes: 3088
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int c[15],A[15][15];
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int n,m,x,ans=LLONG_MAX;
	cin>>n>>m>>x;
	for (int i = 0; i < n; ++i)
	{
		cin>>c[i];
		for (int j = 0; j < m; ++j)
			cin>>A[i][j];
	}
	for (int i = 0; i < (1<<n); ++i)
	{
		int sum=0;
		v vec(m,0);
		for (int j = 0; j < n; ++j)
		{
			if((i>>j)&1){
				sum+=c[j];
				for (int z = 0; z < m; ++z)
					vec[z]+=A[j][z];
			}
		}
		bool f=1;
		for(auto it:vec)
			if(it<x){f=0;break;}
		if(f)ans=min(ans,sum);
	}
	if(ans==LLONG_MAX)ans=-1;
	cout<<ans<<"\n";
	return 0;
}
//long long
//array bounds
//special cases
//binary search

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

int main(){
    int n;
    cin>>n;
    double tmp=0.0;
    vector<int> ar(n);
    for(int i=0;i<n;i++){
        cin>>ar[i];
        tmp+=1.0/(1.0*ar[i]);
    }
    cout<<1.0/(1.0*tmp)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>

#define MAXN 200000

using namespace std;

typedef long long ll;

ll A[MAXN];
ll B[MAXN];

int find ( ll key, int N )
{
  int l = 0;
  int r = N;
  int mid;

  while( l < r ) {
    mid = (l+r)/2;
    if ( B[mid] == key ) return mid;
    if ( key < B[mid] ) r = mid;
    else l = mid+1;
  }

  return -1;
}

int main()
{
  int N;
  int mid1, mid2;

  cin >> N;
  mid1 = N/2-1;
  mid2 = N/2;

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

  sort(B,B+N);
  //printf("mid1 = %d, mid2 = %d\n", mid1, mid2);
  //for ( int i = 0; i < N; ++i ) cout << B[i] << " "; cout << endl;
  for ( int i = 0; i < N; ++i ) {
      int tmp = find(A[i], N);
      if ( tmp < mid2 ) cout << B[mid2] << endl;
      else cout << B[mid1] << endl;
  }
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

ll f(ll n)
{
    ll r=n%4;
    if(n<0) return 0;
    if(r==0) return n;
    else if(r==1) return 1;
    else if(r==2) return n+1;
    return 0;
}

int main(void)
{
    
    string s,ans;
    cin>>s;
    for(int i=0;i<s.size();i+=2) ans+=s[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T& a, T b) { if (a < b)a = b; }
template<class T>void chmin(T& a, T b) { if (a > b)a = b; }
constexpr int INF = 1000000000000000000;
constexpr int mod = 1000000007;
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int kaijo[2000010];
int gcd(int a, int b) {
    if (b == 0)return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
bool prime(int a) {
    if (a == 1)return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)return false;
    }
    return true;
}
void init_fact() {
    kaijo[0] = 1;
    for (int i = 1; i <= 2000000; i++) {
        kaijo[i] = kaijo[i - 1] * i;
        kaijo[i] %= mod;
    }
}
int modpow(int a, int b) {
    if (b == 0)return 1;
    if (b % 2)return modpow(a, b - 1) * a % mod;
    int memo = modpow(a, b / 2);
    return memo * memo % mod;
}
int comb(int a, int b) {
    if (!kaijo[0])init_fact();
    return kaijo[a] * modpow(kaijo[a - b], mod - 2) % mod * modpow(kaijo[b], mod - 2) % mod;
}
int inv(int x) {
    x = modpow(x, mod - 2);
    return x;
}
bool kosa(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy) {
    double ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);
    double tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);
    double tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);
    double td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);
    return tc * td < 0 && ta * tb < 0;
}
int n, a[16][16], dp[(1 << 16)], memo[(1 << 16)];
signed main() {
    cin >> n;
    rep(i, n) {
        rep(j, n) {
            cin >> a[i][j];
        }
    }
    rep(i, (1 << n)) {
        rep(j, n) {
            if ((i >> j) & 1) {
                rep(k, n) {
                    if (j < k) {
                        if ((i >> k) & 1) {
                            memo[i] += a[j][k];
                        }
                    }
                }
            }
        }
    }
    rep(i, (1 << n)) {
        for (int j = i; j > 0; j = (j - 1) & i) {
            chmax(dp[i], dp[i - j] + memo[j]);
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return 0;
}


Measured memory_bytes: 1280
x,y,z = map(int,input().split())
a = x // (z+y)
b = x % (y+z)
cnt = 0
if y == 0:
    print(0)
else:
    cnt = 0
    if b <= y:
        cnt += b
    else:
        cnt += y
        
    cnt += a * y
    print(cnt)

Measured memory_bytes: 3064
N = int(input())
X = list(map(int, (input().split())))

distance = lambda Xi, P: (Xi - P) ** 2
all_distance = lambda X, P: sum([distance(Xi, P) for Xi in X])

X_min = min(X)
X_max = max(X)

answer = min([all_distance(X, P) for P in range(X_min, X_max + 1)])

print(answer)


Measured memory_bytes: 3060
N,K=map(int,input().split())
A=list(map(int,input().split()))
d={}
for i in range(N):
    if A[i] in d:
        d[A[i]]+=1
    else:
        d[A[i]]=1
l=list(d.values())
l.sort()
n=len(l)
print(sum(l[0:-K]))

Measured memory_bytes: 33312
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int x,n; cin>>x>>n;
	map <int,bool> m;
	forn(i,n)
	{
	    int p; cin>>p;
	    m[p] = 1;
	}
	int id;
	for(id=x;;id++) if(m[id]==0) break;
	int id1;
	for(id1=x;;id1--) if(m[id1]==0) break;
	if( abs(x-id1) <= abs(x-id) ) cout<<id1;
	else cout<<id;
	
	return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#define MAX_V 10001

typedef struct vertex {
    struct edge *head;
}vertex;

typedef struct edge {
    int to;
    struct edge *next;
}edge;

void add(vertex *a, int to);
void dfs(int i);
int rdfs(int i, int k);
int scc(void);
void init(void);

vertex g[MAX_V];
vertex rg[MAX_V];
int used[MAX_V];
int ret[MAX_V];
int num[MAX_V];
int v, e, dfs_num;

int main(void)
{
    int i, j, k, f, t, q;
    scanf("%d %d", &v, &e);
    for (i = 0; i < e; i++) {
        scanf("%d %d", &f, &t);
        add(&g[f], t);
        add(&rg[t], f);
    }
    init();
    scc();
    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d %d", &f, &t);
        printf("%d\n", ret[f] == ret[t]);
    }
    return 0;
}

void init(void)
{
    int i;
    for (i = 0; i < v; i++) {
        used[i] = 0;
        ret[i] = 0;
        num[i] = 0;
    }
    dfs_num = 0;
}

int scc(void)
{
    int i, k = 0;
    for (i = 0; i < v; i++) {
        if (!used[i]) {
            dfs(i);
        }
    }
    for (i = 0; i < v; i++) used[i] = 0;
    for (i = v - 1; i >= 0; i--) {
        if (!used[num[i]]) {
            rdfs(num[i], k++);
        }
    }
    return k;
}

int rdfs(int i, int k)
{
    edge *pos = rg[i].head;
    used[i] = 1;
    ret[i] = k;
    while (pos) {
        if (!used[pos->to]) {
            rdfs(pos->to, k);
        }
        pos = pos->next;
    }
    return k;
}

void dfs(int i)
{
    edge *pos = g[i].head;
    used[i] = 1;
    while (pos) {
        if (!used[pos->to]) {
            dfs(pos->to);
        }
        pos = pos->next;
    }
    num[dfs_num++] = i;
}

void add(vertex *a, int to)
{
    edge *pos = a->head;
    edge *new_ = (edge *)malloc(sizeof(edge));
    new_->to = to;
    new_->next = NULL;
    if (!pos) {
        a->head = new_;
    } else {
        while (pos->next) {
            pos = pos->next;
        }
        pos->next = new_;
    }
}

Measured memory_bytes: 2440
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,q,w;
	scanf("%d%d%d%d",&x,&y,&q,&w);
	int l=abs(x-q),up=abs(y-w);
	for(int i=0;i<up;i++)
	{
		if(y-w>0)
		{
			printf("D");
		}
		else
		printf("U");
	}   
	for(int i=0;i<l;i++)
	{
	if(x-q>0)
	printf("L");
	else
	printf("R");
	}      //去 
	for(int i=0;i<up;i++)
	{
		if(y-w>0)
		{
			printf("U");
		}
		else
		printf("D");
	}
	for(int i=0;i<l;i++)
	{
	if(x-q>0)
	printf("R");
	else
	printf("L");
	}   //回 
	if(x-q>0)
	printf("R");
	else
	printf("L");
	for(int i=0;i<=up;i++)
	{
		if(y-w>0)
		{
			printf("D");
		}
		else
		printf("U");
	}
	for(int i=0;i<=l;i++)
	{
	if(x-q>0)
	printf("L");
	else
	printf("R");
	}
	if(y-w>0)
		{
			printf("U");
		}
	else
		printf("D"); //又去 
	if(x-q>0)
	printf("L");
	else
	printf("R");
	for(int i=0;i<=up;i++)
	{
		if(y-w>0)
		{
			printf("U");
		}
		else
		printf("D");
	}
		for(int i=0;i<=l;i++)
	{
	if(x-q>0)
	printf("R");
	else
	printf("L");
	}
		if(y-w>0)
		{
			printf("D\n");
		}
	else
		printf("U\n");
	return 0;
}

Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int N;
    cin >> N;

    int count=0;
    int val;

    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> val;
        while(val % 2==0){
            val = val/2;
            count++;
        }
    }

    cout << count << endl;
    

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N; cin>>N;
  vector<int> A(N);
  for(auto& a: A) {
    cin>>a;
  }

  vector<int> B = A;
  sort(B.begin(), B.end());
  int median1 = B[N/2-1];
  int median2 = B[N/2];
  for(int i=0; i<N; i++) {
    int ans;
    if(A[i] < median2) {
      ans = median2;
    } else {
      ans = median1;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3840
#include<stdio.h>
#define MAX 100000

int partition(int,int);

int A[MAX];
int n;

int main(){
  int i,num;

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

    scanf("%d",&A[i]);
  }
  
  num=partition(0,n-1);

  for(i=0;i<n;i++){
    if(i)printf(" ");
    if(i==num)printf("[");
    printf("%d",A[i]);
    if(i==num)printf("]");
  }
  printf("\n");

  return 0;
}

int partition(int p,int r){
  int x,i,j,num;

  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      num=A[i];
      A[i]=A[j];
      A[j]=num;	
    }
  }
  num=A[i+1];
  A[i+1]=A[r];
  A[r]=num;
  return i+1;
}




Measured memory_bytes: 2992