akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define hell                         1000000007
#define M                            1000000007
#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
 
#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first  
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'
 //const ll infl=0x3f3f3f3f3f3f3f3fLL;

 #define pi                           3.141592653589793238
// Debug //
 
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;
//ll a[200005];



int main()
{

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

    ll n;
    string s;
    cin>>n>>s;

    string t="";
    t+=s[0];
    for(ll i=1;i<n;i++)
    {
        if(s[i]==s[i-1])
            continue;
        else
            t+=s[i];
    }

    ll x=t.size();
    cout<<x<<endl;

}

Measured memory_bytes: 3728
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[,] temp = new int[10, 10];
        for (int i = 1; i <= N; i++)
        {
            int left = (int)(i / Math.Pow(10, (int)Math.Log10(i)));
            int right = (int)(i % 10);
            if (left != 0 && right != 0)
            {
                temp[left, right]++;
            }
        }
        int ans = 0;
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                ans+=temp[i, j] * temp[j, i];
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
package main

import "fmt"

func main(){
  var N,K int
  fmt.Scan(&N,&K)
  //K以上のbに対して、あまりがK以上になるaがいくつあるか
  //c := N/b cb <= N < (c+1)b
  //c(b-K) + (N-cb)-K if N-cb >= K else 0
  result := 0
  for b := K+1; b<=N; b++{
    c := N/b
    d := 0

    if (N - c*b) >= K && K==0{
      d = (N- c*b) - K
    }else if (N - c*b) >= K{
      d = (N- c*b) -K +1
    }else{
      d = 0
    }
    // fmt.Println(b,c,d, c*(b-K) + d)
    result += c*(b-K) + d
  }
  fmt.Println(result)
}


Measured memory_bytes: 512
import sys
from collections import Counter

input = sys.stdin.readline


def main():
    w = input().rstrip()

    c = Counter(w)
    ans = "Yes"
    for v in c.values():
        if v % 2 != 0:
            ans = "No"

    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment

const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
}

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

vector<P> convex_cut(vector<P> G, L l){
  vector<P> res;
  for(int i=0;i<G.size();i++){
    P A = G[i];
    P B = G[(i+1)%G.size()];
    if(ccw(l.first, l.second, A) != -1) res.push_back(A);
    if(ccw(l.first, l.second, A) * ccw(l.first, l.second, B) < 0)
      res.push_back(crossPoint(L(A,B), l));
  }
  return res;
}

bool check(vector<P> G,double d){
  vector<P> pol=G;
  int n=G.size();
  for(int i=0;i<n;i++){
    P a=G[i],b=G[(i+1)%n],c=(b-a);
    b=P(abs(c),d)*(c/abs(c))+a;
    a=b-c;
    pol=convex_cut(pol,L(a,b));
    if(pol.size()<3)return 0;
  }
  return  1;
}


int main(){
  int n;
  while(cin>>n,n){
    vector<P> pol(n);
    for(int i=0,x,y;i<n;i++){
      cin>>x>>y;
      pol[i]=P(x,y);
    }
    double L=0,M,R=1e4;
    while(L<R){
      M=(L+R)/2;
      if(!check(pol,M)) R=M-EPS;
      else L=M+EPS;
    }
    printf("%lf\n",L);
  }
  return 0;
}

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

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


Measured memory_bytes: 3612
#include <stdio.h>

int main(void) {
  int n, i; //n = ゲームを行う回数
  scanf("%d", &n);
  int k[n], p[n], res[n]; //k = 石の数, p = 人数, res =　勝者
  for (i = 0; i < n; i++) {
    scanf("%d%d", &k[i], &p[i]);
    res[i] = k[i] % p[i];
    if (res[i] == 0) {
      res[i] = p[i];
    }
  }
  for (i = 0; i < n; i++) {
    printf("%d\n", res[i]);
  }
  return 0;
}



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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

double f(double x1, double y1, double x2, double y2) {
  return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

signed main() {
  ll N;
  cin>>N;
  vector<PLL> z(N);
  rep(i,N)
    cin >> z[i].first >> z[i].second;
  vector<ll> v;
  rep(i,N)
    v.push_back(i);

  double ans = 0.0;
  ll t = 0;
  do {
    rep(i, N-1) {
      ans += f(z[v[i]].first, z[v[i]].second, z[v[i+1]].first, z[v[i+1]].second);
    }
    t++;
  } while (next_permutation(v.begin(), v.end()));
  printf("%.11f\n", ans/t);
}


Measured memory_bytes: 256
N, M=map(int, input().split())
g = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = [int(x) for x in input().split()]
    g[a].append(b)
    g[b].append(a)


from collections import deque

queue=deque([1])
d=[None]*(N+1)
d[1]=0
ans=[0]*(N+1)
while queue:
    v=queue.popleft()
    for i in g[v]:
        if d[i] is None:
            d[i]=d[v]+1
            ans[i]=v
            queue.append(i)

            
print("Yes")
for i in range(2,len(ans)):
    print(ans[i])

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

int main(){
  bool cards[4][14];
  int n, rank;
  char suit;
    
  for ( int s = 0; s < 4; s++ )
   for ( int r = 1; r <= 13; r++ )
    cards[s][r] = 0;
      
  cin >> n;
  for ( int i = 0; i < n; i++ ){
   cin >> suit >> rank;
   if ( suit == 'S' ) cards[0][rank] = 1;
   if ( suit == 'H' ) cards[1][rank] = 1; 
   if ( suit == 'C' ) cards[2][rank] = 1; 
   if ( suit == 'D' ) cards[3][rank] = 1; 
  }
    
  for ( int s = 0; s < 4; s++ ){
   for ( int r = 1; r <= 13; r++ ){
    if ( cards[s][r] ) continue;
    if ( s == 0 ) suit = 'S';
    if ( s == 1 ) suit = 'H';
    if ( s == 2 ) suit = 'C';
    if ( s == 3 ) suit = 'D';
    cout << suit << " " << r << endl;
   }
  }
    
    return 0;
}

Measured memory_bytes: 1160
N=io.read("n")
A=io.read("n")
B=io.read("n")
function d(a)
  local s=0
  while (a>0) do
    s=s+a%10
    a=a//10
  end
  return s
end
local total=0
for i=1,N do
  if d(i)>=A and d(i)<=B then
    total=total+i
  end
end
print(total)

Measured memory_bytes: 760
var i,n,sum:longint;
a:array[0..100000]of longint;
procedure sort(l,r:longint);
var i,j,x,y:longint;begin i:=l;j:=r;x:=a[(l+r) div 2];
repeat while a[i]<x do inc(i);while x<a[j] do dec(j);if not(i>j) then
begin y:=a[i];a[i]:=a[j];a[j]:=y;inc(i);dec(j);end;until i>j;
if l<j then sort(l,j);if i<r then sort(i,r);end;
begin
readln(n);
for i:=1to n do read(a[i]);
sort(1,n);
i:=n;
while(i>0)do
  begin
  sum:=sum+(a[i]-a[i-1]);dec(i,2);
  end;
writeln(sum);
end.

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

int main(){
  char a;
  cin>>a;
  if(a=='A')
    cout<<'T'<<endl;
  if(a=='T')
    cout<<'A'<<endl;
  if(a=='G')
    cout<<'C'<<endl;
  if(a=='C')
    cout<<'G'<<endl;
  return 0;
}

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

pub 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")
}

fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = vec![];
    for _ in 0..n {
        a.push(read());
    }

    let maxv: i64 = *a.iter().max().unwrap();
    let sum: i64 = a.iter().sum();
    println!("{}", sum - (maxv / 2));
}


Measured memory_bytes: 4352
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        while (true)
        {
            short[] l = Console.ReadLine().Split(' ').Select(short.Parse).ToArray();
            short c = 0, n = l[0], x = l[1];

            if (l[0] + l[1] == 0) break;

            for (byte i = 1; i <= n; i++)
                for (byte j = (byte)(i + 1); j <= n; j++)
                    for (byte k = (byte)(j + 1); k <= n; k++)
                        if (i + j + k == x)
                            c++;

            Console.WriteLine(c);
        }
    }
}

Measured memory_bytes: 9448
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N, M;
	while (cin >> N >> M, N) {
		vector<int> mx(N), mn(N);
		for (int i = 0; i < M; ++i) {
			int s, l, x;
			cin >> s >> l;
			for (int j = 0; j < l; ++j) {
				cin >> x; --x;
				mx[x] += s;
				if (l == 1) mn[x] += s;
			}
		}
		vector<int> lmx(N + 1), rmx(N + 1);
		for (int i = 0; i < N; ++i) lmx[i + 1] = max(lmx[i], mx[i]);
		for (int i = N - 1; i >= 0; --i) rmx[i] = max(rmx[i + 1], mx[i]);
		int ans = 0;
		for (int i = 0; i < N; ++i) {
			ans = max(ans, max(lmx[i], rmx[i + 1]) - mn[i]);
		}
		cout << ans + 1 << '\n';
	}
	return 0;
}


Measured memory_bytes: 3260
#include<iostream>

using namespace std;

int main(void){
	while(1){
		int n;
		int x[3],y[3],z[3],w[3];
		scanf("%d",&n);
		if(n==0)break;
		for(int a=0;a<n;a++){
			scanf("%d%d%d%d%d%d%d%d",&x[0],&y[0],&z[0],&w[0],&x[1],&y[1],&z[1],&w[1]);
			x[2]=x[0]*x[1]-y[0]*y[1]-z[0]*z[1]-w[0]*w[1];
			y[2]=x[0]*y[1]+x[1]*y[0]+z[0]*w[1]-z[1]*w[0];
			z[2]=x[0]*z[1]+x[1]*z[0]+w[0]*y[1]-w[1]*y[0];
			w[2]=x[0]*w[1]+x[1]*w[0]+y[0]*z[1]-y[1]*z[0];
			printf("%d %d %d %d\n",x[2],y[2],z[2],w[2]);
		}
	}
    return 0;
}

Measured memory_bytes: 0
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

// ll N = 99909;

bool Q(ll n){
	cout<<"? "<<n<<endl;
	char c;
	cin>>c;
	// string a,b;
	// convert(n, a);
	// convert(N, b);
	// bool ret = false;

	// if(n <= N && a <= b) ret = true;
	// if(n > N  && a > b) ret = true;
	// cout<<(ret?"Y":"N")<<endl;
	// return ret;
	return (c=='Y'?true:false);
}

void ANS(ll n){
	cout<<"! "<<n<<endl;
}

void mainmain(){
	if(Q(1000000000000)){
		ll t = 110000000;
		ll ans = 1000000000;
		while(t >= 11){
			if(!Q(t)){
				ANS(ans);
				return;
			}
			t /= 10;
			ans /= 10;
		}
		if(Q(2)){
			return ANS(1);
		}
		else{
			return ANS(10);
		}
	}
	else{
		ll t = 10;
		int keta = 1;
		while(1){
			if(!Q(t)){
				break;
			}
			t *= 10;
			keta++;
		}
		ll l = t/10;
		ll r = t-1;
		while(r-l>1){
			// cout<<l<<" "<<r<<endl;
			ll mid = (r+l)/2;
			if(Q(mid*10)) r = mid;
			else l = mid; 
		}
		return ANS(r);
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N; cin >> N;
  int P[10], Q[10];
  for (int i = 0; i < N; ++i) cin >> P[i];
  for (int i = 0; i < N; ++i) cin >> Q[i];
  
  int p = 0,q = 0;
  int R[10];
  
  for (int i = 1; i <= N; ++i) R[i-1] = i;
  int c = 1;
  do { 
    bool ok = true;
    for (int i = 0; i < N; ++i) {
      if (P[i] != R[i]) {
        ok = false;
      }
    }
    if (ok) break;
    else c++;
  } while (std::next_permutation(R, R + N));
  p = c;
  
  for (int i = 1; i <= N; ++i) R[i-1] = i;
  c = 1;
  do { 
    bool ok = true;
    for (int i = 0; i < N; ++i) {
      if (Q[i] != R[i]) {
        ok = false;
      }
    }
    if (ok) break;
    else c++;
  } while (std::next_permutation(R, R + N));
  q = c;
  
  cout << abs(p - q) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,y;
  cin>>x>>y;
  int b;
  bool flag=false;
  for(int i=0;i<=x;i++)
  {
    b=x-i;
    if((2*i+4*b)==y)
    {
      flag=true;
      break;
      
    }
    
    
  }
  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
 
  
  
}

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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
pair < int, int > a[N];

int main () {
	SpeedForce;

	cin >> n >> m;
	for (int i = 1; i <= n; i ++)
		cin >> a[i].F >> a[i].S;

	sort(a + 1, a + n + 1);
	ll ans = 0;
	For (i, 1, n) {
		m -= a[i].S;
		ans += a[i].F * (ll)a[i].S;
	//	cout << ans << ' ' << a[i].F << ' ' << a[i].S << ' ' << m << '\n';
	
		if (m < 0) {
			ans += a[i].F * (ll)m;
			break;
		}
	}
	 
	cout << ans << '\n';

	return Accepted;
}

// B...a

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/


int main(){
    string s; cin >> s;
    int ans = 0;
    int n = s.size();
    bool flag = false;
    rep(i, n){
        if(!(flag) and s[i] == s[i + 1]){
            flag = true;
            i++;
        }else if((flag) and s[i] == s[i + 1]){
            flag = false;
        }else if((flag) and s[i] != s[i + 1]){
            flag = false;
        }
        ans++;
    }
    cout << ans << endl;
}

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

template
<
    typename TYPE,
    std::size_t SIZE
>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;

#define REP(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))



int main()
{
    int a,b;
    cin >> a >>  b;
    if(max(a,b) < 9){
        cout << "Yay!" << endl;
    }
    else{
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int r;
  cin >> r;
  P(r * r * 3);


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int U[2003][2003];

int main() {
    ll A[3];
    rep(i,3){
        cin >> A[i];
    }
    sort(A,A+3);
    cout << A[0]+A[1]+10*A[2] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int H,W,i,j,x;
	scanf("%d %d",&H,&W);
	char a[H][W];
	int gyou[H],retu[W];
	
	for(i=0;i<H;i++){
		scanf("%s",a[i]);
		gyou[i]=1;
	}
	
	for(j=0;j<W;j++) retu[j]=1;
	
	for(i=0;i<H;i++){
		x=0;
		for(j=0;j<W;j++){
			if(a[i][j]=='.') x++;
		}
		if(x==W) gyou[i]=0;
	}
	
	for(j=0;j<W;j++){
		x=0;
		for(i=0;i<H;i++){
			if(a[i][j]=='.') x++;
		}
		if(x==H) retu[j]=0;
	}
	
	for(i=0;i<H;i++){
		if(gyou[i]==1) puts("");
		for(j=0;j<W;j++){
			if(gyou[i]*retu[j]==1) printf("%c",a[i][j]);
		}
	}
	
}

Measured memory_bytes: 128
/**
 *   created: 09 January 2019  20:00:37
**/
#include<bits/stdc++.h>
using namespace std;

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

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007

void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
	optimizeIO();
	int n,a,b;
	cin>>n>>a>>b;
	vi p(n);
	F(i,0,n-1)
	cin>>p[i];
	sort(p.begin(),p.end());
	int q1=0,q2=0,q3=0;
	// q1 = upper_bound(p.begin(), p.end(), a+1) - p.begin() - 1;
	// q2 = upper_bound(p.begin(), p.end(), b+1) - p.begin() - q1;
	// q3 = n - q1 - q2;
	// cout<<q1<<" "<<q2<<" "<<q3<<endl;
	F(i,0,n-1)
	{
		if(p[i]<=a)
			q1++;
		else if(p[i]<=b)
			q2++;
		else
			q3++;
	}
	cout<<min(min(q1,q2),q3);
	return 0;
}


Measured memory_bytes: 256
<?php
function gcd($m,$n){
    if($n==0)
        echo $m."\n";
    else{
        $a = $m%$n;
        $m = $n;
        $n = $a;
        gcd($m,$n);
    }
}

while(1){
    fscanf(STDIN,"%d %d\n",$a,$b);
    if($a=="" || $b=="")
        break;

    if($a > $b){
        $m = $a;
        $n = $b;
    }
    else{
        $m = $b;
        $n = $a;
    }    
    gcd($m,$n);
    $a = "";
    $b = "";
}
?>

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

int n,q;
int a[27][1000001];
char s[1500001];

int lowbit(int n)
{
	return n&(-n);
}

int get(char x)
{
	return x-'a'+1;
}

void change(int num,int rt,int plus)
{
	while(rt<=n)
	{
		a[num][rt]+=plus;
		rt+=lowbit(rt);
	}
}

int get_sum(int num,int r)
{
	int sum=0;
	while(r>=1)
	{
		sum+=a[num][r];
		r-=lowbit(r);
	}
	return sum;
}

signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
		change(get(s[i]),i,1);
	}
	cin>>q;
	
	for(int i=1;i<=q;i++)
	{
		int f,t1,t2;
		cin>>f;
		
		if(f==1)
		{
			char x;
			cin>>t1>>x;
			change(get(x),t1,1);
			change(get(s[t1]),t1,-1);
			s[t1]=x;
		}
		else
		{
			int t=0;
			cin>>t1>>t2;
			for (int i=1;i<=26;i++)
				if(get_sum(i,t2)-get_sum(i,t1-1))
					t++;
			
			cout<<t<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 154368
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to; int cost; };
int s[200005], t[200005], x[200005], d[200005];
PP p[200005];
int ans[200005];
vector<int> node, lazy;
vector<bool> lazyF;
int n = 1;
class RUQ {
public:
	
	void init(int N) {
		while (n < N)n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1);
		lazyF.resize(2 * n - 1, false);
	}
	void lazy_evaluate(int k, int l, int r) {
		if (lazyF[k] == false)return;
		node[k] = lazy[k];
		if (k < n - 1) {
			for (int i = 1; i <= 2; i++) { lazy[2 * k + i] = lazy[k]; }
			for (int i = 1; i <= 2; i++) { lazyF[2 * k + i] = true; }
		}
		lazyF[k] = false;
	}
	void update(int a, int b, int x, int k, int l, int r) {
		lazy_evaluate(k, l, r);
		if (r <= a || b <= l)return;
		if (a <= l && r <= b) {
			lazy[k] = x; lazyF[k] = true;
			lazy_evaluate(k, l, r);
			return;
		}
		update(a, b, x, k * 2 + 1, l, (l + r) / 2);
		update(a, b, x, k * 2 + 2, (l + r) / 2, r);
		node[k] = max(node[k * 2 + 1], node[k * 2 + 2]);
	}
	int calc(int a, int b, int k, int l, int r) {
		lazy_evaluate(k, l, r);
		if (r <= a || b <= l)return -inf;
		if (a <= l && r <= b)return node[k];
		int vl = calc(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = calc(a, b, k * 2 + 2, (l + r) / 2, r);
		return  max(vl, vr);
	}
	void replace(int a, int b, int x) { update(a, b, x, 0, 0, n); }
	int get_max(int a, int b) { return calc(a, b, 0, 0, n); }
};
signed main() {
	int N, q; cin >> N >> q;
	rep(i, N)cin >> s[i] >> t[i] >> x[i];
	rep(i, q)cin >> d[i];

	rep(i, N) {
		p[i] = PP(x[i],P(s[i],t[i]));
	}
	sort(p, p + N);
	rep(i, N) {
		s[i] = p[i].second.first;
		t[i] = p[i].second.second;
		x[i] = p[i].first;
	}

	RUQ seg;
	seg.init(q);
	for(int i=N-1;i>=0;i--) {
	//[s-x,t-x)
		int lb = lower_bound(d, d + q, s[i] - x[i])-d;
		int rb = lower_bound(d, d + q, t[i] - x[i]) - d - 1;
		//cout << lb << ' ' << rb << endl;
		seg.update(lb, rb+1, x[i], 0, 0, n);
	}
	rep(i, q) {
		int a = seg.get_max(i, i + 1);
		if (a == 0)cout << -1 << endl;
		else cout << a<<endl;
	}
}

Measured memory_bytes: 21120
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
Vi accum(Vi v){Vi ret((v).size());ret[0]=v[0];REP(i,1,(v).size()) ret[i]=ret[i-1]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
    int n;
    cin>>n;
    Vi a(n),b(n),c(n);
    REP(i,0,n) cin>>a[i]>>b[i]>>c[i];

    VVi dp(n,Vi(3));
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    REP(i,0,n-1){
        REP(j,0,3){
            if(j!=0) chmax(dp[i+1][0],dp[i][j]+a[i+1]);
            if(j!=1) chmax(dp[i+1][1],dp[i][j]+b[i+1]);
            if(j!=2) chmax(dp[i+1][2],dp[i][j]+c[i+1]);
        }
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}


Measured memory_bytes: 8064
from math import sqrt, ceil


def divisors(n):
    out = []
    nn = ceil(sqrt(n))
    for i in range(1, nn):
        if n % i == 0:
            out.append(i)
            out.append(n//i)

    if nn ** 2 == n:
        out.append(nn)

    out.sort()
    return out


n = int(input())
a = len(divisors(n-1)[1:])

d = divisors(n)
for dd in d[1:]:
    nn = n
    while nn % dd == 0:
        nn = nn // dd
    if nn % dd == 1:
        a += 1

print(a)


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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cout<<#x<<":"<<x<<endl
#define debug2(x,y) cout<<#x<<","<<#y":"<<x<<","<<y<<endl
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

void solve(int N){
    vector<vector<int>> t(N,vector<int>(N+1));
    rep(i,N) rep(j,N+1) cin>>t[i][j];
    int sz=1;
    for(int i=0;i<N+1;i++) sz*=2;
    vector<int> dp(sz,INF);
    dp[0]=0;

    for(int i=0;i<(1<<N);i++){
        for(int j=0;j<N;j++){           // solve stage j
            if(((1<<j)&i)!=0){
                continue;
            }
            int cost = t[j][0];
            for(int k=0;k<N;k++){       // use t[j][k+1] ?
                if((i&(1<<k))!=0){      // already finished stage k
                    cost = min(cost,t[j][k+1]);
                }
            }
            dp[i|(1<<j)] = min(dp[i|(1<<j)],dp[i]+cost);
        }
    }

    cout << dp[(1<<N)-1] << endl;
}

int main(){
    int n;
    while(cin>>n){
        if(n==0) break;
        solve(n);
    }
}

Measured memory_bytes: 3648
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline-------------------------------------------
    N,A,B = map(int,input().split())
    X = list(map(int,input().split()))
    tired = 0
    for i in range(N-1):
        tired += min(A*(X[i+1]-X[i]),B)
    print(tired)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 16360
#include<bits/stdc++.h>
using namespace std;
int s[5];
int main(){
	int x,y;
	bool ans=true;
	for(int i=1;i<=3;i++){
		scanf("%d%d",&x,&y);
		s[x]++,s[y]++;
	}
	for(int i=1;i<=4;i++)
	if(s[i]>2||s[i]==0) ans=false;
	if(ans) printf("YES");
	else printf("NO");
}

Measured memory_bytes: 256
<?php
$a = intval(trim(fgets(STDIN)));
$answer = 'No';
for($i = 0;$i < 10;$i++) {
    for($j = 0;$j < 10;$j++) {
        if($a === $i * $j) {
            $answer = 'Yes';
        } else {
            continue;
        }
    }
}
echo $answer . PHP_EOL;

Measured memory_bytes: 5240
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <climits>


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

inline int ctoi(char c) {
    return (int)(c -'0');
}

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

int main() {
    ll a, b;
    cin >> a >> b;
    cout << ((a*b) -a-b+1) << endl;
    
    return 0;
}

Measured memory_bytes: 764
#include<stdio.h>

int min(int x, int y){
	if(x <= y) return x;
	else return y;
}
int main(){
int i,j,n,m;
scanf("%d",&n);
scanf("%d",&m);
int C[m];
for(i=0;i<m;i++)
scanf("%d",&C[i]);
int T[n+1];
for(i=0;i<=n;i++)
T[i] = 10001;
T[0]=0;
for(i=0;i<m;i++){
for(j=C[i];j<=n;j++)
T[j] = min(T[j], T[j - C[i]] + 1);
}
printf("%d\n",T[n]);
return 0;
}

Measured memory_bytes: 792
n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)

next_max_node = 1

for leaf in a:
    if leaf > next_max_node:
        print(-1)
        exit()
    next_max_node = (next_max_node - leaf) * 2

num_sum = 0

for i in range(1, n+2):
    tmp = a[-i]
    b[-i] = a[-i] + num_sum
    num_sum += a[-i]

ret = 0
next_max_node = 1

for i in range(n+1):
    leaf = a[i]
    ret += min(b[i], next_max_node)
    next_max_node = (next_max_node - leaf) * 2

print(ret)


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

const int maxn=200010;
char s[maxn];
int n, ans;

int main(){

	scanf("%s",s+1); n=strlen(s+1); ans=n;
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(s[i]=='S') cnt++;
		else{
			if(cnt) cnt--, ans-=2;
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var (a, b, c, d) = sc.nextLine().split(" ").map { it.toInt() }

    while(true){
        c -= b
        if(c<=0) {
            println("Yes")
            return
        }
        a -= d
        if(a<=0) {
            println("No")
            return
        }
     }
}

Measured memory_bytes: 38244
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int maxN = 1000;
	static int maxM = 2000;
	static int n;
	static int m;
	static long INF = Long.MAX_VALUE/2;
	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			// input
			n = in.nextInt();
			m = in.nextInt();

			long[] d = new long[n];
			Edge[] edges = new Edge[m];

			for (int i = 0; i < m; i++) {
				int a = in.nextInt()-1;
				int b = in.nextInt()-1;
				long c = in.nextLong();
				edges[i] = new Edge(a, b, -c);
			}

			Arrays.fill(d, INF);

			d[0] = 0;

			boolean isNegative = false;

			for (int now = 0; now < n; now++) {
				for (int j = 0; j < m; j++) {
					int u = edges[j].from;
					int v = edges[j].to;
					long c = edges[j].cost;
					if (d[u] + c < d[v]) {
						d[v] = d[u] + c;
						if (now == n-1 && v == n-1) {
							isNegative = true;
						}
					}
				}
			}

			if (isNegative) {
				out.println("inf");
			} else {
				out.println(-d[n-1]);
			}


		}
	}

	static class Edge {
		int from;
		int to;
		long cost;

		public Edge(int from, int toNodeNum, long weight) {
			this.from = from;
			this.to = toNodeNum;
			this.cost = weight;
		}
	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 23084
#include <cstdio>
#include <vector>
int main() {
	long long n;
	scanf("%lld", &n);
	n++;
	
	int all = 100;
	
	std::vector <int> p, q;
	while(n > 1) {
		if(n & 1) {
			p.push_back(all--);
			n--;
		}
		else {
			q.push_back(all--);
			n >>= 1;
		}
	}
	
	int sz = p.size() + q.size();
	printf("%d\n", sz + 100);
	for(int i = 0; i < p.size(); i++)
		printf("%d ", p[i]);
	for(int i = q.size() - 1; ~i; --i)
		printf("%d ", q[i]);
	for(int i = 1; i <= 100; i++)
		printf("%d ", i);
	return 0;
}

Measured memory_bytes: 256
def gcd(x, y): 

    while(y): 
        x, y = y, x % y 
    
    return x 

n = int(input())
a = list(map(int, input().split(' ')))
nok = a[0]
mod = int(1e9 + 7)
for i in range(1, n):
    nok = nok * a[i] // gcd(nok, a[i])
ans = 0
for i in range(0, n):
    ans += nok // a[i]
print (ans % mod)

Measured memory_bytes: 4084
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

# n, m = map(int, input().split())

n = int(input())

# data =[]
# for i in range(n):
#     tmp = [int(n) for n in input().split()]
#     data.append(tmp)

if n == 0:
    print(0)
    exit(0)

if n % 2 == 1:
    print(0)
    exit(0)

ans = 0
keta = 10
for i in range(30):
    ans += n//keta
    keta *= 5

    if keta > n:
        break

print(ans)




Measured memory_bytes: 5108
package main

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

func main() {
	N := nextInt()
	D := nextInt()

	vector := make([][]int, N)

	for i := 0; i < N; i++ {
		vector[i] = make([]int, D)

		for j := 0; j < D; j++ {
			vector[i][j] = nextInt()
		}
	}

	c := 0

	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			d2 := float64(0)

			for k := 0; k < D; k++ {
				d2 += float64(vector[i][k]-vector[j][k]) * float64(vector[i][k]-vector[j][k])
			}

			d := int(math.Sqrt(d2))

			if d2 == float64(d*d) {
				c++
			}
		}
	}

	fmt.Println(c)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

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

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)

	return i
}

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

int main(int argc, char const *argv[])
{
	long long a,b;
	cin>>a>>b;
	if ((a+b)%2LL==0LL)
	{
		cout<<(a+b)/2LL<<endl;
	}
	else
	{
		cout<<"IMPOSSIBLE\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int n;
	scanf("%d", &n);
	int s = 0, t = n;
	for (;;)
	{
		if (t == 0)break;
		s += t % 10;
		t /= 10;
	}
	printf((n%s == 0) ? "Yes\n" : "No\n");
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


int K;
int itm;
vector<string>ope;
vector<int>idx1,idx2;

inline void add(const string &s,int i,int j){
    ope.pb(s);
    idx1.pb(i);
    idx2.pb(j);
    if(s=="split")K+=2;
    else K++;
}

void dfs(int k,string s){
    int X=count(all(s),'o')-count(all(s),'x');
    assert(X>=0);
    if(X==s.size()){
        if(itm!=-1)return;
        if(X==1)itm=k;
        else{
            add("split",k,0);
            itm=K-1;
        }
        return;
    }
    if(s.size()<=2)return;

    int st=0;
    rep(i,s.size()){
        if(s[i]=='o')st++;else st--;
        if(i&&i+2<s.size()&&0<=st&&st<=X);else continue;

        add("split",k,i);
        int x=K-1,y=K;
        if(st){
            dfs(x,s.substr(0,i+1));
            dfs(y,s.substr(i+1,s.size()-i-1));
        }
        else{
            dfs(y,s.substr(i+1,s.size()-i-1));
            dfs(x,s.substr(0,i+1));
        }
        return;
    }

    if(s[0]=='x'){
        if(itm!=-1){
            add("join",itm,k);
            itm=-1;
            dfs(K,"o"+s);
        }
        else{
            add("split",k,s.size()-2);
            itm=K;
            dfs(K-1,s.substr(0,s.size()-1));
        }
    }
    else{
        if(itm!=-1){
            add("join",k,itm);
            itm=-1;
            dfs(K,s+"o");
        }
        else{
            add("split",k,0);
            itm=K-1;
            dfs(K,s.substr(1,s.size()-1));
        }
    }
}

signed main(){
    int N;
    cin>>N;
    while(N--){
        K=0;itm=-1;
        string S;
        cin>>S;
        int a=count(all(S),'o');
        int b=S.size()-a;
        bool flag=true;
        for(int i=0;i+1<S.size();i+=2)if(S[i]==S[i+1])flag=false;
        if(a>b||(a==b&&flag)){
            dfs(0,S);
            cout<<ope.size()<<endl;
            rep(i,ope.size())cout<<ope[i]<<" "<<idx1[i]<<" "<<idx2[i]<<endl;
        }
        else{
            cout<<-1<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3164
#include<iostream>

using namespace std;

int main() {
  int begin = 1, end;
  int n, m;
  cin >> n >> m;
  end = n + 2;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    if (l > begin) begin = l;
    if (r + 1 < end) end = r + 1;
    //cout << l << " " << r << endl;
  }
  cout << max(0, end - begin) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

int p[100001],r[100001],c[100001];
void init(){rep(i,100001)p[i]=i,r[i]=0,c[i]=1;}
int find(int x){return (p[x]==x)?x:(p[x]=find(p[x]));}
void unite(int x,int y) {
  x=find(x),y=find(y);
  if(x==y)return;
  int cx=c[x],cy=c[y];
  if(r[x]<r[y])p[x]=y;
  else{p[y]=x;if(r[x]==r[y])r[x]++;}
  c[find(x)]=cx+cy;
}
bool same(int x,int y){return find(x)==find(y);}

void Main() {
  init();
  ll n,m;
  cin >> n >> m;
  P a[m];
  rep(i,m) {
    cin >> a[i].F >> a[i].S;
    a[i].F--,a[i].S--;
  }
  ll d=n*(n-1)/2;
  vector<ll> ans;
  rrep(i,m) {
    ans.pb(d);
    if(!same(a[i].F,a[i].S)) {
      ll x=c[find(a[i].F)],y=c[find(a[i].S)];
      unite(a[i].F,a[i].S);
      d-=x*y;
    }
  }
  
  rrep(i,ans.size()) pr(ans[i]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 4980
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <queue>
#include <tuple>

using namespace std;

class solver
{
	vector<vector<int>> G;
	vector<int> C;	//color
	vector<int> D;	//depth
	int c;	//current color

public:
	void dfs(int v, int d)
	{
		if (C[v] == 0)
			C[v] = c;
		if (D[v] >= d)
			return;
		D[v] = d;
		if (d > 0) {
			for (int i : G[v]) {
				dfs(i, d - 1);
			}
		}
	}

	void solve()
	{
		int N, M;
		cin >> N >> M;
		{
			vector<vector<int>> g(N, vector<int>());
			G.swap(g);
			vector<int> c(N);
			C.swap(c);
			vector<int> d(N);
			D.swap(d);
		}
		for (int i = 0; i < M; i++) {
			int a, b;
			cin >> a >> b;
			a--; b--;
			G[a].push_back(b);
			G[b].push_back(a);
		}
		int Q;
		cin >> Q;
		vector<tuple<int, int, int>> q(Q);
		for (int i = 0; i < Q; i++) {
			int v, d, c;
			cin >> v >> d >> c;
			v--;
			q.emplace_back(v, d, c);
		}
		for (auto it = q.crbegin(); it != q.crend(); ++it) {
			c = std::get<2>(*it);
			dfs(std::get<0>(*it), std::get<1>(*it));
		}
		for (auto i : C) {
			cout << i << endl;
		}
	}
};

int main()
{
	solver s;
	s.solve();
	return 0;
}

Measured memory_bytes: 9572