akhauriyash/Code-Regression huggingface dataset:
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 30031
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
int Scan() {
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
const int N=20005;
//Code begin...

int a[13]={0,1,3,1,2,1,2,1,1,2,1,2,1};
int main ()
{
    int x, y;
    scanf("%d%d",&x,&y);
    puts(a[x]==a[y]?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] A = new int[n + 1];
		int[] B = new int[n];
		int[] C;
		long count2 = 0;

		for (int i = 0; i < n + 1; i++) {
			A[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			B[i] = sc.nextInt();
		}

		C = A.clone();

		for (int i = n - 1; i >= 0; i--) {
			if (A[i + 1] < B[i]) {
				count2 += A[i + 1];
				B[i] -= A[i + 1];
				A[i + 1] = 0;
			} else if (A[i + 1] == B[i]) {
				count2 += B[i];
				A[i + 1] = 0;
				B[i] = 0;

			} else {
				count2 += B[i];
				A[i + 1] -= B[i];
				B[i] = 0;
			}

			if (A[i] < B[i]) {
				count2 += A[i];
				B[i] -= A[i];
				A[i] = 0;
			} else if (A[i] == B[i]) {
				count2 += A[i];
				A[i] = 0;
				B[i] = 0;
			} else {
				count2 += B[i];
				A[i] -= B[i];
				B[i] = 0;
			}
		}

		System.out.println(count2);

	}
}


Measured memory_bytes: 64352
// ABC127
// A - Ferris Wheel
#include<bits/stdc++.h>

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a>=13) cout << b << endl;
    else if(a>=6) cout << b/2 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo for(int i=0;i<n;i++)
#define clear cin.clear();cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define loopSolve int t; cin>>t; while(t--){solve();}
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//INT_MAX         2,147,483,647                       <10^10
//U_INT_MAX       4,294,967,295                       <10^10
//LONG_LONG_MAX   9,223,372,036,854,775,807           <10^18
//U_LONG_LONG_MAX 18,446,744,073,709,551,615          <10^18
//ll power(int a, int b){
//    return (ll)(pow(a,b)+0.5);
//}

vector<int> gV(int n){
    vector<int> v(n);
    fo { cin>>v[i];  }
    return v;
}

int* gA(int n){
    int* arr = new int[n];
    fo cin>>arr[i];
    return arr;
}

void solve(){
    ll n; cin>>n;
    ll* prices = new ll[n];
    fo{
        cin>>prices[i];
    }
    ll profit=1000,low,high;

    for(int i=0;i<n-1;i++){
        if(prices[i]<prices[i+1]){
            low=prices[i];
//            while(i<n-1 && prices[i]<=prices[i+1])
//                i++;
            high=prices[i+1];
            ll bought=profit/low;
//            profit-=(bought*low);
//            int sold=(bought*high);
            profit+=(high-low)*bought;
        }
    }

    cout<<profit<<endl;
}


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

    solve();
    //loopSolve;

	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 100000000
#define MOD 1000000007
using namespace std;



int main(){
    int A,B,C;
    cin>>A>>B>>C;
    
    if(A+B>=C){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int a[N];
int main(){
    int n,a,b;cin>>n>>a>>b;
    int tp=b-b%n;
    if(tp<a){
        cout<<"NG"<<endl;
    }else{
        cout<<"OK"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))

typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
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;}
//#define int long long

int n,m,a,b,c;
string str;


inline void solve(){

  cin >> str;
  FOR(i,str.length()){
    if(str[i]=='0')
      a++;
    else
      b++;
  }
  cout << min(a,b)*2 fin;
    
}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}



Measured memory_bytes: 512
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;

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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n, m;
	cin >> n >> m;
	vector<P> ab(m);
	REP(i, m) cin >> ab[i].second >> ab[i].first;
	sort(all(ab));

	ll con = 0;
	ll pre = 0;
	REP(i, m) {
		ll a = ab[i].second;
		ll b = ab[i].first;
		if (pre > a) continue;
		pre = b;
		con++;
	}

	cout << con << en;

	return 0;
}


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

int main() {
    int N; cin >> N;
    int xs[N];
    for (int i = 0; i < N; i++) cin >> xs[i];
    sort(xs, xs + N);

    int ans = 0;

    for (int i = 0; i < N - 2; i++) {
        int a = xs[i];
        for (int j = i + 1; j < N - 1; j++) {
            int b = xs[j];
            for (int k = j + 1; k < N; k++) {
                if (a + b > xs[k]) {
                    ans++;
                } else {
                    break;
                }
            }
        }
    }
    
    cout << ans << endl;
}


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

int main(){
    string S;
    cin >> S;
    rep(i,50){
        if(S[2*i]=='L'){
            puts("No");
            return 0;
        }
        if(S[2*i+1]=='R'){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void  main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int buy,ans,rem;
		ans = Integer.MIN_VALUE;
		
		buy = sc.nextInt();
		for(int i = 1 ; i < n ; i++ )
		{
			rem = sc.nextInt();
			ans = Math.max(ans , rem - buy);
			buy = Math.min(rem , buy );
			
		}
		
		System.out.println(ans);
		
	}
}

Measured memory_bytes: 100316
#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <numeric>

using namespace std;

const double eps = 1e-7;
const int MOD = 1000000007;
const int MOD_MAX = 200000;

using ll = long long;
using vi = vector<int>; using vi2 = vector<vi>; using vi3 = vector<vi2>;
using vll = vector<ll>; using vll2 = vector<vll>; using vll3 = vector<vll2>;
using vd = vector<double>; using vd2 = vector<vd>; using vd3 = vector<vd2>;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vpi = vector<pi>; using vpll = vector<pll>;

#define loopi(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define loop(i, n) for (int i = 0; i < (int)n; i++)
#define loopeq(i, n) for (int i = 0; i <= (int)n; i++)
#define loopll(i, n) for (ll i = 0; i < (ll)n; i++)
#define looplleq(i, n) for (ll i = 0; i <= (ll)n; i++)
#define rloopi(i, a, b) for(int i = (int)a - 1; i >= (int)b; i--)
#define rloop(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define rloopeq(i, n) for (int i = (int)n - 1; i >= 1; i--)
#define rloopll(i, n) for (int i = (ll)n - 1; i >= 0; i--)
#define rlooplleq(i, n) for (int i = (ll)n - 1; i >= 1; i--)
#define all(a) (a).begin(), (a).end()

bool feq(float x, float y) { return abs(x-y) <= eps; }
bool deq(double x, double y) { return abs(x-y) <= eps; }
int ceillog2(ll x) { return int (ceil(log2(x))); }
int floorlog2(ll x) { return int (floor(log2(x))); }
template<class T> T reversed (T container) { reverse(container.begin(), container.end()); return container; }
template<class T> T sort (T container) { sort(container.begin(), container.end()); return container; }
ll gcd(ll m, ll n) { if (m > n) swap(m, n); if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

ll alg(ll n, ll k) {
	if (n == k) cout << 0 << endl;
	//else if (n < k) cout << n << endl;
	else {
		ll r = n % k;
		ll s = k - r;
		if (min(s, r) < k) cout << min(s, r) << endl;
		else alg(min(s, r), k);
	}
}

int main() {
	ll n, k; cin >> n >> k;
	alg(n, k);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

int main()
{
  int n, a[100], i, j, sorted[100];
  int max, alice = 0, bob = 0;
  std::cin >> n;
  for (i = 0; i < n; i++)
  {
    std::cin >> a[i];
  }

  std::sort(a, a + n, std::greater<int>());

  for (i = 0; i < n; i++)
  {
    if (i % 2 == 0)
    {
      alice += a[i];
    }
    else
    {
      bob += a[i];
    }
  }
  std::cout << alice - bob << std::endl;
  return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(){
  int N, K;
  int d, buf;
  scanf("%d%d", &N,&K);
  int sunuke_kasi[110] = {};
  for(int i=0; i<K; i++){
    //お菓子ごとに
    scanf("%d", &d);
    for(int j=0; j<d; j++){
      scanf("%d", &buf);
      sunuke_kasi[buf]++;
    }
  }

  int count = 0;
  for(int i=1; i<=N; i++){
    if(sunuke_kasi[i] == 0)count++;
  }

  printf("%d\n", count);
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

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

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

    class Program
    {
        static int n; // jewels count
        static int k; // operation count
        static List<int> cylinder; // jewel container

        static void Main(string[] args)
        {
            // read n, m;
            string[] nk = Console.ReadLine().Split(' ');
            n = Convert.ToInt32(nk[0]);
            k = Convert.ToInt32(nk[1]);

            cylinder = new List<int>();

            // read jewel value
            string[] v = Console.ReadLine().Split(' ');

            for (int i = 0; i < n; i++)
            {
                cylinder.Add(Convert.ToInt32(v[i]));
            }

            int value = 0;

            for (int i = 1; i <= k && i <= n; i++) // using operation count
            {
                for (int r = 0; r <= i; r++) // right side count(operation B)
                {
                    List<int> hand = new List<int>();
                    hand.AddRange(cylinder.GetRange(0, i - r));
                    if (r != 0)
                        hand.AddRange(cylinder.GetRange(cylinder.Count - r, r));
                    value = Math.Max(value, calcValue(hand, k - i));
                }
            }


            Console.WriteLine(value);
        }

        static int calcValue(List<int> hand, int leftOpt)
        {
            hand.Sort();
            while (hand.Count != 0 && hand[0] < 0 && leftOpt > 0) // fixable
            {
                hand.RemoveAt(0);
                leftOpt--;
            }
            return hand.Sum();
        }
    }



Measured memory_bytes: 13268
N,C,K = map(int,input().split())
T = sorted([int(input()) for i in range(N)],reverse=1)
count = 0
bus = 0
arr = T[0] -K
for i in range(N):
    if arr <= T[i]:
        count += 1
    else:
        count = 1
        arr = T[i] - K
        bus += 1

    if count == C:
        bus += 1
        count = 0
        if i != N-1:
            arr = T[i+1]-K 
if count:
    bus += 1
print(bus)

Measured memory_bytes: 8276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;

int main() {
	int n, i, j;
	cin >> n;
	for (i = 0; i <= 9; i++) {
		for (j = 0; j <= 9; j++) {
			if (i * j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
if a.count(0) > 0:
  ans = 0
else:
  ans = 1

for i in a:
  ans *= i
  if ans > (10 ** 18):
    break

if not ans > (10 ** 18):
  print(ans)
else:
  print(-1)

Measured memory_bytes: 21768
=begin
－－－－－－－－－－－－－－
  N = 入力値
  cnt = 桁数
  ans = 答え
－－－－－－－－－－－－－－
  digitsメソッドを作成(num)
    1: cnt += 1
    2: num /10
    3. num < 0 になったら cnt を返す
  メソッド－－－－－－－－－－

  1: 1 ~ N まで繰り返す(i)
  2: digits(i) % 2 が 0 以外なら ans += 1
  3: ans を出力
=end

def digits(num)
  cnt = 0;
  while num > 0
    cnt += 1;
    num /= 10;
  end
  return cnt;
end

N = gets.to_i;
ans = 0;
1.upto(N) do |i|
  ans += 1 unless digits(i) % 2 == 0
end

puts ans

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

int main(){
    int n,k,s=0;
    cin>>n>>k;
    vector<int> l(n);
    for(int i=0;i<n;i++) cin>>l[i];
    sort(l.begin(),l.end(),greater<int>());
    for(int i=0;i<k;i++) s+=l[i];
    cout<<s<<endl;
    return 0;
}

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

template<typename Type>
vector<Type> Dijkstra(vector<vector<pair<long long, Type> > > Graph, long long Start) {
	using PT = pair<Type, long long>;
	const Type Inf = numeric_limits<Type>::max();
	long long Size = Graph.size();
	vector<Type> Dist;
	Dist.assign(Size, Inf);
	priority_queue<PT, vector<PT>, greater<PT> > PQ;

	Dist[Start] = 0;
	PQ.emplace(PT(Dist[Start], Start));
	while (!PQ.empty()) {
		PT p = PQ.top();
		PQ.pop();
		Type D = p.first;
		long long E = p.second;
		if (Dist[E] < D) continue;
		for (pair<long long, Type> Next : Graph[E]) {
			Type ND = Next.second;
			long long NE = Next.first;
			if (Dist[NE] > Dist[E] + ND) {
				Dist[NE] = Dist[E] + ND;
				PQ.emplace(PT(Dist[NE], NE));
			}
		}
	}
	return Dist;
}

int main() {
	long long N, M, R;
	vector<vector<pair<long long, long long> > > V;
	cin >> N >> M >> R;
	V.resize(N);
	for (int i = 0; i < M; i++) {
		long long S, T, C;
		cin >> S >> T >> C;
		V[S].push_back({ T, C });
	}
	vector<long long> ANS = Dijkstra<long long>(V, R);
	for (int i = 0; i < N; i++) {
		if (ANS[i] == LLONG_MAX) cout << "INF" << endl;
		else cout << ANS[i] << endl;
	}
}


Measured memory_bytes: 30768
N,M = map(int,input().split())
ab = {}
for i in range(N):
    a,b = map(int,input().split())
    if a in ab.keys():
        ab[a] += b
        continue
    ab[a] = b

keys = sorted(ab.keys())

ans = 0
kosu = 0
for k in keys:
    kosu += ab[k]
    if kosu >= M:
        kosu -= ab[k]
        break
    ans += k * ab[k]

for i in range(ab[k]):
    if kosu == M:
        break
    kosu += 1
    ans += k
print(ans)


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

int main() {
  int n, i = 0;
  cin >> n;
  long l[n + 1];
  l[0] = 2, l[1] = 1;

  for (int i = 2; i <= n; i++) {
    l[i] = l[i - 1] + l[i - 2];
  }
  cout << l[n] << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		char[] s=sc.next().toCharArray();
		if(s[0]=='0' || s[s.length-1]=='1'){
			System.out.println(-1);
			return;
		}
		for(int i=0; i<s.length/2; i++){
			if(s[i]!=s[s.length-2-i]){
				System.out.println(-1);
				return;
			}
		}
		PrintWriter ans=new PrintWriter(System.out);
		ans.println(1+" "+2);
		int point=2;
		for(int i=1; i<s.length-1; i++){
			ans.println(point+" "+(i+2));
			if(s[i]=='1'){
				point=i+2;
			}
		}
		ans.flush();
	}
}


Measured memory_bytes: 41516
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
using namespace std;


int main(void) {
	int R, G, B, N;
	int ans;
	scanf("%d %d %d %d", &R, &G, &B, &N);
	ans = 0;

	for (int i = 0; i*R <= N; i++) {
		for (int j = 0; i*R + j * G <= N; j++) {
			if ((N - i * R - j * G) % B == 0) {
				ans++;
			}
		}
	}
	printf("%d\n", ans);

}

Measured memory_bytes: 888
#include <stdio.h>
#include <stdlib.h>
#define max_size (int)(1e5 + 1)

int main(){
	long long int N, K, a, b, i;
	scanf("%lld%lld", &N, &K);
	long long int *anum = (long long int *)malloc(sizeof(long long int) * max_size);
	for(i = 0; i < max_size; i++){
		anum[i] = 0;
	}
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &a, &b);
		anum[a] += b;
	}
	long long int sum = 0;
	for(i = 0; sum < K; i++){
		sum += anum[i];
	}
	printf("%lld\n", i - 1);
	return 0;
}

Measured memory_bytes: 896
h,w =list(map(int,input().split()))
mod=10**9+7
a = [[i for i in input()] for j in range(h)]
dp=[[0]*w for i in range(h)]
dp[0][0]=1
for i in range(h):
	for j in range(w):
		if i==0 and j==0: pass
		elif a[i][j]!="#":
			if i==0 : dp[i][j]=dp[i][j-1]
			elif j==0: dp[i][j]=dp[i-1][j]
			else:dp[i][j]=dp[i-1][j]+dp[i][j-1]
		else: dp[i][j]=0
		dp[i][j]=dp[i][j]%mod
print(dp[h-1][w-1])
		


Measured memory_bytes: 51412
///******* In the name of Allah *******///

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

void Ok()
{
	long int a,b,c,d,i,j,k,l,m,n,cnt = 0;
    double aa,bb,cc,dd;
    
    cin>>n;
    if(n>=30)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;

	return;
}

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

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

int main(){
    int k, n, a[1000001];
    cin >> k >> n;
    for(int i = 0; i < n; i++)cin >> a[i];
    int max_dest = a[1] - a[0];
    for(int i = 1; i < n-1; i++)max_dest = max(a[i + 1] - a[i], max_dest);
    max_dest = max(k + a[0] - a[n-1], max_dest);
    cout << k - max_dest << endl;

    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define int long long 
using namespace std ;
const int inf = 1e9 ;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int k,n;
	cin>>k>>n;
	int arr[n];
	for(int& i:arr) cin>>i;
	
	int ans = inf;
	for(int i=0;i<n;i++){
		if(i==0){ 
			ans=min(ans,arr[n-1]-arr[0]);
			continue;
		}
		int dist = k-arr[i]+arr[i-1];
		ans=min(ans,dist);
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, M, R;
    cin >> N >> M >> R;
    int r[R];
    rep(i, R){
        cin >> r[i];
        r[i]--;
    }
    ll d[N][N];
    fill(d[0], d[N], INF);
    rep(i, M){
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--, b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    rep(i, N) d[i][i] = 0;
    rep(i, N){
        rep(j, N){
            rep(k, N){
                d[j][k] = min(d[j][k], d[j][i]+d[i][k]);
            }
        }
    }
    vector<int> v;
    rep(i, R) v.pb(i);
    ll ans = INF;
    do{
        ll len = 0;
        rep(i, R-1){
            len += d[r[v[i]]][r[v[i+1]]];
        }
        ans = min(ans, len);
    } while(next_permutation(v.begin(), v.end()));
    cout << ans << endl;
}

Measured memory_bytes: 512
while true
    n, m = gets.chomp.split.map(&:to_i)
    break if [n, m] == [0, 0]
    
    arr, arr2 = [], []
    arr = gets.chomp.split.map(&:to_i) if n > 0
    arr2 = gets.chomp.split.map(&:to_i) if m > 0
    arr += arr2
    arr.sort!.reverse!
    arr << 0
    max, prev = 0, arr[0]
    arr[1..-1].each{|x|
        d, prev = prev - x, x
        max = d if max < d
    }    
    puts max
end


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main()
{
    int x,a,b;cin>>x>>a>>b;
    
    if(abs(x-a)<abs(x-b))cout<<'A'<<endl;
    else cout<<'B'<<endl;
    
   return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
d = defaultdict(int)
for i in [input() for j in range(n)]:
  d["".join(sorted(i))]+=1

from math import factorial as f

ans = 0
for i in d:
  if d[i]>1:
    ans+=f(d[i])//f(2)//f(d[i]-2)

print(ans)

Measured memory_bytes: 29848
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int main(void){
    string l;
    int t=0;
	string max="";
	map<string,int> str;
	string s;
	while(cin>>s){

        if(s.length()>max.length())max=s;


        str[s]++;
        if(str[s]>t){
            t=str[s];
            l=s;
        }

	}

	cout<<l<<" "<<max<<endl;



	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007


int main(){

  int n;
  int mm = 0;
  cin>>n;

  vector<pair<double,double>> vec(n);
  vector<int>perm(n);

  for(int i=0;i<n;i++)
    cin>>vec[i].first>>vec[i].second;

  iota(perm.begin(),perm.end(),0);
  double dist=0;

  do{
    mm++;
    for(int i=1;i<n;i++){
        dist += sqrt(pow(vec[perm[i]].first-vec[perm[i-1]].first,2) +
                     pow(vec[perm[i]].second - vec[perm[i-1]].second,2));

    }
  }while(next_permutation(perm.begin(),perm.end()));

  cout<<fixed<<setprecision(10);

  cout<<dist/mm<<endl;



return 0;
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(int i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
//const ll mod = 1000000007LL;
const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}
//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> vec(N),wa(N);
    vecin(vec);
    sort(all(vec));
    vector<bool> ok(N - 1);
    wa[0] = vec[0];
    REP(i,N - 1){
        wa[i] += wa[i - 1] + vec[i];
    }
    ll ans = 1;
    rep(i,N - 1){
        if(wa[i] * 2 >= vec[i + 1]){
            ok[i] = 1;
        }
    }
    for(ll i = N - 2;i >= 0;i--){
        if(ok[i])ans++;
        else break;
    }
    cout << ans << endl;
    //vecout(vec);
    //vecout(wa);
}

Measured memory_bytes: 4776
/*
 
 * This code is written by Sanskar Agarwal
 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

#define ll long long
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define S second
#define F first
#define PB push_back

const ll MOD=1000000007;

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

    
    ll n,k;
    cin>>n>>k;
    ll a[n],i,sm=0;
    for(i=0;i<n;i++) {
        cin>>a[i];
        sm+=a[i];
    }
    if(sm<k) {
        cout << "0";
        return 0;
    }
    ll j,dp[n+1][k+1],pref[k+1];
    for(i=0;i<=k;i++) {
        dp[0][i]=0;
        pref[i]=0;
    }
    for(i=0;i<=n;i++)
        dp[i][0]=1;

    for(i=1;i<=n;i++)
    {
        pref[0]=dp[i-1][0];
        for(j=1;j<=k;j++) {
            pref[j]=(pref[j-1]+dp[i-1][j])%MOD;
        }
        // for(j=0;j<=k;j++)
        //     cout << pref[j] << " ";
        // cout << "\n";

        for(j=1;j<=k;j++)
        {
            if(j>a[i-1])
            {
                dp[i][j]=(pref[j]-pref[j-a[i-1]-1]+MOD)%MOD;
            } else {
                dp[i][j]=pref[j];
            }

            //cout << dp[i][j] << " ";
        }
        //cout << "\n";
    }

    cout << dp[n][k];
     
    return 0;
}


Measured memory_bytes: 80000
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	if( n % 2 == 0 ) cout << n << endl;
	else cout << 2 * n << endl;
	
	return 0;
}


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

long kaijou(long);
long n;

int main(){
	cin >>n;
	cout << kaijou(n) <<endl;

	return 0;
}

long kaijou(long i){
	if(i == 0){
		return 1;
	} else {
		return i * kaijou(i-1);
	}
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
    int n, l;
    int total=0, actTotal;
    int minDif=1e9;
    int ans=0;
    scanf("%d%d", &n, &l);
    for(int i=0; i<n; i++){
        total+=l+i;
    }
    //printf("Starting with %d\n", total);
    for(int i=0; i<n; i++){
        actTotal=total-(l+i);
        //printf("posible: %d\n", actTotal);
        if(abs(abs(total)-abs(actTotal))<minDif){
            minDif=abs(abs(total)-abs(actTotal));
            //printf("diff of %d\n", minDif);
            ans=actTotal;
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

int main() {
  vector<int> abc(5);
  for (int i=0; i<5; ++i) {
    cin >> abc[i];
  }
  int k;
  cin >> k;

  sort(abc.begin(), abc.end());
  int max_d = abc[4] - abc[0];
  if (max_d <= k) {
    cout << "Yay!\n";
  } else {
    cout << ":(\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
const int mod=1e9+7;

int main(){
  int64_t L,R;
  cin>>L>>R;
  int64_t sum=1e18;
  int64_t t=L+2019*2;
  for(int i=L;i<=min(t,R);i++){
    for(int j=i+1;j<=min(t,R);j++){
      int l=i%2019,r=j%2019;
      int64_t x=l*r;x%=2019;
      chmin(sum,x);
    }
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3672
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val n = StdIn.readLine.toInt
    val S = StdIn.readLine.split(' ').map(_.toInt)
    val q = StdIn.readLine.toInt
    val T = StdIn.readLine.split(' ').map(_.toInt)
    val C = new Array[Int](100000)
    var len = 0

    val res = T filter { m => binSearch(S, n, m) }
    println(res.length)
  }

  def binSearch(S: Array[Int], len: Int, i: Int): Boolean = {
    var l = 0
    var r = len
    while (l < r) {
      val indice = (r + l) / 2
      if (S(indice) < i) {
        l = indice + 1
      } else if (S(indice) > i) {
        r = indice
      } else {
        return true
      }
    }
    false
  }
}



Measured memory_bytes: 76492
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
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 keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int k,n;cin >> k >> n;
    vi a(n+1);
    rep1(i, n)cin >> a[i];
    a[0] = a[n]-k;
    // int mi = inf;
    int sum = 0;
    vi sa(n);
    rep(i, n) {
        sa[i] = a[i+1]-a[i];
        sum+=sa[i];
    }
    resort(sa);
    cout << sum-sa[0] << endl;
    return 0;
}

Measured memory_bytes: 6384
///////////////////// author : TrEbLeCleF /////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;

#define pb(x) push_back(x)
#define deb(x) cerr <<#x<<" = "<<x<<"\n"
#define print(v,s,e) for(int i = s; i < e; i++)cout << v[i]<<" ";cout<<"\n";
#define INF 1e17
#define PI 3.14159265358979323846 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
/////////////////////////// GLOBAL ///////////////////////////



/////////////////////////// GLOBAL ///////////////////////////
void solve(){
	ll n;
	cin >> n;
	ll sum = n + n*n + n*n*n;
	cout << sum ;
	

}

int main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		freopen("error.txt", "w", stderr);
	#endif 
    ios_base:: sync_with_stdio(false); 
   	cin.tie(0); 
	int t=1;
	//cin >> t;
	while(t--){
		solve();
	}
	/* #ifndef ONLINE_JUDGE
    printf("\nRun Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif  */
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x)<<fixed;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll n,ll mod){
    return pow1(n,mod-2,mod);
}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
    if(a.ff != b.ff)return a.ff < b.ff;
    return a.ss > b.ss;
}

void solve(){
    ll i,j,k,l,n,m,x,y,z,r;
	cin>>n>>m>>k;
	// if(n==1){
	// 	cout<<"OK\n";
	// 	return;
	// }
	if(k%n==0 || m%n==0){
		cout<<"OK\n";
		return;
	}
	if(m/n != k/n){
		cout<<"OK"<<endl;
	}else{
		cout<<"NG\n";
	}
	
    
  
}
int main(){
    FS;
    ll i,j,k,n,m,x,y,z,q;
    q=1;
    // cin>>q;
    while(q--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3576
n = int(input())
if n % 2 == 1:
    print(0)
    exit(0)
lst = []
i = 1
while n >= 5 ** i:
    lst.append(n//(2 * (5**i)))
    i += 1
    
ans = 0
for i in range(len(lst)):
    ans += lst[i]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define vvdebug(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N; cin >> N;
	vi A(N); rep(i, N) cin >> A.at(i);
	// vdebug(A);
	ll ans = 0;
	rep(i, N - 1) {
		if (A.at(i) % 2 == 1 && A.at(i + 1) > 0) {
			A.at(i)--; A.at(i + 1)--;
			ans++;
		}
	}
	rep(i, N) {
		ans += A.at(i) / 2;
	}
	cout << ans << endl;
}

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

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

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    
    int ans = 0;
    
    if(a + b > 2 * c){
        if(x > y){
            ans += y * 2 * c;
            ans += (x - y) * a;
        }else{
            ans += x * 2 * c;
            ans += (y - x) * b;
        }
        
        ans = min(max(x, y) * 2 * c, ans);
    }else{
        ans += a * x;
        ans += b * y;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
//check modulo
int main(){
	IOS;
	cout.precision(30) ;
	int n ; cin >> n;
	vi a(n);for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	ll ans = 0 ;
	for(int i = 0 ; i < n ; i++) ans += a[i] - 1 ;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"t,s=open(0)\n"
"n,k=map(int,t.split())\n"
"l=2*k+1\n"
"x=[0]*(2+int(s[0]))+[i+1for i in range(n-1)if s[i]!=s[i+1]]+[n]*l\n"
"print(max(x[i+l]-x[i]for i in range(0,len(x)-l,2)))\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 8912
#include<stdio.h>
int main(){
  int a,b,j,ab,total=1;
  while(scanf("%d %d",&a,&b)!=EOF){
    ab=a+b;
    total=1;
    int i=10;
    for(j=0;j<6;j++){
      if(ab/i>=1){
	total++;
      }
      i=10*i;
    }
    printf("%d\n",total);
  }
  return(0);
}

Measured memory_bytes: 1028
n=gets.to_i
a=gets.to_s.split(" ").map{|s| s.to_i}
for m in 0..n-1
  a[0]=a[0]|a[m]
end
c=0
while a[0]%2==0
 a[0]=a[0]/2
 c+=1
end
print c

Measured memory_bytes: 1788
#include <bits/stdc++.h>
 
    using namespace std;
 
    typedef long long ll;
    typedef long double ld;
 
    typedef pair<int, int> pi;
    typedef pair<ll,ll> pl;

    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pi> vpi;
    typedef vector<pl> vpl;
    typedef vector<vi> vvi;

    #define FOR(i, a, b) for (int i=a; i<(b); i++)
    
    #define sz(x) (int)(x).size()
    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
    #define lb lower_bound
    #define ub upper_bound
    #define all(x) x.begin(), x.end()
 
    template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
    template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
    
    #define trav(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
 
    const int MOD = 1000000007;
    const char nl = '\n';
 
    int main() 
    {
        ios_base::sync_with_stdio(0); cin.tie(0);
        double a,b,c,d;cin>>a>>b>>c>>d;
        
        (ceil(a/d) < ceil(c/b)) ? cout<<"No" : cout<<"Yes";
    }


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,pas;
string s,h,j,r;
map <pair <string, string>, long long> m,n;
map <pair <string, string>, long long>::iterator it;
void rec(long long q){
	if(q>a){
		m[make_pair(h,j)]++;
		return;
	}
	r=s[q-1];
	h.insert(h.size(),r);
	rec(q+1);
	h.erase(h.size()-1,1);
	r=s[q-1];
	j.insert(j.size(),r);
	rec(q+1);
	j.erase(j.size()-1,1);
}
void rec2(long long q){
	if(q>a*2){
		pas=pas+m[make_pair(h,j)];
		return;
	}
	r=s[q-1];
	h.insert(0,r);
	rec2(q+1);
  r=s[q-1];
	h.erase(0,1);
	j.insert(0,r);
	rec2(q+1);
	j.erase(0,1);
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>s;
	rec(1);
	h.clear();
	j.clear();
	rec2(a+1);
	cout<<pas;
	return 0;
}

Measured memory_bytes: 86272
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n)
	{
		int a[3]={0};
		a[2]=n%10;
		a[1]=n/10%10;
		a[0]=n/100;
		int i;
		for(i=0;i<3;i++)
		{
			if(a[i]==1)
				a[i]=9;
			else if(a[i]==9)
				a[i]=1;	
		}
		for(i=0;i<3;i++)
			cout<<a[i];
		cout<<endl;	
	} 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int f(int n){
	for(int i=4;i<=n;i++)
	if(i*i==n)return 1;
	return 0;
}
int main(){
	int a,b;
	cin>>a>>b;
	if(b==100)a*=1000;
	else if(b/10==0)a*=10;
	else a*=100;
	if(f(a+b))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

#ifdef _DEBUG
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout if (false) cout
#define debug() if (false)
#define dvout(v) if(false) vout(v)
#endif

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vec(v, n) vector<int> v(n, 0);
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力

#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
#define next asdnext
#define prev asdprev
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"



void Main()
{
	char a;
	cin>>a;
	if('A'<=a && a<='Z'){
		cout<<'A'<<_n;
	}
	else{
		cout<<'a'<<_n;
	}
}



int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 3648