akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))
#define PI 3.14159265358979323


typedef struct point{double x,y;ll n;}P;

//凸包を求める。点の配列を引いて、凸包を構成する点のindexを求め、その要素数を返す
//O(nlogn)※誤差の扱いが雑
#define menseki(p,q)(p.x*q.y-p.y*q.x)
#define EPS 1e-6
ll pindex[110];
int pointhikaku(const void*p,const void*q){
	//辞書順ソート
	P pp=*(P*)p,qq=*(P*)q;
	if(pp.x<qq.x)return -1;
	if(pp.x>qq.x)return  1;
	if(pp.y<qq.y)return -1;
	return 1;
} 
int pointhikaku2(const void*p,const void*q){
	//argでソート
	P pp=*(P*)p,qq=*(P*)q;
	double diff=atan2(pp.y,pp.x)-atan2(qq.y,qq.x);
	return diff>0?1:diff<0?-1:0;
}
ll totuhou(P*a,ll cnt){
	//https://www.jaist.ac.jp/~uehara/course/2014/i481f/pdf/ppt-3.pdfによる
	if(cnt<=2){
		rep(i,0,cnt)pindex[i]=i;
		return cnt;
	}
	
	P*t=(P*)malloc(cnt*sizeof(P));
	P O;
	O.x=0,O.y=0;
	rep(i,0,cnt){O.x+=a[i].x/cnt;O.y+=a[i].y/cnt;}

	rep(i,0,cnt){
		t[i].x=a[i].x-O.x;
		t[i].y=a[i].y-O.y;
		t[i].n=a[i].n;
	}

	qsort(t,cnt,sizeof(P),pointhikaku2);
	//このソートによりx軸負の位置から反時計回りに並ぶ
		
	//x軸最小の点を選ぶ
	double mx=10000000;
	ll mi;
	rep(i,0,cnt)if(t[i].x<mx){
		mx=t[i].x;
		mi=i;
	}

	ll anscnt=2;
	pindex[0]=mi;
	pindex[1]=(mi+1)%cnt;
	rep(i,2,cnt+1){
		//リストの最後の2つと今見てる点の3つが凸orリストが1点　になるまで点を削除
		//Oの反時計回り順にある3点ABCが凸⇔△OAB+△OBC>△OAC
		while(anscnt>=2){
			ll a=pindex[anscnt-2];
			ll b=pindex[anscnt-1];
			ll c=(mi+i)%cnt;
			if(menseki(t[a],t[b])+menseki(t[b],t[c])>menseki(t[a],t[c])+EPS)break;
			anscnt--;
		}
		pindex[anscnt++]=(mi+i)%cnt;
	}
	//全ての点が同一直線状にあるときanscnt(=リストの長さ)は2
	//そうでないとき4以上で、これは凸包を構成する点の数+1(pindex[0]==pindex[anscnt-1])
	if(anscnt>2){
		rep(i,0,anscnt)pindex[i]=t[pindex[i]].n;//元のindexに戻す
		return anscnt-1;
	}else{
		//全ての点が同一直線上
		//ソートして端の点を返す
		qsort(t,cnt,sizeof(P),pointhikaku);
		pindex[0]=t[    0].n;
		pindex[1]=t[cnt-1].n;
		return 2;
	}
}


P ppp[110];
double ans[110];

double kakudo(ll a,ll b,ll c){
	//反時計回りの3点a,b,cのなす角度を求める
	double siita=atan2(ppp[a].y-ppp[b].y,ppp[a].x-ppp[b].x)-atan2(ppp[c].y-ppp[b].y,ppp[c].x-ppp[b].x);
	while(siita>2*PI)siita-=2*PI;
	while(siita<0)siita+=2*PI;
	return siita;
}

int main(){
	int n;
	scanf("%d",&n);
	rep(i,0,n){
		int x,y;
		scanf("%d%d",&x,&y);
		ppp[i].x=x;
		ppp[i].y=y;
		ppp[i].n=i;
	}

	ll x=totuhou(ppp,n);
	rep(i,0,x){
		ll a=pindex[(i-1+x)%x];
		ll b=pindex[i];
		ll c=pindex[(i+1)%x];
		ans[b]=(PI-kakudo(a,b,c))/(2*PI);
	}
	rep(i,0,n)printf("%.9f\n",ans[i]);
	return 0;
}

Measured memory_bytes: 380
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>

#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 n,m;
    cin >> n >> m;

    vector<int> h(n+1), ans(n+1);

    rep(i,n) cin >> h[i+1];

    for (int i = 0; i < m; i++)
    {
        int a,b;
        cin >> a >> b;

        if (h[a]>h[b])
        {
            ans[b]++;
        }else if (h[a]<h[b]) {
            ans[a]++;
        }else {
            ans[a]++;
            ans[b]++;
        }
    }

    int res=0;

    for (int i = 1; i <= n; i++)
    {
        if (ans[i] == 0)
        {
            res++;
        }
    }

    //rep(i,n) cout << ans[i+1] << endl;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4052
#include<iostream>
#include<cmath> // sqrt???pow????????????????????????
#include<cstdio>
using namespace std;
 

int main() {
	int n=0;
	double *s;

	while(1){
		cin >> n;
		s = new double[n];
		if( n== 0 ) break;

		double sum=0;
		for(int i=0; i<n; i++){
			cin >> s[i];
			sum += s[i];
		}

		double m = sum / n;
		double x=0;

		for(int i=0; i<n; i++){
			x += (s[i]-m) * (s[i]-m);
		}

		double a = sqrt(x/n);
		printf("%.8f\n",a);
	}

	return 0;
}

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

vector<long long> S;
vector<long long> A(1000), B(1000), C(1000);
int x,y,z,k;

int main(void){
    
    cin >> x >> y >> z >> k;
    for(int i = 0; i < x; i++) cin >> A[i];
    for(int i = 0; i < y; i++) cin >> B[i];
    for(int i = 0; i < z; i++) cin >> C[i];
    
    sort(A.begin(), A.end(),greater<long long>());
    sort(B.begin(), B.end(),greater<long long>());
    sort(C.begin(), C.end(),greater<long long>());
    for(int i = 0; i < x; i++){
        for(int j = 0; j < y; j++){
            for(int s = 0; s < z; s++){
                if((i+1)*(j+1)*(s+1) <= k) S.push_back(A[i]+B[j]+C[s]);
                else break;
            }
        }
    }
    
    sort(S.begin(), S.end(), greater<long long>());
    for(int i = 0; i < k; i++){
        cout << S[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


double nthRoot(int A, int N) 
{ 
    // intially guessing a random number between 
    // 0 and 9 
    double xPre = rand() % 10; 
  
    //  smaller eps, denotes more accuracy 
    double eps = 1e-3; 
  
    // initializing difference between two 
    // roots by INT_MAX 
    double delX = INT_MAX; 
  
    //  xK denotes current value of x 
    double xK; 
  
    //  loop untill we reach desired accuracy 
    while (delX > eps) 
    { 
        //  calculating current value from previous 
        // value by newton's method 
        xK = ((N - 1.0) * xPre + 
              (double)A/pow(xPre, N-1)) / (double)N; 
        delX = abs(xK - xPre); 
        xPre = xK; 
    } 
  
    return xK; 
} 

signed main() {
	int t=1;
	// cin>>t;
	while(t--){
		int n;
		cin>>n;
		int j = 1;
		for(int i = -300; i < 300; i++) {
	        for (int j = -300; j < 300; j++) {
	            double con = pow(i, 5) - pow(j, 5);
	            if(con == n){
	                cout << i << " " << j;
	                return 0;
	            }
	        }
	    }
		
	}
	
}

Measured memory_bytes: 4060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
using ll = long long;
const ll M = 1000000007;
const ll infi = 1000000000000000;
const ll md = 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> is;
ll power(ll x,ll y){
    if(y==0)
    return 1;
    ll res=power(x,y/2);
    res=(res*res)%M;
    if(y&(ll)1)
    res=(res*x)%M;
    return res;
}


/*int n,ma=0;
vector<vector<int>> gr;
vector<int> color;
void dfs(int c,int p)
{
    vector<int> v;
    int j;
    for(j=1;j<gr[c].size()+2;j++)
    {
        if(j==color[c]||j==color[p])
        continue;
        //cout<<j<<" ";
        v.pb(j);
    }
    //cout<<endl;
    j=0;
    for(int i=0;i<gr[c].size();i++)
    {
        if(gr[c][i]!=p)
        {
            color[gr[c][i]]=v[j];j++;
            dfs(gr[c][i],c);
        }
    }
}*/
void solve(){
    ll n,a,b;
    cin>>a>>b;
    for(ll i=1;i<=100000;i++)
    {
        if(floor(i*0.08)==a&&floor(i*0.1)==b)
        {
            cout<<i<<endl;
            return;
        }
    }
    cout<<-1<<endl;
}
 
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;

const int N = 123456;
ll a[N], b[N];

int main(void) {
  int n;
  ll k;
  cin >> n >> k;
  REP(i, 0, n) {
    cin >> a[i] >> b[i];
  }
  ll ma = 0;
  k += 1;
  while (k > 0) {
    ll kk = k - 1;
    ll tot = 0;
    REP(i, 0, n) {
      if ((a[i] & kk) == a[i]) {
	tot += b[i];
      }
    }
    ma = max(ma, tot);
    k &= k - 1;
  }
  cout << ma << endl;
}


Measured memory_bytes: 1920
<?php
list($a, $b, $c, $d) = ints();
if ($a + $b > $c + $d) exit('Left');
if ($a + $b === $c + $d) exit('Balanced');
echo 'Right';
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


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


int main(){
  int n,k;cin >> n >> k;
  double ans=0,p;
  for(int i=1; i<=n; i++){
    p = 1.0/n;
    if(i<k){
      int j = i;
      while(j<k){
        p /= 2;
        j *= 2;
      }
    }
    ans += p;
  }
  printf("%.15lf\n", ans);
}

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

using namespace std;
typedef long long ll;
typedef pair<int,ll>pa;

const int N=2e5+100;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

char s[N];
int main()
{
    int k;cin>>k;
    ll ans=1;
    ll tot=7;
    while(1){
        if(tot%k==0) break;
        ans++;
        tot=(tot*10+7)%k;
        if(ans==1e7) {
            cout<<-1;
            return 0;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3636
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a = int(input())
    b = int(input())
    h = int(input())
    print((a+b)*h//2)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Pavel Mavrin
 */
public class Main {

    private void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int k = nextInt();
        char[][] a = new char[n][];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        int sx = 0;
        int sy = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (a[i][j] == 'S') {
                    sx = i;
                    sy = j;
                }
            }
        }
        int[] qqx = new int[n * m];
        int[] qqy = new int[n * m];
        int[] qx = new int[n * m];
        int[] qy = new int[n * m];
        int[][] d = new int[n][m];
        for (int[] ints : d) {
            Arrays.fill(ints, -1);
        }
        d[sx][sy] = 0;
        qx[0] = sx;
        qy[0] = sy;
        int h = 0;
        int t = 1;
        int st = 0;
        int[] dx = new int[]{-1, 0, 0, 1};
        int[] dy = new int[]{0, -1, 1, 0};
        while (t > h || st > 0) {
            if (t == h || d[qx[h]][qy[h]] > k) {
                while (st > 0) {
                    qx[t] = qqx[st - 1];
                    qy[t] = qqy[st - 1];
                    st--;
                    t++;
                }
            }
            int x = qx[h];
            int y = qy[h];
            h++;
            if (x == 0 || y == 0 || x == n - 1 || y == m - 1) {
                out.println((d[x][y] + k - 1) / k);
                return;
            }
            for (int i = 0; i < 4; i++) {
                int xx = x + dx[i];
                int yy = y + dy[i];
                if (d[xx][yy] == -1) {
                    if (a[xx][yy] == '.' || d[x][y] >= k) {
                        qx[t] = xx;
                        qy[t] = yy;
                        t++;
                        d[xx][yy] = d[x][y] + 1;
                    } else {
                        qqx[st] = xx;
                        qqy[st] = yy;
                        st++;
                        d[xx][yy] = k + 1;
                    }
                }
            }
        }
    }

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

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        solve();
        out.close();
    }

}


Measured memory_bytes: 54836
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int X,N;
    cin >> X >> N;
    vector<int> p(N);
    for(int i = 0; i < N; i++) cin >> p[i];
    queue<int> Q;
    for(int i = 300; -300 < i; i--){
        bool flag = true;
        for(int j = 0; j < N; j++){
            if(p[j] == i){
                flag = false;
                break;
            }
        }
        if(flag == true) Q.push(i);
    }
    int q = Q.size();
    int k = 100000,j = -1;
    for(int i = 0; i < q; i++){
        int NQ = Q.front();
        Q.pop();
            if(abs(X-NQ) <= k){
                k = abs(X-NQ);
                j = NQ;
            }
    }
    cout << j << endl;
}

Measured memory_bytes: 3632
import scala.io.StdIn._

object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)

    val n = readInt
    val s = new Array[String](n)
    for (i <- 0 until n) {
      s(i) = readLine()
    }

    var mp = scala.collection.mutable.Map[String, Int]()
    for (i <- 0 until n) {
      if (mp.contains(s(i))) {
        mp(s(i)) += 1
      } else {
        mp.put(s(i), 1)
      }
    }
    val max = mp.values.max
    mp.filter { v => v._2 == max }.keys.toList.distinct.sorted

    val pw = new java.io.PrintWriter(System.out)
    for (str <- mp.filter { v => v._2 == max }.keys.toList.distinct.sorted) {
      pw.println(str)
    }
    pw.flush()

  }
}


Measured memory_bytes: 108344
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  while (true) {
    int n; cin >> n;
    if (!n) break;
    V<> xs, ys;
    V<> x(n), y(n);
    for (int i = 0; i < n; ++i) {
      cin >> x[i] >> y[i];
      xs.push_back(x[i]);
      ys.push_back(y[i]);
    }
    V<> a(4), b(4);
    for (int i = 0; i < 4; ++i) {
      cin >> a[i] >> b[i];
      xs.push_back(a[i]);
      ys.push_back(b[i]);
    }
    sort(begin(xs), end(xs));
    xs.erase(unique(begin(xs), end(xs)), end(xs));
    sort(begin(ys), end(ys));
    ys.erase(unique(begin(ys), end(ys)), end(ys));
    auto zipx = [&](int e) -> int { return lower_bound(begin(xs), end(xs), e) - begin(xs); };
    auto zipy = [&](int e) -> int { return lower_bound(begin(ys), end(ys), e) - begin(ys); };
    for (auto&& e : x) e = zipx(e);
    for (auto&& e : y) e = zipy(e);
    for (auto&& e : a) e = zipx(e);
    for (auto&& e : b) e = zipy(e);
    int w = xs.size() - 1, h = ys.size() - 1;
    VV<bool> e(w, V<bool>(h + 1));
    for (int i = 0; i < n; ++i) {
      int j = (i + 1) % n;
      if (y[i] != y[j]) continue;
      int xl = x[i], xr = x[j];
      if (xl > xr) swap(xl, xr);
      for (int t = xl; t < xr; ++t) e[t][y[i]] = true;
    }
    VV<bool> s(w, V<bool>(h));
    for (int xx = 0; xx < w; ++xx) for (int yy = 0; yy < h; ++yy) {
      int c = 0;
      for (int yyy = 0; yyy <= yy; ++yyy) c += e[xx][yyy];
      s[xx][yy] = c & 1;
    }
    int res = 0;
    int x0 = *min_element(begin(a), end(a)), x1 = *max_element(begin(a), end(a));
    int y0 = *min_element(begin(b), end(b)), y1 = *max_element(begin(b), end(b));
    for (int xx = 0; xx < w; ++xx) for (int yy = 0; yy < h; ++yy) if (s[xx][yy]) {
      if (x0 <= xx and xx < x1 and y0 <= yy and yy < y1) continue;
      res += (xs[xx + 1] - xs[xx]) * (ys[yy + 1] - ys[yy]);
    }
    cout << res << '\n';
  }
}


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

using namespace std;

typedef long long int ll;

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

typedef pair<int,int> pair;


int main(){
    int n; string s,t;
    cin >> n >> s >> t;

    string ans;

    for(int i=0;i<n;i++){
        ans+=s[i];
        ans+=t[i];
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

vector<int> to[200005];
ll ans[200005];
ll a[200005];
vector<ll> vec(200005);

pair<int, ll> dfs(int x, int i, int p = -1) {
    pair<int, ll> res;
    if (a[x]>vec[i])  {
        res.first = i+1;
        res.second = vec[i+1];
        vec[i+1] = a[x];
        i++;
    }
    else {
        auto it = lower_bound(vec.begin(), vec.begin()+i+1, a[x]); 
        int y = it - vec.begin();
        res.first = y;
        res.second = vec[y];
        vec[y] = a[x];
        
    }
    ans[x] = i+1;
    for (int e: to[x]) {
        if (e==p) continue;
        pair<int, ll> temp = dfs(e, i, x);
        vec[temp.first] = temp.second;
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        to[u].emplace_back(v);
        to[v].emplace_back(u);
    }
    
    vec[0] = 1E+18;
    pair<int, ll> p = dfs(0, 0);

    
    
    
    
    rep(i, n) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 33224
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
template<class T> inline bool chmin(T& a, T b){
  if (a > b){
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b){
  if (a < b){
    a = b;
    return true;
  }
  return false;
}

int main(){
  cout << fixed << setprecision(15);
  
  int a, b; cin >> a >> b;

  ll ans = 0;
  ans = a < 10 && b < 10 ? a * b : -1;
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main (void){

    int n, cnt = 0;

    cin >> n;

    int masu[n];

    for(int i = 0;i < n;i++){
        cin >> masu[i];

        if((i + 1) %  2 != 0 && masu[i] % 2 != 0)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
} 

Measured memory_bytes: 3616
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

using namespace std;

int main() {
 
	//数字
   long long int N;
   cin >> N;

   if(N%2==1){
      cout << 0 << endl;
   }else{
   long long int M;
   long long int S=0;
   
   for(int i=1;i<100;i++){
      M=2*(long long int)pow(5,i);
      if(M>N){break;}
      S+=N/M;
     // cout << i<<" "<<S << endl;
   }
   cout << S << endl;
   }
 //  cout <<N <<" = " << (int)N/((int)pow(5,M)) << "*5**"<< M << "+"<< N-((int)N/((int)pow(5,M))*(int)pow(5,M)) << endl;
 
}

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

#define INF (INT_MAX/2)


typedef struct {
  short v; // 接続先の番号
  int c; // 有向辺の重み
} edge;

typedef struct {
  int k; // 頂点の持つ有向辺の数
  edge* e; // 有向辺の配列
} vertex;



int* ssspForCost( vertex* g, int n ) {

  int i;
  int *dist, color[n];
  int minCost, u;

  dist = (int*)malloc( sizeof( int ) * n );

  //初期化
  for( i=0; i<n; i++ ) { 
    dist[i] = INF;
    color[i] = 0;
  }

  dist[0] = 0;

  while( 1 ) {

    minCost = INF;
    for( i=0; i<n; i++ ) {
      if( color[i] != 1 && dist[i] < minCost ) {
	minCost = dist[i];
	u = i;
      }
    }

    if( minCost == INF ) {
      break;
    }

    color[ u ] = 1;

    for( i=0; i<g[u].k; i++ ) {
      if( color[ g[u].e[i].v ] != 1 && dist[u] + g[u].e[i].c < dist[ g[u].e[i].v ] ) {
	dist[ g[u].e[i].v ] = dist[u] + g[u].e[i].c;
      }
    }

  }

  return dist;

}


void printDist( int* dist, int n ) {
  int i;

  for( i=0; i<n; i++ ) {
    printf( "%d %d\n", i, dist[i] );
  }

  return;

}


int main() {

  int i, j;
  int n, u; // n:頂点の数
  vertex* g;
  
  int* dist;

  scanf( "%d", &n );
  g = (vertex*)malloc( sizeof( vertex ) * n );

  for( i=0; i<n; i++ ) {
    scanf( "%d", &u );
    scanf( "%d", &g[u].k );
    g[u].e = (edge*)malloc( sizeof( edge ) * g[u].k );

    for( j=0; j<g[u].k; j++ ) {
      scanf( "%hd%d", &g[u].e[j].v, &g[u].e[j].c );
    }
  }

  dist = ssspForCost( g, n );

  printDist( dist, n );

  return 0;
}

Measured memory_bytes: 4528
#include<stdio.h>
#include<ctype.h>
int main(void){
	int x[1001],i,j;
	char a[1001];

	for(i=0;;i++){
		x[i]=0;
		scanf("%s%*c",a );
		if(a[0]=='0')break;
		for(j=0;a[j]!='\0';j++){
			x[i]=x[i]+(a[j]-'0');
		}

	}
	for(j=0;j<i;j++)
		printf("%d\n",x[j]);
	return 0;
}

Measured memory_bytes: 540
import java.util.Scanner;

public class Main {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();


        int count = 0;
        for(int i = 0; i <= c; i++) {
            if(i % a == 0 && i != 0) count += b;
        }
        System.out.println(count);

    }
}

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

int main() {
    int N, K, ans = 0, h;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> h;
        if (h >= K) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int n;
  cin >> n;
  cout << n / 2 - (n % 2 == 0);
}

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

typedef long long ll;

int main(){
    int N, W, w, v;
    cin >> N >> W >> w >> v;

    vector<vector<int>> value(4);
    value[0].push_back(v);

    int base = w;
    for(int i = 1; i < N; i++){
        cin >> w >> v;
        value[w-base].push_back(v);
    }
    for(int i = 0; i < 4; i++)  sort(value[i].rbegin(), value[i].rend());

    int ans = 0;
    for(int a = 0; a <= value[0].size(); a++){
        for(int b = 0; b <= value[1].size(); b++){
            for(int c = 0; c <= value[2].size(); c++){
                for(int d = 0; d <= value[3].size(); d++){
                    if((ll)base*(a + b + c + d) + b + 2*c + 3*d > W)   break;
                    int tmp = 0;
                    for(int x = 0; x < a; x++)  tmp += value[0][x];
                    for(int x = 0; x < b; x++)  tmp += value[1][x];
                    for(int x = 0; x < c; x++)  tmp += value[2][x];
                    for(int x = 0; x < d; x++)  tmp += value[3][x];
                    ans = max(ans, tmp);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
using namespace std;
void solve()
{
    string s;
    cin>>s;
    int ans = 0;
    int t = 0;
    for(auto a: s)
        if(a=='R')
        {
            ++t;
            ans=max(ans,t);
        }
        else
        {
            t=0;
        }
        
    cout<<ans<<endl;
}
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
        solve();
 
		
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
bool field[32][32];
const string dic="NESW";
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
int main(){
	while(true){
		int n;	cin>>n;
		if(n==0)	return 0;
		for(int i=0;i<32;i++)	for(int j=0;j<32;j++)	field[i][j]=false;
		for(int i=0;i<n;i++){
			int x,y;	cin>>x>>y;
			field[y][x]=true;
		}
		int m;	cin>>m;
		int cx=10,cy=10;
		for(int i=0;i<m;i++){
			char d;	int l;	cin>>d>>l;
			for(int j=0;j<4;j++){
				if(dic[j]==d){
					for(int k=0;k<l;k++){
						cx+=dx[j];
						cy+=dy[j];
						if(field[cy][cx]){
							n--;
							field[cy][cx]=false;
						}
					}
					break;
				}
			}
		}
		if(n==0)	cout<<"Yes"<<endl;
		else 	cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
const long double EPS=1e-9;
typedef pair<int,int> P;
struct UnionFind{
    vector<int> par;
    vector<int> dep;
    
    UnionFind(int siz){
        par.assign(siz,0);
        dep.assign(siz,0);
        for(int i=0;i<siz;i++){
            par[i]=i;
        }
    };

    int find(int x){
        if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
    }

    void unite(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y){
            return;
        }
        if(dep[x]<dep[y]){
            par[x]=y;
        }else{
            par[y]=x;
            if(dep[x]==dep[y]){
                dep[x]++;
            }
        }
    }

    bool same(int x,int y){
        return find(x)==find(y);
    }
};
int s[100010];
int main(){
    memset(s,-1,sizeof(s));
    int n,m,k;cin>>n>>m>>k;
    UnionFind uf(n+1);
    int ans=0;
    for(int i=1;i<=k;i++){
        int t,a,b;cin>>t>>a>>b;
        if(t==1){
            if(s[uf.find(a)]>0){
                int d=s[uf.find(a)];
                if(s[uf.find(b)]==-1){
                    uf.unite(a,b);
                    s[uf.find(a)]=d;
                }else if(s[uf.find(b)]==s[uf.find(a)]){
                    uf.unite(a,b);
                    s[uf.find(a)]=d;
                }else{
                    if(ans==0)ans=i;
                }
            }else{
                if(s[uf.find(b)]==-1){
                    uf.unite(a,b);
                    s[uf.find(a)]=-1;
                }else{
                    int d=s[uf.find(b)];
                    uf.unite(a,b);
                    s[uf.find(a)]=d;
                }
            }
        }else{
            if(s[uf.find(a)]>0){
                    if(s[uf.find(a)]!=b){
                        if(ans==0)ans=i;
                    }
                }else{
                    s[uf.find(a)]=b;
                }
        }
    }
    cout<<ans<<endl;
}   


Measured memory_bytes: 3860
#include <stdio.h>

int main()
{
    char s[4],n=0;
    scanf("%s", s);
    for(int i = 0; i < 4; i++){
        if(s[i] == '+'){
            n++;
        }else{
            n--;
        }
    }
    printf("%d\n", n);
    return 0;
}


Measured memory_bytes: 128
#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;

int main(){
    int N, M, X, Y;
    vector<int> x(100), y(100);
    cin >> N >> M >> X >> Y;
    rep(i, N) cin >> x[i];
    rep(i, M) cin >> y[i];

    sort(x.begin(), x.begin()+N);
    sort(y.begin(), y.begin()+M);

    if(max(X,x[N-1]) < min(Y,y[0])){
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }

}

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

int n, m, q;
const int N = 100;
struct node{
    int a, b, c,d;
}p[N];

int cnt[20];
int maxn;

void dfs(int dep, int value){
    if(dep == n){
        int sum = 0;
        for(int i = 1; i <= q; i++){
            if(cnt[p[i].b] - cnt[p[i].a] == p[i].c){
                sum += p[i].d;
            }
        }
        maxn = max(maxn, sum);
        return;
    }

    for(int i = value; i <= m; i++){
        cnt[dep + 1] = i;
        dfs(dep + 1, i);

    }
}

int main(){
    cin >> n >> m >> q;
    for(int i = 1; i <= q; i++){
        cin >> p[i].a >> p[i].b >> p[i].c >> p[i].d;
    }
    dfs(0, 1);
    printf("%d\n", maxn);
  





}

Measured memory_bytes: 3716
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <map>
#include <set>
#include <bitset>
#include <vector>
#include <complex>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;
const int maxn = 2e5 + 5;
long long x[maxn];
long long q1[maxn], q2[maxn];
int main()
{
	std::ios::sync_with_stdio(false);
	int l, n;
	cin >> l >> n;
	for(int i = 1; i <= n; i ++)
		cin >> x[i];
	for(int i = 1; i <= n; i ++)
		q1[i] = q1[i - 1] + x[i];
	for(int i = n; i >= 1; i --)
		q2[i] = q2[i + 1] + l - x[i];
	long long ans = 0;
	for(int i = 0; i <= n; i ++)
	{
		if(i == n - i)
			ans = max(ans, max(q1[i] * 2 - x[i] + q2[i + 1] * 2, q1[i] * 2 + q2[i + 1] * 2 - (l - x[i + 1])));
		else if(i > n - i)
			ans = max(ans, max((q1[i] - q1[2 * i - n - 1]) * 2 - x[i] + q2[i + 1] * 2, (q1[i] - q1[2 * i - n]) * 2 + q2[i + 1] * 2 - (l - x[i + 1])));
		else
			ans = max(ans, max(q1[i] * 2 + (q2[i + 1] - q2[2 * i + 2]) * 2 - (l - x[i + 1]), q1[i] * 2 - x[i] + (q2[i + 1] - q2[2 * i + 1]) * 2));
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<string> u(3);
  for(int i = 0; i < 3; i++) cin >> u[i];
  int ans = 0;
  for(int i = 0; i < n; i++){
    map<char, int> g;
    for(int j = 0; j < 3; j++) g[u[j][i]]++;
    int mx = 0;
    for(auto it : g) mx = max(mx, it.second);
    ans += 3 - mx;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
    const int p = 10;
   const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
    const int p = 179;
   const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")`

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int r;
    cin >> r;
    cout << fixed << setprecision(10) << PI * (ld)r * 2.0;
}
/*

*/


Measured memory_bytes: 3796
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
double pi = 3.14159265358979323846264338;
const int MOD = 1000000007;
string arr[27] = { "z","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" };
string ans;
int cnt;
void dfs(int k) {
	if (k <= 26) { cnt--; ans = arr[k] + ans; return; }
	int re = k % 26;
	if (re == 0) {
		ans = "z" + ans;
		cnt--;
		dfs(k / 26);
		return;
	}
	ans = arr[re] + ans;
	cnt--;
	dfs((k - re) / 26 + 1);
	return;
}
int main() {

	int h, w, k;
	cin >> h >> w >> k;
	string arr[7];
	for (int i = 1; i <= h; i++) {
		cin >> arr[i];
		arr[i] = " " + arr[i];
		//cout<<arr[i]<<endl;
	}
	int s = 1;
	int cnt = 0;
	for (int i = 0; i < h + w; i++)s = s * 2;
	for (int i = 0; i < s; i++) {
		int cur = 0;
		for (int x = 1; x <= h; x++)for (int y = 1; y <= w; y++) {
			if (arr[x][y] == '.')continue;
			if ((i & (1 << (x - 1))) > 0 || (i & (1 << (h + y - 1))) > 0) continue;
			cur++;
		}
		if (cur == k) {
			//cout << i << endl;
			cnt++;
		}

	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

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

    int max = 1;
    for(int i=2;i<=sqrt(x);i++){
        for(int j=2; j<10; j++){
            //cout << "#:" <<i << " " << j  << endl;
            int p = pow(i,j);
//cout << "#:" <<p  << endl;
            if(p<=x ){
                if(max < p){
                        //cout << "#" <<p  << endl;
                    max = p;
                }
            } else{
                break;
            }
        }
    }
    cout << max  << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
ll sieve[1000001]={0},i,j;
ll m=1e9+7;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
using namespace std;
  ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
  
            else 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
	ll n,k;
	cin>>n>>k;
	vector<ll> dp(k+1);
	dp[0]=1;
	for(ll  child=0;child<n;child++)
	{
		ll up_to;
		cin>>up_to;
		vector<ll> fake(k+1);
		for(ll used=k;used>=0;--used)
		{
			ll temp=dp[used];
			ll L=used+1;
			ll R=used+ min(up_to,k-used);
			if(L<=R)
			{
				fake[L]+=temp;
				fake[L]%=m;
				if(R+1<=k)
				{
					fake[R+1]-=temp;
					if(fake[R+1]<0)
					fake[R+1]+=m;
				}
			}
		
		}
		ll prefix_sum=0;
		for(i=0;i<=k;i++)
		{
			prefix_sum+=fake[i];
			prefix_sum%=m;
			dp[i]+=prefix_sum;
			dp[i]%=m;
		}
	}
	cout<<dp[k];
	cout<<"\n"; 
 } 
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
string S;

void solve() {
    cin >> N >> S;
    S.erase(unique(S.begin(), S.end()), S.end());
    cout << S.size() << endl;
    return;
}

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


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

int main() {
  int N; 
  cin >> N;
  bool go = false;
  for (int i = 0; i < N; i++){
    string S;
    cin >> S;
    if (S == "Y"){
      go = true;
      break;
    }
  }
  if (go){
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  ll N; cin>>N;
  ll K; cin>>K;
  char S[N+10];
  rep(i,N+2){
    if(i==0) S[i]='R';
    else if(i==N+1) S[i]='L';
    else cin>>S[i];
  }
  
  ll count1=0;
  rep(i,N+1){
    if(S[i]=='R'&&S[i+1]=='L') count1++;
  }
  ll count2=0;
  if(S[1]=='L') {
    count1--;
    count2++;
  }
  if(S[N]=='R') {
    count1--;
    count2++;
  }
  
  ll peaple=N-count1*2-count2;
  ll ans=0;
  
  rep(i,K){
    if(count1>1){
      ans+=2;
      count1--;
      continue;
    }
    if(count1==1&&count2==0){
      ans++;
      break;
    }
    if(count1==1&&count2==1){
      ans+=2;
      break;
    }
    if(count1==1&&count2==2){
      ans+=2;
      count1--;
      continue;
    }
    if(count1==0&&count2==1) break;
    if(count1==0&&count2==2) {
      ans++;
      break;
    }
  }
  
  ll anst=peaple+ans;
  cout<<anst<<endl;
}
  
  
  
    
    
  
  

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define INF 100000000
#define rep(i,a,b) for(int (i)=a;(i)<(int)(b);(i)++)

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    X -=1;
    Y -=1;
    vector<vector<int>> vec(N,vector<int>(N,0));
    vector<int> ans(N-1,0);
    for(int i=0;i<=X-1;i++){
        for(int j=i+1;j<=X;j++){
            vec[i][j] = j-i;
        }
    }

    for(int i=0;i<=X;i++){
        for(int j=i+1;j<=Y;j++){
            int tmp1 = j-X;
            int tmp2 = 1+Y-j;
            vec[i][j] = min(tmp1,tmp2) + vec[i][X];
        }
    }

    for(int i=X;i<Y;i++){
        for(int j=i+1;j<=Y;j++){
            int tmp1 = j-i;
            int tmp2 = i-X+1+Y-j;
            vec[i][j] = min(tmp1,tmp2);
        }
    }

    if(Y != N-1){
        for(int i=0;i<=Y;i++){
            for(int j=Y+1;j<N;j++){
                vec[i][j] = vec[i][j-1]+1;
            }
        }
    }
    if(Y != N-1){
        for(int i=Y+1;i<=N-2;i++){
            for(int j=i+1;j<N;j++){
                vec[i][j] = j-i;
            }
        }
    }

    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            ans[vec[i][j]-1] += 1;
        }
    }
    for(auto x:ans) cout << x << endl;
}

Measured memory_bytes: 16000
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  ULL x;
  cin >> x;
  ULL m = 100;
  int ans = 0;
  while(x > m) {
    m += m / 100;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;

int dp[60][2];

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

  int n,k;
  cin>>n>>k;
  int a[n];
  rep(i,n) cin>>a[i];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  int mx = 50;
  FOR(i, 1, mx + 1) {
    int mask = 1LL << (mx - i);
    int cnt0 = 0;int cnt1 = 0;
    rep(j,n) {
      if(a[j] & mask) cnt1++;
      else cnt0++;
    }
    if(dp[i-1][1] != -1) {
      dp[i][1] = dp[i-1][1] + mask * max(cnt0, cnt1);
    }
    if(mask & k) {
      dp[i][1] = max(dp[i][1], dp[i-1][0] + mask * cnt1);
      dp[i][0] = dp[i-1][0] + mask * cnt0;
    } else {
      dp[i][0] = dp[i-1][0] + mask * cnt1;
    }
  }
  cout << max(dp[mx][0],dp[mx][1]) << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define maxn 300005
#define LL long long
using namespace std;
int n,m,a[maxn],b[maxn];
LL s[maxn];
bool check(LL x,int k){
	int p=lower_bound(b+1,b+1+m,x)-b;
	return s[p-1]+(m-p+1)*x>=x*k;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)
		if(a[i]!=a[i-1]) b[++m]=1;
		else b[m]++;
	sort(b+1,b+1+m);
	for(int i=1;i<=m;i++) s[i]=s[i-1]+b[i];
	for(int k=1;k<=n;k++){
		LL l=0,r=s[m]/k,mid;
		while(l<r){
			mid=(l+r+1)>>1;
			if(check(mid,k)) l=mid;
			else r=mid-1;
		}
		printf("%lld\n",l);
	}
}

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

int main(){
    int k,a,b,flag=0;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            flag=1;
            break;
        }
    }
    if(flag==1){
        cout<<"OK"<<endl;
    }
    else{
        cout<<"NG"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3592
# include <iostream>
using namespace std;
int n,m,x,y,z;
void work (void)
{
	if (x<=z-2||x==z-1&&y>=1)
	cout<<"No";
else cout<<"Yes";
}
int main (void)
{
	int i;
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>m;
		if (m%4==0)
		x++;
   else if (m%2==0)
        y++;
   else z++;
	}
	work ();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jul 11 21:02:00 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    Int ans = 0;
    REP(i, n) {
        Int x;
        std::cin >> x;
        ans += i % 2 == 0 && x % 2;
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3648
def examC():
    N, x  = LI()
    A = LI()
    ans = 0
    cur = A[0]
    if A[0]>x:
        ans += A[0]-x
        cur = x
    for i in range(1,N):
        if cur+A[i]<=x:
            cur = A[i]
            continue
        ans += cur+A[i]-x
        cur = A[i]-(cur+A[i]-x)
    print(ans)
    return

def examD():
    S = SI()
    return

def dijkstra(edge_adj, node, start):
    # graph[node] = [(cost, to)]
    dist = [inf] * node
    used = [False] * node
    dist[start] = 0
    while True:
        v = -1
        for i in range(node):
            if not used[i] and (v == -1 or dist[v] > dist[i]):
                v = i
        if v == -1:
            break
        used[v] = True
        for i in range(node):
            if dist[i] > dist[v] + edge_adj[v][i]:
                dist[i] = dist[v] + edge_adj[v][i]

    return dist
def examE():
    xs,ys,xg,yg = LI()
    N = I()
    XYR = [[]for _ in range(N)]
    for i in range(N):
        XYR[i] = LI()
    XYR.append([xs,ys,0])
    XYR.append([xg,yg,0])
    V = [[0]*(N+2) for _ in range(N+2)]
    for i in range(N+2):
        for j in range(i+1,N+2):
            s = XYR[i]; t = XYR[j]
            cur = ((s[0]-t[0])**2 + (s[1]-t[1])**2)**0.5 - (s[2]+t[2])
            V[i][j] = max(0,cur)
            V[j][i] = max(0,cur)
    D = dijkstra(V,N+2,N)
#    print(D)
    ans = D[-1]
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examE()


Measured memory_bytes: 81904
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<" : "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
template<class Type> void line(const Type &a){int cnt=0;for(auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int n;
vvi tree;
map<pii,int> ans;
int num_color=0;
int max_color=0;

void f(int leaf,int color){
	int tmp0=1;
	REP(i,tree[leaf].size()){
		int tmp1=leaf;
		int tmp2=tree[leaf][i];
		bool jud=false;
		if(tmp1>tmp2){
			swap(tmp1,tmp2);
			jud=true;
		}
		if(ans[pii(tmp1,tmp2)]==0){
			if(tmp0==color) tmp0++;
			if(tmp0>max_color){
				num_color++;
				max_color=tmp0;
			}
			ans[pii(tmp1,tmp2)]=tmp0;	
			if(jud) f(tmp1,tmp0);
			else f(tmp2,tmp0);
			tmp0++;
		}
	}
}

int main(){
	int n;
	cin>>n;
	
	tree.resize(n);
	vi a(n-1),b(n-1);
	REP(i,n-1){
		cin>>a[i]>>b[i];
		a[i]--, b[i]--;
		tree[a[i]].push_back(b[i]);
		tree[b[i]].push_back(a[i]);
	}
	
	f(a[0],0);
	
	cout<<num_color<<endl;
	REP(i,n-1) cout<<ans[pii(a[i],b[i])]<<endl;
}


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

string s;
size_t w;
bool i;

int main(){
    cin >> s;
    w = 0;
    i = true;

    for (auto p = s.begin(); p != s.end(); ++p, i=!i){
        if (*p == '0' && i) w++;
        if (*p == '1' && !i) w++;
    }
    cout << min(w, s.length()-w);
}

Measured memory_bytes: 512