akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define SIZE 1003

bool IsDivisible(int n)
{
    if(n%3==0 || n%5==0)
        return true;
    else return false;
}

int main()
{
    int n,num[SIZE];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>num[i];
    }

    int flag=1;

    for(int i=0;i<n;i++)
    {
        if(num[i]%2==0)
        {
            if(IsDivisible(num[i])==false)
            {
                flag=0;
                break;
            }
        }
    }

    if(flag==1)
        cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}


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

using namespace std;

int n, mx[3][3];

int main()
{
    for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j)
        cin >> mx[i][j];
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        int b;
        cin >> b;
        for (int i = 0; i < 3; ++i)
        for (int j = 0; j < 3; ++j)
            if (mx[i][j] == b) mx[i][j] = 0;
    }
    if (mx[0][0]+mx[0][1]+mx[0][2] == 0
        || mx[0][0]+mx[1][0]+mx[2][0] == 0
        || mx[0][2]+mx[1][2]+mx[2][2] == 0
        || mx[2][0]+mx[2][1]+mx[2][2] == 0
        || mx[1][0]+mx[1][1]+mx[1][2] == 0
        || mx[0][1]+mx[1][1]+mx[2][1] == 0
        || mx[0][0]+mx[1][1]+mx[2][2] == 0
        || mx[0][2]+mx[1][1]+mx[2][0] == 0)
            cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c)
	cout<<"Yes";
	else if(a==c&&a!=b)
	cout<<"Yes";
	else if(c==b&&a!=c)
	cout<<"Yes";
	else
	cout<<"No";
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, l, r) for (int i = l; i <= (int)(r); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define all(v) v.begin(), v.end()
#define MOD (int) (1e9+7)
#define INF (int) 1e9
#define LLINF (ll) 1e18

vector<int> edges[100005];
vector<P> ans(100005);

void bfs(){
    queue<tuple<int, int, int>> que;
    que.push(make_tuple(0, 0, -1));

    while(!que.empty()){
        int d = get<0>(que.front());
        int nod = get<1>(que.front());
        int pa = get<2>(que.front());
        que.pop();

        for (int v : edges[nod]){
            if(ans[v].first==INF){
                que.push(make_tuple(d+1, v, nod));
                ans[v].first = d+1;
                ans[v].second = nod;
            }
        }
    }
}

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

    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a].emplace_back(b);
        edges[b].emplace_back(a);
    }

    rep(i, n){
        ans[i].first = INF;
        ans[i].second = -1;
    }

    bfs();

    bool ok = true;
    rep(i, n){
        if(ans[i].first==INF) ok = false;
    }

    if(ok){
        cout << "Yes" << endl;
        for (int i = 1; i < n; i++)
        {
            cout << ans[i].second+1 << endl;    
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 11384
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t)
{
    std::ostringstream os;
    os << t;
    return os.str();
}
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main()
{
    int n;
    cin >> n;
    vector<ll> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    ll tmp = v[0], ans = INF, cnt = 0;
    for (int i = 1; i < n; i++)
    {
        if (v[i] % tmp == 0)
        {
            cnt++;
        }
        else
        {
            ans = min(ans, __gcd(tmp, v[i]));
        }
    }
    if (cnt == n - 1)
    {
        cout << v[0] << endl;
    }
    else
    {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LLI long long int
#define pii pair<int,int>
#define fst first
#define sec second
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 0
using namespace std;

int x[107];

int main()
{
    int i,j;
    int N;

    scanf("%d", &N);
    for( i=1; i<=N; i++)
        scanf("%d", &x[i]);

    int avg = 0;
    for( i=1; i<=N; i++)
        avg += x[i];
    avg /= N;

    de(1) printf("avg = %d\n", avg);
    int ans1 = 0;
    for( i=1; i<=N; i++)
        ans1 += ( avg - x[i] ) * ( avg - x[i] );
    int ans2 = 0;
    for( i=1; i<=N; i++)
        ans2 += ( avg + 1 - x[i] ) * ( avg + 1 - x[i] );

    printf("%d\n", min( ans1, ans2));

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, k;
  cin >> n >> k;
  int ans = k;
  rep(i, n-1) ans *= (k-1);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    int n,l;
    string s[110];
    cin>>n>>l;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    sort(s,s+n);
    string res="";
    for(int i=0;i<n;i++){
        res+=s[i];
    }
    cout<<res<<endl;

    return 0;
}


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

using namespace std;

int main () {
    int n, x, mx = 0, sum = 0;
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> x;
        mx = max( mx, x );
        sum += x;
    }
    if ( mx < sum - mx ) cout << "Yes";
    else cout << "No";
}


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

int main(void) {
    long long N, K, H[200005], S, i;
    scanf("%lld%lld", &N, &K);
    if (K>=N) {
        printf("0");
        return 0;
    }
    for (i=0; i<N; i++) scanf("%lld", &H[i]);
    std::sort(H, H+N);
    for (i=N-K; i<N; i++) H[i]=0;
    S=0;
    for (i=0; i<N; i++) S+=H[i];
    printf("%lld", S);
    return 0;
}

Measured memory_bytes: 1664
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#A
def A():
    a, b, c, d = LI()
    x = abs(a - b)
    y = abs(b - c)
    z = abs(a - c)
    if (x <= d and y <= d) or z <= d:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    X = II()
    x = [False] * (10 ** 3 + 1)
    x[1] = True
    for i in range(2, int(10 ** 1.5) + 1):
        k = i*i
        while X >= k:
            x[k] = True
            k *= i
    for i in range(X, -1, -1):
        if x[i]:
            print(i)
            return
    return

#C
def C():
    s = stdin.readline().rstrip()
    K = II() - 1
    ans = []
    for i in range(len(s)):
        for k in range(K+1):
            b = s[i:i + k + 1]
            ans.append(b)
    ans = list(set(ans))
    ans.sort()
    print(ans[K])
    return

#D
def D():
    n, m = LI()
    p = LI_()
    xy = LIR_(m)
    size = [1 for _ in range(n)]
    height = [1 for _ in range(n)]
    par = [i for i in range(n)]
    def find(x):
        if par[x] == x:
            return x
        else:
            par[x] = find(par[x])
            return par[x]
    def union(x, y):
        s1 = find(x)
        s2 = find(y)
        if s1 != s2:
            if height[s1] < height[s2]:
                par[s1] = s2
                size[s2] += size[s1]
                size[s1] = 0
            else:
                par[s2] = s1
                size[s1] += size[s2]
                size[s2] = 0
                if height[s1] == height[s2]:
                    height[s1] += 1

    for x,y in xy:
        union(x, y)
    ans = 0
    for i in range(n):
        if find(p[i]) == find(i):
            ans += 1
    
    print(ans)
    return

#Solve
if __name__ == '__main__':
    B()


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

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int x[9] = {0, 0, 0, 1, 1, 1, 2, 2, 2};
int y[9] = {0, 1, 2, 0, 1, 2, 0, 1, 2};

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

bool ok(string s)
{
    int N = s.size();

    int nowy = y[s[0] - 'A'], nowx = x[s[0] - 'A'];

    rep1(i, N - 1) {
        rep(j, 4) {
            int nexty = nowy + dy[j], nextx = nowx + dx[j];
            if (nexty == y[s[i] - 'A'] && nextx == x[s[i] - 'A']) {
                nowy = nexty, nowx = nextx;
                goto nxt;
            }
        }

        return false;

        nxt:;
    }

    return true;
}

signed main()
{
    string s;
    rep(i, 1000) {
        cin >> s;
        if (ok(s)) {
            cout << s << endl;
        }
    }
}

Measured memory_bytes: 1180
X, Y, Z, K = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

A_list.sort(reverse=True)
B_list.sort(reverse=True)
C_list.sort(reverse=True)

F_list = []
for i in range(1, X+1):
  if i > K:
    break
  for j in range(1, Y+1):
    if i*j > K:
      break
    for k in range(1, Z+1):
      if i*j*k > K:
        break
      F_list.append(A_list[i-1]+B_list[j-1]+C_list[k-1])

F_list.sort(reverse=True)

for i in range(K):
  print(F_list[i])

Measured memory_bytes: 8708
N = int(input())
an = list(map(int, input().split()))
over_cnt = 0
colors = []
for a in an:
    rate = a // 400
    if rate >= 8:
        over_cnt += 1
    elif rate not in colors:
        colors.append(rate)
 
print(max(len(colors), 1), len(colors) + over_cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> s;
    int n = s.size();
    string d[] = {"dreamer", "eraser", "dream", "erase"};
    int r = n;
    eper(l, n-1, 0) {
      string sub = s.substr(l, r - l);
      rep(i, 0, 4) {
        if (sub == d[i]) {
          s.erase(l, r - l);
          r - l;
        }
      }
    }
    if (s.size() > 0) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
//	string str=lcs(s,t,"");
//	cout<<str<<"\n";
  int m=s.size(),n=t.size();
	vector<vector<int> >dp(m+1,vector<int>(n+1,0));
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(s[i-1]==t[j-1])
			   dp[i][j]=dp[i-1][j-1]+1;
			else
			{
				if(dp[i-1][j]>=dp[i][j-1])
				   dp[i][j]=dp[i-1][j];
				else
				   dp[i][j]=dp[i][j-1];
				  
			}
		}
	}
  int index=dp[m][n];
  string x="";
  int i=m,j=n;
  while(i>0 && j>0)
  {
    if(s[i-1]==t[j-1]){
      x=s[i-1]+x;
      i--;
      j--;
    }
    else if(dp[i-1][j]>dp[i][j-1])
      i--;
    else
      j--;
  }
	cout<<x<<"\n";
	
}


Measured memory_bytes: 38780
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    int N;cin>>N;int K;cin>>K;
    string S;
    cin>>S;
    if(S[K-1]=='A'){
        S[K-1]='a';
    }else if(S[K-1]=='B'){
        S[K-1]='b';
    }else if(S[K-1]=='C'){
        S[K-1]='c';
    }
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
a, b, c, d, e, f = gets.split.map(&:to_i)

cntA = f / (100 * a)
cntB = f / (100 * b)
maxNodo = 0
maxWater = 0
maxSugar = 0

for numA in 1..cntA
	for numB in 0..cntB
		cntC = (a*numA+b*numB)*e / c
		cntD = (a*numA+b*numB)*e / d
		for numC in 0..cntC
			for numD in 0..cntD
				sugar = c*numC + d*numD
				if sugar > e*(a*numA+b*numB)
					break
				end
				water = 100*a*numA + 100*b*numB
				if (water + sugar) > f
					break
				end
				temp = 100.0*sugar/(water+sugar)
				if maxNodo <= temp
					maxNodo = temp
					maxWater = water
					maxSugar = sugar
				end
			end
		end
	end
end

print(maxWater+maxSugar, " ", maxSugar, "\n")

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    cin >> n;
    vector<P> d(n);
    rep(i, n){ cin >> d[i].first >> d[i].second; }

    int len = 0;
    rep(i, n){
        if (d[i].first == d[i].second){
            len++;
        }else {
            len = 0;
        }
        if (len >= 3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}



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

using namespace std;

typedef long long int64;

int N, M;
vector< int > g[8];
int64 dp[1 << 8];

int64 rec(int idx, int bit)
{
  if(bit == (1 << N) - 1) return (1);
  if(~dp[bit]) return (dp[bit]);
  int64 ret = 0;
  for(auto &to : g[idx]) {
    if((bit >> to) & 1) continue;
    ret += rec(to, bit | (1 << to));
  }
  return (ret);
}

int main()
{

  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    g[--A].push_back(--B);
    g[B].push_back(A);
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(0, 1) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 100005
#define ll long long
int a[N],n,b[N];ll ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	if(!(n&1))
	{
		int cnt=1;
		for(int i=n-1;i>0;i-=2)b[i]=a[cnt++];cnt=n;
		for(int i=2;i<=n;i+=2)b[i]=a[cnt--];
		for(int i=1;i<n;i++)ans+=abs(b[i+1]-b[i]);
		printf("%lld\n",ans);
	}else
	{
		int cnt=1;
		for(int i=3;i<=n;i+=2)b[i]=a[cnt++];cnt=n;
		for(int i=2;i<=n;i+=2)b[i]=a[cnt--];b[1]=a[(n+1)>>1];
		for(int i=1;i<n;i++)ans+=abs(b[i+1]-b[i]);
			// for(int i=1;i<=n;i++)printf("%d ",b[i]);puts("");
		ll tmp=0;
		for(int i=2;i<=n;i+=2)swap(b[i],b[i+1]);
		for(int i=1;i<n;i++)tmp+=abs(b[i+1]-b[i]);
			// for(int i=1;i<=n;i++)printf("%d ",b[i]);puts("");
		printf("%lld\n",max(ans,tmp));
	}
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

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

int main(void){
  int n;
  cin>>n;
  REP(i,n){
    int h,m;
    scanf("%d:%d",&h,&m);
    if(h>=12) h -= 12;
    double t1 = h * 30 + (double)m/2;  
    double t2 = m * 6; 
    if(abs(t1-t2)<30||abs(t1-t2)>330){
      cout<<"alert"<<endl;
    }else if(abs(t1-t2)>=90&&abs(t1-t2)<=270){
      cout<<"safe"<<endl;
    }else{
      cout<<"warning"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define REP(i, x) for(int i = 0; i < (int)(x); i++)
#define REPS(i,x) for(int i = 1; i <= (int)(x); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define debug(x) cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h,w;
  cin >> h >> w;
  string s;
  REP(i, h){
    cin >> s;
    cout << s << endl;
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vs ss(n);
	map<vi,ll> mp;
	rep(i,n){
		cin>>ss[i];
		vi v(26);
		rep(j,ss[i].size())v[ss[i][j]-'a']++;
		mp[v]++;
	}
	ll ans=0;
	for(auto x:mp){
		ans+=x.sc*(x.sc-1)/2;
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 24448
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm.*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//typedef long long ll;
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define debug() cout << "Hi" << endl	// write debug(); in main()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;
	else if(p1.ff == p2.ff){
		if(p1.ss < p2.ss)return true;		// You should not be writing p1.ss <= p2.ss !!!
		return false;
	}
	return false;
}
/*		1. Take all the inputs
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	//debug();
	// int main  or  int32_t main ...
	int n,m;
	cin >> n >> m;
	int a[n];
	int sum = 0;
	FO(i,0,n){
		cin >> a[i];
		sum += a[i];
	}
	int check = sum;//(4*m);
	//cout << check << endl;
	sort(a,a+n,greater<int>());
	bool pr = true;
	FO(i,0,m){
		//cout << a[i] << endl;
		if((a[i]*(4*m)) < check){
			pr = false;
			break;
		}
	}
	if(pr)cout << "Yes" << endl;
	else cout << "No" << endl;
}
/*	memset() can be used to set all values as 0 or -1 for integer data types.*/

int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(12); std::cout << std::fixed;
	int t;
	// cin >> t;
	t = 1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	string s;
	
	cin>>s;
	
	if(s == "RRR") cout<<3<<endl;
	else if(s == "RRS" || s == "SRR") cout<<2<<endl;
	else if(s == "SSS") cout<<0<<endl;
	else cout<<1<<endl;
	
	
	
	return 0;
}

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

#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;


const int MAX_H=10000;
const int MAX_N=1000;

ll a,b;
ll n;



int main()
{

    cin>>n>>a>>b;;
    ll time=n/(a+b);
    ll rem=n%(a+b);
    ll rem_blue=min(rem,a);

    ll ans=time*a + rem_blue;

    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 256
#!/usr/bin/ruby
while(a,b=gets.split.map(&:to_i))!=[0,0]do
	r=99999999
	1.step(Math.sqrt(a)){|i|
		i=i.to_i
		if a%i>0 then next end
		1.step(Math.sqrt(b)){|j|
			j=j.to_i
			if b%j>0 then next end
			x=[i,a/i,j,b/j].sort
			p=(x[3]-x[2])**2+(x[2]-x[1])**2+(x[1]-x[0])**2
			if r>p then r=p end
		}
	}
	p r
end

Measured memory_bytes: 2456
//Author:- S_Aditya

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const ll mod=1e9+7;         
const int N=3e3+4;

//dp[i] tells the probability of getting a total of i heads.
 
double dp[N];

int main()                  
{
    int n;
    
    scn(n);
    
    dp[0]=1.0; //initially the there are no tosses and hence no heads, hence the probability of getting 0 heads is 1
    
    rep(i,1,n+1)
    {
        double prob;
        
        scanf("%lf",&prob);
        
        for(int j=i;j>=0;j--)
        {
            dp[j]=(1.0-prob)*dp[j];
            
            if(j)
            dp[j]+=(dp[j-1]*prob);
        }
    }
    
    double ans=0.0;
        
    int lim=(n+1)/2;
        
    rep(i,lim,n+1)
    ans+=dp[i];
    
    printf("%.10lf",ans);
} 


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

int main(void)
{
    int s;
    cin >> s;
    int b = s % 100;
    s /= 100;
    int a = s;

    if (1 <= a && a <= 12) {
        if (1 <= b && b <= 12) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if (1 <= b && b <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
n, d = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
  for j in range(i+1, n):
    tmp = 0
    for k in range(d):
      tmp += (a[i][k]-a[j][k])**2
    tmp **= 0.5
    if tmp == int(tmp):
      ans += 1
print(ans)

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main(){
	int x,y;
	while (1){
		cin >> x >> y;;
		if (x == 0 && y ==0) break;
		if (x > y){
			cout << y << " " << x << endl;
		}
		else {
			cout << x << " " << y << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
n=int(input())
a= list(map(int, input().split()))

# 各階層で可能な点のmin、max
v=[[0,0] for i in range(n+1)]
v[n]=[a[-1],a[-1]]
for i in range(n-1,-1,-1):
    v[i][0]=-(-v[i+1][0]//2)+a[i]
    v[i][1]=v[i+1][1]+a[i]


if v[0][0]>1:
    print(-1)
    exit()

ans=1
# w＝各階層で葉をもつ頂点の個数
w=1
# 各階層でできるだけ多く点をとる。
for i in range(1,n+1):
    w=min(w*2,v[i][1])
    ans+=w
    # 葉っぱは次の階層の根にならない
    w-=a[i]
print(ans)

Measured memory_bytes: 90616
import java.io.*;
import java.util.*;
import java.math.*;
public class Main{
	public static long fact[];
	public static long inverse[];
	public static long pow(long a,long n) {
	    long res=1;
	    while (n>0) {
	        if (n%2==1){
	            res=(res*a)%mod;
	        }
	        a=(a*a)%mod;
	        n>>=1;
	    }
	    return res;
	}
 
	public static long modinv(long n) {
	    return pow(n, mod-2);
	}
 
	public static long comb(int n,int k){
    	if(n<0 || k<0 || n<k)return 0;
    	return (fact[n]*((inverse[k]*inverse[n-k])%mod))%mod;
	}
	public static long mod = (long)1e9+7;
	public static void main(String args[]) throws IOException{
               BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));	
				int k = Integer.parseInt(reader.readLine());
				String str = reader.readLine();
				int n = str.length();
				inverse = new long[n+k+1];
				fact =new long[n+k+1];
				fact[0]=1;
				inverse[0]=1;
				for(int i=1;i<=n+k;++i){
					fact[i] = (fact[i-1]*(long)i)%mod;
					inverse[i] = modinv(fact[i]);
				}
				//sum of (N-1-(K-k)
				long res = 0;
				long p = 1;
				for(int i = 0;i<=k;i++){
					res = (res + comb(n+k,i)*p)%mod;
					p = (p*25)%mod;
				}
				System.out.println(res); 				
		}
		
}

Measured memory_bytes: 68720
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001
#define NIL NULL
struct N{
  int key;
  struct N *parent;
  struct N *left;
  struct N *right;
};
typedef struct N * node;

void insert(int);
void ino(node);
void pr(node);
node r;
node Find(node r, int key){
  if(r == NIL || r->key == key)return r;
  if(r->key > key) return Find(r->left,key);
  else return Find(r->right,key);
}
node r;

int main(){
  int i,n,x;
  char c[20];
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%s", c);
  
    if(c[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }
    else if(c[0] == 'f'){
      scanf ("%d" , &x);
      node t = Find(r , x);
      if(t!= NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(c[0] == 'p'){
      ino(r);
      printf("\n");
      pr(r);
       printf("\n");
    }
  }
  return 0;
}

void insert(int n){
  node x = NIL;
  node y = r;
  node z;
  z = malloc(sizeof(struct N));
  z->key = n;
  z->left = NIL;
  z->right = NIL;
  while(y!=NIL){
    x = y;
    if(z->key < y->key) y = y->left;
    else y = y->right;
  }
  z->parent = x;
  if(x == NIL)r = z;
  else if( z->key < x->key) x->left = z;
  else x->right = z;
}

void ino(node a){
  if(a!=NIL){
    ino(a->left);
    printf(" %d", a->key);
    ino(a->right);
}
}

void pr(node a){
  if(a!=NIL){
    printf(" %d" , a->key);
    pr(a->left);
    pr(a->right);
  }
}

Measured memory_bytes: 19364
import math

def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    """
    3点を通る円の中心と半径を取得
    """
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
    y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
    r = math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
    return x, y, r

n = int(input())
l = []
ans = float('inf')
for i in range(n):
    l.append([int(_) for _ in input().split()])

for i in range(0, n - 1):
    for j in range(i + 1, n):
        x = (l[i][0] + l[j][0]) / 2
        y = (l[i][1] + l[j][1]) / 2
        r = math.sqrt((l[i][0] - l[j][0])** 2 + (l[i][1] - l[j][1])**2) / 2
        flag = 1
        for k in range(n):
            if k != i and k != j:
                if (x - l[k][0]) ** 2 + (y - l[k][1]) ** 2 > r ** 2:
                    flag = 0
        if flag == 1:
            ans = min(r, ans)
        # print(x, y, r, ans)
for i in range(0, n - 2):
    for j in range(i + 1, n - 1):
        for k in range(i + 2, n):
            try:
                x, y, r = get_circle_center_and_radius(l[i][0],l[i][1],l[j][0],l[j][1],l[k][0],l[k][1])
                flag = 1
                for p in range(n):
                    if p != i and p != j and p != k:
                        if (x - l[p][0]) ** 2 + (y - l[p][1]) ** 2 > r ** 2:
                            flag = 0
                if flag == 1:
                    ans = min(r, ans)
                # print(x, y, r, ans)
            except:
                continue
print(ans)

Measured memory_bytes: 50136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N, Q;
string S;
int K[128];
// vector<int> D, M, C;

void solve(int idx) {
  ll ans = 0;
  int l = 0, r = 0;
  int sm = 0, sc = 0;
  ll cost = 0;
  while (l < N) {
    // cout << "Phase0 : " << l << " " << r << " " << cost << endl;
    while (l < N && S[l] != 'D') r = max(r, ++l);
    // cout << "Phase1 : " << l << " " << r << endl;
    while (r < N && r - l < K[idx]) {
      if (S[r] == 'M') sm++;
      if (S[r] == 'C') {
        cost += sm;
        sc++;
      }
      r++;
    }
    ans += cost;
    // ans += (ll)sm*sc;
    // cout << "Phase2 : " << l << " " << r << " " << cost << endl;
    l++;
    while (l < r) {
      if (S[l] == 'D') break;
      if (S[l] == 'M') {
        cost -= sc;
        sm--;
      }
      if (S[l] == 'C') sc--;
      l++;
    }
    // cout << "Phase3 : " << l << " " << r << endl << endl;
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> S >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> K[i];
  }
  // for (int i = 0; i < N; i++) {
  //   if (S[i] == 'D') D.emplace_back(i);
  //   if (S[i] == 'M') M.emplace_back(i);
  //   if (S[i] == 'C') C.emplace_back(i);
  // }
  for (int i = 0; i < Q; i++) {
    solve(i);
  }

  return 0;
}

Measured memory_bytes: 1948
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
ll modpow(ll n, ll p, ll m) { ll result = 1; while (p > 0) { if (p & 1) result = (result * n) % m; p >>= 1; n = (n * n) % m; } return result; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define fake false



int main() {
	int W, a, b;
	cin >> W >> a >> b;

	int d = abs(a - b);
	cout << max(0, d - W) << endl;

	return 0;
}

Measured memory_bytes: 256
'use strict'

const main = arg => {
    arg = arg.trim().split('\n')
    const N = ~~(arg[0].split(' ')[0]);
    const M = ~~(arg[0].split(' ')[1]);
    let arr = arg.slice(1, N + 1);
    let points = arg.slice(N + 1, M + N + 1);

    const parse = v => {
        let temp = v.split(' ').map(vv => parseInt(vv))
        return {
            x: temp[0],
            y: temp[1]
        }
    }
    
    arr = arr.map(parse);
    points = points.map(parse);


    let indexArr = [];
    arr.forEach((v, i) => {
        let minDist = 1000000000;
        let index = 0;
        
        points.forEach((w, j) => {
            let dist = Math.abs(v.x - w.x) + Math.abs(v.y - w.y);
            if(dist < minDist){
                minDist = dist;
                index = j;
            }
        })
        
        indexArr.push(index);
    })

    indexArr.forEach(v => console.log(v + 1));
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))


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

int main(){
	int n,ma=0;
	cin >> n;
  	int a[n],b[n];
  	for (int i=0;i<n;i++){
    	cin >> a[i];
    }
  	for (int i=0;i<n;i++){
    	cin >> b[i];
    }
	for (int i=0;i<n;i++){
    	int p=0;
      	for (int j=0;j<=i;j++){
    	p+=a[j];   	
    	}
      	for (int j=i;j<n;j++){
    	p+=b[j];   	
    	}
      	if(p>=ma) ma=p;
    }
	cout << ma << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#include<stack>
#include<set>
#define MAX 1000000000000000000LL
long long inf=100000000000007;
using namespace std;
struct edge{long long to,cost;};
typedef pair<int,int>P;
vector<edge> G[100005];
long long d[100005];
int n;

void dijkstra(long long k){
    priority_queue<P,vector<P>,greater<P> >que;
    fill(d,d+n,inf);
    d[k]=0;
    que.push(P(0,k));
    while(!que.empty()){
        P p=que.top();que.pop();
        int v=p.second;
        if(d[v]<p.first)continue;
        for(int i=0;i<G[v].size(); i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

int main(){
    cin>>n;
    long long  a,b,c;
    for(int i=0; i<n-1; i++){
        cin>>a>>b>>c;
        a--;b--;
        G[a].push_back(edge{b,c});
        G[b].push_back(edge{a,c});
    }
    long long q,k;
    cin>>q>>k;
    dijkstra(k-1);
    long long st,go;
    for(int i=0; i<q; i++){
        cin>>st>>go;
        st--;go--;
        cout<<d[st]+d[go]<<endl;
    }
    return 0;
}


Measured memory_bytes: 9984
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		
		int[] l = new int[n];
		for(int i = 0;i < n;i++){
			l[i] = sc.nextInt();
		}
		
		
		long ans = 0;
		Arrays.sort(l);
//		for(int i= 0;i < n;i++){
//			System.out.print(l[i] + " ");
//		}
		for(int i = 0;i < n;i++){
			for(int j = i+1;j < n;j++){
//				System.out.println("i " + i + " j " + j +  " left " + (j+1) + " right " + (upperbond(l[i]+l[j],j,l) )+ " ");

				
				int right = upperbond(l[i]+l[j],j,l);
//				if(right >= n-1){
//					right++;
//				}
				int left = j+1;
				
				
				if(right < left){
					continue;
				}
				
				ans += right-left;
			}
		}
		
		System.out.println(ans);
		
		
	}




	static int upperbond(int k,int min,int[] data){		//kより小さい最大の値をdataの中から探し、返す二分探索
		int max = data.length;
//		if(min == data.length-1){
//			if(data[min] > k){
//				return min;
//			}
//		}

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;
	}

	static int lowerbond(int k,int min,int[] data){		//kより大きい最小の値をdataの中から探し、返す二分探索
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return min;
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



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




}


class Edge extends ArrayList<P>{

}

class P{
	int to;
	long cost;
	P(int to,long cost){
		this.to = to;
		this.cost = cost;
	}
}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   from- otherpair.from;
	}








}






Measured memory_bytes: 26672
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long h = sc.nextLong();
		long value = (long) (Math.log(h) / Math.log(2));
		long ans = 0l;
		for(long i = 0; i <=  value; i++) {
			ans += Math.pow(2, i);
		}
		System.out.println(ans);
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


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

int main()
{
    int n;
    cin>>n;
    int ans=0,cur=0;
    while(n--){
        int height;
        cin>>height;
        if(height>=cur){
            ans++;
            cur=height;
        }
    }
    cout<<ans;
    return 0;
}


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

int main() {
    int n, m; scanf("%d%d", &n, &m);

    constexpr int kMod = 1'000'000'000 + 7;
    vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(n + 1, vector<int>(m + 1, 0)));
    dp[0][0][0] = 1;

    for (int i = 0; i < n; ++i) {
        vector<vector<vector<int>>> nxt(n + 1, vector<vector<int>>(n + 1, vector<int>(m + 1, 0)));
        for (int j = 0; j <= n; ++j) {
            for (int k = 0; k <= n; ++k) {
                for (int v = 0; v <= m; ++v) {
                    if (dp[j][k][v] == 0) continue;
                    if (v + j + k <= m) {
                        (nxt[j][k][v + j + k] += 1LL * (k + j + 1) * dp[j][k][v] % kMod) >= kMod ? nxt[j][k][v + j + k] -= kMod : 0;
                    }
                    if (j + 1 <= m && k + 1 <= m && v + j + k + 2 <= m) {
                        (nxt[j + 1][k + 1][v + j + k + 2] += dp[j][k][v]) >= kMod ? nxt[j + 1][k + 1][v + j + k + 2] -= kMod : 0;
                    }
                    if (j > 0 && k > 0 && v + j + k - 2 <= m) {
                        (nxt[j - 1][k - 1][v + j + k - 2] += 1LL * j * k * dp[j][k][v] % kMod) >= kMod ? nxt[j - 1][k - 1][v + j + k - 2] -= kMod : 0;
                    }
                }
            }
        }
        dp = nxt;
    }
    printf("%d\n", dp[0][0][m]);
}


Measured memory_bytes: 51808
package main

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

var (
	sc = bufio.NewReader(os.Stdin)
)

func main() {
	N, M := scanInt(), scanInt()
	uf := newUnionFind(N)
	for i := 0; i < M; i++ {
		a, b := scanInt()-1, scanInt()-1
		uf.merge(a, b)
	}
	cnt := 0
	for i := 0; i < N; i++ {
		if uf.root(i) == i {
			cnt++
		}
	}
	fmt.Println(cnt - 1)
}

func abs(a int) int         { return int(math.Abs(float64(a))) }
func scan(a ...interface{}) { _, err := fmt.Fscan(sc, a...); pnc(err) }
func scanStr() (s string)   { scan(&s); return }
func scanInt() int          { i, err := strconv.Atoi(scanStr()); pnc(err); return i }
func scanFloat() float64    { f, err := strconv.ParseFloat(scanStr(), 64); pnc(err); return f }
func pnc(err error) {
	if err != nil {
		panic(err)
	}
}

type unionFind struct {
	n      int
	parent []int
	rank   []int
}

func newUnionFind(n int) *unionFind {
	parent, rank := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		parent[i] = i
		rank[i] = 0
	}
	return &unionFind{n: n, parent: parent, rank: rank}
}
func (u *unionFind) root(a int) int {
	if u.parent[a] == a {
		return a
	}
	u.parent[a] = u.root(u.parent[a])
	return u.parent[a]
}
func (u *unionFind) same(a, b int) bool {
	return u.root(a) == u.root(b)
}
func (u *unionFind) merge(a, b int) {
	x, y := u.root(a), u.root(b)
	if x == y {
		return
	}

	// rankが低い方を高い方に繋げる
	if u.rank[x] < u.rank[y] {
		u.parent[x] = y
	} else {
		u.parent[y] = x
		// 同じrankの場合は繋がれた方のrankをインクリメントする
		if u.rank[x] == u.rank[y] {
			u.rank[x]++
		}
	}
}


Measured memory_bytes: 6300
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) {
        cin >> s[i];
    }

    vector<vector<int> > l(h, vector<int>(w));
    vector<vector<int> > r(h, vector<int>(w));
    vector<vector<int> > d(h, vector<int>(w));
    vector<vector<int> > u(h, vector<int>(w));

    rep(i, h) {
        if (s[i][0] == '.') l[i][0] = 1;
        else l[i][0] = 0;
        if (s[i][w-1] == '.') r[i][w-1] = 1;
        else r[i][w-1] = 0;
    }

    rep(i, w) {
        if (s[0][i] == '.') u[0][i] = 1;
        else u[0][i] = 0;
        if (s[h-1][i] == '.') d[h-1][i] = 1;
        else d[h-1][i] = 0;
    }

    rep(i, h) {
        rep(j, w-1) {
            if (s[i][j+1] == '.') {
                l[i][j+1] = l[i][j] + 1;
            }
            else {
                l[i][j+1] = 0;
            }
        }
    }

    rep(i, h) {
        for (int j=w-1; j>=1; j--) {
            if (s[i][j-1] == '.') {
                r[i][j-1] = r[i][j] + 1;
            }
            else {
                r[i][j-1] = 0;
            }
        }
    }

    rep(i, w) {
        rep(j, h-1) {
            if (s[j+1][i] == '.') {
                u[j+1][i] = u[j][i] + 1;
            }
            else {
                u[j+1][i] = 0;
            }
        }
    }

    rep(i, w) {
        for (int j=h-1; j>=1; j--) {
            if (s[j-1][i] == '.') {
                d[j-1][i] = d[j][i] + 1;
            }
            else {
                d[j-1][i] = 0;
            }
        }
    }

    int ans = 0;
    rep(i, h) {
        rep(j, w) {
            if (s[i][j] == '#') continue;
            ans = max(ans, l[i][j] + r[i][j] + d[i][j] + u[i][j] - 3);
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 67200