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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;


int main(void){

	int N; cin >> N;

	int sum = 0;
	int idx = 1;
	while(sum <= N){
		sum += idx;
		idx++;
	}
	int ig = sum - N;

	FOR(i,1,idx){
		if(ig != i) cout << i << endl;
	}
	
	


	return 0;
}


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

#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
#define vec vector<int>
#define dead not_bad
#define bad gooood

#define left not_right
#define y1 what

using namespace std;

const int N = (int) 3e3 + 10;
const int M = (int) 1e6 + 10;
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const int ALPHA = 26;
const int mod = INF + 2;
const double PI = 3.14159265359;
const ld EPS = (ld) 1e-12;

const int nx[4] = {0, 0, -1, 1};
const int ny[4] = {1, -1, 0, 0};

int n, m;

int mult(int x, int y, int mod) {
  return 1ll * x * y % mod;
}

int add(int x, int y, int mod) {
  x += y;
  if (x < 0)
    x += mod;
  if (x >= mod)
    x -= mod;
  return x;
}

int bp(int x, int y, int mod) {
  int ans = 1;
  while (y) {
    if (y % 2)
      ans = mult(ans, x, mod);
    x = mult(x, x, mod);
    y /= 2;
  }
  return ans;
}

int dp[N][N], c[N][N];

int f(int cnt, int k) {
  return dp[cnt][k];
}

int get(int i) {
  int ans = 0;
  for (int k = 0; k <= i; k++) {
    // k+1 -> mycopka
    ans = add(ans, mult(f(i, k), bp(2, mult(k, n - i, m - 1), m), m), m);
  }
  ans = mult(ans, bp(2, bp(2, n - i, m - 1), m), m);
  return ans;
}

int main() {
  #define fn "saddle"
  #ifdef witch
      freopen("input.txt", "r", stdin);
  //    freopen("output.txt", "w", stdout);
  #else
      //freopen(fn".in", "r", stdin);
      //freopen(fn".out", "w", stdout);
  #endif
  cin >> n >> m;
  for (int i = 0; i <= n; i++) {
    c[i][0] = 1;
    dp[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      c[i][j] = add(c[i - 1][j], c[i - 1][j - 1], m);
      dp[i][j] = add(dp[i - 1][j - 1], dp[i - 1][j] * 1ll * (j + 1) % m, m);
    }
  }
  //cout << f(1, 1) << endl;
  //return 0;
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    //cout << i << ' ' << mult(c[n][i], get(i), m) << endl;
    if (i % 2 == 0)
      ans = add(ans, mult(c[n][i], get(i), m), m);
    else
      ans = add(ans, -mult(c[n][i], get(i), m), m);
  }
  cout << ans;
  return 0;
}


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

string s;

int main(){
	cin >> s;
	if(s[0] == 'S') cout << "Cloudy\n";
	else if(s[0] == 'C') cout << "Rainy\n";
	else cout << "Sunny\n";
	return 0;
}


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

vector<vector<vector<int>>> a(2, vector<vector<int>>(0, vector<int>(0)));
int f(int n){
	a.at(0).push_back({1});
	rep(ii, n-1){
		int k = a.at(ii%2).size();
		int l = a.at(ii%2).at(0).size();
		rep(i, k) a.at(ii%2).at(i).push_back(l+1);
		rep(i, k){//2
			rep(j, l+1){//3
				a.at((ii+1)%2).push_back({});
				rep(m, l+1) a.at((ii+1)%2).at(i*(l+1)+j).push_back(a.at(ii%2).at(i).at((m+j)%(l+1)));
			}
		}
		while(a.at(ii%2).size() != 0){
			a.at(ii%2).pop_back();
		}
	}
	sort(a.at((n+1)%2).begin(), a.at((n+1)%2).end());
	return 0;
}

int main(){
	int n;
	cin >> n;
    vector<int> ns0(n);
    vector<int> ns1(n);
    rep(i, n) cin >> ns0.at(i);
    rep(i, n) cin >> ns1.at(i);
    f(n);
    int c, d;
    int f0 = 0;
    int f1 = 0;
    rep(i, a.at((n+1)%2).size()){
      f0 = 0;
      f1 = 0;
      rep(j, n){
        if(a.at((n+1)%2).at(i).at(j) != ns0.at(j)) f0 = 1;
        if(a.at((n+1)%2).at(i).at(j) != ns1.at(j)) f1 = 1;
      }
      if(f0 == 0) c = i+1;
      if(f1 == 0) d = i+1;
    }
    cout << abs(c-d) << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {
  int x, a, b;
  cin >> x >> a >> b;

  const int d = b - a;
  if (d <= 0) {
    cout << "delicious" << endl;
  } else if (d <= x) {
    cout << "safe" << endl;
  } else {
    cout << "dangerous" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,i,A[1000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&A[i]);
    }
    for(i=n-1;i>=1;i--)
    {
        printf("%d ",A[i]);
    }
    printf("%d\n",A[0]);
    return 0;
}



Measured memory_bytes: 2032
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion


//ABC  115-C Chrismas Eve

int main(void) {
	int        i, n, k;
	int        h[100001];

	scanf("%d %d", &n, &k);
	for (i = 0; i < n; i++)
		scanf("%d", &h[i]);

	qsort(h, n, sizeof(int), i_asort);

	int min = 1000000001;
	for (i = 0; i <= n - k; i++) 
		min = _min((h[i + k - 1] - h[i]), min);
	

	printf("\n%d\n", min);
	return 0;
}


Measured memory_bytes: 2724
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

long foo(string s, char c) {
  long ret = 0;
  while (true) {
    long flag = true;
    for (auto it: s) if (it != c) flag = false;
    if (flag) return ret;

    string next = s.substr(0, s.size() - 1);
    for (long i = 0; i < next.size(); i++) {
      if (s[i+1] == c) next[i] = s[i+1];
      else next[i] = s[i];
    }
    s = next;
    ret++;
  }
}

void solve() {
  string s;
  cin >> s;

  long ans = s.size();
  for (char c = 'a'; c <= 'z'; c++) {
    long tmp = foo(s, c);
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

const string YES = "Yes";
const string NO = "No";

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long a, long long b, long long c, long long k){
    while(b <= a&& k > 0)
        b *= 2, --k;
    while(k > 0)
        c *= 2, --k;
    cout << (a < b && b < c ? YES : NO) << endl;
}


signed main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main(){
    int k, a, b; cin >> k >> a >> b;
    for(int i = a; i <= b; i++) {
        if(i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3636
kn = input().split()
a = input().split()

al = [int(i) for i in a]
k = int(kn[0])
n = kn[1]

ml = k - abs(al[len(al)-1] - al[0])


for i in range(len(al)-1):
	ml = max(ml,abs(al[i]-(al[i+1])))


print(k-ml)



Measured memory_bytes: 24948
# -*- coding:utf-8 -*-
 
def main():
    while True:
        try:
            IN=input()
            if IN=="":
                raise EOFError
            else:
                val=IN.split(" ")
                a=int(val[0])+int(val[1])

                i=1
                flag=True
                while flag:
                    a=a/10
                    if a<1:
                        flag=False
                    else:
                        i+=1

            print(i)
        except EOFError:
            break
  
if __name__ == '__main__':
    main()

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

using namespace std;

struct SuffixArray
{
  vector< int > SA;
  string s;

  void Build_SA(const string &str)
  {
    s = str;
    SA.resize(s.size());
    iota(begin(SA), end(SA), 0);
    sort(begin(SA), end(SA), [&](const int &a, const int &b)
    {
      if(s[a] == s[b]) return (a > b);
      return (s[a] < s[b]);
    });
    vector< int > classes(s.size()), c(s.size()), cnt(s.size());
    for(int i = 0; i < s.size(); i++) {
      c[i] = s[i];
    }
    for(int len = 1; len < s.size(); len <<= 1) {
      for(int i = 0; i < s.size(); i++) {
        if(i > 0 && c[SA[i - 1]] == c[SA[i]] && SA[i - 1] + len < s.size() && c[SA[i - 1] + len / 2] == c[SA[i] + len / 2]) {
          classes[SA[i]] = classes[SA[i - 1]];
        } else {
          classes[SA[i]] = i;
        }
      }
      iota(begin(cnt), end(cnt), 0);
      copy(begin(SA), end(SA), begin(c));
      for(int i = 0; i < s.size(); i++) {
        int s1 = c[i] - len;
        if(s1 >= 0) SA[cnt[classes[s1]]++] = s1;
      }
      classes.swap(c);
    }
  }

  int operator[](int k) const
  {
    return (SA[k]);
  }

  int size() const
  {
    return (s.size());
  }

  bool lt_substr(string &t, int si = 0, int ti = 0)
  {
    int sn = s.size(), tn = t.size();
    while(si < sn && ti < tn) {
      if(s[si] < t[ti]) return (true);
      if(s[si] > t[ti]) return (false);
      ++si, ++ti;
    }
    return (si >= sn && ti < tn);
  }

  int lower_bound(string &t)
  {
    int low = -1, high = SA.size();
    while(high - low > 1) {
      int mid = (low + high) >> 1;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    return (high);
  }

  pair< int, int > lower_upper_bound(string &t)
  {
    int idx = lower_bound(t);
    int low = idx - 1, high = SA.size();
    t.back()++;
    while(high - low > 1) {
      int mid = (low + high) >> 1;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    t.back()--;
    return (make_pair(idx, high));
  }

  void output()
  {
    for(int i = 0; i < size(); i++) {
      cout << i << ": " << s.substr(SA[i]) << endl;
    }
  }
};


int main()
{
  string S;
  int Q;

  cin >> S;

  SuffixArray sa;
  sa.Build_SA(S);

  cin >> Q;
  while(Q--) {
    string T;
    cin >> T;
    auto get = sa.lower_upper_bound(T);
    cout << (get.first != get.second) << endl;
  }
}

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

int main(){
    char c;
    cin>>c;
    if(c =='a'){
        cout<<"vowel"<<endl;
    }else if(c =='i'){
        cout<<"vowel"<<endl;
    }else if(c =='u'){
        cout<<"vowel"<<endl;
    }else if(c =='e'){
        cout<<"vowel"<<endl;
    }else if(c =='o'){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
    }
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    codefestival2017quala_b()
}

fun codefestival2017quala_b() {
    val (n, m, k) = readLine()!!.split(" ").map { it.toInt() }

    for (i in 0..n) {
        for (j in 0..m) {
            val blackCell = (m - j) * i + (n - i) * j
            if (blackCell == k) return println("Yes")
        }
    }

    println("No")
}


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

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = n / (a + b) * a + min(n % (a + b), a);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        n: usize,
        x: i64,
    }

    let mut ls: Vec<i64> = Vec::new();
    ls.push(1);
    let mut l = 1_i64;

    let mut ps: Vec<i64> = Vec::new();
    ps.push(1);
    let mut p = 1_i64;

    for i in 0..50 {
        l = 2 * ls[i] + 3;
        ls.push(l);

        p = 2 * ps[i] + 1;
        ps.push(p);
    }

    println!("{}", count(n, x, ls, ps));
}

fn count(n: usize, x: i64, ls: Vec<i64>, ps: Vec<i64>) -> i64 {
    if x == 0 {
        return 0;
    }
    if n == 0 {
        return 1;
    }

    let size = ls[n];
    let half = size / 2 + 1;
    if x < half {
        count(n - 1, x - 1, ls, ps)
    } else if x == half {
        ps[n - 1] + 1
    } else {
        ps[n - 1] + 1 + count(n - 1, x - half, ls, ps)
    }
}

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

const ll INF = 1e18;

int N, M, R;
vector<vector<ll>> d;
vector<int> r;

void warshall_floyd() {
  for (int i = 0; i < N; i++) d[i][i] = 0;
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

main() {
  cin >> N >> M >> R;
  r.resize(R);
  d.assign(N, vector<ll>(N, INF));
  vector<int> perm(R);
  for (int i = 0; i < R; i++) {
    cin >> r[i];
    r[i]--;
    perm[i] = r[i];
  }
  for (int i = 0; i < M; i++) {
    int s, t, c; cin >> s >> t >> c;
    s--; t--;
    d[s][t] = d[t][s] = c;
  }

  ll ans = INF;
  warshall_floyd();
  sort(perm.begin(), perm.end());
  do {
    ll sum = 0;
    for (int i = 0; i < R - 1; i++) {
      sum += d[perm[i]][perm[i + 1]];
    }
    ans = min(ans, sum);
  } while (next_permutation(perm.begin(), perm.end()));
  cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define N 100000 + 5
#define int long long
#define rep(i, l, r) for(int i = l; i <= r; ++i)
struct node1{
    int p, x, y;
    bool operator < (const node1 &a) const{
        return x == a.x ? y < a.y : x < a.x;
    }
}a[N];
struct node2{
    int p, x, y;
    bool operator < (const node2 &a) const{
        return y == a.y ? x < a.x : y < a.y;
    }
}b[N];
int n, S, E, D, X, Y, ans, top, x[N], y[N], st[N];
multiset <node1> S1; 
multiset <node1> :: iterator it;
multiset <node2> S2; 
multiset <node2> :: iterator It;
queue <int> Q;
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
void solve1(int X, int Y, int XX, int YY){
    int last = 0;
    int Fi = lower_bound(a + 1, a + n + 1, node1{1, X, Y}) - a;
    int En = upper_bound(a + 1, a + n + 1, node1{1, XX, YY}) - a;
    if(En > Fi) ans += En - Fi;
    multiset <node1> :: iterator fi = S1.lower_bound(node1{1, X, Y}); if((*fi).x != X || fi == S1.end()) return;
    multiset <node1> :: iterator en = S1.upper_bound(node1{1, XX, YY}); if(en == S1.begin()) return;
    for(it = fi; it != en; ++it) st[++top] = (*it).p;
    while(top){
        Q.push(st[top]);
        it = S1.lower_bound(node1{st[top], x[st[top]], y[st[top]]}); S1.erase(it);
        It = S2.lower_bound(node2{st[top], x[st[top]], y[st[top]]}); S2.erase(It);
        --top;
    }
}
void solve2(int X, int Y, int XX, int YY){
    int last = 0;
    int Fi = lower_bound(b + 1, b + n + 1, node2{1, X + 1, Y}) - b;
    int En = upper_bound(b + 1, b + n + 1, node2{1, XX - 1, YY}) - b;
    if(En > Fi) ans += En - Fi;
    multiset <node2> :: iterator fi = S2.lower_bound(node2{1, X, Y}); if((*fi).y != Y || fi == S2.end()) return;
    multiset <node2> :: iterator en = S2.upper_bound(node2{1, XX, YY}); if(en == S2.begin()) return;
    for(It = fi; It != en; ++It) st[++top] = (*It).p;
    while(top){
        Q.push(st[top]);
        it = S1.lower_bound(node1{st[top], x[st[top]], y[st[top]]}); S1.erase(it);
        It = S2.lower_bound(node2{st[top], x[st[top]], y[st[top]]}); S2.erase(It);
        --top;
    }
}
signed main(){
    n = read(), S = read(), E = read();
    rep(i, 1, n) x[i] = read(), y[i] = read();
    D = abs(x[S] - x[E]) + abs(y[S] - y[E]);
    rep(i, 1, n) X = x[i], Y = y[i], x[i] = X - Y, y[i] = X + Y;
    rep(i, 1, n) a[i].p = i, a[i].x = x[i], a[i].y = y[i], b[i].p = i, b[i].x = x[i], b[i].y = y[i];
    rep(i, 1, n) if(i != S && i != E) S1.insert(node1{i, x[i], y[i]}), S2.insert(node2{i, x[i], y[i]});
    sort(a + 1, a + n + 1), sort(b + 1, b + n + 1);
    Q.push(S), Q.push(E);
    while(!Q.empty()){
        int u = Q.front(); Q.pop(); 
        solve1(x[u] - D, y[u] - D, x[u] - D, y[u] + D); 
        solve1(x[u] + D, y[u] - D, x[u] + D, y[u] + D); 
        solve2(x[u] - D, y[u] - D, x[u] + D, y[u] - D); 
        solve2(x[u] - D, y[u] + D, x[u] + D, y[u] + D); 
    }
    printf("%lld", ans / 2);
    return 0; 
}

Measured memory_bytes: 22868
#include<iostream>
using namespace std;
int main()
{
    int A,B,K;
    cin>>A;
    cin>>B;
    K=(A+B)/2;
    if((A+B)%2==0)
    {
        cout<<K<<endl;
    }
    else
    {
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N,M,num[55]={};
int main(){
  cin >> N >> M;
  for(int i=1;i<=M;i++){
    int a;
    cin >> a;
    num[a]++;
    cin >> a;
    num[a]++;
  }
  for(int i=1;i<=N;i++){
    cout << num[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  a=a+b;
  b=c+d;
  if(a>b)cout<<"Left"<<endl;
  if(a==b)cout<<"Balanced"<<endl;
  if(a<b)cout<<"Right"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() 
{
    string s, t;
    cin >>s >> t;
    if (t.substr(0, t.length() - 1) == s)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    

    

}

Measured memory_bytes: 3588
n, m = map(int,input().split())

def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod

mod = 10**9+7
N = 510000  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N+1):
	fact.append((fact[-1]*i)%mod)
	inv.append((-inv[mod%i]*(mod//i))%mod)
	factinv.append((factinv[-1]*inv[-1])%mod)

targ = m-n
"""
m = 10, n = 8とする.
a = 1, 2, 3, 4, 5, 6, 7, 8
b = ?????????????????????
dp[i] = i番目まで選んだとき差がm-n
"""

dp = [0 for _ in range(n+1)]
dp[0] = 1
for i in range(1, n+1):
	if i == 1:
		dp[1] = targ
	elif i == 2:
		dp[i] = dp[0] + dp[1]*(targ+1)
	else:
		dp[i] = (dp[i-2]*(i-1) + dp[i-1]*(targ+i-1)) % mod

print((dp[n]*cmb(m, n, mod)*fact[n]) % mod)

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

int main() {
    int H, W;

    while (true) {
        cin >> H >> W;

        if (H == 0 && W == 0) {
            break;
        }

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if ((i + j) % 2 == 0) {
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3076
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
//const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

bool is_prime(int N){
    
    if (N == 1) return false;
    
    int sqn = sqrt(N);
    
    for(auto i = 2; i<=sqn; i++){
        if (N % i == 0) return false;
    }
    return true;
}


int main() {
    int n;cin>>n;
    
    vector<int> a;
    
    repsg(i,1,55556){
        if(!is_prime(i))continue;
        
        if(i%5==1)a.push_back(i);
        
        if(a.size()==n)break;
    }
    
    rep(i,n-1){
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
    
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc140/tasks/abc140_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    cout << n * n * n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include<iomanip>
using namespace std;
using P = pair<int, int>;

long long int attack(long long int h) {
	if (h == 1) {
		return 1;
	}
	else {
		return 1 + 2 * attack(h / 2);
	}
}

int main()
{
	long long int H;
	cin >> H;
	cout << attack(H) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
  ll a;
  ll b;
  ll c;
  ll d;
  cin >> a >> b >> c >> d;
 ll f = a * c, g = b * c, h = b * d, i = a * d;
  cout << max(f, max(g, max(h, i))) << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for(int i=(a);i<(b);++i)
#define foreach(i, n) for (__typeof(n.begin()) i = n.begin(); i != n.end(); ++i)
#define sqr(x) ((x)*(x))
#define clr(a, b) memset(a, b, sizeof(a))
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)a.size())
#define all(a) (a).begin(),(a).end()
#define inf 0x3f3f3f3f
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
const double eps = 1e-8;
int dcmp(double x) { if (x < -eps) return -1; else return x > eps;}
#define se(x) cout<<#x<<" = "<<x<<endl

#ifdef CHEN_PC
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...)
#endif

const int N = 200010;
const int mod = 1000000007; // 10^9+7
int n;
int a[N];

ll solve() {
    sort(a, a + n);
    ll ans = a[n - 1] - a[0];
    int st = 1;
    int ed = n - 2;
    int a0 = a[0];
    int an = a[n - 1];
    while (st <= ed) {
        if (abs(a0 - a[ed]) > abs(an - a[st])) {
            ans += abs(a0 - a[ed]);
            a0 = a[ed--];
        }
        else {
            ans += abs(an - a[st]);
            an = a[st++];
        }
        if (a0 > an) {
            swap(a0, an);
        }
//        debug("%d %d %d %d %lld\n", a0, an, st, ed, ans);
    }
    return ans;
}

int main(int argc, char *argv[]) {
#ifdef CHEN_PC
    freopen("C.in", "r", stdin);
#endif

    while (scanf("%d", &n) != EOF) {
        forn (i, n) {
            scanf("%d", a + i);
        }
        ll ret = solve();
        printf("%lld\n", ret);
    }
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int D;
#define KIND 26
vector<int> c(KIND);
vector<vector<int>> s(365, vector<int>(KIND));
vector<int> t(365);

vector<int> last(KIND, -1);
int calc_score() {
	int ret_score = 0;
	for (int i = 0; i < D; ++i) {
		ret_score += s[i][t[i] - 1];
		last[t[i] - 1] = i;
		int dec_score = 0;
		for (int j = 0; j < KIND; ++j) {
			dec_score += c[j] * (i - last[j]);
		}
		ret_score -= dec_score;
		cout << ret_score << endl;
	}
	return ret_score;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> D;
	for (auto& elem : c) cin >> elem;
	for (int i = 0; i < D; ++i) {
		for (int j = 0; j < KIND; ++j) {
			cin >> s[i][j];
		}
	}
	for (int i = 0; i < D; ++i) cin >> t[i];

	calc_score();

	return 0;
}

Measured memory_bytes: 3696
#include<iostream>
using namespace std;
int main()
{
	int f=2,s=1,x;
	for(int i=0;i<3;i++)
	{
		scanf("%d",&x);
		if(x==5) f--;
		if(x==7) s--;
	}
	if(f==0&&s==0) printf("YES\n");
	else printf("NO\n");
 } 

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#include<bitset>
using ll=long long;


int main(){
  ll a,b,k;
  cin >> a >> b >> k;
  if(a>=k)cout << a-k << " " << b;
  else if(a<k&&(a+b)>k)cout << "0 "<< b+a-k;
  else cout << "0 0";


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, k, n) for(ll i = k; i < (ll)(n); i++)
string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    string s;
    cin >> s;
    map<char, int> cnt;
    for (auto si:s){
        cnt[si]++;
    }
    bool flag = 1;
    for (auto al:alpha){
        if (cnt[al] > 0){
            if (cnt[al] == 1 || cnt[al]%2 != 0) flag = 0;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    vector<int> a;
    vector<int> b;
    int tmp;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp;
        a.push_back(tmp);
        b.push_back(tmp);
    }

    sort(b.begin(), b.end());
    for(int i=0; i<n; i++){
        if(a[i] == b[n-1]){
            cout << b[n-2] << endl;
        }else{
            cout << b[n-1] << endl;
        }
    }
}

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


#define ll long long int
#define ld long double
#define mod 998244353
#define big 1e18+10
#define small -big
#define pb push_back
#define endl "\n"


template <typename T>

void prarr(T a)
{
     cerr << "[ ";
     
     for(auto i : a){
         cerr << i << " ";
     }
     
     cerr << "]" << endl;
}


#define trace(...) _er(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>

void _er(const char* name, Arg1&& arg1){
	cerr << "[" << name << " : " << arg1 << "]" << endl;
}

template <typename Arg1, typename... Args>

void _er(const char* names, Arg1&& arg1, Args&&... args){
    
	const char* comma = strchr(names + 1, ',');
	cerr << "[" ; cerr.write(names, comma - names) << " : " << arg1 << "] ";
	_er(comma+2, args...);
}






void solve() {
    
     
     ll N;
     cin >> N;
     
     ll s = 0;
     
     for(ll i = 1; i <= N; i++) {
            ll a;
            cin >> a;
            if(i % 2 && a % 2) {
                  s++;
            }
     }
    
      cout << s << endl;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   

    int t=1;
    //cin >> t;

    for(int i = 1; i <= t; i++) {  
   
         solve();
    }


    return 0;
        
}


Measured memory_bytes: 3644
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>

using namespace std;

typedef long long ll;

const int MAX_N = 100000;

ll x;

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

    cin >> x;

    ll p = x / 11;
    ll r = x - p * 11;
    ll ans;

    if (r == 0) {
        ans = 2 * p;
    } else if (r <= 6) {
        ans = 2 * p + 1;
    } else {
        ans = 2 * p + 2;
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3616
<?php
    $num = (int)fgets(STDIN);
    $cond = explode(" ", fgets(STDIN));

$ans = 0;

for($k=0; $k<$num; $k++){
  if($k < $num-1){
      $cond[$k] = (int)$cond[$k];
  }
  if($k <= count($cond)-1){
    if($k === 0){   
      $ans += $cond[0];
    }elseif($cond[$k] > $cond[$k-1]){
      $ans += $cond[$k-1];
    }else{
      $ans += $cond[$k];
    }
  }else{
    $ans += $cond[$k-1];
  }
}

echo $ans;

Measured memory_bytes: 4604
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split();
	public K()
	{
		var N = F;
		var ps = new Complex[N];
		for (var i = 0; i < N; i++) { var I = G; ps[i] = new Complex(I[0], I[1]); }
		var M = 1300000;
		var d = 2 * PI / M;
		var ans = new int[N];
		for (var i = 0; i < M; i++)
		{
			var p = Complex.FromPolarCoordinates(1, i * d);
			var k = -1;
			var r = double.NegativeInfinity;
			for (var j = 0; j < N; j++)
			{
				var tmp = (p * ps[j]).Real;
				if (tmp > r) { r = tmp; k = j; }
			}
			ans[k]++;
		}
		for (var i = 0; i < N; i++) WriteLine(ans[i] / (decimal)M);
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k,sum=0;
    cin>>n>>k;
    long long int arr[n];
    for(long long int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(long long int i=0;i<n-k;i++)
    {
        sum=sum+arr[i];
    }
    cout<<sum;
    
    return 0;
}
    
    
    
    
    

Measured memory_bytes: 1792
// AOJ 2104: Country Road
// 2017.9.30 bal4u@uu
// 2017.11.7 retry

#include <stdio.h>
#include <string.h>

int f[1000001];

// for data input
char buf[800000], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int t, n, k, i, ans;
	int x0, x, dx, min, max;

	fgets(p=buf, 10, stdin), t = getint();
	while (t--) {
		fgets(p=buf, 20, stdin), n = getint(), p++, k = getint();
		fgets(p=buf, sizeof(buf), stdin);
		if (k >= n) { puts("0"); continue; }
		
		memset(f, 0, sizeof(f));
		min = 1000000, max = 0;
		for (n--, x0 = getint(), i = 0; i < n; i++, x0 = x) {
			p++, x = getint();
			dx = x - x0, f[dx]++;
			if (dx < min) min = dx;
			if (dx > max) max = dx;
		}

		for (ans = 0, i = n-k+1, x = min; i > 0; x++) {
			if (f[x] > 0) {
				if (i < f[x]) f[x] = i;
				ans += x*f[x], i -= f[x];
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

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

int main() {
  char s[101];
  scanf("AtCoder%sContest", s);
  printf("A%cC\n", *s);
  return 0;
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
 
 
void doit()
{
	int n;
	cin >> n;
	
	int cnt =0;
	int maxi=0 ;
	
	for(int i =0 ;i < n ;i++)
	{
		int x;
		cin >> x;
		if(maxi == 0)
			maxi= x;
		if(maxi >= x)
			cnt++;
		
		maxi= min( maxi, x);
	}
	cout<<cnt;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int t=1;
	//cin >>t;
	
	while(t--)
		doit();
	
	return 0;
}

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


int main() {
    int r,d,x_2000;
    cin >> r >> d >> x_2000;

    int count = 0;
    vector<int> x(11);
    x[0] = x_2000;
    //print(x[0]);

    while(count < 10){
        x[count + 1] += r * x[count] - d;
        print(x[count + 1]);
        count++;
    }
}

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

int main() {
  int a[3][3];
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) {
      cin>>a[i][j];
    }
  }
  int n;
  cin>>n;
  int b[n];
  for (int i=0; i<n; i++) cin>>b[i];
  for (int x: b) {
    for (int i=0; i<3; i++) {
      for (int j=0; j<3; j++) {
        if (x == a[i][j]) {
          a[i][j] = 0;
          break;
        }
      }
    }
  }
  bool found = false;
  for (int i=0; i<3; i++) {
    if (a[i][0] + a[i][1] + a[i][2] == 0) {
      found = true;
    }
    if (a[0][i] + a[1][i] + a[2][i] == 0) {
      found = true;
    }
  }
  if (a[0][0] + a[1][1] + a[2][2] == 0) {
    found = true;
  }
  if (a[0][2] + a[1][1] + a[2][0] == 0) {
    found = true;
  }
  if (found) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define INF 10000000
int main(){
    int n;
    long long sum = 0;
    cin>>n;
    int a[n];
    int min = INF;
    int max = -INF;
    for(int i = 0;i<n;i++){
        cin>>a[i];
        if(min > a[i]) min = a[i];
        if(max < a[i]) max = a[i];
        sum += a[i];
    }
    cout<<min<<" "<<max<<" "<<sum<<endl;
    
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 2007;

vector <int> g[N];
int dist[N][N];

void dfs(int u, int p, int start, int d) {
    dist[start][u] = d;
    for (auto v : g[u]) {
        if (v != p) {
            dfs(v, u, start, d + 1);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n, k;
    cin >> n >> k;
    for (int i = 0; i + 1 < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for (int i = 0; i < n; ++i) dfs(i, -1, i, 0);
    int res = n + 1;
    for (int i = 0; i < n; ++i) {
        int cur = 0;
        for (int j = 0; j < n; ++j) {
            if (dist[i][j] * 2 > k) {
                ++cur;
            }
        }
        res = min(res, cur);
    }
    for (int u = 0; u < n; ++u) {
        for (int v : g[u]) {
            int cur = 0;
            for (int i = 0; i < n; ++i) {
                if (min(dist[u][i], dist[v][i]) * 2 >= k) {
                    ++cur;
                }
            }
            res = min(res, cur);
        }
    }
    cout << res << '\n';
}

Measured memory_bytes: 16128
/*
ID: jerrywcy
TASK: AtCoder ABC 102 Problem D
LINK: https://abc102.contest.atcoder.jp/tasks/abc102_d
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

int n,i,j,k,l,m;
long long s[200001];

int main(){
	long long p=-1,p1,p2,p3,p4,mn,mx;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>s[i];
		s[i]+=s[i-1];
	} 
	j=1;
	k=3;
	for(i=3;i<n;i++){
	  	while(fabs(s[i-1]-s[j]-s[j])>fabs(s[i-1]-s[j+1]-s[j+1]))j++;
		p1=s[j];
		p2=s[i-1]-s[j];
		
	  	while(fabs(s[n]-s[k]-s[k]+s[i-1])>fabs(s[n]-s[k+1]-s[k+1]+s[i-1]))k++;
	  	p3=s[n]-s[k];
	  	p4=s[k]-s[i-1];
	  	
	  	mn=p1; 
	  	if(mn>p2)mn=p2;
	   	if(mn>p3)mn=p3;
	    if(mn>p4)mn=p4;
	    
	    mx=p1;
	    if(mx<p2)mx=p2;
	    if(mx<p3)mx=p3;
	    if(mx<p4)mx=p4;
	    
	    if((mx-mn<p)||(p==-1))p=mx-mn;
	}
	cout<<p<<endl;
	return 0;
}

Measured memory_bytes: 1920
#include<iostream>
#include<algorithm>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<cctype>
#include<vector>
#include<limits.h>
#include<queue>

using namespace std;


int main()
{
    int p[10];
    int ans,k,i,j;
    for(i=0; i<5; ++i)
    {
        scanf("%d",&p[i]);
    }
    scanf("%d",&k);
    for(i=0,ans=-100; i<5; ++i)
    {
        for(j=i+1; j<5; j++)
        {
            ans=max(ans,p[j]-p[i]);
        }
    }
    if(ans>k)
        printf(":(\n");
    else
        printf("Yay!\n");
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

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

  int n;

  while(true) {
    cin >> n;
    if(n == 0) break;

    int num, max = -1;
    rep(i,0,n) {
      int id,d1,d2;
      cin >> id >> d1 >> d2;
      if(max < d1+d2) {
        max = d1+d2;
        num = id;
      }
    }
    cout << num << " " << max << endl;
  }

	return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>

int Fib(int n){
  int i;
  int sum=1,x1=1,x2=1;

  for(i=1;i<n;i++){
    sum=x1+x2;
    x1=x2;
    x2=sum;
  }
  return sum;
}

main(){
  int n;

  scanf("%d",&n);

  printf("%d\n",Fib(n));

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
long long n,a[200005];
int main() 
{
    cin>>n;
    for(int i=1;i<=n;i++)
    	cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=2;i<=n;i++)
    	if(a[i]==a[i-1])
    	{
    		cout<<"NO\n";
    		return 0;
		}
	cout<<"YES\n";
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int solve()
{
    int N;

    std::cin >> N;

    return N * N;
}

int main()
{
    std::cout << solve() << std::endl;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
K, A, B = list(map(int, input().split()))
if B - A > 2 and K - A > 0:
    x = (K - A + 1) // 2
    y = (K - A + 1) % 2
    print(x * (B - A) + A + y)
else:
    print(K + 1)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define int long long

using namespace std;

const int N = 1e5;

int readInt ()
{
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true)
    {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true;
    else result = ch-'0';
    while (true)
    {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}
main() {
    int m = readInt(), d = readInt();
    int ans = 0;
    set<pair<int,int>>st;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) {
                int x = j, y = i / j;
                if (x >= 2 && x <= 9 && y >= 2 && y <= 9 && x * 10 + y <= d) {
                    ++ans;
//                    cout <<
                }
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,x[maxn],y[maxn],ans,dl;
PII d[maxn];
int main(){
	n=read();
	FOR(i,1,n) x[i]=read(),y[i]=read();
	FOR(i,1,n) FOR(j,1,n){
		if(i==j) continue;
		d[++dl]=MP(x[i]-x[j],y[i]-y[j]);
	}
	sort(d+1,d+dl+1);
	FOR(i,1,dl){
		int cnt=0,j=i;
		while(j<=dl && d[i]==d[j]) j++,cnt++;
		ans=max(ans,cnt);
		i=j-1;
	}
	printf("%d\n",n-ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w;
	cin>>h>>w;
	char s[h+2][w+2];
	for(int i=0;i<h+2;i++){
		for(int j=0;j<w+2;j++){
			s[i][j]=char('#');
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>s[i+1][j+1];
		}
	}
	for(int i=0;i<h+2;i++){
		for(int j=0;j<w+2;j++){
			cout<<s[i][j];
		}
		cout<<endl;
	}
	return 0;
}

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

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(long[]);
    a.sort!"a > b"();
    long ans = a[0];
    int m = n - 2;
    foreach (i; 1 .. n) {
        if (m == 0)
            break;
        if (m == 1) {
            ans += a[i];
            break;
        }
        ans += 2 * a[i];
        m -= 2;
    }
    writeln(ans);
}

void scan(T...)(ref T args) {
    auto line = readln.split; // @suppress(dscanner.suspicious.unmodified)
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args)
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9

typedef long long unsigned int ll;

int n;

int getDigit(int ii){
  int digit = 0;
  while (ii!=0)
  {
    ii /= 10;
    digit++;
  }
  return digit;
}
void solve(){
  int cnt = 0;
  rep(i, n){
    if(getDigit(i + 1) % 2 != 0){
      cnt++;
    }
  }
  cout << cnt << endl;
}

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

Measured memory_bytes: 256
s = str(input())
k = int(input())
flag = False
for i in range(len(s)):
  if s[i] != '1':
    flag = True
    posi = i
    break
if flag:
  if k < posi+1:
    print(1)
  else:
    print(s[posi])
else:
  print(s[0])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>

using namespace std;

int main()
{
	int a;
	int b;
	cin >> a;
cin>>b;
	cout << a*b <<" "<<a+a+b+b<< endl;
	return 0;
}

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

using namespace std;
int N,M;
int total;
int mask[2000],cost[2000],dp[100000];

int main() {
    int n,m,i,j;
    cin>>n>>m;
    N=n;M=m;
    
    for(i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        int sum=0;
        for(j=0;j<b;j++){
            int x;
            cin>>x;
            x--;
            sum+=(1<<x);
        }
        mask[i]=sum;
        cost[i]=a;
        //cout<<sum<<' ';
    
        
    }


    int total=1<<n;
    for(j=0;j<total;j++)dp[j]=1e9;
    dp[0]=0;
    for(i=0;i<m;i++){
        for(j=0;j<(1<<n);j++)
            dp[j|mask[i]]=min(dp[j|mask[i]],dp[j]+cost[i]);
    }
    if(dp[(1<<n)-1]!=1e9)
        cout<<dp[(1<<n)-1];
    else
        cout<<"-1";
}

Measured memory_bytes: 256