akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    int N;
    cin >> N;
    long long A[N],B[N];
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    long long count=0;
    long long ans=0;
    long long plus_a=0,plus_b=0;
    for(int i=0;i<N;++i){
        if(A[i]<B[i]){
            plus_a+=(B[i]-A[i]+1)/2;
        }
        else{
            plus_b+=A[i]-B[i];
        }
}
long long sousa=0;
for(int i=0;i<N;++i){
    sousa+=B[i]-A[i];
}
ans=max(plus_b,plus_a);
if(ans<=sousa){
    cout << "Yes";
}
else{
    cout << "No";
}
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
int main(void){
    int dim;
    cin >> dim;
    double vx[dim], vy[dim];
    for(int i=0; i<dim; i++) cin >> vx[i];
    for(int i=0; i<dim; i++) cin >> vy[i];
    
    double d1 = 0, d2 = 0, d3 = 0, di = 0, d = 0;
    
    for(int i=0; i<dim; i++){
        d1 += abs(vx[i] - vy[i]);
        d2 += pow((vx[i] - vy[i]), 2);
        d3 += pow(abs(vx[i] - vy[i]), 3);
        d = abs(vx[i] - vy[i]);
        if(i==0){
            di = d;
        }else{
            if(di < d) di = d;
        }
    }
    d2 = sqrt(d2);
    d3 = pow(d3, 1.0/3.0);

    printf("%.8lf\n%.8lf\n%.8lf\n%.8lf\n", d1, d2, d3, di);
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

	int n, p; cin >> n >> p;
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	sort(v.begin(), v.end());
	vector<ll> dp(5000, 0);
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 5000; j>=0; j--) {
			if (j - v[i] >= 0) dp[j] += dp[j - v[i]] ;
		}
	}
	ll res = 0;
	for (int i = 0; i <= 5000; i++) {
		if (i % 2 == p) res += dp[i];
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
  double W,H,x,y,S;
  scanf("%lf%lf%lf%lf",&W,&H,&x,&y);
  
  S = (W*H)/2;
  printf("%lf ",S);
  
  if (x*2 == W && y*2 == H) {
    printf("1");
  } else {
    printf("0");
  }
  return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define mp make_pair
#define what_is(x) cerr << #x << " is " << x << endl;

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


const int p = 1e9 + 7;


int mul(int a, int b) {
    return (1LL * a%p * b%p) % p;
}

int add(int a, int b) {
    int s = (a+b);
    s = s%p;
    if (s<0) s+=p;
    return s;
}

int sub(int a, int b) {
    int s = (a-b);
    s = s%p;
    if (s<0) s+=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

vector<int> Z(vector<int> s)
{
    int n = s.size();
    vector<int> z(n);
    int L = 0, R = 0;
    for (int i = 1; i < n; i++) {
        if (i > R) {
            L = R = i;
            while (R < n && s[R-L] == s[R]) R++;
            z[i] = R-L; R--;
        } else {
            int k = i-L;
            if (z[k] < R-i+1) z[i] = z[k];
            else {
                L = i;
                while (R < n && s[R-L] == s[R]) R++;
                z[i] = R-L; R--;
            }
        }
    }
    return z;
}

mt19937 rnd(time(0));
/*
struct Line {
    mutable ll k, m, p;
    bool operator<(const Line& o) const { return k < o.k; }
    bool operator<(ll x) const { return p < x; }
};

struct CHT : multiset<Line, less<>> {
    // (for doubles, use inf = 1/.0, div(a,b) = a/b)
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b) { // floored division
        return a / b - ((a ^ b) < 0 && a % b); }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        auto l = *lower_bound(x);
        return l.k * x + l.m;
    }
};
*/

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

    vector<int> good;

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

    vector<vector<int>> d(n+1);
    for (int i = 1; i<=n; i++)
    {
        for (int j = i; j<=n; j+=i) d[j].push_back(i);
    }
    vector<int> cnt(n+1);
    for (int i = n; i>=1; i--)
    {
        if (cnt[i]%2 != a[i]) {good.push_back(i); for (auto it: d[i]) cnt[it]++;}
    }
    cout<<good.size()<<endl;
    for (auto it: good) cout<<it<<' ';
}

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

ll nc2(ll n)
{
    return n * (n - 1) / 2;
}

int main()
{
    int n;
    cin >> n;
    map<int, int> m;
    vector<int> a(n);
    rep(i, n)
    {
        int k;
        cin >> k;
        m[k]++;
        a[i] = k;
    }

    ll ans = 0;
    for (auto k : m)
    {
        ans += nc2(k.second);
    }

    for (auto k : a)
    {
        int cnt = m[k] - 1;
        cout << (ans - cnt) << endl;
    }

    return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll n;
vector<vector<ll>> graph(1000*1000);
vector<ll> vdist(1000*1000,-1);
vector<ll> seen(1000*1000,-1);

ll dfs(ll now)
{
    if(seen.at(now) == 2) return vdist.at(now);
    seen.at(now) = 1;
    ll tmp = 0;
    for(auto next:graph.at(now)){
        if(seen.at(next) == 1){
            cout << -1 << endl;
            exit(0);
        }
        tmp = max(tmp, dfs(next)+1);
    }
    seen.at(now) = 2;
    return vdist.at(now) = tmp;
}

int main()
{
    ll i,j;
    cin >> n;
    for(i = 0;i < n;++i){
        ll p = 0;
        rep(j,n-1){
            ll k;
            cin >> k;
            --k;
            ll ni = min(i,k);
            ll nj = max(i,k);
            ll next = ni*n + nj;
            graph.at(p).push_back(next);
            p = next;
        }
    }
    vdist.at(0) = 0;
    dfs(0);
    cout << vdist.at(0) << endl;
    return 0;
}

Measured memory_bytes: 55040
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename V> typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V> typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, 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 (a > b) { a = b; return 1; } return 0; }

template<typename T>
struct SegmentTree {
private:
	ll n;
	vector<T> node;
	T ex;
	T(*f)(T,T);

public:
	SegmentTree() {}
	//初期化
	SegmentTree(int size, T(*_f)(T,T), T _ex, T ini) {
		n = 1;
		while (n < size)n *= 2;
		f = _f;
		ex = _ex;
		node.resize(2 * n - 1, ex);
		//最下段に順番に値を入れる。
		REP(i, size)node[i + n - 1] = ini;
		//親に伝えていく
		REPR(i, size - 1)node[i] = f(node[i * 2 + 1], node[i * 2 + 2]);
	}

	//k番目(0-indexed)をaに変更
	void update(ll k, ll a) {
		//最下段のインデックスを取得
		k += n - 1;
		//値を代入
		node[k] = a;

		//上りながら更新
		while (k > 0) {
			k = (k - 1) / 2;
			node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}

	//[a,b)の範囲のcalcの結果を求める
	//kは接点番号、l,rはそれが[l,r)に対応づいていることを表す。
	//外からは(a,b)で呼び出し。
	ll query(ll a, ll b, ll k = 0, ll l = 0, ll r = -1) {

		//初回呼び出し時探索範囲を[0,n)に設定。
		if (r < 0)r = n;
		//[a,b)と[l.r)が交差しない。
		if (r <= a || b <= l) {
			return ex;
		}
		//[a,b)が[l,r)を完全に含む。
		if (a <= l && r <= b)return node[k];
		else {
			T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
			T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return f(vl, vr);
		}
	}
};


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Q;
	cin >> N >> Q;
	SegmentTree<ll> st(N, [](auto a, auto b) {return min(a, b); }, (1 << 30) -1 + (1 << 30), (1 << 30) - 1 + (1 << 30));
	REP(i, Q) {
		int c, x, y;
		cin >> c >> x >> y;
		if (c == 0) {
			st.update(x, y);
		}
		else {
			cout << st.query(x, y+1) << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4912
#include<iostream>
#include<cstring>
using namespace std;
char S[300000];
long ans;
int main(){
  cin >> S;
  ans = 0;
  int k=0;
  for (int i=0;i<strlen(S);i++){
    if (S[i]=='W'){
      ans+=(i-k);
      k++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1016
N, C = map(int, input().split())
stc = [list(map(int, input().split())) for _ in range(N)]
 
record = [[0] * 10 ** 5 for _ in range(C)]
for s, t, c in stc:
    for i in range(s, t + 1):
        record[c-1][i-1] = 1
 
ans = 0
for i in range(10 ** 5):
    cnt = 0
    for j in range(C):
        cnt += record[j][i]
    ans = max(ans, cnt)
 
print(ans)

Measured memory_bytes: 50924
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int N;
    cin >> N;

    vector<int> d;

    for(int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        d.push_back(tmp);
    }

    //昇順にソート
    sort(d.begin(), d.end());

    int size = d.back();
    vector<int> count(size+1, 0);

    for(int i = 0; i < N; i++)
    {
        count.at((d.at(i)-1))++;
    }

    int ans = 0;

    for(int i = 0; i < size+1; i++)
    {
        if(count.at(i) != 0)
        {
            ans++;
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
void yes(){
  cout << "Yes" << endl;
  exit(0);
}

void no(){
  cout << "No" << endl;
}

int main() {
  ll n; cin >> n;
  REP(i, n) REP(j, n){
    if(4*i+7*j==n) yes();
  }
  no();
}

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

#define FOR(i, a, b) for (int (i) = (a); (i) < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cerr << #x << " " << x << endl
#define eb emplace_back
#define __ << " " <<
typedef long long ll;
typedef std::pair<int, int> P;
#define X first
#define Y second
#define double long double
using namespace std;

const int MaxN = 200100;
const int MaxK = 1010;
const int Mod = 1e9 + 7;

int N;
int K;
int x[MaxN], y[MaxN];
char c[MaxN];
int a[2 * MaxK][2 * MaxK], b[2 * MaxK][2 * MaxK], d[2 * MaxK][2 * MaxK], e[2 * MaxK][2 * MaxK];


void solve(){
  int res = -1e9;
  REP(r, 2*K) REP(c, 2*K){
//    if (e[r][c] > res){
//      TRACE(r __ c __ e[r][c]);
//    }
    res = max(res, e[r][c]);
  }
//  if ((res + N) % 2 != 0)
//    TRACE(res);
  int sol = (res + N) / 2;
  cout << sol << endl;
}

void findE(){
  for (int r = 0; r < 2*K; r++){
    
    for (int c = 0; c < K; c++){
      e[r][0] += d[r][c] - d[r][c + K];
    }

    for (int c = 1; c < 2*K; c++){
      e[r][c] = e[r][c - 1];
      int indNew = (c + K - 1) % (2*K);
      int indOld = (c - 1 + 2*K) % (2*K);
      e[r][c] += 2 * d[r][indNew] - 2 * d[r][indOld];
    }
  }
}
  
void findB(){
  for (int r = 0; r < 2*K; r++){
    
    for (int c = 0; c < K; c++){
      b[r][0] += a[r][c] - a[r][c + K];
    }

    for (int c = 1; c < 2*K; c++){
      b[r][c] = b[r][c - 1];
      int indNew = (c + K - 1) % (2*K);
      int indOld = (c - 1 + 2*K) % (2*K);
      b[r][c] += 2 * a[r][indNew] - 2 * a[r][indOld];
    }
  }
}
  
void findD(){
  for (int c = 0; c < 2*K; c++){
    
    for (int r = 0; r < K; r++){
      d[0][c] += a[r][c] - a[r + K][c];
    }

    for (int r = 1; r < 2*K; r++){
      d[r][c] = d[r - 1][c];
      int indNew = (r + K - 1) % (2*K);
      int indOld = (r - 1 + 2*K) % (2*K);
      d[r][c] += 2 * a[indNew][c] - 2 * a[indOld][c];
    }

    
  }
}
  
void load(){
  scanf("%d%d", &N, &K);
  REP(i, N){
    scanf("%d %d %c", x + i, y + i, c + i);
    a[ x[i] % (2*K)][ y[i] % (2*K) ] += ((c[i] == 'B') ? 1 : -1); 
  }
}

int main(){
    load();
    findB();
    findD();
    findE();
    solve();
    return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll dp[100005];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  fill(dp,dp+n+1,n);
  dp[0]=0;
  rep(i,n){
    for(ll j=1; j+i<=n; j*=6){
      chmin(dp[i+j],dp[i]+1);
    }
    for(ll j=1; j+i<=n; j*=9){
      chmin(dp[i+j],dp[i]+1);
    }
  }
  cout<<dp[n]<<endl;
}

Measured memory_bytes: 1024
use proconio::input;

#[allow(non_snake_case)]
fn main() {
    input! {
    S: String
    }

    let ans = if S.contains("RRR") {
        3
    } else if S.contains("RR") {
        2
    } else if S.contains("R") {
        1
    } else {
        0
    };

    println!("{}", ans);
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
#define mo 998244353
int n,m,i,j,ans,flag,a[100005];
int read(){
	int xx=0,flag2=1;
	char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')
		ch=getchar();
	if(ch=='-'){
		flag2=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		xx=xx*10+ch-'0';
		ch=getchar();
	}
	return flag2*xx;
}
int main(){
	n=read();m=read();
	cout<<max(max(n-m,n*m),n+m)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    HashSet<Integer> set = new HashSet<Integer>();
    for(int i = a; i < Math.min(b + 1, (a + k)); i++) {
      set.add(i);
    }
    for(int i = b; i > Math.max(a - 1, (b - k)); i--) {
      set.add(i);
    }
    ArrayList<Integer> list = new ArrayList<Integer>();
    for(Iterator<Integer> itr = set.iterator(); itr.hasNext();) {
      list.add(itr.next());
    }
    Collections.sort(list);
    for(int i = 0; i < list.size(); i++) {
      System.out.println(list.get(i));
    }
  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int N;
    cin >> N;
    vector<ll> a(3 * N);
    rep(i, 3 * N) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    ll sum = 0;
    for (int i = 0; i < 2 * N; i++)
    {
        if (i % 2 == 1)
            sum += a[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

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

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

#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  int N;
  cin >> N;
  string s, t;
  cin >> s >> t;

  rep(i, N) cout << s[i] << t[i];
  cout << endl;
}

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

int main(){
  vector<vector<int>> c(3, vector<int>(3, 0));
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c.at(i).at(j);
    }
  }
  int flag = true;
  for(int i = 0; i < 2; i++){
    if(!(c.at(i+1).at(0) - c.at(i).at(0) == c.at(i+1).at(1) - c.at(i).at(1) && c.at(i+1).at(0) - c.at(i).at(0) == c.at(i+1).at(2) - c.at(i).at(2))) flag = false;
  }
  for(int i = 0; i < 2; i++){
    if(!(c.at(0).at(i+1) - c.at(0).at(i) == c.at(1).at(i+1) - c.at(1).at(i) && c.at(0).at(i+1) - c.at(0).at(i) == c.at(2).at(i+1) - c.at(2).at(i))) flag = false;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())
if Y == 0:
    answer = X
else:
    list_1 = list(map(int, input().split()))

    mylist = list(range(-100, 200))

    list_2 = list(filter(lambda x: x not in list_1, mylist))
    
    list_3 = list(map(lambda x: x - X, list_2))

    import numpy as np

    abslist = np.abs(list_3)

    min_num = min(abslist)

    answer_lisbef = [X - min_num, X + min_num]
    
    answer_lisaf = list(filter(lambda x: x not in list_1, answer_lisbef))
    
    answer = min(answer_lisaf)
print(answer)

Measured memory_bytes: 27168
import std.stdio;
import std.array;
import std.conv;
import std.string;
import std.algorithm;
import std.typecons;
import std.math;


class UnionFind
{
	int[] data;

	this() {
	}

	this(int x) {
		data = new int[](x);
		data[] = -1;
	}

	bool unionSet(int x, int y)
	{
		x = root(x); y=root(y);
		if(x != y)
		{
			if(data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	
	int root(int x)
	{
		if( data[x] < 0 ) return x;
		return data[x]=root(data[x]);
	}
};
	

alias Tuple!(double, "x", double, "y", double, "z") P3;
alias Tuple!(P3, "p", double, "r") Sphere;
alias Tuple!(int, "src", int, "dst", double, "cost") Edge;

string[] inputs;

double dist(Sphere a, Sphere b)
{
	double res = sqrt((a.p.x-b.p.x)^^2 + (a.p.y-b.p.y)^^2 + (a.p.z-b.p.z)^^2) - (a.r+b.r);
	if (res < 0) res = 0;

	return res;
}


double solve(int N, Sphere[] stations) {
	
	int connected = 0;
	double res = 0;

	UnionFind uf = new UnionFind(N);
	Edge[] edges;

	foreach(i; 0..N)
	foreach(j; i+1..N) {
		edges ~= Edge(i,j,dist(stations[i],stations[j]));
	}

	sort!("a.cost < b.cost")(edges);

	foreach(e; edges) {
		if(connected >= N-1) break;
		if(uf.unionSet(e.src, e.dst)) {
			connected++;
			res += e.cost;
		}
	}

	return res;
}
	

void main()
{
	
	while(true)
	{
		inputs = split(chomp(readln));
		int N = to!int(inputs[0]);
		if(N==0) break;

		Sphere[] stations = new Sphere[](N);
		foreach(i; 0..N) {
			inputs = split(chomp(readln));
			stations[i] = Sphere(P3(to!double(inputs[0]), to!double(inputs[1]), to!double(inputs[2])), to!double(inputs[3]));
		}

		writefln("%.3f", solve(N, stations));
	}
}

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

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

    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d.at(i);
    }

    int div = n / 2;
    int cnt = 0, abc;
    sort(d.begin(), d.end());
    for (int i = d.at(div-1); i <= d.at(div); i++) {
        /*
        abc = 0;
        for (int j = 0; j < div; j++) {
            if (d.at(j) < i) {
                abc++;
            }
        }
        if (div == abc) cnt++;
        */
        cnt++;
    }

    cout << cnt-1 << endl;

    return 0;
}


Measured memory_bytes: 3776
<?php 
  $s = trim(fgets(STDIN));
  $flg1 = FALSE;
  $flg2 = FALSE;
  for($i = 0; $i < 3; $i++){
    if($s[$i] == "A"){
      $flg1 = TRUE;
    }else{
      $flg2 = TRUE;
    }
  }
  if($flg1 == TRUE && $flg2 == TRUE){
    echo "Yes";
  }else{
    echo "No";
  }
 ?>

Measured memory_bytes: 4856
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  int mic=0;
  ll miabs=1e10;
  ll sum=0;
  for(int i=0;i<n;i++){
    if(a[i]<0) mic++;
    sum+=abs(a[i]);
    miabs=min(miabs,abs(a[i]));
  }

  if(mic%2) cout<<sum-2*miabs<<endl;
  else cout<<sum<<endl;


  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
    public static void main(String [] args){
        Scanner scan=new Scanner (System.in);
        String a=scan.next();
        int b=a.length();
        char c[]=new char[b];
        int ans1=0;
        int ans2=0;
        StringBuilder sb1 = new StringBuilder(a);

        for(int i=0;i<b;i++){
            c[i]=sb1.charAt(i);
        }
        int d=0;
        for(int i=0;i<b;i++){
            d=i%2;
            if(d==0){
                if(c[i]!='0'){
                    ans1+=1;
                }
            }else{
                if(c[i]!='1'){
                    ans1+=1;
                }
            }
        }

        d=0;
        for(int i=0;i<b;i++){
        	d=i%2;
            if(d==0){
                if(c[i]!='1'){
                    ans2+=1;
                }
            }else{
                if(c[i]!='0'){
                    ans2+=1;
                }
            }
        }
        if(ans1>ans2){
            System.out.println(ans2);
        }else{
            System.out.println(ans1);
        }


    }
}

Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

int main() {
  int l;
  cin >> l;
  double x = l / 3.0;
  double ans = x * x * x;
  printf("%.10f\n", ans);
}

Measured memory_bytes: 256
n = int(input())
s = input()

ec, wc = 0, 0
for i in range(1, n):
    if s[i] == "E":
        ec += 1

ans = ec+wc
for i in range(1, n):
    wc += int(s[i - 1] == "W")
    ec -= int(s[i] == "E")
    ans = min(ans, wc+ec)

print(ans)


Measured memory_bytes: 9640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}
int dfs(int v, ll N, bool visited[nmax])
{
    bool all_visited = true;

    for (int i = 0; i < N; i++)
    {
        if (!visited[i])
        {
            all_visited = false;
        }
    }

    if (all_visited)
    {
        return 1;
    }
    int ret = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (!graph[v][i])
        {
            continue;
        }
        if (visited[i])
        {
            continue;
        }

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}


void solve(long long K, long long S){
    int ans = 0;
    for(int x = 0; x <= K; x++)
    {
        for(int y = 0; y <= K; y++)
        {
            int z = S - x - y;
            if(0 <= z && z <= K){
                ans++;
            }
        }
    }

    cout << ans << endl;
    
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long S;
    scanf("%lld",&S);
    solve(K, S);
    return 0;
}


Measured memory_bytes: 256
#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)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve()
{
 int N; cin >> N;
 vector<int> P, Q;
 P.reserve(N); Q.reserve(N);

 REP0(i, N) { int tmp; cin >> tmp; P.push_back(tmp); }
 REP0(i, N) { int tmp; cin >> tmp; Q.push_back(tmp); }
 bool P_gt_Q = true;
 REP0(i, N) 
 { // equal なら発火しない
   if (P.at(i) < Q.at(i)) { P_gt_Q = false; break; }
   if (P.at(i) > Q.at(i)) { break; }
 }
 vector<int> start = (P_gt_Q) ? Q : P;
 vector<int> end = (P_gt_Q) ? P : Q;
 int ans = 0;
 while ( !(start == end) )
 {
   ans++;
   next_permutation(start.begin(), start.end());
 }
 cout << ans << 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: 256
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;

int main()
{
    ll h, sum=0, cnt = 1;
    cin >> h;
    while (h) {
        h /= 2;
        sum += cnt;
        cnt *= 2;
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
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; }

int main(){
    int N;
    cin >> N;
    string s;
    map<string,int> m;

    rep(i,N){
        cin >> s;
        m[s] = 1;
    }
    cout << m.size() << endl;
    return 0;

}


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

class class_A
{
    static int calc(int n0)
    {
        var result = 0;
        foreach (var c in n0.ToString())
        {
            result += int.Parse(c + "");
        }
        return result;
    }

    static void Main()
    {
        var tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = tmp[0];
        var A = tmp[1];
        var B = tmp[2];

        var ans = 0;

        for (var n = 0; n <= N; n++)
        {
            var calc_n = calc(n);
            if (A <= calc_n && calc_n <= B)
            {
                ans += n;
            }
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>

using namespace std;
const int INF=1e9+7;

struct edge{int to, cost;};
long long G1[309][309], G2[309][309];

int main(){
  int n, m ,l, q;
  cin >> n >> m >> l;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      G1[i][j] = INF;
      G2[i][j] = INF;
    }
  }
  for(int i=0;i<n;i++){
    G1[i][i] = 0;
    G2[i][i] = 0;
  }
  for(int i=0;i<m;i++){
    int a, b ,c;
    cin >> a >> b >> c;
    a--;b--;
    G1[a][b] = c;
    G1[b][a] = c;
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        G1[i][j] = min(G1[i][j], G1[i][k] + G1[k][j]);
      }
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(G1[i][j]<=l && i!=j)G2[i][j] = 1;
    }
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        G2[i][j] = min(G2[i][j], G2[i][k] + G2[k][j]);
      }
    }
  }
  cin >> q;
  for(int i=0;i<q;i++){
    int s, t;
    cin >> s >> t;
    s--;t--;
    cout << (G2[s][t]==INF?-1:G2[s][t]-1) << endl;
  }
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n; cin >> n;
    vector<ll> h(n); rep(i,0,n) cin >> h[i];

    ll res = 0;
    while(1){
        if(*max_element(all(h)) == 0) break;
        ll i = 0;
        while(i < n){
            if(h[i] == 0) i++;
            else{
                res++; //1が連続する区間を見つけたので+1
                while(i < n && h[i] > 0){
                    h[i]--;
                    i++;
                }
            }
        }
    }
    cout << res << ednl;

}


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

#define ll long long
#define ull long long unsigned
#define vii vector<int>
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pdd pair<double,double>
#define pldld pair<long long double, long long double>
#define ff first
#define ss second
#define pb push_back
#define read freopen("alu.txt","r",stdin);
#define write freopen("vorta.txt","w",stdout);
#define fastio ios::sync_with_stdio(false); cin.tie(NULL);
#define PI 2*acos(0.0)

const int MAX=100005, MOD=1000000007;
const ll inf=1e9;

int arr[MAX];
int g[205][205];
void initialize(int n){
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            if(i==j) g[i][j]=0;
            else g[i][j]=INT_MAX;
        }
    }
}

void floyd(int n){
    for(int k=1;k<=n;k++){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                if(g[i][k]+g[k][j]>=0) g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
            }
        }
    }
}

vii v;
int main(){

    fastio;
    int n,m,r;
    cin>>n>>m>>r;
    for(int i=0;i<r;i++){
        int u;
        cin>>u;
        v.pb(u);
    }
    initialize(n);
    for(int i=0;i<m;i++){
        int u,v,w;
        cin>>u>>v>>w;
        if(w<g[u][v]) g[u][v]=g[v][u]=w;
    }
    floyd(n);

    ll ans=INT_MAX;
    sort(v.begin(),v.end());
    do{
        ll dis=0;
        for(int i=1;i<v.size();i++){
            dis+=g[v[i-1]][v[i]];
        }
        ans=min(ans,dis);
    } while(next_permutation(v.begin(),v.end()));

    cout<<ans<<"\n";

}











Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

LL n,k;
LL a[105];
LL dp[105][100005] = {0};
LL pre[100005] = {0};

int main(){
	scanf("%lld %lld",&n,&k);
	for(LL i = 1;i <= n;i ++) scanf("%lld",&a[i]);
	for(LL i = 1;i <= n;i ++){
		pre[0] = 1; for(LL j = 1;j <= k;j ++) pre[j] = (pre[j - 1] + dp[i - 1][j]) % N;
		for(LL j = 0;j <= k;j ++){
			LL del = 0;
			if(j - a[i] > 0) del = pre[max(0LL,j - a[i] - 1)];
			dp[i][j] = pre[j] - del;
			dp[i][j] = (dp[i][j] + N) % N;
		}
	}
	printf("%lld\n",dp[n][k]);
	return 0;
}

Measured memory_bytes: 79360
import numpy as np

N, M, X, Y = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

min_x = np.min(x)
max_x = np.max(x)
min_y = np.min(y)
max_y = np.max(y)

if(X < Y): #ZはXより大きな整数であるため
    if((max_x < min_y) and (max_x < Y) and (min_y > X)):
        print("No War")
    else:
        print("War")
else:
    print("War")


Measured memory_bytes: 12984
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define MAXV 10010
int V,E,R;
vector<vector<pll>> G(MAXV);
vector<ll>key(MAXV,INF);//shortest in adj()
vector<bool>used(MAXV,0);//Q{}

ll prim(const int &R){
    key[R]=0;
    ll res=0;
    REP(i,V){
        ll v=-1;
        //minimum in V-Q
        REP(u,V)if(!used[u]&&(v==-1||key[u]<key[v]))v=u;
        used[v]=1;//Q=Q U v
        res+=key[v];
        //RELAX each adj(v)
        REP(j,G[v].size()){ll u=G[v][j].first;key[u]=min(key[u],(ll)G[v][j].second);}
    }
    return res;
}
/*
more space less time
ll prim(const int &R){
    priority_queue<pll,vector<pll>,greater<pll>>pq;
    key[R]=0;
    ll res=0;
    pq.push(mp(0,0));
    while(!pq.empty()){
        ll cost=pq.top().first;
        ll v=pq.top().second;
        pq.pop();
        if(cost>key[v])continue;
        used[v]=1;
        res+=key[v];
        REP(j,G[v].size()){
            ll u=G[v][j].first;
            if(used[u])continue;
            key[u]=min(key[u],(ll)G[v][j].second);
            pq.push(mp(key[u],u));
            }
    }
    return res;
}
*/

void solve()
{
    cin>>V>>E;
    REP(i,E){
        int x,y,d;cin>>x>>y>>d;
        G[x].pb(mp(y,d));
        G[y].pb(mp(x,d));
    }
    R=0;
    cout<<prim(R)<<endl;
}


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


Measured memory_bytes: 8496
import java.util.Scanner;

public class Main{
    
 
    public static void main(String[] args)  {
        new Main().solve();
    }

    void solve(){
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        
        int fhund, fyen;
        int b;

        fhund = a / 500;
        b = a % 500;
        fyen = b / 5;

        System.out.println((fhund * 1000) + (fyen * 5));



    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323

//int calc1(float a,float b,float c,float d,float e,float f,float *x,float *y);
//void quick(int *,long long,long long);
//int comp(char *a,char *b);

int main(){
	
	int i,num;
	int a[10];
	
	num=0;
	while(scanf("%d",&i)!=EOF){
		if(i==0){
			num--;
			printf("%d\n",a[num]);
		}else{
			a[num]=i;
			num++;
		}
	}
	//for(i=0;i<=1000000000;i++);
	return 0;
}

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

int main(){
    int n,k,x,sum = 0;
    cin >> n >> k;
    rep(i,n){
        cin >> x;
        sum += 2*min(abs(k-x),x);
    }
    cout << sum << "\n";
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math, core.stdc.stdio;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }

int f(string n) {
    int k = n.length.to!int;
    int r = (n[0] - '0') + (k - 1) * 9;
    if (count(n[1..$], '9') != k - 1) r--;
    return r;
}

void main() {
    writeln(readln.strip.f);
    auto _ = readln(); // dbg
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long sum = 0;
		for(int i = 1;i<=n;i++){
			if(((i%3)!=0)&&((i%5)!=0)){
				sum += i;
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 27092
INF = float('inf')


def tc():
    n = int(input())
    p = list(map(float, input().split()))

    dp = [[0] * (n + 1) for _ in range(n + 1)]
    dp[0][0] = 1
    # dp[i][j]: probability that out of the first
    # i coins, j of them are heads
    for i in range(1, n + 1):
        dp[i][0] = dp[i - 1][0] * (1 - p[i - 1])
        for j in range(1, i + 1):
            dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1]

    ans = sum(dp[n][n // 2 + 1:])
    print(ans)


tc()


Measured memory_bytes: 204564
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, D] = [int(input_raw[0]), int(input_raw[1])]
    K = 2 * D + 1
    print N / K + (1 if N % K != 0 else 0)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3056
/*
    把h*w矩形分为三部分,求最大面积与最小面积之差最小值
    首先,n或m为三的倍数,面积差最小值为0
    其次,暴力枚举所有情况
    先将矩形,分为两部分,横切或者竖切,剩下的那块对半分
    最大h*w会爆int
*/
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll inf = 9e18;
ll Max(ll a,ll b,ll c){
    return max(a, max(b, c));
}
ll Min(ll a,ll b,ll c){
    return min(a, min(b, c));
}
int main(){
    ll h, w, ans;
    scanf("%lld%lld", &h, &w);
    if(!(h%3)||!(w%3)){
        puts("0");
        return 0;
    }
    ans = inf;
    for (ll i = 1; i < h;i++){
        ll tmp = h - i;//剩下部分
        ll h1 = (tmp + 1) / 2;  //向上取整
        ll h2 = tmp / 2;//向下取整
        //为1时不能再横切
        if(tmp!=1){
            ans=min(ans,Max(i*w,h1*w,h2*w)-Min(i*w,h1*w,h2*w));
        }
        ll w1 = (w + 1) / 2;
        ll w2 = w / 2;
        //竖切,w初始为2
        ans=min(ans,Max(i*w,tmp*w1,tmp*w2)-Min(i*w,tmp*w1,tmp*w2));
    }
    for (ll i = 1; i < w;i++){
        ll tmp = w - i;//
        ll w1 = (tmp + 1) / 2;  //向上取整
        ll w2 = tmp / 2;//向下取整
        if(tmp!=1){
            ans=min(ans,Max(i*h,w1*h,w2*h)-Min(i*h,w1*h,w2*h));
        }
        ll h1 = (h + 1) / 2;
        ll h2 = h / 2;
        ans=min(ans,Max(i*h,tmp*h1,tmp*h2)-Min(i*h,tmp*h1,tmp*h2));
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
    int w,h;
    char c;
    cin>>w>>h>>c;
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if(i==0||i==h-1){
                if(j==0||j==w-1){
                    cout<<"+";
                }else{
                    cout<<"-";
                }
            }else{
                if(j==0||j==w-1){
                    cout<<"|";
                }else if (i==h/2&&j==w/2){
                    cout<<c;
                }else{
                    cout<<".";
                }
            }
        }
        cout<<endl;
    }
}


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

int main() {
  string s;
  cin >> s;
  rep(i,s.size()) {
    s[i] = 'x';
  }
  cout << s << endl;
  return 0;
}

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

int main(void)
{
    int N;
    cin >> N;

    vector<int> A(N);
    bool even = true;
    int counter = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        if (A[i] % 2 != 0)
        {
            even = false;
        }
    }

    if (even == false)
    {
        cout << counter << endl;
        return 0;
    }

    while (even == true)
    {
        for (int i = 0; i < N; i++)
        {
            A[i] /= 2;
            if (A[i] % 2 != 0)
            {
                even = false;
            }
        }
        counter++;
    }
    cout << counter << endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  ll A,B;
  cin >> A >> B;
  ll eft = A;
  ll right = B;
  if (A % 2 == 1) eft++;
  if (B % 2 == 0) right--;
  ll ans = 0;
  ll num = (right - eft + 1) / 2;
  if (A % 2 == 1) ans ^= A;
  if (B % 2 == 0) ans ^= B;
  if (num % 2 == 1) ans ^= 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

class UnionFind:

    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n)]
        self.height = [0 for i in range(n)]
        self.size = [1 for i in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def getSize(self, x):
        return self.size[self.find(x)]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.height[x] < self.height[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = self.par[x]
            self.size[x] += self.size[y]
            if self.height[x] == self.height[x]:
                self.height[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

N = int(input())
A = list(map(int, input().split()))
B = [-1] * (N+1)
for i, a in enumerate(A):
    B[a] = i
uf = UnionFind(N)
ans = 0
for x in range(N, 0, -1):
    i, l, r = B[x], 0, 0
    if 0 < i and A[i] < A[i-1]:
        l = uf.getSize(i-1)
        uf.unite(i-1, i)
    if i < N-1 and A[i] < A[i+1]:
        r = uf.getSize(i+1)
        uf.unite(i, i+1)
    ans += (l+1)*(r+1)*x
print(ans)


Measured memory_bytes: 124420