akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ac=0,tle=0,wa=0,re=0;
    string s;
    cin>>n;
    while(n--)
    {
        cin>>s;
        if(s=="AC")
        {
            ac++;

        }
        else if(s=="TLE")
        {
            tle++;
        }
        else if(s=="WA")
        {
            wa++;
        }
        else if(s=="RE")
        {
            re++;
        }
    }
    cout<<"AC x "<<ac<<'\n';
     cout<<"WA x "<<wa<<'\n';
      cout<<"TLE x "<<tle<<'\n';
       cout<<"RE x "<<re<<'\n';




    return 0;
}


Measured memory_bytes: 3624
def D_abs(N, Z, W, A):
    if N == 1:
        # Xは山札のたった1枚を引かねばならず、Yは山札から1枚も引けないから
        return abs(A[0] - W)
    else:
        # 山札は一番上しか見れないので、
        # Xがa_{N-1}を持ち、Yがa_{N}を持つか、
        # Xがa_{N}を持ち、YがWまたはa_{N-1}を持つかの
        # どちらかで終了する。
        return max(abs(A[N - 1] - W), abs(A[N - 1] - A[N - 2]))

N,Z,W = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(D_abs(N, Z, W, A))

Measured memory_bytes: 3188
package main

import "fmt"

func main() {
	var sx, sy, tx, ty int
	fmt.Scan(&sx, &sy, &tx, &ty)
	U_number := ty - sy
	D_number := ty - sy
	L_number := tx - sx
	R_number := tx - sx
	ans := ""
	for i := 0; i < U_number; i++ {
		ans = ans + "U"
	}
	for i := 0; i < R_number; i++ {
		ans = ans + "R"
	}
	for i := 0; i < D_number; i++ {
		ans = ans + "D"
	}
	for i := 0; i < L_number; i++ {
		ans = ans + "L"
	}
	ans = ans + "L"
	for i := 0; i < U_number + 1; i++ {
		ans = ans + "U"
	}
	for i := 0; i < R_number + 1; i++ {
		ans = ans + "R"
	}
	ans = ans + "D"
	ans = ans + "R"
	for i := 0; i < D_number + 1; i++ {
		ans = ans + "D"
	}
	for i := 0; i < L_number + 1; i++ {
		ans = ans + "L"
	}
	ans = ans + "U"
	fmt.Println(ans)
}

Measured memory_bytes: 6528
#include <iostream>

using namespace std;

int main() {
  long long a, b, c;
  cin >> a >> b >> c;
  // a + b + 2sqrt(ab) < c
  // 2sqrt(ab) < c - a - b
  // 4ab < (c - a - b)^2 && c - a - b >= 0
  
  if (4 * a * b < (c - a - b) * (c - a - b) && c - a - b >= 0) {
  	cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define maxn 100000
using namespace std;
typedef long long LL;
int fa[maxn], off[maxn];
int find(int x) {
    if (fa[x] == x) return x;
    int temp = fa[x];
    fa[x] = find(fa[x]);
    off[x] += off[temp];
    return fa[x];
}
int main() {
//    freopen("in.txt", "r", stdin);
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) fa[i] = i;
    for (int i = 0; i < m; ++i) {
        int l, r, d;
        scanf("%d%d%d", &l, &r, &d);
        int fl = find(l), fr = find(r);
        if (fl == fr) {
            if (off[r] - off[l] == d) continue;
            else { puts("No"); return 0; }
        }
        else {
            fa[fr] = fl;
            off[fr] = d - off[r] + off[l];
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
    int a;
    int b;
    scanf("%d %d", &a, &b);
    if (a < b) {
        printf("a < b\n");
    }
    else if (a > b) {
        printf("a > b\n");
    }
    else {
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;



int main() {
  string S; cin >>S;
  ll ans = INF;
  rep(i,S.size()-2){
    ll ints = stoi(S.substr(i,3)); 
    ans = min(ans,abs(753 - ints));
  }

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



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

template<class T = long long, class U = T>
struct Node {
	T val;
	explicit Node(T v) : val(v) {}
	explicit Node() : val() {}
	inline Node operator+(const Node& rhs) const {
		return Node(__gcd(val, rhs.val));
	}
	inline void assign(const U v) {
		val = v;
	}
	using NODE_T = T; using ASSIGN_T = U;
};

template<class NODE>
struct SegmentTree_slow {
	using NODE_T = typename NODE::NODE_T;
	using ASSIGN_T = typename NODE::ASSIGN_T;
	struct NODE_BOOL {
		bool unity = true;
		NODE node;
		explicit NODE_BOOL(const NODE& x) : unity(false), node(x) {}
		explicit NODE_BOOL() : unity(true), node() {}
		inline NODE_BOOL& operator=(const NODE_T& x) {
			unity = false;
			node.val = x;
		}
		inline void assign(ASSIGN_T x) {
			unity = false;
			node.assign(x);
		}
		inline NODE_BOOL operator+(const NODE_BOOL& rhs) const {
			if (unity) return NODE_BOOL(rhs);
			if (rhs.unity) return NODE_BOOL(*this);
			return NODE_BOOL(node + rhs.node);
		}
	};
	int n;
	vector<NODE_BOOL> node_bool;
	SegmentTree_slow (int n_) : n(calc_n(n_)), node_bool(2*n-1) {}
	SegmentTree_slow (const vector<NODE_T>& v) : SegmentTree_slow(v.size()) {
		for (size_t i = 0; i < v.size(); i++) {
			node_bool[i+n-1] = v[i];
		}
		for (int i = n - 2; i >= 0; i--){
			node_bool[i] = node_bool[i*2+1] + node_bool[i*2+2];
		}
	}
	void set(int p, ASSIGN_T v) {
		p += n - 1;
		node_bool[p].assign(v);
		while (p) {
			p = (p-1) / 2;
			node_bool[p] = node_bool[p*2+1] + node_bool[p*2+2];
		}
	}
	NODE_BOOL get(int a, int b, int k, int l, int r) {
		if (a <= l && r <= b) {
			return node_bool[k];
		} else if (b <= l || r <= a) {
			return NODE_BOOL();
		}
		return get(a, b, k * 2 + 1, l, (l+r) / 2) + get(a, b, k * 2 + 2, (l+r) / 2, r);
	}
	NODE_T get(int a, int b) {return get(a, b, 0, 0, n).node.val;}
	const NODE_T& operator[](int i) {
		return node_bool[i+n-1].node.val;
	}
	int calc_n(int n_, int t = 1) {return n_ > t ? calc_n(n_, t << 1) : t;}
};


int main() {
	int N;
	cin >> N;
	vector<long long> v(N);
	for (int i = 0; i < N; i++) cin >> v[i];
	SegmentTree_slow<Node<>> S(v);
	long long res = max(S.get(1, N), S.get(0, N-1));
	for (int i = 1; i < N-1; i++) {
		res = max(res, __gcd(S.get(0, i), S.get(i+1, N)));
	}
	cout << res << endl;
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>

using namespace std;
static const int MAX = 100;
static int changeCt = 0;
void BubbleSort(int T[], int n) {
	bool flag = true;
	while(flag) {
		flag = false;
		for(int j = n-1; j >= 1; j--) {
			if(T[j] < T[j-1]) {
				swap(T[j], T[j-1]);
				flag = true;
				changeCt++;
			}
		}
	}
}

int main()
{
	int n;
	cin >> n;
	int A[MAX];
	std::string readbuff;
	cin.get();
	getline(cin, readbuff);
	stringstream ss(readbuff);
	string str;
	for (int i = 0; i < n; i++) {
		getline(ss, str, ' ');
		A[i] = stoi(str);
	}
	BubbleSort(A, n);
	for (int ct = 0; ct < n - 1; ct++) cout << A[ct] << ' ';
	cout << A[n - 1] << endl;
	cout << changeCt << endl;
	
	return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


string s;
int main(){
    cin >> s;
    int ct = 0;
    rep(i,sz(s)){
        if(s[i] == 'o') ct++;
    }
    if(ct + 15 - sz(s) >= 8) pr("YES");
    else pr("NO");
}

Measured memory_bytes: 256
from itertools import combinations
import copy

def add_combo(c, len_S, len_combo, S):
    S_copy = copy.deepcopy(S)
    total_len = len_S + len_combo
    combo_total = 0
    cnt = 1
    for i in c:
        S_copy.insert(i+cnt, '+')
        cnt += 1
    last = 0
    nums = []
    plus_count = 0
    for j in range(0, total_len):
        if S_copy[j] == '+':
            nums.append(S_copy[last:j])
            plus_count += 1
            if plus_count == len_combo:
                nums.append(S_copy[j+1:])
            last = j+1
    for n in nums:
        combo_total += int("".join(n))
    return combo_total


if __name__ == '__main__':
    S = list(input())
    no_plus = int("".join(S))
    len = len(S)
    all_plus = 0
    total = 0
    for x in S:
        all_plus += int(x)
    for i in range(1, len):
        combo = combinations(range(0, len-1), i)
        for c in combo:
            total += add_combo(c, len, i, S)
            # print(c)
    total += no_plus
    # total += all_plus
    print(total)


Measured memory_bytes: 3820
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
H = LIST()

for i in range(N - 1):
	if H[i] + 1 <= H[i + 1]:
		H[i + 1] -= 1
		continue

	if H[i] + 1 == H[i + 1]:
		continue
	if H[i] > H[i + 1]:
		print("No")
		exit()
	
print("Yes")

Measured memory_bytes: 85100
#import<bits/stdc++.h>
using namespace std;
long long h,i,j,k,m,n,s,w[200005];
main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	for(;i<n;i++)
	{
		cin>>w[i];
	}
	sort(w,w+n);
	for(i=0;i<n-k;i++)s+=w[i];
	cout<<s;
}

Measured memory_bytes: 1792
def main():
    R, G, B, N = (int(i) for i in input().split())
    ans = 0
    for r in range(0, N+1):
        for g in range(0, N+1):
            b = (N - r*R - g*G)//B
            if b >= 0 and r*R + g*G + b*B == N:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40684
#include <bits/stdc++.h>
#define int long long
#define D long double
using namespace std;
struct Vertex{int a; int b;};
vector<Vertex> bor;
Vertex create(){
    Vertex v = {-1, -1};
    return v;
}
int n, l, grundy;
int add(int v, char num){
    if (num == '0'){
        if (bor[v].a != -1){
            return bor[v].a;
        }
        else{
            bor.push_back(create());
            bor[v].a = bor.size() - 1;
            return bor[v].a;
        }
    }
    else{
        if (bor[v].b != -1){
            return bor[v].b;
        }
        else{
            bor.push_back(create());
            bor[v].b = bor.size() - 1;
            return bor[v].b;
        }
    }
}
void change(int number){
    for (int i=0; i < 61; i++){
        int ba = (1LL << i) & number;
        if (ba != 0){
            grundy ^= (i+1);
            return;
        }
    }
}
void dfs(int vertex, int g){
    if (bor[vertex].a == -1 && bor[vertex].b == -1) return;
    if (bor[vertex].a != -1 && bor[vertex].b != -1){
        dfs(bor[vertex].a, g+1);
        dfs(bor[vertex].b, g+1);
        return;
    }
    change(l - g);
    if (bor[vertex].a != -1){
        dfs(bor[vertex].a, g+1);
    }
    else dfs(bor[vertex].b, g+1);
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> l;
    grundy = 0;
    bor.push_back(create());
    for (int i=0; i < n; i++){
        string s;
        cin >> s;
        int now = 0;
        for (int j=0; j < s.size(); j++){
            now = add(now, s[j]);
        }
    }
    dfs(0, 0);
    if (grundy == 0) cout << "Bob" << endl;
    else cout << "Alice" << endl;
    return 0;
}


Measured memory_bytes: 2548
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
#ifdef ONLINE_JUDGE
#define D(...)
#else
#define D(...)cerr<<__LINE__<<":"<<"["<<#__VA_ARGS__<<"]->",P(__VA_ARGS__)
#endif
void P(){cerr<<endl;} 
template<typename H,typename...T>void P(H h,T...t){cerr<<h<<" ";P(t...);}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    double T,A;cin>>T>>A;
    int index=0;
    double ans=1e6;
    for(int i=0;i<n;++i){
        double h;cin>>h;
        double val=T-(.006*h);
        if(fabs(A-val)<ans){
            index=i+1;
            ans=fabs(A-val);
        }
    }
    cout<<index;

}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

#define int long long

signed main()
{
    int n;
    int M = 300005;
    while(cin>>n, n!=1) {
        cout << n << ":";
        bool is_primes[M];
        fill(is_primes, is_primes+M, true);
        for(int i=2; i<=n; ++i) {
            if(i%7!=1&&i%7!=6) continue;
            if(is_primes[i]) {
                if(n%i==0) cout << " " << i;
                for(int j=i; j<=n; j+=i) is_primes[j] = false;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3380
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2e9;
const ll large_P = 1e9 + 7;



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



ll my_gcd(ll& a, ll& b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}



// long long型 n を、base 進法での、i 桁目の数が入った vector にする。
void ll_to_vector(ll base, ll n, vector<ll>& v) {
	ll tempo = n;

	ll n_digit = floor(log10(n) / log10(base)) + 1;
	v.assign(n_digit, 0);

	//ll n_digit = v.size();

	for (ll i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}



int char_to_int(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4;
	case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9;
	default: return 0;
	}
}


//エラトステネスの篩で、prime で ないところに false を入れる。
//true で初期化された vector を代入する必要がある。
void prime_judge(vector<bool>& prime_or_not) {

	prime_or_not.at(0) = false;
	prime_or_not.at(1) = false;

	ll n = prime_or_not.size() - 1;
	ll region = sqrt(n) + 1;

	for (ll i = 2; i <= n / 2; i++) {
		prime_or_not.at(2 * i) = false;
	}


	for (ll i2 = 1; i2 < n / 2; i2++) {
		ll i = 2 * i2 + 1;  //ここからは奇数のみ探索
		if (i < region && prime_or_not.at(i)) {
			ll j = i * i;
			while (j < n + 1) {
				prime_or_not.at(j) = false;
				j += 2 * i;
			}
		}
	}
};



map<int, int> divide_to_prime(int target) {
	map<int, int> res;

	//sqrt(target) まで調べる。
	int upper_lim = ceil(sqrt(target));
	vector<bool> prime_or_not(upper_lim + 1, true);

	if (upper_lim < 20) prime_or_not.assign(25, true);
	prime_judge(prime_or_not);

	int tempo = target;
	rep(i, upper_lim + 1) {
		if (prime_or_not.at(i)) {
			while (tempo % i == 0) {
				tempo /= i;
				res[i]++;
			}
		}
	}

	if (tempo != 1) res[tempo]++; //sqrt(target) より大きな素因数は高々1つしかない。



	return res;
}





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

	bool res = false;
	
	for (int i = A; i <= B; i++) {
		if (i % K == 0) {
			res = true;
			break;
		}
	}

	if (res) cout << "OK" << endl;
	else cout << "NG" << endl;
}

Measured memory_bytes: 3732
import sys
from operator import itemgetter


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n, m = _ia()
    edge = [[] for _ in range(n)]
    for _ in range(m):
        ai, bi = map(lambda x: x-1, _ia())
        edge[ai].append(bi)
        edge[bi].append(ai)

    now = []
    nxt = [0]
    idx = {0: 0}
    while len(idx) < n:
        now = nxt
        nxt = []
        for ai in now:
            for bi in edge[ai]:
                if idx.get(bi, -1) >= 0:
                    continue
                idx[bi] = ai
                nxt.append(bi)

    print("Yes")
    return "\n".join(map(str, [v+1 for k, v in sorted(idx.items(), key=itemgetter(0)) if k > 0]))


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 112292
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1};
vl dy={1,-1,0,0};

//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}

const ll MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
//finvが階乗の逆元

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}



int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll n;cin>>n;ll k;cin>>k;
  vector<P>vec(n);
  rep(i,n)cin>>vec[i].first>>vec[i].second;
  //sort(all(vec));
  vl a(n),b(n);
  rep(i,n){
    a[i]=vec[i].first;
    b[i]=vec[i].second;
  }
  ll i=0;
  ll cnt=0;
  ll ans=0;
  map<ll,ll>M;
  rep(i,n){
    //cnt+=b[i];
  
    M[a[i]]+=b[i];
    
  }
  ll cnt2=0;
  for(auto p:M){
    //cout<<p.first<<" "<<p.second<<endl;
    cnt2+=p.second;
    if(cnt2>=k){
      cout<<p.first<<endl;
      return 0;
    }
    
  }
}

    


Measured memory_bytes: 10284
#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<int,int>;

int main(){
	int n,y;
	cin >> n >> y;
	rep(i,n+1)rep(j,n+1-i)rep(k,n+1-i){
		int sum = 0;
		sum = k*10000 + j*5000 + i*1000;
		if(sum == y && i+j+k == n){
			cout << k << " " << j << " " << i << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 3636
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    m = A[0]
    ans = 0
    for i in range(N):
        if m > A[i]:
            ans += m - A[i]
        else:
            m = A[i]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 31408
#include <bits/stdc++.h>
using namespace std;
template<typename T> void amax(T &a, T b){ a = max(a, b); }
const int maxn = 101;
short dp[maxn][maxn][maxn][maxn];
int acum[maxn][maxn];
char g[maxn][maxn];
int main(){
	int n, m; cin >> n >> m;
	int xe = -1, ye = -1;
	for(int i = 0; i < n; i++) 
		for(int j = 0; j < m; j++){
			cin >> g[i][j];
			if(g[i][j] == 'E'){
				xe = i;
				ye = j;
			}
		}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			acum[i + 1][j + 1] = (g[i][j] == 'o') + acum[i + 1][j] + acum[i][j + 1] - acum[i][j];
		}
	}
	function<int (int,int,int,int)> get = [&](int a, int b, int c, int d){
		a++; b++; c++; d++;
		return acum[c][d] - acum[a - 1][d] - acum[c][b - 1] + acum[a - 1][b - 1];
	};
	for(int l = xe; l >= 0; l--){
		for(int d = ye; d >= 0; d--){
			for(int r = xe; r < n; r++){
				for(int u = ye; u < m; u++){
					short now = dp[l][d][r][u];
					int in_u = (u - ye);
					int to_d = (m - (ye - d) - 1);
					int in_r = (r - xe);
					int to_l = (n - (xe - l) - 1);
					if(l > 0){
						short inc = 0;
						if(l - 1 >= in_r && in_u <= to_d) inc = get(l - 1, max(in_u, d), l - 1, min(to_d, u));
						amax(dp[l - 1][d][r][u], (short)(now + inc));
					}
					if(r + 1 < n){
						short inc = 0;
						if(r + 1 <= to_l && in_u <= to_d) inc = get(r + 1, max(in_u, d), r + 1, min(to_d, u));
						amax(dp[l][d][r + 1][u], (short)(now + inc));
					}
					if(d > 0){
						short inc = 0;
						if(d - 1 >= in_u && in_r <= to_l) inc = get(max(in_r, l), d - 1, min(to_l, r), d - 1);
						amax(dp[l][d - 1][r][u], (short)(now + inc));
					}
					if(u + 1 < m){
						short inc = 0;
						if(u + 1 <= to_d && in_r <= to_l) inc = get(max(in_r, l), u + 1, min(to_l, r), u + 1);
						amax(dp[l][d][r][u + 1], (short)(now + inc));
					}
				}
			}
		}
	}
	cout << dp[0][0][n - 1][m - 1] << endl;
	return 0;
}


Measured memory_bytes: 201344
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<int,int> P;
vector<P> sc;

int main(void){
	while(1){
		sc.clear();
		int n;
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			int res=0;
			int t=0;
			scanf("%d",&t);
			for(int j=0;j<4;j++){
				int m,s;
				scanf("%d%d",&m,&s);
				res+=m*60+s;
			}
			sc.push_back(P(res,t));
		}
		sort(sc.begin(),sc.end());
		cout << sc[0].second << endl;
		cout << sc[1].second << endl;
		cout << sc[n-2].second << endl;
	}
    return 0;
}

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

using namespace std;

int main()
{
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	int ans = 2000000000;
	for (int i = 0; i <= max(x, y) * 2; i += 2)
		ans = min(ans, a * max(0, x - i / 2) + b * max(0, y - i / 2) + c * i);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
p=list(map(int,input().split()))
f=[0]*(n+1)
for i in range(n):
    f[p[i]]=i+1
l=[0]+[i for i in range(n+1)]
r=[i+1 for i in range(n+1)]+[n+1]
ans=0
for i in range(1,n+1):
    x=f[i]
    l1,r1=l[x],r[x]
    l2,r2=l[l1],r[r1]
    ans+=i*((l1-l2)*(r1-x)+(x-l1)*(r2-r1))
    l[r1],r[l1]=l1,r1
print(ans)

Measured memory_bytes: 60268
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    int N;
    int  x[8],y[8];
    double rt=1;
    double sum=0.0;
    cin >> N;
    for(int i = 0 ; i < N ; i++){
        cin >> x[i] >> y[i];
    }
    for( int i = 1 ; i <= N ; i++){
        rt *= i;
    }

    vector<int> v(N);
    for(int i = 0 ; i < N ; i++){
        v[i] = i;
    }
    do{
        int i;
        for(i = 0  ; i < N-1  ; i++){
            double dx = x[v[i]] - x[v[i+1]];
            double dy = y[v[i]] - y[v[i+1]];
            sum += pow(dx * dx + dy * dy, 0.5);
        }

    } while(next_permutation(v.begin(), v.end()));
    cout << fixed << setprecision(10) << sum / rt << endl;
    return 0;
    
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
ll mod = 1000000007;

int main(){
  ll n,k; cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<ll> f(n);
  rep(i,n){
    cin >> f[i];
  }
  sort(f.begin(),f.end(),greater<ll>());
  vector<vector<ll>> q;
  ll ub = 0;
  rep(i,n){
    vector<ll> v(3);
    v[0]=a[i]*f[i]; v[1]=a[i]; v[2]=f[i];
    q.push_back(v);
    ub = max(ub,v[0]);
  }
  ll lb = -1;
  while(ub-lb>1){
    ll mid = (ub+lb)/2;
    ll cnt = k;
    for(auto e:q){
      ll dif = e[1]-(mid/e[2]);
      if(dif<=0) continue;
      cnt -= dif;
    }
    if(cnt>=0){
      ub = mid;
    }else{
      lb = mid;
    }
  }
  cout << ub;
  return 0;
}

Measured memory_bytes: 15660
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	
#include<list>

using namespace std;

int main() {
	int N;
	double ans = 0;
	cin >> N;
	vector<double> V;
	for (int i = 0; i < N; ++i) {
		double v;
		cin >> v;
		V.push_back(v);
	}
	sort(V.begin(), V.end());
	ans = V[0];
	for (int i = 1; i < N ; ++i) {
		ans = (ans + V[i]) / 2.0;
	}
	printf("%lf", ans);
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

int curr;
int money;
int maxProfit(vector<int> &prices) {
    int ans = 0;
    int n = prices.size();
    if(n == 0)return 0;
    for(int i = 1; i < n; i++) {
        curr=money/prices[i-1];
        if(prices[i]>prices[i-1]){
            money+=(prices[i]-prices[i-1])*curr;
        }
    }
    return money;

}


int32_t main() {

    fast

    int n;
    cin>>n;

    vector<int>arr(n);

    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    money=1000;
    int curr=1000/arr[0];
    cout<<maxProfit(arr)<<endl;





    return 0;
}



Measured memory_bytes: 3656
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, M;
int A[1 << 18];
bool used[1 << 18];

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		int a; string b; cin >> a >> b;
		if (b == "WA" && used[a] == false) { A[a] += 1; }
		if (b == "AC") { used[a] = true; }
	}

	int v1 = 0, v2 = 0;
	for (int i = 1; i <= N; i++) {
		if (used[i] == false) continue;
		v1 += 1; v2 += A[i];
	}
	cout << v1 << " " << v2 << endl;
	return 0;
}

Measured memory_bytes: 4052
h, w = map(int,input().split())
g = [list(input()) for _ in range(h)]
#print(g)
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
mod = 10**9+7
for i in range(h):
  for j in range(w):
    if i+1<h and g[i+1][j] == '.':
      dp[i+1][j] = (dp[i+1][j] + dp[i][j])%mod
    if j+1<w and g[i][j+1] == '.':
      dp[i][j+1] = (dp[i][j+1] + dp[i][j])%mod
print(dp[-1][-1])

Measured memory_bytes: 51500
S=list(input())

s=0
f=0
g=0
h=0
for i in range(len(S)):
    if S[i]==">":
        g=0
        f+=1
        if h>=f:
            s+=f-1
        else:
            s+=f
        
    else:
        f=0
        g+=1
        s+=g
        h=g

print(s)


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

int main() {
	// your code goes here
	long long n;
	cin >> n;
	cout << (((n)*(n+1)-3*(n/3)*(n/3+1)-5*(n/5)*(n/5+1)+15*(n/15)*(n/15+1))/2) << endl;
	
	
	
	return 0;
}

Measured memory_bytes: 3228
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  a[i]=format(a[i],'022b')
A=[[0 for i in range(22)] for j in range(n+1)]
for i in range(n):
  for j in range(22):
    if a[i][j]=='1':
      A[i+1][j]=A[i][j]+1
    else:
      A[i+1][j]=A[i][j]

ct=0
right=1
for i in range(n):
  flag=0
  if i>right:
    right=i
  for j in range(right,n+1):
    check=0
    for k in range(22):
      if A[j][k]-A[i][k]<=1:
        check+=1
    if check!=22:
      right=j-1
      ct+=right-i
      flag=1
      break
  if flag==0:
    right=j
    ct+=right-i
print(ct)

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

using namespace std;
#define LL long long

const int MAXN = 212345;

LL lcm (LL a, LL b) {
	return (a * b) / __gcd (a, b);
}

int main () {

	ios_base::sync_with_stdio(false); cin.tie(NULL);

	LL a, b, c, d;
	cin >> a >> b >> c >> d;

	LL x = b / c - (a - 1) / c;
	LL y = b / d - (a - 1) / d;

	// cout << "x= " << x << ' ' << "y= " << y << '\n';

	LL k = lcm (c, d);

	LL both = b / k - (a - 1) / k;
	LL used = x + y - both;

	LL inter = b - a + 1;
	LL resp = inter - used;

	cout << resp << '\n';

	/*
	for (int i = a; i <= b; ++i) {
		cout << i;
		if (i % c==0 || i % d==0) cout << "* ";
		cout << ' ';
	}

	cout << endl;
	*/

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define lli long long int
#define pb push_back
#define pob pop_back
#define rep(i,a,b) for(lli i=a;i<b;i++)
#define repv(a,b) for(int i=a;i>=b;i--)
#define itr vector<lli> :: iterator
#define maximum(a,b,c)  max(a,max(b,c))
#define minimum(a,b,c) min(a,min(b,c))
#define tim clock_t

inline void fast()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

int main()
{
	fast();
	lli a,b,c;
	cin>>a>>b>>c;
	lli k=b/a;
	cout<<min(k,c);
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = 0; i < (a); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

template<typename T>
std::vector<T> divisor(T n) {
  std::vector<T> div;
  for(int i = 1; i * i <= n; ++i) {
    if(n % (T)i == 0) {
      div.push_back(i);
      if(i * i != n) div.push_back(n / i);
    }
  }
  sort(begin(div), end(div));
  return div;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  VI fac = divisor<int>(m);
  int ans = 0;
  for(auto x : fac) {
    if(m / x < n) break;
    ans = max(ans, x);
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import           Control.Monad.ST
import           Data.Ord
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

main = do
  a <- readInt
  b <- readInt
  h <- readInt
  print $ ((a + b) * h) `div` 2

Measured memory_bytes: 380
#include<iostream>
using namespace std;
int main(){
  int n,m;
  while(cin>>n>>m){
    if(n==0&&m==0) break;
    int r[n+1];
    for(int i=1;i<=n;i++) r[i] = i+1;
    r[n] = 1;
    int p = n,next,newnext;
    while(1){
      for(int i=1;i<m;i++) p = r[p];
      next = r[p];
      newnext = r[next];
      if(next==newnext){
	cout << next << endl;
	break;
      }
      r[p] = newnext;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();

            boolean poor = false;

            if (A == B && A != C) {
                poor = true;
            }

            if (B == C && B != A) {
                poor = true;
            }

            if (C == A && C != B) {
                poor = true;
            }

            if (poor) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

}


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

#define ll long long
#define f(i, a, b) for(ll i=a;i<b;i++)
#define fi(i, a, b) for(ll i=b-1;i>=a;i--)
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define ml map<ll,ll>
#define pll pair<ll,ll>


int main()
{
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  int t1 = h1*60+m1;
  int t2= h2*60+m2;
  int relax_time = t2-t1;
  int study = relax_time-k;

   if(study<=0){
     cout<<"0";
   }  else
   cout<<study;
}


Measured memory_bytes: 3632
/**
 * 
 */

/**
 * @author Chisom
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main.multiply(9);
	}
	
	public static void multiply(int limit) {
		int limit2 = limit;
		for (int i = 1; i <= limit; i++) {
			for (int j = 1; j <= limit2; j++) {
				System.out.println(String.valueOf(i) + "x" + String.valueOf(j) + "=" + String.valueOf(i*j));
			}
		}
	}
}

Measured memory_bytes: 16860
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main(){
    int N[3];
    cin >> N[0] >> N[1] >> N[2];

    sort(N,N+3);

    string s;
    if(N[0] == 5 && N[1]==5 &&N[2]==7) s = "YES";
    else s = "NO";

    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
/* Coached by rainboy */
#include <stdio.h>
#include <string.h>

#define N 100000
#define MD 1000000007

int main() {
	static char ok[N + 1];
	static int dp[N + 1];
	int n, m, i;

	scanf("%d%d", &n, &m);
	memset(ok, 1, sizeof ok);
	while (m--) {
		int a;

		scanf("%d", &a);
		ok[a] = 0;
	}
	dp[0] = 1;
	for (i = 1; i <= n; i++)
		if (ok[i])
			dp[i] = (dp[i - 1] + (i > 1 ? dp[i - 2] : 0)) % MD;
	printf("%d\n", dp[n]);
	return 0;
}


Measured memory_bytes: 640
package main

import "fmt"

func main() {
	s := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scan(&s[i])
	}
	var five int
	var seven int
	for _, v := range s {
		if v == 5 {
			five++
		} else if v == 7 {
			seven++
		}
	}

	if five == 2 && seven == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

Measured memory_bytes: 512
"use strict";

var main = function main(input) {
  var args = input.split(' ');
  var A = parseInt(args[0], 10);
  var B = parseInt(args[1], 10);
  var C = parseInt(args[2], 10);
  ;
  var start = A % B; // console.log(`start:${start}`);

  var now = A;
  var flag = false;

  do {
    // console.log(`now:${now}`);
    if (now % B == C) {
      flag = true;
    }

    now += A; // console.log(now);
  } while (now % B != start);

  if (flag) {
    console.log("YES");
  } else {
    console.log("NO");
  }
};

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	long X, Y;
	cin >>X >>Y;
	long S=0;
	while (X<=Y) {
		S++;
		X +=X;
	}
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define mod ((ll)1e9+7)
#define inf ((ll)1e18+5)
#define maxx ((ll)2e5+5)
#define pb push_back
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
*/
ll fact[maxx]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<maxx;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncrm(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}

ll inv[maxx];
void inversify( ll m){
  inv[1]=1;
  for(int i=2;i<maxx;i++){
    inv[i]= m- m/i*inv[m%i]%m;
  }
}

ll ncr(ll n,ll r, ll m)
{
  int ans=1;
  for (int i = 0; i < r; i++)
  {
    ans=ans*(n-i)%m*inv[i+1]%m;
  }
  return ans; 

}


signed main(){
  fast;
  //usefile;
  //test
  {
    int n,a,b;
    cin>>n>>a>>b;
    int ans=expm(2,n);
    inversify(mod);
    ans=ans-1+mod-ncr(n,a,mod)+mod-ncr(n,b,mod);
    ans+=mod;
    ans%=mod;
    cout<<ans<<endl;


  }
  //time("");
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <climits>

using namespace std;

int N, M, L, Q;
long long dist[305][305];
int a, b, c;

int main() {

    cin >> N >> M >> L;
    for (int i=0; i<N; i++) {
        for (int j=0; j<N; j++) {
            dist[i][j] = INT_MAX;
        }
    }

    for (int i=0; i<M; i++) {
        cin >> a >> b >> c;
        dist[a-1][b-1] = c;
        dist[b-1][a-1] = c;
    }

    for (int i=0; i<N; i++) {
        for (int j=0; j<N; j++) {
            for (int k=0; k<N; k++) {
                if (dist[j][i]!= INT_MAX && dist[i][k]!= INT_MAX) {
                    dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
                }
            }
        }
    }

    for (int i=0; i<N; i++) {
        for (int j=0; j<N; j++) {
            dist[i][j] = (dist[i][j] <= L) ? 1:INT_MAX;
        }
    }

    for (int i=0; i<N; i++) {
        for (int j=0; j<N; j++) {
            for (int k=0; k<N; k++) {
                if (dist[j][i]!= INT_MAX && dist[i][k]!= INT_MAX) {
                    dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
                }
            }
        }
    }

    cin >> Q;
    for (int i=0; i<Q; i++) {
        cin >> a >> b;
        if (dist[a-1][b-1] == INT_MAX) {
            cout << "-1\n";
        } else {
            cout << dist[a-1][b-1]-1 << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>

int main(void){
	int N;
	int i,j;
	int flag=0;
	
	scanf("%d",&N);
	
	for(i=1;i<10;i++){
		for(j=1;j<10;j++){
			if(i*j==N)flag=1;
		}
	}
	
	if(flag==1)printf("Yes\n");
	else printf("No\n");
}


Measured memory_bytes: 128
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val str = StdIn.readLine()
    val K = StdIn.readInt()
    var counter = K
    val ans = new StringBuilder
    for (c <- str.toCharArray) {
      if (c == 'a')
        ans.append(c)
      else {
        val num = c - 'a'
        val changeNum = 26 - num
        if (counter >= changeNum) {
          counter -= changeNum
          ans.append('a')
        } else {
          ans.append(c)
        }
      }
    }
    val lastChar = ans.charAt(ans.length -1) + counter % 26
    val printChar = if (lastChar > 'z') 'a'.toInt + lastChar - 'z'.toInt else lastChar
    println(ans.substring(0, ans.length - 1) + printChar.toChar)
  }
}


Measured memory_bytes: 26240
#include <time.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
 typedef long long int ll;
int main(int argc, char const *argv[])
{
  string b;
  cin>>b;
  if(b[0]=='A'){
    cout<<'T'<<endl;
  }else if(b[0]=='T'){
    cout<<'A'<<endl;
  }else if(b[0]=='C'){
    cout<<'G'<<endl;
  }else{
    cout<<'C'<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    for (string S;;) {
        cin >> S;
        if (S == "#") { break; }
        const int sz = S.size();
        const int maximum = 1 << sz;
        set<string, greater<string>> f;
        set<string> t;
        int ans = 0;
        for (int i = 0; i < maximum; i++) {
            string s = S;
            for (int j = 0; j < sz; j++) {
                if (i & (1 << j)) { s[j]++; }
            }
            string tmp = s;
            bool used[26]{true};
            bool ok = true;
            for (int j = 0; j < sz; j++) {
                if (not used[tmp[j] - 'a']) { used[tmp[j] - 'a'] = true, tmp[j]--; }
                if (tmp[j] != S[j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                ans++, f.insert(s), t.insert(s);
                if (f.size() > 10) { f.erase(f.begin()), t.erase(t.begin()); }
            }
        }
        cout << ans << endl;
        if (ans <= 10) {
            for (auto it = f.rbegin(); it != f.rend(); it++) { cout << *it << "\n"; }
        } else {
            vector<string> ans;
            auto it = f.rbegin();
            for (int i = 0; i < 5; i++, it++) { ans.push_back(*it); }
            it = t.rbegin();
            for (int i = 0; i < 5; i++, it++) { ans.push_back(*it); }
            sort(ans.begin(), ans.end());
            for (const string& s : ans) { cout << s << "\n"; }
        }
    }
    return 0;
}



Measured memory_bytes: 3252
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector <int> vec(n);
  int sum = 0;
  for(int i = 0; i < n; i++){
      cin >> vec[i];
      for(int j = 0; j < i; j++){
          sum += vec[j]*vec[i];
      }
  }
  cout << sum;
}



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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; read(n);
	vector<ll> v(n);
	rep(i, 0, n) read(v[i]);
	ll rem = 0;
	rep(i, 2, n) rem ^= v[i];
	ll a0 = v[0], a = v[0], b = v[1];
	if ((a ^ b ^ rem) & (1 == 0))
		die(-1);
	for (int i = 0; i < 50; i++) {
		ll sig = 1ll << i;
		if (a > sig / 2 && ((a & sig) ^ (b & sig)) != (rem & sig))
			a -= sig / 2, b += sig / 2;
		for (int j = i - 1; j >= 0; j--) {
			ll sig = 1ll << j;
			if (a + sig < a0 && ((a + sig) ^ (b - sig) ^ rem) == 0)
				a += sig, b -= sig;
		}
	}
	if ((a ^ b ^ rem) == 0)
		write(a0 - a);
	else
		write(-1);
}


Measured memory_bytes: 3656
#define LOCAL_tqk

//C - Traveling Plan
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define el "\n"
#ifdef LOCAL_tqk
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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

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

    char in[4], ans[4]={0};
    rep(i, 3){
        cin>>in;
        ans[i]=in[i];
    }
    cout<<ans<<el;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int N;
	cin>>N;
	int ta[N];
	for(int i=0;i<N;i++)
	    cin>>ta[i];
	int sum=0;
	for(int i=0;i<N-1;i++)
	{
		for(int j=i+1;j<N;j++)
		{
			sum+=ta[i]*ta[j];
		}
	}
	cout<<sum;
	return 0;
	
}

Measured memory_bytes: 256