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

int main(){
    long long N, x; cin >> N >> x;
    vector<int> a(N);
    for (int i=0; i<N; i++){
        cin >> a.at(i);
    }
    long long count=0;
    for (int i=0; i<N-1; i++){
        if(i==0 && a.at(i)>x){
            count+=a.at(i)-x;
            a.at(i)=x;
        } 
        if (a.at(i)+a.at(i+1)>x){
            count+=a.at(i)+a.at(i+1)-x;
            a.at(i+1)-=a.at(i)+a.at(i+1)-x;
        }
        //cout << "count is " << count << endl;
    }
    cout  << count << endl;
    return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	set<int>a;
	for(int i=0;i<n;++i){
		int A; cin>>A;
		if(a.find(A)==a.end())a.insert(A);
		else a.erase(A);
	}
	cout<<a.size()<<"\n"s;
}

Measured memory_bytes: 4992
import java.util.*;
public class Main {
	//定義関数から参照できる変数定義はこの辺
	static int N;
	static String ans = "No";

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		for(int i=0;i<=25;i++){
			for(int j=0;j<=25;j++){
				if (N==(4*i+7*j)) {
					ans="Yes";
				}
			}
		}
		System.out.println(ans);
		//System.out.print(ans);
    }
}

Measured memory_bytes: 35620
#include <iostream>

using namespace std;

int main(){
    int N;
    double AA=0,AAA=0,A[100];
    cin >>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    for(int i=0;i<N;i++){
        AA+=1/A[i];
    }
    AAA=1/AA;
    cout <<AAA;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    string s;
    cin >> s;
    string ans="";
    for(int i=0;i<s.size();i++){
        if(s[i]!='B') ans+=s[i];
        else {
            if(ans.size()) ans.erase(ans.size()-1);
            }
    }
    cout << ans << endl;
}


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

long n, m;
std::vector<long> vec;
long l, r, c;
int main() {
    std::cin >> n >> m;
    vec.assign(n+2, 0);
    for (long i = 0; i < m; i++) {
        std::cin >> l >> r;
        vec[l]++;
        vec[r+1]--;
    }
    for (long i = 2; i <= n; i++) {
        vec[i] += vec[i-1];
    }
    for (long i = 1; i <= n; i++) {
        if (vec[i] == m) {
            c++;
        }
    }
    std::cout << c << std::endl;
}


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

using namespace std;

int main() {
    int N, x;
    cin >> N;
    priority_queue<double, vector<double>, greater<double>> q;
    for (int i = 0; i < N; ++i) {
        cin >> x;
        q.push(double(x));
    }
    while (q.size() > 1) {
        auto a = q.top();
        q.pop();
        auto b = q.top();
        q.pop();
        q.push((a + b) / 2);
    }
    cout << q.top() << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007


int main() {
  string s,t;
  cin >> s >> t;
  sort(all(s));
  sort(all(t), greater<char>());
  //cout << s << " " << t << endl;
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;

}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = 1e15;
const ll mod = 1e9 + 7;

struct BitnicSolver {
	typedef pair<ll, ll> Point;

	double dist(const Point& p1, const Point& p2) {
		return sqrt(pow(p1.first - p2.first, 2.0) + pow(p1.second - p2.second, 2.0));
	}

	double bitonic_tsp_distance(const vector<Point>& p) {
		const int N = p.size();
		vector<vector<double> > L(N, vector<double>(N, 0.0));

		for (int j = 1; j < N; j++) {
			for (int i = 0; i < j; i++) {
				if (i == 0 && j == 1) {
					L[i][j] = dist(p[i], p[j]);
				}
				else if (i < j - 1) {
					L[i][j] = L[i][j - 1] + dist(p[j - 1], p[j]);
				}
				else {
					L[i][j] = numeric_limits<double>::infinity();
					for (int k = 0; k < i; k++)
						L[i][j] = min(L[i][j], L[k][i] + dist(p[k], p[j]));
				}
			}
		}

		double ans = numeric_limits<double>::infinity();

		for (int k = 0; k < N - 1; k++)
			ans = min(ans, L[k][N - 1] + dist(p[k], p[N - 1]));

		return ans;
	}
};

int main(void)
{
	ll n;
	cin >> n;
	vector<P> ps(n);
	rep(i, n) {
		P& a = ps[i];
		cin >> a.first >> a.second;
	}
	BitnicSolver s;
	auto r = s.bitonic_tsp_distance(ps);
	cout << std::fixed << setprecision(10);
	cout << r << endl;
	return 0;
}



Measured memory_bytes: 10804
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;


/* range: ± 3.27 * 10^4 */
using i16 = short int;
/* range: 0 to 65535 */
using u16 = short unsigned int;
/* range: ± 2.14 * 10^9 */
using i32 = int;
/* range: 0 to 4.29 * 10^9 */
using u32 = unsigned int;
/* range: ± 9.22 * 10^18 */
using i64 = long long int;
/* range: 0 to 1.84 * 10^19 */
using u64 = long long unsigned int;

i32 main() {
    i32 n, k;
    cin >> n >> k;

    vector<i32> stones(n);
    for (i32 i = 0; i < n; i++) {
        cin >> stones[i];
    }

    vector<bool> dp(k + 1, false);

    for (i32 i = 1; i <= k; i++) {
        for (auto stone : stones) {
            if (!dp[i] && i >= stone) {
                dp[i] = !dp[i - stone];
            }
        }
    }

    if (dp[k]) {
        cout << "First" << '\n';
    } else {
        cout << "Second" << '\n';
    }
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
int main()
{
	int a[50],n,i;
	a[0]=1;
	a[1]=1;
	scanf("%d",&n);
	if(n>=2)
		for(i=2;i<=n;i++)
			a[i]=a[i-1]+a[i-2];
	printf("%d\n",a[n]);
	return 0;
}


Measured memory_bytes: 2096
package main

import (
	"fmt"
	"math"
)

var N, A, ans int

func main() {
	fmt.Scan(&N, &A)

	ans = N - 500*(N/500)

	if ans <= A {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

/*  ----------------------------------------  */
func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

// type LR []int

// func (a SortBy) Len() int           { return len(a) }
// func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
// func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }


Measured memory_bytes: 512
import math
A, B = map(int,input().split())
minA = math.ceil(A/0.08)
maxA = math.ceil((A+1)/0.08) -1
minB = math.ceil(B/0.1)
maxB = math.ceil((B+1)/0.1) -1

if (minA>maxB) or (minB>maxA):
    print(-1)
else:
    print(max(minA,minB))


Measured memory_bytes: 3060
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    string s;cin >> s;
    if(s=="SUN")puts("7");
    else if(s=="MON")puts("6");
    else if(s=="TUE")puts("5");
    else if(s=="WED")puts("4");
    else if(s=="THU")puts("3");
    else if(s=="FRI")puts("2");
   else puts("1");
    
    return 0;
}

Measured memory_bytes: 3540
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

struct Combination
{
    int maxn;
    vector<ll> fmemo;
    vector<ll> imemo;
    vector<ll> ifmemo;
    
    ll modpow(ll x, ll n){
        ll res = 1;
        ll mul = x;
        while(n){
            if(n % 2) res = res * mul % MOD;
            mul = mul * mul % MOD;
            n /= 2;
        }
        return res;
    }

    Combination(int maxn) : maxn(maxn){
        fmemo.resize(maxn + 1);
        imemo.resize(maxn + 1);
        ifmemo.resize(maxn + 1);
        for(ll i = 1; i <= maxn; i++){
            imemo[i] = modpow(i, MOD - 2);
        }
    }

    ll fact(ll n){
        if(n == 0) return 1;
        if(fmemo[n]) return fmemo[n];
        return fmemo[n] = n * fact(n - 1) % MOD;
    }

    ll ifact(ll n){
        if(n == 0) return 1;
        if(ifmemo[n]) return ifmemo[n];
        return ifmemo[n] = imemo[n] * ifact(n - 1) % MOD;
    }

    ll com(ll n, ll k){
        if(k > n) return 0;
        if(k == n || k == 0) return 1;
        return (fact(n) * ifact(k) % MOD) * ifact(n - k) % MOD;
    }
};

int main()
{
    int x, y;
    cin >> x >> y;
    if((x + y) % 3){
        cout << 0 << endl;
        return 0;
    }
    if(x < y) swap(x, y);
    int a = 0, b = 0;
    while(x > y){
        x -= 2;
        y -= 1;
        a++;
    }
    if(x < 0){
        cout << 0 << endl;
        return 0;
    }
    a += x / 3;
    b += y / 3;
    Combination c(1000000);
    cout << c.com(a + b, a) << endl;
}


Measured memory_bytes: 39296
import itertools
N, M,Q = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(Q)]

ans=-1
#全探索
seq = tuple(range(M))

com=list(itertools.combinations_with_replacement(seq, N))

for li in com:
    re=0
    for i in range(Q):
        a=S[i][0]-1
        b=S[i][1]-1
        c=S[i][2]
        d=S[i][3]
        if li[b]-li[a] == c:
            re += d
    if re > ans:
        ans=re

print(ans)

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define mset(a,x) memset(a,x,sizeof(a))
#define OUT(x) cout<<(x)<<"\n"
#define SZ(x) (int)(x).size()
#define FASTIO cin.tie(0),ios::sync_with_stdio(0)

int a[55], b[55], c[55];
int dp[55][500][500];
const int INF = 114514810;

int main() {
    int n, ma, mb;
    cin >> n >> ma >> mb;
    rep(i, n) {
        cin >> a[i] >> b[i] >> c[i];
    }
    rep(i, 55) rep(j, 500) rep(k, 500) dp[i][j][k] = INF;

    dp[0][0][0] = 0;
    rep(i, n) {
        rep(ca, 500) {
            rep(cb, 500) {
                if(dp[i][ca][cb] == INF) continue;
                dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb]);
                dp[i + 1][ca + a[i]][cb + b[i]] = min(dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]);
            }
        }
    }

    int ans = INF;
    FOR(ca, 1, 500) {
        FOR(cb, 1, 500) {
            if(ca*mb == cb*ma) {
                ans = min(ans, dp[n][ca][cb]);
            }
        }
    }

    OUT(ans == INF ? -1 : ans);

    return 0;
}

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

void fst()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
int nxt()
{
    int x;
    cin >> x;
    return x;
}
int nex_l()
{
    long long x;
    cin >> x;
    return x;
}

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define binary(n) cout << bitset<31>(n) << "\n";
#define FOR(i, n) for (int i = 0; i < n; i++)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define input_arr(a, n)         \
    for (int i = 0; i < n; i++) \
        cin >> a[i];
#define print_arr(a, n)         \
    for (int i = 0; i < n; i++) \
        cout << a[i] << " ";
#define deb(n) cerr << #n << "=" << n << "\n";

int main()
{
    ll n;
    cin >> n;
    ll sum = 0;
    ll p = 1;
    int i = 0;
    while (sum < n)
    {
        i++;
        p *= 26;
        sum += p;
    }
    sum -= p;
    p /= 26;
    n -= sum;
    string ans;
    for (int j = 0; j < i; j++)
    {
        if (n == 0)
        {
            ans.pb('z');
        }
        else
            ans.pb(('a' + (n - 1) / p));
        n %= p;
        p /= 26;
    }
    cout << ans;
}


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int a[110];
signed main() {
    cin >> N;
    int sum = 0;
    rep(i, N) { cin >> a[i], sum += a[i]; }
    int ans = 0;
    for (int i = 1; i < N; i++) {
        if (abs(sum - a[ans] * N) > abs(sum - a[i] * N)) { ans = i; }
    }
    cout << ans << endl;

}


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

using namespace std;

#define fastio cin.tie(NULL);cout.tie(NULL);ios_base::sync_with_stdio(0);
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define MAXN 200005
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define int long long
#define endl '\n'

typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <pii> vii;
typedef vector <vi> matriz;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// auto timer_start = chrono::steady_clock::now().time_since_epoch().count();

struct line {
    ll m, b;
    ll get(ll x){
        return m * x + b;
    }
};

struct node {
    ll i, j, mid;
    line res;
    node * l, * r;
    node(ll i, ll j, line res) : l(NULL), r(NULL), i(i), j(j), res(res), mid(i + (j - i) / 2){ }
} * seg;

void update(node * &seg, line v){
    bool checkL = seg->res.get(seg->i) > v.get(seg->i);
    bool checkM = seg->res.get(seg->mid) > v.get(seg->mid);

    if(checkM) swap(seg->res, v);
    if(seg->i == seg->j) return;

    if(checkL != checkM){
        if(!seg->l) seg->l = new node(seg->i, seg->mid, v);
        else update(seg->l, v);
    } else {
        if(!seg->r) seg->r = new node(seg->mid + 1, seg->j, v);
        else update(seg->r, v);
    }
}

ll query(node * seg, ll x){
    ll v = seg->res.get(x);
    if(seg->i == seg->j) return v;
    if(x <= seg->mid){
        if(seg->l) return min(v, query(seg->l, x));
    } else if(seg->r){
        return min(v, query(seg->r, x));
    }
    return v;
}

int n, c;

int32_t main(){
    fastio
    cin >> n >> c;
    int aux, res = INF;
    for(int i = 1; i <= n; i++){
        cin >> aux;
        if(i == 1){
            seg = new node(0, 1e9, {-2 * aux, aux * aux});
        } else {
            res = c + aux * aux + query(seg, aux);
            update(seg, {-2 * aux, res + aux * aux});
        }
    }
    cout << res << endl;

    return 0;
}


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

#define int long long
const int INF = 1e18;

signed main() {
  int n;
  while ( cin >> n, n ) {
    vector<int> a(n);
    for ( int i = 0; i < n; i++ ) cin >> a[i];
    
    int ans = INF;
    sort(a.begin(), a.end());
    for ( int i = 1; i < n; i++ ) {
      ans = min(ans, a[i]-a[i-1]);
    }

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



Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define forn(i,a,b) for (int i = a; i <= b; i++)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
#define er erase
#define in insert
#define pi pair <int, int>
# define sz(x) (int)((x).size())
#define int long long

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

const ll inf = 0x3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 500 + 11;

int dp[N][N][2],a[N],n,x;
//vector<int>v[N];

int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cerr.tie(0); cout.tie(0);

    cin >> n;

    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }


    for(int j = 1; j <= n; j++){
        for(int i = 1; i <= n; i++){
            if(j == 1){
                dp[i][i][0] = a[i];
                continue;
            }
            if(j == 2){
                dp[i][i+1][0] = a[i] + a[i + 1];
                dp[i][i+1][1] = a[i] + a[i + 1];
                continue;
            }
            int l = i, r = i + j - 1;
            dp[l][r][1] = 3e18;
            if(r > n)continue;
            for(int k = i; k < r; k++){
                int val = dp[i][k][0] + dp[k+1][r][0];
                int price = dp[i][k][1] + dp[k+1][r][1] + val;
                if(dp[l][r][1] > price){
                    dp[l][r][1] = price;
                    dp[l][r][0] = val;
                }
            }
        }
    }


    rc(dp[1][n][1]);
return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;

const int CN = 2e5+5;

string S[CN],P[CN]; int n,cnt = 0;
map<string, int> lib;

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>S[i]; 
        if(!lib.count( S[i] )) P[++cnt] = S[i];
        lib[ S[i] ]++;
    }

    sort(P + 1, P + cnt + 1);

    int t = 0;
    for(int i=1;i<=cnt;i++) t = max(t, lib[ P[i] ]);
    for(int i=1;i<=cnt;i++) if(lib[ P[i] ] == t){
        cout<<P[i]; puts("");
    }
}

Measured memory_bytes: 28288
#include <iostream>

int main()
{
    char s[4];
    std::cin >> s;
    if ((s[0] == 'A' && s[1] == 'A' && s[2] == 'A') || (s[0] == 'B' && s[1] == 'B' && s[2] == 'B'))
    {
        std::cout << "No";
    }
    else
    {
        std::cout << "Yes";
    }
    return 0;
}

Measured memory_bytes: 256
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

const int N = 2e5 + 20 , inf = 1e9 + 20 ;
int n ;
pii a[N] ;

ll ans ;
int mn1 = inf , mx1 , mn2 = inf , mx2 ;

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

	cin >> n ;

	for (int i = 0 ; i < n ; i ++) {
		cin >> a[i].F >> a[i].S ;

		if (a[i].F > a[i].S) swap(a[i].F , a[i].S) ;
	
		mn1 = min(mn1 , a[i].F) ;
		mx1 = max(mx1 , a[i].F) ;

		mn2 = min(mn2 , a[i].S) ;
		mx2 = max(mx2 , a[i].S) ;
	}

	ans = 1ll * (mx1 - mn1) * (mx2 - mn2) ;

	sort(a , a + n) ;

	mx1 = mx2 ;
	mn2 = inf , mx2 = 0 ;

	for (int i = 0 ; i < n ; i ++) {
		if (i) ans = min(ans , 1ll * (mx1 - mn1) * (max(mx2 , a[n - 1].F) - min(mn2 , a[i].F))) ;

		mn2 = min(mn2 , a[i].S) ;
		mx2 = max(mx2 , a[i].S) ;
	}

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

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define cs const 
#define int long long
#define low(i) (i&(-i))
#define mid ((l+r)>>1)
#define ls (now<<1)
#define rs (now<<1|1)
#define par pair<int,int>
#define mp make_pair
#define fr first 
#define se second
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define drep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])
cs int base = 233;
cs int ff = 3e6+1;
cs int mod = 998244353;
cs int inf = 1e9+1;
int n, m; 
void init()
{
	cin >> n >> m;
	cout << max( n * (n-1) / 2, 0LL) + max( m * (m-1) / 2, 0LL);
}
signed main()
{
	int T = 1;
	while(T--) 
		init();
} 


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

int main() {
  string s;
  cin >> s;
  int counter = 0;
  if (s[0] == '1') ++counter;
  if (s[1] == '1') ++counter;
  if (s[2] == '1') ++counter;
  cout << counter << endl;
}

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

int N;

int main(){
    cin>>N;
    if(N%10==3)cout<<"bon"<<endl;
    if(N%10==0||N%10==1||N%10==6||N%10==8)cout<<"pon"<<endl;
    else if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9)cout<<"hon"<<endl;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define ed(i)       i.end()
#define mem(a)      memset(a, 0, sizeof(a))
#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
#define hell        1000000007
bool isPrime(long int n) 
{
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}


ll power(int x, unsigned int y, int p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
        // y must be even now 
        y = y>>1; // y = y/2
        x = (x*x) % p;  
    } 
    return res;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll computeXOR(ll n) 
{ 

  
    switch(n & 3) // n % 4  
    { 
    case 0: return n;     // if n is multiple of 4 
    case 1: return 1;     // If n % 4 gives remainder 1   
    case 2: return n + 1; // If n % 4 gives remainder 2     
    case 3: return 0;     // If n % 4 gives remainder 3   
    } 
}
void solve(){
	ll a, b;
	cin >> a >> b;
	if(a != 0)	a--;
	cout << (computeXOR(b) ^ computeXOR(a)) << endl;

}
int main() {
	// freopen("input.txt", "rt", stdin);
	// freopen("output.txt", "wt", stdout);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 1000010 
#define MAXM 1000010 
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;

int read()
{
	int res=0; char ch=getchar();
	while(ch<'0' || ch>'9') ch=getchar();
	while(ch>='0' && ch<='9')
	{
		res=res*10+ch-'0'; ch=getchar();
	}
	return res;
}

struct Edge
{
	int from,to,next,com;
	Edge(){}
	Edge(int u,int v,int n,int c):from(u),to(v),next(n),com(c){}
	bool operator < (const Edge &rhs) const
	{
		return com<rhs.com;
	}
};

struct Node
{
	int d,u;
	bool operator < (const Node &rhs) const
	{
		return d>rhs.d;
	}
};

int n,m,cnt;
Edge edges[MAXM];
int head[MAXN],tot,vis[MAXN],dis[MAXN];
vector<int> comp[MAXN],G[MAXN];
vector<Edge> G1[MAXN];

void AddEdge(int u,int v,int com)
{
	edges[tot]=Edge(u,v,head[u],com);
	head[u]=tot++;
	edges[tot]=Edge(v,u,head[v],com);
	head[v]=tot++;
}

set<int> dict;

void init()
{
	tot=0;
	for(int i=1;i<=n;++i) head[i]=-1;
}

void dijkstra(int s)
{
	for(int i=1;i<=n+cnt;++i) dis[i]=INF,vis[i]=0;
	priority_queue<Node> q;
	dis[s]=0;
	q.push((Node){0,s});
	while(!q.empty())
	{
		Node x=q.top(); q.pop();
		int u=x.u;
		if(vis[u]) continue;
		vis[u]=1;
		int len=G[u].size();
		for(int i=0;i!=len;++i)
		{
			int v=G[u][i];
			if(dis[v]>dis[u]+1)
			{
				dis[v]=dis[u]+1;
				q.push((Node){dis[v],v});
			}
		}
	}
}

int cur[MAXN];

int main()
{
	//freopen("03.txt","r",stdin);
	n=read(),m=read();
	init();
	for(int i=0;i!=m;++i)
	{
		int u,v,com;
		u=read(),v=read(),com=read();
		//buf[i].u=u,buf[i].v=v,buf[i].com=com;
		G1[u].push_back(Edge(u,v,-1,com));
		G1[v].push_back(Edge(v,u,-1,com));
		comp[com].push_back(u);
		dict.insert(com);
	}
	for(int i=1;i<=n;++i)
		sort(G1[i].begin(),G1[i].end());
	for(set<int>::iterator it=dict.begin();it!=dict.end();++it)
	{
		int com=*it;
		int len=comp[com].size();
		for(int i=0;i!=len;++i)
		{
			int u=comp[com][i];
			if(vis[u]==com) continue;
			vis[u]=com;
			queue<int> q;
			q.push(u);
			++cnt;
			while(!q.empty())
			{
				int u=q.front(); q.pop();
				int len=G1[u].size();
				for(int &i=cur[u];i!=len;++i)
				{
					Edge &e=G1[u][i];
					if(e.com!=com) break;
					if(vis[e.to]!=com)
					{
						vis[e.to]=com; q.push(e.to);
					}
				}
				G[u].push_back(n+cnt);
				G[n+cnt].push_back(u);
			}
		}
	}
	dijkstra(1);
	int ans;
	if(dis[n]==INF) ans=-1;
	else ans=dis[n]/2;
	printf("%d\n",ans);
}


Measured memory_bytes: 113400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int count = 1;
		for(int i = 0; i < n; i++) {
			if(i == 0) {
				count = count * k;
			} else {
				count = count * (k - 1);
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21588
#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(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);

// 区間加算　一点取得 RAQ 平方分割で実装
template <typename T>
struct RAQ{// 0-index
	int n,rn,bn; // rn個のかたまりをbn個
	vector<T> data,bucket;
	RAQ(int n_){init(n_);}
	void init(int n_){
		n = n_;
		rn = sqrt(n);
		bn = ceil((double)n/rn);
		data.resize(n,0);
		bucket.resize(bn,0);
	}
	T get(int i){
		return data[i]+bucket[i/rn];
	}
	void add(int s,int t,T x){ // s~tにxを加算
		for(int i=s;i<=t;++i){
			if(i%rn==0 && (i+rn-1)<=t){
				bucket[i/rn] += x;
				i += rn-1;
			}else{
				data[i] += x;
			}
		}
	}
};

int main(){
	ll N,D,A;
	cin >> N >> D >> A;
	vector< pair<ll,ll> > XH(N);
	vector<ll> X(N+1);
	FOR(i,0,N) cin >> XH[i].first >> XH[i].second;
	SORT(XH);
	FOR(i,0,N) X[i] = XH[i].first;
	X[N] = INF;

	RAQ<ll> raq(N+1);
	FOR(i,0,N){
		raq.add(i,i,XH[i].second);
	}
	//FOR(i,0,N) cout << raq.get(i) << " ";

	ll ans = 0;
	FOR(i,0,N){
		ll HP = raq.get(i);
		ll at = (HP+A-1)/A;
		if(HP<=0)continue;
		ans += at;
		ll ind = POSU(X,XH[i].first+2*D);
		raq.add(0,ind-1,-A*at);
	}
	cout << ans << endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;

int main() {
  int N,X;
  cin >> N;
  vector<int>A;
  ul sum = 0;
  //ここまでの最大値を保存する
  int max = -1;
  for(int i = 0;i < N;++i){
    cin >> X;
    int x = max - X;
    if(x < 0){
      max = X;
    }
    else{
      sum += x;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    long long sum=0;
    cin>>n;
    for(int i=1; i<=n; i++){
        if(i%3!=0 && i%5!=0){
            sum+=i;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

vector<pair<int, int>> vp;

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

    //cout << fixed << setprecision(15);
    ll N, K;
    cin >> N >> K;

    for (int i = 0; i < N; ++i)
    {
        ll a, b;
        cin >> a >> b;
        vp.push_back(make_pair(a, b));
    }

    sort(vp.begin(), vp.end());
    ll cnt = 0;
    for (int i = 0; i < N; ++i)
    {
        cnt += vp[i].second;
        if (cnt >= K)
        {
            cout << vp[i].first << endl;
            return 0;
        }
    }
    return 0;
}


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

int main() {

	int iInputTime; // 入力時間
	int iUntilTime; // 次年度までの時間
	//iInputTime = 0;
	iUntilTime = 48;
	cin >> iInputTime;

	cout << iUntilTime - iInputTime;
	//cout << "!!!Hello World!!!" << endl;
	// prints !!!Hello World!!!

	return 0;
}

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

int main(void) {
	int a, b, i, n = 0;
	cin >> a >> b;
	for(i = 0; i * (a - 1) + 1 < b; i++) {
		continue;
	}
	cout << i << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
ll n,cnt=0;
string s;
int main() {
//    freopen("../in.in", "r", stdin);
//    freopen("../out.out","w",stdout);
    ios::sync_with_stdio(false);
    ll t, i, j = 0;
    ll m, x, y,k;
    ll v;
    cin>>n>>t>>v;
    if(n>t*v) cout<<"No";
    else cout<<"Yes";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3624
unittest
{
	assert( [ "1118" ].parse.expand.solve == "Yes" );
	assert( [ "7777" ].parse.expand.solve == "Yes" );
	assert( [ "1234" ].parse.expand.solve == "No" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto ns = input.front.strip.to!( dchar[] );
	return tuple( ns );
}

auto solve( dchar[] ns )
{
	auto gs = ns.group;
	
	if( 3 <= gs.front[ 1 ] ) return "Yes";
	gs.popFront;
	if( 3 <= gs.front[ 1 ] ) return "Yes";
	return "No";
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

/**
 * Shuffle
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] count = new int[26];

        while (sc.hasNext()) {
            String str = sc.next();
            str = str.toLowerCase();

            for (int i = 0; i < str.length(); i++) {
                if (0 <= str.charAt(i) - 'a' && str.charAt(i) - 'a' < 26)
                    count[str.charAt(i) - 'a']++;
            }
        }

        for (int i = 0; i < 26; i++) {
            char[] charArray = Character.toChars('a' + i);
            String s = new String(charArray);
            System.out.println(s + " : " + count[i]);
        }
    }
}


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

long long n,a,b;

int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a>b) swap(a,b);
	if((a+b)%2==0)
	{
		printf("%lld\n",(b-a)/2);
	}
	else
	{
		long long x=1,y=b-(a-1)-1;
		long long ans=a-1+(y-1)/2+1;
//		cout<<x<<' '<<y<<' '<<a-1<<' '<<(y-1)/2<<endl;
		y=n,x=a+(n-b)+1;
		ans=min(ans,n-b+(n-x)/2+1);
		printf("%lld\n",ans);
	}
}

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

int main() { 
    string s;
    cin >> s;
    
    int ans = 0;
    for (int i = 0; i < 4; i++) {
        if (s[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
LL gcd(LL a,LL b) {
    return b==0?a:gcd(b,a%b);
}
int main() {
    LL n,x,sum=0;
    scanf("%lld%lld",&n,&x);
    LL d=gcd(n,x);
    n/=d;
    unsigned long long ans=d*3*(n-1);
    printf("%llu\n",ans);
    return 0;
}

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

using namespace std;

bool check(const vector<vector<bool>>& matrix)
{
    int H = matrix.size();
    int W = matrix[0].size();
    vector<vector<bool>> visit(H, vector<bool>(W, false));
    int w = 0; 
    int h = 0;
    while (true) {
        visit[h][w] = true;
        int next_w = w, next_h = h;
        int step = 0;
        if (w + 1 < W and matrix[h][w + 1]) {
            next_w = w + 1;
            ++step;
        }
        if (h + 1 < H and matrix[h + 1][w]) {
            next_h = h + 1;
            ++step;
        }
        if (step == 0) break;
        if (step > 1) return false;
        w = next_w;
        h = next_h;
    }
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w < W; ++w) {
            if (visit[h][w]) continue;
            if (matrix[h][w]) return false;
        }
    }
    return true;
}

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<bool>> matrix(H, vector<bool>(W, false));
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w < W; ++w) {
            char c;
            cin >> c;
            matrix[h][w] = c == '#';
        }
    }
    cout << (check(matrix) ? "Possible" : "Impossible") << endl;
    return 0;
}

Measured memory_bytes: 384
n = int(input())
lst = list(map(int,input().split()))
mod = 10**9 + 7

col_lst = [0 , 0 , 0]
ans = 1

for i in range(n):
    tmp = lst[i]
    val = col_lst.count(tmp)
    if val == 0:
        print(0)
        exit()
    else:
        ans = (ans * val) % mod
        col_lst[col_lst.index(tmp)] += 1
print(ans % mod)

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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define mp make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front 
#define pb push_back
#define pp push
#define lb lower_bound 
#define ub upper_bound

int n,r;

int main() {
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>n>>r;
    cout<<100*(10-min(10,n))+r<<endl;
    /* end code */
	return 0;
}

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

using namespace std;

int64_t gcd(int64_t x, int64_t y) {
    while (y != 0) {
        auto tmp = x % y;
        x = y;
        y = tmp;
    }
    return x;
}

int main(int argc, char * argv[]) {
    int64_t A, B, C, D;
    cin >> A >> B >> C >> D;

    int64_t dC = B / C - (A - 1) / C;
    int64_t dD = B / D - (A - 1) / D;
    int64_t CD = C * D / gcd(C, D);
    int64_t dCD = B / CD - (A - 1) / CD;

    int64_t result = B - A + 1 - (dC + dD - dCD);
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  Atcode_Beginner_Contest_66_C
//
//  Created by lee on 2017/7/14.
//  Copyright © 2017年 lee. All rights reserved.
//

#include <iostream>
using namespace std;

const int MAX = 2 * 100000 + 10;

void afterOperationAndPrint(int arr[], int length) {
    
    if(length % 2 == 0) {
        for(int i = length-1; i > 0; i-=2) {
            printf("%d ", arr[i]);
        }
        for(int i = 0; i <= length - 2; i+=2) {
            printf("%d ", arr[i]);
        }
    } else {
        for(int i = length-1; i >= 0; i-=2) {
            printf("%d ", arr[i]);
        }
        for(int i = 1; i <= length - 2; i+=2) {
            printf("%d ", arr[i]);
        }

    }
}

int main() {
    
    int n;
    int arr[MAX] = {0};
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", arr+i);
    }
    
    afterOperationAndPrint(arr, n);
    
    return 0;
}
/*
 1
 21
 312
 4213
 53124
 642135
 
*/

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);
string sum_of_two_strings(string a,string b);





map<char,int>mp;

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,n;
    cin >> n;
    int a[n+2];
    for(i=1;i<=n;i++)
    {
        cin >> a[i];
    }
    sort(a+1,a+n+1);
    cout << a[n/2+1]-a[n/2];
    return 0;
}








LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}

string sum_of_two_strings(string a,string b)
{
    reverse(a.B,a.E);
    reverse(b.B,b.E);
    char c;
    string ans="";
    int length_of_a=a.SZ,length_of_b=b.SZ;
    int i,carry=0,sum,length=max(length_of_a,length_of_b);
    for(i=0; i<length; i++)
    {
        if(i >= length_of_a)
        {
            sum=(b[i]-48)+carry;
        }
        else if(i >= length_of_b)
        {
            sum=(a[i]-48)+carry;
        }
        else
        {
            sum=(a[i]-48)+(b[i]-48)+carry;
        }
        carry=sum/10;
        sum%=10;
        c=sum+48;
        ans+=c;
    }
    if(carry > 0)
    {
        ans+=(carry+48);
    }
    reverse(ans.B,ans.E);
    return ans;
}


Measured memory_bytes: 768
s=input()
c=float('inf')
f=0
for i in range(len(s)):
    if s[i]=='C':
        c=i+1
        break

for j in range(len(s)):
    if s[-(j+1)]=='F':
        f=len(s)-j
        break
if c<f:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    REP(i,n)cin >> a[i];
    if(a[0]!=0){
        cout << -1 << endl;
        return 0;
    }
    ll answer = 0;
    FORR(i,n-1,1){
        if(a[i]-a[i-1]==1)answer++;
        else if(a[i] - a[i-1] > 1){
            cout << -1 << endl;
            return 0;
        }
        else answer+=a[i];
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 4804
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] inputs = line.split(" ");
        int N = Integer.parseInt(inputs[0]);
        int K = Integer.parseInt(inputs[1]);
        int Q = Integer.parseInt(inputs[2]);

//        System.out.println(N);
//        System.out.println(K);
//        System.out.println(Q);
        int[] scores = new int[N];
        for (int i = 0; i < Q; i++) {
        	String ans = sc.nextLine();
//        	System.out.println(ans);
        	int id = Integer.parseInt(ans) -1;
        	scores[id]++;
        }
        for (int i = 0; i < scores.length; i++) {
//        	System.out.println(scores[i]);
        	if (Q - scores[i] < K) {
        		System.out.println("Yes");
        	} else {
        		System.out.println("No");
        	}
        }
	}





}

Measured memory_bytes: 101356
#include<iostream>
#include<cstdio>
#include<stdlib.h>
using namespace std;

struct Node {
	int n;
	Node *pre, *next;
};

Node *Nil;

void Init()
{
	Nil = (Node*)malloc(sizeof(Node));
	Nil->next = Nil;
	Nil->pre = Nil;
	Nil->n = 0;
}

void Insert(int n)
{
	Node *p;
	p = (Node*)malloc(sizeof(Node));
	p->n = n;
	Nil->next->pre = p;
	p->next = Nil->next;
	Nil->next = p;
	p->pre = Nil;
}

Node *Find(int n)
{
	Node *p;
	p = Nil->next;
	while (p != Nil)
	{
		if (p->n == n)
			return p;
		else
			p = p->next;
	}
	return 0;
}

void Delete(int n)
{
	Node *p;
	if (!Find(n))
		return;
	else
	{
		p = Find(n);
		p->next->pre = p->pre;
		p->pre->next = p->next;
	}
}

void DeleteFirst()
{
	Node *p;
	if (Nil->next == Nil)
		return;
	else
	{
		p = Nil->next;
		Delete(p->n);
	}
}

void DeleteLast()
{
	if (Nil->pre == Nil)
		return;
	else
	{
		Nil->pre->pre->next = Nil;
		Nil->pre = Nil->pre->pre;
	}
}




void Print()
{
	Node *p = Nil->next;
	int flag = 0;
	while (p != Nil)
	{
		cout << p->n;
		if (p->next != Nil)
			cout << ' ';
		p = p->next;
	}
	cout << endl;
}

int main()
{
	Init();
	int N;
	char com[20];
	int key;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> com;
		if (com[0] == 'i')
		{
			cin >> key;
			Insert(key);
		}
		else if (com[0] == 'd')
		{
			if (com[6] == 'F')
				DeleteFirst();
			else if (com[6] == 'L')
				DeleteLast();
			else
			{
				cin >> key;
				Delete(key);
			}

		}
	}
	Print();
	return 0;
}


Measured memory_bytes: 37488