akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
std::vector<int> eratosthenes(const int n) {
  std::vector<bool> is_prime(n + 1, true);
  std::vector<int> p;
  for (int i = 2; i <= n; i++) {
    if (is_prime[i]) {
      for (int j = 2 * i; j <= n; j += i) {
        is_prime[j] = false;
      }
      p.emplace_back(i);
    }
  }
  return p;
}
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int x;
  cin >> x;
  vector<int> res = eratosthenes((int)1e+5 + 3);
  int ok = SIZE(res) - 1;  //解が存在する値 [ok,ng) or (ng,ok]
  int ng = -1;             // 解が存在しない値

  while (abs(ok - ng) > 1) {
    int mid = (ok + ng) / 2;
    if (res[mid] >= x)
      ok = mid;
    else
      ng = mid;
  }
  cout << res[ok] << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
using namespace std;

int mod=1000000007;
int n;
char s1[105];
char s2[105];
bool p[105];

long long pow(long long a,int b)
{
    long long ans=1;
    while (b!=0)
        {
        if (b%2==1) ans=(ans*a)%mod;
        a=(a*a)%mod;
        b/=2;
        }
    return ans;
}

int main()
{
    scanf ("%d",&n);
    scanf ("%s",s1+1);
    scanf ("%s",s2+1);
    for (int i=1;i<=n;i++)
        if (s1[i]==s2[i]) p[i]=1;
    long long ans=1;
    bool g=0;
    int last=0;
    if (p[1]==1) {ans=3; last=1;}

    for (int i=2;i<=n;i++)
        if (p[i]==1)
           {
            if (p[i-1]==1) ans=(ans*2)%mod;
            else ans=(ans*2*pow(3,(i-last-1)/2-1))%mod;

            if (last==0 && p[i-1]==0) ans=(ans*3)%mod;
            last=i;
           }

    if (last!=0)
       {
        if (p[n]!=1) ans=(ans*2*pow(3,(n-last)/2-1))%mod;
       }
    else ans=(ans*6*pow(3,n/2-1))%mod;

    printf ("%d",ans);
}


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

int main(void){
    int n;cin>>n;
    int ans=0;
    for(int i=0;i<n;i++){
        int a;cin>>a;
        while(a%2==0){
            ans++;a/=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(void)
{
    int n,m=0,maxn=-1,maxn2=-1;
    scanf("%d",&n);
    int *num=(int*)malloc(sizeof(int)*n);
    while(n>0)
    {
        scanf("%d",&num[m]);
        if(num[m]>maxn)
        {
            maxn2=maxn;
            maxn=num[m];
        }
        else if(num[m]>maxn2) maxn2=num[m];
        n--;m++;
    }
    while(m>0)
    {
        if(num[n]==maxn) printf("%d\n",maxn2);
        else printf("%d\n",maxn);
        m--;n++;
    }
    free(num);
    return 0;
}




Measured memory_bytes: 2304
import java.util.*;
public class Main{
    public static void main(String[] args){
	int a,b,c,d,cnt=0;
	Scanner sc = new Scanner(System.in);

	
	while(sc.hasNext()){
	    int n = sc.nextInt();
	    cnt=0;
	    for(a=0;a<10;a++){
		for(b=0;b<10;b++){
		    for(c=0;c<10;c++){
			for(d=0;d<10;d++){
			    if((a+b+c+d)==n)
				cnt++;
			}
		    }
		}
	    }
	    System.out.println(cnt);
	    /*  n=sc.nextInt();*/
	}
    }
}

Measured memory_bytes: 18852
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            var n = Sarray()[0];
            var minNums = Enumerable.Repeat(long.MaxValue, 26).ToArray();
            for (var i = 0; i < n; ++i)
            {
                var Si = ReadLine();
                var cnt = new long[26];
                foreach (var s in Si)
                    ++cnt[s - 'a'];
                for (var j = 0; j < 26; ++j)
                    minNums[j] = Min(minNums[j], cnt[j]);
            }
            var ans = string.Empty;
            for (var i = 0; i < 26; ++i)
                ans += new string((char)('a' + i), (int)minNums[i]);

            WriteLine(ans);
        }



        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28224
s=list(input())

for i in range(1,len(s)):
    if (len(s)-i)%2==0:
        a=0
        for j in range((len(s)-i)//2):
            if s[j]!=s[j+(len(s)-i)//2]:
                a+=1
        if a==0:
            print(len(s)-i)
            break


Measured memory_bytes: 2940
#include <stdio.h>
  
int main(void)
{
    int D[6];
    int i, t, f, q, e, tp, fp, t1, t2, f1, f2;
  
    for (i = 0; i < 6; i++) scanf("%d", &D[i]);
  
    scanf("%d", &q);
  
    for (i = 0; i < q; i++)
    {
        scanf("%d", &t);
        tp = 0;
        while (D[tp] != t) 
        {
            tp++;
        }
        scanf("%d", &f);
        fp = 0;
        while (D[fp] != f) 
        {
            fp++;
        }
  
        t1 = tp / 3;
        t2 = t1 > 0 ? 3 - (t1 + tp % 3) : tp % 3;
        f1 = fp / 3;
        f2 = f1 > 0 ? 3 - (f1 + fp % 3) : fp % 3;
  
        e = t1 ^ f1;
        e = f2 - (t2 + 1) % 3 != 0 ? !e * 3 : e * 3;
        e += e > 0 ? (t2 + f2) - 1 : 3 - (t2 + f2);
  
        printf("%d\n", D[e]);
    }
      
    return 0;
}


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

alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(10**15):
  a = N
  N -= 26**i
  if N < 0:
    n = i
    break
ans = ['']*n
S = [0]*n
for i in range(n):
  S[-i-1] = (a//(26**i))%26
  ans[-i-1] = alp[S[-i-1]]

print(''.join(ans))

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

int main(){
  long long a, b, x;
  long long u = 0;
  cin >> a >> b >> x;
  if (a == 0) u++, a++;
  cout << b / x - (a - 1) / x + u << endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

while True:
    N = input()
    if N.find(".") < 0:
        N = N + ".0"
    
    strA,strB = N.split(".")
    a = int(strA)
    if strA[0] == "-":
        break
    b = int(strB) * (10 ** (4-len(strB)))

    s1 = ""
    s2 = ""
    for i in range(8):
        if a > 0:
            s1 = str(a % 2) + s1
            a = a // 2
        else:
            s1 = "0" + s1
    
    for i in range(4):
        if b > 0:
            s2 = s2 + str((b * 2) // 10000) 
            b = (b * 2) % 10000
        else:
            s2 = s2 + "0"

    if a == 0 and b == 0:
        print(s1 + "." + s2)
    else:
        print("NA")
    
    


Measured memory_bytes: 5604
#include<iostream>
#define N 501
const int inf= 1000000000;
using namespace std;
 #define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
int cap[N][N];
int flow[N][N];
bool vis[N];


int fordFulkerson(const int n,int t,int now,int fl){
  if (now == t)return fl;
  if (vis[now])return 0;
  vis[now]=true;
  int tmp=0;
  for(int i = 0 ;i < n ; i++){
    int &next=i;
    if (cap[now][i] - flow[now][i] > 0){
      tmp=fordFulkerson(n,t,next,min(fl,cap[now][i]-flow[now][i]));
      if (tmp != 0){
        flow[now][next]+=tmp;
        flow[next][now]=-flow[now][next];
        return tmp;
      }
    }
  }
  return 0;
}
 
int maxFlow(int n,int s,int t){
  int tmp=0,ret=0;
  for(int i = 0 ; i < n ; i++)vis[i]=false;
  while((tmp = fordFulkerson(n,t,s,inf)) != 0){
    ret+=tmp;
    for(int i = 0 ; i < n ; i++)vis[i]=false;
  }
  return ret;
}
 
bool dfs(int n,int now,int t){
  if (now == t)return true;
  if (vis[now])return false;
  vis[now]=true;
  for(int i = 0 ; i < n ; i++){
    int &next=i;
    if (flow[now][next] < 0){
      if (dfs(n,next,t)){
        flow[now][next]=flow[next][now]=0;
        return true;
      }
    }
  }
  return false;
}
 
int dfs2(int n,int now,int t){
  if (now == t)return 1;
  if (vis[now])return 0;
  vis[now]=true;
  for(int i = 0 ; i < n ; i++){
    int &next=i;
    if (cap[now][next]-flow[now][next] > 0){
      if (dfs2(n,next,t)){
        flow[now][next]+=1;
        flow[next][now]=-flow[now][next];
        return 1;
      }
    }
  }
  return 0;
}
 
main(){
  int n,e,q;
  while(cin>>n>>e>>q){
    const int s = 0,t=n-1;
    rep(i,n)rep(j,n)cap[i][j]=0,flow[i][j]=0;
    rep(i,e){
      int f,t;
      cin>>f>>t;
      f--;t--;
      cap[f][t]=1;
      cap[t][f]=1;
    }
    int prev=maxFlow(n,s,t);
    rep(i,q){
      int a,from,to,tmp;
      cin>>a>>from>>to;
      from--;to--;
      if (a == 1){//add
	cap[from][to]=cap[to][from]=1;
	tmp = maxFlow(n,s,t);
#ifdef DEBUG1
	cout <<"add:";
#endif
	cout << prev+tmp << endl;
	prev=prev+tmp;
      }else if (flow[from][to] == 0){
#ifdef DEBUG1
	cout <<"noflow:";
#endif
	cap[from][to]=cap[to][from]=0;
	cout << prev << endl;
      }else {//delete
#ifdef DEBUG1
	cout <<"del:";
#endif
	if (flow[from][to] < 0)swap(from,to);
	cap[from][to]=cap[to][from]=0;
	flow[from][to]=flow[to][from]=0;

	rep(j,n)vis[j]=false;
	tmp=dfs2(n,from,to);
	if (tmp != 0){
	  cout << prev << endl;
	  prev=prev;//keep
	}else {
	  rep(j,n)vis[j]=false;
	  dfs(n,from,s);
	  rep(j,n)vis[j]=false;
	  dfs(n,t,to);
	  cout << prev-1 << endl;
	  prev=prev-1;
	}
      }
    }
#ifdef DEBUG
    cout << "end " << endl;
#endif
  }
}

Measured memory_bytes: 2844
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
int A[100111];
LL B[100111];

int main() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i);

    LL z = 0;
    REP (i, N) z += A[i];

    bool yes = true;
    LL t = z / ((LL)N * (N+1) / 2);
    if (z % ((LL)N * (N+1) / 2)) yes = false;

    if (yes) {
	REP (i, N) if (A[i] < t || t * N < A[i]) yes = false;
    }

    if (yes) {
	REP (i, N) B[i] = A[i] - i * t;
	REP (i, N-1) if (B[i] < B[i+1]) yes = false;
	REP (i, N-1) if ((B[i] % N + N) % N != (B[i+1] % N + N) % N) yes= false;
    }

    puts(yes? "YES": "NO");


    return 0;
}



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

#define ll long long int
#define LD long double

const int N = 100010;

int inf = 1e9;
int mod = 1e9 + 7;

signed main()
{
    //freopen("IN.txt", "r", stdin);
    //freopen("OUT.txt", "w", stdout);

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);


    string s; cin >> s;
    int k; cin >> k;
    int n = (int)s.length();

    bool key = true;
    for(int i = 1; i < n; i++) {
        if(s[i] != s[i - 1]) {
            key = false;
        }
    }

    if(key) {
        ll t = 1LL * n * k;
        cout << t / 2 << "\n";
        return 0;
    }

    vector<int> diff;
    int cnt = 1;
    for(int i = 1; i < n; i++) {
        if(s[i] == s[i - 1]) {
            cnt++;
        }
        else {
            diff.push_back(cnt);
            cnt = 1;
        }
    }

    diff.push_back(cnt);

    ll ans = 0;
    for(int i = 1; i < (int)diff.size() - 1; i++) {
        ans += diff[i] / 2;
    }

    ans *= k;

    if(s[0] == s[n - 1]) {
        ans += 1LL * (diff[0] + diff.back()) / 2 * (k - 1);
    }
    else {
        ans += (1LL * diff[0] / 2) * (k - 1) + (1LL * diff.back() / 2) * (k - 1);
    }

    ans += diff[0] / 2 + diff.back() / 2;

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod =1e9+7;
const int N = (int)2e5 + 5;

void solve(){
	ll k,n;
	cin>>k>>n;
	ll a[n];
	rep(i,n)cin>>a[i];
	vi v;
	rep(i,n-1){
		v.pb(a[i+1]-a[i]);
	}
	v.pb(a[0]+k-a[n-1]);
	sort(all(v));
	int ans=0;
	rep(i,sz(v)-1){
		ans+=v[i];
	}
	cout<<ans;



}
int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

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

using namespace std;

int main()
{
	long long A, B;
	cin >> A >> B;

	long long a = A;
	long long b = B;

	long long tmp;
	if (A < B) {
		tmp = A;
		A = B;
		B = tmp;
	}

	long long r = A % B;
	while (r != 0)
	{
		A = B;
		B = r;
		r = A % B;
	}
	
	long long res = a * b / B;

	cout << res << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> edge;
typedef vector<edge> ve;
typedef vector<ve> graph;

int main(){
  int n,m,p;
  while(scanf("%d%d%d",&n,&m,&p), n){
    graph g(n);
    for(int i=0;i<m;i++){
      int a,b,c;
      scanf("%d%d%d",&a,&b,&c);
      g[a].push_back(edge(c,b));
      g[b].push_back(edge(c,a));
    }

    vi c(p);
    for(int i=0;i<p;i++)scanf("%d",&c[i]);

    vi d(n,1e9), order;
    d[0] = 0;
    priority_queue< edge,vector<edge>,greater<edge> > pq;
    pq.push(edge(0,0));

    while(pq.size()){
      int dis = pq.top().first, v = pq.top().second; pq.pop();
      if(d[v] < dis)continue;
      order.push_back(v);

      for(edge e : g[v]){
	int nxtd = dis + e.first, u = e.second;
	if(d[u] > nxtd){
	  d[u] = nxtd;
	  pq.push(edge(nxtd,u));
	}
      }
    }

    vector<double> cnt(n,0);
    cnt[n-1] = 1;
    for(int i=order.size()-1;i>=0;i--){
      int v = order[i];
      for(edge e : g[v]){
	int dis = e.first, u = e.second;
	if(d[v] == d[u] + dis)cnt[u] += cnt[v];
      }
    }

    vector<double> prob(n,0);
    prob[0] = 1;
    for(int i=0;i<n;i++){
      int v = order[i];

      for(edge e : g[v]){
	int nxtd = d[v] + e.first, u = e.second;
	if(d[u] == nxtd){
	  prob[u] += prob[v] * cnt[u] / cnt[v];
	}
      }
    }

    for(int i=0;i<p;i++)printf("%.9lf\n", prob[c[i]]);
    puts("");
  }
}

Measured memory_bytes: 1348
def main():
  ans = 'YES'
  n = int(input())
  l = list(map(int, input().split()))
  a = 0
  for i in l:
      if i % 2 != 0:
          a += 1
  if a % 2 != 0:
      ans = 'NO'
  print(ans)

if __name__ == '__main__':
  main()

Measured memory_bytes: 14108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String line = sc.nextLine();
		String num = "0";
		if (line.equals("SUN")) {
			num = "7";
		} else if (line.equals("MON")) {
			num = "6";
		} else if (line.equals("TUE")) {
			num = "5";
		} else if (line.equals("WED")) {
			num = "4";
		} else if (line.equals("THU")) {
			num = "3";
		} else if (line.equals("FRI")) {
			num = "2";
		} else {
			num = "1";
		}

		// 出力
		System.out.println(num);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#define INF 1000000010

using namespace std;

int n, a[500010], cnt=0;

void merge (int left, int mid, int right)
{
    int n1=mid-left, n2=right-mid, L[n1+1], R[n2+1];
    for (int i=0; i<n1; i++) L[i]=a[left+i];
    for (int i=0; i<n2; i++) R[i]=a[mid+i];
    L[n1]=INF; R[n2]=INF;
    int i=0, j=0;
    for (int k=left; k<right; k++)
    {
        cnt++;
        if (L[i]<=R[j])
        {
            a[k]=L[i];
            i++;
        }
        else
        {
            a[k]=R[j];
            j++;
        }
    }
}

void mergesort (int left, int right)
{
    if (left+1<right)
    {
        int mid=(left+right)/2;
        mergesort(left, mid);
        mergesort(mid, right);
        merge(left, mid, right);
    }
}
int main()
{
    cin>>n;
    for (int i=0; i<n; i++) cin>>a[i];
    mergesort(0, n);
    for (int i=0; i<n; i++)
    {
        if (i!=n-1) cout<<a[i]<<' ';
        else cout<<a[i]<<'\n';
    }
    cout<<cnt<<'\n';
    return 0;
}



Measured memory_bytes: 6896
// #pragma GCC optimize("Ofast")

// #pragma GCC optimize("no-stack-protector")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>

using namespace std;

template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}

template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define left left228
#define right right228
#define ld long double
#define list list228
// #define prev prev228
#define mp make_pair
#define list list228
#define all(v) v.begin(), v.end()

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (c - a - b <= 0) cout << "No\n";
    else {
        if (4 * a * b < (c - a - b) * (c - a - b)) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}

/*
3
1 1 2
2 2 2
3 3 2
2 1 1
3 2 1


2 2
1 1 2
2 2 2
1 2 3
2 1 1

2
2 1 2 2 3
2 2 2 1 1

5
1 2
2 3
3 4
3 5
1
2 3
1 2
4 3
2 3 5

*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0 ;i < s.size(); i++) if(s[i] == '1') cnt++;
    cout << cnt;
}

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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	double s = (a + b + c) * 0.5;
	double r = sqrt(s * (s - a) * (s - b) * (s - c));
	int r2 = int(r + 0.5);

	cout << r2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int main(){
	int k;
	scanf("%d", &k);
	int a[100000];
	for (int i = 0; i<k; i++){
		scanf("%d", &a[i]);
	}
	long long int m = 2;
	long long int n = 2;
	if (a[k - 1] != 2){
		m = -1;
		n = -1;
	}
	for (int i = k - 2; i >= 0; i--){
		if (m == -1){
			break;
		}
		long long int mm = ((m - 1) / a[i] + 1)*a[i];
		if ((mm / a[i + 1])*a[i + 1] <= n){

		}
		else{
			m = -1;
            break;
		}
		if (n == -1)break;
		long long int nn = ((n + a[i + 1] - 1) / a[i])*a[i];
		if ((nn / a[i + 1])*a[i + 1] >= m){
			m = mm;
			n = nn;
		}
		else n = -1;
	}
	if (n != -1)n = n + a[0] - 1;
	if (m != -1)printf("%lld %lld\n", m, n);
	else printf("-1\n");
	return 0;
}


Measured memory_bytes: 512
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

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

n, k = splitintinput()
for i in range(10000):
    if n < k ** i:
        print(i)
        break
    


Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

class mytree
{
public:
    mytree() {}
    mytree(int n)
    : g(vector< vector< pair<int, s64> > >(n)), d(vs64(n, 0))
    {}
    ~mytree() {}

    void dijkstra(int x)
    {
        vector< bool > done(d.size(), false);
        queue<int> q;
        q.push(x);
        done[x] = true;

        while (!q.empty())
        {
            int y = q.front();
            q.pop();
            rep (i, g[y].size())
            {
                int c = g[y][i].first;
                if (!done[c])
                {
                    d[c] = d[y] + g[y][i].second;
                    q.push(c);
                    done[c] = true;
                }
            }
        }
    }

    vector< vector< pair<int, s64> > > g;
    vs64 d;
};

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

    int N;
    cin >> N;

    mytree tree(N);
    int a, b;
    s64 c;
    rep (i, N - 1)
    {
        cin >> a >> b >> c;
        --a; --b;
        tree.g[a].emplace_back(b, c);
        tree.g[b].emplace_back(a, c);
    }

    int Q, K;
    cin >> Q >> K;
    --K;
    tree.dijkstra(K);

    s64 x, y;
    rep (i, Q)
    {
        cin >> x >> y;
        --x; --y;
        cout << tree.d[x] + tree.d[y] << "\n";
    }

    return 0;
}



Measured memory_bytes: 9984
#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <cmath> 
#include <algorithm> 
#include <vector> 
using namespace std; 

const int MAX_N = 1e5 + 5; 

vector<int> G[MAX_N]; 
int N, X[MAX_N][2]; 
pair<int, int> p[MAX_N]; 
int id[MAX_N << 2], cnt; 
void Add_Edge(int u, int v) { G[u].push_back(v); } 
#define lson (o << 1)
#define rson (o << 1 | 1) 
void build(int o, int l, int r) { 
	if (l == r) return (void)(id[o] = p[l].second); 
	id[o] = ++cnt; 
	int mid = (l + r) >> 1; 
	build(lson, l, mid), build(rson, mid + 1, r); 
	Add_Edge(id[o], id[lson]), Add_Edge(id[o], id[rson]); 
} 
void Link(int o, int l, int r, int ql, int qr, int x) { 
	if (ql <= l && r <= qr) return Add_Edge(x, id[o]); 
	int mid = (l + r) >> 1; 
	if (ql <= mid) Link(lson, l, mid, ql, qr, x); 
	if (qr > mid) Link(rson, mid + 1, r, ql, qr, x); 
} 
int low[MAX_N], dfn[MAX_N], stk[MAX_N], top; 
int col[MAX_N], scc, tim; 
void tarjan(int x) { 
	dfn[x] = low[x] = ++tim, stk[++top] = x; 
	for (auto v : G[x]) { 
		if (!dfn[v]) tarjan(v), low[x] = min(low[x], low[v]); 
		else if (!col[v]) low[x] = min(low[x], dfn[v]); 
	} 
	if (low[x] == dfn[x]) { 
		col[x] = ++scc; 
		while (stk[top] != x) col[stk[top--]] = scc; 
		--top; 
	} 
} 
bool check(int v) { 
	for (int i = 1; i <= N << 1; i++) G[i].clear(); 
	memset(low, 0, sizeof(low)); 
	memset(dfn, 0, sizeof(dfn)); 
	memset(col, 0, sizeof(col)); 
	scc = tim = top = 0; 
	cnt = N << 1; build(1, 1, N << 1); 
	for (int i = 1; i <= N; i++) 
		for (int op = 0; op < 2; op++) { 
			int l = lower_bound(&p[1], &p[N << 1 | 1], make_pair(X[i][op] - v + 1, 0)) - p; 
			int r = lower_bound(&p[1], &p[N << 1 | 1], make_pair(X[i][op] + v - 1, N << 1 | 1)) - p - 1; 
			int m = lower_bound(&p[1], &p[N << 1 | 1], make_pair(X[i][op], i + (op ^ 1) * N)) - p; 
			if (l <= m - 1) Link(1, 1, N << 1, l, m - 1, i + op * N); 
			if (m + 1 <= r) Link(1, 1, N << 1, m + 1, r, i + op * N); 
		} 
	for (int i = 1; i <= cnt; i++) if (!dfn[i]) tarjan(i); 
	for (int i = 1; i <= N; i++) if (col[i] == col[i + N]) return 0; 
	return 1; 
} 
int main () { 
	scanf("%d", &N); 
	for (int i = 1; i <= N; i++) scanf("%d %d", &X[i][0], &X[i][1]); 
	for (int i = 1; i <= N; i++) 
		p[i] = make_pair(X[i][0], i + N), p[i + N] = make_pair(X[i][1], i); 
	sort(&p[1], &p[N << 1 | 1]); 
	int l = 0, r = 1e9, ans = 0; 
	while (l <= r) { 
		int mid = (l + r) >> 1; 
		if (check(mid)) ans = mid, l = mid + 1; 
		else r = mid - 1; 
	} 
	printf("%d\n", ans); 
    return 0; 
} 

Measured memory_bytes: 19200
#include <stdio.h>
#include <stdlib.h>
#define Max 100000

int partition(int A[], int p, int r)
{
    int x,i,j,t;
    x=A[r];
    i=p-1;
    for (j=p;j<r;j++)
    {
        if(A[j]<=x)
        {
           
            i++;
            t=A[i];
            A[i]=A[j];
            A[j]=t; 
        }
           
    }
    t=A[i+1];
     A[i+1]=A[j];
     A[j]=t;
     return i+1;
}





int main()
{
    int A[Max];
    int n;
    int i;
    int j=0;
    int p;
    scanf("%d", &n);
    for(i=0;i<n;i++)
    {
        scanf("%d", &A[i]);
       
    }
    
    p=partition(A,0,n-1);

    
     
    for (int j=0; j != n; j++) 
    {
        if (j==p){printf("[%d] ", A[j]);j++;}
        if (j==n-1)printf("%d\n", A[j]);

        else printf("%d ", A[j]);
      

    }
    return 0;
    
}


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

int main() {
  int a, s1, s2, s3;
  cin >> a;
  s1 = a / 100;
  s2 = a % 100 / 10;
  s3 = a % 100 % 10;
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>a;
int main()
{
    int n,temp;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> temp;
        a.push_back(temp);
   }
    int time;
        cin >> time;
    for (int i = 0; i < time; i++)
    {
        cin >> temp;
        if (binary_search(a.begin(), a.end(), temp))cout << 1 << endl;
        else cout << 0 << endl;
    }
}


Measured memory_bytes: 3528
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		int n;
		cin >> n;
		if (!n)break;
		vi l(n);
		REP(i, n)cin >> l[i];
		vi r(n+1);
		vi v(n);
		vi o(256);
		double ans = INF*INF;
		int x = 0,y = 0,z = 0;
		
		REP(s, 16) {
			REP(a, 16) {
				REP(c, 16) {
					REP(i, 256)o[i] = 0;
					r[0] = s;
					REP(i, n) {
						r[i + 1] = (a*r[i] + c) % 256;
					}
					REP(i, n)v[i] = (r[i+1] + l[i]) % 256;
					REP(i, n) {
						o[v[i]]++;
					}
					double tmp = 0;
					REP(i, 256) {
						double d = double(o[i]) / n;
						if (o[i] != 0)tmp -= d*log(d);
					}
					if (tmp+EPS  < ans){
						x = s, y = a, z = c;

						ans = tmp;
					}
				}
			}
		}
		cout << x << " " << y << " " << z << endl;
	}
	return 0;
}

Measured memory_bytes: 3432
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    long long sum = 0;
    for(int i = 1; i < N; i++){
        if(A[i] < A[i - 1]) {
            sum += A[i - 1] - A[i];
            A[i] = A[i - 1];
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 4776
#include <cstdio>
#include <cmath>
int main()
{
	int n;
	scanf("%d", &n);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int s = 0, j = i;
		while (j) {
			j /= 10;
			s++;
		}
		if (s % 2)
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int ans = m * (m - 1) / 2 + n * (n - 1) / 2;
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
/*
  AUTHOR:SOURABH
  CREATED:23:06:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pii , null_type, less< pii >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,i,j,ans;
    set<ll> d;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n;
        vll div(n+1,0);
         for (int i = 1; i <= n; i++) {

        // Increase divisors count for
        // every number divisible by i
        for (int j = 1; j * i <= n; j++)
            div[i * j]++;
    }
    ans=0;
        fs(i,1,n+1)
        ans+=i*div[i];
        cout<<ans;
    }
    return 0;
}




























Measured memory_bytes: 81332
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  
  if(n%10==7 || (n/10)%10==7 || n/100==7) cout << "Yes"<<endl;
  else cout << "No" <<endl;
  
  
  return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
      cin >> A[i];
    }
    sort(A.begin(), A.end());
    vector<ll> bounds(N);
    bounds[N - 1] = (A[N - 1] + 1) / 2;
    for (int i = N - 2; i >= 0; i--) {
      bounds[i] = max((A[i] + 1) / 2, bounds[i + 1] - A[i]);
    }
    int res = 1;
    ll sum = 0;
    for (int i = 0; i < N - 1; i++) {
      sum += A[i];
      if (sum >= bounds[i + 1]) {
        ++res;
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end() //使うときはsort(all())という感じで
using ll = long long;
#define PI 3.14159265359

int main(void){
  int n,k;
  cin>>n>>k;
  vector<int> vec(n);
  vector<int> v(n-k+1,0);
  int ma=0;
  double sum=0;
  rep(i,n){
    cin>>vec[i];
    if(i<k){
      sum+=vec[i];
    }
    else{
      v[i-k+1]=vec[i]-vec[i-k]+v[i-k];
      ma=max(v[i-k+1],ma);
    }
  }
  cout<<fixed<<setprecision(12)<<(sum+ma+k)/2<<endl;
  return 0;
}


Measured memory_bytes: 1792
import math
def main():
    a, b, c, d = [float(i) for i in input().split()]
    taka = math.ceil(c / b)
    aoki = math.ceil(a / d)
    if taka <= aoki:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()



Measured memory_bytes: 9104
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
#[allow(dead_code)]
struct Main {
    n: usize,
    m: usize,
    q: usize,
    ptns: Vec<Vec<usize>>,
    a: Vec<usize>,
    b: Vec<usize>,
    c: Vec<usize>,
    d: Vec<usize>,
    max: usize,
}

#[allow(dead_code)]
impl Main {
    fn dfs(&mut self, vals: Vec<usize>, depth: usize) {
        if depth == self.n {
            return;
        }
        if depth == self.n - 1 {
            // println!("{:?}", vals);
            let mut sum = 0;
            for i in 0..self.q {
                let expected_c = vals[self.b[i]] - vals[self.a[i]];
                if expected_c == self.c[i] {
                    // println!("{}", self.d[i]);
                    sum += self.d[i];
                }
            }
            // println!("{:?}", sum);
            if sum > self.max {
                self.max = sum;
            }
        }

        for new_val in *vals.last().unwrap()..=self.m {
            let mut next_vals = vals.clone();
            next_vals.push(new_val);
            self.dfs(next_vals, depth + 1);
        }
    }
    fn invoke(&mut self) {
        self.dfs(vec![1], 0);
        println!("{}", self.max);
    }
}

fn main() {
    let n = read::<usize>();
    let m = read::<usize>();
    let q = read::<usize>();
    let mut a = vec![0; q];
    let mut b = vec![0; q];
    let mut c = vec![0; q];
    let mut d = vec![0; q];
    for i in 0..q {
        let a_one = read::<usize>();
        a[i] = a_one - 1;
        let b_one = read::<usize>();
        b[i] = b_one - 1;
        let c_one = read::<usize>();
        c[i] = c_one;
        let d_one = read::<usize>();
        d[i] = d_one;
    }
    Main {
        n,
        m,
        q,
        ptns: vec![],
        a,
        b,
        c,
        d,
        max: 0,
    }
    .invoke();
}


Measured memory_bytes: 2064
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input!{
        s: chars
    }
    let mut ans = 0;
    for i in s {
        if i == '+' { ans += 1; } else if i == '-' { ans -= 1; }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,k,temp,a;
  cin >> n >> k;
  vector<long long int> b(100010);
  for(int i=0; i<n; i++){
    cin >> a >> temp;
    b[a] += temp;
  }
  long long int c=0;
  for(int i=1; i<=100009; i++){
    c+=b[i];
    if(c>=k){
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 1024
#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;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;


int main(){
    int n;
    cin >> n;
    vector<int> L(n);
    rep(i,n) cin >> L[i];
    sort(L.begin(),L.end());
    int ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int now = L[i]+L[j];
            int r = distance(L.begin(),lower_bound(L.begin(),L.end(),now));
            int l = j+1;
            int dist = r-l;
            ans += dist;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#include<iostream>
using namespace std;
int main()
{
int n,i,j,s,c,cm=0;
int a[2][100];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[0][i];
}
for(i=0;i<n;i++)
{
cin>>a[1][i];
}
for(s=0;s<=n;s++)
{
j=0;c=0;
for(j=0;j<n;j++)
{
c+=a[0][j];
if(j==s)
{break;}
}
for(;j<n;j++)
{
c+=a[1][j];
}
if(c>cm)cm=c;
}
cout<<cm;
return 0;
}

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

int k, cur;

int main() {
	scanf("%d", &k);
	for (int i = 1; i <= k; i++) {
		cur = (cur * 10 + 7) % k;
		if (cur == 0) {
			printf("%d\n", i);
			return 0;
		}
	}
	printf("-1\n");
}

/*
typedef pair <int, int> ii;

#define MAX 100000000

int k, digits;
int seven, cur;
int ans;

int main() {
	scanf("%d", &k);
	digits = log10(k);
	for (int i = 0; i < digits; i++) {
		seven = seven * 10 + 7;
	}
	if (k > seven) seven = seven * 10 + 7;
	for (int j = 0; j < 10000000; j++) {
        int temp = cur;
		for (int i = 0; i < 10; i++) {
			if (temp + k * i <= seven) cur = temp + k * i;
		}
		//printf("%d, %d\n", cur, seven);
		if (cur == seven) {
			printf("%d\n", ans + (int) log10(cur) + 1);
			return 0;
		}
		cur *= 10; seven = seven * 10 + 7;
		if (cur >= MAX) {
			ans++;
			cur %= MAX;
			seven %= MAX;
		}
	}
	printf("-1\n");
	return 0;
}
*/


Measured memory_bytes: 3796
use proconio::input;

fn solve() {
    input! {
        s:String,t:String
    }
    let s = s.chars().collect::<Vec<char>>();
    let t = t.chars().collect::<Vec<char>>();
    let mut ans = 100000;
    for i in 0..s.len() - t.len() + 1 {
        let mut cnt = 0;
        for j in 0..t.len() {
            if s[i + j] != t[j] {
                cnt += 1;
            }
        }
        ans = if cnt < ans { cnt } else { ans };
    }
    println!("{}", ans);
}

fn main() {
    solve();
}


Measured memory_bytes: 2156
import sys


def main():
    input = sys.stdin.buffer.readline
    a, b, c = map(int, input().split())
    k = int(input())
    cnt = 0
    while a >= b:
        b *= 2
        cnt += 1
    while b >= c:
        c *= 2
        cnt += 1
    print("Yes" if cnt <= k else "No")


if __name__ == "__main__":
    main()


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

int main() {
  long long time = 0;
  long long n;
  vector<long long> city;
  cin >> n;
  for (int i = 0; i < 5; i++) {
    long long cap;
    cin >> cap;
    city.push_back(cap);
  }
  vector<long long>::iterator m = min_element(city.begin(), city.end());
  time = ((n + *m - 1) / *m) + 4;
  cout << time << endl;
  return 0;
}

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

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  int cnt = 0;
  int ans = 0;
  vector<int> d(200);
  for(int i = 1; i < min(a,b)+1; ++i) {
    if (a%i ==0 && b%i ==0) d.push_back(i);
  }
  std::sort(d.begin(),d.end(),std::greater<int>());
  ans = d[k-1];
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define pii pair<int, int>
#define rep(i,n) for(int i = 0;i < n; i++)
#define Rep(i,n) for(int i = 1;i <= n; i++)

int main(){
    int n,a = 0;string s;map<string, int> m;
    cin >> n;
    rep(i, n){
        cin >> s;
        m[s]++;
        a = max(a, m[s]);
    }
	for(auto& i : m){
        if(i.second == a)cout << i.first << endl;
    }
    return 0;
}


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

ll a, b, c, ans;

int main()
{
    cin >> a >> b >> c;
    if(a == b && b == c && a % 2 == 0){
        printf("-1\n");
        return 0;
    }
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
        ll d,e,f;
        d = a / 2;
        e = b / 2;
        f = c / 2;
        a = e + f;
        b = d + f;
        c = d + e;
        ans++;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a[3],e,f,x,y,z,i;
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>e>>f;
	x=100;
	y=0;
	for(i=0;i<4;i++){
		y=y+a[i];
		if(x>a[i]){
			x=a[i];
		}
	}
	z=y-x;
	if(e>f){
		z=z+e;
	}else{
		z=z+f;
	}
	cout<<z<<endl;
	return 0;
}

Measured memory_bytes: 3104
while n = gets.to_i
  break if n == 0
  root = Array.new(n){|i| i}
  node = {}
  n.times{|i|
    node[i] = [i]
  }
  m = gets.to_i
  edge = []
  m.times{|i|
    a, b, d = gets.chomp.split(",").map(&:to_i)
    a, b = b, a if a > b
    edge[i] = [d/100 - 1, a, b]
  }
  edge.sort!
  sum = 0
  while edge.size > 0
    d, a, b = edge.shift
    ra = root[a]
    rb = root[b]
    if ra != rb
      node[ra] += node[rb]
      node[rb].each{|i|
        root[i] = ra
      }
      sum += d
    end
  end
  p sum
end

Measured memory_bytes: 8804
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>A(N); rep(i, 0, N) { cin >> A[i]; A[i]--; }
	vector<int>B(N); rep(i, 0, N) { cin >> B[i]; }
	vector<int>C(N-1); rep(i, 0, N-1) { cin >> C[i]; }

	int ans = 0;
	rep(i, 0, N) {
		ans += B[A[i]];
	}
	rep(i, 0, N - 1) {
		dump(i, A[i], A[i + 1],ans);
		if (A[i] + 1 == A[i + 1]) {
			ans += C[A[i]];
		}
	}
	cout << ans << endl;

	return 0;
}


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

#define INF (1e9+5)
using namespace std;
typedef long long ll;
ll mod = 1000000000+7;

int x,y;

ll comb(int n, int r) {
  vector<ll> f(n+1), inv(n+1), invf(n+1);
  f[0]=f[1]=1;
  invf[0]=invf[1]=1;
  inv[1]=1;
  for (int i=2;i<n+1;i++) {
      f[i] = (i * f[i-1]) % mod;
      inv[i] = mod -((mod/i) * inv[mod%i]) % mod;
      invf[i] = (inv[i] * invf[i-1]) % mod;
  }     
  ll cmb = f[n] * (invf[r] * invf[n-r] % mod) % mod;
  if (n>=r) return cmb;
  else return 0;
}

int main() {
  scanf("%d %d", &x, &y);

  if ((x+y) % 3 != 0) {
    printf("%d\n", 0);
    return 0;
  }

  int n, m;
  // n+2m = x
  // 2n+m = y
  m = (2*x - y) / 3; // +2 y direction
  n = x - 2*m; // +2 x direction
  if (m < 0 || n < 0) {
    printf("%d\n", 0);
    return 0;
  }

  printf("%lld\n", comb(n+m, n));
}


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

int main(void){
	int N,time=0;
	cin >> N;
	int a[N];
	for(int i=0;i<N;i++){
		cin >> a[i];
	}

	for(int k=0;k<40;k++){
		bool f = true;
		for(int i=0;i<N;i++){
			if(a[i]%2!=0){
				f = false;
			}
		}
		if(f==true){
			for(int p=0;p<N;p++){
				a[p]=a[p]/2;
			}
			time=time+1;
		}
	}
	cout << time << endl;
	return 0;
}

Measured memory_bytes: 256