akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX*/

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1e9 + 7;


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

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

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

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

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

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

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

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/


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

    string s;
    cin>>s;
    if (s.size()%2) {cout<<"No"; return 0;}
    for (int i = 0; i<s.size(); i++)
    {
        if (i%2==0 && s[i]!='h') {cout<<"No"; return 0;}
        if (i%2==1 && s[i]!='i') {cout<<"No"; return 0;}
    }
    cout<<"Yes";



}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   int a,b,c;
   cin>>a>>b>>c;
   if(b>=c)
   {
       cout<<"delicious";
   }
   else if(b+a<c)
   {
       cout<<"dangerous";
   }
   else
    cout<<"safe";
 
 
    return 0;
}

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

using namespace std;
#define ll long long int

void solve(){

	int N,n=1000;
	cin>>N;
	string s;
	unordered_map<string,int>mp;
    
    while(N--){
    	cin>>s;
    	mp[s]++;
    }

    // for(auto it = mp.begin() ; it!=mp.end() ; it++){

    // 	cout<<it->first<<" "<<it->second<<"\n";
    // }
    cout<<"AC"<<" "<<"x"<<" "<<mp["AC"]<<"\n";
    cout<<"WA"<<" "<<"x"<<" "<<mp["WA"]<<"\n";
    cout<<"TLE"<<" "<<"x"<<" "<<mp["TLE"]<<"\n";
    cout<<"RE"<<" "<<"x"<<" "<<mp["RE"]<<"\n";



}




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

    
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif

   
    solve();
   
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<long long> A(n);
    long long max_a = 0;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        max_a = max(max_a, A[i]);
    }

    long long mid = 0, min_diff = 1LL << 60;
    for (int i = 0; i < n; i++) {
        long long diff = abs(A[i] - max_a / 2);
        if (diff < min_diff && A[i] != max_a) {
            mid = A[i];
            min_diff = diff;
        }
    }
    cout << max_a << " " << mid << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < int(n); i++)
#define rep1(i,n) for (int i = 1; i <= int(n); i++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define loop(i,a,B) for (int i = a; i B; i++)
#define loopR(i,a,B) for (int i = a; i B; i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", my_dmp(#__VA_ARGS__, __VA_ARGS__)
void my_dmp(const char*) { cerr << endl; }
template <class T, class... U>
void my_dmp(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; my_dmp(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, multiset<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S>& p) { return is >> p.first >> p.second; }
struct my_Init { my_Init() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } my_init;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
template <class It> auto sumof(It b, It e) { return accumulate(b,e,typename iterator_traits<It>::value_type{}); }
////////////////////////////////

int32_t main() {
    int n,m; cin >> n >> m;
    vector<int> a(n); cin >> a;
    vector<pair<int,int> > p(m);
    rep (i,m) cin >> p[i].snd >> p[i].fst;
    sort(all(a));
    sort(all(p)); reverse(all(p));
    int jj = 0;
    rep (i,m) {
        rep (j,p[i].snd) {
            chmax(a[jj++], p[i].fst);
            if (jj == n) break;
        }
        if (jj == n) break;
    }
    cout << sumof(all(a)) << "\n";
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 18;

int n, m, k;

void solve(int test)
{
  int ga, sa, ba, gb, sb, bb;
  cin >> n >> ga >> sa >> ba >> gb >> sb >> bb;
  vector<int64> d(n + 1, -1);
  d[n] = n;
  vector<pair<int, int>> a = {
    {ga, gb - ga},
    {sa, sb - sa},
    {ba, bb - ba}
  };
  for (int i = n; i >= 0; --i) {
    if (d[i] == -1) {
      continue;
    }
    for (int j = 0; j < 3; ++j) {
      int to = i - a[j].first;
      if (to >= 0) {
        d[to] = max(d[to], d[i] + a[j].second);
      }
    }
  }
  int64 ans = *max_element(d.begin(), d.end());
  vector<pair<int, int>> b = {
    {gb, ga - gb},
    {sb, sa - sb},
    {bb, ba - bb}
  };
  d.assign(ans + 1, -1);
  d[ans] = ans;
  for (int i = ans; i >= 0; --i) {
    if (d[i] == -1) {
      continue;
    }
    for (int j = 0; j < 3; ++j) {
      int to = i - b[j].first;
      if (to >= 0) {
        d[to] = max(d[to], d[i] + b[j].second);
      }
    }
  }
  cout << *max_element(d.begin(), d.end()) << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 195584
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

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

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    
    map<char, int> mp;
    REP(i, s.size()) mp[s[i]]++;

    cout << (mp[s[0]] == 2 && mp[s[1]] == 2 && mp[s[2]] == 2 && mp[s[3]] == 2 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m,a,b[50],c;
int main(){
    cin>>n>>m>>c;
    for(int i=0;i<m;i++)cin>>b[i];
    ll ans=0;
    for(int i=0;i<n;i++){
	ll sum=c;
	for(int j=0;j<m;j++){
	    cin>>a;
	    sum+=a*b[j];
	}
	if(sum>0)ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
'use strict'

const INF = 900719925474099 // Number.MAX_SAFE_INTEGER / 10;

function chmin(a,b){
	if(a < b) return a;
	return b;
}

function Main(input){
	let temp = input.trim().split('\n');
	let n = parseInt(temp[0]);
	let h = temp[1].split(' ').map((v)=>parseInt(v));

	let step = new Array(n+10).fill(INF);
	step[0]=0;
	for(let i=0;i<n;i++){
		step[i+1] = chmin(step[i+1],step[i] + Math.abs(h[i]-h[i+1]));
		step[i+2] = chmin(step[i+2],step[i] + Math.abs(h[i]-h[i+2]));
	}
	console.log(step[n-1]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 27684
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
#include <numeric>
#include <utility>
#include <cfloat>
#include <set>

using namespace std;

int main(){
    int A;
    int B;
    char op;
    cin >> A >> op >> B;
    if(op == '+'){
        cout << A + B << endl;
    } else {
        cout << A - B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s, t;
    cin >>s >>t;
    cout <<t <<s;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define ll long long
using namespace std;

int main () {
ll n,s=0,c=0;
cin>>n;
//vector<ll>v;
for(ll i=0;i<1000000;i++)
{
    s=(s*10+7)%n;
    if(s==0)
    {
        cout<<i+1<<endl;
        return 0;
    }
}

if(n%2==0||n%5==0)
    {
        cout<<-1<<endl;
    }
}
//cout<<c<<endl;



Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <iomanip>
#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 <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main()
{
    vector<int> aa(3);
    cin >> aa.at(0) >> aa.at(1) >> aa.at(2);
    int cnt = 0;
    while (true)
    {
        if(aa.at(0)==aa.at(1) && aa.at(0) == aa.at(2))
        {  
            cout << cnt << endl;
            return 0;
        }
        sort(aa.begin(), aa.end());
        
        if (aa.at(0) < aa.at(2) && aa.at(1) < aa.at(2))
        {
            aa.at(0)++;
            aa.at(1)++;
            cnt++;
        }
        else
        {
            aa.at(0) += 2;
            cnt++;
        }
    }
}


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



int32_t main(){
	// #ifndef ONLINE_JUDGE 
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif

    int n ;
    cin >> n ;
    for(int i = 1; i <= 9 ; i++ ){
    	if(n % i == 0 &&  n / i <= 9 ) {
    		cout<<"Yes"<<endl;
    		return 0;
    	}
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define ll long long
using namespace std;
const int nmax=101234;

int n,x,y,z;
bool a[25][25],flg[1<<22];
ll dp[1<<22];
queue<ll> q2;


int main()
{
    scanf("%d",&n);
    for(int i=0; i<n; ++i)
    {
        for(int j=0; j<n; ++j)
            scanf("%d",&a[i][j]);
    }
    dp[0]=0;
    for(int j=0; j<n; ++j)
    {
        if(a[0][j]==1)
        {
            x=1<<j;
            dp[x]=1;
            q2.push(x);
        }
    }
    q2.push(0);
    for(int i=1; i<n; ++i)
    {
        while(q2.front()!=0)
        {
            x=q2.front();
            q2.pop();
            flg[x]=1;
              for(int j=0; j<n; ++j)
            {
                if(a[i][j]==1)
                {
                    y=1<<j;
                    if((z=x|y)!=x){
                        dp[z]=(dp[z]+dp[x])%MOD;
                        q2.push(z);
                    }
                }
            }
            while(flg[q2.front()]==1)
                q2.pop();
        }
        q2.pop();
        q2.push(0);
    }
    printf("%lld",dp[(1<<n)-1]);
    return 0;
}

Measured memory_bytes: 56012
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple
ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if(n&1==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

ll d[200][200];
int V;
void wf(){
  rep(k,V)
    rep(i,V)
      rep(j,V) d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
}



ll ans = LLINF/2;
ll n,m,r;
vi rs;
void dfs(int state,ll c,int now){
  if(state == (1 << r) - 1) ans = min(ans,c);
  else{
    rep(i,r)
      if(!(state >> i & 1)) dfs(state | 1 << i,c + d[rs[i]][rs[now]],i);
  }
  return;
}

int main(){
  cin >> n >> m >> r; V = n;
  fill_n(d[0],200*200,LLINF/2);
  for(int i=0; i < n; i++)
    d[i][i] = 0;
  rep(i,r){int t; cin >> t;  t--; rs.pb(t);}
  rep(i,m){
    ll a,b,c; cin >> a >> b >> c;
    a--,b--;
    d[a][b] = c;
    d[b][a] = c;
  }
  wf();
  rep(i,r){
    dfs(1 << i,0,i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
      int T = scn.nextInt();
      int y = 1000000;
      int[] a = new int[n*2];
      for(int i=0; i<a.length; ++i){
        a[i] = scn.nextInt();
      }
      for(int i=1; i<a.length; i+=2){
        if(T >= a[i]){
          if(y > a[(i-1)]){
          y = a[(i-1)];
          }
        }
      }
      if(y !=1000000){
        System.out.println(y);
      }else{
        System.out.println("TLE");
      }
	}
}


Measured memory_bytes: 36024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,x,l;
  cin >> n >> x;
  int d = 0, nb = 1;
  while(n--){
    cin >> l;
    d += l;
    if(d <= x) ++nb;
    else break;
  }
  cout << nb;
  return 0;
}


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

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

    vector<int> vList;
    for (int i = 0; i < n; ++i)
    {
        int input;
        cin >> input;
        vList.push_back(input);
    }

    sort(vList.begin(), vList.end());

    float finalValue = float(vList.at(0));
    for (int i = 1; i < n; ++i)
    {
        finalValue = float((finalValue + vList.at(i)) / 2);
    }

    cout << finalValue << endl;
}

Measured memory_bytes: 256
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

int A,B,C;

int main() {
    cin >> A >> B >> C;
    if(A-B <= C) cout << C-(A-B) << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	float n,k;cin>>n>>k;
  vector<int >nos(n,0);
  for(int i=0;i<n;i++)cin>>nos[i];
  //k+k-1 >= n-k/k-1 + 1
  cout<<ceil((n-k)/(k-1))+1;
  
}

Measured memory_bytes: 3812
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int k = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        
        boolean flag = false;
        for(int i = 1; i <= 1000; i++){
            if(a <= k*i && k*i <= b){
                flag = true;
                break;
            }
        }
        System.out.println(flag ? "OK" : "NG");    
    }
}

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

const int MOD=1000000007;
const int MAX_N=100000;

vector<int> to[MAX_N+1];
ll dp[MAX_N+1][2];
int n;

void dfs(int curent, int parent=-1) {
  int white=1,black=1;
  rep(i, (int)(to[curent].size())) {
    int next=to[curent][i];
    if (next==parent) continue;
    dfs(next, curent);
    white=((dp[next][0]+dp[next][1])*white)%MOD;
    black=(dp[next][0]*black)%MOD;
  }
  dp[curent][0]=white;
  dp[curent][1]=black;
}

int main() {
  scanf("%d", &n);
  for (int i=0; i<n-1; i++) {
    int u,v;
    scanf("%d %d", &u,&v);
    u--, v--;
    to[u].push_back(v);
    to[v].push_back(u);
  }
  dfs(0);
  ll res=dp[0][0]+dp[0][1];
  res%=MOD;
  printf("%lld\n", res);
  return 0;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MX=4*1e5+100;
const long long INF = 1e18;
int N, M;
int arr[MX];

int main()
{
    map<int,int> m;
    scanf("%d", &N);
    for(int i=0;i<N;i++) cin>>arr[i], m[arr[i]]++;
scanf("%d", &M);
bool ok=1;
    for(int i=0;i<M;i++)
    {
        int x;
        scanf("%d", &x);
        if(m.find(x) == m.end()) ok=0;
        if(m[x] > 1) m[x]--;
        else m.erase(x);
    }
    if(ok) cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}


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

bool is_kaibun(string s)
{
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main()
{
    string s;
    cin >> s;
    int n=s.size();
    if (is_kaibun(s) && is_kaibun(s.substr(0, (n-1)/2)) && is_kaibun(s.substr((n+1)/2))) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

using namespace std;

int main(){
    int num;
    vector<int> syllables;

    for(int i=1; i<=3; i++){
        cin >> num;
        syllables.push_back(num);
    }

    sort(syllables.begin(), syllables.end());

    if(syllables[0] == 5 && syllables[1] == 5 && syllables[2] == 7)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{min,max};

struct DisjointSet {
    ps: Vec<Option<usize>>,
    ns: Vec<i64>,
}

impl DisjointSet {
    fn new(n: usize) -> DisjointSet {
        return DisjointSet { ps: vec![None; n], ns: vec![1; n] };
    }

    fn unite(&mut self, x: usize, y: usize) {
        let nx = self.find(x);
        let ny = self.find(y);
        if nx == ny {
            return;
        }
        let (a,b) = if self.ns[nx] < self.ns[ny] { (nx,ny) } else { (ny,nx) };
        self.ps[a] = Some(b);
        self.ns[b] += self.ns[a];
    }

    fn find(&mut self, x: usize) -> usize {
        match self.ps[x] {
            Some(y) => {
                let res = self.find(y);
                self.ps[x] = Some(res);
                return res;
            },
            None => {
                return x;
            },
        }
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        return self.find(x) == self.find(y);
    }
}

fn main() {
    let xs = read_vec_i64();
    let (n,q) = (xs[0] as usize, xs[1] as usize);
    let mut ds = DisjointSet::new(n);
    for _ in 0..q {
        let ys = read_vec_i64();
        let (com,x,y) = (ys[0], ys[1] as usize, ys[2] as usize);
        if com == 0 {
            ds.unite(x,y);
        }
        else {
            println!("{}", if ds.same(x,y) { 1 } else { 0 });
        }
    }
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}



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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n;
    cin >> n;
    vector<ll> vll(n);
    REP(i, n){
        double d;
        cin >> d;
        vll[i]=(ll)(d*1e9+0.5);
    }
    
    vector<vector<int>> vvi(64, vector<int>(64, 0));
    ll ans = 0;

    REP(i, vll.size())
    {
        int cnt2 = 0;
        int cnt5 = 0;
        while (vll[i] % 2 == 0) {
            cnt2++;
            vll[i] /= 2;
        }
        while (vll[i] % 5 == 0) {
            cnt5++;
            vll[i] /= 5;
        }
        vvi[cnt2][cnt5]++;
        if (cnt2 >= 9 && cnt5 >= 9)
            ans--;
    }

    REP(i,64)
    REP(j, 64)
    REP(k, 64)
    REP(l, 64)
    {
        if (i + k < 18 || j + l < 18)
            continue;
        ans += 1LL*vvi[i][j] * vvi[k][l];
    }

    cout << ans/2 << endl;
}

Measured memory_bytes: 4796
#include<stdio.h>

typedef long long int llu;

llu max(llu a, llu b) {
    return (a < b) ? b : a;
}

int main() {
    // INPUT
    int N, W;
    scanf("%d%d", &N, &W);

    int w[N], v[N];
    for (int i = 0; i < N; ++i) {
        scanf("%d%d", &w[i], &v[i]);
    }

    // INITIALIZE
    llu dp[W+1];
    for (int j = 0; j <= W; ++j) {
        dp[j] = 0;
    }

    // DP
    while (N--) {
        for (int j = W; j >= w[N]; --j) {
            dp[j] = max( dp[j-w[N]] + v[N] , dp[j] );
        }
    }

    // OUTPUT
    printf("%llu\n", dp[W]);
}



Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll arr[200010];
ll lvl[200010];
int main()
{
    ll n,i,j,k,l,m,a,b,c,d,x,y;
    cin>>n>>m;
    vector<ll>vc[n+10];
    queue<ll>q;
    for(i=0; i<m; i++)
    {
        cin>>a>>b;
        vc[a].push_back(b);
        vc[b].push_back(a);
    }
    for(i=0; i<=n; i++)
    {
        arr[i]=0;
        lvl[i]=0;
    }
    x=vc[1][0];
    q.push(x);
    lvl[1]=1;
    arr[x]=1;
    lvl[x]=lvl[1]+1;

    while(!q.empty())
    {
        x=q.front();
        q.pop();
        arr[x]=2;
        for(i=0; i<vc[x].size(); i++)
        {
            k=vc[x][i];
            if(arr[k]==0)
            {
                q.push(k);
                arr[k]=1;
                if(lvl[k]==0)
                {
                    lvl[k]=lvl[x]+1;
                }
                else
                {
                    if(lvl[k]>(lvl[x]+1))
                    {
                        lvl[k]=lvl[x]+1;
                    }
                    else if(lvl[k]<(lvl[x]+1))
                    {
                        lvl[k]=lvl[k];
                    }
                }
            }
        }
    }


    if(lvl[n]==3)
    {
        cout<<"POSSIBLE"<<endl;
    }
    else
    {
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}


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

using namespace std;


int main(){
    
    double x1, y1, x2, y2, distance;

    cin >> x1 >> y1 >> x2 >> y2;
    distance = sqrt(pow((x2-x1), 2) + pow((y2-y1), 2));

    printf("%lf\n", distance);

    return 0;
}




Measured memory_bytes: 3208
import java.util.*;

public class Main {
  static long[] dp;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    dp = new long[N + 1];
    for(int i = 0; i <= N; i++) {
      dp[i] = -1;
    }
    System.out.println(searchLucas(N));
  }
  
  public static long searchLucas(int k) {
    if(k == 0) {
      dp[k] = 2;
    } else if(k == 1) {
      dp[k] = 1;
    }
    if(dp[k] != -1) {
      return dp[k];
    } else {
      return dp[k] = searchLucas(k-1) + searchLucas(k-2);
    }
  }
}


Measured memory_bytes: 23508
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).trim().split('\n');
main();
  
function main(){
  for(var i = 0, len = input.length; i < len; i++){
    var c = input[i].split('');
     
    var count = [0,0,0,0,0,0,0,0,0,0,0];
    for(var j = 0, jlen = c.length; j < jlen; j++){
      count[c[j]]++; // 入力の個数をカウント
    }
 
    var result = [];
  JLOOP:for(var j = 1; j <= 9; j++){
      // 引く牌のループ
 
      if(count[j] == 4 || (!count[j-1] && !count[j] && !count[j+1])){
        continue;
      }
     
      for(var k = 1; k <= 9; k++){
        if((j != k && count[k] <= 1) || (j == k && count[k] == 0))
          continue;
 
        var copiedCount = count.slice(0);
        copiedCount[j]++;
        copiedCount[k] -= 2;

        for(var l = 1; l <= 9; l++){
          if(copiedCount[l-1] >= 1 && copiedCount[l] >= 1 && copiedCount[l+1] >= 1){
            copiedCount[l-1]--;
            copiedCount[l]--;
            copiedCount[l+1]--;
          }
          if(copiedCount[l-1] >= 1 && copiedCount[l] >= 1 && copiedCount[l+1] >= 1){
            copiedCount[l-1]--;
            copiedCount[l]--;
            copiedCount[l+1]--;
          }
          if(copiedCount[l] >= 3){
            copiedCount[l] -= 3;
          }
        }
        var sum = 0;
        for(var l = 1; l <=9; l++){
          sum += copiedCount[l];
        }
 
        if(!sum){
          result.push(j);
          continue JLOOP;
        }
      }
    }
 
    console.log(result.length?result.join(' '):'0');
     
 
  }
   
}

Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    
    int H,W;
    cin >> H >> W;
    vector<char> S(H*W);
    rep(i,H*W) cin >> S[i];
    sort(all(S));
    
    vector<int> a;
    a.push_back(1);
    for (int i = 1; i < H*W; i++) {
        if(S[i] == S[i-1]) a.back()++;
        else a.push_back(1);
    }
    
    
    int o = 0, t = 0, f = 0;
    rep(i,int(a.size())){
        if(a[i]%4==0) f++;
        else if(a[i]%2==0) t++;
        else o++;
    }
    
    if(H%2==0 && W%2==0){
        if(o == 0 && t == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
        
    }else if(H%2==0 && W%2==1){
        if(o == 0 && t <= H/2) cout << "Yes" << endl;
        else cout << "No" << endl;
        
    }else if(H%2==1 && W%2==0){
        if(o == 0 && t <= W/2) cout << "Yes" << endl;
        else cout << "No" << endl;
        
    }else if(H%2==1 && W%2==1){
        if(o == 1 && t <= H/2+W/2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
/*
********************
Author : MIHIR ARORA
********************
*/
#include <bits/stdc++.h>
using namespace std;
#define fast cin.tie(NULL); cout.tie(NULL); 
#define input int n; scanf("%d",&n); int*arr = new int[n];  for(int i=0;i<n;i++) scanf("%d",&arr[i]);  
#define inputs int n; scanf("%d",&n); char str[n];   cin>>str;   

typedef long long int ll;
const int mod=1e9+7; 
ll add(ll a, ll b)
{
    return (a%mod+b%mod)%mod;
}

ll mul(ll a, ll b)
{
    return ((a%mod)*(b%mod))%mod;
}

ll sub(ll a, ll b)
{
    return ((a%mod) - (b%mod))%mod;
}
inline int rec(int*arr , int n, int*cache)
{
    if(n==0)
        return 0; 
    if(n<0) 
        return 1e9; 
    if(cache[n]!=-1)
        return cache[n]; 
     int a= abs(arr[1]-arr[0])+ rec(arr+1,n-1,cache); 
    int b =abs( arr[2]-arr[0])+ rec(arr+2,n-2,cache); 
    cache[n]=min(a,b); 
    return min(a,b); 
}
inline void solve()
{
 input; 
    int cache[n]; 
    memset(cache,-1,sizeof(cache)); 
    cout<<rec(arr,n-1,cache); 
    
}
int main()
{ 
    fast; 

        solve();
 
    
    
}

Measured memory_bytes: 7296
#include <stdio.h>

int main(void){
  int N = 0;
  int B = 0;
  scanf("%d",&N);
  if(1<=N && N<=10000){
    B = (((N / 1000) + 1) * 1000) - N;
    if(B == 1000){
      B = 0;
      printf("%d\n",B);
    }else{
      printf("%d\n",B);
    }
  }
  return 0;
}


Measured memory_bytes: 1732
eval"_,*A="+gets.split*?,
s=*$<
q=[]
f=->i{s[i]&.chop&.bytes{|x|A[y=s[i].sum-x-75]+=1;q[i]=""<<y+65;f[i+1]if~0<A[x-=65]-=1;A[x]+=1;A[y]-=1}||puts(:Yes,q)+exit}
f[0]
puts:No

Measured memory_bytes: 155064
#include <iostream>
#include<bits/stdc++.h>
#define pb(x) push_back(x)

using namespace std;


int main() {
    long long n,x;
    cin>>n;
    stack<long long>s;
    long long ans = 0;
    for(long long i=0; i<n; i++)
    {
        cin>>x;
        if(s.empty() || x>s.top())
            s.push(x);
        else
            ans+=s.top()-x;
    }
    cout<<ans;
}


Measured memory_bytes: 5140
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a,b;
cin>>a>>b;
if(2*b>=a)
{
    cout<<0<<endl;
}
else
{
    cout<<a-2*b<<endl;
}
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

Aii=[0]*(N)
Ajj=[0]*(N)

for i in range(N):
    x=A[i]+i+1
    y=i+1-A[i]
    if 1<x<N: Aii[x]+=1
    if 1<y<N: Ajj[y]+=1

ans=0
for i in range(N):
    ans+=Aii[i]*Ajj[i]

print(ans)

Measured memory_bytes: 32356
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define inl(a) cin >> a
#define prl(a) cout << a << " "
#define outl(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define tddd tuple<double,double,double>
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int > >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define N 10005
typedef long long int ll;
ll dp[2][N];
bool cmp(pair<ii,int> A,pair<ii,int> B)
{
    return min(A.F.S,B.F.S-A.F.F)>min(B.F.S,A.F.S-B.F.F);

}
int main()
{
    int i,j,n,w,c,v;
    int C=0;
    in(n);
    viii ad(n);
    rep(i,n)
    {
        in3(w,c,v);
        C=max(C,c+1);
        ad[i]={{w,c},v};
    }
    sort(all(ad),cmp);
    ll x,ans=0;
    rep(i,n)
    {
        w=ad[i].F.F,c=ad[i].F.S+1,v=ad[i].S;
        x=0;
        rep(j,c)
            x=max(x,dp[0][j]);
        ans=max(ans,x+v);
        for(j=min(C,c+w)-1;j>=w;j--)
            dp[1][j]=max(dp[1][j],v+dp[0][j-w]),dp[0][j]=dp[1][j];
    }
    outl(ans);
}








Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N,M; cin>>N>>M;
	vector<int> k(M), p(M);
	vector<vector<int>> s(M);
	for (int i=0; i<M; i++) {
		cin>>k[i];
		int x;
		for (int j=0; j<k[i]; j++)
			cin>>x, s[i].push_back(x);
	}
	for (int i=0; i<M; i++)
		cin>>p[i];
	int ret=0;
	for (int bt=0; bt<(1<<N); bt++) {
		set<int> st;
		for (int i=0; i<N; i++)
			if (bt&(1<<i))
				st.insert(i+1);
		int ct=0;
		for (int i=0; i<M; i++) {
			int cur=0;
			for (auto x : s[i])
				if (st.count(x))
					cur++;
			if (cur%2==p[i])
				ct++;
		}
		if (ct==M)
			ret++;
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int ans = 0;
	REP(i, 10) {
		int a; cin >> a;
		ans += a;
	}
	cout << ans << endl;
	return 0;
}




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

int main() {
    int n, k; cin >> n >> k;
    vector<long long> cnt(k);
    for (int i = 1; i <= n; i++) cnt[i % k]++;
    long long ans = 0;
    for (int a = 0; a < k; a++) {
        int b = (k - a) % k, c = (k - a) % k;
        if ((b + c) % k) continue;
        ans += cnt[a] * cnt[b] * cnt[c];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
	int a=100000,n;
	cin>>n;
	for(int i=0;i<n;i++){
		a=a*21/20;
		if(a%1000>0){
			a=a/1000;
			a=a+1;
			a=a*1000;
		}
	}
	cout<<a<<endl;
}

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

int n;
double a[55];

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> a[i];
	for(int i=1;i<=n-1;i++)
	{
		sort(a+i,a+1+n);
		a[i+1]=(a[i]+a[i+1])/2;
	} 
	cout << fixed << setprecision(5) << a[n] << endl;
	return 0;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())


lli dp[5005][5005];

signed main(){

	lli n;
	cin>>n;
	string s;
	cin>>s;

	for(lli i=n-1;i>=0;i--){
		for(lli j=n-1;j>=0;j--){
			if(s[i] != s[j])dp[i][j] = 0;
			else dp[i][j] = dp[i+1][j+1] + 1;
		}
	}

	lli ans = 0;
	REP(i,0,n){
		REP(j,0,n){
			if(i>=j)continue;
			lli now = min(dp[i][j],(lli)j-i);
			ans = max(ans,now);
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 195712
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

void solve()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    int i,j;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());

    ll sum = 0;
    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            int tmp=a[i] + a[j];
            int k=lower_bound(a.begin(), a.end(), tmp) - a.begin();
            sum += (k - (j + 1));
        }
    }
    printf("%lld", sum);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;
const int tam = 1e6;
long long f[tam], finv[tam];

/*
    5 5 2 2
    o o o o o
    o o o o o
    o o o o o
    x x o o o
    x x o o o
*/

long long exp( long long b, long long e ) {
    long long ans = 1;
    while( e ) {
        if( e&1 ) {
            ans = (ans*b)%mod;
        }
        b = (b*b)%mod;
        e >>= 1;
    }
    return ans;
}

long long NcK( long long N, long long K ) {
    return ( (f[N]*finv[N-K])%mod * finv[K] )%mod;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    f[0] = finv[0] = 1;
    for( int i = 1; i < tam; i++ ) {
        f[i] = (f[i-1]*i)%mod;
        finv[i] = exp( f[i], mod-2 );
    }
    int w, h, a, b;
    cin >> h >> w >> a >> b;
    long long ans = 0;
    for( int x = b; x < w; x++ ) {
        long long y = h - a - 1, x1 = w-x-1;
        long long temp = ( NcK(y+x, x) * NcK( a-1 + x1, x1 ) )%mod;
        ans = (ans+temp)%mod;
    }
    cout << ans << '\n';
    return 0;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

bool pairCompare(const pair<ll, ll>& firstElof, const pair<ll, ll>& secondElof) {
    return firstElof.first < secondElof.first;
}

int main() {
    ll n, m;
    cin >> n >> m;
    int ans = 0;
    if ( m == 0 ) {
        if ( n != 1 ) {
            ans = pow(10, n-1);
        }
        cout << ans << endl;
        return 0;
    }
    ll s[m], c[m];
    ll Ans[n] = {};
    vector<pair<ll, ll> > pairs;

    int j = 1;
    rep(i, m) {
        cin >> s[i] >> c[i];
        if ( n != 1 && s[i] == 1 && c[i] == 0 ) {
            j = 0;
        }
        pairs.push_back( make_pair(s[i], c[i]) );
    }
    if (!j) {
        cout << -1 << endl;
        return 0;
    }

    sort(ALL(pairs), pairCompare);
    ll num;
    ll keep;
    vector<pair<ll, ll> > pairs2;

    rep(i, m) {
        if ( i == 0 ) {
            num = pairs.at(i).first;
            keep = i;
            Ans[num-1] = pairs.at(i).second;
        } else {
            if ( Ans[pairs.at(i).first-1] != 0 ) {
                if ( Ans[pairs.at(i).first-1] != pairs.at(i).second ) {
                    j = 0;
                    break;
                }
            } else {
                Ans[pairs.at(i).first-1] = pairs.at(i).second;
            }
        }
    }

    if (!j) {
        cout << -1 << endl;
        return 0;
    }
    if ( n > 1 && Ans[0] == 0 ) {
        Ans[0] = 1;
    }

    if ( Ans[0] != 0 || Ans[1] != 0 || Ans[2] != 0 ) {
        rep(i, n) {
            if ( Ans[i] != 0 && i != n-1 ) {
                ans += Ans[i]*pow(10, n-i-2);
            } else if ( i == n-1 ) {
                ans *= 10;
                ans += Ans[i];
            }
        }
    } else {
        ans += pow(10, n-1);
    }

    cout << ans << endl;
    return 0;
}


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

const int mxN = 1e4 + 5, mod = 1e9 + 7;
int arr[mxN];

long long fast_power(long long a, int b) {
	if(b == 0)
		return 1;
	long long temp = fast_power(a, b / 2);
	long long result = temp % mod * temp % mod * (b % 2 ? a : 1);
	return result % mod;
}

long long mod_inv(long long x) {
	return fast_power(x, mod - 2);
}

int main() {
	int n;
	cin >> n;
	map<int, int> cnt, cur;
	for(int i = 1; i <= n; ++i) {
		cin >> arr[i];
		int x = arr[i];
		cur.clear();
		for(int j = 2; j * j <= x; ++j) {
			while(x % j == 0)
				++cur[j], x /= j;
			cnt[j] = max(cnt[j], cur[j]);
		}
		if(x != 1)
			cnt[x] = max(cnt[x], 1);
	}
	long long LCM = 1;
	map<int, int> :: iterator it = cnt.begin();
	while(it != cnt.end()) {
		int temp = it-> second;
		while(temp--)
			LCM = LCM * it-> first % mod;
		++it;
	}
	long long answer = 0;
	for(int i = 1; i <= n; ++i) {
		answer = (answer + LCM * mod_inv(arr[i])) % mod;
	}
	cout << answer;
}


Measured memory_bytes: 4144
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  st A, B, C;
  ci(A, B, C);
  if(A.at(sz(A) - 1) == B.at(0) && B.at(sz(B) - 1) == C.at(0)){
    co("YES");
  }
  else{
    co("NO");
  }
}

Measured memory_bytes: 256