akhauriyash/Code-Regression huggingface dataset:
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long L, R, D;
    scan(L, R, D);
    long ans;
    foreach (x; L .. R + 1)
    {
        if (x % D == 0)
        {
            ans++;
            // writeln(x);
        }
    }
    writeln(ans);
}


Measured memory_bytes: 3724
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <math.h>
#include <deque>
#include <queue>
#include <map>
#include <iterator>
#include <set>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

const int mxV = 10009;
const int mxE = 100009;
vector<int> G[mxV];
int in[mxV];

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

	int v, e;
	cin >> v >> e;
	fill(in, in + v, 0);
	for (int i = 0; i < e; i++) {
		int a, b;
		cin >> a >> b;
		G[a].push_back(b);
		in[b]++;
	}

	queue<int> Q;
	for (int i = 0; i < v; i++) {
		if (in[i] == 0) {
			Q.push(i);
		}
	}

	vector<int> ans;

	while (!Q.empty()) {
		int p = Q.front();
		Q.pop();

		for (auto e : G[p]) {
			in[e]--;
			if (in[e] == 0) {
				Q.push(e);
			}
		}

		ans.push_back(p);
	}

	for (auto e : ans) {
		cout << e << endl;
	}

}


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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

int wa (int n){
    int ans = 0;
    while(n != 0){
        ans += n % 10;
        n /= 10;
    }
    return ans;
}

void solve()
{
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(a <= wa(i) && wa(i) <= b) ans+=i;
    }
    cout << ans << "\n";
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define INF 10000000000

ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s;

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

    cin >> a >> b >> x;
    rep(i, a, min(b + 1, a + x)){
        cout << i << endl;
    }
    rep(i, max(a + x, b - x + 1), b + 1){
        cout << i << endl;
    }
}



Measured memory_bytes: 256
function Main(input){
	input = input.split("\n")[0].split(" ");
  var a = ~~input[0];
  if(a == 7)return "YES";
  if(a == 5)return "YES";
  if(a == 3)return "YES";
  return "NO";
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
8 4
9 1 8 2 7 5 6 4
`);

Measured memory_bytes: 21064
#include<stdio.h>

int main(void)


{


  int a,b,c,i,x;


  x=0;


  scanf("%d %d %d",&a,&b,&c);


  for(i=a;i<=b;i++){


    if(c%i==0){


        x++;


    }


  }


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


  return 0;


}

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

int main() {
    int R, G, B;
    scanf("%d%d%d", &R, &G, &B);
    int number = R*100 + G*10 + B;
    if(number % 4 == 0) {
        printf("YES");
    } else {
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; 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 ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

void dfs(int v, int p, vector<int> &ans, vector<vector<int>> &g) {
    for(int u : g[v]) {
        if(u==p) continue;
        ans[u] += ans[v];
        dfs(u, v, ans, g);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    vector<vector<int>> g(n);
    REP(i,n-1) {
        int a,b; cin >> a >> b; a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> ans(n,0);
    REP(i,q) {
        int p,x; cin >> p >> x; p--;
        ans[p] += x;
    }
    dfs(0,-1,ans,g);
    REP(i,n) {
        if(i==n-1) cout << ans[i] << endl;
        else cout << ans[i] << " ";
    }
    return 0;
}


Measured memory_bytes: 29824
n,m=map(int,input().split())
divisors = []
for i in range(1, int(m**0.5)+1):
    if m % i == 0:
        divisors.append(i)
        if not i**2==m:
            divisors.append(m//i)
divisors.sort(reverse=True)
for i in divisors:
    if m//i>=n:
        print(i)
        break


Measured memory_bytes: 38640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1e5+5;
int n,m,sz[N*3],rm_c[N*3];
lint rm_d[N*3];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x>y?x=y:0;}
	template <class T> inline void apx(T &x,const T y){x<y?x=y:0;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

void add(const int fr,const int to){
	++sz[fr+1];
	++rm_c[to];
	rm_d[to]+=to-fr-1;
}

int main(){
	m=nxi(),n=nxi();
	lint tot=0,ans=1e15;
	for(int lst=nxi(),cur=0,i=2; i<=m; ++i,lst=cur){
		cur=nxi();
		if(lst<cur){
			add(lst+n,cur+n);
			tot+=cur-lst;
		}
		else{
			add(lst,cur+n);
			add(lst+n,cur+(n<<1));
			tot+=cur+n-lst;
		}
	}
	for(int i=1,s=0; i<=n*2; ++i){
		tot-=s;
		tot+=rm_d[i-1];
		s+=sz[i]-rm_c[i];
		apn(ans,tot);
	}
	printf("%lld\n",ans);
	return 0;
}


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

#define en "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fs first
#define sc second
#define size(a) (int) a.size()
#define deb(x) cerr << #x << " => " << x << en
#define debp(a) cerr << #a << " => " <<"("<<a.fs<<", "<<a.sc<<") " << en;
#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
#define debpa(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)
int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) fastpow(a, HELL - 2)
#define mul(a, b) ((a % HELL) * (b % HELL)) % HELL

vector<pii> primeFactors(int n) {
    vector<pii> factorization;
    int ct = 0;
    while (n % 2 == 0) {
        n /= 2;
        ct++;
    }
    if (ct) {
    	factorization.pb({ 2, ct });
    }
    for (int d = 3; d * d <= n; d += 2) {
        ct = 0;
        while (n % d == 0) {
        	ct++;
            n /= d;
        }
        if (ct) {
        	factorization.pb({ d, ct });
        }
    }
    if (n > 1)
        factorization.push_back({ n, 1 });
    return factorization;
}

int32_t main() { fastio;
	int n; cin >> n;
	vector<pii> fcts = primeFactors(n);
	int res = 0;
	for (auto f : fcts) {
		int num = 1;
		int ct = f.sc;
		while (ct >= num) {
			ct -= num;
			res++;
			num++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3652
s = gets.chomp.split('')
q = gets.to_i
rev = 0
q.times do
  qu = gets.split
  if qu[0] == '1'
    rev = rev == 0 ? 1 : 0
  elsif qu[0] == '2'
    if rev.zero?
      s.unshift(qu[2]) if qu[1] == '1'
      s.push(qu[2]) if qu[1] == '2'
    else
      s.push(qu[2]) if qu[1] == '1'
      s.unshift(qu[2]) if qu[1] == '2'
    end 
  end
end
if rev.zero?
  puts s.join('')
else
  puts s.reverse.join('')
end

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin>>N;
    map<ll,int> mp;
    REP(i,N) {
        ll a;
        cin>>a;
        if (mp.find(a)!=mp.end()) mp[a]++;
        else mp[a] = 1;
    }
    ll ans = 0;
    for (auto x:mp) {
        if (x.second%2 == 1) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6528
A = list(map(int,input().split()))
A456 = list(map(int,input().split()))
A789 = list(map(int,input().split()))
A.extend(A456)
A.extend(A789)
N = int(input())
B = []
for i in range(N):
    b = int(input())
    B.append(b)
for i in range(9):
    for u in range(N):
        if A[i] == B[u]:
            A[i] = 0
if A[0] + A[1] + A[2] == 0 or  A[3] + A[4] + A[5] == 0 or A[6] + A[7] + A[8] == 0 :
    print("Yes")
elif A[0] + A[3] + A[6] == 0 or A[1] + A[4] + A[7] == 0 or A[2] + A[5] + A[8] == 0:
    print("Yes")
elif A[0] + A[4] + A[8] == 0 or A[2] + A[4] + A[6] == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

ll dp[61][3];

void add(ll &a, ll b){
    a = (a+b) % mod;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;
    cin>>n;
    string s="";
    ll cn=n;
    while(cn>0){
        if((cn&1)==0){
            s=s+"0";
        }
        else{
            s=s+"1";
        }
        cn>>=1;
    }
    int d=s.length();
    dp[d-1][0]=1;
    dp[d-1][1]=1;

    for(int i=d-2;i>=0;i--){
        int sdi=s[i]-'0';
         for(int sd=0; sd<=2; sd++){
            for(int k=0; k<=2; k++){
                int s2 = min(2, 2*sd + sdi - k);
                if(s2 >= 0) add(dp[i][s2], dp[i+1][sd]);
            }
        }
    }

    long long ans = (dp[0][0] + dp[0][1] + dp[0][2]) % mod;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

char s[200000][11];
int ix[200000];
int ans[200000];

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

    int al = 0;
    char ch;
    int len;
    for (int i = 0; i < n; ++i)
    {
       ix[i] = i;
       len = 0;
       while ((ch = getchar()) != '\n')
       {
           s[i][len++] = ch;
       }
       s[i][len] = 0;
    }

    for (int gap = n/2; gap > 0; gap /= 2)
    {
        for (int i = gap; i < n; ++i)
        {
            for (int j = i - gap; j >= 0 && strcmp(s[ix[j]], s[ix[j+gap]]) > 0; j -= gap)
            {
                swap(ix[j], ix[j+gap]);
            }
        }
    }

    int mv = 0;
    al = 0;
    int c = 1;

    for (int i = 1; i < n; ++i)
    {
        if (strcmp(s[ix[i-1]], s[ix[i]]) == 0)
        {
            c++;
        }
        else
        {
            if (c > mv)
            {
                mv = c;
                al = 1;
                ans[0] = ix[i-1];
            }
            else if (c == mv)
            {
                ans[al++] = ix[i-1];
            }

            c = 1;
        }
    }

    if (c > mv)
    {
        al = 1;
        ans[0] = ix[n-1];
    }
    else if (c == mv)
    {
        ans[al++] = ix[n-1];
    }

    for (int i = 0; i < al; ++i)
    {
        cout << s[ans[i]] << "\n";
    }
    return 0;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;

/*
#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
*/
 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-12;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
//#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////

int main(){fastio
    ll n,q;cin>>n>>q;
    dsu uf(n);
    while(q--){
        ll a,b,c;cin>>a>>b>>c;
        if(a==0){
            uf.merge(b,c);
        }else{
            cout<<(uf.same(b,c)?1:0)<<endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3936
#include<cstdio>
int main() {
	long long n, m, ans;
	scanf("%lld%lld", &n, &m);
	if (n == 1 && m == 1)ans = 1;
	else if (n == 1) ans = m - 2;
	else if (m == 1)ans = n - 2;
	else ans = (n - 2)*(m - 2);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k,a,b,t;
  cin>>k>>a>>b;
  string str="NG";
  t=k;
  while(true){
    if(a<=t && t<=b){
      str="OK";
      break;
    }
    if(b<t){
      break;
    }
    t=t+k;
  }
  cout<<str;
}

Measured memory_bytes: 3624
n = int(input())
dp = [i for i in range(n + 2)]
for i in range(n + 1):
    pow = 6
    while i + pow <= n + 1:
        dp[i + pow] = min(dp[i + pow], dp[i] + 1)
        pow *= 6
    pow = 9
    while i + pow <= n + 1:
        dp[i + pow] = min(dp[i + pow], dp[i] + 1)
        pow *= 9
# print(dp)
print(dp[n])

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


def solve(N: int, M: int, L: "List[int]", R: "List[int]"):
    l = sorted(L)
    r = sorted(R)
    ret = max(0, r[0] - l[-1] + 1)
    print(ret)
    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
    M = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]" 
    R = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
    solve(N, M, L, R)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12840
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct UnionFind {
    vector<int> par;
    int cnt;
    UnionFind(int size_) : par(size_, -1), cnt(size_) {}
    void unite(int x, int y) {
        if ((x = find(x)) != (y = find(y))) {
            if (par[y] < par[x]) swap(x, y);
            par[x] += par[y]; par[y] = x; cnt--;
        }
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
    int size(int x) { return -par[find(x)]; }
    int size() { return cnt; }
};

struct Edge {
    int src, dst, weight;
    Edge(int s, int d, int w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

int n, m;
Graph g;

bool check(int l, int r) {
    UnionFind uf(g.size());
    for (auto &es : g) {
        for (auto &e : es) {
            if (l <= e.weight && e.weight <= r) {
                uf.unite(e.src, e.dst);
            }
        }
    }
    return uf.size() == 1;
}

int solve() {
    int ans = 1e9;
    for (int i = 0; i <= 10000; ++i) {
        int lb = i - 1;
        int ub = 10001;
        while (lb + 1 < ub) {
            int mid = (ub + lb) / 2;
            if (check(i, mid)) {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        if (ub != 10001) {
            ans = min(ans, ub - i);
        }
    }
    return ans == 1e9 ? -1 : ans;
}

signed main() {
    while (cin >> n >> m && n) {
        g.assign(n, {});
        for (int i = 0; i < m; i++) {
            int a, b, w;
            cin >> a >> b >> w;
            --a, --b;
            g[a].emplace_back(a, b, w);
            g[b].emplace_back(b, a, w);
        }
        cout << solve() << endl;
    }
}

Measured memory_bytes: 3212
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

#define EPS 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
	public:
	double x, y;

	Point(double x = 0, double y = 0): x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(a * x, a * y); }
	Point operator / (double a) { return Point(x / a, y / a); }

	double abs() { return sqrt(norm()); }
	double norm() { return x * x + y * y; }

	bool operator < (const Point &p) const {
		return x != p.x ? x < p.x : y < p.y;
	}

	bool operator == (const Point &p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};

typedef Point Vector;

double cross(Vector a, Vector b) {
	return a.x*b.y - a.y*b.x;
}

double xa, ya, xb, yb, xc, yc, xd, yd;
char comma;

int main()
{
	while (cin>>xa>>comma>>ya>>comma>>xb>>comma>>yb>>comma>>xc>>comma>>yc>>comma>>xd>>comma>>yd)
	{
		Point a(xa, ya);
		Point b(xb, yb);
		Point c(xc, yc);
		Point d(xd, yd);

		Vector ab = b - a;
		Vector bc = c - b;
		Vector cd = d - c;
		Vector da = a - d;

		if (cross(ab, bc) > EPS)
		{
			//反時計回り
			if (cross(bc, cd) > EPS && cross(cd, da) > EPS && cross(da, ab) > EPS)
			{
				cout << "YES" << endl;
				continue;
			}
		} else if (cross(ab, bc) < -EPS) {
			//時計回り
			if (cross(bc, cd) < -EPS && cross(cd, da) < -EPS && cross(da, ab) < -EPS)
			{
				cout << "YES" << endl;
				continue;
			}
		}

		cout << "NO" << endl;
	}
	
	return 0;
}

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

int main (){
  int k, s;
  cin>>k>>s;
  int sum = 0;
  rep(x,k+1){
    rep(y,k+1){
      int z = s -(x+y);
      if (0<=z && z<=k && x + y + z == s){
        sum++;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
// 2015/06/01 Tazoe

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	while(true){
		char s[150];
		cin >> s;

		if(strcmp(s, "0")==0)
			break;

		int A = 0, B = 0;

		for(int i=1; s[i]!='\0'; i++){		// 最初のサーブは見ない
			if(s[i]=='A'){
				A++;
			}
			else{
				B++;
			}
		}

		if(A>B){		// 最後のポイントの処理
			A++;
		}
		else{
			B++;
		}

		cout << A << ' ' << B << '\n';
	}

	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

bool compare_by_second(pair<int, int> a, pair<int, int> b)
{
	if (a.second != b.second)return a.second < b.second;
	else return a.first < b.first;
}

int main()
{
	int n; cin >> n;
	vpii blue(n), red(n);
	rep(i, n)cin >> red[i].first >> red[i].second;
	rep(i, n)cin >> blue[i].first >> blue[i].second;
	sort(all(blue));
	sort(all(red), compare_by_second);
	reverse(all(red));
	int ans = 0;
	rep(i, n)
	{
		int c = blue[i].first;
		int d = blue[i].second;
		rep(i, n)
		{
			int a = red[i].first;
			int b = red[i].second;
			if (a < c && b < d)
			{
				ans++;
				red[i].first = 1000;
				red[i].second = 1000;
				break;
			}
		}
	}
	co(ans);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int A, B, C, K;

    scanf("%d %d %d %d", &A, &B, &C, &K);

    while(K--){
        if (A >= B && A >= C){
            A = A*2;
        } else if (B >= C){
            B = B*2;
        } else {
            C = C*2;
        }
    }

    printf("%d\n", A+B+C);

    return 0;
}

Measured memory_bytes: 1696
#include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	stack<int> s1;
	stack<pair<int, int>> s2;
	char temp;
	int sum = 0;
	for (int i = 0; (temp = getchar()) != '\n'; i++) {
		if (temp == '\\') s1.push(i);
		else if (temp == '/' && s1.size() > 0) {
			int j = s1.top(); s1.pop();
			int a = i - j;
			sum += a;
			while (s2.size() > 0 && s2.top().first > j)
			{
				a += s2.top().second; s2.pop();
			}
			s2.push(make_pair(j, a));
		}
	}
	vector<int> ans;
	while (s2.size()>0)
	{
		ans.push_back(s2.top().second);
		s2.pop();
	}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i = 0; i < ans.size(); i++)
	{
		cout << ' ' << ans[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3224
/**
 * File              : E-tutorial.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 27.01.2020
 * Last Modified Date: 27.01.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9+7;
vector<ll> primes;
vector<ll> used;
unordered_map<ll, int> mp;


ll power(ll base, ll pow) {
    ll res = 1;
    while (pow) {
        if (pow&1) {
            res *= base;
            res %= MOD;
        }
        base *= base;
        base %= MOD;
        pow >>= 1;
    }
    return res;
}
void sieve(ll _max) {
    vector<bool> nums(_max + 1);
    for (int i = 2; i <= _max; i++) {
        if (nums[i]) continue; 
        primes.push_back(i);
        for (ll j = i*1LL*i; j <= _max; j += i) {
            nums[j] = true; 
        }
    }
}

void update(ll x) {
    ll original = x;
    for (auto p: primes) {
        if (p *p > original ||x == 1) break;
        int val = 0;
        while (x > 1 && x % p == 0) {
            val++;
            x /= p;
        }
        if (val > 0)
            mp[p] = max(mp[p], val);
    }
    if (x != 1) mp[x] = max(mp[x], 1);
}
ll ans = 0;

void calc(ll x) {
    ll cur = 1;
    for (auto lcm : mp) {
        ll p = lcm.first;
        ll cnt = lcm.second;
        int val = 0;
        while (x > 1 && x % p == 0) {
            val++;
            x /= p;
        }
        cur *= pow(p, cnt-val);
        cur %= MOD;
    }
    ans += cur;
    ans %= MOD;
}

// x * modinv(d)
ll modd(ll x,ll d) {
    return x * power(d,MOD-2) % MOD;
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll _max = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        _max = max(_max, a[i]);
    }
    sieve(_max);
    for (int i = 0; i < n; i++)
        update(a[i]);
    ll _lcm = 1;
    for (auto x: mp) {
        _lcm *= power(x.first, x.second);
        _lcm %= MOD;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ans += modd(_lcm, a[i]);
        ans %= MOD;
    }
    cout << ans;

    return 0;
}


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

using namespace std;
#define Pi acos(-1)
#define _terminated return 0
#define endl "\n"
#define yes cout << "yes" << endl 
#define no cout << "no" << endl 
#define booster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<long> > v2l;

const int mod = 1e+5;
const int mx = 2e+5;
const ll inf = 1e18;

void upper_bubble_sort(){
     int i,j,temp,number_of_input;
     int array[100];
     cin >> number_of_input;
     for(i=0; i<number_of_input; i++)
         cin >> array[i];
         for(i=0; i<number_of_input; i++){
             for(j=0; j<(number_of_input-i-1); j++){
               if(array[j] > array[j+1]){
                 temp = array[j];
                 array[j] = array[j+1];
                 array[j+1] = temp;
                }
              }
         }
    for(i=0; i<number_of_input; i++)
      cout << array[i] << endl;
}
void bst(void){
          int low,high,mid,keynum,num,array[100];
          cin >> keynum;
          low = 1;
	         high = num;
         	do{
		        mid = (low + high) / 2;
		         if(keynum < array[mid])
			         high = mid - 1;
		         else if (keynum > array[mid])
			         low = mid + 1;
	         } 
          while (keynum != array[mid] && low <= high);
	        if(keynum == array[mid]){
            cout << "number located at " << mid +1 << endl;}
         else
           no;
}
     
void solvio(void){
     int a,b,c;
     cin >> a >> b >> c;
     if((a==5 && b==7 && c==5)||(a==5 && b==5 && c==7)||(a==7 && b==5 && c==5))
       cout << "YES" << endl;
     else
        cout << "NO" << endl;
}

int main(){
    booster;
    solvio();
    _terminated;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2004;
const int HA=1e9+7;
int n,k,ans;
int num[N],dd[N];
inline int ksm(int x,int y){
	int tmp=1;
	while(y){
		if(y&1)
			tmp=(tmp*x)%HA;
		x=(x*x)%HA;
		y>>=1;
	}
	return tmp%HA;
}
signed main(){
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&num[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++){
			if(num[j]<num[i])
				dd[i]++;
		}
	for(int i=1;i<=n;i++){
		ans=(ans+k*(k-1)%HA*ksm(2,HA-2)%HA*dd[i]%HA)%HA;
		int tdp = 0;
		for(int j=i+1;j<=n;j++)
			if(num[j]<num[i])
				tdp++;
		ans = ( ans + tdp * k ) % HA; 
	}	 
	printf("%lld\n",ans);
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DELTA 1.E-9

int main(){
    int a, b;
    cin >> a >> b;
    int k = a + b;
    if(k%2 == 0){
        cout << k/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    
    return 0;
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    int l;
    cin >> l;

    double a = (double)l/3;
    double ans = a*a*a;

    cout << setprecision(13) << ans << "\n";
    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

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

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define FOR(i, a, b)  for(int i=a; i<b; ++i)
#define rFOR(i, a, b) for(int i=a-1; i>=b; --i)
#define REP(i, n) for(int i=0; i<n; ++i)
#define rREP(i, n) for(int i=n-1; i>=0; --i)
#define all(a)  a.begin(), a.end()
#define MAXNUM 10000
using namespace std;



int main(){
  long long n;  cin >> n;
  long long a[MAXNUM];
  int ans = 0;
  REP(i, n)  cin >> a[i];
  REP(i, n){
    if(a[i]%2==0){
      while(true){
        a[i]/=2;
        ans++;
        if(a[i]%2!=0) break;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 384
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let h: Vec<u32> = parse_line().unwrap();
    let mut ans = 0;
    let mut cnt = 0;

    for i in 0..n - 1 {
        if h[i] >= h[i + 1] {
            cnt += 1;
        } else {
            ans = ans.max(cnt);
            cnt = 0;
        }
    }
    ans = ans.max(cnt);
    println!("{}", ans);
}


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) cin >> s[i];

    int cnt = 0;
    queue<pii> q;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                cnt++;
                q.push(pii(i,j));
            }
        }
    }
    if (cnt == h*w) {
        cout << 0 << endl;
        return 0;
    }

    auto f = [&] (int y, int x) {
        cnt++;
        s[y][x] = '#';
        q.push(pii(y, x));
    };
    for (int i = 1; 1; i++) {
        int j = q.size();
        for (int k = 0; k < j; k++) {
            int a = q.front().first;
            int b = q.front().second;
            q.pop();
            if (a>0)   if (s[a-1][b]=='.') f(a-1,b);
            if (a<h-1) if (s[a+1][b]=='.') f(a+1,b);
            if (b>0)   if (s[a][b-1]=='.') f(a,b-1);
            if (b<w-1) if (s[a][b+1]=='.') f(a,b+1);
        }
        if (cnt == h*w) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 13576
import java.util.*;

public class Main{
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<String> listA = new ArrayList<String>();
        
        for(int i=0; i<n; i++) {
            listA.add(sc.next());
        }
        List<String> listB = new ArrayList<String>(new LinkedHashSet<>(listA));

        System.out.println(listB.size());
	}
}

Measured memory_bytes: 76108
#include<stdio.h>

int main(void){
    int n,m,i,j,flag;
    char a,b;
    char sb[62]={0},sa[62]={0};

    while(scanf("%d%*c",&n),n!=0){
        for(i=0;i<n;i++){
            //for(scanf("%c",&b);b==' ';scanf("%c",&b));
            scanf("%c %c",&sb[i],&sa[i]);
            getchar();
            //for(scanf("%c",&b);b==' ';scanf("%c",&b));
        }
        scanf("%d%*c",&m);
        //for(scanf("%c",&b);b==' ';scanf("%c",&b));
        for(i=0;i<m;i++){
            flag=0;
            scanf("%c",&a);
            getchar();
            //for(scanf("%c",&b);b==' ';scanf("%c",&b));
            for(j=0;j<n;j++){
                if(sb[j]==a){
                    printf("%c",sa[j]);
                    flag=1;
                    break;
                }
            }
            if(!flag)printf("%c",a);
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 592
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//input
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type Node struct {
	key int
	p   *Node
	l   *Node
	r   *Node
}

var NIL *Node

var root *Node
var n int

func preorder(u *Node, l []int) []int {
	if u != NIL {

		//fmt.Printf(" %d", u.key)
		l = append(l, u.key)
		l = preorder(u.l, l)
		l = preorder(u.r, l)
	}
	return l

}

func inorder(u *Node, l []int) []int {
	if u != NIL {
		l = inorder(u.l, l)
		//fmt.Printf(" %d", u.key)
		l = append(l, u.key)
		l = inorder(u.r, l)
	}
	return l
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//挿入
func insert(v int) {
	var x, y *Node

	//x: 走査する初期値
	//y: xの親 = NIL
	x = root

	//z: 挿入するNode
	z := &Node{v, NIL, NIL, NIL}
	//zの親を求める
	for x != NIL {
		y = x
		if z.key < x.key {
			x = x.l
		} else {
			x = x.r
		}
	}

	z.p = y
	if y == NIL {
		root = z //木が空のときは、zをrootとする
	} else if z.key < y.key {
		y.l = z //zをyの左の子にする
	} else {
		y.r = z //zをyの右のことする
	}

}

//探索
func find(v int, u *Node) *Node {
	for u != NIL && v != u.key {
		if v < u.key {
			u = u.l
		} else {
			u = u.r
		}
	}
	return u
}

func main() {
	sc.Split(bufio.ScanWords)
	n = nextInt()
	for i := 0; i < n; i++ {
		verb := nextStr()
		if verb == "insert" {
			v := nextInt()
			insert(v)
		} else if verb == "print" {
			printList(inorder(root, []int{}))
			printList(preorder(root, []int{}))
		} else if verb == "find" {
			v := nextInt()
			t := find(v, root)
			if t != NIL {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		}
	}
	//fmt.Println(root)
}



Measured memory_bytes: 39308
fun main(args: Array<String>) {
//    val mod = 1000000007L
    val mod = 2019
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toLong).toMutableList()
    val B = readLine()!!.split(" ").map(String::toLong).toList()

    var ans = 0L

    for ((i,b) in B.withIndex()) {
        ans += Math.min(A[i]+A[i+1],b)
        if (b > A[i]) {
            A[i+1] -= b-A[i]
            if (A[i+1] < 0)
                A[i+1] = 0
        }
    }

    println(ans)
}

Measured memory_bytes: 85080
#include <bits/stdc++.h>
using namespace std;
#define repl(i,x,n) for(long long i=(long long)(x);i<(long long)(n);i++)
#define rep(i,x,n) for(long i=long(x);i<long(n);i++)
/*#define cin fin
#define cout fout
ifstream cin("input.in");ofstream cout("output.out");*/
int main() 
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s,p;
    cin>>s>>p;
    long n=s.size();
    for(long i=0;i<n;i++){
    	bool flag=1;
    	for(long j=0;j<n;j++)
    		if(s[j]!=p[(i+j)%n])
    			flag=0;
    	if(flag){
    		cout<<"Yes";
    		return 0;
    	}
    }
  	cout<<"No";
  	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define LL long long
#define MOD 1000000007
#define INF 2000000000
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
ll N, M, K,H,W, mi1,mi2,sum,B[100001],l[100000],r[100000],Q;
LL ans;
LL no;
bool b,bb[100001];
string s,t;

int main() {
	cin >> N>>M;
	priority_queue<LL> a;
	for (int i = 0; i < N; i++) {
		cin >> H;
		a.push(H);
	}
	for (int i = 0; i < M; i++) {
		K = a.top();
		a.pop();
		K = K / 2;
		a.push(K);
	}
	ans = 0;
	for (int i = 0; i < N; i++) {
		ans += a.top();
		a.pop();
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
		
	int n, k;
	cin >> n >> k;
	vi a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	vi dp(k + 1);
	dp[0] = 0;
	for(int i = 1; i <= k; i++) {
		for(int j:a) if(i - j >= 0 && dp[i - j] == 0) dp[i] = 1;
	}
	cout << (dp[k] ? "First" : "Second") << endl;

}



Measured memory_bytes: 3708
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N,A,B,C,D;
	scanf("%d %d %d %d %d",&N,&A,&B,&C,&D);

	int X_num,Y_num,X_sum,Y_sum;

	if(N%A == 0){
		X_num = N/A;
	}else{
		X_num = N/A+1;
	}

	X_sum = B*X_num;

	if(N%C == 0){
		Y_num = N/C;
	}else{
		Y_num = N/C+1;
	}

	Y_sum = D*Y_num;

	printf("%d\n",min(X_sum,Y_sum));

	return 0;
}



Measured memory_bytes: 3220
n=int(input())
a=list(map(int,input().split()))
a.insert(0,0)
a.append(0) #len(a)==n+2
n=len(a)
tot=0
for i in range(n-1):
    tot+=abs(a[i]-a[i+1])
tot2=0
for i in range(1,n-1):
    tot2+=abs(a[i]-a[i-1])+abs(a[i]-a[i+1])-abs(a[i-1]-a[i+1])
    print(tot-tot2)
    tot2=0


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

bool isPrime(const int64_t &v){
  for(int i=2;i<=(int)sqrt(v);i++){
    if(v%i==0){
      return false;
    }
  }
  return true;
}

int main(){
  int64_t N,v,count=0;
  cin >> N;

  for(int i=0;i<N;i++){
    cin >> v;
    if(isPrime(v)){
      count++;
    }
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 3068
while True:
    s = input().strip()
    if s == '#': break

    clauses = s.split('|')
    for clause in clauses:
        literals = clause[1:-1].split('&')
        ntil = clause.count('~')
        if ntil == 0 or ntil == 3:
            print('yes')
            break
        if ntil == 1:
            x = [v[1] for v in literals if v[0] == '~'][0]
            if clause.count(x) == 1:
                print('yes')
                break
        if ntil == 2:
            x = [v for v in literals if len(v) == 1][0]
            if clause.count(x) == 1:
                print('yes')
                break
    else:
        print('no')



Measured memory_bytes: 5580
#include <queue>
#include<iostream>
using namespace std;
int n,a,s[5];
priority_queue<int> q;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a,q.push(a);
    }
    for(int i=1;i<=n;i++)
    {
        a=q.top();
        q.pop();
        s[i&1]+=a;
    }
    cout<<s[1]-s[0];
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

using T = tuple<ll, int, int, int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

//          a*1000*1000 + b*1000 + c
// bool isUsed[1000][1000][1000]; // <- 10億要素あるからダメ
// set<int> UsedNumbers // 使った値だけを入れてあげる

int main () {
  int x, y, z;
  int K;
  cin >> x >> y >> z;
  cin >> K;
  vll a(x), b(y), c(z);

  rep(i,x) cin >> a[i];
  rep(i,y) cin >> b[i];
  rep(i,z) cin >> c[i];

  a.pb((ll)-1e17);
  b.pb((ll)-1e17);
  c.pb((ll)-1e17);

  RSORT(a);
  RSORT(b);
  RSORT(c);

  priority_queue<T> pq;
  pq.push((make_tuple(a[0]+b[0]+c[0],0,0,0)));

  // priority_queueに入れたかどうかを管理する
  set<int> s;
  s.insert(0);

  vll ans;
  while (ans.size() < K) {
    auto v = pq.top(); pq.pop();
    ans.pb(get<0>(v));

    rep(i,3) {
      int an = get<1>(v);
      int bn = get<2>(v);
      int cn = get<3>(v);
      if (i == 0) an++;
      if (i == 1) bn++;
      if (i == 2) cn++;
      // hashを作る_
      int hash = (an << 20) + (bn << 10) + cn;
      if (s.find(hash) == s.end()) {
        s.insert(hash);
        pq.push((make_tuple(a[an]+b[bn]+c[cn],an,bn,cn)));
      }
    }
  }

  rep(i,K) {
    printf("%lld\n", ans[i]);
  }
  
  return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>

int main(){
    int i,m,f,r;
    char d[50];
    i=0;
    while(!(m==-1&&f==-1&&r==-1)){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1){
            d[i]='G';
        }else if(m==-1||f==-1){
            d[i]='F';
        }else if(m+f>79){
            d[i]='A';
        }else if(m+f>64){
            d[i]='B';
        }else if(m+f>49){
            d[i]='C';
        }else if(m+f>29){
            d[i]=r>49? 'C':'D';
        }else{
            d[i]='F';
        }
        i++;
    }
    i=0;
    while(d[i]!='G'){
        printf("%c\n",d[i++]);
    }
    return 0;
}


Measured memory_bytes: 2048
main(){
    int n,a=100000; scanf("%d",&n);
    while(n--){
        a*=1.05;
        if(a%1000>0) a=(a/1000+1)*1000;
        else        a=a/1000*1000;
    }
    printf("%d\n",a);
    exit(0);
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;


long long f1 (int n, int arr[])
{
    long long ans = 0, sum = 0;
    for(int i=0; i<n; i++){
        sum += arr[i];
        if(i % 2) {
            if(sum <= 0){
                ans += -sum + 1;
                sum = 1;
            }
        }
        else {
            if(sum >= 0){
                ans += sum + 1;
                sum = -1;
            }
        }
    }
    
    return ans;
}

long long f2 (int n, int arr[])
{
    long long ans = 0, sum = 0;
    for(int i=0; i<n; i++){
        sum += arr[i];
        if(i % 2) {
            if(sum >= 0){
                ans += sum + 1;
                sum = -1;
            }
        }
        else {
            if(sum <= 0){
                ans += -sum + 1;
                sum = 1;
            }
        }
    }
    
    return ans;
}

int main()
{
    int n, a[100000];
    cin >> n;
    for(int i=0; i<n; i++) cin >> a[i];

    long long ans = min(f1(n, a), f2(n, a));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll l,r,cnt=0;
    cin>>l>>r;
    while(l<=r){
        cnt++;
        l*=2ll;
    }
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 3700