akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll d[1000100];

long long modpow(long long a, long long b){ 
  long long r = 1LL;
  while(b){
    if(b & 1LL)r *= a;
    if(r >= MOD)r %= MOD;
    a *= a;
    if(a >= MOD)a %= MOD;
    b >>= 1LL;
  }
  return r%MOD;
}

int main(){
  clr(d,0);
  ll n;
  cin>>n;
  vector<ll> v;
  rep(j,0,n){
    ll m;
    cin>>m;
    v.pb(m);
    map<ll,ll> ma;
    while(m % 2 == 0){
      ma[2]++;
      m /= 2LL;
    }
    for(long long i = 3LL; i * i <= m; i += 2LL){
      while(m % i == 0){
        ma[i]++;
        m /= i;
      }
    }
    if(m > 1LL){
      ma[m]++;
    }
    map<ll,ll>::iterator itr = ma.begin();
    while(itr!=ma.end()){
      ll a = (*itr).fi;
      ll b = (*itr).se;
      d[a] = max(d[a],b);
      itr++;
    }
  }
  ll dd = 1;
  rep(i,0,1000100){
    if(d[i]>0){
      dd *= modpow(i,d[i]);
      dd %= MOD;
    }
  }
  ll ans = 0;
  rep(i,0,v.sz){
    ans += (dd*modpow(v[i],MOD-2))%MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

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

long long n;
vector<long long> a;
template <class T>
void readVector(int n, vector<T> &v){
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	readVector(n, a);
	long long s = 0;
	for(auto i : a)
		s += i;
	if(s % (n * (n+1) / 2) == 0){
		long long k = s * 2 / n / (n+1);
		bool f = true;
		for(int i=0; i<n; ++i){
			if((k - a[(i+1)%n] + a[i]) % n != 0)
				f = false;
			if(k - a[(i+1)%n] + a[i] < 0)
				f = false;
		}
//		cout << k << " " << tmp << "\n";
		cout << (f ? "YES\n" : "NO\n");
	}else{
		cout << "NO\n";
	}
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
#define fil(x) memset(x, 0, sizeof(x))
#define fillb(x) memset(x,false,sizeof(x))
#define fillm(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define pll pair<int, int>
#define pf printf
#define sf scanf
#define all(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<n;i++)
#define fof(i,a,b) for(int i=a;i<=b;i++)
#define off(i,a,b) for(int i=a;i>=b;i--)
#define of(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define nl endl

typedef unsigned long long lll;
typedef long long ll;
int knigtx8[] = {2, 2, -2, -2, 1, 1, -1, -1}; ///knight move in chess
int knigty8[] = {1, -1, 1, -1, 2, -2, 2, -2}; ///knight move in chess
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; ///for 8 directions
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1}; ///for 8 directions
int dx4[] = {0, 0, 1, -1}; ///for 4 directions
int dy4[] = {1, -1, 0, 0}; ///for 4 directions
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}
ll pw(ll a, ll b)
{
    ll ans = 1;
    for(ll i = 1; i <= b; ++i)
        ans = (ans * a);
    return ans;
}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

int main()
{
    IOS;
    int a,b;
    cin>>a>>b;
    if(b%2!=0)cout<<"No"<<endl;
    else if(b>4*a or a>b/2)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

///Alhamdulillah


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N;
	cin>>N;
	long long int A[N],sum=0;
	int i,j,k;
	vector <long long int> freq(100000,0);
	for(i=0;i<N;i++)
	{
		cin>>A[i];
		freq[A[i]]++;
		sum=sum+A[i];
	}
	int Q;
	cin>>Q;
	int q,w;
	for(i=1;i<=Q;i++)
	{
		cin>>q>>w;
		sum=sum+(long long int)(w-q)*freq[q];
		freq[w]=freq[w]+freq[q];
		freq[q]=0;
//		if(freq[q]<0)
//		freq[q]=0;
		cout<<sum<<"\n";
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

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

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

    // 終了時刻でsortを行い、判定する
    int N;
    cin >> N;
    vector<pair<ll, ll>> AB(N);

    ll tmpA, tmpB;
    for(int i = 0; i < N; i++){
        cin >> tmpA >> tmpB;
        AB[i] = make_pair(tmpA, tmpB);
    }

    sort(AB.begin(), AB.end(), [](pair<ll, ll> pa, pair<ll, ll> pb){return pa.second < pb.second;});
    
    // for(int i = 0; i < N; i++){
    //     cout << AB[i].first << AB[i].second << endl;
    // }
    
    bool en_finish = true;
    ll now = 0;
    for(int i = 0; i < N; i++){
        now += AB[i].first;
        if(now > AB[i].second){
            en_finish = false;
        }
    }

    if(en_finish){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define pb push_back
#define all(_obj) _obj.begin(),_obj.end()
#define F first
#define S second
#define INF 1e18
#define pll pair<ll, ll> 
#define vll vector<ll>
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=1e5+11,mod=1e9+7;
inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline vll read(int n) {vll v(n);for (int i = 0; i < v.size(); i++)cin>>v[i];return v;}
void sol()
{
cin>>n;
vll v=read(n);
ll t=0;
ll mx=0;
for(int i=0;i<n;i++)
{
 t+=max(0,mx-v[i]);
 mx=max(v[i],mx);
}
cout<<t;
return ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test=1;
    //cin>>test;
    for(int i=1;i<=test;i++)
    sol();
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const int MOD=1000000007;
int INF=100100100100100;
int add(int a,int b){
  return (a+b)%MOD;
}
int prod(int a,int b){
  return (a*b)%MOD;
}

int beki(int a,int b)
{
	if(b==0)return 1;
	int x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

int inv(int a)
{
	return beki(a,MOD-2);
}

int kaijou(int a)
{
	int ans=1;
	for(int i=1;i<=a;i++)
	{
		ans=(ans*i)%MOD;
	}			
	return ans;
}

/*int combi(int a,int b)
{
	int ret=1;
	for(int i=1;i<=b;i++)
	{
		ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
	}
	return ret;
}*/
/*
const int MAX_a=200010;
int cb[MAX_a+1]
void combi(int a,int b)
{
    int ret=1;
    cb[0]=1;
    for(int i=1;i<=b;i++)
    {
	ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
        cb[i]=ret;
    }
	
}*/

vector<P> prime_factorize(int N)
{
	vector<P> res;
	for(int a=2;a*a<=N;a++)
	{
		if(N%a!=0)continue;
		int ex=0;
		while(N%a==0)
		{
			ex++;N/=a;
		}
		res.push_back(P(a,ex));
	}
	if(N!=1)res.push_back(P(N,1));
	return res;
}

//ここから書く
signed main(){
  int a,b;cin>>a>>b;
  int ans=max((int)0,4-a)*100000+max((int)0,4-b)*100000;
  if(a==1 && b==1)ans+=400000;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    string line;

    while(getline(cin, line)) {

        for(int i = 0; i < line.length(); i++) {
            if (line[i] != '@') {
                cout << line[i];
            } else {
                int t = line[i+1] - '0';
                for(int k = 0; k < t; k++)  cout << line[i+2];
                i += 2;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 int x = sc.nextInt();
		 if(x == 0) {
			 System.out.print(1);
		 }else {
			 System.out.print(0);
		 }

	}

}


Measured memory_bytes: 35668
#include <bits/stdc++.h>
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
#define erep(i,l,r) for((i)=(l);(i)<=(r);(i)++)
#define drep(i,l,r) for((i)=(l);(i)>=(r);(i)--)
#define MOD 1000000007
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    int i;
    double a[n],chi=1,mom=0;
    rep(i,0,n){
        cin>>a[i];
        chi*=a[i];
    }
    rep(i,0,n) mom+=chi/a[i];
    printf("%.6lf\n",chi/mom);
}

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

using namespace std;
static const int INF = 1000000000;

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<vector<int>> conn(n);
	for(int i = 1; i < n; ++i){
		int a, b;
		cin >> a >> b;
		--a; --b;
		conn[a].push_back(b);
		conn[b].push_back(a);
	}
	vector<vector<int>> mat(n, vector<int>(n, INF));
	for(int r = 0; r < n; ++r){
		auto &row = mat[r];
		queue<int> q;
		row[r] = 0;
		q.push(r);
		while(!q.empty()){
			const int u = q.front();
			q.pop();
			for(const int v : conn[u]){
				if(row[v] < INF){ continue; }
				row[v] = row[u] + 1;
				q.push(v);
			}
		}
	}
	int answer = INF;
	if(k % 2 == 1){
		for(int u = 0; u < n; ++u){
			for(const int v : conn[u]){
				int count = 0;
				for(int i = 0; i < n; ++i){
					if(mat[u][i] + mat[v][i] <= k){ ++count; }
				}
				answer = min(answer, n - count);
			}
		}
	}else{
		for(int i = 0; i < n; ++i){
			int count = 0;
			for(int j = 0; j < n; ++j){
				if(mat[i][j] <= k / 2){ ++count; }
			}
			answer = min(answer, n - count);
		}
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 16128
N = int(input())

ans = 0
for j in range(1, N+1):
    # ある数jのNまでの倍数をすべて足す。等差数列の和
    n = N // j
    tmp = n * (2 * j + (n-1) * j) // 2
    ans += tmp

print(ans)

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

int main() {

	int r, c;
	cin >> r >> c;

	int sheet[r + 1][c + 1];

	for (int i = 0; i < c + 1; ++i) {
		sheet[r][i] = 0;
	}
	for (int i = 0; i < r + 1; ++i) {
		sheet[i][c] = 0;
	}

	for (int i = 0; i < r; ++i) {
		for (int j = 0; j < c; ++j) {
			cin >> sheet[i][j];
		}
	}

	for (int i = 0; i < r; ++i) {
		for (int j = 0; j < c; ++j) {
			sheet[i][c] += sheet[i][j]; //??????????即?
			sheet[r][j] += sheet[i][j]; //??????????即?
			sheet[r][c] += sheet[i][j]; //??即??????????即?
		}
	}

	for (int i = 0; i < r + 1; ++i) {
		for (int j = 0; j < c + 1; ++j) {
			if (j < c )
				cout << sheet[i][j] << " ";
			else
				cout << sheet[i][j] << endl;
		}
	}

	return 0;
}

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

using namespace std;

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

    int sum=0;
    for (int i=0;i<N;i++) {
        for (int j=0;j<N;j++) {
            if (i != j) {
                sum += dn[i] * dn[j];
            }
        }
    }

    cout << sum/2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


string s;

void solve()
{
    cin >> s;
    if (s[0]=='7'||s[1]=='7'||s[2]=='7') nout("Yes");
    else nout("No");
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

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

#define ll long long
const int mod=1e9+7;

void U(auto &x,auto y){
    x=(x+y)%mod;
}
ll K(ll x,ll y=mod-2){
    ll t=1;
    for (;y;y>>=1,x=x*x%mod)
        if (y&1) t=t*x%mod;
    return t;
}

struct VAL{
    int v[2][2][2];
}nil, one;

VAL operator + (VAL a,VAL b){
    VAL c=nil;
    for (int la=0;la<=1;++la)
        for (int ra=0;ra<=1;++ra)
            for (int fa=0;fa<=1;++fa)
                for (int lb=0;lb<=1;++lb)
                    for (int rb=0;rb<=1;++rb)
                        for (int fb=0;fb<=1;++fb){
                            U(c.v[la][rb][fa|fb|ra==lb],(ll)a.v[la][ra][fa]*b.v[lb][rb][fb]);
                        }
    return c;
}

int n;

VAL calc(vector<int>vec){
    int mn=*min_element(vec.begin(),vec.end()), sz=vec.size();
    VAL res=nil; int fir=1;
    for (int i=0;i<sz;++i){
        VAL tmp;
        if (vec[i]==mn) tmp=one;
        else {
            vector<int>nex;
            while (i<sz&&vec[i]>mn) nex.push_back(vec[i]-mn+1), ++i;
            --i;
            tmp=calc(nex);
        }
        if (fir) res=tmp, fir=0;
        else res=res+tmp;
    }
    int t=mn-1;
    if (!t) return res;
    VAL re2=nil;
    for (int lb=0;lb<=1;++lb)
        for (int rb=0;rb<=1;++rb)
            for (int fl=0;fl<=1;++fl){
                if (!fl){
                    for (int dif=0;dif<=1;++dif)
                        U(re2.v[lb^dif][rb^dif][fl],res.v[lb][rb][fl]*K(2,t-1));
                }else{
                    int dif=t&1;
                    U(re2.v[lb^dif][rb^dif][fl],res.v[lb][rb][fl]);
                }
            }
    return re2;
}

int main(){
    cin>>n;
    vector<int>vec;
    for (int i=1;i<=n;++i){
        int x; cin>>x;
        vec.push_back(x);
    }
    one.v[1][1][0]=one.v[0][0][0]=1;
    VAL res=calc(vec);
    int ans=0;
    for (int lb=0;lb<=1;++lb)
        for (int rb=0;rb<=1;++rb)
            for (int fl=0;fl<=1;++fl)
                U(ans,res.v[lb][rb][fl]);
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define lpp(i, n) for (int i = 1; i <= (n) ; ++i)
#define sz(v) (int)(v).size()
#define int long long
#define mod 100000007

string x ;


int32_t main() {
    int n, t;
    cin >> n ;
    int arr[n+1];
    lpp(i,n)cin>>arr[i];
    int dp[n+1];
    arr[0]=100000000000;
    dp[0]=0;
    dp[1]=0;
    for (int j = 2; j <= n; ++j) {
        dp[j]=min(dp[j-1]+abs(arr[j]-arr[j-1]),dp[j-2]+abs(arr[j]-arr[j-2]));
    }
    cout << dp[n];
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define EPS 1e-14
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

int main()
{
   
    ull n, i, a, b, c;
    cin>>n;
    a=2;b=1;
    for(i=1;i<n;i++){
        c=a+b;
        a=b;
        b=c;
    }if(n==0)cout<<"2"<<endl;
    else if(n==1)cout<<"1"<<endl;
    else cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
N = int(input())
a = list(map(int,input().split()))
b = []
for i in range(N):
    for j in range(a[i]):
        b.append(i+1)
s = 0
for i in range(H):
    if i % 2== 0:
        print(*b[s:s+W])
    else:
        print(*b[s+W-1:s-1:-1])
    s += W

Measured memory_bytes: 9332
#include <stdio.h>
int main()
{
    int n, res = 0;
    scanf("%d", &n);
    int b[n - 1];
    int a[n];
    for (int i = 0; i < n - 1; i++)
        scanf("%d", &b[i]);
    a[0] = b[0];
    for (int i = 1; i < n - 1; i++)
    {
        if (b[i - 1] < b[i])
            a[i] = b[i - 1];
        else
            a[i] = b[i];
    }
    a[n - 1] = b[n - 2];
    for (int i = 0; i < n; i++)
        res += a[i];
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var k = int.Parse(Console.ReadLine());
			var sum = 0;

			for(int a = 1; a <= k; a++)
			{
				for(int b = 1; b <= k; b++)
				{
					for(int c = 1; c <= k; c++)
					{
						sum += Gcd(a, Gcd(b, c));
					}
				}
			}

			Console.WriteLine(sum);
		}

		private static int Gcd(int a, int b)
		{
			if(b == 0)
			{
				return a;
			}

			return Gcd(b, a % b);
		}
	}
}


Measured memory_bytes: 17676
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> kabe[200005];
int main(){
  ll h,w,n;
  cin>>h>>w>>n;
  ll ans=h;
  for(int i=0;i<n;i++){
    ll x,y;
    cin>>x>>y;
    kabe[x].push_back(y);
  }
  for(int i=1;i<=h;i++) {
    kabe[i].push_back(17441744);
    sort(kabe[i].begin(),kabe[i].end());
  }
  ll c=0;
  for(int i=1;i<=h;i++) {
    if(i-c-1>=kabe[i][0]){
      cout<<i-1<<endl;
      return 0;
    }
    else{
      ll ky=*(lower_bound(kabe[i].begin(),kabe[i].end(),i-c));
      if(ky==i-c) c++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define vi vector<ll>
# define vvi vector<vi>
# define rep(i, N) for (int i = 0; i < N; i++)
# define Rep(i, N) for (int i = 1; i <= N; i++)
# define deb(x) cerr << #x << ": " << x << endl;
# define deb2(x, i) cerr << #x << "[" << i << "]: " << x[i] << endl;
/*
vi v(10, 2); 
rep(i, 10) deb2(v, i); 
*/

/*
int a; cin >> a;
int a, b; cin >> a >> b;
rep(i, n){cin >> v[i];}
cout <<   << endl;
*/

signed		main()
{
	string s, t; cin >> s >> t;
	if (s.size()+1 != t.size()) 
	{
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] != t[i])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}



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

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

    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<long long> A(x), B(y), C(z);
    for(int i = 0; i < x; i++){
        cin >> A[i];
    }
    for(int i = 0; i < y; i++){
        cin >> B[i];
    }
    for(int i = 0; i < z; i++){
        cin >> C[i];
    }

    vector<long long> AB;
    for(int i = 0; i < x; i++){
        for(int j = 0; j < y; j++){
            AB.push_back(A[i] + B[j]);
        }
    }

    sort(AB.rbegin(), AB.rend());
    AB.resize(k);

    vector<long long> ABC;
    for(int i = 0; i < z; i++){
        for(int j = 0; j < AB.size(); j++){
            ABC.push_back(C[i] + AB[j]);
        }
    }

    sort(ABC.rbegin(), ABC.rend());

    for(int i = 0; i < k; i++){
        cout << ABC[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 43368
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(int i=vv;i<n;i++)
#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define M1 1000000000000000000ll
#define PRECISE cout.precision(18);
#define BS(v,n) binary_search(v.begin(),v.end(),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.begin(),v.end(),greater <ll>())
#define F first
#define S second
#define GET(i,p) get<p>(i)

ll bexp(ll a,ll b,ll m){
ll ans=1;
ll d1=a%m;
while(b>0){
	if(b%2==0){
		d1=(d1*d1)%m;
		b/=2;
	}
	else{
		ans=(ans*d1)%m;
		b-=1;
	}
}
 
return ans;
 
}

pair <ll,ll> fun(ll x,ll y){
 	ll g=__gcd(x,y);
 	if(g==0)
 		g=1;
  	ll x1=x/g;
  	ll x2=y/g;
  	if(x2<0ll){
  		x1=-x1;
  		x2=-x2;
  	}
  	return make_pair(x1,x2);


}


int main(){

    FAST
//	PRECISE


  ll n;
  cin>>n;
  map <pair<ll,ll>,ll> m1;

  ll c=0;
  FOR(i,0,n){
  	ll x,y;
  	cin>>x>>y;
 	pair <ll,ll> d=fun(x,y);
 	d.F=-d.F;
 	if(d!=make_pair(0ll,0ll))
  	m1[d]++;
  else
  	c++;
  }
ll z=1;
while(!m1.empty()){
	ll c1=(m1.begin()->S);
	ll x=(m1.begin())->F.F;
	x=-x;
	ll y=(m1.begin())->F.S;
	m1.erase(m1.begin());
	pair <ll,ll> d=fun(y,x);
	ll c2=m1[d];
	z*=(bexp(2,c1,M)+bexp(2,c2,M)-1+M)%M;
	z=z%M;
	m1.erase(d);
}
cout<<(z+c-1+M)%M;

return 0;
 }









Measured memory_bytes: 16104
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, m;
	cin >> n >> m;
	vector<vector<bool>> graph(n, vector<bool>(n));
	rep(i, m) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		graph[u][v] = true;
		graph[v][u] = true;
	}
	bitset<710> dp; dp[0] = true;
	vector<bool> vis(n);
	vector<int> col(n);
	rep(i, n) {
		if (!vis[i]) {
			queue<P> que;
			int cnt0 = 0, cnt1 = 0;
			que.push(P(i, 0)); vis[i] = true;
			col[i] = 0;
			while (!que.empty()) {
				P p = que.front(); que.pop();
				int pf = p.first; int ps = p.second;
				if (ps) cnt1++; else cnt0++;
				rep(j, n) {
					if (pf == j || graph[pf][j]) continue;
					if (vis[j] && col[j] != (ps ^ 1)) {
						cout << -1 << '\n';
						return 0;
					}
					if (!vis[j]) {
						vis[j] = true;
						col[j] = ps ^ 1;
						que.push(P(j, ps ^ 1));
					}
				}
			}
			dp = (dp << cnt0) | (dp << cnt1);
		}
	}
	for (int i = n / 2; i >= 0; i--) {
		if (dp[i]) {
			cout << i * (i - 1) / 2 + (n - i)*(n - i - 1) / 2 << '\n';
			return 0;
		}
	}
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		String xp = null;
		String yp = null;

        int[] first ={1, 3, 5, 7, 8, 10, 12};
		int[] second ={4, 6, 9, 11};
		int[] third ={2};

		for(int i = 0; i<first.length; i ++){
			if(first[i] == x){
				 xp = "F";
				 }for(int j = 0; j<first.length; j ++){
				if(first[j] == y){
					 yp = "F";
					 }
				}
			}

		for(int i = 0; i<second.length; i ++){
			if(second[i] == x){
				 xp = "S";
				 }for(int j = 0; j<second.length; j ++){
				if(second[j] == y){
					 yp = "S";
					 }
				}
			}

		for(int i = 0; i<third.length; i ++){
			if(third[i] == x){
				 xp = "T";
				 }for(int j = 0; j<third.length; j ++){
				if(third[j] == y){
					 yp = "T";
					 }
				}
			}
				if(xp.equals(yp)){
					System.out.println("Yes");
				}else{
					System.out.println("No");
				}


	}

}




Measured memory_bytes: 22612
#include <stdio.h>
#include <math.h>
int main(){
  int N,D,i,j,k;
  double l;
  scanf("%d %d",&N,&D);
  int x[N][D];
  
  for(i=0;i<N;i++){
    for(j=0;j<D;j++)
    scanf("%d",&x[i][j]);
  }
 // printf("%d",x[0][1]); x[][]に数値は入っている
  int c=0;
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
      int n=0;
      for(k=0;k<D;k++){
        n +=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
        l=sqrt(n);
      if(ceil(l)==floor(l))
        c++;
    }
  }
  printf("%d",c);
} 

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>
#include <set>
using namespace std;

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

#define max_n 100

int N,Q;
vector<int> node[200001];
long long NC[200001];

void Count(int from,int to,long long sendx){

	NC[to] += sendx;
	
	rep(i,node[to].size()){
		if(node[to].at(i)!=from)
		{
			Count(to, node[to].at(i), NC[to]);
		}
	}

}

int main() {

	cin >> N >> Q;

	rep(i, N-1){
		int j,k;
		cin >> j >>k;
		node[j-1].push_back(k-1);
		node[k-1].push_back(j-1);
	}

	rep(i, Q) {
		int j, k;
		cin >> j >> k;
		NC[j-1] += k;
	}

	Count(-1, 0, 0);

	rep(i,N){
		cout << NC[i] << " ";
	}
	cout << endl;

	return 0;	
}

Measured memory_bytes: 27392
#include<iostream>
#include<numeric>
#include<vector>
using namespace std;

int Gcd(int n, int m){
	if (n == 0 || m == 0) return 0;

	if (n%m == 0){
		return m;
	}
	else{
		return(Gcd(m, n%m));
	}
}

int Lcm(int n, int m){
	return n * m / Gcd(n, m);
}

long long arrayLcm(vector<int> v){
	long long n, m, result;

	n = v[0];
	m = v[1];
	result = Lcm(n, m);

	for (int i = 2; i < v.size(); i++){
		n = v[i];
		m = result;
		result = Lcm(n, m);
	}

	return result;
}

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

	vector<int>v (n);
	for (int i = 0; i < n; i++){
		cin >> v[i];
	}
	
	if (n < 2){
		cout << v[0] << endl;
	}
	else{
		long long lcm = arrayLcm(v);
		long long fraction = 0;

		for (int i = 0; i < n; i++){
			fraction += lcm / v[i];
		}
		cout << (double)lcm/fraction << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
mi =[0]*N

LE = 0
LW = 0
RE = S[1:N].count("E")
RW = N-1-RE
mi[0] = RE

if S[0] == "E":
    LE +=1
else:
    LW +=1

for i in range(1,N-1):
    if S[i]=="E":
        RE -=1
        mi[i]= LW + RE 
        LE +=1
    elif S[i]=="W":
        RW -=1
        mi[i]=LW +RE
        LW +=1

mi[N-1] = S[0:N-1].count("W")
print(min(mi))

Measured memory_bytes: 19876
#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;
    vector<int> alp(26);
    rep(i, s.size()) alp[s[i]-'a'] = 1;
    rep(i, 26) {
        if(!alp[i]) {
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }
    cout << "None";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define mo 1505
int a[mo][mo],dp[mo][mo];
int n,m;
int main()
{
    while(cin>>n>>m)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>a[i][j];
            }
        }
        int maxs=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(a[i][j]) dp[i][j]=0;
                else dp[i][j]=min(dp[i-1][j],min(dp[i-1][j-1],dp[i][j-1]))+1;
                maxs=max(maxs,dp[i][j]);
               // cout<<dp[i][j]<<' ';
            }
            //cout<<endl;
        }
        cout<<maxs*maxs<<endl;

    }


}



Measured memory_bytes: 19548
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>

using namespace std;

int H, W= 0;
char a[50][50];

int main() {

	cin >> H >> W;

	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> a[i][j];
		}
	}

	int flg = 0;

	//自身の黒ますの上下左右に黒がない場合はNO
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (a[i][j] == '#' && a[i-1][j] == '.' && a[i + 1][j] == '.'&& a[i][j-1] == '.' && a[i][j+1] == '.') {
				flg = flg + 1;
			}
		}
	}

	if (flg != 0) {
		printf("No");
	}
	else {
		printf("Yes");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define pii pair<int,int>
#define f first
#define se second
using namespace std;
double pi=acos(-1.0);
int m=1000000007;
bool cmp2(int n,pii p)
 {return n<p.f;}
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};
int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%m;n=(n*n)%m;x=x>>1;}
 return ans;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
int32_t main(){
//ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int n,w;
cin>>n>>w;
int a[n][2];
for(int i=0;i<n;i++)
cin>>a[i][0]>>a[i][1];
int dp[n+1][w+1];
for(int i=0;i<=n;i++)
dp[i][0]=0;
for(int i=0;i<=w;i++)
dp[0][i]=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=w;j++)
if(j<a[i-1][0])
dp[i][j]=dp[i-1][j];
else
dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i-1][0]]+a[i-1][1]);
cout<<dp[n][w];
    
}

Measured memory_bytes: 79104
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
using namespace std;
typedef long long ll;


int main(void) {
	int n; cin >> n;
	rep(i, n) {
		int a; cin >> a;
		if (a % 2 != 0) {
			continue;
		}
		else {
			if (a % 3 == 0 || a % 5 == 0) {
				continue;
			}
			else {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}

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

const int N= 200001;
int parent[N];

void make_set(int r){
    parent[r]=r;
}

int find_set(int r){
    if(parent[r]==r){
        return r;
    }else{
        return parent[r]=find_set(parent[r]);
    }
}

void union_set(int a, int b){
    a= find_set(a);
    b=find_set(b);
    if(a!=b){
        parent[b]=a;
    }
}

int main(){
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n;++i){
        make_set(i);
    }
    for(int i=0; i<q; ++i){
        int t,u,v;
        cin>>t>>u>>v;
        if(t==0){
            union_set(u,v);
        }else{
            cout<<((find_set(u)==find_set(v))? 1:0)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4184
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
//using Graph = vector<vector<ll> >;
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 = 1e9;

//input
ll h,w,k;
int_fast16_t s[12][1010];

int main(){
    //input
    cin >> h >> w >> k;
    rep(i,h)rep(j,w){
        char c;
        cin>>c;
        s[i][j]=c-'0';
    }


    ll ans = INF;
    for(int bit=0;bit<(1<<h-1);bit++){
        ll cut = __builtin_popcount(bit);
        vector<ll>id(12);
        id[0]=0;
        rep(i,h-1){
            if((bit>>i)&1){
                id[i+1]=id[i]+1;
            }
            else{
                id[i+1]=id[i];
            }
        }

        bool flag=false;

        //一列だけでKを超えてしまう列がないかCheck
        vector<ll>check(h,0);
        rep(i,w){
            rep(j,h){
                check[id[j]]+=s[j][i];
            }
            rep(j,h){
                if(check[j]>k)flag=true;
                check[j]=0;
            }
            
        }
        if(flag)continue;

        vector<ll>white(12,0);
        rep(i,h){
            white[id[i]]+=s[i][0];
        }
        for(int i=1;i<w;i++){
            vector<ll>nx(12);
            rep(j,h){
                nx[id[j]]+=s[j][i];
            }
            bool can = true;
            rep(j,h){
                ll tmp = nx[j]+white[j];
                if(tmp>k){
                    can=false;
                }
            }
            if(!can){
                cut++;
                rep(j,h){
                    white[j]=nx[j];
                }
            }
            else{
                rep(j,h){
                    white[j]+= nx[j];
                }
            }
        }
        chmin(ans,cut);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3676
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

int main() {
	string S, T;
	cin >> S >> T;

	int j = 0;

	rep(i, 3) if (S[i] == T[i]) { ++j; }

	cout << j << endl;
}

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

int main() {
    int X,Y,Z,K;
    cin >> X >> Y >> Z >> K;

    vector<long long> A, B, C;
    for (int i=0; i<X; i++) {
        long long a; cin >> a;
        A.push_back(a);
    }
    for (int i=0; i<Y; i++) {
        long long b; cin >> b;
        B.push_back(b);
    }
    for (int i=0; i<Z; i++) {
        long long c; cin >> c;
        C.push_back(c);
    }

    vector<long long> D;
    for (int i=0; i<X; i++) {
        for (int j=0; j<Y; j++) {
            D.push_back(A[i] + B[j]);
        }
    }
    sort(D.rbegin(), D.rend());

    vector<long long> E;
    for (int i=0; i<min((size_t)K, D.size()); i++) {
        for (int j=0; j<min((size_t)K, C.size()); j++) {
            E.push_back(D[i] + C[j]);
        }
    }
    sort(E.rbegin(), E.rend());

    for (int i=0; i<K; i++) cout << E[i] << endl;
}

Measured memory_bytes: 42744
#include <iostream>
#include <vector>

using namespace std;


int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }

  bool odd = (x[0] + y[0]) % 2 ? true : false;

  for (int i = 0; i < n; i++) {
    if (odd && (x[i] + y[i]) % 2 == 0) {
      cout << -1;
      return 0;
    }
    if (!odd && (x[i] + y[i]) % 2) {
      cout << -1;
      return 0;
    }
  }


  vector<int> d(31, 1);
  for (int i = 0; i < d.size(); i++) {
    d[i] = 1 << i;
  }
  if (!odd) d.insert(d.begin(), 1);
  cout << d.size() << endl;
  for (int i = 0; i < d.size(); i++) cout << d[i] << ' ';
  cout << endl;
  for (int i = 0; i < n; i++) {
    int px = 0, py = 0;
    string s;
    for (int j = d.size() - 1; j >= 0; j--) {
      int ydiff = y[i] - py;
      int xdiff = x[i] - px;
      if (abs(xdiff) > abs(ydiff)) {
	if (xdiff < 0) {
	  s = "L" + s;
	  px -= d[j];
	}
	else {
	  s = "R" + s;
	  px += d[j];
	}
      }
      else {
	if (ydiff < 0) {
	  s = "D" + s;
	  py -= d[j];
	}
	else {
	  s = "U" + s;
	  py += d[j];
	}
      }
    }
    cout << s << endl;
  }
}


Measured memory_bytes: 256
use std::io;
 
fn main() {
    let array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
    let mut input = String::new();
    
    io::stdin()
       .read_line(&mut input)
       .expect("Failed to read line");
    
    let index: usize = input.trim().parse().expect("uooo");
    
    println!("{}", array[index - 1]);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  cin>>n;
  vi v(n);
  
  rep(i,n){
    cin>>v[i];
  } 
 
  sort(all(v));
  v.PB(inf);


  int ans=0;

  rep(i,n){
    FOR(j,i+1,n){
      int l=upper_bound(all(v),v[j]-v[i])-v.begin();
      int r=lower_bound(all(v),v[i]+v[j])-v.begin();
      
      //cout<<' '<<v[i]<<' '<<v[j]<<endl;
      int res=r-l;
      //cout<<res<<endl;
      if(v[l]<=v[i]&&v[i]<=v[r]) res--;
      if(v[l]<=v[j]&&v[j]<=v[r]) res--;

      //cout<<r<<' '<<l<<endl;
      ans+=max(res,0LL);
    }
  }
  cout<<ans/3<<endl;


}

Measured memory_bytes: 384
//### In The Name Of GOD ###

 //## Ya Hossien ##
 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

const int mod = 1000000007;
const int inf = 2000000000;
const int maxn = 500*1000+500*1000+15;
const int MLOG = 18;

#define int long long
#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())

int32_t main(){
	int n, x, ans = 0;
	cin >> n >> x;
	const int m = n;
	int a[m];
	for(int i = 0;i < m; i++){
		cin >> a[i];
	}
	if(a[0] > x){
		ans += a[0]-x;
		a[0] = x;
	}
	for(int i = 0 ; i < n - 1; i++){
		if(a[i] + a[i + 1] > x){
			int dif = a[i + 1] + a[i] - x;
			ans += dif;
			a[i + 1] = a[i + 1] - dif;
		}
	}
	cout << ans ;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
 int a=0;
 int b=0;
 
  public void solve(){
    Scanner sc= new Scanner(System.in);
    a=sc.nextInt();
    b=sc.nextInt();
      
    if(a<b){
        System.out.println("a < b");
    }else if(a>b){
        System.out.println("a > b");
    }if(a==b){
        System.out.println("a == b");
    }
}

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

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

using namespace std;

int main(){
    string s;
    cin>>s;
    int n=0;
    for (int i=0; i<s.size(); i++) {
        if(s.at(i)=='+'){
            n++;
        }else{
            n--;
        }
    }
    cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 256
func2::[Int] -> [Int] -> Int
func2 [_] _ = 0
func2 (a:as) cs = if head as - a == 1 then (cs!!(a-1)) + (func2 as cs) else (func2 as cs)

main::IO ()
main = do
    _ <- getLine
    a <- map read . words <$> getLine
    b <- map read . words <$> getLine
    c <- map read . words <$> getLine
    let count = func2 a c
    print $ (+count) $ sum b

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using pi = pair<int,int>;

#define mp make_pair
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

void setIO(string name = ""){
    freopen((name+".in").c_str(), "r", stdin); 
    freopen((name+".out").c_str(), "w", stdout);
}

#define PI 3.14159265358979323846264338327950L

int main(){
 	ios_base::sync_with_stdio(0); cin.tie(0); 
	// setIO();
	long double a,b,h,m;
	cin >> a >> b >> h >> m;
	long double rad=PI* 2 * ((long double)h/ 12.0 + ((long double)m/ 60.0) / 12.0 - (long double)m/ 60.0);
	long double rsq= (long double)(a*a+b*b) - (long double)(2 *a*b) *cosl(rad);
	printf("%20.20Lf\n",sqrtl(rsq));

}






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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int N, A;
    cin >> N >> A;
    printf("%lld\n", N * N - A);
    return 0;
}


Measured memory_bytes: 256
import math
n=int(input())+1
s=0
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            if i==1 or j==1 or k==1:s+=1
            else:s+=math.gcd(math.gcd(i,j),k)
print(s)




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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define bzero(p, n) memset(p, 0, n)
#define all(a) begin(a),end(a)
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
inline ll powll(ll x,ll y) {ll p=1; while(y--) p*=x; return p;}


int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    ll N, K; cin >> N >> K;

    ll ans;
    if (K % 2) {
        ans = powll(N/K, 3);
    } else {
        ans = powll(N/K, 3) + powll(N/(K/2)-N/K,3);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// AOJ 1133: Water Tank
// 2018.2.20 bal4u

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

int n;
int b[12]; int h[12];
double x[12], ans[12];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

double calc(int pos, int l, int r, double y)
{
	int i, m, k;
	double dy;

	if (r-l > 1) {
        for (m = i = l+1; i < r; i++) if (h[m] < h[i]) m = i;
        if (pos < m) {
			y = calc(pos, l, m, y);
			y = calc(pos, m, r, y);
		} else {
			y = calc(pos, m, r, y);
			y = calc(pos, l, m, y);
		}
    }

    k = h[l]; if (k > h[r]) k = h[r];
    dy = (k-ans[l]) * (b[r]-b[l]); if (dy < 0) dy = 0;
	if (dy > y) dy = y;
	y -= dy;
    for (i = l; i < r; i++) ans[i] += dy / (b[r] - b[l]);
	return y;
}

int bsch(int x)
{
	int m, l = 0, r = n+1;

    while (l < r) {
        m = (l+r) >> 1;
        if (b[m] <= x) l = m + 1; else r = m;
    }
	return l;
}

int main()
{
	int cno, i, m, l, f, a, p, t;

	cno = in(); while (cno--) {
		n = in();
		b[0] = 0, h[0] = 50, b[n+1] = 100, h[n+1] = 50;
		for (i = 1; i <= n; i++) b[i] = in(), h[i] = in();

		memset(x, 0, sizeof(x));
		m = in(); while (m--) {
			f = in(), a = in();
            x[t=bsch(f)-1] += a/30.0;
        }

		l = in(); while (l--) {
			p = in(), t = in();
			memset(ans, 0, sizeof(ans));
			for (i = 0; i <= n; i++) calc(i, 0, n+1, x[i]*t);
			printf("%lf\n", ans[t=bsch(p)-1]);
		}
	}
	return 0;
}



Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final long h = scanner.nextInt();
        final long w = scanner.nextInt();

        if (h == 1 || w == 1) {
            System.out.println(1);
            return;
        }

        if (w % 2 == 0) {
            System.out.println(h * w / 2);
        } else if (h % 2 == 0) {
            System.out.println(h * (w / 2) + h / 2);
        } else {
            System.out.println(h * (w / 2) + h / 2 + 1);
        }
    }
}


Measured memory_bytes: 21972
#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int64_t N;
    cin >> N;
    vector<int64_t> a_lst(N - 1);
    for(int64_t &x: a_lst) cin >> x;

    vector<int64_t> result(N, 0);
    for(int64_t &x: a_lst) result[x-1]++;
    for(int64_t &x: result) cout << x << endl;
    return 0;
}

Measured memory_bytes: 6424