akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
#include <list>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 2;

vector<ll> two_powers(int n)
{
    vector<ll> ret(n + 1, 0);
    for (int i = 1; i <= n; i++)
    {
        ll p = 0;
        while ((i >> p) % 2 == 0)
        {
            p++;
        }
        // cout << i << ":" << p << endl;
        ret[i] = p;
    }
    return ret;
}
ll combination(vector<ll> &factorial, ll n, ll m)
{
    if (factorial[n] - factorial[m] - factorial[n - m] > 0)
    {
        return 0;
    }
    else
    {
        return 1;
    }
}

string next_x(string &s)
{
    if (s.size() == 1)
    {
        return s;
    }
    else
    {
        string ret;
        for (int i = 0; i < s.size() - 1; i++)
        {
            ret += (char)'0' + abs(s[i + 1] - s[i]);
        }
        return ret;
    }
}
int main()
{
    // 整数の入力
    ll N;
    string S;
    cin >> N;
    cin >> S;

    vector<ll> twos = two_powers(N);
    vector<ll> factorial(N + 1, 0);
    for (int i = 1; i <= N; i++)
    {
        factorial[i] = factorial[i - 1] + twos[i];
        // cout << i << ":" << factorial[i] << endl;
    }

    string x = next_x(S);
    // cout << x << endl;
    map<ll, ll> elementary_counts{{0, 0}, {1, 0}, {2, 0}};
    map<ll, ll> counts{{0, 0}, {1, 0}, {2, 0}};
    for (int i = 0; i < x.length(); i++)
    {
        ll c = combination(factorial, x.size() - 1, i);
        // cout << x.size() -1 << "C" << i   << endl;
        // cout << (x[i] - '0') << " " << c << endl;
        elementary_counts[x[i] - '0']++;
        counts[x[i] - '0'] = (counts[x[i] - '0'] + c) % 2;
    }
    // for(auto p:counts){
    //     cout << p.first << " " << p.second << endl;
    // }
    if (elementary_counts[1] > 0){
        counts[2] = 0;
    }
    if (counts[1] == 0 && counts[2] == 0)
    {
        cout << 0 << endl;
    }
    else if (counts[1] == 0 && counts[2] == 1)
    {
        cout << 2 << endl;
    }
    else if (counts[1] == 1 && counts[2] == 0)
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 1 << endl;
    }

    // cout << x << endl;
    // while(x.size() != 1){
    //     x = next_x(x);
    //     cout << x << endl;
    // }
    // cout << x << endl;
    return 0;
}

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


int main() {
  int N,D;
  cin >> N >> D;
  
  int M =2*N;
  
  vector<double> vecX(M);
  for (int i = 0; i < M; i++) {
    cin >> vecX.at(i);
  }
  
  vector<double> vecS(M);
  for (int i = 0; i < M; i++) {
    vecS.at(i) = vecX.at(i)*vecX.at(i);
  }
  
  int O =M-1;
  vector<double> vecU(O);
  for (int i = 0; i < O; i++) {
    vecU.at(i) = vecS.at(i)+vecS.at(i+1);
  }
  
  vector<double> vecV(O);
  for (int i = 0; i < O; i++) {
    vecV.at(i) = sqrt(vecU.at(i));
  }
  
  int sum =0;
  for (int i = 0; i < O; i++) {
    if(i%2==0){
      if(vecV.at(i)<=D){
        sum ++;
      }
      else{
        sum +=0;
      }
    }
    else{
      sum +=0;
    }
  }
  
  cout << sum <<endl;

}

Measured memory_bytes: 15728
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const long long N=4e5+1e3+7;

long long n,a[N],k,s[N],ans;

long long tot,root,size[N],num[N],key[N],fa[N],son[N][2];

void pushup(long long x)
{
	size[x]=size[son[x][0]]+size[son[x][1]]+num[x];
}


void rotate(long long x)
{
	long long y=fa[x],z=fa[y],t=(son[y][0]==x);
	if(z)
		son[z][son[z][1]==y]=x;
	fa[x]=z;
	son[y][!t]=son[x][t];
	fa[son[y][!t]]=y;
	son[x][t]=y;
	fa[y]=x;
	pushup(y);
	pushup(x);
}



void splay(long long x,long long s)
{
	while(fa[x]!=s)
	{
		long long y=fa[x],z=fa[y];
		if(z!=s)
			if(son[z][0]==y^son[y][0]==x)
				rotate(x);
			else
				rotate(y);
		rotate(x);
	}
	if(s==0)
		root=x;
}


void insert(long long &x,long long v,long long s)
{
	if(!x)
	{
		x=++tot;
		size[x]=num[x]=1;
		son[x][0]=son[x][1]=0;
		key[x]=v;
		fa[x]=s;
		splay(x,0);
		return;
	}
	if(v==key[x])
	{
		num[x]++;
		size[x]++;
		splay(x,0);
		return;
	}
	insert(son[x][v>key[x]],v,x);
	pushup(x);
}

long long get(long long v)
{
	long long x=root;
	while(x&&v!=key[x])
		x=son[x][v>key[x]];
	return x;
}



void del(long long x)
{
	x=get(x);
	if(!x)
		return;
	splay(x,0);
	if(num[x]>1)
	{
		num[x]--;
		size[x]--;
		return;
	}
	if(!son[x][0]||!son[x][1])
		root=son[x][0]+son[x][1];
	else
	{
		long long y=son[x][1];
		while(son[y][0])
			y=son[y][0];
		splay(y,x);
		son[y][0]=son[x][0];
		fa[son[y][0]]=y;
		root=y;
	}
	fa[root]=0;
	pushup(root);
}

long long rk(long long v)
{
	insert(root,v,0);
	long long ans=size[son[root][0]];
	del(v);
	return ans;
}

int main()
{
	cin>>n>>k;
	for(long long i=1;i<=n;i++)
		cin>>a[i],a[i]-=k,s[i]=s[i-1]+a[i];
	insert(root,0,0);
	for(long long i=1;i<=n;i++)
	{
		insert(root,s[i],0);
		ans+=rk(s[i]+1)-1;
	}
	cout<<ans;
}

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

double kaijo(int n){
  double rtn=1.0;
  REP(i,n) rtn*=(double)(i+1);
  return rtn;
}

int main(){
  int n;double ans=0;cin>>n;
  vector<double> x(8,0),y(8,0);
  vector<vector<double>> def(8,vector<double>(8));
  REP(i,n) cin>>x.at(i)>>y.at(i);
  REP(i,n) REP(j,n) def.at(i).at(j)=sqrt((x.at(i)-x.at(j))*(x.at(i)-x.at(j))+(y.at(i)-y.at(j))*(y.at(i)-y.at(j)));
  REP(i,n) REP(j,n) ans+=def.at(i).at(j)*kaijo(n-1)*2;
  ans/=(kaijo(n)*2.0);
  cout<<fixed<<setprecision(7)<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c;
    cin >> a >> b >> c;
    intl ans = 0;
    for(intl i = a;i < c + 1; i += a)ans += b;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(void)
{
    long N;
    cin >> N;
    string S;
    long MARCH[5] = {0};

    for (long i = 0; i < N; i++) {
        cin >> S;
        switch(S[0]) {
            case 'M':
                MARCH[0]++;
                break;
            case 'A':
                MARCH[1]++;
                break;
            case 'R':
                MARCH[2]++;
                break;
            case 'C':
                MARCH[3]++;
                break;
            case 'H':
                MARCH[4]++;
                break;
        }
    }

    long count = 0;
    for (long i = 0; i < 5; i++) {
        for (long j = i + 1; j < 5; j++) {
            for (long k = j + 1; k < 5; k++) {
                // cout << i << j << k << endl;
                count += MARCH[i] * MARCH[j] * MARCH[k];
            }
        }
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < n; ++1)
using namespace std;
int main(){
vector <int>a(3);
for(int i=0;i<3;i++) {
cin >> a.at(i);
}
sort(a.begin(),a.end());
cout << a[0] <<" " << a[1]<<" "<< a[2] <<endl;
return 0;
}


Measured memory_bytes: 3128
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
// using namespace atcoder;
using ll = long long;
const int mod = 1e9 + 7;

void solve()
{
    int n;
    cin >> n;
    vector<ll> a(n + 1), b(n);
    rep(i, n + 1) cin >> a[i];
    rep(i, n) cin >> b[i];
    ll ans = 0;
    rep(i, n)
    {
        ans += min(a[i], b[i]);
        b[i] -= min(a[i], b[i]);
        if (b[i] < 0)
            continue;
        ans += min(a[i + 1], b[i]);
        a[i + 1] -= min(a[i + 1], b[i]);
    }
    cout << ans << endl;
}

int main()
{
    // srand((unsigned)time(NULL));
    // int t = clock();
    solve();
    // double et = 1.0 * (clock() - t) / CLOCKS_PER_SEC;
    // printf("Execution Time: %.4lf sec\n", et);
    return 0;
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<ll, ll>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

template <typename T> //Maximum
struct RMQ
{
  private:
    int N = 1;
    vector<T> node;

  public:
    RMQ(vector<T> vec)
    {
        int size = vec.size();

        while (N < size)
        {
            N *= 2;
        }

        node.resize(2 * N - 1, make_pair(-llINF, 0));

        REP(i, size)
        {
            node[i + N - 1] = vec[i];
        }

        for (int i = N - 2; 0 <= i; i--)
        {
            node[i] = max(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void update(int i, T value)
    {
        i += (N - 1);

        node[i] = value;

        while (i > 0)
        {
            i = (i - 1) / 2;

            node[i] = max(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    T getMax(int a, int b, int i = 0, int l = 0, int r = -1)
    {
        if (r < 0)
        {
            r = N;
        }

        if (r <= a || b <= l)
        {
            return P(-llINF, llINF);
        }

        if (a <= l && r <= b)
        {
            return node[i];
        }

        T vl = getMax(a, b, 2 * i + 1, l, (l + r) / 2);

        T vr = getMax(a, b, 2 * i + 2, (l + r) / 2, r);

        return max(vl, vr);
    }
};

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

    int N, R, L;
    cin >> N >> R >> L;

    vector<P> vec(N);

    vector<ll> time(N, 0);

    REP(i, N)
    {
        vec[i] = make_pair(0, -i);
    }

    RMQ<P> rmq(vec);

    vector<int> d(R), t(R), x(R);

    REP(i, R)
    {
        cin >> d[i] >> t[i] >> x[i];
    }

    t.push_back(L);

    time[0] = t[0];

    REP(i, R)
    {
        P pre = rmq.getMax(d[i] - 1, d[i]);
        rmq.update(d[i] - 1, make_pair(pre.fi + x[i], pre.se));
        P team = rmq.getMax(0, N);

        time[-team.se] += (t[i + 1] - t[i]);        
    }

    cout << max_element(ALL(time)) - time.begin() + 1 << endl;

    return 0;
}


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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

	int n;
	cin >> n;
	mii a;
	ll sum = 0;
	loop(n) {
		int x;
		cin >> x;
		a[x]++;
		sum += x;
	}
	int q;
	ll b, c;
	cin >> q;
	loop(q) {
		cin >> b >> c;
		int x = a[b];
		a[c] += a[b];
		a[b] = 0;
		sum += x * (c - b);
		cout << sum << endl;
	}
	return 0;
}



Measured memory_bytes: 7948
#include<stdio.h>

int main(){

int s,h,m,ss,sm;
scanf("%d",&s);

if(s<60){
	printf("0:0:%d\n",s);
}
else if(s<3600 && s>= 60){
	m = s/60;
	ss = s - (m*60);
    printf("0:%d:%d\n",m,ss);
}
else if(s>=3600 && s<=86400){
	h = s/3600;
	sm = s - (h*3600);
	m = sm/60;
	ss = sm - (m*60);
    printf("%d:%d:%d\n",h,m,ss);
}
return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(){
	int N,x;

	vector<int> A;
	cin >> N;


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

	sort(A.begin(),A.end());
	cout << abs(A[0] - A[N-1]) << endl;

	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
typedef long long ll;
int main()
{
    ll N;
    int a=0,i,c,j;
    int l[8]={3,6,10,15,21,28,36,45};
    scanf("%lld",&N);
    for(i=2;i<1000001;i++){
        if(N%i) continue;
        c=0;
        while(N%i==0){
            c++;
            N/=i;
        }for(j=0;j<8;j++){
            if(l[j]>c) {
                a+=j+1;
                break;
            }
        }

    }
    if(N>1) a+=1;
    printf("%d",a);
}

Measured memory_bytes: 1704
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
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);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    while(N){
        if(N%26 == 0){
            res += 'z';
            N -= 26;
            N /= 26;
        }else{
            res += (char)('a' + N%26 - 1);
            N /= 26;
        }
    }
    reverse(res.begin(),res.end());
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 100000
#define QMAX 1000
 
//構造体
typedef struct {
  char name[10];
  int t;
}Process;
  
//プロトタイプ宣言
void enqueue(Process);
Process dequeue(void);
  
//グローバル変数
Process Q[MAX];
int n,q;
int ttime;
int i;
int top,last;
  
int main(void){
  
  Process stack;
  
  scanf("%d %d", &n, &q);
  
  //スケジュールの入力
  for ( i = 0; i < n; i++){
    scanf("%s", stack.name);
    scanf("%d", &stack.t);
    enqueue(stack);
  }

  i=0;

  while(0 < n){

    stack = dequeue();

    if(stack.t <= q){
      printf("%s %d\n",stack.name,stack.t + ttime);
      --n;
    


    ttime += stack.t;
    }
    else{
      stack.t = stack.t - q;

      enqueue(stack);

      ttime += q;
    }
  }

  return 0;
}
    
//終了したプロセスを表示する
void enqueue(Process x){
  
  if(last+1 == MAX)
    last = 0;

  Q[last++] = x;
}
  
Process dequeue(void){

  if(top + 1 == MAX)
    top = 0;

 return Q[top++];
        
}

Measured memory_bytes: 2160
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,z,d,ma;
int main()
{

    scanf("%d%d%d%d%d",&x,&y,&z,&d,&n);ma=min(min(4*x,2*y),z);

    cout<<min(ma*n,(n/2*d+n%2*ma))<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll mod = 1e9 + 7;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> step(n + 1, true);
  rep(i, m) {
    int tmp;
    cin >> tmp;
    step[tmp] = false;
  }
  vector<ll> dp(n + 1);
  dp[0] = 1;
  for (int now = 0; now < n; now++) {
    for (int next = now + 1; next <= min(n, now + 2); next++) {
      if (step[next]) {
        dp[next] += dp[now];
        dp[next] %= mod;
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

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

    int n;

    cin >> n;

    int p[n];
    int ans;

    int i, len;

    rep(i, n) cin >> p[i];

    sort(p, p + n);

    ans = p[n - 1] / 2;
    len = n - 1;
    rep(i, len) ans += p[i];

    Out(ans);

    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-
  This code was written after reading the editorial.
-}

import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Lazy.Char8 as B
import Control.Monad.Primitive
import Data.Function
import Data.List
import Data.Maybe
import Control.Monad
import Control.Monad.ST
import Data.Bits
import Debug.Trace

solve :: Int -> [Int] -> Int
solve n as = binsch (minimum as) (maximum as + 1)
  where
    binsch xMin xMax | xMin + 1 == xMax = xMin
                     | try mid n as     = binsch mid xMax
                     | otherwise        = binsch xMin mid
      where mid = (xMax + xMin) `div` 2

try :: Int -> Int -> [Int] -> Bool
try x n as =
  t >= ((n * (n+1) `div` 2) + 1) `div` 2
  where
    t = numIncr (2*n + 1) ss
    ss = scanl' (+) (n+1) $ map (\a -> if a >= x then 1 else -1) as

numIncr lim as = runST $ do
  v <- VUM.replicate (lim+1) 0
  sub v 0 as
  where
    sub v !acc [] = return acc
    sub v !acc (a:as) = do
      y <- bit_intv v a
      bit_add v lim a 1
      sub v (acc+y) as

{--
  bit_add v n i x ... a_i += x
--}
bit_add :: VUM.MVector s Int -> Int -> Int -> Int -> ST s ()
bit_add v n i x = sub i
  where
    sub !j | j > n     = return ()
           | otherwise = do
               VUM.modify v (+ x) j
               sub (j + (j .&. (-j)))

{--
  bit_intv v i    ... \Sum_{j=1}^{i} a_i
--}
bit_intv :: VUM.MVector s Int -> Int -> ST s Int
bit_intv v i = sub 0 i
  where
    sub !acc 0 = return acc
    sub !acc !j = do
      y <- VUM.read v j
      sub (acc+y) (j - (j .&. (-j)))

bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

tmain :: B.ByteString -> Int
tmain cont =
  let n : as = bsReadInts cont
  in solve n as

main = putStrLn . show . tmain =<< B.getContents


Measured memory_bytes: 18812
#include<stdio.h>
#include<string.h>
#define N 1000
int longco(char X[],char Y[])
{
  int A[N+1][N+1];
  int i,j;
  int k=strlen(X);
  int l=strlen(Y);
  int max=0;
  for(i=1;i<=k;i++)
    {
      for(j=1;j<=l;j++)
	{
	  A[i][j]=0;
	}
    }

  
  for(i=1;i<=k;i++)
    {
      for(j=1;j<=l;j++)
	{
	  if(X[i-1]==Y[j-1]) A[i][j]=A[i-1][j-1]+1;
	  else
	    {
	      if(A[i-1][j]>A[i][j-1])A[i][j]=A[i-1][j];
	      else A[i][j]=A[i][j-1];
	    }
	  if(max>A[i][j])max=max;
	  else max=A[i][j];
	}
    }
  return max;
}

int main()
{
  char s1[N],s2[N];
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s %s",s1,s2);
      printf("%d\n",longco(s1,s2));
    }
  return 0;
}
  

Measured memory_bytes: 4524
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V<ll> a(n);
    map<ll,ll> mp;
    ll ans=0;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
        ans+=a[i];
    }
    int q;
    cin>>q;
    while(q--){
        ll b,c;
        cin>>b>>c;
        ans-=b*mp[b];
        mp[c]+=mp[b];
        ans+=c*mp[b];
        mp[b]=0;
        cout<<ans<<'\n';
    }
    //ll ans=0;
    //cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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

using namespace std;

#if !defined(ONLINE_JUDGE) && 1
#define DEBUG(x) cerr << " --- " << #x << "\t" << (x) << endl;
#define DEBUG2(x) cerr << "DEBUG: " << x << endl;
#else
#define DEBUG(x)
#define DEBUG2(x)
#endif

using ll = long long;
using uint = unsigned int;
using rl = double;
using pii = pair<int, int>;

const int modd = 1000000000 + 7;
const int MAXN = 100009;
int n;
char s[MAXN];

int cnt[26];

int add(int a, int b)
{
    a += b;
    if (a >= modd)
        a -= modd;
    return a;
}

int mult(int a, int b)
{
    ll c = a * (ll)b;
    if (c >= modd)
        c %= modd;
    return c;
}

int main()
{
    scanf("%d", &n);
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i++)
    {
        cnt[(int)(s[i] - 'a')]++;
    }

    int res = 1;
    for (int i = 0; i < 26; i++)
    {
        res = mult(res, add(1, cnt[i]));
    }
    printf("%d\n", add(modd - 1, res));
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip> 
#include <cstdlib>
#include <cmath>
#include<map>
#include<string.h>
#include <algorithm>
#include <bits/stdc++.h> 
#include<vector>
 
using namespace std;
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
//#define viadj[n+1] vector<int>adj[n+1] 
#define sortA(arr)   sort(arr.begin(),arr.end())
#define sortC(arr,n)   sort(arr,arr+n,comparefunc())
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define ll long long
#define LCM(a,b) boost::math::lcm(a,b)
#define mp make_pair
#define pll pair<long long int,long long int>
 vb isprime(1e7+1,true);
 
struct node{
     ll lenght;};
        
void Sieve(ll maxn){ 
    ll j;isprime[0]=isprime[1]=false;
    rep(i,2,sqrt(maxn)+1)
    {
        if(isprime[i]){
            for(j=i*i;j<=maxn;j+=i){
                isprime[j]=false;
            }
        }
    }
} 
 struct comparefunction{
bool operator()(const pll c,const pll d)const{
    ll lenc=c.second-c.first+1;
    ll lend=d.second-d.first+1;
    if(lenc!=lend)
    return lenc>lend;
    else
    return c.first<d.first;
   
     
}};
 
  
 
   void dfs(ll v,vb visited,vi adj[]) {
    visited[v] = true;
 
    
    for (int u : adj[v]) {
       if (!visited[u])
            dfs(u,visited,adj);
    }
   
    
}
 
 ll modpow(ll x, ll n,ll p){
     if(n==0)
     return 1;
     if(n==1)
     return x%p;
     if(n%2==0)
     return (modpow(x,n/2,p)%p)*(modpow(x,n/2,p)%p);
     else
     return (x%p)* (modpow(x,n/2,p)%p)*(modpow(x,n/2,p)%p);
 }
 
 
 
int main()
{
    
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
   
    ll check1=0,check2=0,check3=0;
    ll counti=0, i=0,j;
    ll sum=0,count=0,t,k,q,l,r;ll s;
  // cin>>t;
  //while(t--){
  ll m,n;check1=0;ll W;
cin>>n>>W;
ll dp[W+1][n+1];


vl w(n+1);
vl v(n+1);
rep(i,1,n+1)
cin>>w[i]>>v[i];
ll weight=0;
rep(i,0,n+1)
    dp[0][i]=0;
    rep(j,0,W+1)
    dp[j][0]=0;
    rep(i,1,W+1)
    {
        rep(j,1,n+1){
            dp[i][j]=dp[i][j-1];
         
            if(w[j]<=i)
            dp[i][j]=max(dp[i][j],v[j]+dp[i-w[j]][j-1]);
        }
    }
ll ans=dp[W][n];
cout<<ans;




//}
    
}
  



 
   
 
 

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

using namespace std;

#define sz(x) (int) x.size()
#define all(a) a.begin(), a.end()

const int MAXN = 505;

const int di[] = {-1, 1, 0, 0};
const int dj[] = {0, 0, -1, 1};

int n;
int dist[MAXN][MAXN];
bool gone[MAXN][MAXN];
deque<pair<int, int>> q;

int main() {

    scanf("%d", &n);

    for (int i = 0; i < n; i++) 
        for (int j = 0; j < n; j++) {
            dist[i][j] = min(i, n - i - 1);
            dist[i][j] = min(dist[i][j], min(j, n - j - 1));
        }

    long long ans = 0;

    for (int i = 0; i < n * n; i++) {
        int cur;
        scanf("%d", &cur);
        cur--;

        int ii = cur / n, jj = cur % n;
        gone[ii][jj] = true;
        ans += dist[ii][jj];

        // cerr << ii << " " << jj << " " << dist[ii][jj] << endl;

        // if (dist[ii][jj]) 
        // dist[ii][jj]--;

        q.push_front({ii, jj});

        while (!q.empty()) {
            int curI = q.front().first, curJ = q.front().second;
            q.pop_front();

            for (int k = 0; k < 4; k++) {
                int newI = curI + di[k], newJ = curJ + dj[k];
                if (newI < 0 || newI >= n || newJ < 0 || newJ >= n)
                    continue;

                int add = gone[curI][curJ] ? 0 : 1;

                if (dist[curI][curJ] + add < dist[newI][newJ]) {
                    dist[newI][newJ] = dist[curI][curJ] + add;

                    if (add == 0)
                        q.push_front({newI, newJ});
                    else
                        q.push_back({newI, newJ});
                }
            }
        }

        // for (int iii = 0; iii < n; iii++) {
        //     for (int j = 0; j < n; j++) {
        //         cerr << dist[iii][j] << " ";
        //     }
        //     cerr << endl;
        // }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5740
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20)
#define int long long
#define double long double
#define gcd __gcd
#define lcm(a, b) (a / gcd(a, b) * b)
#define factorial(a) (a < 2 ? 1 : factorial(a - 1) * a)
#define summation(a) (a < 1 ? 0 : (a * a + a) / 2)
const int INF = 1e18, MOD = 1e9 + 7;

int n;

signed main() {
    INCANT;
    cin>>n;
    stack<int> v;
    while (n > 0) {
        v.push(n % 26 - 1);
        n--;
        n /= 26;
    }
    while (!v.empty()) {
        char a = 'a' + v.top();
        if (a < 'a') a += 26;
        cout<<a;
        v.pop();
    }
}

Measured memory_bytes: 3612
import heapq


class Graph(object):

    class Node:
        def __init__(self, dist: int, number: int):
            self.dist = dist
            self.number = number

        def __lt__(self, other):
            return self.dist < other.dist \
                   or (self.dist == other.dist
                       and self.number < other.number)

        def __le__(self, other):
            return self.dist <= other.dist

        def __gt__(self, other):
            return other <= self

        def __ge__(self, other):
            return other < self

        def __str__(self):
            return "Node: (" + str(self.number) + ", " \
                   + str(self.dist) + ")"

    class Edge:
        def __init__(self, to: int, cost: int):
            self.to = to
            self.cost = cost

        def __str__(self):
            return "Edge: (" + str(self.to) + ", " \
                   + str(self.cost) + ")"

    INF = 10e10

    def __init__(self, node_n: int, start: int):
        self.node_n = node_n
        self.start = start
        self.edges = [{} for _ in range(self.node_n)]
        self.dist = [self.INF for _ in range(self.node_n)]

    def set_edge(self, from_pos: int, to_pos: int, cost: int, reversible: bool) -> None:
        self.edges[from_pos][to_pos] = (self.Edge(to_pos, cost))
        if reversible:
            self.edges[to_pos][from_pos] = (self.Edge(from_pos, cost))

    def solve(self) -> list:
        raise NotImplementedError


class Dijkstra(Graph):
    hq = []
    prev: list

    def __init__(self, node_n: int, start: int):
        super(Dijkstra, self).__init__(node_n, start)
        self.dist[self.start] = 0
        self.prev = [None for _ in range(node_n)]

    def solve(self) -> list:
        heapq.heappush(self.hq, self.Node(0, self.start))

        while len(self.hq) != 0:
            node = heapq.heappop(self.hq)
            if node.dist > self.dist[node.number]:
                continue

            for edge in self.edges[node.number].values():
                alt = self.dist[node.number] + edge.cost
                if self.dist[edge.to] > alt:
                    self.dist[edge.to] = alt
                    self.prev[edge.to] = node.number
                    heapq.heappush(self.hq, self.Node(self.dist[edge.to], edge.to))

        return self.dist


if __name__ == '__main__':
    n = int(input())
    graph = Dijkstra(n, 0)

    for _ in range(n):
        buff = list(map(int, input().split()))
        u = buff[0]
        k = buff[1]
        for i in range(k):
            graph.set_edge(u,
                           buff[2 + i * 2],
                           buff[3 + i * 2],
                           False)
    dist = graph.solve()
    for i, d in enumerate(dist):
        print(i, d)



Measured memory_bytes: 6984
program ABC077A
    implicit none
    character(3)::C1,C2
    read(5,*)C1,C2

    if(C1(1:1)==C2(3:3) .and. C1(2:2)==C2(2:2) .and. C1(3:3)==C2(1:1))then
        print'(A)',"YES"
    else
        print'(A)',"NO"
    end if
    
end program ABC077A

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 2147483647
#define dinf 0x3f3f3f3f
#define llinf 0x7f7f7f7f7f7f7f7f

#define ll long long
#define rei register int
#define inv inline void
#define ull unsigned long long
#define il inline

#define bl putchar(' ')
#define ed putchar('\n')
#define test cout<<"this:" 

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x){
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
int a,b;
int main()
{
	read2(a,b);
	b*=2;
	if(a<=b) write(0);
	else write(a-b);
	return 0;
}

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

using namespace std;
const long long int MOD=998244353;


long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
  long long n, d[100009], mx=0;
  map<long long, long long> m;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> d[i];
    mx = max(mx, d[i]);
    m[d[i]]++;
  }
  bool check=false;

  if(d[0]!=0 || m[0]>=2){
    cout << 0 << endl;
    return 0;
  }
  long long ans=1;
  for(int i=1;i<=mx;i++){
    ans = (modpow(m[i-1], m[i], MOD) * ans)%MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 7296
a['   '];n,s,i,m;main(k){for(;scanf("%d%d",&n,&k)*n;s=!printf("%d\n",m))for(i=-1;++i-n;m=i<k?s+=a[i]:fmax(m,s+=a[i]-a[i-k]))scanf("%d",a+i);}

Measured memory_bytes: 1000
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cout << v << " ";                                                          \
  }                                                                            \
  cout << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, D, X;
  cin >> N >> D >> X;
  int ans = 0;
  REP(i, N) {
    int p;
    cin >> p;
    ans += 1 + (D - 1) / p;
  }
  ans += X;
  print(ans);
}

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

int main() {
int N;
string S;
int r=0;
int b=0;
cin >>N>>S;
for(int i=0;i<N;i++){
  if(S.at(i)=='R'){
    r++;
  }
  else if(S.at(i)=='B'){
    b++;
  }
}
if(r>b){
  cout <<"Yes"<<endl;
}
else if (r<=b){
  cout <<"No"<<endl;
}
}

Measured memory_bytes: 256
#include<cstring>
#include<iostream>

using namespace std;

typedef long long ll;

#define MOD 1000000007

string s;
ll dp[100001][4];

ll solve(int p, int c){
	if(dp[p][c] != -1) return dp[p][c];
	if(p == s.length() && c == 3) return dp[p][c] = 1;
	if(p == s.length() && c != 3) return dp[p][c] = 0;
	ll res = solve(p + 1, c);
	if(s[p] == '?') res *= 3;
	if(c < 3 && (s[p] == "ABC"[c] || s[p] == '?')) res += solve(p + 1, c + 1);
	return dp[p][c] = res % MOD;
}

int main(){
	cin >> s;
	memset(dp, -1, sizeof(dp));
	cout << solve(0, 0) << endl;
	return 0;
}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N; cin >> N;
    vec L(N); cin >> L;
    int ans = 0;
    REP(i, N) REP(j, i) REP(k, j){
        vec v({L[i], L[j], L[k]});
        Sort(v);
        if(v[0] != v[1] && v[1] != v[2] && v[2] < v[0] + v[1]) ans++;
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 int main() {
	int N;
   cin>>N;
   if(N%10==9||N/10==9){cout<<"Yes";}
   else{cout<<"No";}
  
   }
	

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

using namespace std;
int main() {
#ifdef LDT
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<long long> a(n);
    double l = 0;
    for (auto &x : a) {
        cin >> x;
        if (x == 0) {
            return !(cout << 0);
        }
        l += log10(x);
    }
    if (l > 18 + 0.001) {
        return !(cout << -1);
    }
    long long ans = 1;
    for (auto x : a) ans *= x;
    if (ans > 1000000000ll * 1000000000ll) {
        cout << -1;
        return 0;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3992
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m;
    cin>>n>>m;
    vector<int> a(n+1);
    REP(i,n) cin >> a[i+1];
    rep(i,n){
        a[i+1]+=a[i];
    }
    rep(i,n){
        a[i+1]%=m;
    }
    map<int,int> mp;
    ll ans=0;
    for(int i=0;i<=n;i++){
        ans+=mp[a[i]];
        mp[a[i]]++;
    }
    cout<<ans<<endl;

    
    
}

Measured memory_bytes: 4992
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

#define N_MAX 200000
#define MODVAL 1000000007

int main(void){
	char s[4];

	scanf("%s",s);

	if(s[1] == 'B'){
		printf("ARC\n");
	}else{
		printf("ABC\n");
	}

}

Measured memory_bytes: 1644
#include<cstdio>
#include<algorithm>
using namespace std;
static const int MAX_N = 10000;

int N;
int a[MAX_N];

int main(){
	for(;;){
		scanf("%d", &N);
		if(N == 0) break;
		for(int i = 0; i < N; i++) scanf("%d", &a[i]);
		int res = N;
		for(int i = 0; i < N; i++){
			int bf = a[i];
			for(int j = 1; j <= 3; j++){
				if(j == a[i]) continue;
				a[i] = j;
				int num_vanish = 0;
				int prev = i, next = i;
				for(;;){
					int cnt;
					if(prev == i && next == i) cnt = 1;
					else cnt = 2;
					while(prev > 0 && a[prev - 1] == a[prev]){
						prev--;
						cnt++;
					}
					while(next < N - 1 && a[next + 1] == a[next]){
						next++;
						cnt++;
					}
					if(cnt < 4) break;
					num_vanish += cnt;
					prev--; next++;
					if(a[prev] != a[next]) break;
				}
				res = min(res, N - num_vanish);
			}
			a[i] = bf;
		}
		printf("%d\n", res);
	}
	return 0;
}


Measured memory_bytes: 2620
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        BinaryTree btr = new BinaryTree();
        for (int i = 0; i < n; i++)
        {
            string[] inputs = Console.ReadLine().Split(' ');
            if(inputs[0] == "insert") btr.Insert(int.Parse(inputs[1]));
            else btr.Print();
        }
    }
}

class BinaryTree
{
    public class Node
    {
        public int Value {get; set;}
        internal Node parent, left, right;
        internal Node(int val, Node parent)
        {
            this.Value = val;
            this.parent = parent;
        }
    }

    Node root;

    public void Insert(int val)
    {
        Node tmpParent = null;
        Node tmpPosition = this.root;
        while(tmpPosition != null)
        {
            tmpParent = tmpPosition;
            if(val < tmpParent.Value) tmpPosition = tmpParent.left;
            else tmpPosition = tmpParent.right; 
        }
        if(tmpParent == null) this.root = new Node(val, null);
        else if(val < tmpParent.Value) tmpParent.left = new Node(val, tmpParent);
        else tmpParent.right = new Node(val, tmpParent);
    }

    public void Print()
    {
        InorderedDisplay(this.root);
        Console.WriteLine();
        PreorderedDisplay(this.root);
        Console.WriteLine();
    }
    private void InorderedDisplay(Node node)
    {
        if(node == null) return;
        InorderedDisplay(node.left);
        Console.Write(" " + node.Value);
        InorderedDisplay(node.right);
    }
    private void PreorderedDisplay(Node node)
    {
        if(node == null) return;
        Console.Write(" " + node.Value);
        PreorderedDisplay(node.left);
        PreorderedDisplay(node.right);
    }
}

Measured memory_bytes: 46572
#include<iostream>

using namespace std;

int w, h;
char fld[100][100];
char a[100][100];
char b[100][100];
int dx[]={0, 0, 1, -1};
int dy[]={1, -1, 0, 0};


void rec(int i, int j, char c){

    for(int k=0; k<4; k++){
        int ni=i+dx[k];
        int nj=j+dy[k];
        if(!(0<=ni&&ni<h&&0<=nj&&nj<w)) continue;
        if(c=='w'){
            if(a[ni][nj]=='.'){
                a[ni][nj]=c;
                rec(ni, nj, c);
            }else if(a[ni][nj]=='b'){
                a[ni][nj]='#';
                rec(ni, nj, c);
            }
        }else{
            if(a[ni][nj]=='.'){
                a[ni][nj]=c;
                rec(ni, nj, c);
            }
        }
    }
}

int main(){

    while(1){
        cin>> w>> h;
        if(!(w||h)) break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                cin>> fld[i][j];
            }
        }

        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                a[i][j]=fld[i][j];
            }
        }

        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(fld[i][j]=='B') rec(i, j, 'b');
            }
        }
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(fld[i][j]=='W') rec(i, j, 'w');
            }
        }
        int www=0, bbb=0;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                www+=(a[i][j]=='w');
                bbb+=(a[i][j]=='b');
            }
        }

        cout<< bbb<< " "<< www<< endl;
    }



    return 0;
}

Measured memory_bytes: 3076
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

//H時M分の時Acm時針,Bcm分針の先端間の距離を出力
//時針の角度：((H*60+M)/(12*60))*(全角度)
//時計を、x軸右方向を0時とする
//時針先端の座標：(A*cos(角度),A*sin(角度))
//分針同様
int main(){
    double A,B,H,M;
    cin >> A >> B >> H >> M;
    double dis;

    double A_range = 2*M_PI*((H*60+M)/(12*60));
    double B_range = 2*M_PI*(M/60);
    dis=pow(A*cos(A_range)-B*cos(B_range),2)+pow(A*sin(A_range)-B*sin(B_range),2);
    dis=sqrt(dis);

    cout << fixed << setprecision(15) << dis << endl;
}

Measured memory_bytes: 4148