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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	int N;
	ll D, A;
	cin >> N >> D >> A;
	V<pair<ll, ll>> mons(N);
	V<ll> acc(N + 1);

	for (int i = 0; i < N; ++i) {
		cin >> mons[i].fs >> mons[i].sc;
	}

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

	mons.pb(mp(1e11, 0));

	ll ans = 0, got = 0;

	for (int i = 0; i < N; ++i) {
		ll l = mons[i].fs;
		got += acc[i];

		int lo = i + 1, hi = N;
		while (lo < hi) {
			int mid = (lo + hi) / 2;
			if (mons[mid].fs <= l + 2 * D)
				lo = mid + 1;
			else
				hi = mid;
		}


		ll need = max((mons[i].sc + A - 1) / A - got, 0LL);

		acc[lo] -= need;

		got += need;

		ans += need;
	}

	cout << ans << '\n';



	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<queue>
using namespace std;
int main() {
    string s; cin >> s;
    queue<int> bfs;
    bfs.push(0);
    string divide[4] = {"dream", "dreamer", "erase", "eraser"};
    while (!bfs.empty()) {
        int t = bfs.front();
        if (t == s.size()) { //0から足していって条件満たした上でsizeが同じなら
            cout << "YES" << endl;
            return 0;
        }
        bfs.pop();
        for (string di : divide) {
            if (s.substr(t, di.size()) == di) { //全可能性をpush
                bfs.push(t + (int)di.size());
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 512
/*
 * AtCode Beginner Contest 138 : A.Red or Not
 * Author : anaksoleh
 * 18 August 2019
 *
 */

#include <bits/stdc++.h>
using namespace std;

int a;

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

	string s;

	cin >>a>>s;

	if(a < 3200){
		cout << "red" << '\n';
	}else cout << s << '\n'; 

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int, Int> pii;
typedef pair<Int, double> pid;
typedef pair<double, double> pdd;
typedef pair<Int, pii> pip;
typedef pair<pii, Int> ppi;
typedef pair<double, Int> pdp;
typedef vector<Int> veci;
typedef vector<double> vecd;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<pii> vecpii;
typedef vector<ppi> vecppi;
typedef vector<veci> mati;
typedef vector<vecll> matll;
typedef vector<vecd> matd;
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define REP(i, a, b) for(int i = (a);i <= (b);i++)
#define FORO(i, n) REP(i,0,(int)n-1)
#define FORI(i, n) REP(i,1,(int)n)
#define FORIT(i, t) for(auto i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a, _b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
#define DEBUG 1
#if DEBUG
#define DUMP(a) do { std::cout << #a " = " << (a) << ", "; } while(false)
#define DUMPLN(a) do { std::cout << #a " = " << (a) << std::endl; } while(false)
#else
#define DUMP(a)
#define DUMPLN(a)
#endif
template<typename T, typename U>
inline void getMin(T &a, U b) { if (a > b) a = b; }
template<typename T, typename U>
inline void getMax(T &a, U b) { if (a < b) a = b; }
template<typename T>
vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T>
vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T>
vector<T> getEmptyVector() { return vector<T>(); }
template<typename T>
void appendAll(vector<T> &a, vector<T> b) { a.insert(a.end(), b.begin(), b.end()); }
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
// #define X first
// #define Y second
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const ll MOD = 1000000007;
const int MAXN = 1 << 17;
const int inf = 1 << 27;
const ll llinf = 1LL << 50;
const int NIL = -inf;
int popcount(int x) { return __builtin_popcount(x); }


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

    int K; cin >> K;
    vector<bool> used(K, false);
    int mod = 0;
    int ans = 0;
    bool found = false;
    while(1) {
        ans++;
        mod = (mod * 10 + 7) % K;
        if(mod == 0) {
            cout << ans << endl;
            found = true;
            break;
        }
        if(used[mod]) break;
        used[mod] = true;
    }

    if(!found) cout << -1 << endl;

    return 0;
}

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

class binaryTree{
  enum tag{ROOT, INTERNALNODE, LEAF};
  class node{
  public:
    tag t;
    int left, right, parent, sib;
    int degree, depth, height;
    node(){
      left = right = parent = sib = -1;
      degree = depth = height = 0;
    }
    void printNode(int id){
      cout << "node " << id << ": parent = " << parent << ", sibling = " << sib;
      cout << ", degree = " << degree << ", depth = " << depth << ", height = " << height << ", ";
      if(t==ROOT) cout << "root" << endl;
      else if(t==INTERNALNODE) cout << "internal node" << endl;
      else cout << "leaf" << endl;
    }
  };
public:
  binaryTree(int n){
    nodes = new node[n];
    num = n;
  }
  void printNodes(){
    for(int i=0; i<num; i++){
      nodes[i].printNode(i);
    }
  }
  int findroot(){
    for(int i=0; i<num; i++){
      if(nodes[i].parent==-1) return i;
    }
  }
  void prewalk(int root){
    cout << "Preorder" << endl;
    nodeprewalk(root);
    cout << endl;
  }
  void inwalk(int root){
    cout << "Inorder" << endl;
    nodeinwalk(root);
    cout << endl;
  }
  void postwalk(int root){
    cout << "Postorder" << endl;
    nodepostwalk(root);
    cout << endl;
  }
  void init(int i){
    initnode(&nodes[i]);
  }
  int num;
  node* nodes;
private:
  void initnode(node* n){
    int hl=0, hr=0;
    if(n->left != -1) {
      n->degree++;
      nodes[n->left].depth = n->depth+1;
      initnode(&nodes[n->left]);
      hl = nodes[n->left].height+1;
    }
    if(n->right != -1){
      n->degree++;
      nodes[n->right].depth = n->depth+1;
      initnode(&nodes[n->right]);
      hr = nodes[n->right].height+1;
    }
    n->height = max(hl, hr);
    if(n->parent == -1) n->t=ROOT;
    else if(n->left == -1 && n->right == -1) n->t=LEAF;
    else n->t=INTERNALNODE;
  }
  void nodeprewalk(int n){
    cout << " " << n;
    if(nodes[n].left != -1) nodeprewalk(nodes[n].left);
    if(nodes[n].right != -1) nodeprewalk(nodes[n].right);
  }
  void nodeinwalk(int n){
    if(nodes[n].left != -1) nodeinwalk(nodes[n].left);
    cout << " " << n;
    if(nodes[n].right != -1) nodeinwalk(nodes[n].right);
  }
  void nodepostwalk(int n){
    if(nodes[n].left != -1) nodepostwalk(nodes[n].left);
    if(nodes[n].right != -1) nodepostwalk(nodes[n].right);
    cout << " " << n;
  }
};

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

  binaryTree bt(n);
  int id, left, right;
  for(int i=0; i<n; i++){
    cin >> id >> left >> right;
    bt.nodes[id].left = left;
    bt.nodes[id].right = right;
    bt.nodes[left].parent = id;
    bt.nodes[right].parent = id;
    bt.nodes[left].sib = right;
    bt.nodes[right].sib = left;
  }

  int root = bt.findroot();
  bt.prewalk(root);
  bt.inwalk(root);
  bt.postwalk(root);

  return 0;
}



Measured memory_bytes: 3076
# F - Absolute Minima
import heapq

n = int(input())

hq1 = []
hq2 = []
ans = 0

for _ in range(n):
    q = list(map(int, input().split()))
    if q[0]==1:
        heapq.heappush(hq1, q[1]*-1)
        heapq.heappush(hq2, q[1])
        hq1max = heapq.heappop(hq1)*-1
        hq2min = heapq.heappop(hq2)
        heapq.heappush(hq1, hq2min*-1)      
        heapq.heappush(hq2, hq1max)
        ans += abs(hq1max-hq2min) + q[2]        
    if q[0]==2:
        hq1max = heapq.heappop(hq1)*-1
        heapq.heappush(hq1, hq1max*-1)          
        print(hq1max, ans)


Measured memory_bytes: 19040
class QuickSort

  class Card
    attr_accessor :mark, :number

    def initialize(mark, number)
      @mark = mark
      @number = number
    end

  end

  # Example:
  # a ::= [ "D 3", "H 2", "D 1" ]
  def initialize(a)
    @cards = []
    a.each do |pair|
      mark, number = pair.split
      @cards << Card.new(mark, number.to_i)
    end
    @cards_ini = @cards.dup
  end

  def solve(p, r)
    if p < r
      q = partition(p, r)
      solve(p, q-1)
      solve(q+1, r)
    end
  end

  def dump
    puts stable ? "Stable" : "Not stable"
    @cards.each do |card|
      puts "#{card.mark} #{card.number}"
    end
  end

  private

    def partition(p, r)
      x = @cards[r].number
      i = p - 1
      (p..r-1).each do |j|
        if @cards[j].number <= x
          i += 1
          @cards[i], @cards[j] = @cards[j], @cards[i]
        end
      end
      @cards[i+1], @cards[r] = @cards[r], @cards[i+1]
      return i+1
    end

    def stable
      cards_ini = {}
      cards = {}
      @cards_ini.each do |c|
         cards_ini[c.number] ||= []
         cards_ini[c.number] << c.mark
      end
      @cards.each do |c|
         cards[c.number] ||= []
         cards[c.number] << c.mark
      end
      cards_ini.each do |key, value|
        return false if value != cards[key]
      end
      return true
    end
end

n = gets.to_i
cards = (1..n).collect {|i| gets }

qs = QuickSort.new cards
qs.solve(0, n-1)
qs.dump

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

int main() {
  long n,m,a=0,b=0,mod=1000000007;
  cin >> n >> m;
  vector<long> x(n);
  vector<long> y(m);
  for(long i=0;i<n;i++) cin >> x[i];
  for(long i=0;i<m;i++) cin >> y[i];

  for(long i=0;i<n/2;i++) a=(a+((x[n-i-1]+mod-x[i])%mod)*(n-1-i*2))%mod;
  for(long i=0;i<m/2;i++) b=(b+((y[m-i-1]+mod-y[i])%mod)*(m-1-i*2))%mod;
  cout << a*b%mod << endl;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
bool vis[100000];
int color[100000];
vector<int> G[100000];
int dfs(int v) {
	vis[v] = 1;
	int sum = 1;
	for (int to : G[v]) {
		if (!vis[to]) sum += dfs(to);
	}
	return sum;
}
bool check(int v, int c) {
	color[v] = c;
	for (int to : G[v]) {
		if (color[to] == c) return 0;
		if (!color[to] && !check(to, -c)) return 0;
	}
	return 1;

}
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	ll one = 0;
	ll A = 0, B = 0;
	for (int i = 0; i < N; i++) {
		if (!vis[i]) {
			int s = dfs(i);
			if (s == 1) one++;
			else if (check(i, 1)) A++;
			else B++;
		}
	}
	ll ans = one * one;
	ans += 2 * one*(N - one);
	ans += 2 * A*B;
	ans += 2 * A*A;
	ans += B * B;
	cout << ans << endl;
}


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

int main() {
  int K, X;
  cin >> K >> X;
  int min_x, max_x;
  min_x = X - (K - 1);
  max_x = X + (K - 1);
  min_x = max(-1000000, min_x);
  max_x = min(1000000, max_x);
  cout << min_x;
  for (int i = min_x + 1; i <= max_x; ++i) {
    cout << " " << i;
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long INF = 1L << 60;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto X = s[1].to!long;
    auto Y = s[2].to!long;
    auto A = readln.split.map!(to!long).array;

    auto mem = new long[][](N+1, 2);
    foreach (i; 0..N+1) mem[i].fill(-1);

    long dfs(int n, int turn) {
        if (mem[n][turn] >= 0)
            return mem[n][turn];

        long ret;
        if (turn == 0) {
            long yp = n == 0 ? Y : A[n-1];
            ret = abs(yp - A[$-1]);
        } else {
            long xp = n == 0 ? X : A[n-1];
            ret = abs(xp - A[$-1]);
        }

        if (turn == 0) { // 先手
            foreach (i; n+1..N) {
                ret = max(ret, dfs(i, 1));
            }
        } else {
            foreach (i; n+1..N) {
                ret = min(ret, dfs(i, 0));
            }
        }

        mem[n][turn] = ret;
        return ret;
    }

    dfs(0, 0).writeln;
}


Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a) for (int i = 0; i < (a); i++)
const ll MOD = 1000000007;

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<pair<ll, ll>> bc(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> bc[i].second >> bc[i].first;

  sort(a.begin(), a.end());
  sort(bc.rbegin(), bc.rend());
  ll j = 0, ans = 0;
  for (ll i = 0; i < n; ++i) {
    if (a[i] < bc[j].first && j < m) {
      a[i] = bc[j].first;
      bc[j].second--;
      if (bc[j].second == 0) j++;
    }
    ans += a[i];
  }

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


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n; cin>>n;
    map<int,int> mp;
    rep(i,n){
        int a; cin>>a;
        mp[a]++;
    }
    int ans=0;
    for(auto &v: mp){
        if(v.first<v.second){
            ans+=v.second-v.first;
        }else if(v.first>v.second){
            ans+=v.second;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7944
#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <numeric>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define rng mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count())

#define ri(...) i64 __VA_ARGS__; rx(__VA_ARGS__)
#define rc(...) char __VA_ARGS__; rx(__VA_ARGS__)
#define rs(...) string __VA_ARGS__; rx(__VA_ARGS__)
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << '[' << #__VA_ARGS__ << "]: "; dbg_log(__VA_ARGS__)
#else
#define dbg(...) ;;
#endif

#define fa(i, v) for (auto &i : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(i) ri(_i); fi(i, _i)

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#ifdef __SIZEOF_INT128__
typedef __uint128_t u128;
typedef __int128_t i128;
#endif
typedef vector<i64> vi;
typedef vector<vi> vvi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) out << x << ' ';
    return out;
}

template<typename T>
inline void rx(T &x) {
    cin >> x;
}

template<typename T, typename... R>
inline void rx(T &x, R &... l) {
    cin >> x;
    rx(l...);
}

template<typename T>
inline void dbg_log(const T &x) {
    cerr << x << '\n';
}

template<typename T, typename... R>
inline void dbg_log(const T &x, const R &... l) {
    cerr << x << ", ";
    dbg_log(l...);
}

template<typename T>
inline void wl(const T &x) {
    cout << x << '\n';
}

template<typename T, typename... R>
inline void wl(const T &x, const R &... l) {
    cout << x << ' ';
    wl<R...>(l...);
}

int main() {
    fio;

    ri(k);
    i64 n = 7;
    i64 res = -1;
    fp(i, 1e7) {
        n = n % k;
        if (n == 0) {
            res = i;
            break;
        }
        n = 10 * n + 7;
    }
    wl(res);

    return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  multiset<int> st;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    st.insert(num);
  }
  for(int i=0; i<m; i++){
    int num;
    auto itr = st.end();
    --itr;
    num = *itr;
    st.erase(itr);
    num = num / 2.0;
    st.insert(num);
  }
  long long sum = 0;
  for(auto itr = st.begin(); itr != st.end(); ++itr) {
    sum += *itr;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double EPS = 1.0e-10;

double pow2(double a){
    return a * a;
}

int main()
{
    for(;;){
        int n, m;
        cin >> n >> m;
        if(n == 0)
            return 0;

        vector<double> x(n), y(n), v(n);
        for(int i=0; i<n; ++i)
            cin >> x[i] >> y[i] >> v[i];

        vector<int> num(n, 0);
        while(--m >= 0){
            double fpx, fpy, fvx, fvy;
            cin >> fpx >> fpy >> fvx >> fvy;

            vector<double> vy(n, 0.0), vx(n, 0.0);
            double minT = DBL_MAX;
            int getDog;
            for(int i=0; i<n; ++i){
                double a = pow2(fvx) + pow2(fvy) - pow2(v[i]);
                double b = 2 * (fvx * (fpx - x[i]) + fvy * (fpy - y[i]));
                double c = pow2(fpx - x[i]) + pow2(fpy - y[i]);
                double d = pow2(b) - 4 * a * c;
                if(d >= 0.0){
                    double t;
                    if(fabs(a) < EPS){
                        t = - c / b;
                        if(t < 0.0)
                            continue;
                    }else{
                        double tmp = (-b - sqrt(d)) / (2*a);
                        if(tmp >= 0.0)
                            t = tmp;
                        else{
                            tmp = (-b + sqrt(d)) / (2*a);
                            if(tmp >= 0.0)
                                t = tmp;
                            else
                                continue;
                        }
                    }
                    vx[i] = (fpx - x[i] + fvx * t) / t;
                    vy[i] = (fpy - y[i] + fvy * t) / t;
                    if(t < minT){
                        minT = t;
                        getDog = i;
                    }
                }
            }

            if(minT != DBL_MAX){
                ++ num[getDog];
                for(int i=0; i<n; ++i){
                    x[i] += vx[i] * minT;
                    y[i] += vy[i] * minT;
                }
            }
        }

        cout << num[0];
        for(int i=1; i<n; ++i)
            cout << ' ' << num[i];
        cout << endl;
    }
}

Measured memory_bytes: 968
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {

            string input = Console.ReadLine();
            String[] temp = input.Split(' ');
            Decimal N = Decimal.Parse(temp[0]);
            Decimal D = Decimal.Parse(temp[1]);

            Decimal ret = Math.Ceiling(N / (2 * D + 1));

            Console.WriteLine((int)ret);

            return;
        }



    }
}


Measured memory_bytes: 11092
// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
void solve();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

// Main Code
void solve() {
    int x;
    cin >> x;
    cout << 8 - (x - 400) / 200 << "\n";
    return;
}


Measured memory_bytes: 3648
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<functional>
#include<algorithm>
#include<bitset>
#include<utility>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
string s;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s;
	int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
	if(a-b-c-d==7){//000
		cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<"=7";return 0;}
	if(a-b-c+d==7){//001
		cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<"=7";return 0;}
	if(a-b+c-d==7){//010
		cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<"=7";return 0;}
	if(a-b+c+d==7){//011
		cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<"=7";return 0;}
	if(a+b-c-d==7){//100
		cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<"=7";return 0;}
	if(a+b-c+d==7){//101
		cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<"=7";return 0;}
	if(a+b+c-d==7){//110
		cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<"=7";return 0;}
	if(a+b+c+d==7){//111
		cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<"=7";return 0;}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
la = []
lb = []
for i in range(n):
    a,b = map(int,input().split())
    la.append(a)
    lb.append(b)
la.sort()
lb.sort()

if n % 2 != 0:
    left = la[n//2]
    right = lb[n//2]
    print(right-left+1)
else:
    left = (la[n//2]+la[n//2-1])/2
    right = (lb[n//2]+lb[n//2-1])/2
    print(int((right-left)*2)+1)

Measured memory_bytes: 25424
#include <stdio.h>

int main(int argc,char* argv[]){
    char a,b,c,d;
    int t[4];
    int i,j,k;
    int ans=0;
    scanf("%c%c%c%c",&a,&b,&c,&d);
    t[0]=a-'0';
    t[1]=b-'0';
    t[2]=c-'0';
    t[3]=d-'0';
    for(i=0;i<2;i++){
        for(j=0;j<2;j++){
            for(k=0;k<2;k++){
                ans=t[0];
                if(i==0)ans+=t[1];
                else ans-=t[1];
                if(j==0)ans+=t[2];
                else ans-=t[2];
                if(k==0)ans+=t[3];
                else ans-=t[3];
                if(ans==7){
                    printf("%c%c%c%c%c%c%c=7\n",a,(i==0)?'+':'-',b,(j==0)?'+':'-',c,(k==0)?'+':'-',d);
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

const long long N = 1005;

const long long MOD = 1e9 + 7;
long long n, k, fact[N];

long long powMod(long long base, long long exp) {
	if(exp == 0)return 1;
	long long tmp = powMod(base, exp / 2);
	tmp = (1LL * tmp * tmp) % MOD;
	if(exp % 2) tmp = (tmp * base) % MOD;
	return tmp;
}

long long invMod(long long a) {
	return powMod(a, MOD - 2);
}

long long comb(long long n, long long k) {
	return (1LL * fact[n] * invMod((1LL * fact[k] * fact[n - k]) % MOD)) % MOD;
}

long long perm_rep(vector <long long> v) {
	long long sum = 0;
	for(auto i : v) 
		sum += i;
	long long ans = fact[sum];
	for(auto i : v) 
		ans = (1LL * ans * invMod(fact[i])) % MOD;
	// dbg(v);
	// dbg(ans);
	return ans;
}

void pre() {
	fact[0] = 1;
	for(long long i = 1; i < N; i++)
		fact[i] = (1LL * i * fact[i - 1]) % MOD;
}

long long a, b, c, d, dp[N][N], pm[N][N], ii[N], cc[N][N];

int main() {
	ios_base::sync_with_stdio(false);
	pre();
	cin >> n >> a >> b >> c >> d;

	for(long long i = 0; i <= n; i++)
		for(long long j = 0; j <= n; j++) {
			pm[i][j] = invMod(powMod(fact[i], j));
			if(i >= j)
				cc[i][j] = comb(i, j);
		}

	for(long long i = 0; i <= n; i++)
		ii[i] = invMod(fact[i]);

	dp[a - 1][0] = 1;
	for(long long i = a; i <= b; i++) {
		// dbg(i);
		for(long long j = 0;j <= n; j++) {
			dp[i][j] = dp[i - 1][j];
			// dbg(i, j, dp[i][j]);

			for(long long k = c; k <= d && i * k <= j; k++) {
				dp[i][j] += (((dp[i - 1][j - i * k] * cc[n - j + i * k][i * k] % MOD) * fact[i * k]  % MOD ) * pm[i][k] % MOD ) * ii[k] % MOD;
				dp[i][j] %= MOD;
			}
			// dbg(i, j, dp[i][j]);
		}
	}
	cout << dp[b][n];
}	

	

Measured memory_bytes: 23168
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    ll a[n];
    vector<ll> x[n], y[n];
    rep(i, n){
        cin >> a[i];
        rep(j, a[i]){
            ll xtemp, ytemp; cin >> xtemp >> ytemp;
            xtemp--;
            x[i].push_back(xtemp);
            y[i].push_back(ytemp);
        }
    }

    // rep(i, n){
    //     for(auto t : y[i]){
    //         cout << t <<  " ";
    //     }
    //     cout << endl;
    // }

    ll cnt_max = 0;
    bool is_valid;

    rep(pat, 1<<n){

        int test[n];
        memset(test, -1, sizeof(test));

        ll cnt = 0;
        is_valid = true;

        // rep(i, n){
        //     cout << (pat & (1<<i)) << " ";
        // }
        // cout << endl;

        rep(i, n){
            if(pat & (1<<i)){
                test[i] = 1;
            }
            else{
                test[i] = 0;
            }
            // cout << test[i] << " ";
        }
        // cout << endl;

        rep(i, n){
            if(test[i] == 0){
                continue;
            }
            // {
            //     if(test[i] == 0){
            //         is_valid = false;
            //         break;
            //     }
            // }

            rep(j, a[i]){
                // cout << " " <<  i << " " << j << endl;

                if(test[x[i][j]] == y[i][j]){
                    cnt++;
                }
                else{
                    is_valid = false;
                    break;
                }
                
            }
            if(!is_valid) break;
        }

        if(!is_valid) continue;
        // cnt_max = max(cnt, cnt_max);
        cnt_max = max(cnt_max, accumulate(test, test+n, 0LL));
    }

    cout << cnt_max << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define PI acos(-1.0)

#define pb push_back

#define F first

#define S second

using namespace std;

typedef long long ll;

const int N=2e5+5;

const int MOD=1e9+7;

ll a[N];

//struct node{

//    ll v;

//    ll d;

//}p[N];

//ll sum;

//ll ans[N];

 

int main(void){

    ios::sync_with_stdio(false);

    cin.tie(0);cout.tie(0);

    int n;

    cin >>n;

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

    sort(a+1,a+1+n);

    ll mid=n/2;

    ll b[4]={a[mid],a[mid+1],a[mid-1]};

    ll ans=1e18;

    for(int i=0;i<=2;i++){

        ll tb=b[i];

        ll res=0;

        for(int j=1;j<=n;j++){

            res+=abs(a[j]-tb);

        }

        ans=min(ans,res);

    }

    cout << ans << endl;

 

    return 0;

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	if(a <= b && c <= b){
		swap(a, b);
	}else if(a <= c && b <= c){
		swap(a, c);
	}
	if(b <= c){
		swap(b, c);
	}
	int ans = 200;
	int x = a - b;
	if((a - x - c) % 2 == 0){
		ans = min(ans, x + (a - x - c) / 2);
	}else{
		ans =  min(ans, x + (a - x - c + 1) / 2 + 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  }
}

Measured memory_bytes: 23380
matrix = []

r, c = $stdin.readline.split(" ").map {|s| s.to_i }

(1..r).each do |row|
  cols = $stdin.readline.split(" ").map {|s| s.to_i }
  matrix.push(cols)
end

matrix.each do |row|
  print row.join(" ")
  print " "
  puts row.reduce(0) {|result, col| result + col }
end

total = 0
(1..c).each do |col|
  sum = 0
  (1..r).each do |row|
    sum += matrix[row-1][col-1]
    total += matrix[row-1][col-1]
  end
  print sum.to_s + " "
end

puts total



Measured memory_bytes: 7020
#include <iostream>
#include <cstdio>
#include <vector>
#define N 200005
using namespace std;

int n, sz, a[N], ans[N], d[N];
vector<int> gr[N];

void f(int p, int q) {
	int k, re;
	if(ans[p]) return;
	k = lower_bound(d, d+q, a[p]) - d;
	if(k == q) q++;
	ans[p] = q;
	re = d[k];
	d[k] = a[p];
	for(auto x:gr[p]) f(x, q);
	d[k] = re;
}

int main() {
	int i, t1, t2;
	cin >> n;
	for(i=1; i<=n; i++) scanf("%d", &a[i]);
	for(i=0; i<n-1; i++) {
		scanf("%d%d", &t1, &t2);
		gr[t1].push_back(t2);
		gr[t2].push_back(t1);
	}
	for(i=0; i<n; i++) d[i] = 1e9;
	f(1, 0);
	for(i=1; i<=n; i++) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 28456
import java.util.Scanner;
import java.util.Collections;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);

		for(;;){
			int h = scan.nextInt();
			int w = scan.nextInt();

			if(h == 0 && w == 0)
				break;

			System.out.println(String.join("", Collections.nCopies(h, String.join("", Collections.nCopies(w, "#"))+"\n")));
		}
	}
}



Measured memory_bytes: 26452
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

int main()
{
    long long int n,c=0,flag=0;
	cin>>n;
	long long int a[n];
	for(long long int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]>i)
		flag=1;
	}
	if(flag==1)
	cout<<-1<<endl;
	else
	{
		for(long long int i=n-1;i>=1;i--)
		{
			if(a[i]==a[i-1])
			c+=a[i];
			else
			if(a[i]==(a[i-1]+1))
			c+=1;
			else {
				if(a[i-1]>a[i])
				c+=a[i];
				else
				{
					flag=1;
					break;
				}
			}
		}
		if(flag==1)
		cout<<"-1"<<endl;
		else
		cout<<c<<endl;
	}
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

int main(){
    int N;
    cin >> N;
    vector<int> A(3*N+1, 0);
    for (int i = 1; i <= 3*N; i++) cin >> A[i];
    vector<vector<int>> dp(N+1, vector<int>(N+1, -1e8));
    dp[A[1]][A[2]] = 0;
    dp[A[2]][A[1]] = 0;
    
    int geta = 0;
    queue<pair<pair<int, int>, int>> renew;
    vector<int> onemax(N+1, -1e8);
    onemax[A[1]] = 0;
    onemax[A[2]] = 0;
    int nowmax = 0;
    for (int i = 1; i <= N-1; i++) {
        int c = min(A[3*i], min(A[3*i+1], A[3*i+2]));
        int e = max(A[3*i], max(A[3*i+1], A[3*i+2]));
        int d = A[3*i]+A[3*i+1]+A[3*i+2]-c-e;
        
        if (c == d && d == e) {
            geta++;
            continue;
        }else if (c == d || d == e) {
            if (d == e) swap(c, e);
            
            for (int i = 1; i <= N; i++) {
                renew.push({{e, i}, dp[c][i]+1});
            }
            renew.push({{c, c}, nowmax});
            renew.push({{c, c}, dp[e][e]+1});
            renew.push({{c, e}, nowmax});
            for (int i = 1; i <= N; i++) {
                renew.push({{c, i}, onemax[i]});
                renew.push({{e, i}, onemax[i]});
            }
        }else {
            renew.push({{d, e}, max(dp[c][c]+1, nowmax)});
            renew.push({{c, e}, max(dp[d][d]+1, nowmax)});
            renew.push({{c, d}, max(dp[e][e]+1, nowmax)});
            for (int i = 1; i <= N; i++) {
                renew.push({{c, i}, onemax[i]});
                renew.push({{d, i}, onemax[i]});
                renew.push({{e, i}, onemax[i]});
            }
        }
        while (!renew.empty()) {
            auto p = renew.front();
            int a = p.first.first, b = p.first.second;
            int v = p.second;
            renew.pop();
            onemax[a] = max(onemax[a], v);
            onemax[b] = max(onemax[b], v);
            nowmax = max(nowmax, v);
            dp[a][b] = max(dp[a][b], v);
            dp[b][a] = max(dp[b][a], v);
        }
    }
    cout << max(nowmax, dp[A[3*N]][A[3*N]]+1)+geta << endl;
	return 0;
}


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

int main() {
	unsigned long long A;
	string B;
	cin >> A >> B;
	B.erase(B.find('.'), 1);
	unsigned long long b = stoi(B);
	unsigned long long ans = A * b;
	cout << ans / 100 << endl;
	return 0;
}


Measured memory_bytes: 3628
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <iostream>
#include <bitset>
#include <algorithm>        // sort()
#include <vector>           // for vectors
#include <map>              // for ordered map
#include <unordered_map>
#include <list>             // for list
#include <iomanip>          // for setprecision()
#include <cmath>            // for pow(), sqrt(), log(), log10(), ....
#include <cstring>          // for memset()
#include <unordered_set>    // for unordered_set
#include <climits>          // for INT_MAX & INT_MIN
#include <set>              // for ordered set

#define C ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
#define INF INT_MAX
#define NINF INT_MIN
#define MOD 1000000007
const double pi=acos(-1); // value of pi


bool isVowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        return 1;
    }
    return 0;
}

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second<b.second;
}


bool isPrime(ll n) {
    for(ll i=3; i*i<=n; i+=2) {
        if(n%i==0) {
            return false;
        }
    }
    return true;
}

map<ll, list<ll>> m;
// map<ll, ll> m;

int main() {
    C
//     freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
    int t=1;
    //cin >> t;
    while(t--) {
        ll d, x, res=0;
        cin >> d;
        ll c[26];
        ll arr[d][26];
        ll la[26];
        for(ll i=0; i<26; i++) {
            cin >> c[i];
            la[i]=-1;
        }
        for(ll i=0; i<d; i++) {
            for(ll j=0; j<26; j++) {
                cin >> arr[i][j];
            }
        }
        for(ll i=0; i<d; i++) {
            ll ans, ma=0;
            for(ll j=0; j<26; j++) {
                x=arr[i][j];
                for(ll k=0; k<26; k++) {
                    if(k!=j) {
                        x-=((c[k])*(i-la[k]));
                    }
                }
                if(x>ma) {
                    ma=x;
                    ans=j;
                }
            }
            la[ans]=i;
            cout << ans+1 << endl;
        }
    }
}


Measured memory_bytes: 3248
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=100011;
int n,a[N],r=0,l=0,ans=0;
int c[N*10],s[N<<1];
void add(int x)
{
	while(x<=N*2)
	  c[x]++,x+=x&(-x);
}
ll ask(int x)
{
	ll ans=0;
	while(x)
	{
		ans+=c[x];
		x-=x&(-x);
	}
	return ans;
}
bool check(int x)
{
	for(int i=1;i<=2*N;i++) c[i]=0;
	s[0]=0;
	for(int i=1;i<=n;i++)
	  s[i]=s[i-1]+(a[i]>=x?1:-1);
	ll sum=0;
	for(int i=0;i<=n;i++)
    {
       sum+=ask(s[i]+N);
       add(s[i]+N);
	} 
	return sum>=(ll)n*(n+1)/4;
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
  scanf("%d",&n);
  for(int i=1;i<=n;i++) scanf("%d",&a[i]),r=max(r,a[i]);
  while(l<=r)
  {
  	int mid=(l+r)>>1;
  	if(check(mid)) 
	  l=mid+1;
	else r=mid-1;
  }
  printf("%d\n",r);
  return 0;
}


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

int main() {
int N,K;
  cin>>N>>K;
  int i,X;  
  X=1;
  for(i=0;i<N;i++){
    if(X<K)X*=2;
      else X+=K;
  }
  cout<<X<<endl;
}

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

using ll = long long;

const int N = 300005;
const ll inf = ll(1e12);

int n, k;
ll b[N];

int main(){
    scanf("%d%d", &n, &k);
    if(~n & 1){
        printf("%d ", n / 2);
        for(int i = 0; i < k - 1; i++) printf("%d ", n);
        return 0;
    }
    ll o = k & 1;
    b[k] = 1;
    for(int i = k - 1; i >= 1; i--) b[i] = min(inf, b[i + 1] * n + 1);
    for(int i = 1; i <= k; i++){
        if(~(k - i) & 1) o--;
        int t = (n + 1) / 2;
        while(o > b[i] / 2){ o -= b[i]; t++; }
        while(o < -((b[i] - 1) / 2)){ o += b[i]; t--; }
        if(!t) break;
        printf("%d ", t);
    }
}


Measured memory_bytes: 4608
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,t,a;
  int x,ans,temp,min=100000;
  scanf("%d",&n);
  scanf("%d %d",&t,&a);
  x = 1000*(t-a)/6;
  int H;
  for(int i = 0;i<n;i++){
    scanf("%d",&H);
    temp = abs(x-H);
    if(temp<min){
      min = temp;
      ans = i;
    }
  }
  printf("%d",ans+1);
  return 0;
}

Measured memory_bytes: 1712
#include<stdio.h>

long long int min(long long int a, long long int b){return a>b?b:a;}

int N, W, w[100001], v[100001], i, j;
long long int d[101][100001], ans;

int main(){
	scanf("%d%d", &N, &W);
	for(i=0; i<N; i++){
		scanf("%d%d", w+i, v+i);
	}
	for(j=0; j<100001; j++){d[0][j]=4611686018427387904;}
	d[0][0] = 0;
	for(i=0; i<N; i++){
		for(j=0; j<100001; j++){
			if(j<v[i]){
				d[i+1][j] = d[i][j];
			}else{
				d[i+1][j] = min(d[i][j], d[i][j-v[i]]+w[i]);
			}
		}
	}
	for(j=0; j<100001; j++){if(d[N][j]<=W){ans=j;}}
	printf("%lld\n", ans);
}


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

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

	if (a.length() > b.length()) cout << "GREATER";
	else if (a.length() == b.length()) {
		bool flag = false;
		for (int i = 0; i < a.length(); i++) {
			if (a[i] > b[i]) {
				cout << "GREATER";
				flag = true;
				break;
			}
			else if (a[i] < b[i]) {
				cout << "LESS";
				flag = true;
				break;
			}
		}

		if (!flag) {
			cout << "EQUAL";
		}

	}
	else cout << "LESS";

	return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 2 * 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int a[N], n, k;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    cin >> n >> k;
    FOR(i, 1, n) cin >> a[i];
    sort(a + 1, a + 1 + n);
    ll s = 0;
    FOR(i, 1, max(n - k, 0))
    {
        s += a[i];
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h> 
#include <math.h>
int main(void)
{
	double  S, L, h, rad;
	double pi = 3.1415926535;
	int a, b, C;
	C = 1, a = 1, b = 1;
	scanf("%d %d %d", &a, &b, &C);
	rad = C*pi / 180;
	h = b*sin(rad);
	L = sqrt(a*a + b*b - 2 * a*b*cos(rad)) + a + b;
	S = (1.0/ 2) * a*b*sin(rad);
	printf("%f %f %f\n", S, L, h);
	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N;
  cin >> N;
  if (N == 1)
    cout << 1 << endl
         << 1 << endl;
  else if (N == 2)
    cout << 2 << endl
         << 0 << endl
         << 11 << endl;
  else
  {
    cout << N - 1 << endl;
    string ans = "1";
    for (i64 i = 0; i < N - 1; i++)
    {
      cout << ans << "1" << endl;
      ans += "0";
    }
  }
  return 0;
}



Measured memory_bytes: 3204
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll a,b,c;
  cin >> a >> b >> c;
  ll ma = max(a,max(b,c));
  pri(ma*10+a+b+c-ma);
  return 0;
}


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

using namespace std;

int main() {
  int n;
  while (cin >> n && n) {
    vector<int> s;
    for (int i = 0; i < n; i++) {
      int tmp;
      cin >> tmp;
      s.push_back(tmp);
    }
    sort(s.begin(), s.end());
    int ans = accumulate(s.begin() + 1, s.end() - 1, 0) / (n - 2);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3148