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

using namespace std;

# define REP(i, a, b) for(int i = a; i <= b; ++ i)
# define CLR(i, a) memset(i, a, sizeof(i))
# define REPD(i, a, b) for(int i = a; i >= b; -- i)

const int N = 3e5 + 3, INF = 1e9;

# define gc getchar
inline int rd() {
	char ch = gc(); int ret = 0, sgn = 1;
	while(ch < '0' || ch > '9') { 
		if(ch == '-') sgn = -1;
		ch = gc();
	}
	while(ch >= '0' && ch <= '9') 
		ret = ret * 10 + ch - '0', ch = gc();
	return ret * sgn;
}

struct node {
	int tg, mx;
} tr[N << 2];

# define pii pair<int, int>
# define fir first
# define sec second
# define mkp make_pair

int n, w, h, ans, m;
pii su[N], sd[N];
pii a[N];

# define u tr[x]
# define ls (x << 1)
# define rs (x << 1 | 1)
# define urs tr[rs]
# define uls tr[ls]

void pd(int x) {
	if(!u.tg) return ;
	uls.tg += u.tg, urs.tg += u.tg;
	uls.mx += u.tg, urs.mx += u.tg;
	u.tg = 0;
}

inline void modi(int ql, int qr, int v, int x = 1, int l = 0, int r = m) {
	if(qr < ql) return ;
	// printf("[%d %d] %d %d\n", l, r, ql, qr); 
	if(ql <= l && qr >= r) {
		if(u.mx == -INF) u.mx = 0;
		u.tg += v, u.mx += v;
		return ;
	}
	pd(x);
	int mid = l + r >> 1;
	if(ql <= mid) modi(ql, qr, v, ls, l, mid);
	if(qr > mid) modi(ql, qr, v, rs, mid + 1, r);
	u.mx = max(uls.mx, urs.mx);
}

void build(int x, int l, int r) {
	u.mx = -INF, u.tg = 0;
	if(l == r) return ;
	int mid = l + r >> 1;
	build(ls, l, mid), build(rs, mid + 1, r);
}

# undef u 
# undef ls 
# undef rs 
# undef urs 
# undef uls 

int dis[N], au[N], ad[N];
void solve() {
	REP(i, 1, n) dis[i] = a[i].fir;
	dis[n + 1] = w;
	sort(dis, dis + n + 2);
	m = unique(dis, dis + n + 2) - dis - 1;
	build(1, 0, m);
	// cout << m << " ?? " << endl;
	REP(i, 0, m) ad[i] = 0, au[i] = h;
	REP(i, 1, n) {
		a[i].fir = lower_bound(dis, dis + m + 1, a[i].fir) - dis;
		if(a[i].sec <= h / 2)
			ad[a[i].fir] = max(a[i].sec, ad[a[i].fir]);
		else au[a[i].fir] = min(a[i].sec, au[a[i].fir]);
	}

	int tu = 0, td = 0;
	modi(0, 0, h);
	REP(i, 1, m) {
		// modi(i - 1, i - 1, h);
		ans = max(ans, tr[1].mx + dis[i]);
		
		modi(su[tu].fir, i - 1, au[i] - h);
		while(tu && su[tu].sec >= au[i]) {
			modi(su[tu - 1].fir, su[tu].fir - 1, au[i] - su[tu].sec);
			-- tu;
		}
		su[++ tu] = mkp(i, au[i]);

		modi(sd[td].fir, i - 1, -ad[i]);
		while(td && sd[td].sec <= ad[i]) {
			modi(sd[td - 1].fir, sd[td].fir - 1, sd[td].sec - ad[i]);
			-- td;
		}
		sd[++ td] = mkp(i, ad[i]);

		modi(i, i, h - dis[i]);
	}	

}

int main() {
	w = rd(), h = rd(), n = rd();
	// ++ n;
	REP(i, 1, n) {
		int x = rd(), y = rd();
		a[i] = mkp(x, y);
	}
	// a[1] = mkp(0, 0), a[++ n] = mkp(w, h);
	solve();		
	swap(w, h);
	REP(i, 1, n) a[i].fir = dis[a[i].fir];
	REP(i, 1, n) swap(a[i].fir, a[i].sec);

	solve();

	printf("%d\n", ans << 1);

	return 0;
}

Measured memory_bytes: 19068
<?php

// ABC109B
$w_array = array();
fscanf(STDIN, '%d', $n);
for ($i = 0; $i < $n; $i++) {
    fscanf(STDIN, '%s', $w);
    if (in_array($w, $w_array)) {
        echo 'No';
        return;
    }
    if (!empty($w_array)) {
        if (substr($w, 0, 1) !== substr($w_array[count($w_array) - 1], -1, 1)) {
            echo 'No';
            return;
        }
    }
    $w_array[] = $w;
}

echo 'Yes';


Measured memory_bytes: 4728
import java.io.*;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int m = fs.nextInt();

        int ans = 0;
        for( int i = n - 1 ; 0 < i ; i-- ){
            ans += i;
        }
        for( int i = m - 1 ; 0 < i ; i-- ){
            ans += i;
        }

        System.out.println(ans);



    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int bufferLength = 0;

        private boolean hasNextByte() {
            if (ptr < bufferLength) {
                return true;
            } else {
                ptr = 0;
                try {
                    bufferLength = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return bufferLength > 0;
            }
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        String next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

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


Measured memory_bytes: 22612
#import pysnooper
#import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline
n=int(input().rstrip())
a=[int(i) for i in input().split()]

def rep(l,b):
    cnt,s=0,0
    for i in l:
        s+=i
        if b and s<1:
           # print("True",s,i)
            cnt+=1-s
            s=1
        elif not b and s>-1:
            #print("False",s,i)
            cnt+=s+1
            s=-1
        #print(cnt,s)
        b=not b
    return cnt

print(min(rep(a,1),rep(a,0)))

Measured memory_bytes: 14588
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n;
    cin >> n;
    pair<int,int> A[n];
    bool is_max[n];
    REP(i,n) is_max[i] = false;
    int ma = -1;
    int su = 0;
    REP(i,n){
        cin >> A[i].fi;
        su += A[i].fi;
        A[i].se = i;
        if(ma < A[i].fi){
            ma = A[i].fi;
            is_max[i] = true;
        }
    }

    sort(A,A+n);
    int ans[n] = {};
    int tmp = su;
    int mi = 0;
    REP(i,n){
        tmp -= (n - i) * (A[i].fi - mi);
        mi = A[i].fi;
        if(is_max[A[i].se] == false) continue;
        ans[A[i].se] = su - tmp;
        su = tmp;
        if(su == 0) break;
    }

    REP(i,n) cout << ans[i] << endl;



}

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

int main() {
	ll a[4], n;
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> n;
	for (int i = 1; i < 4; i++) {
		a[i] = min(a[i], a[i - 1] << 1);
	}
	n <<= 2;
	ll s = 0;
	for (int i = 4 - 1; i >= 0; i--) {
		s += n / (1 << i) * a[i];
		n %= (1 << i);
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int n, b, a;
    cin >> n >> a >> b;
    if(n*a < b) cout << n*a << endl;
    else cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

P topo_sort(vvll &g, vll &deg, ll n){
    ll day = 0;
    vll ps(n);
    queue<ll> que;
    REP(i, n){
        if(!deg[i]){
            que.push(i);
            ps[i] = 1;
        }
    }
    vll ans;
    while(!que.empty()){
        ll s = que.front();
        que.pop();
        ans.push_back(s);
        day = max(day, ps[s]);
        for(auto j : g[s]){
            deg[j]--;
            ps[j] = max(ps[j], ps[s] + 1);
            if(deg[j] == 0) que.push(j);
        }
    }
    return P{ans.size(), day};
}

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

    ll n;
    cin >> n;
    vvll a(n, vll(n - 1));

    REP(i, n){
        REP(j, n - 1){
            cin >> a[i][j];
            a[i][j]--;
        }
    }

    vvll vid(n, vll(n));
    ll v = 0;
    REP(i, n){
        REP(j, n){
            vid[i][j] = v++;
        }
    }

    auto id = [&](ll i, ll j) {
        if (i > j) swap(i, j);
        return vid[i][j];
    };

    // 試合数は n * (n - 1) / 2 回だけど id は v == n^2 まで使ってあり実質 v コの頂点のグラフになる
    // 該当する試合が無い頂点番号からは一本も辺が出ないし入らない
    vvll g(v);
    vll d(v); // d[i] : i の入次数
    REP(i, n){
        REP(j, n - 1){
            a[i][j] = id(i, a[i][j]); // a[i][j] : i が j 番目に対戦する試合の番号 < v
        }
        REP(j, n - 2){
            // 試合順の優先度に対応する有効辺を張る. a[i][j] -> a[i][j + 1]
            g[a[i][j]].push_back(a[i][j + 1]);
            d[a[i][j + 1]]++;
        }
    }
    P res = topo_sort(g, d, v);
    if (res.first != v) {
        cout << -1 << endl;
        return 0;
    }
    cout << res.second << endl;
    return 0;
}

Measured memory_bytes: 80688
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y, Z =MAP()
print((X-Z)//(Y+Z))


Measured memory_bytes: 5148
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll INF = 1LL << 60;

int d[2000001];
bool seen[2000001];
vector<vector<int>> g;


int main(){
    int n,m;
    cin >> n >> m;
    g.resize(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }
    auto f =[&](int s){
        queue<int> q;
        q.push(s);
        while(!q.empty()){
            int now = q.front();q.pop();
            for (auto nx:g[now]){
                if (d[nx] == 0){
                    q.push(nx);
                    d[nx] = d[now]+1;
                }
            }
        }
    };
    f(0);
    if (d[n-1] == 2) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    
    return 0;
}

Measured memory_bytes: 14576
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;

const int mod = 1e9+7;
const int N = 6e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;

int main() {
    int n; cin>>n;
    rep(i, 0, n+1) {
        db tmp = i * 1.08;
        int cur;
        //if(tmp >= (int)tmp + 0.5) cur = ceil(tmp);
        //else cur = floor(tmp);
        cur = floor(tmp);
        //dd(tmp);de(cur);
        if(cur==n) {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int a = in.nextInt();
    		int b = in.nextInt();
    		int h = in.nextInt();
    		out.println((a + b) * h / 2);
    	}
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 22484
def warshall_floyd(n, d):
    for i in range(n):
        for j in range(n):
            for k in range(n):
                d[j][k] = min(d[j][k], d[j][i] + d[i][k])


INF = float('inf')

H, W = map(int, input().split())
S = [input() for _ in range(H)]

N = H * W
d = [[INF] * N for _ in range(N)]
for k in range(N):
    d[k][k] = 0

for y in range(H):
    for x in range(W):
        if S[y][x] == '#':
            continue
        if y - 1 >= 0 and S[y - 1][x] != '#':
            d[y * W + x][(y - 1) * W + x] = 1
        if y + 1 < H and S[y + 1][x] != '#':
            d[y * W + x][(y + 1) * W + x] = 1
        if x - 1 >= 0 and S[y][x - 1] != '#':
            d[y * W + x][y * W + x - 1] = 1
        if x + 1 < W and S[y][x + 1] != '#':
            d[y * W + x][y * W + x + 1] = 1

warshall_floyd(N, d)

result = 0 
for i in range(N):
    for j in range(N):
        if d[i][j] != INF and d[i][j] > result:
            result = d[i][j]

print(result)


Measured memory_bytes: 133676
using System;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var ABC = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        var (A, B, C) = (ABC[0], ABC[1], ABC[2]);

        WriteLine($"{C} {A} {B}");
    }
}


Measured memory_bytes: 28228
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n, k);
	map< int, int > mp;
	REP(i, n) {
		VAR(int, a, b);
		mp[a] += b;
	}
	int cnt = 0;
	EACH(mi, mp) {
		cnt += mi.second;
		if (cnt >= k) {
			OUT(mi.first)BR;
			break;
		}
	}
  
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    int x;
    cin >> x;
    int a = 2 * (x / 11);
    if (x % 11 == 0) ;
    else if (x % 11 <= 6) a++;
    else a += 2;
    cout << a << endl;
}


Measured memory_bytes: 256
using System;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            double lineA = double.Parse(data[0]);
            double lineB = double.Parse(data[1]);
            double angelC = double.Parse(data[2]);

            double area = 0.5 * lineA * lineB * Math.Sin(angelC * Math.PI / 180);
            double lineAll = lineA + lineB + Math.Sqrt(Math.Pow(lineA, 2.0) + Math.Pow(lineB, 2) - 2 * lineA * lineB * Math.Cos(angelC * Math.PI / 180));
            double h = lineB * Math.Sin(angelC * Math.PI / 180);

            Console.WriteLine(area.ToString("F8"));
            Console.WriteLine(lineAll.ToString("F8"));
            Console.WriteLine(h.ToString("F8"));
        }
    }
}

Measured memory_bytes: 9436
#!/usr/bin/env python3
import sys

def is_p(n):
    if n == 2:
        return True
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

def solve(N: int):
    primes = []
    for i in range(3, 55556):
        if is_p(i) and i % 5 == 3:
            primes.append(i)
        if len(primes) >= N:
            break
    #print(len(primes)) # 5637
    print(' '.join([str(p) for p in primes]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int A, B, C, D, E;
	cin >> A >> B >> C >> D >> E;
	
	int ans = 0;
	if (A < 0) {
		ans += -A * C;
		A = 0;
	}
	if (A == 0) {
		ans += D;
	}
	ans += (B - A) * E;
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n, MAX;
vector<double> v;
double dp[3005][3005];


double prob(int numero_coroa, int pos)
{
	if(dp[numero_coroa][pos] >= 0)
		return dp[numero_coroa][pos];

	if(pos >= n)
		return 1;

	if(numero_coroa == MAX)
	{
		return dp[numero_coroa][pos] = v[pos] * prob(numero_coroa, pos + 1);
	}

	double soma = 0.00;

	soma += v[pos] * prob(numero_coroa, pos + 1);

	soma += (1.00 - v[pos]) * prob(numero_coroa + 1, pos + 1);


	return dp[numero_coroa][pos] = soma;
}





int main()
{

	cin >> n;


 	memset(dp, -1, sizeof(dp));
 
 	double num1;
 	for (int i = 0; i < n; ++i)
 	{
 		cin >> num1;
 		v.push_back(num1);
 	}
 	
 	MAX = n/2;

 	cout << fixed << setprecision(10) << prob(0, 0) << endl;


 
    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

int A[pow10(5) * 2];

void solve()
{
    map<int, int> cnt;
    int N;
    cin >> N;
    LL ans_base = 0;

    REP0 (i, N)
    {
        int a;
        cin >> a;
        A[i] = a;
        cnt[a]++;
    }

    for (auto p : cnt)
    {
        LL n = p.second;
        ans_base += n * (n - 1) / 2;
    }

    REP0 (i, N)
    {
        int a = A[i];
        LL n = cnt[a];
        cout << ans_base - n * (n - 1) / 2 + (n - 1) * (n - 2) / 2 << endl;
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


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

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int n;
    cin >> n;
    cout << n/3 << "\n";
    
    return 0;
}

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

int main()
{
	int mat[3][3];
	for ( int i = 0; i < 3; i++ ) {
		cin >> mat[i][0] >> mat[i][1] >> mat[i][2];
	}
	int diff1 = mat[0][1] - mat[0][0], diff2 = mat[0][2] - mat[0][1];
	if ( mat[1][1] - mat[1][0] == diff1 && mat[1][2] - mat[1][1] == diff2 &&
		 mat[2][1] - mat[2][0] == diff1 && mat[2][2] - mat[2][1] == diff2    ) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return ( 0 );
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int n,k,c,dp[200005],mx[200005];
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k>>c>>s;
    s=' '+s;
    for(int i=n;i>=1;i--)
    {
        if(s[i]=='o')
            dp[i]=1+mx[min(n+1,i+c+1)];
        else
            dp[i]=mx[i+1];
        mx[i]=max(dp[i],mx[i+1]);
    }
    int lst=1;
    int mxr=k;
    deque<int> v;
    while(mxr)
    {
        for(int i=lst;i<=n;i++)
        {
            if(s[i]=='o'&&dp[i]>=mxr)
                v.push_back(i);
            if(mx[i]<mxr)
            {
                lst=i;
                break;
            }
        }
        if(v.size()==1)
            cout<<v[0]<<'\n';
        if(v.size())
            lst=max(lst,v[0]+c+1);
        int prv=v[0];
        while(!v.empty()&&prv+c+1>v[0])
            v.pop_front();
        mxr--;
    }
    return 0;
}


Measured memory_bytes: 3408
#include <bits/stdc++.h>
    #define M 1000000007
    #define U 998244353
    #define int long long
    #define sz(c) (int)c.size()
    #define fr first
    #define ll long long 
    #define sc second
    #define pb push_back
    #define ppb pop_back
    #define mp make_pair
    #define all(a) (a).begin(),(a).end()
    #define rep(i,a,n) for(int i=a ; i<n ; i++)
    #define r0 return 0;
    #define N 1000005
    #define U 998244353
    #define bs binary_search
    #define endl '\n'
    #define FILEIO     freopen("input.txt","r",stdin); freopen("output.txt","w", stdout);
    #define PI 3.1415926535
    #define INF LLONG_MAX-5
    using namespace std;
    int po(int n, int exp){
        int prod=1;
        rep(i,0,exp)
            prod*=n;
        return prod;
    }

    set<int> Divisors(int n) 
    { 
        set<int> ans;
        for (int i=2; i<=sqrt(n); i++) 
        {
            if (n%i == 0) 
            {
                if (n/i == i) 
                    ans.insert(i);
                else
                {
                    ans.insert(i);
                    ans.insert(n/i);
                }
            } 
        } 
        return ans;
    } 
    int power(int x, unsigned int y, unsigned int m)
    {
        if (y == 0)
            return 1;
        int p = power(x, y/2, m) % m;
        p = (p * p) % m;
        return (y%2 == 0)? p : (x * p) % m;
    }
    int gcd(int a, int b, int &x, int &y) {
        if (a == 0) {
            x = 0; y = 1;
            return b;
        }
        int x1, y1;
        int d = gcd(b%a, a, x1, y1);
        x = y1 - (b / a) * x1;
        y = x1;
        return d;
    }
    signed main()
    {
        ios_base::sync_with_stdio(0);
        // cin.tie(0);
        // cout.tie(0);
        int TESTS=1;
        // cin>>TESTS;
        while(TESTS--)
        {   
            int n;
            cin>>n;
            int a[n];
            rep(i,0,n){
                cin>>a[i];
            }
            int cur = 0;
            rep(i,0,n){
                if(i%2==0) cur +=a[i];
                else cur -= a[i];
            }
            rep(i,0,n){
                cout<<cur<<" ";
                cur = 2*a[i] - cur;
            }
        }   
    }       


Measured memory_bytes: 2176
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
        
        if ( A == 0 ){
            System.out.println( 10 );
        } else{
            System.out.println( (X / A) * 10 );
        }

    }
}


Measured memory_bytes: 21716
# -*-coding:utf-8

import fileinput
import math

def main():
    allCard = cardPool()

    n = int(input())

    for i in range(n):
        a, b = input().split()
        allCard.remove(a + ' ' + b)

    for i in allCard:
        print(i)


def cardPool():
    mark = ['S', 'H', 'C', 'D']
    cards = []

    for i in mark:
        for j in range(1, 14):
            cards.append(i + ' ' + str(j))

    return cards

if __name__ == '__main__':
    main()

Measured memory_bytes: 7820
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
bool compare_by_b(pair<string, int> a, pair<string, int> b) {
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first < b.first;
    }
}
signed main(){
  int x=0,y=0,z=0,w=0,n=0;
std::cin >> x;
std::vector<int> v(x);
rep(i,x)std::cin >> v[i];
std::vector<int> dp(x,INF);
dp[0]=0;
repone(i,x){
  dp[i]=min(dp[i],dp[i-1]+abs(v[i]-v[i-1]));
  if(i>1)dp[i]=min(dp[i],dp[i-2]+abs(v[i]-v[i-2]));
}
std::cout << dp[x-1] << '\n';
}


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



int main() {
  int n;
  cin>>n;
  
  const int64_t div=1000000007;
  
  
  if(n<=1){
    cout<<0<<endl;
    return 0;
  }

  int64_t a1=1;//全部

  rep(i,n){
    a1*=10;
    a1%=div;
  }
  //cout<<a1<<endl;

  int64_t a2=1;//0も9も入ってない
  rep(i,n){
    a2*=8;
    a2%=div;
  }
  //cout<<a2<<endl;

  int64_t a3=1;//0or9が入ってない
  rep(i,n){
    a3*=9;
    a3%=div;
  }

  //cout<<a3<<endl;
  int64_t a4=a3*2%div;
  int64_t ans=(a1-(a4-a2)%div)%div;
  if(ans<=0)ans+=div;
 
  cout<<ans<<endl;

  
  return 0;

}



Measured memory_bytes: 3580
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int cnt[3];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    mem(cnt,0);
    
    int N,A,B;
    cin>>N>>A>>B;
    
    rep(i,N){
        int x; cin>>x;
        if(x<=A){
            cnt[0]++;
        }else if(x<=B){
            cnt[1]++;
        }else{
            cnt[2]++;
        }
    }
    
    cout1(min(cnt[0],min(cnt[1],cnt[2])))
}

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

int main() {
    int n, k; cin >> n >> k;
    map<int, int> m;
    rep(i, n){
        int x; cin >> x;
        m[x]++;
    } 
    vector<int> s;
    for(auto a: m){
        s.push_back(a.second);
    }
    sort(s.begin(), s.end());

    int ans = s.size();
    int cnt = 0;
    dump(ans);
    for(int i=0; i<s.size(); i++){
        dump(s.at(i));
        if(ans>k){
            ans--; 
            cnt += s.at(i);
        }
        else{
            cout << cnt << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 10748
using System;
using System.Linq;
public class Hello{
    public static void Main()
    {
        // Your code here!
        int[] s = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int A = s[0];
        int B = s[1];
        int C = s[2];
        int D = s[3];
        int ans = -1;
        if(Math.Max(A, C) <= Math.Min(B, D))
        {
            ans = Math.Min(B, D) - Math.Max(A, C);
        }
        else
        {
            ans = 0;
        }
        
        Console.WriteLine(ans);
    }
}

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

int main() {
  string s, ans = "";
  cin >> s;
  for (auto c : s) {
    if (c == 'B') {
      if (!ans.empty()) {
        ans.pop_back();
      }
    } else {
      ans.push_back(c);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

def gcd(a,b):
  aa=max(a,b)
  bb=min(a,b)
  return gcd(bb,aa%bb) if bb else aa
  

left=[]
right=[]
for i in range(0,n):
  j=n-i-1
  if left:
    hahaha=gcd(left[i-1],a[i])
    left.append(hahaha)
  else:
    left.append(a[i])
  if right:
    hahaha=gcd(right[i-1],a[j])
    right.append(hahaha)
  else:
    right.append(a[j])
    
keep=0
for i in range(0,n):
  if i==0:
    temp=right[-2]
  elif i==n-1:
    temp=left[-2]
  else:
    temp=gcd(left[i-1],right[n-i-2])
  if temp>keep:
    keep=temp

print(keep)
    

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

int N;
int d[110];

int main()
{
        cin >> N;
        for(int i=0;i<N;i++){
                cin >> d[i];
        }

        sort(d,d+N,greater<int>());

        int ans = 1;
        for(int i=1;i<N;i++){
                if(d[i-1]>d[i]){
                        ans += 1;
                }
        }
        cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    if (a == 1) {
      a += 13;
    }
    
    int b = sc.nextInt();
    if (b == 1) {
      b += 13;
    }
    
    if (a > b) {
      System.out.println("Alice");
    } else if (a == b) {
      System.out.println("Draw");
    } else {
      System.out.println("Bob");
    }

  }
}

Measured memory_bytes: 35652
i,p[1000],P;M(int*a){return*1[&a]-*a;}main(n,m){for(;scanf("%d%d",&n,&m)*n;P=!printf("%d\n",P)){for(i=n;i--;P+=p[i])scanf("%d",p+i);qsort(p,n,4,M);for(i=m-1;i<n;i+=m)P-=p[i];}}

Measured memory_bytes: 0
/*
 * Author:  heyuhhh
 * Created Time:  2020/5/13 21:33:20
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5;

void run() {
    ll n; cin >> n;
    vector <ll> d;
    for (int i = 2; 1ll * i * i <= n; i++) {
        if (n % i == 0) {
            d.push_back(i);
            if (n / i != i) d.push_back(n / i);
        }
    }
    d.push_back(n);
    sort(all(d));
    --n;
    vector <ll> d2;
    for (int i = 2; 1ll * i * i <= n; i++) {
        if (n % i == 0) {
            d2.push_back(i);
            if (n / i != i) d2.push_back(n / i);
        }
    }
    if (n != 1) d2.push_back(n);
    ll ans = sz(d2);
    ++n;
    for (auto x : d) {
        ll now = n;
        while (now >= x && now % x == 0) {
            now /= x;
        }
        now %= x;
        if (now == 1) ++ans;
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

Measured memory_bytes: 3656
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
D = rl()

D.sort()

if N % 2 == 1:
	print(0)
	exit()

d1 = D[N//2-1]
d2 = D[N//2]
if d1 == d2:
	print(0)
	exit()

print(d2-d1)


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

using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());


signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    int have = x;
    x *= 4;
    x -= y;
    if (x <  0 ||  x % 2 != 0) {
        cout << "No" << endl;
    } else {
        x /= 2;
        if(x > have){
            cout << "No" << endl;
        }
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){    
  ll N;
  cin >> N;
  if(N / 10 == 9 || N % 10 == 9) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, m; 
    while(cin >> n >> m, n || m) {
        int t[100010], s[100010], d[100010];
        int s2[100010], d2[100010];
        memset(s2, -1, sizeof(s2));
        memset(d2, -1, sizeof(d2));
        map<int, int> mp;
        rep(i,0,m) {
            cin >> t[i] >> s[i] >> d[i];
            mp[t[i]];
        }

        int num = 0;
        for(auto &x : mp) x.sc = num++;
        rep(i,0,m) {
            // printf("t[%lld] = %lld, mp[t[i]] = %lld\n", i, t[i], mp[t[i]]);
            s2[ mp[ t[i] ] ] = s[i];
            d2[ mp[ t[i] ] ] = d[i];
        }

        bool infect[100010] = {};
        infect[1] = true;
        rep(i,0,100010) {
            if(s2[i] == -1) continue;
            if(infect[ s2[i] ]) {
                infect[ d2[i] ] = true;
            }
        }
        int ans = 0;
        rep(i,0,100000) {
            if(infect[i]) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 6440
#include<bits/stdc++.h>
#define int long long int
using namespace std;

#undef int
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
#define int long long int
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t = 1;
	//cin >> t;
	while (t--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int i = 0;
		int flag = 2;
		while (1) {
			if (a <= 0) {
				flag = 0;
				break;
			}
			if (c <= 0) {
				flag = 1;
				break;
			}
			if (i % 2 == 0) {
				c = c - b;
			}
			else
				a = a - d;
			i++;
		}
		if (flag == 0)
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
	}
	return 0;
}

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

const int MAX_N = 1006;
int X,Y,Z,K;
ll A[MAX_N],B[MAX_N],C[MAX_N];

void solve()
{
	sort(A,A+X,greater<ll>());
	sort(B,B+Y,greater<ll>());
	sort(C,C+Z,greater<ll>());
	vector<ll> v;
	for(int i=0;i<X;++i)for(int j=0;j<Y;++j){
		v.push_back(A[i]+B[j]);
	}
	sort(v.rbegin(), v.rend());
	vector<ll> ans;
	for(int i=0;i<min((int)v.size(), K);++i){
		for(int j=0;j<Z;++j) ans.push_back(v[i]+C[j]);
	}
	sort(ans.rbegin(),ans.rend());
	for(int i=0;i<K;++i) cout<<ans[i]<<'\n';
}

int main()
{
	cin >> X >> Y >> Z >> K;
	for(int i=0;i<X;++i) cin >> A[i];
	for(int i=0;i<Y;++i) cin >> B[i];
	for(int i=0;i<Z;++i) cin >> C[i];
	solve();
	return 0;
}

Measured memory_bytes: 44096
#include "stdio.h"

int main(void){
    int n;
    scanf("%d", &n);
    int a[3];
    a[0] = n%10;
    a[1] = n/10%10;
    a[2] = n/100;
    for(n=2; n>-1; n--){
        if(a[n] == 9)
            printf("1");
        if(a[n] == 1)
            printf("9");
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int x,y;
    cin>>k>>n;
    vi a(2*n);
    rep(i,0,n) cin>>a[i],a[i+n]=a[i];
    vi dist;
    rep(i,1,2*n)
    {
        if(i==n)
        {
            dist.pb(a[n]+k-a[n-1]);
            continue;
        }
        dist.pb(abs(a[i]-a[i-1]));
    }
    vi pre;
    pre.pb(0);
    l=0;
    int ans=INF;
    // vout(dist)cout<<"\n";
    rep(i,0,sz(dist))
    {
        sum+=dist[i];
        count++;
        if(count>=n-1)
        {
            ans=min(ans,sum);
            sum-=dist[l];
            l++;
        }
        // cout<<sum<<" ";
    }
    // cout<<"\n";
    cout<<ans;
    return;
    vout(pre);
    rep(i,n-1,sz(pre))
    {

    }
}
 
 
signed main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        // if(t)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 10524
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<i64> s(n);
    for (int i = 0; i < n; i++) {
        std::cin >> s[i];
    }
    i64 ret = 0;
    for (int d = 1; d < n; d++) {
        i64 c = 0;
        int l = 0, r = n - 1;
        while (1) {
            l += d;
            r -= d;
            if ((l >= r && r % d == 0) || r < d || l >= n - 1) break;
            c += s[l] + s[r];
            ret = std::max(ret, c);
        }
    }
    std::cout << ret << std::endl;

    return 0;
}


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

int main() {
  int X, A, B;
  cin >> X >> A >> B;
  if (A >= B) {
    cout << "delicious";
  }
  else if (B - A <= X) {
    cout << "safe";
  }
  else {
    cout << "dangerous";
  }
  
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int n,m,x;
int cnt=0,cnt1=0;
cin>>n>>m>>x;
int a[202]={};
for(int i=0;i<m;i++)
{
 int b;
 cin>>b;
 a[b]++;
}
for(int i=x;i<n;i++)
if(a[i]!=0)
cnt++;
for(int i=x;i>0;i--)
if(a[i]!=0)
cnt1++;
cout<<min(cnt,cnt1);
system("pause");
return 0;
}

Measured memory_bytes: 504