akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ")
#define print1(v) cout << fixed << setprecision(10) << v << "\n"
#define print2(v1, v2) cout << fixed << setprecision(10) << v1 << " " << v2 << "\n"
#define printvi(v, n) REP(iiii, n) { cout << v[iiii]; delim(iiii, n); }
#define printvii(v, h, w) REP(iiiii, h) { printvi(v[iiiii], w); }

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

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 1e5;
int n;
vi x(maxn);
vi y(maxn);
vb used(maxn);
graph G(maxn);

vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};

// O(|E|log|V|)
int prim() {
    int s = 0;
    used.assign(n, false);
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.emplace(0, s);
    int ret = 0;
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        int v = p.second;
        if (used[v]) continue;
        used[v] = true;
        ret += p.first;
        for (auto &e : G[v]) pq.emplace(e.cost, e.to);
    }
    return ret;
}

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

    cin >> n;
    REP(i, n) {
        cin >> x[i] >> y[i];
    }

    vi idx(n);
    vi idy(n);
    REP(i, n) {
        idx[i] = i;
        idy[i] = i;
    }
    sort(idx.begin(), idx.end(), [&](int i, int j) { return x[i] < x[j]; });
    sort(idy.begin(), idy.end(), [&](int i, int j) { return y[i] < y[j]; });

    REP(i, n-1) {
        edge e;
        int s = idx[i];
        e.to = idx[i+1];
        e.cost = x[e.to] - x[s];
        G[s].push_back(e);
        swap(e.to, s);
        G[s].push_back(e);
    }
    REP(i, n-1) {
        edge e;
        int s = idy[i];
        e.to = idy[i+1];
        e.cost = y[e.to] - y[s];
        G[s].push_back(e);
        swap(e.to, s);
        G[s].push_back(e);
    }
    
    int ret = prim();

    print1(ret);
}

Measured memory_bytes: 21904
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int L, R, d;
  int cnt = 0;
  cin >> L >> R >> d;
  for(int i = L; i <= R; i++){
    if(i%d == 0) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3532
#include <stdio.h>

int main() {
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);

    if (A == B) {
        printf("%d\n", C);
    } else if (B == C) {
        printf("%d\n", A);
    } else {
        printf("%d\n", B);
    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
int main() {
    int N,A,B;
    int u;
    cin >> N >> A >> B;
    u = N*A; 
    
    if(u > B){
        cout << B << endl;
    }else{
        cout << u << endl;
    }
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> l(N);
  for(int i=0;i<N;i++){
    cin >> l.at(i);
  }
  
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  int ans=0;
  for(int i=0;i<K;i++){
    ans+=l.at(i);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/26/20 20:17:32
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  ll n,m,s; cin>>n>>m>>s;
  struct Train {
    ll s, c, d;
    Train(ll s,ll c,ll d):s(s),c(c),d(d){}
    bool operator>(const Train& x) const {return d>x.d;}
  };
  vector<Train> graph[n];
  for (int i = 0; i < m; i++) {
    ll u,v,a,b; cin>>u>>v>>a>>b; u--; v--;
    graph[u].emplace_back(v,a,b);
    graph[v].emplace_back(u,a,b);
  }
  for (int i = 0; i < n; i++) {
    int c,d; cin>>c>>d;
    graph[i].emplace_back(i,-c,d);
  }
  constexpr ll MAX = 200;
  constexpr ll INF = 1e18;
  vector<array<ll, MAX+1>> dp(n);
  for (auto& arr:dp) arr.fill(INF);
  dp[0][min(s,MAX)] = 0;
  priority_queue<Train, vector<Train>, greater<>> qs;
  qs.emplace(0,s,0);
  while (not qs.empty()) {
    auto [s,c,d] = qs.top(); qs.pop();
    if (d > dp[s][min(c,MAX)]) continue;
    for (auto t:graph[s]) {
      if (c-t.c<0) continue;
      if (d+t.d >= dp[t.s][min(c-t.c,MAX)]) continue;
      dp[t.s][min(c-t.c,MAX)] = d+t.d;
      qs.emplace(t.s, c-t.c, d+t.d);
    }
  }
  for (int i = 1; i < n; i++) {
    cout << *min_element(dp[i].begin(), dp[i].end()) << endl;
  }

  return 0;
}


Measured memory_bytes: 3824
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = LIST()

a = [1]
r = -1
loc = 1
b = [0]*(N+1)
b[1] = 1


for i in range(N):
	loc = A[loc-1]
	#print(loc)
	if b[loc] == 0:
		a.append(loc)
		b[loc] = 1
		#print(a)
	else:
		r = i+1
		loop_start = loc
		break

#print(a)
#print(r)
#print(loop_start)

for i in range(N):
	if a[i] == loop_start:
		l = i
		break

first = a[:l]
loop = a[l:]

#print(l, r)
#print(first)
#print(loop)


K += 1

if K <= len(first):
	print(a[K-1])
else:
	K -= len(first)
	K %= len(loop)
	print(loop[K-1])


Measured memory_bytes: 104492
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const int64_t MOD = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    vector<int> c(n);
    rep(i, n)
    {
        cin >> c[i];
        c[i]--;
    }
    c.erase(unique(c.begin(), c.end()), c.end());
    n = c.size();

    vector<int64_t> dp(n + 1);
    vector<int64_t> dp2(200'000, 0);
    irep(i, n)
    {
        if (i == 0) {
            dp[i] = 1;
        } else {
            dp2[c[i - 1]] += dp[i - 1];
            dp2[c[i - 1]] %= MOD;
            dp[i] = dp2[c[i - 1]];
        }
    }

    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int LL;
typedef LL ll;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
const ll M=2e5+5,LG=19,SM=4000+5,inf=1e18+1;
ll mod=924844033;

ll n,x;
ll a[M];
bool us[M];

int main()
{
	ios::sync_with_stdio(0);
    cin >> n >> x;
    if (x==1 || x==2*n-1)
        RET("No");
    cout << "Yes\n";
    if (n==2)
        RET("1 2 3");
    if (x==3 && n==3)
        RET("1 2 3 4 5");
    ll s=2*n-2;
    if (x==s) s=2;
    a[n-2]=s;
    a[n-1]=x;
    a[n]=1;
    a[n+1]=2*n-1;
    if (x==2*n-2) swap(a[n],a[n+1]);
    us[1]=us[2*n-1]=us[s]=us[x]=1;
    s=1;
    For(i,0,n-2)
    {
        while (us[s]) s++;
        us[s]=1;
        a[i]=s;
    }
    For(i,n+2,2*n-1)
    {
        while (us[s]) s++;
        us[s]=1;
        a[i]=s;
    }
    For(i,0,2*n-1) cout << a[i] << ' ';         
}    

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
int nx[4]={0,-1,0,1};
int ny[4]={-1,0,1,0};

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int main(){
    ll a,b,c;
    cin >> a >> b >>c;
    if(c-a-b<=0){
        cout << "No" <<endl;
    }
    else {
        ll left=4*a*b;
        ll right=(c-a-b)*(c-a-b);
        if(left<right) cout << "Yes" <<endl;
        else cout << "No" <<endl;
    }
    return 0;
 
    return 0;
}

Measured memory_bytes: 256
import re
A,B = [int(i) for i in input().split()]
S = input()
count = 0
for i in range(A + B + 1) :
    if (S[A] != '-'):
        break
    elif (re.match("[0-9]",S[i])):
        count+=1
if count == (A + B):
    print('Yes')
else :
    print('No')


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

int main(void){
   string str,command,p,tmp;
   int count,a,b;
   cin >> str >> count;
   for (int i = 0; i < count; i++){
      cin >> command;
      if (command == "replace"){
         cin >> a >> b >> p;
         for (int j = 0; j < b - a + 1; j++){
            str[a + j] = p[j];
         }
      }
      if (command == "reverse"){
         cin >> a >> b;
         for (int j = a; j <= b; j++){
            tmp[b - j] = str[j]; 
         }
         for (int j = a; j <= b; j++){
            str[j] = tmp[j - a];
         }
      }
      if (command == "print"){
         cin >> a >> b;
         for (int j = 0; j < b - a + 1; j++){
            cout << str[a + j];
         }
         cout << endl;
      }
   }
   return 0;
}


Measured memory_bytes: 3216
#B - Judge Status Summary
S = []
N = int(input())
for i in range(N):
    Si = str(input())
    S.append(Si)
C0 = S.count('AC')
C1 = S.count('WA')
C2 = S.count('TLE')
C3 = S.count('RE')

# 出力
print("AC x",C0)
print("WA x",C1)
print("TLE x",C2)
print("RE x",C3)

Measured memory_bytes: 16300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,j,n) for(int i=j;i<n;i++)
int main(){
  int N,C;cin>>N>>C;
  vector<int> s(N),t(N),c(N),cnt(200010);
  rep(i,N) cin>>s[i]>>t[i]>>c[i];
  REP(i,1,C+1){
	vector<int> table(2000010);
    rep(j,N) {
      if(c[j]==i) {
        table[s[j]*2-1]++,table[t[j]*2]--;
      }
    }
    REP(j,1,2000010) table[j]+=table[j-1];
    rep(j,2000010) if(table[j]>0) cnt[j]++;
  }
  int ans=0;
  for(auto p:cnt) ans=max(ans,p);
  cout<<ans<<endl;
}
    

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

using namespace std;

#define ll long long 

int main()
{
	int n, a[100005],b[100005];
	
	cin >> n;
	for(int i = 1; i <= n+1; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) cin >> b[i];
	
	ll sum = 0;
	
	for(int i = 1; i <= n; i++)
	{
		if(a[i] >= b[i])
		{
			sum += b[i];
			b[i] = 0;
		}
		else
		{
			sum += a[i];
			b[i] -= a[i];
			
			sum += min(a[i+1],b[i]);
			a[i+1] -= min(a[i+1],b[i]);
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1024
n = int(input())
a,b,c = [],[],[]
for i in range(n):
    tmp = list(int(i) for i in input().split())
    a.append(tmp[0])
    b.append(tmp[1])
    c.append(tmp[2])

dp = list(list(0 for i in range(n)) for i in range(3))
for i in range(n):
    if i==0:
        dp[0][i] = a[i]
        dp[1][i] = b[i]
        dp[2][i] = c[i]
    else:
        dp[0][i] = max(dp[1][i-1],dp[2][i-1]) + a[i]
        dp[1][i] = max(dp[0][i-1],dp[2][i-1]) + b[i]
        dp[2][i] = max(dp[0][i-1],dp[1][i-1]) + c[i]
print(max(dp[0][n-1], dp[1][n-1], dp[2][n-1]))
        

Measured memory_bytes: 26884
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;

struct Dat{
    ll dist;
    ll place;
    ll par;
    bool operator>(const Dat& a) const{
        if(dist!=a.dist) return dist>a.dist;
        return place!=a.place ? place>a.place : par>a.par;
    }
};

typedef priority_queue<Dat,vector<Dat>,greater<Dat> > Dat_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define MUL(a,b) a=(a*b)%mod

vector<P> d[101];
bool used[101][101];
int main(){
    ll N,M; cin>>N>>M;
    rep(i,M){
        ll a,b,c; cin>>a>>b>>c;
        a--; b--;
        d[a].pb(mp(c,b));
        d[b].pb(mp(c,a));
    }
    rep(i,N){
        Dat_queue Q;
        vec memo(N,INF);
        memo[i]=0;
        Dat y={0,i,i};
        Q.push(y);
        while(!Q.empty()){
            Dat x=Q.top();
            Q.pop();
            if(x.dist<=memo[x.place]){
                used[x.par][x.place]=true;
                used[x.place][x.par]=true;
                //cout<<i<<':'<<x.par<<' '<<x.place<<' '<<x.dist<<endl;
                memo[x.place]=x.dist;
                ll A=x.place;
                
                rep(j,d[A].size()) {
                    Dat y={x.dist+d[A][j].first, d[A][j].second,A};
                    Q.push(y);
                }
            }
        }
    }
    ll ans=0;
    rep(i,N) rep(j,d[i].size()){
        ll k=d[i][j].second;
        if(!used[i][k]) ans++;
    }
    cout<<ans/2<<endl;
    
}

Measured memory_bytes: 3704
A, B = gets.split.map(&:to_i)
if A == B
  puts('Draw')
  exit
end
if [A, B].include?(13) && [A, B].include?(1)
  puts(A == 1 ? 'Alice' : 'Bob') 
else
  puts(A < B ? 'Bob' : 'Alice')
end

Measured memory_bytes: 1788
import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
	private static BufferedReader br = null;
	
	public static void main(String[] args) {
		int n = Integer.parseInt(read(1)[0]);
		String[] w = read(n);
		
		String result = "Yes";
		
		Set<String> wSet = Arrays.stream(w).collect(Collectors.toSet());
		if (wSet.size() != w.length) {
			result = "No";
		} else {
			for (int i = 1; i < w.length; i++) {
				if (w[i - 1].charAt(w[i - 1].length() - 1) != w[i].charAt(0)) {
					result = "No";
				}
			}
		}
		
		System.out.println(result);
		
		close();
	}
	
	private static String[] read(int len) {
		List<String> strList = new ArrayList<>();
		
		try {
			if (br == null) {
				br = new BufferedReader(new InputStreamReader(System.in));
			}
			
			for (int i = 0; i < len; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
		
		return strList.toArray(new String[0]);
	}
	
	private static void close() {
		try {
			if (br != null) {
				br.close();
			}
		} catch (IOException e) {
		}
	}
}


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

int main() {
	int N,D;
	cin >> N >>D;
	int ans = N / (1 + 2 * D);
	if (0 != N % (1 + 2 * D)) {
		ans++;
	}
	cout << ans <<endl;
	return 0;
}

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

int main(){
  string x,y;
  cin >> x >> y;
  if(x>y) cout << ">" << endl;
  if(y>x) cout << "<" << endl;
  if(x==y) cout << "=" << endl;
}

Measured memory_bytes: 256
// ABC116_A
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    ll N, M, hoge;
    cin >> N >> M >> hoge;
    
    // calculation
    cout << (N*M)/2 << "\n";
    
    return 0;
}


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

int main()
{
    int s;
    cin >> s;
    vector<bool> check(1000001, false);

    for (int i = 0; i <= 1000000; i++)
    {
        if (check[s])
        {
            cout << i + 1 << endl;
            break;
        }
        check[s] = true;
        if (s % 2 == 0)
        {
            s = s / 2;
        }
        else
        {
            s = 3 * s + 1;
        }
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(){
  int n, x;
  cin >> n >> x;

  vector<lli> l(n);
  for(int i = 0; i < n; i++){
    cin >> l[i];
  }

  lli now_pt = 0;
  
  int i;
  for(i = 0; i < n; i++){
    now_pt += l[i];
    if(now_pt > x)
      break;
  }

  // 1 <= x <= 1000
  cout << i + 1 << endl;

}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans = 0;
  if(a + b >= 2 * c){
    ans += min(x, y) * c * 2;
  }else{
    cout << a * x + b * y << endl;
    return 0;
  }
  int mn = min(x, y);
  x -= mn;
  y -= mn;
  if (x > 0){
    if(a > 2 * c){
      ans += 2 * c * x;
    }else{
      ans += a * x;
    }
  }else if(y > 0){
    if(b > 2 * c){
      ans += 2 * c * y;
    }else{
      ans += b * y;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#pypyは内包表記使わない, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 1000000007
    l = []
    for _ in range(4):
        n = int(input())
        l.append(n)
    print(min(l[:2])+min(l[2:]))

if __name__ == '__main__':
    main()

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d){
        cout << "Left" << endl;
    } else if(a+b == c+d){
        cout << "Balanced" << endl;
    }else{
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
package main

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

func main() {
	N, M := ReadInt(), ReadInt()
	v := make([]int, N)
	for i := 0; i < N; i++ {
		v[i] = -1
	}
	for i := 0; i < M; i++ {
		s, c := ReadInt()-1, ReadInt()
		if v[s] != -1 && v[s] != c {
			fmt.Println(-1)
			return
		}
		v[s] = c
	}

	if N > 1 && v[0] == 0 {
		fmt.Println(-1)
		return
	}

	for i := 0; i < N; i++ {
		if v[i] >= 0 {
			fmt.Print(v[i])
			continue
		}
		if i == 0 && N > 1 {
			fmt.Print(1)
		} else {
			fmt.Print(0)
		}
	}
	fmt.Println()
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
def scc(argv)
  n, m = argv
  if m >= 2 * n
    n + (m - 2 * n)/4
  else
    m / 2
  end
end

# puts scc(ARGV.map(&:to_i)) if __FILE__ == $PROGRAM_NAME
puts scc(STDIN.gets.chomp.split(" ").map(&:to_i)) if __FILE__ == $PROGRAM_NAME


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n, k;
  cin >> n >> k;
  vector <int> h(n);
  REP(i, n) {
	cin >> h[i];
  }
  vector <int> dp(n);
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; i++) {
	  dp[i] = 2 * 1e9;
	  REP1(j, k) {
		if (i - j >= 0) {
			dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
		  }
	  }
	}
  cout << dp[n - 1] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
string s;
int p, P, Q, R;

int solve()
{
	if (isdigit(s[p]))
	{
		int n = s[p] - '0';
		p++;
		return n;
	}
	else if (s[p] == '(')
	{
		p++;
		int a = solve();
		char c = s[p];
		p++;
		int b = solve();
		p++;
		if (c == '+') return max(a, b);
		else if(c=='*') return min(a, b);
		return 0;
	}
	else if (s[p] == '-')
	{
		p++;
		int t = solve();
		return 2 - t;
	}
	else if (s[p] == 'P')
	{
		p++;
		return P;
	}
	else if (s[p] == 'Q')
	{
		p++;
		return Q;
	}
	else if (s[p] == 'R')
	{
		p++;
		return R;
	}
	return 0;
}

int main()
{
	while (cin >> s&&s != ".")
	{
		int cnt = 0;
		REP(i, 3)REP(j, 3)REP(k, 3)
		{
			P = i; Q = j; R = k;
			p = 0;
			if (solve() == 2) cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define forn(i, n) for (int i = 0; i < (int) (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

using namespace std;

int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   int n;
   cin >> n;
   cout << n*(n+1)/2;
   return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    char a;
    cin >> a;
    if ((int)a >= 65 && (int)a <= 90){
        cout << 'A';
    }else if ((int)a >= 97 && (int)a <= 122){
        cout << 'a';
    }
    return 0;
}


Measured memory_bytes: 3588
program abc149b
   implicit none
   integer(8) :: a, b, k

   read(*,*) a, b, k

   if (a<=k) then
      k = k - a
      a = 0
      b = b - k
      if (b < 0) b = 0
   else
      a = a - k
   end if

   write(*,*) a, b
end program abc149b


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define pb push_back
#define lp(j, n)  for(int j=0; j<(int)(n); ++j)
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
#define F first
#define S second
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int,int> > vpii;
typedef map<int, int> mii;
const ll N=1e5+5;
ll arr[N],A[N]  ;
bool visited[N]={};
int main()
{
  int n,sum=0;
  cin>>n;
  for(int i=0 ; i<n && cin>>arr[i] ; i++)
  {
      sum+=arr[i];
  }
  sort(arr , arr+n , greater<int>());
  if(arr[0]<sum-arr[0])
    cout<<"Yes";
  else
    cout<<"No";

 go;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;	
  ci(n);
  vst A(n);
  FOR(i,0,n){
    ci(A[i])
    SORT(A[i]);
  }
  SORT(A);
  ll ans=0;
  ll count=1;
  
  FOR(i,1,n){
    if(A[i-1]==A[i]){
      count++;
    }
    else{
      ans+=count*(count-1)/2;
      count=1;
    }
  }
  ans+=count*(count-1)/2;
  co(ans)
}

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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void) {
	long long N, keta;

	cin >> N;

	keta = 0;

	vector<char> ans;

	while(N>0){

		long long tmp = N % 26;
        if(tmp == 0)tmp=26;
		ans.push_back('a'+tmp-1);
		N = (N-1) / 26;
		keta++;

	}

	reverse(ans.begin(), ans.end());

	for (int i = 0; i < keta; i++) {
		cout << ans[i];
	}
	cout << endl;


	return 0;
}




Measured memory_bytes: 3624
#include<bits/stdc++.h>
const int N=255;
int n,mo,i,j,k,l,lo[N*2],hi[N*2],f[2][N],nw,ans;
inline int F(int x){return x>0?x:0;}
int main(){
	scanf("%d%d",&n,&mo);
	for(i=0;i<n*2;++i)hi[i]=sqrt(n*n*4-i*i),lo[i]=i<n?sqrt(n*n-i*i-1):0;hi[0]=2*n-1;
	for(l=0;l<=n;++l){
		memset(f,0,sizeof f);nw=0;f[0][0]=1;
		for(i=j=0;i<n || j<n;){
			nw^=1;memset(f[nw],0,n+1<<2);
			if(i<n && (j==n || lo[n-1-i]<=hi[n*2-1-j])){
				for(k=0;k<=l && k<=i+1;++k)
					f[nw][k]=(1ll*f[!nw][k]*F(hi[n-1-i]+1-(i-k)-l-n)+(k?1ll*f[!nw][k-1]*F(lo[n-1-i]+1-(k-1)-j):0))%mo;
				++i;
			}else{
				for(k=0;k<=l && k<=i;++k)
					f[nw][k]=1ll*f[!nw][k]*F(hi[n*2-1-j]+1-k-j)%mo;
				++j;
			}
		}
		ans=(ans+(l&1?mo-f[nw][l]:f[nw][l]))%mo;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

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

	if (A <= 9 && B <= 9) { cout << A*B << endl; }
	else { cout << -1 << endl; }
}

Measured memory_bytes: 256
N, A, B = list(map(int, input().split()))
X = [0] * N
for i in range(N):
    X[i] = int(input())

def C(x):
    Y = [0] * N
    for i in range(N):
        Y[i] = X[i] - x * B
    
    cnt = 0
    for i in range(N):
        if Y[i] > 0:
            cnt += (Y[i] + A - B - 1) // (A - B)
    return cnt <= x

ng = 0; ok = 10**18
while ok - ng > 1:
    mid = (ng + ok) >> 1
    if C(mid): ok = mid
    else: ng = mid

print(ok)

Measured memory_bytes: 11764
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
    int i,n,aage, peeche, q1,q2,p;
    scanf("%d",&n);
    int a[n-1];
    
    scanf("%d",&q2);
    scanf("%d",&q1);
    scanf("%d",&p);
    if(q2>q1)
    a[0]=q2-q1;
    else a[0]= q1-q2;
    
    if(p>q1)
        aage=p-q1;
        else aage=q1-p;
        
        if(p>q2)
        peeche= p-q2;
        else peeche= q2-p;
    
    if( (peeche)>(aage+a[0]))
        a[1]= aage+a[0];
        else a[1]= peeche;    
    
    q2=q1;
    q1=p;
    
    
    for(i=2;i<=n-2;i++)
    {
        
        
        scanf("%d",&p);
        
        if(p>q1)
        aage=p-q1;
        else aage=q1-p;
        
        if(p>q2)
        peeche= p-q2;
        else peeche= q2-p;
        
        if( (a[i-2]+peeche)>(a[i-1]+aage))
        a[i]= a[i-1]+aage;
        else a[i]= a[i-2]+ peeche;
        
        
        
        q2=q1;
        q1=p;
        
    }

    printf("%d",a[n-2]);
}


Measured memory_bytes: 2052
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;

class Sobaya
{
  static void Main(){
    new Sobaya().calc();
    return;
  }
    
  Scanner cin;
  
  void calc(){
    cin = new Scanner();
    int n = cin.nextInt();
    
    Console.WriteLine(3*n*n);
  }
    
  
  
}




class Scanner
{
    string[] s;
    int i;
 
    char[] cs = new char[] { ' ' };
 
    public Scanner()
    {
        s = new string[0];
        i = 0;
    }
 
    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }
 
    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }
 
    public long nextLong()
    {
        return long.Parse(next());
    }
 
    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }
 
    public double nextDouble()
    {
        return double.Parse(next());
    }
 
 
    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include<functional>
#include<stdio.h>
using namespace std;
#define int long long
signed main()
{
    int k;
    cin>>k;
    string ans="";
    for(int i=0;i<k;i++)
    {
        ans+="ACL";
    }
    cout<<ans<<endl;
}


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

int main()
{
  string S;
  cin >> S;

  vector<char> out;

  for(auto c: S)
  {
    if(c == 'B')
    {
      if(out.size() != 0)
        out.pop_back();
    }
    else
    {
      out.push_back(c);
    }
  }
  
  for(auto c: out)
  {
    cout << c;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}

const string YES = "YES";
const string NO = "NO";

void solve(long long N, std::vector<long long> A){
    map <int,int> m;
    REP(i, N){m[A[i]]=0;}
    
    REP(i, N){m[A[i]]++;
    if(m[A[i]]>=2){
        cout<<NO<<endl;return;
    }}
    cout<<YES<<endl;return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    for(int i = 0; i < n; ++i)
        scanf("%d %d",&a[i], &b[i]);
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    ll ans = 0;
    for(int i = 0; i < n; ++i){
        ll nxt = ((ans+a[i]+b[i]-1)/b[i])*b[i];
//        cout << nxt << '\n';
        ans += nxt-ans-a[i];

    }
    cout << ans << '\n';
}


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

#define MAXN 100005

using namespace std;

int n, k, a[MAXN], dep[MAXN], sum[MAXN], adv[MAXN], fa[MAXN], ans;
vector<int> g[MAXN];

int read() {
    char c = getchar();
    int x = 0;
    while (!isdigit(c))
        c = getchar();
    while (isdigit(c)) {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    }
    return x;
}

int DFS(int u) {
    int maxi = dep[u];
    for (int i = 0; i < (int)g[u].size(); ++i) {
        int v = g[u][i];
        if (v == 1)
            continue;
        dep[v] = dep[u] + 1;
        maxi = max(DFS(v), maxi);
    }
    if (maxi - dep[u] == k - 1) {
        if (maxi > k)
            ++ans;
        return dep[u] - 1;
    }
    return maxi;
}

int main() {
    n = read();
    k = read();
    for (int i = 1; i <= n; ++i) {
        fa[i] = read();
        g[fa[i]].push_back(i);
    }
    DFS(1);
    ans += fa[1] != 1;
    printf("%d\n", ans);
}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  if(N%2!=0){
    cout << "No" << endl;
  }else{
    for(int i=0;i<N/2;i++){
      if(S.at(i)!=S.at(N/2+i)){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }
  return 0;
}


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

using namespace std;

int main() {
    int W, H, x, y;
    cin >> W >> H >> x >> y;

    double A;
    A = (double)W*H / 2;

    int ans = (W == x * 2 && H == y * 2) ? 1: 0;
    printf("%lf %d", A, ans);
    return 0;
} 


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

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    i64 a, b, k;
    cin >> a >> b >> k;
    for (int i = 0; i < k; i++)
    {
        if (i & 1)
        {
            b = b / 2 * 2;
            a += b / 2;
            b -= b / 2;
        }
        else
        {
            a = a / 2 * 2;
            b += a / 2;
            a -= a / 2;
        }
    }
    cout << a << ' ' << b << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Rep(i,l,r)for(lld i=(lld)l;i<(lld)r;i++)
#define rep(i,n)Rep(i,0,n)
#define Ma(x,y)(x>y?x:y)
typedef long long lld;
#define N 5792

int main() {
	char S[N],T[N],ans[N]="\0";
	lld s,t,dp[N][N]={0},len;
	scanf("%s%s",S,T);
	s=strlen(S);t=strlen(T);
	Rep(i,1,s+1)Rep(j,1,t+1){
		if(S[i-1]==T[j-1])dp[i][j]=dp[i-1][j-1]+1;
		else dp[i][j]=Ma(dp[i][j-1],dp[i-1][j]);
	}
	len=dp[s][t];
	while(len){
		if(dp[s][t]==dp[s-1][t])s--;
		else if(dp[s][t]==dp[s][t-1])t--;
		else{
			ans[--len]=S[s-1];
			s--;
			t--;
		}
	}
	printf("%s",ans);
}

Measured memory_bytes: 262272
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

  	int A, B, C; cin >> A >> B >> C;
    cout << (A+B >= C ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
def main():
    N, W = (int(i) for i in input().split())
    weight = [0] * (N+1)
    value = [0] * (N+1)
    for i in range(1, N+1):
        w, v = (int(i) for i in input().split())
        weight[i] = w
        value[i] = v
    dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

    for i in range(1, N+1):
        for w in range(W+1):
            if w - weight[i] >= 0:
                dp[i][w] = max(dp[i-1][w], dp[i-1][w - weight[i]] + value[i])
            else:
                dp[i][w] = dp[i-1][w]

    print(dp[N][W])


if __name__ == '__main__':
    main()


Measured memory_bytes: 171528
#include <cstdio>

int get() {
    int x = 0; char s = getchar();
    while (s < '0' || s > '9') s = getchar();
    while (s >= '0' && s <= '9') x = (x << 3) + (x << 1) + (s ^ 48), s = getchar();
    return x;
}

const int M = 105;
int n, k, ans;
bool vis[M];

int main() {
    n = get(), k = get();
    for (int d; k--;) {
        d = get();
        while (d--) vis[get()] = 1;
    }
    for (int i = 1; i <= n; ++i) if(!vis[i]) ++ans;
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 1600
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int solve(){
  int k;cin>>k;

  int n=50;
  int x=k/n;
  int y=k%n;
  vi res;
  rep(i, n+1){
    if (i!=n-y) res.pb(i+x);
  }
  cout << n << endl;
  rep(i, sz(res)) cout << res[i] << (i!=sz(res)-1 ? " " : "\n");

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
main = do
    s <- getLine
    let n = read s :: Int
    let ans = filter (\x -> checkNum x || include3 x) [1..n]
    putStrLn $ (" " ++ ) $ unwords $ map show ans

checkNum x = x `mod` 3 == 0

include3 x
  | x `mod` 10 == 3 = True
  | x `div` 10 /= 0 = include3 $ x `div` 10
  | otherwise       = False


Measured memory_bytes: 4108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        const long MOD = 1000000007;
        var n = sc.nextInt();
        var m = sc.nextInt();
        var a = new bool[n + 1];

        for (int i = 0; i < m; i++)
        {
            int tmp = sc.nextInt();
            a[tmp] = true;
        }

        var dp = new long[n + 1];
        dp[0] = 1;

        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j <= Math.Min(n, i + 2); j++)
            {
                if (!a[j])
                {
                    dp[j] += dp[i];
                    dp[j] %= MOD;
                }
            }
        }

        Console.WriteLine(dp[n]);
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 15836
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define rep_eq(i,l,r) for(int i=l; i<=(int)(r); i++)
#define all(vec) vec.begin(),vec.end()
#define allr(vec) vec.rbegin(),vec.rend()
using namespace std;

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 (a > b) { a = b; return 1; } return 0; }

using ll=int64_t;

using vb=vector<bool>;
using vc=vector<char>;
using vs=vector<string>;
using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

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

  string S; cin >>S;

  ll ans=0;
  ll b_cnt=0;
  for (ll i=0;i<(ll)S.size();i++) {
    if (S[i]=='B') {
      b_cnt++;
    } else {
      ans+=b_cnt;
    }
  }

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


Measured memory_bytes: 3708