akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
int main(){
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    int ans = A*X + B*Y;
    if(X >= Y){
        ans = min(ans, C*X*2);
        ans = min(ans, C*Y*2 + A*(X-Y));
    }
    else{
        ans = min(ans, C*Y*2);
        ans = min(ans, C*X*2 + B*(Y-X));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main(void) {

    int N,K; cin>>N>>K;
    vector<ll> H(N);
    for (int i = 0; i < N; ++i) {
        cin>>H[i];
    }

    sort(H.begin(),H.end(),greater<ll>());

    ll ans = 0;
    for (int i = K; i < N; ++i) {
        ans += H[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define rep(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define repr(i, b, e) for(int (i) = (b) - 1; (i) >= (e); --(i))
#define print(x) cout << (x) << endl 
#define min2(a, b) ((a) < (b)) ? (a) : (b)
#define max2(a, b) ((a) > (b)) ? (a) : (b)
#define count counting_variable

typedef long long ll;

using namespace std;

class Item{
    public:
        ll val;
        int p, q, r;
        Item(ll val, int p, int q, int r){
            this->val = val;
            this->p = p;
            this->q = q;
            this->r = r;
        };
        
        bool operator < (const Item &it) const{
            return this->val < it.val;
        }
};

int K, X, Y, Z;
bool visited[1000][1000][1000];
ll A[3000], B[3000], C[3000], S[3000];

int main(){
    cin >> X >> Y >> Z >> K;
    rep(i, 0, X) cin >> A[i];
    rep(i, 0, Y) cin >> B[i];
    rep(i, 0, Z) cin >> C[i];
    //rep(i, 0, 1000) rep(j, 0, 1000) rep(k, 0, 1000) visited[i][j][k] = false;
    sort(A, A + X, [](ll x, ll y) -> bool{return (x > y);});
    sort(C, C + Z, [](ll x, ll y) -> bool{return (x > y);});
    sort(B, B + Y, [](ll x, ll y) -> bool{return (x > y);});

    priority_queue<Item, vector<Item>, less<Item> > que;
    que.push(Item(A[0] + B[0] + C[0], 0, 0, 0));

    rep(i, 0, K){
        Item it = que.top();
        que.pop();
        S[i] = it.val;
        if(it.p + 1 < X && !visited[it.p + 1][it.q][it.r]) que.push(Item(A[it.p + 1] + B[it.q] + C[it.r], it.p + 1, it.q, it.r));
        if(it.q + 1 < Y && !visited[it.p][it.q + 1][it.r]) que.push(Item(A[it.p] + B[it.q + 1] + C[it.r], it.p, it.q + 1, it.r));
        if(it.r + 1 < Z && !visited[it.p][it.q][it.r + 1]) que.push(Item(A[it.p] + B[it.q] + C[it.r + 1], it.p, it.q, it.r + 1));
        visited[it.p + 1][it.q][it.r] = visited[it.p][it.q + 1][it.r] = visited[it.p][it.q][it.r + 1] = true;
    }

    rep(i, 0, K) print(S[i]);
    return 0;
}

Measured memory_bytes: 973312
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int h,w; cin>>h>>w;
    vector<int> hl(h,0),wl(w,0);
    vector<vector<char>> m(h,vector<char>(w,'q'));
    rep(i,h){
        rep(j,w){
            cin>>m[i][j];
        }
    }
    rep(i,h){
        rep(j,w){
            if(m[i][j]=='.') hl[i]++;
        }
    }
    rep(i,w){
        rep(j,h){
            if(m[j][i]=='.') wl[i]++;
        }
    }
    rep(i,h){
        if(hl[i]==w) continue;
        rep(j,w){
            if(wl[j]==h) continue;
            cout<<m[i][j];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
        int n,x;cin>>n>>x;
        int cur=0;
        rep0(n){
            int t;cin>>t;
            cur+=t;
            if(cur>x){
                cout<<i+1;r0
            }
        }
        cout<<n+1;
        }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

int main(){
	int n; cin >> n;
	int building[4][3][10];
	int b,f,r,v;

	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++){
				building[i][j][k]=0;
			}
		}
	}
	for(int i=0; i<n; i++){
		cin >> b >> f >> r >> v;
		building[b-1][f-1][r-1] += v;
	}
	for(int i=0; i<4; i++){
		for(int j=0; j<3; j++){
			for(int k=0; k<10; k++){
				cout << " " << building[i][j][k];
			}
			cout << endl;
		}
		if(i<3){
			for(int l=0; l<20; l++)
				cout << "#";
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3092
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String B = sc.next();
		if(B.equals("A")) {
			System.out.println('T');
		} else if(B.equals("T")) {
			System.out.println('A');
		} else if(B.equals("G")) {
			System.out.println('C');
		} else {
			System.out.println('G');
		}
	}

}


Measured memory_bytes: 35648
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>


using namespace std;

int main()
{
    int n, x, l, d;
    int i;
    int ans = 1;
    d = 0;
    cin >> n >> x;
    for(i = 1; i <= n; i++)
    {
        cin >> l;
        if(d + l <= x)
        {
            d = d + l;
            ans++;
        }
        else
        {
            cout << ans;
            return 0;
        }
    }
    cout << ans;
    
    
    return 0;
}

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

int A, B;

int main() {
	cin >> A >> B;
	if ((A*B) % 2 == 1) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		int a = cin.nextInt();
		int b = cin.nextInt();
		int c = cin.nextInt();
		if (a <= c && c <= b)
			cout.println("Yes");
		else
			cout.println("No");
	}

	/**
	 * How to read input in Java — tutorial <br />
	 * By Flatfoot<br />
	 * http://codeforces.com/blog/entry/7018
	 */
	static class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new IllegalStateException(e);
				}
			return st.nextToken();
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException(e);
			}
			return str;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 21204
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n = int(readline())
  a = [ int(i) for i in readline().split()]
  gcd_l = [0]*n
  gcd_r = [0]*n
  
  for i in range(1,n):
    gcd_l[i] = gcd(a[i-1],gcd_l[i-1])
    gcd_r[n-1-i] = gcd(a[n-i],gcd_r[n-i])
  
  ans = 0
  
  for a, b in zip(gcd_l, gcd_r):
    x = gcd(a,b)
    if ans < x:
      ans = x
   
  print(ans)
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14548
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if a * i * 100 + b * j * 100 > f:
            break
        water.append(a * i * 100 + b * j * 100)
        
water = sorted(list(set(water)))
sugar = []
for i in range(3001):
    for j in range(3001):
        if c * i + d * j > f:
            break
        sugar.append(c * i + d * j)
        
sugar = sorted(list(set((sugar))))

sugar_ratio = 0
for i in water:
    for j in sugar:
        if i != 0:
            sugar_water = i + j
            if sugar_water <= f:
                if j / i  <= e / 100:
                    if j / sugar_water >= sugar_ratio:
                        sugar_ratio = j / sugar_water
                        ans_sugar_water = sugar_water
                        ans_sugar = j
                        
print(ans_sugar_water, ans_sugar)

Measured memory_bytes: 12456
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n, m;
    cin >> n >> m;
    scc_graph scc(n);
    int a, b;
    rep(i, m) {
        cin >> a >> b;
        scc.add_edge(a, b);
    }
    auto T = scc.scc();
    cout << T.size() << endl;
    for(auto v : T){
        cout << v.size();
        for(int u : v){
            cout << " " << u;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 40096
import math

inputted = list(map(int, input().split()))
N = inputted[0]
K = inputted[1]

num_of_rolls = lambda dice, K: max(1, math.ceil(math.log2(K / dice)))
continuous_probability = lambda rolls: (1 / 2) ** rolls
expectation = lambda N: 1 / N

answer = 0
for dice in range(1, N + 1):
    if dice >= K:
        answer += 1
    else:
        num = num_of_rolls(dice, K)
        answer += continuous_probability(num)
answer *= expectation(N)

print(answer)


Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	char s[100];
	int i=0,j;
	scanf("%s",s);
	while(1){
		if(s[i]=='\0'){
			break;
		}
		i++;
	}
	for(j=0;j<i;j++){
		printf("x");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), 0)
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, _ := strconv.ParseInt(readString(), 0, 64)
	// if err != nil {
	// 	panic(err.Error())
	// }
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// ---------------------------------------------------------

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}
func main() {
	N := readInt()
	M := readInt()
	Q := readInt()
	var data [510][510]int
	for i := 0; i < M; i++ {
		l, r := readInt(), readInt()
		data[l][r]++
	}

	for i := N; i >= 1; i-- {
		for j := 1; j <= N; j++ {
			data[i][j] += data[i+1][j]
			data[i][j] += data[i][j-1]
			data[i][j] -= data[i+1][j-1]
		}
	}

	for i := 0; i < Q; i++ {
		p, q := readInt(), readInt()
		println(data[p][q])
	}
	stdout.Flush()
}


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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long mod = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;



template< int mod >
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
        ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }
    static int get_mod() { return mod; }
};
using mint = ModInt< mod >;

mint ans;

int main(void) {
    int N;
    cin >> N;
    vector<ll> A(N+1, 0), S(N+1, 0);
    rep(i, 1, N+1) cin >> A[i];
    rep(i, 1, N+1) S[i] = S[i-1] + A[i];

    rep(i, 1, N+1) ans += mint(S[N]-S[i]) * mint(A[i]);

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





Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(whole(a));
    reverse(whole(a));
    vector<int> v(2);
    rep(i, n) {
        v[i%2] += a[i];
    }
    int ans = v[0] - v[1];
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    rep(i, N) cin >> vec[i];
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    int a = 0, b = 0;
    rep(i,(N+1)/2){
        a += vec[2*i];
    }
    rep(i, N/2){
        b += vec[2*i+1];
    }
    cout << a - b;
}


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

#define rep(i, n) for ( int i = 0; i < (n); ++i )
using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

int main( void )
{
	double r;

	cin >> r;

	cout << (2 * r * 3.1415926535) << endl;

	return 0;
}


Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=2e5+7;
const int mod=1e9+7;
ll tree[maxn];
void add(int x,ll val)
{
    while(x<maxn)
    {
        tree[x]=(tree[x]+val)%mod;
        x+=x&-x;
    }
}
ll query(int x)
{
    ll ret=0;
    while(x)
    {
        ret=(ret+tree[x])%mod;
        x-=x&-x;
    }
    return ret;
}

pi all[maxn*2];
int L[maxn],R[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>all[i].first;
        all[i].second=0;
    }
    for(int i=0;i<m;i++)
    {
        cin>>all[i+n].first;
        all[i+n].second=1;
    }
    sort(all,all+n+m);
    {
        int cur=0;
        for(int i=0;i<m+n;i++)
        {
            if(all[i].second) cur=all[i].first;
            else{
                if(cur) L[i]=all[i].first-cur;
            }
        }
    }
    {
        int cur=0;
        for(int i=m+n-1;i>=0;i--)
        {
            if(all[i].second) cur=all[i].first;
            else{
                if(cur) R[i]=cur-all[i].first;
            }
        }
    }
    vc<pi> pt;
    vi pos;
    for(int i=0;i<n+m;i++)
    {
        if(L[i]&&R[i]) {
            pt.emplace_back(L[i],R[i]);
            //dbg(i,L[i],R[i]);
            pos.push_back(R[i]);
        }
    }
    mkuni(pt);
    sort(pt.begin(),pt.end(),[&](pi a,pi b){if(a.first==b.first)return a.second>b.second;return a.first<b.first;});
    pos.push_back(0);
    mkuni(pos);
    auto getid=[&](int x)
    {
        return lower_bound(pos.begin(),pos.end(),x)-pos.begin()+1;
    };
    add(getid(0),1);
    for(auto u:pt)
    {
        ll cur=query(getid(u.second)-1);
        add(getid(u.second),cur);
    }
    print(query(maxn-1));
}

Measured memory_bytes: 8052
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;


int main(void){
   int N;
   cin>>N;
   vector<int> A(N),B(N);
   for(int i=0;i<N;i++){
      cin>>A[i]>>B[i];
   }
   vector<pair<int,int>> tasks;
   for(int i=0;i<N;i++){
      tasks.push_back(make_pair(B[i],A[i]));
   }
   sort(tasks.begin(),tasks.end());
   int now=0;
   bool flag=true;
   for(int i=0;i<N;i++){
      now+=tasks[i].second;
      if(now>tasks[i].first){
         flag=false;
         break;
      }
   }
   if(flag){
      cout<<"Yes"<<endl;
   }else{
      cout<<"No"<<endl;
   }
   return 0;
}

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

int main(){
    int n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    string ans;

    for(int i = 0; i < n; i++){
        ans += a[i];
        ans += b[i];
    }

    cout << ans << endl;
}

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

typedef long long int lli;

#define F(i,n) for(int i=0;i<n;i++)
#define FR(i,n) for(int i=n-1;i>=0;i--)
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define pll pair<lli,lli>
#define vpii vector<pii>
#define vpll vector<pll>
#define vi vector<int>
#define pb push_back
#define all(c) c.begin(),c.end()
#define FL(i,a,b,p) for(int i=a;i<=b;i+=p)
#define FastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

void solve(){
	int n;
	cin>>n;
	int ans=0;
	vi arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	for(int i=1;i<=n;i+=2){
		if((arr[i-1]&1))ans++;
	}
	cout<<ans;
	return ;
}
int main()
{
	FastIO;
	solve();
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>

using namespace std;

struct Node
{
	int key;
	Node* parent;
	Node* left;
	Node* right;
};

Node* root;
Node* NIL;

void insert(int key)
{
	Node* y = NIL;
	Node* x = root;
	Node* z;

	z = new Node;
	z->key = key;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else
	{
		if (z->key < y->key)
		{
			y->left = z;
		}
		else
		{
			y->right = z;
		}
	}
}

void inOrder(Node* u)
{
	if (u == NIL)
	{
		return;
	}
	inOrder(u->left);
	cout << " " << u->key;
	inOrder(u->right);
}

void preOrder(Node* u)
{
	if (u == NIL)
	{
		return;
	}
	cout << " " << u->key;
	preOrder(u->left);
	preOrder(u->right);
}

void solve()
{
	int m;
	cin >> m;
	for (int i = 0; i < m; ++i)
	{
		string command;
		cin >> command;
		if (command == "insert")
		{
			int key;
			cin >> key;
			insert(key);
		}
		else if (command == "print")
		{
			inOrder(root);
			cout << endl;
			preOrder(root);
			cout << endl;
		}
	}
}

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

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

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			int a = Integer.parseInt(chr[0]);
			int b = Integer.parseInt(chr[1]);
			int c = Integer.parseInt(chr[2]);
			 System.out.println(Math.max(a, Math.max(b, c))
					 -Math.min(a, Math.min(b, c)));
		}
	}
}

Measured memory_bytes: 25308
#!/usr/bin/env python3

def main():
    *X, = map(int, open(0).read().split())
    # 500円硬貨の数a
    a = X[0] // 500
    # 5円硬貨の数b
    b = (X[0] % 500) // 5
    # 嬉しさH
    H = a * 1000 + b *5
    print(H)



main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O3")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 

template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m=mod){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;  
    }
    if(res<0)
       res+=mod; 
    return res; 
}
// lli fact[2000009];
// lli ncr(lli n,lli r){
//     lli ans=fact[n];
//     if(r>n)return 0;
//     ans=(ans*power(fact[n-r],mod-2))%mod;
//     ans=(ans*power(fact[r],mod-2))%mod;
//     return ans;
// }

int main() 
{ 
    // fact[0]=1;
    // f(i,1,2000001)fact[i]=(i*fact[i-1])%mod;
    fastio;
    int t;
    // cin>>t;	
    t=1;
	while(t--){
        int n;
        cin>>n;
        cout<<(n-1)/2+1<<"\n";
	}

    return 0; 	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n,x;
    cin >> n >> x;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    int d = 0;
    int ans = 0;
    rep(i,n){
        d = d + l[i];
        if(d <= x) ans++;
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int n,x,mxv;
	ll ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		mxv=max(mxv,x);
		ans+=mxv-x;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 3796
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////
class BITree {//1-index
	int N;
	vector<LL> bit;
public:
	BITree(int n) {
		N = n;
		bit = vector<LL>(N + 1, 0);//1-index
	}
	void add(int a, LL w) {//aにwを足す
		if (a <= 0 || N < a) return;//a:[1,N]
		for (int i = a; i <= N; i += i & -i) {
			bit[i] += w;
		}
	}
	LL sum(int a) {//[1,a]の和,a:[1,N]
		/*
		1番目からa番目までの和、1-index
		*/
		LL ret = 0;
		if (a > N) a = N;
		for (int i = a; i > 0; i -= i & -i) {
			ret += bit[i];
		}
		return ret;
	}
};
LL N;
vector<int>C;
bool test(LL K) {
	for (int i = 0; i < N; ++i) {
		if (C[i] >= K) {
			C[i] = 1;
		}
		else {
			C[i] = -1;
		}
		if (i) {
			C[i] += C[i - 1];
		}
	}
	int base = N;

	BITree bit(4 * base + 20);
	LL res = 0;
	bit.add(base, 1);//0点を入れる。
	for (int i = 0; i < N; ++i) {
		LL temp = bit.sum(C[i] + base);
		bit.add(C[i] + base, 1);
		res += temp;
	}

	if (res >= ( N * (N + 1) / 4 ) ) {
		return true;
	}
	else {
		return false;
	}
}
void solve() {
	
	cin >> N;
	vector<int>A(N), B;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	B = A;
	sort(B.begin(), B.end());
	int L = 0;
	int R = N - 1;
	C = A;
	if (test(B[N-1])) {
		cout << B[N - 1] << endl;
		return;
	}

	while (L + 1 < R) {
		int mid = (L + R) / 2;
		C = A;
		
		if( test(B[mid]) ){
			L = mid;
		}
		else {
			R = mid;
		}
	}
	cout << B[L] << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 4608
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    rep(i, 0, n + 1) {
        string s = to_string(i);
        int tmp = 0;
        rep(j, 0, s.size()) {
            tmp += (s[j] - '0');

        }
        if (tmp >= a && tmp <= b) {
            ans += i;
        }

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


Measured memory_bytes: 256
from collections import deque

n,m = list(map(int,input().split()))
e = [[] for _ in range(n+1)]

for i in range(m):
    a,b = list(map(int,input().split()))
    e[a].append(b)
    e[b].append(a)
q = deque()
q.append(1)
t = [-1 for _ in range(n+1)]

while len(q):
    node = q.popleft()

    for i in range(len(e[node])):
        nex = e[node][i]
        if t[nex] == -1:
            q.append(nex)
            t[nex] = node
print("Yes")
for i in range(2,n+1):
    print(t[i])

Measured memory_bytes: 34156
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

const int MAX_V = 1<<20;

struct node{
  int first;// [0],1,2,3
  int mid;  // 0,1,[2],3
  int last; // 0,1,2,[3]
  int sum;
};

node nodes[MAX_V*2];
int offset;

void add(int i, int x){
  nodes[offset+i].sum+=x;
  if(offset+i==0) return;
  int p=(offset+i-1)/2;
  while(true){
    nodes[p].sum = nodes[p*2+1].sum + nodes[p*2+2].sum;
    if(p==0)break;
    p=(p-1)/2;
  }
}
int getSum(int s, int t, int i){
  if(nodes[i].first==s&&nodes[i].last==t)
    return nodes[i].sum;
  if(t<nodes[i].mid)
    return getSum(s,t,i*2+1);
  if(s>=nodes[i].mid)
    return getSum(s,t,i*2+2);
  return getSum(s,nodes[i].mid-1,i*2+1) + getSum(nodes[i].mid,t,i*2+2);
}

int main(){ _;
  int n,q; cin>>n>>q;
  int a=1;
  if(n>1)
    for(;a<n;a*=2){}
  offset=a-1;
  for(int i=0;i<a;i++){
    nodes[offset+i].first=nodes[offset+i].mid=nodes[offset+i].last=i;
    nodes[offset+i].sum=0;
  }
  for(int i=offset-1;i>=0;i--){
    nodes[i].first=nodes[2*i+1].first;
    nodes[i].mid=nodes[2*i+2].first;
    nodes[i].last=nodes[2*i+2].last;
    nodes[i].sum=0;
  }
  REP(i,q){
    int com,x,y;
    cin>>com>>x>>y;
    if(com==0){
      add(x-1,y);
    }else{
      cout<<getSum(x-1,y-1,0)<<endl;
    }
  }
}

Measured memory_bytes: 7332
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;
#define N 100000

int main(void){
    int n;
    cin>>n;
    int a[N+1];
    fill(a,a+N,0);
    ll ans=0;
    for(int i=0;i<n;i++){
        int l,r;
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
    
    return 0;
}


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

ll X, Y;

int main() {
    cin >> X >> Y;
    ll count = 0;
    ll prod = Y/X;
    while(prod) {
        prod /= 2;
        count++;
    }
    cout << count << endl;
    return 0;
}

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

int N,inf = 1e9;
int dp[1000010] = {},dp_odd[1000010] = {};

int main(){
	while(cin >> N && N>0){
		for(int i=1;i<=N;i++){
			dp[i] = inf;
			dp_odd[i] = inf;
		}
		dp[0] = 0;
		for(int i=1;i*(i+1)*(i+2)<=6*N;i++){
			int n = i*(i+1)*(i+2)/6;
			for(int j=n;j<=N;j++){
				dp[j] = min(dp[j],dp[j-n]+1);
			}
		}
		cout << dp[N] << " ";
		dp_odd[0] = 0;
		for(int i=1;i*(i+1)*(i+2)<=6*N;i++){
			int n = i*(i+1)*(i+2)/6;
			if(n%2==0) continue;
			for(int j=n;j<=N;j++){
				dp_odd[j] = min(dp_odd[j],dp_odd[j-n]+1);
			}
		}
		cout << dp_odd[N] << endl;
	}
}


Measured memory_bytes: 10668
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



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

    int a,b;
    cin>>a>>b;
    int ans=0;
    int tap=0;
    if(b==1){
        fin(0);
        return 0;
    }
    for(int i=1;i<10000;i++){
        tap=max(tap-1,0);
        tap+=a;
        
        if(tap>=b){
            fin(i);
            return 0;
        }
    }

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	}
	
	static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	}
	static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	}
}

Measured memory_bytes: 21844
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 
N,M,Q=MI()
a=LLI(Q)
x=[0]*M
for i in range(1,M+1):
    x[i-1]=i
A=itertools.combinations_with_replacement(x,N)

ma=0
for z in A:
    su = 0
    for c in a:
        if z[c[1]-1] - z[c[0]-1] == c[2]:
            su += c[3]
    ma=max(ma,su)
print(ma)



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

typedef long long ll;

int main() {
    ll N, M;
    cin >> N >> M;
    if (N == 1 && M == 1) {
        cout << "1\n";
    } else if (N == 1) {
        cout << M - 2 << "\n";
    } else if (M == 1) {
        cout << N - 2 <<  "\n";
    } else {
        cout << (N - 2) * (M - 2) << "\n";
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    char a,b,c,d;
    cin >> a >> b >> c >> d;
    if(b != c)
    {
        cout << "No\n";
        return 0;
    }
    if(a == b || b == d)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int N,D,S;
  scanf("%d %d",&N,&D);
  if(N%(2*D+1)==0){
    S=N/(2*D+1);
    printf("%d",S);
  }else{
    S=N/(2*D+1)+1;
    printf("%d",S);
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define mem(a, v) memset(a, v, sizeof(a))
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> matrix;
const ll MOD = 1000000007LL;

int arr[20020], A[20020], B[20020];

int main()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>arr[i];
    }
    int cur = 5 * 100000000;
    for(int i=0; i<n; i++) {
        A[i] = cur;
        cur += 20001;
    }
    cur = 5 * 100000000;
    for(int i=0; i<n; i++) {
        B[i] = cur;
        cur -= 20001;
    }
    for(int i=0; i<n; i++) {
        B[arr[i]-1] += i;
    }
    for(int i=0; i<n; i++) {
        cout<<A[i]<<" ";
    }
    cout<<"\n";
    for(int i=0; i<n; i++) {
        cout<<B[i]<<" ";
    }
    cout<<"\n";
    // cur = 0;
    // for(int i=0; i<n; i++) {
    //     int tmp = A[arr[i]-1] + B[arr[i]-1];
    //     assert(tmp > cur);
    //     cur = tmp;
    // }
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))




int main(){
	ll N,K,Q;
	cin >> N >> K >> Q;
	ll A[N+1];
	FOR(i,0,N+1)A[i]=-Q+K;
	FOR(i,0,Q){
		ll a;
		cin >> a;
		A[a]++;
	}
	FOR(i,1,N+1){
		if(A[i]>0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 1408
//	-*- mode: C++ -*-
// The Number of Inversions
//
//	For a given sequence A={a0,a1,...an−1}, the number of pairs (i,j) where ai>aj and i<j, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubble Sort defined in the following program:
//
//	bubbleSort(A)
//	  cnt = 0 // the number of inversions
//	  for i = 0 to A.length-1
//	    for j = A.length-1 downto i+1
//	      if A[j] < A[j-1]
//		swap(A[j], A[j-1])
//		cnt++
//
//	  return cnt
//	For the given sequence A, print the number of inversions of A. Note that you should not use the above program, which brings Time Limit Exceeded.
//
// Input
//	In the first line, an integer n, the number of elements in A, is given. In the second line, the elements ai (i=0,1,..n−1) are given separated by space characters.
//
// output
//	Print the number of inversions in a line.
//
// Constraints
//	1≤n≤200,000
//	0≤ai≤10^9
//	ai are all different
// Sample Input 1
//	5
//	3 5 2 1 4
// Sample Output 1
//	6
// Sample Input 2
//	3
//	3 1 2
// Sample Output 2
//	2

#include <iostream>
#include <vector>
#include <climits>

class CB
{
public:
	CB(){}
	~CB(){}
	void	Sort();

private:
	unsigned long long				n		{0};
	unsigned long long				count	{0};
	std::vector<unsigned long long>	S		{};

	void	Merge(unsigned long long	left,
				  unsigned long long	mid,
				  unsigned long long	right);

	void	MergeSort(unsigned long long	left,
					  unsigned long long	right);
};

void	CB::Sort()
{
	std::cin >> n;

	for(unsigned long long i = 0; i < n; i++){
		unsigned long long	Si;
		std::cin >> Si;
		S.push_back(Si);
	}

	MergeSort(0, n);

	std::cout << count << std::endl;
}

void	CB::Merge(unsigned long long	left,
				  unsigned long long	mid,
				  unsigned long long	right)
{
	unsigned long long	n1	= mid - left;
	unsigned long long	n2	= right - mid;

	std::vector<unsigned long long>	L	{};
	std::vector<unsigned long long>	R	{};

	for(unsigned long long i = 0; i < n1 ; i++){
		L.push_back(S[left + i]);
	}
	L.push_back(ULLONG_MAX);

	for(unsigned long long i = 0; i < n2; i++){
		R.push_back(S[mid + i]);
	}
	R.push_back(ULLONG_MAX);

	unsigned	long long	i	{0};
	unsigned	long long	j	{0};

	for(unsigned long long k = left; k < right ; k++){
		if(L[i] <= R[j]){
			S[k]	= L[i];
			i++;
		}
		else{
			S[k]	= R[j];
			j++;
			count += n1 - i;
		}
	}
}

void	CB::MergeSort(unsigned long long	left,
					  unsigned long long	right)
{
	if(left + 1 < right){
		unsigned long long	mid	= (left + right) / 2;
		MergeSort(left, mid);
		MergeSort(mid, right);
		Merge(left, mid, right);
	}
}

int	main(int	argc,
		 char*	argv[])
{
	CB	cb;

	cb.Sort();

	return 0;
}



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

constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

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

    int a,b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << endl;
}

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

    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }

    /* AOJ */
    solve();
    return 0;
}

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

int main(void)
{
    string x;
    cin>>x;
    string y;
    for(int i=0;i<x.length();i++)
    {
        if(i%2==0)
        {
            y+=x[i];
        }
    }
    cout << y<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  vector<int> a;
  cin >> n >> m;
  for(int i=1;i*i<=m;i++){
      if(m%i==0){
          a.push_back(i);
          a.push_back(m/i);
      }
  }
  sort(a.begin(),a.end());
  for(auto i:a){
      if(n<=i){
          cout << m/i << endl;
          break;
      }
  }
}

Measured memory_bytes: 256
# input here
_INPUT = """\
RSR
"""

def main():
    a = input()
    tenki = [b for b in a]

    if "R" not in tenki:
        print(0)
    elif tenki.count("R") == 1 :
        print(1)
    elif tenki.count("R") == 2:
        if tenki[1] == "S":
            print(1)
        else :
            print(2)
    else:
        print(3)


if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools

    # sys.stdin = io.StringIO(_INPUT)
    main()

Measured memory_bytes: 62628
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(){
  string o,e;
  cin >> o >> e;
  REP(i,e.length()){
    cout << o[i] << e[i];
  }
  if(o.length()!=e.length())cout<<o.back();
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
vi gc(int n) {
	vi res;
	n = (1<<n);
	for(int i=0;i<n;i++) {
		res.push_back(i^(i/2));
	}
	return res;
}
vi mg(int n) {
	vi cnt = gc(n);
	if(n == 1) return cnt;
	int sw = (1<<(n-2));
	int sz = cnt.size();
	while(sw) {
		int ch = sw|(sw/2);
		int mp = 0;
		int fr = sz-2*sw+1;
		for(int i=fr;i<sz;i++) {
			cnt[i] ^= mp;
			int ko = cnt[i]^cnt[i-1];
			if(ko&ch) {
				cnt[i] ^= ch;
				mp ^= ch;
			}
		}
		sw >>= 2;
	}
	return cnt;
}
int hw(int n) {
	if(n == 0) return 0;
	return n%2+hw(n/2);
}
int main() {
	int n;
	int a,b;
	int x,y;
	scanf("%d %d %d",&n,&a,&b);
	x=0;y=a^b;
	int k = hw(y),st=n-k;
	if(!(k&1)) {printf("NO\n");return 0;}
	printf("YES\n");
	vi v=mg(k);
	vi w[2] = {gc(n-k),vi()};
	for(int i=0;i<w[0].size();i++) {w[1].push_back(w[0][w[0].size()-1-i]);}
	vi dg[2];
	for(int i=0;i<n;i++) {
		if(y&(1<<i)) {
			dg[0].push_back(i);
		} else {dg[1].push_back(i);}
	}
	vi res;
	int rev = 0;
	for(int i=0;i<v.size();i++) {
		int p = 0;
		for(int j=0;j<dg[0].size();j++) {
			if(v[i]&(1<<j)) {
				p |= 1<<dg[0][j];
			}
		}
		for(int j=0;j<w[0].size();j++) {
			int pu = p;
			for(int c=0;c<dg[1].size();c++) {
				if(w[rev][j]&(1<<c)) {
					pu |= 1<<dg[1][c];
				}
			}
			res.push_back(pu^a);
		}
		rev = 1-rev;
	}
	for(int i=0;i<res.size();i++) {
		if(i > 0) printf(" ");
		printf("%d",res[i]);
	}
	printf("\n");
}


Measured memory_bytes: 1676