akhauriyash/Code-Regression huggingface dataset:
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;
int mod;

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

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

int main() {
	fast_cin();
	int n;
	cin >> n >> mod;
	vector<vector<int>> choose(3 * n + 1, vector<int>(3 * n + 1, 0));
	for (int i = 0; i <= 3 * n; ++i) {
		choose[i][i] = choose[i][0] = 1;
		for (int j = 1; j < i; ++j) {
			choose[i][j] = add(choose[i - 1][j], choose[i - 1][j - 1]);
		}
	}
	vector<int> p2(n + 1, 1), p3(n + 1, 1);
	for (int b = 1; b <= n; ++b) {
		p2[b] = mul(2 * b - 1, p2[b - 1]);
		p3[b] = mul(mul(3 * b - 1, 3 * b - 2), p3[b - 1]);
	}
	int ans = 0;
	for (int a = 0; a <= 3 * n; ++a) {
		for (int b = 0; b <= n; ++b) {
			if (a + 2 * b > 3 * n or (3 * n - a - 2 * b) % 3) {
				continue;
			}
			int c = (3 * n - a - 2 * b) / 3;
			if (b + c > n) {
				continue;
			}
			int temp = mul(choose[3 * n][a], choose[3 * n - a][2 * b]);
			temp = mul(temp, mul(p2[b], p3[c]));
			// cout << a << ' ' << b << ' ' << c << ' ' << temp << endl;
			ans = add(ans, temp);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 141184
L,R=map(int,input().split())
if R-L>2019:
  print(0)
elif L%2019==0 or R%2019==0:
  print(0)
elif L//2019!=R//2019:
  print(0)
else:
  L=L%2019
  R=R%2019
  ans=2019
  for i in range(L,R):
    for j in range(i+1,R+1):
      ans=min(ans,(i*j)%2019)
      if ans==0:
        break

  print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
 
int main() {
	double A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
 
	double i, j, k, l;
 
	double ans_water;
	double ans_sugar;
 
	double ans_p=0;
    
	for (i = 0; 100*i <= F; i++) {
		for (j = 0; 100*j <= F - j; j++) {
			for (k = 0; C*k <= F - 100*i - 100*j; k++) {
				for (l = 0; D*l <= F - 100*i - 100*j - C*k; l++) {
 
					double water = 100 * A * i + 100 * B * j;
					double sugar = C * k + D * l;
					double sum=water+sugar;
					double p = sugar / sum;
 
					if (sum <= F && p <= E/(100+E) && ans_p <= p) {
						ans_p = p;
						ans_water = water;
						ans_sugar = sugar;
					}
				}
			}
		}
	}
 
	cout << int(ans_water + ans_sugar) <<" "<< int(ans_sugar) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << " "
#define dumpL(x) cout << #x << " : " << x << '\n'
#define LINE cout << "line : " << __LINE__ << " "
#define LINEL cout << "line : " << __LINE__ << '\n'
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << " "
#define dumpVL(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) 
#define dumpL(x) 
#define LINE 
#define LINEL 
#define dumpV(v) 
#define dumpVL(v) 
#define STOP assert(false)
#endif
#define mp make_pair
 
namespace std {
template<class S, class T>
ostream &operator <<(ostream& out, const pair<S, T>& a) {
    out << '(' << a.fi << ", " << a.se << ')';
    return out;
}
}

int main(){
    int n;
    string s;
    cin >> n >> s;
    string rgb = "RGB";
    vector<vi> sum(rgb.size(), vi(n+1, 0));
    rep(i, n) {
        rep(j, 3) if(s[i] == rgb[j]) sum[j][i+1] = 1;
    }
    rep(i, n) rep(j, 3) sum[j][i+1] += sum[j][i];
    ll ans = 0LL;
    rep(i, n) REP(k, i+2, n) if(s[i] != s[k]) {
        int c = 3;
        rep(j, 3) if(s[i] == rgb[j] || s[k] == rgb[j]) c -= j;

        // dump(i);dump(k);dumpL(sum[c][k] - sum[c][i]);

        ans += sum[c][k] - sum[c][i];

        int d = k - i;
        if(d % 2 == 0 && s[i+d/2] == rgb[c]) ans--;
    } 
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
int main()
{
   fast ;
   ll f=1 ;
   ll n ;
   cin>>n ;
   for(ll i=0;i<n;i++)
   {
       ll x ;
       cin>>x ;
       if(x%2==0&&(x%3!=0&&x%5!=0))
        f=0 ;
   }
   if(f)
    cout<<"APPROVED"<<endl ;
   else
    cout<<"DENIED"<<endl ;




}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int k, x, i;
  scanf("%d%d", &k, &x);
  for (i = x - k + 1; i <= x + k - 1; i++) {
    if(i>=-1000000 && i<=1000000) printf("%d ", i);
  }
  printf("\n");
  return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename G >
struct LowLink {
  const G &g;
  vector< int > used, ord, low;
  vector< int > articulation;
  vector< pair< int, int > > bridge;
 
  LowLink(const G &g) : g(g) {}
 
  int dfs(int idx, int k, int par) {
    used[idx] = true;
    ord[idx] = k++;
    low[idx] = ord[idx];
    bool is_articulation = false;
    int cnt = 0;
    for(auto &to : g[idx]) {
      if(!used[to]) {
        ++cnt;
        k = dfs(to, k, idx);
        low[idx] = min(low[idx], low[to]);
        is_articulation |= ~par && low[to] >= ord[idx];
        if(ord[idx] < low[to]) bridge.emplace_back(minmax(idx, (int) to));
      } else if(to != par) {
        low[idx] = min(low[idx], ord[to]);
      }
    }
    is_articulation |= par == -1 && cnt > 1;
    if(is_articulation) articulation.push_back(idx);
    return k;
  }
 
  virtual void build() {
    used.assign(g.size(), 0);
    ord.assign(g.size(), 0);
    low.assign(g.size(), 0);
    int k = 0;
    for(int i = 0; i < g.size(); i++) {
      if(!used[i]) k = dfs(i, k, -1);
    }
  }
};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,m;
  cin >> n >> m;
  UnWeightedGraph g(n);
  REP(i,m){
    int32 a,b;
    cin >> a >> b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  LowLink< UnWeightedGraph > lowlink(g);
  lowlink.build();
  ANS(lowlink.bridge.size());
  return 0;
}

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

int N, *A;
int cnt;

void isort(int *A, int n, int g) {
  for (auto i = g; i < n; i++) {
    auto v = A[i];
    int j;
    for (j = i - g; j >= 0 && A[j] > v; j -= g) {
      A[j+g] = A[j];
      cnt++;
    }
    A[j+g] = v;
  }
}

void shsort(int *A, int n) {
  cnt = 0;
  int m = 0;
  int G[] = {1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161};
  for (; G[m] <= n; m++);
  cout << m << endl;
  for (auto i = m - 1; i >= 0; i--) {
    if (i != m - 1) cout << " ";
    cout << G[i];
    isort(A, n, G[i]);
  }
  cout << endl;
  cout << cnt << endl;
}

int main(void){
  cin >> N;
  A = new int[N];
  for (auto i = 0; i < N; i++) cin >> A[i];
  
  shsort(A, N);
  
  for (int i = 0; i < N; i++) cout << A[i] << endl;
  
  delete[] A;
  
  return 0;
}

Measured memory_bytes: 6740
import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a < b)  System.out.println("a < b");
           else if(a > b) System.out.println("a > b");
           else System.out.println("a == b");
            
            sc.close();
        }
}


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

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

   string astr;
   string bstr;
   string resulta = "";
   string resultb = "";

   astr = to_string(a);
   bstr = to_string(b);

   for (int i=0; i<b; i++)
      resulta = resulta + astr;

   for (int i=0; i<a; i++)
      resultb = resultb + bstr;

   if (resulta >= resultb)
      cout << resultb << endl;
   else
      cout << resulta << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	long long n, a, b;
	cin >> n >> a >> b;
	if ((n == 1 && a != b) || b < a) cout << 0 << endl;
	else cout << (b * (n - 1) + a - (a * (n - 1) + b) + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<set>
#include<stack>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
typedef long long ll;
const int N = 200000 + 10, inf = 0x3f3f3f3f;
int a[N];
int main()
{
    int n, t;
    ll sum = 0, time = 0;
    scanf("%d%d", &n, &t);
    for(int i = 0; i<n;i++)
        scanf("%d", &a[i]);
    for(int i = 0; i<n; i++)
    {
        if(i == 0)
        {
            time = a[i] + t;
        }
        else
        {
            if(a[i]<=time)
                sum += a[i]-a[i-1], time = t+a[i];
            else sum += t, time = t + a[i];
        }
    }
    sum += t;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1024
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def main():
    s = S()
    t = S()
    s_len = len(s)
    t_len = len(t)
    dp = [[0] * (t_len+1) for i in range(s_len+1)]
    ans = []

    for i in range(s_len):
        for j in range(t_len):
            if s[i] == t[j]:
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

    # print(*dp)
    i = s_len
    j = t_len
    while i > 0 and j > 0:
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            ans.append(s[i-1])
            i -= 1
            j -= 1

    print(''.join(ans[::-1]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 112600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;
 
vector<vector<int> > s;
vector<int> c;

int score(vector<int> held){
    vector<int> ld(26,0);
    int ans=0;
    rep(i,held.size()){
        int t=held[i];
        ld[t]=i+1;
        ans+=s[i][t];
        rep(j,26){
            rep(k,26){
                ans-=c[j]*(k*(1+k)/2+i+1-ld[j]);
            }
        }
    }
    return ans;
}

int main(){
    int d; cin >> d;
    vector<int> cc(26);
    c=cc;
    rep(i,26) cin >> c[i];
    vector<vector<int> > ss(d);
    s=ss;
    rep(i,d)rep(j,26){
        int a; cin >> a;
        s[i].push_back(a);
    }
 
    //vector<int> ld(26,0);
    vector<vector<int> > ds(26);
    vector<int> days(0);

    rep(i,d){
        int now=-INF;
        int whatday;
        rep(j,26){
            vector<int> tmp=days;
            tmp.push_back(j);
            int sc=score(tmp);
            if(sc>now){
                whatday=j;
                now=sc;
            }
        }
        days.push_back(whatday);
    }
    rep(i,d) cout << days[i]+1 << endl;
return 0;
}

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

int main() {
  string S;
  cin >> S;
  vector<int> a(4);
  a[0] = S[0] - '0', a[1] = S[1] - '0', a[2] = S[2] - '0', a[3] = S[3] - '0';
  
  string ans;
  for (int tmp = 0; tmp < (1 << 3); tmp++) {
    bitset<3> s(tmp);
    
    int result = a[0];
    string str;
    str = S[0];
    for (int i = 0; i < 3; i++) {
      if (s.test(i)) {
        result += a[i+1];
        str = str + '+' + S[i+1];
      } else {
        result -= a[i+1];
        str = str + '-' + S[i+1];
      }
    }
    if (result == 7) {
      ans = str + "=7";
      break;
    }
  }
  
  cout << ans << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  string S;
  string T;

  cin >> S >> T;

  int cnt = 0;
  for(int i = 0; i < (int)S.size(); ++i){
    if(S.at(i) != T.at(i)){
      cnt++;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 3864
# -*- coding: utf-8 -*-
a,b,n = list(map(int,input().split()))
ret = 0
if n >= b-1:
    ret = max(ret,int(a * (b-1) / b) - a * int((b-1)/b))
else:
    ret = max(ret,int(a * n / b) - a * int(n/b))
print(ret)

Measured memory_bytes: 9192
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	x := nextInt()

	ans := 2 * (x / 11)
	if r := x % 11; 0 < r && r <= 6 {
		ans++
	} else if 7 <= r {
		ans += 2
	}

	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
bool comp(pi a, pi b){
	if(a.first < b.first) return true;
	else return false;
}


int main(){
	ll n,k;
	cin >> n>> k;
	vector<pi> v;
	ll a[n],b[n];
	for(ll i=0; i<n;i++){
		cin >> a[i] >> b[i];
		 v.PB(MP(a[i],b[i]));
	}
	sort(v.begin(),v.end(),comp);
	//FOR(i,n)cout << v[i].first <<"\n";
	ll i=0;
	ll j=0;
	while(i<k){
		i+=v[j].second;
		j++;
	}
	cout << v[j-1].first;

	return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl L(N);
    for (ll i = 0; i < N; i++) {
        cin >> L[i];
    }
    ll ans = 0;
    for (ll i = 0; i < N; i++) {
        for (ll j = i + 1; j < N; j++) {
            for (ll k = j + 1; k < N; k++) {
                if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
                    if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) {
                        ++ans;
                    }
                }
            }
        }
    }
    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3660
N, Y = map(int, input().split())
ans = False
for i in range(N+1):
  for j in range(N+1-i):
    k = N-i-j
    if 10000*i + 5000*j + 1000*k == Y:
      ans = True
      print(i, j, k)
      break
  if ans == True:
    break
      
if ans == False:
  print(-1, -1, -1)


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

using namespace std;

/*
* Suffix Array.
* Verified by: http://arc050.contest.atcoder.jp/submissions/818745
* Reference: http://mayokoex.hatenablog.com/entry/2016/04/03/145845
*/

struct compare_sa{
	const vector<int> &rank;
	int n, k;
	compare_sa(const vector<int> &rank, int n, int k) : rank(rank), n(n), k(k) {}
		bool operator () (int i, int j) {
		if (rank[i] != rank[j]){
			return rank[i] < rank[j];
		}
		int ri = i + k <= n ? rank[i + k] : -1;
		int rj = j + k <= n ? rank[j + k] : -1;
		
		return ri < rj;
	}
};

vector<int> create_sa(const string& s){
	int n = s.length();
	vector<int> sa(n + 1, -1);
	vector<int> rank(n + 1, -1);
	vector<int> tmp(n + 1, -1);

	for(int i=0;i<=n;i++){
		sa[i] = i;
		rank[i] = i < n ? s[i] : -1;
	}

	for (int k=1;k<=n;k*=2){
		compare_sa cp = compare_sa(rank, n, k);
		sort(sa.begin(),sa.begin()+n+1,cp);
		tmp[sa[0]] = 0;
		for(int i=1;i<=n;i++){
			tmp[sa[i]] = tmp[sa[i - 1]] + (cp(sa[i - 1], sa[i]) ? 1 : 0);
		}
		for (int i=0;i<=n;i++) {
			rank[i] = tmp[i];
		}
	}
	
	return sa;
}

int main(void){
	int k;
	string s;
	cin >> k >> s;
	if (k == 0) {
		cout << s << endl;
		return 0;
	}
	
	int n = s.length();
	vector<int> sa = create_sa(s);
	vector<int> sa_inv(n + 1);
	
	for(int i=0;i<n+1;i++){
		sa_inv[sa[i]] = i;
	}
	
	vector<int> sat;
	int q = (n + k) / (k + 1);
	int r = q * (k + 1) - n; // 0 <= r <= k
	
	for(int i=0;i<sa.size();i++){
		int w = sa[i];
		if (w <= n - q) {
			sat.push_back(w);
		}
	}
	
	int lo = -1;
	int hi = n - q + 1;
	while (hi - lo > 1){
		int mid = (hi + lo) / 2;
		int rem = r;
		for(int i=0;i<k+1;i++){
			if (rem < 0){
				break;
			}
			int idx = i * q - r + rem;
			if (idx >= n - q + 1){
				break;
			}
			if (sa_inv[idx] > sa_inv[sat[mid]]) {
				rem--;
			}
		}
		if (rem >= 0){
			hi = mid;
		}
		else {
			lo = mid;
		}
	}
	
	cout << s.substr(sat[hi], q) << endl;
	return 0;
}

Measured memory_bytes: 2160
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<string>
using namespace std;
char in[110];
string str[110];
char com[310];
int dp[310];
vector<int>rev[310];
char c[30]="22233344455566677778889999";
void dfs(int a,string b){
	if(a==0)printf("%s\n",b.c_str());
	for(int i=0;i<rev[a].size();i++){
		if(b.size()==1)dfs(a-str[rev[a][i]].size(),str[rev[a][i]]+b);
		else dfs(a-str[rev[a][i]].size(),str[rev[a][i]]+" "+b);
	}
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			scanf("%s",in);
			str[i]=in;
		}
		scanf("%s",com);
		int n=strlen(com);
		for(int i=0;i<310;i++){
			dp[i]=0;rev[i].clear();
		}
		dp[0]=1;
		for(int i=0;i<n;i++){
			if(!dp[i])continue;
			for(int j=0;j<a;j++){
				if(i+str[j].size()>n)continue;
				bool ok=true;
				for(int k=0;k<str[j].size();k++){
					if(c[str[j][k]-'a']!=com[i+k])ok=false;
				}
				if(ok){
					dp[i+str[j].size()]=1;
					rev[i+str[j].size()].push_back(j);
				}
			}
		}
		dfs(n,".");
		printf("--\n");
	}
}

Measured memory_bytes: 1104
#include<stdlib.h>

#define TRUE 1
#define FALSE 0

int solve(int, int);
int n;

int A[200];

int main(){
  int q, i, j;
  int m[2000];
  
  scanf("%d",&n);
  if( n>20 ) exit(1);

  for( i=0 ; i<n ; i++ ){
    scanf("%d",&A[i]);
    if( A[i]<1 || 2000<A[i] ) exit(2);
  }

  scanf("%d",&q);
  if( q>200 ) exit(3);

  for( i=0 ; i<q ; i++ ){
    scanf("%d",&m[i]);
    if( m[i]<1 || 2000<m[i] ) exit(4);
  }

  for( i=0 ; i<q ; i++ ){
    if(solve(0,m[i]) == TRUE ) printf("yes\n");
    else printf("no\n");
  }
  
  return 0;
}

int solve(int i, int m){
  int res1, res2;
  
  if( m==0 ) return TRUE;
  if( i>=n ) return FALSE;

  res1 = solve(i+1, m);
  res2 = solve(i+1, m-A[i]);

  if( res1 == TRUE || res2 == TRUE ) return TRUE;
  else return FALSE;
}

Measured memory_bytes: 588
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;


int main() {
    using P = array<int, 6>;
    vector<P> ps{{0,1,2,3,4,5},{0,2,3,4,1,5},{0,3,4,1,2,5},{0,4,1,2,3,5},{1,0,4,5,2,3},{1,2,0,4,5,3},{1,4,5,2,0,3},{1,5,2,0,4,3},{2,0,1,5,3,4},{2,1,5,3,0,4},{2,3,0,1,5,4},{2,5,3,0,1,4},{3,0,2,5,4,1},{3,2,5,4,0,1},{3,4,0,2,5,1},{3,5,4,0,2,1},{4,0,3,5,1,2},{4,1,0,3,5,2},{4,3,5,1,0,2},{4,5,1,0,3,2},{5,1,4,3,2,0},{5,2,1,4,3,0},{5,3,2,1,4,0},{5,4,3,2,1,0}};
    auto mul = [](P a, P b){
        P res;
        for (int i = 0; i < 6; ++i) res[i] = a[b[i]];
        return res;
    };
    vector<string> v{"Blue","Cyan","Green","Magenta","Red","Yellow"};
    int n;
    while(cin >> n, n){
        vector<P> A(n);
        int cnt = 0;
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < 6; ++j) {
                string s;
                cin >> s;
                A[i][j] = lower_bound(v.begin(),v.end(), s)-v.begin();
            }
            swap(A[i][3], A[i][4]);
            int ok = 0;
            for (int j = 0; j < i; ++j) {
                for (int k = 0; k < ps.size(); ++k) {
                    if(A[j] == mul(A[i], ps[k])){
                        ok = 1;
                        j = k = 100;
                    }
                }
            }
            cnt += ok;
        }
        cout << cnt << "\n";
    }
    return 0;
}


Measured memory_bytes: 3200
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools
 
INF = 10 ** 10
 
MOD = 10**9 + 7
 
N, K = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
 
 
cnt = 0
 
for i in range(N):
    for j in range(i+1, N):
        if A[i] > A[j]:
            cnt += 1
 
cnt = cnt % MOD
 
if K >= 2:
    cnt = (cnt * K) % MOD
 
cnt2 = 0
 
if K >= 2:
    for i in range(N):
        for j in range(N):
            if A[i] > A[j]:
                cnt2 += 1
    cnt2 = cnt2 % MOD
 
    tmp = ((K) * (K-1)) // 2
 
    cnt2 = (cnt2 * tmp) % MOD
 
cnt = (cnt + cnt2) % MOD
 
print(cnt)

Measured memory_bytes: 67432
abcd=list(input())
abcd=list(map(int,abcd))
for i in range(2**3):
  ret=abcd[0]
  for j in range(3):
    if (i>>j)%2==1:
      ret-=abcd[j+1]
    else:
      ret+=abcd[j+1]
  if ret==7:
    ans=[str(abcd[0])]
    for j in range(3):
      if (i>>j)%2==1:
        ans.append("-")
      else:
        ans.append("+")
      ans.append(str(abcd[j+1]))
    ans.append("=")
    ans.append("7")
    print("".join(ans))
    exit(0)


Measured memory_bytes: 3064
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll Mypow(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll gcd(ll a, ll b){//計算量はO(log(max(a,b))
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

ll kai(ll x){
  if(x == 1) return 1;
  return x * kai(x-1) % MOD;
}

int main(){
  ll N; cin >> N;
  cout << N * 800 - 200 * (N / 15) << endl;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

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

int n;
vint graph[1001];
int x[1001];

vint dp[1001];

bool dfs(int u) {
  resz(dp[u], 5001, 0);

  for(int v : graph[u]) {
    if(!dfs(v)) return false;
    vint dp2(5001, inf);
    for(int i = 0; i < 5001; ++i) {
      int y = dp[v][x[v]];
      if(i+x[v] < 5001) chmin(dp2[i+x[v]], dp[u][i]+y);
      if(i+y < 5001) chmin(dp2[i+y], dp[u][i]+x[v]);
    }
    dp[u].swap(dp2);
  }

  if(dp[u][x[u]] == inf) return false;
  return true;
}

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

  cin >> n;
  rep(i, n-1) {
    int p; cin >> p; --p;
    graph[p].push_back(i+1);
  }
  rep(i, n) cin >> x[i];
  cout << (dfs(0) ? "POSSIBLE" : "IMPOSSIBLE") << endl;


  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, s.size()) if(s[i] != t[i]) ++ans;
  cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    unsigned long long ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        ans+=a-1;
    }
    cout << ans << endl;
    return 0;
}

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

long long int n,m,i,j,dp[1002][1002],ma=1000000007;
char mat[1002][1002];
int main()
{
    

    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            cin>>mat[i][j];
            dp[i][j] = 0;
        }
    }
    for(i=n;i>=1;i--)
    {
        for(j=m;j>=1;j--)
        {
            if(i==n && j==m)
            {
                dp[i][j] = 1;
            }
            else if(i==n)
            {
                if(mat[i][j] == '#')
                dp[i][j] = 0;
                else
                {
                    dp[i][j] = dp[i][j+1];
                }
            } 
            else if(j==m)
            {
                if(mat[i][j] == '#')
                dp[i][j] = 0;
                else
                {
                    dp[i][j] = dp[i+1][j];
                }
            }
            else
            {
                if(mat[i][j] == '#')
                dp[i][j] = 0;
                else
                {
                    dp[i][j] = (dp[i][j+1]%ma + dp[i+1][j]%ma)%ma;
                }
            }
        }
    }
    // for(i=1;i<=n;i++)
    // {
    //     for(j=1;j<=m;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    cout<<dp[1][1]<<endl;
}

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

int InsertionSort( int *a, int n, int g )
{
    int cnt = 0;
    for( int i = g; i <= n - 1 ; i++ )          //ここはi++でよかった。not i += g;
    {
        int v = a[i];
        int j = i - g;
        while( j >= 0 && a[j] > v )
        {
            a[j+g] = a[j];
            j = j - g;
            cnt++;
        }
        a[j+g] = v;
    }
    return cnt;
}

void ShellSort( int* a, int n )
{
    int cnt = 0, m = -1;
    int max = 0;

    while( max <= n )
    {
        max = max * 3 + 1;
        m++;
    }

    if( n < 4 )
    {
        max = 1 * 3 + 1;
        m = 1;
    }

    int G[m];

    cout << m << endl;                          //m個の整数の出力(1行目)

    for( int i = 0; i < m; i++ )
    {
        max /= 3;
        G[i] = max;
        cout << G[i] << " ";                    //G[i]の中身を順に出力(2行目)
        cnt += InsertionSort( a, n, G[i] );
    }
    cout << endl;
    cout << cnt << endl;                        //cntの値を出力(3行目)
}

int main()
{
    int n;                                      //n個の配列

    cin >> n;

    int x[n];                                   //配列

    for( int i = 0; i < n; i++ )                //配列の入力
        cin >> x[i];

    ShellSort( x, n );                          //内部で、m, G[i],cnt出力

    for( int i = 0; i < n; i++ )                //整列された値を順に出力
        cout << x[i] << endl;
    

    return 0;
}


Measured memory_bytes: 6952
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>
#include <map>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;
//obj;
class binary{
public:
    bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}
int binary_search(int key,vi a) {
   
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key,a)) ok = mid;
        else ng = mid;
    }
    return ok;
}
}obj;

int main(){
    string s,t;cin>>s>>t;
    size_t sin=s.length();
    int flag=0;
    rep(i,sin){
        if(s[i]!=t[i])flag++;
    }
    cout<<flag<<endl;
 }


Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}




int main() {
  int n,x,t;
  cin >> n >> x >> t;
  int ans=((n+x-1)/x)*t;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, l[2019];
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n;
	rep(i, 0, n-1){
		cin >> l[i];
	}
	sort(l, l+n);
	ll ans = 0;
	rrep(i, n-1, 2){
		rrep(j, i-1, 1){
			ll ok = j;
			ll ng = -1;
			while(ok-ng > 1){
				ll mid = (ng+ok)/2;
				if(l[mid]+l[j] > l[i]){
					ok = mid;
				}
				else{
					ng = mid;
				}
			}
			ans += j-ok;
		}
	}
	print(ans)
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>

using namespace std;

typedef long long ll;

ll k,a,b;

int main()
{
	cin >> k >> a >> b;
	if (a >= b - 1 || k <= a - 1)
	{
		cout << k + 1 << endl;
		return 0;
	}
	k -= a - 1;
	cout << a + (k / 2) * (b - a) + (k & 1) << endl;
	return 0;
}

Measured memory_bytes: 256
fn main() {
    let v = read_vec::<i32>();
    let a = v[0];
    let b = v[1];
    let c = v[2];
    let d = v[3];

    println!(
        "{}",
        std::cmp::max(std::cmp::min(b, d) - std::cmp::max(a, c), 0)
    );
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int main() {
    int a[10];
	for(int i=0;i<=9;i++) std::cin>>a[i];
 std::sort(a, a + 10, greater<int>());
 for (int j = 0; j < 3; j++) {
  std::cout << a[j] << endl;    
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<ll, ll>;
// Welcome to my source code!

vector<ll> divisor(ll n) {
    vector<ll> div;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            div.push_back(i);
            if (i != n / i) div.push_back(n / i);
        }
    }
    return div;
}

int main() {
    int n;
    cin >> n;
    int t[n];
    int maxt = 0;
    for (int i = 0; i < n; i++) {
        cin >> t[i];
        maxt = max(maxt, t[i]);
    }
    vector<ll> div = divisor(maxt);
    sort(div.begin(), div.end());
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (maxt % t[i] != 0) {
            ans += *lower_bound(div.begin(), div.end(), t[i]) - t[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3484
#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++)
typedef int64_t Int;

char Next(char c) {
  if (c == 'a') return 'b';
  if (c == 'b') return 'c';
  if (c == 'c') return 'd';
  if (c == 'd') return 'e';
  if (c == 'e') return 'f';
  if (c == 'f') return 'g';
  if (c == 'g') return 'h';
  if (c == 'h') return 'i';
  if (c == 'i') return 'j';
  if (c == 'j') return 'k';
  if (c == 'k') return 'l';
  if (c == 'l') return 'm';
  if (c == 'm') return 'n';
  if (c == 'n') return 'o';
  if (c == 'o') return 'p';
  if (c == 'p') return 'q';
  if (c == 'q') return 'r';
  if (c == 'r') return 's';
  if (c == 's') return 't';
  if (c == 't') return 'u';
  if (c == 'u') return 'v';
  if (c == 'v') return 'w';
  if (c == 'w') return 'x';
  if (c == 'x') return 'y';
  if (c == 'y') return 'z';
}

int main(){
  char x;
  cin >> x;
  
  cout << Next(x) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#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
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}




int main() {
	int  N, s=0,X,an=0,m=999999;
	
	cin >>N;
	vector<int> p(N);
	rep(i, N) {
		
		cin >> p.at(i);
		s += p.at(i);
		
	};
	s ;
	rep(i, N) {
		if (m > abs(s -N* p.at(i))) {
			m =  abs(s - N*p.at(i));
			an = i;
		}
	}

	cout << an<< endl;
	
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#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 mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b) cout << c << endl;
  else if(b == c) cout << a << endl;
  else cout << b << endl;

  return 0;
}

Measured memory_bytes: 256
import math
A,B,H,M =  map(int,input().split())
pi=math.pi




Mr=M*2*pi/60
Hr=(H+M/60)*2*pi/12

R=0
R=Mr - Hr


C=A**2+B**2 - 2*A*B*math.cos(R)
c=math.sqrt(C)
print(c)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

int D;
vector<int> c;
vector<vector<int>> s;

class Answer {
public:
    // 0~25の構造体
    vector<int> ans;
    explicit Answer() {
        ans.resize(D,0);
    }

    void print_ans() {
        for(const auto &it: ans) cout << it+1 << endl;
    }
};

void read() {
    cin >> D;
    c.resize(26);
    REP(i,26) cin >> c[i];
    s.resize(D);
    REP(i,D) {
        s[i].resize(26);
        REP(j,26) cin >> s[i][j];
    }
}


void solve() {
    read();
    auto ans = Answer();
    ans.print_ans();
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3680
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();
    	int[] H = new int[N];
    	boolean[] isBad = new boolean[N];
    	for (int i = 0; i < N; i++) {
    		H[i] = sc.nextInt();
        }
    	for(int i = 0; i < M; i++) {
    		int A = sc.nextInt() - 1;
    		int B = sc.nextInt() - 1;
    		int C = H[A] < H[B] ? A : B;
    		isBad[C] = true;
    		if(H[A] == H[B]){
    			isBad[A] = true;
    		}
    	}
    	
    	int sum = 0;
    	for(int i = 0; i < N; i++) {
    		if(!isBad[i])sum++;
    	}
    	System.out.println(sum);
    }
}

Measured memory_bytes: 49112
#include <stdio.h>

int main(int argc, char **argv) {
    int a, b, c, d ;
    scanf("%d %d %d %d", &a, &b, &c, &d) ;

    while(1){
        c -= b ;
        if (c <= 0){
            printf("Yes\n") ;
            break ;
        }
        a -= d ;
        if (a <= 0){
            printf("No\n") ;
            break ;
        }
    }
    return 0 ;
}


Measured memory_bytes: 1664
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if((a+b)%2==0){
		cout<<(a+b)/2<<endl;
	}
	
	else if((a+b)%2!=0){
		cout<<(a+b)/2+1<<endl;
	}
	
}

Measured memory_bytes: 256