akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(c - (a - b), 0) << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

long long solve(long long H, long long W, long long h, long long w) {
    return (H-h)*(W-w);
}

int main() {
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  long long h;
  scanf("%lld", &h);
  long long w;
  scanf("%lld", &w);
  cout<<solve(H, W, h, w)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>

using ll = long long;
using namespace std;

int main(){
  ll H, N;

  cin >> H >> N;

  vector<ll> A(N);

  ll a_total = 0;

  for(auto& a : A){
    cin >> a;
    a_total += a;
  }

  string ans = H <= a_total ? "Yes" : "No";

  cout << ans << endl;
  
  return 0;
}


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

long long n, sum = 0;
map<long long, long long> mp;

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    sum += x;
    ++mp[x];
  }
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long b, c;
    cin >> b >> c;
    sum -= mp[b] * b;
    sum += mp[b] * c;
    mp[c] += mp[b];
    mp.erase(b);

    cout << sum << endl;
  }

  cout << endl;
  return 0;
}

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

int c, g, l, r, ma, mi, a;

int main() {
	cin >> c >> g;
	for (int i=1; i<=g; i++) {
		cin >> l >> r;
		if (i==1) {
			ma=r;
			mi=l;
		}
		else {
			if (r<ma) {
				ma=r;
			}
			if (l>mi) {
				mi=l;
			}
		}
	}
	a=ma-mi+1;
	if (a>0) {
		cout << a << endl;
	}
	else {
		cout << "0" << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x, y = 0;
		if (b != 100) {
			if (b / 10 == 0) {
				x = a * 10 + b;
			} else {
				x = a * 100 + b;
			}
		} else {
			x = a * 1000 + b;
		}
		for (int i = 0; i * i <= x; i++) {
			if (i * i == x) {
				System.out.println("Yes");
				y = 1;
				break;
			}
		}
		if (y == 0) {
			System.out.println("No");
		}
		sc.close();

	}

}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a = 1, b = 1, i = 1;
	while ((a != 0)||(b != 0)){
		if (i != 1)
			cout << endl;
		i++;
		cin >> a >> b;
		if ((a != 0)||(b != 0))
			for (int i = 1; i <= a; i++){
				for (int j = 1; j <= b; j++)
					cout << '#';
				cout << endl;
			}
	}
}


Measured memory_bytes: 3080
#include<stdio.h>
#include<string.h>
int main()
{
	char a[100],b[100],c[100];
    char d,m,n;
	scanf("%s %s %s",&a,&b,&c);
   d=a[0]-32;
   m=b[0]-32;
   n=c[0]-32;
    printf("%c%c%c",d,m,n);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+1;
const ll p=1e9+7;
string s;
int main()
{
	int i,n,sum=0,ans=0;
	cin>>n>>s;
	for(i=0;i<n;i++)
    {
        sum+=(s[i]==')')?1:-1;
        ans=max(ans,sum);
    }
    for(i=0;i<ans;i++)cout<<'(';
    cout<<s;
    for(i=0;i<ans-sum;i++)cout<<')';
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N, M; cin >> N >> M;
    string S; cin >> S;
    reverse(S.begin(), S.end());

    vector<i64> available;
    REP(i, N + 1) {
        if (S[i] == '0') available.pb(i);
    }

    i64 cur = 0;
    vector<i64> ans;
    while (cur < N) {
        i64 nxt = upper_bound(available.begin(), available.end(), cur + M) - available.begin();
        nxt--;
        if (nxt < 0) {
            cout << -1 << endl;
            return 0;
        }
        i64 far = available[nxt];
        if (far <= cur) {
            cout << -1 << endl;
            return 0;
        }
        ans.pb(far - cur);
        cur = far;
    }

    reverse(ans.begin(), ans.end());
    for (i64 x : ans) cout << x << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 5688
#include<cstdio>
int n,m,ans,a[501][501],f[1000000][4];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	  for(int j=1;j<=m;j++)
	    scanf("%d",&a[i][j]);
	for(int i=1;i<=n;i++)
	  for(int j=1;j<=m;j++)
	  {
	  	if(i==n&&j==m) break;
	  	if(a[i][j]&1)
	  	{
	  		if(j!=m)
	  		{
	  			a[i][j]=a[i][j]-1;
	  			a[i][j+1]=a[i][j+1]+1;
	  			f[++ans][0]=i;f[ans][1]=j;f[ans][2]=i;f[ans][3]=j+1;
			}
			else
			{
				a[i][j]=a[i][j]-1;
	  			a[i+1][j]=a[i+1][j]+1;
				f[++ans][0]=i;f[ans][1]=j;f[ans][2]=i+1;f[ans][3]=j;
			}
		}
	  }
	  printf("%d\n",ans);
	  for(int i=1;i<=ans;i++)
	     printf("%d %d %d %d\n",f[i][0],f[i][1],f[i][2],f[i][3]);
	  return 0;
}

Measured memory_bytes: 6272
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
using namespace std;
int perm(int n);

int main(){

    string S;
    cin >> S;

    if((S[2] == S[3]) && (S[4] == S[5])){
        cout << "Yes";
    } 
    else{
        cout << "No";
    }
    // int N;
    // cin >> N;
    // vector<int> A(N);
    // vector<int> B(N);
    // vector<int> res(N);

    // for(int i=0;i<N;i++){
    //     cin >> A[i];
    //     B[A[i]-1]++;
    // }

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

using namespace std;
using ll = long long;

int main() {
	int x, n;
	cin >> x >> n;
	int* p = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> p[i];
	}
	sort(p, p + n);
	int i;
	bool pl = false, m = false;
	for (i = 0;i <= 100;i++) {
		int index = lower_bound(p, p + n, x + i) - p;
		if (p[index] != x + i)pl = true;
		index = lower_bound(p, p + n, x - i) - p;
		if (p[index] != x - i)m = true;
		if (pl || m)break;
	}
	if (m)cout << x - i << endl;
	else cout << x + i << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF INT64_MAX
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222


int main(void) {
  cin >> s;

  FOR(i, 0, s.length()) {
	if (s[i] == 'p') ans--;
  }

  cout << ans + (s.length() / 2) << endl;

  return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#define N (1<<17)

#include <cstdio>
#include <iostream>
#include <fstream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <vector>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;

int n, m;
int a[N];
long long prec[N], prex[N];
long long Ans;

inline void AddPre(long long pc, long long px, int L, int R)
{
	prec[L] += pc;
	prec[R] -= pc;
	prex[L] += px;
	prex[R] -= px;
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		a[i]--;
	}
	for (int i = 0;i < n - 1;i++)
	{
		if (a[i] < a[i + 1])
		{
			AddPre(a[i + 1] - a[i], 0, 0, a[i] + 1);
			AddPre(a[i + 1] - a[i], 0, a[i + 1] + 1, m + 1);
			AddPre(a[i + 1] + 1, -1, a[i] + 1, a[i + 1] + 1);
		}
		else
		{
			AddPre(m - a[i] + a[i + 1], 0, a[i + 1] + 1, a[i] + 1);
			AddPre(a[i + 1] + 1, -1, 0, a[i + 1] + 1);
			AddPre(m + a[i + 1] + 1, -1, a[i] + 1, m + 1);
		}
	}
	long long curc = 0LL, curx = 0LL;
	Ans = 9223372036854775807LL;
	for (int i = 0;i < m;i++)
	{
		curc += prec[i];
		curx += prex[i];
		Ans = min(Ans, curc + curx*(long long)(i));
	}
	printf("%lld\n", Ans);
	//system("pause");
	return 0;
}



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

using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
  char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
  vector<char*> v({token});
  while(token = strtok(NULL,", ")) v.push_back(token);
  return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
  debug() << " [" << args.back() << ": " << H << "] ";
  args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main() {
    IOS;
    int n,i;
    cin>>n;
    ll a[n];
    REP(i,0,n-1) cin>>a[i];
    ll sum=a[n-1],ans=0;
    RAP(i,n-2,0) {
        ans+=(sum*a[i])%mod;
        ans%=mod;
        (sum+=a[i])%=mod;
    }
    cout<<ans;
    return 0;   
}

Measured memory_bytes: 5168
#include<iostream>
#include<cstring>
using namespace std;
int main(){
    int n;
    cin>>n;
    char a[n+1];
    int i;
    for(i=1;i<=n;i++) cin>>a[i];
    int s=0;
    for(i=1;i<=n;i++) {
        int j;
        for(j=1;j<i;j++) if(a[i]==a[j]) break;
        if(j==i) s++;
    }
    if(s==3) cout<<"Three"<<endl;
    else cout<<"Four"<<endl;
    return 0;
}

Measured memory_bytes: 256
import itertools

while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    l = list(range(1,n+1))
    count = 0
    for v in itertools.combinations(l, 3):
        if sum(v) == x:
            count +=1
    print(count)


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

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

    int s = 0;    
    for(int i = 0;i < n-1;i++){
        for(int j = i+1;j < n;j++){
            if(a[i]>a[j]){
                if(s < a[i] - a[j]) s = a[i] - a[j];
            }else{
                if(s < a[j] - a[i]) s = a[j] - a[i];
            }
        }
    }
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(1, n-1):
	if min(p[i-1], p[i], p[i+1]) != p[i] and max(p[i-1], p[i], p[i+1]) != p[i]:
		cnt += 1

print(cnt)


Measured memory_bytes: 3064
n, k = gets.to_s.split.map{|t|t.to_i}
s = gets.to_s.chomp

a = []
s.scan(/(1*)(0*)/) do 
   a << $1.size
   a << $2.size
end

a.flatten!

ans = t = a[0, 2*k+1].reduce(0){|s,t| s+t }
# p a[0, 2*k+1]
i = 2
# p ans
while i+2*k < a.length
# p [t, a[i-1], a[i-2]]
  t = t - a[i-1] - a[i-2] + a[i+2*k-1] + a[i+2*k]
  ans = t if ans < t
  i += 2
end
 
puts ans

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

int main(){

	char line[1000],R3;
	int R1,R2;

	while(scanf("%s",line) != EOF){

	   R1 = 0;
	   R2 = 0;
	   R3 = ' ';

	   for(int i = 0; line[i] != '\0'; i++){
		   if(line[i] >= '0' && line[i] <= '9'){
			   R2 = 10*R2+(line[i]-'0');
			   if(R2 > 9999){
				   printf("E\n");
				   break;
			   }
		   }else{
			   switch(R3){
			   case '+':
				   R1 += R2;
				   break;
			   case '-':
				   R1 -= R2;
				   break;
			   case '*':
				   R1 *= R2;
				   break;
			   case ' ':
				   R1 = R2;
				   break;
			   }

			   if(R1 < 0 || R1 > 9999){
				   printf("E\n");
				   break;
			   }
			   R2 = 0;
			   R3 = line[i];
			   if(R3 == '='){
				   printf("%d\n",R1);
				   break;
			   }
		   }
	   }
	}

     return 0;
}

Measured memory_bytes: 3060
import math
import sys
from itertools import permutations
input = sys.stdin.readline

A,B,C=map(int,input().split())
K=int(input())
ans=0
while(B<=A):
    B*=2
    ans+=1
while(C<=B):
    C*=2
    ans+=1

if ans<=K:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 62180
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	ll A, B, C; cin >> A >> B >> C;
	ll ans = 0;
	if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0)ans = 0;
	else {
		ans = min(A * B, min(B * C, C * A));
	}
	cout << ans << "\n";
	

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int p, q, a, n;

int dfs(int i, int last, int prod, int c, int d)
{
    int count = 0;
    if (c * q == d * p) {
        return 1;
    }
    if (i >= n) {
        return 0;
    }
    for (int y = last; prod * y <= a; y++) {
        if ((q * (c * y + d)) <= ((d * y) * p))
            count += dfs(i+1, y, prod*y, c*y+d, d*y);
    }
    return count;
}

int main()
{
    while (true) {
        scanf("%d %d %d %d", &p, &q, &a, &n);
        if (p == 0) {
            break;
        }
        cout << dfs(0, 1, 1, 0, 1) << endl;
    }

    return 0;
}

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

using namespace std;


int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    
    long long n, d, x, y, cnt = 0;
    cin >> n >> d;
    while(n--) {
        cin >> x >> y;
        if(sqrt(abs(x * x) + abs(y * y)) <= d)
            cnt++;
    }
    cout << cnt;

}

Measured memory_bytes: 3664
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long
 
#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")
 
#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))
 
#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())
 
#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()
 
#define MX1     30001
#define MX2     1000000
#define Inf     1000000000000000
#define mod		1000000007
using namespace std;
 
lli Power(lli a,lli b)
{
    lli result=1;
 
    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }
 
        b=b>>1;
        a=(a*a)%mod;
    }
 
 return result;
}
 
int main()
{
    opt;
 
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/
    
    lli R,G,B;
    cin>>R>>G>>B;
    
    lli x=10*G+B;
    
    if(x%4)
    {
        cout<<"NO";
    }
    else
    {
        cout<<"YES";
    }
    
    
    
    
    
    
    
    
    
 
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;

ll M = 1000000007;
ll inv[200001], fac[200001], fiv[200001];
ll H, W, A, B;
ll combination(ll h, ll w) {
    return fac[h+w] * fiv[h] % M * fiv[w] % M;
}

int main() {
    cin >> H >> W >> A >> B;

    inv[1]=fac[1]=fiv[1]=inv[0]=fac[0]=fiv[0]=1;
    for (ll i = 2; i <= H+W; i++) {
        fac[i] = fac[i-1] * i % M; // n!
        inv[i] = inv[M%i] * (M-M/i) % M; // n^-1
        fiv[i] = fiv[i-1] * inv[i] % M; // (n!)^-1
    }

    ll h = H - A;
    ll w = B + 1;
    ll ans = 0LL;
    while (h >= 1 && w <= W) {
        ans  = (ans + (combination(h-1, w-1) * combination(H-h, W-w) % M)) % M;
        h--;
        w++;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main()
{
     ios_base ::sync_with_stdio(0);cin.tie(0);cout.tie(0);
     int n;
     cin>>n;
     if(n==0)
        cout <<1<<endl;
        else if(n==1)
            cout <<0<<endl;
}


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

int main(void)
{
    int n, i, index;
    int max = 0;
    int sum = 0;
    cin >> n;
    vector<int> l(n);
    for (i = 0; i < n; i++) {
        cin >> l.at(i);
        if ( l.at(i) > max) {
            max = l.at(i);
            index = i;
        }
    }

    for ( i = 0; i < n; i++) {
        if (i != index) {
            sum += l.at(i);
        }
    }

    if ( sum > max ) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 210
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef pair<int,LL> pii;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int tot=1<<15;

int n;
int t[maxn],x[maxn],y[maxn],s[maxn];
int qry(int p){
	printf("? ");
	if(p==0){
		for(int i=1;i<n;i++) printf("%d ",t[i]);
		printf("%d\n",t[n]);
	}else if(p==1){
		for(int i=1;i<n;i++) printf("%d ",x[i]);
		printf("%d\n",x[n]);
	}else{
		for(int i=1;i<n;i++) printf("%d ",y[i]);
		printf("%d\n",y[n]);
	}
	fflush(stdout);
	string s;
	cin>>s;
	if(s=="Red") return 1;
	else return -1;
} 

int a,b,beg,en;

int main(){
	//freopen("test.txt","r",stdin);
	
	cin>>n;

	
	int l=1,r=n+1,mid;
	for(int i=1;i<=n;i++) t[i]=i;
	a=qry(0);b=-1*a;
	while(l<r-1){
		mid=(l+r)>>1;
		for(int i=1;i<=n;i++) t[i]=mid+i-1;
		int tt=qry(0);
		if(tt!=a){
			r=mid;
		}else{
			l=mid;
		}
	}
	s[l]=a;s[l+n]=b;
	beg=l;en=l+n;
	int cnt=0;
	
	for(int i=1;i<n;i++) x[i]=i+beg;
//	cerr<<"beg=="<<beg<<" "<<en<<endl;
	
	for(int i=1;i<=2*n;i++)if(i<beg||i>en){
		x[n]=i;
		s[i]=qry(1);
		t[++cnt]=i;
	}
	
	for(int i=1;i<=2*n;i++)if(i>beg&&i<en){
		t[n]=i;
		s[i]=qry(0);
	}
	
	printf("! ");
	for(int i=1;i<2*n;i++) printf("%c",(s[i]==1)?'R':'B');
	printf("%c\n",(s[2*n]==1)?'R':'B');

	
	return 0;
} 

Measured memory_bytes: 724
#include <iostream>
#include <vector>
using namespace std;
int n, m, x;
const int n_max = 12;
const int m_max = 12;
int a[n_max][m_max];

int main()
{
    long long min_money = 10000000;

    cin >> n >> m >> x;
    int a[n][m];
    int c[n];
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    for (int bit = 0; bit < (1 << n); ++bit)
    {
        long long money = 0;
        int a_sum[m];
        memset(a_sum, 0, sizeof(a_sum));
        for (int i = 0; i < n; ++i)
        {
            if (bit & (1 << i))
            {
                money += c[i];
                for (int j = 0; j < m; j++)
                {
                    a_sum[j] += a[i][j];
                }
            }
        }
        //ここから条件に適するかを判定
        bool judge = true;
        for (int j = 0; j < m; j++)
        {
            judge &= (a_sum[j] >= x);
        }
        if (judge)
        {
            min_money = min(min_money, money);
        }
    }
    if (min_money == 10000000)
        cout << -1 << endl;
    else
        cout << min_money << endl;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define ll long long
#define li long int
#define ld long double
#define pl pair<long long, long long>
#define pi pair<int, int>
#define ppl pair<pl, ll>
#define ppi pair<int, pi>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LLFOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define MOD 1000000007
#define M2 998244353
//std::cout <<setprecision(30) << av << endl;
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin >> t;

    vector<pl> v;
        ll hi=3e15;
        ll lo = -3e15;
        ll p=0;
        while(pow(p, 5)<hi){
            v.push_back(make_pair(pow(p, 5), p));
            p++;
        }
        //cout << v[v.size()-1].fi -v[v.size()-2].fi << endl;
        p=-1;
        while(pow(p, 5)>lo){
             v.push_back(make_pair(pow(p, 5), p));
            p--;
        }
    while(t--){


        ll x;
        cin >> x;

        FOR(j, 0, v.size()){
            FOR(k, 0, v.size()){
                if(v[k].fi-v[j].fi==x){
                    cout << v[k].se << " " << v[j].se << endl;
                    return 0;
                }
            }
        }
    }
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    int k,t;cin>>k>>t;
    vi a(t);rep(i,t)cin>>a[i];
    sort(all(a));reverse(all(a));
    if(2*a[0]<=k&&k%2==0){
        cout<<0;return 0;
    }
    if(2*a[0]-1<=k&&k%2==1){
        cout<<0;return 0;
    }
    int b=k-a[0];
    int ans=a[0]-b-1;
    cout<<ans;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val d = List.fill(n)(sc.nextInt)

    var ans = 0
    (0 until n).foreach(i => ans += d.drop(i + 1).map(_ * d(i)).sum)
    println(ans)
  }
}

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

int N, B[110], sum;
int main() {
	cin >> N;
	for (int i = 1; i < N; i++)
		cin >> B[i];
	sum = B[1] + B[N - 1];
	for (int i = 1; i < N-1; i++)
		sum += min(B[i], B[i + 1]);
	cout << sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll a,b,n;
  cin >> n >> a >> b;
  //奇数間隔
  if(abs(a-b)%2){
      ll ans=0;
      ans+=min(a-1,n-b);
      ans+=(b-a+1)/2;
      cout << ans << endl;
    }
  else{
    cout << abs(a-b)/2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define task "abc171"
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// Head:
// Source:
const int maxn = 2e5 + 7;
int n;
int a[maxn], k, ans = 0;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen(task".inp","r",stdin);
    freopen(task".out","w",stdout);
#endif
    cin>>n>>k;
    rep(i, 1, n + 1) cin>>a[i];
    sort(a + 1, a + 1 + n);
    rep(i, 1, k + 1) ans += a[i];
    cout<<ans;  

}



Measured memory_bytes: 3672
<?php
  $n = trim(fgets(STDIN));
  $judge = $n % 10;
  switch($judge){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      echo "hon";
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      echo "pon";
      break;
    case 3:
      echo "bon";
      break;
  }
?>

Measured memory_bytes: 16032
package main

import (
	"fmt"
	"math"
)

func main() {
	var x, a, b float64
	fmt.Scan(&x, &a, &b)

	if math.Abs(a-x) > math.Abs(b-x) {
		fmt.Println("B")
	} else {
		fmt.Println("A")
	}
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;

int main()
{
	int n; cin>>n;
	ll a[200020], b[200020];
	ll cnt=0;
	bool ok[200020]={};
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	priority_queue<P> que;
	for(int i=0; i<n; i++){
		cin>>b[i];
		if(a[i]==b[i]) ok[i]=1;
		else que.push({b[i], i});
		if(a[i]>b[i]){
			cout<<-1<<endl;
			return 0;
		}
	}
	ll ans=0;
	while(!que.empty()){
		P p=que.top(); que.pop();
		int x=p.second;
		ll b1=b[(x-1+n)%n], b2=b[(x+1)%n];
		if(b[x]-b1-b2<=0){
			cout<<-1<<endl;
			return 0;
		}
		ll t=(b[x]-a[x])/(b1+b2);
		if(t==0){
			cout<<-1<<endl;
			return 0;
		}
		b[x]-=t*(b1+b2);
		ans+=t;
		if(a[x]==b[x]){
			ok[x]=1;
		}else{
			que.push({b[x], x});
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 9328
public class Main{
  static int count;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int a, b, tmp;

    for(;;){
      a = sc.nextInt(); b = sc.nextInt();
      if(a == 0 && b == 0)break;
      if(a < b){
        tmp = a; a = b; b = tmp;
      }
      count = 0;
      out.println(gcd(a, b) + " " + count);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int gcd(int x, int y){
    count++;
    if(x % y == 0)return y;
    else return gcd(y, x % y);
  }
}

Measured memory_bytes: 24368
/**
 *    author:  math2do
 *    created: 04.05.2020 03:12:59 IST
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  set <int> st;
  for (int i = 0; i < k; i++) {
    int di;
    cin >> di;
    for (int j = 0; j < di; j++) {
      int sn;
      cin >> sn;
      st.insert(sn);
    } 
  } 
  cout << n - (int) st.size() << endl;
  return 0;
}


Measured memory_bytes: 3672
import numpy as np

mod = 998244353
N = int(input())
A = [int(input()) for i in range(N)]
S = sum(A)

# D1[i][r]: i個塗った時点でR=rとなる場合の数
D1 = np.zeros((N+1, S+1), dtype=int)
D1[0][0] = 1
# D2[i][r]: i個塗った時点でR=r, B=0となる場合の数
D2 = np.zeros((N+1, S+1), dtype=int)
D2[0][0] = 1

for i in range(N):
    D1[i+1] += D1[i] * 2
    D1[i+1][A[i]:] += D1[i][:-A[i]]
    D1[i+1] = D1[i+1] % mod

    D2[i+1] += D2[i]
    D2[i+1][A[i]:] += D2[i][:-A[i]]
    D2[i+1] = D2[i+1] % mod

border = (S + 1) // 2

result = 3 ** N - 3 * sum(D1[N][border:]) + (border * 2 == S) * 3 * D2[N][border]

print(result % mod)


Measured memory_bytes: 433620
N,C=map(int,input().split())
ans=[[] for i in range(10**5*2+2)]
for i in range(N):
  s,t,c=map(int,input().split())
  if -c in ans[2*s]:
    d=ans[2*s].index(-c)
    ans[2*s].pop(d)
  else:
    ans[2*s-1].append(c)
  if c in ans[2*t-1]:
    d=ans[2*t-1].index(c)
    ans[2*t-1].pop(d)
  else:
    ans[2*t].append(-c)
timetable=[0 for j in range(200002)]
for i in range(10**5*2+2):
  for j in range(len(ans[i])):
    if ans[i][j]>0:
      timetable[i]+=1
    else:
      timetable[i]-=1
res=0
for i in range(1,200002):
  timetable[i]+=timetable[i-1]
  res=max(res,timetable[i])
print(res)

Measured memory_bytes: 27656
#include <stdio.h>
#include <string.h>

int main()
{

    char original[20];
    scanf("%s", original);

    int len = strlen(original);
    int p;
    for (int i = 1; i < len; i++)
    {
        if(original[i]=='B'){
            p = 1;
            while (i - p >= 0)
            {
                if (original[i - p]!='B'){
                    original[i - p] = 'B';
                    break;
                }
                p++;
            }
        }
    }

    for (int i = 0; i < len; i++)
    {
        if (original[i] != 'B')
        {
            printf("%c",original[i]);
        }
    }

    printf("\n");
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int main(){
    int a,b;
    int i=0, j,k;
    int *s;
    scanf("%d",&a);
    s = (int *)malloc(a * sizeof(int));
    while(i < a){
      scanf("%d",&s[i]);
      i++;
    }
     printf("%d",s[0]);
     for(k = 1;k < a;k++){
	  printf(" %d",s[k]);
        }
        printf("\n");
    for(i = 1;i < a;i++){
        b = s[i];
        j = i - 1;
        while(j >= 0 && s[j] > b){
        s[j+1] = s[j];
        j--;
        s[j+1]=b;
        }
	 printf("%d",s[0]);
     for(k = 1;k < a;k++){
	  printf(" %d",s[k]);
        }
        printf("\n");
    }
    free(s);
    return 0;
}




Measured memory_bytes: 2036
n,m=[int(i) for i in input().split()]
es=set()
for _ in range(m):
    u,v=map(int,input().split())
    u,v=u-1,v-1
    es|={(u,v),(v,u)}

p=[[0]]
x=0
while p:  
  p1=p.pop()
  if len(p1)==n:
    x+=1
  else:
    for l0,l1 in es:
      if l0==p1[len(p1)-1] and l1 not in p1:
          p.append(p1+[l1])

print(x)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000000000
#define MOD 1000000007
#define N 200005
#define M 1000005
#define LOG 30
#define KOK 32000
#define EPS 0.000000001
using namespace std;

int n,val;
int ans;
map<int,vector<int> > mp;
map<int,int> fr,vis,ok,pro;

int dfs(int node,int ata) {

	int tot=0;

	vis[node]=1;

	for(int i:mp[node]) {

		if(i==ata) continue ;

		int ret=dfs(i,node);

		tot+=ret;

	}

	int add=min(fr[node],tot);

	ans+=add;

	fr[node]-=add;

	if(fr[node]>0 && pro[node]) {

		ans+=fr[node]/2;

		fr[node]-=fr[node]/2*2;

	}

	return fr[node];

}

int main() {
 
	//freopen("input.txt","r",stdin);

	for(int i=0;i<=LOG;i++) pro[pw(i)]=1;

	scanf("%d",&n);

	for(int i=1;i<=n;i++) {

		scanf("%d",&val);

		ok[val]=1;

		fr[val]++;

	}

	for(auto x:fr) {

		for(int j=0;j<=LOG;j++) {

			if(pw(j)>=x.st && pw(j)-x.st!=x.st && ok[pw(j)-x.st]) {

				mp[x.st].pb(pw(j)-x.st);

			}

		}

	}

	for(auto x:fr) {

		if(!vis[x.st]) {

			dfs(x.st,0);

		}

	}

	printf("%d",ans);

}


Measured memory_bytes: 78720
#include <stdio.h>
int Partition(int *A,int p,int r){
  int j,n1,n2,x,i;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      n1=A[i];
      A[i]=A[j];
      A[j]=n1;
    }
  }
  n2=A[i+1];
  A[i+1]=A[r];
  A[r]=n2;
  return i+1;
}

main(){
  int n,i,A[100000],x;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  x=Partition(A,1,n);
  for(i=1;i<=n;i++){
    if(i!=x && i!=n)printf("%d ",A[i]);
    else if (i==x)printf("[%d] ",A[i]);
    else if(i== n) printf("%d",A[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 992
#include <iostream>
#include <complex>

int main()
{
	int n, a, b;
	std::cin >> n >> a >> b;
	
	if (abs(a - b - 1) % 2 == 0)
	{
		std::cout << "Borys";
	}
	else
	{
		std::cout << "Alice";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 123;
#define int long long 
int n, m;
pair <int, int> a[maxn];
string s, t;
main () { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;

    int cur = 1;
    if(n % 2) {
    	cout << 0;
    	exit(0);
    }

    int ans = 0;
    for(int i = 1; i; i++) {
		if(cur * 5. > n * 1.) break;
		cur *= 5;
	
		int res = n / cur;
		int rem = res % 2;
		res /= 2;
		//res -= rem;
		ans += res;
    }
    cout << ans;
}




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

int height[20010];
char c[20010];
int lakenum = 0,lakeS[10010];
int getS(int, int);

int main() {
	//input
	int i = 0,n;
	while (cin >> c[i]) {
		i++;
	}
	n = i;

	height[0] = 0;
	for (int i = 1; i <= n; i++) {
		switch (c[i-1]) {
		case'/':
			height[i] = height[i - 1] + 1;
			break;
		case'\\':
			height[i] = height[i - 1] - 1;
			break;
		case'_':
			height[i] = height[i - 1];
			break;
		}
	}

	//debug
	//for (int i = 0; i <= n; i++) cerr << height[i] << " ";

	//research
	for (int i = 0; i < n; i++) {
		bool islake = false;
		int next;
		int h = height[i];
		int j = i + 1;
		if (height[j] == h) continue;
		j++;
		while (j <= n) {
			if (height[j] == h  && height[i+1] == h-1) {
				next = j;
				lakeS[lakenum++] = getS(i, next);
				islake = true;
				//cerr << "lake" << lakenum << ": " << i << " to " << next << " S:" << getS(i,next) << endl;
				break;
			}
			j++;
		}
		if (islake) i = next-1;
	}

	int sumS = 0;
	for (int i = 0; i < lakenum; i++) sumS += lakeS[i];
	cout << sumS << endl;
	cout << lakenum ;
	if (lakenum != 0) cout << " ";
	else cout << endl;
	for (int i = 0; i < lakenum; i++) {
		cout << lakeS[i];
		if (i == lakenum - 1) cout << endl;
		else cout << " ";
	}
	


	return 0;
}

int getS(int first, int last) {
	int h = height[first];
	int s2 = 0;
	for (int i = first; i < last; i++) {
		s2 += (h - height[i]) + (h - height[i + 1]);
	}
	return s2 / 2;
}

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


template<class T>
class Dinic {
private:

    struct edge {
        T to, cap, rev;
        edge(T to, T cap, T rev) :to(to), cap(cap), rev(rev) {}
    };

    T V;
    vector<vector<edge>> g;
    vector<T> level;      // sourceからの距離
    vector<T> itr;        // どこまで調べ終わったか

public:
    Dinic(T V) :V(V), g(V, vector<edge>()) {}

    void add_edge(T from, T to, T cap) {
        g[from].emplace_back(to, cap, g[to].size());
        g[to].emplace_back(from, 0, g[from].size()-1);
    }

    // sourceからの最短路を幅優先で探索
    void bfs(T s) {
        level = vector<T>(V, -1);
        queue<T> que;
        que.push(s);
        level[s] = 0;
        while (que.size()) {
            int v = que.front(); que.pop();
            for (edge &e : g[v]) {
                if (e.cap > 0 and level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }
    }

    // v->tの増加路を探す
    T dfs(T v, T t, T f) {
        if (v == t) return f;
        for (T& i = itr[v]; i < g[v].size(); ++i) {
            edge& e = g[v][i];
            if (e.cap > 0 and level[v] < level[e.to]) {
                int d = dfs(e.to, t, min(f, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    g[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    T max_flow(T s, T t) {
        T flow = 0, f;
        while (true) {
            bfs(s);
            if (level[t] < 0) return flow;
            itr = vector<T>(V, 0);
            while ((f = dfs(s, t, numeric_limits<T>::max())) > 0) {
                flow += f;
            }
        }
    }
};

int main() {
    int N;
    cin >> N;
    Dinic<ll> flow(2*N+4);
    vector<ll> A(N+1) , B(N);
    rep(i, N+1) cin >> A[i];
    rep(i, N) cin >> B[i];

    int s = 0, t = 1;
    rep(i, N) {
        flow.add_edge(s, i+2, B[i]);

        flow.add_edge(i+2, i+2+N, A[i]);
        //flow.add_edge(i+2+N, t, A[i]);

        flow.add_edge(i+2, i+2+N+1, A[i+1]);
        //flow.add_edge(i+2+N+1, t, A[i+1]);
    }

    rep(i, N+1) {
        int v = i+2+N;
        flow.add_edge(v, t, A[i]);
    }

    cout << flow.max_flow(s, t) << endl;


}


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

int main() {
  int H, W;
  string a;
  cin >> H >> W;
  
  for(int i = 0; i < W + 2; i++){
    cout << '#';
  }
  
  cout << endl;
  
  for(int i = 0; i < H; i++){
    cout << '#';
    cin >> a;
    cout << a;
    cout << '#' << endl;
  }
  
   for(int i = 0; i < W + 2; i++){
   cout << '#';
  }
  
  cout << endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  vector<vector <char> > a (h,vector<char> (w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
    }
  }
  for(int i=0;i<w+2;i++){
    cout<<'#';
  }
  cout<<'\n';
  
  for(int i=0;i<h;i++){
    cout<<'#';
    for(int j=0;j<w;j++){
      cout<<a[i][j];
    }
    cout<<'#'<<endl;
  }
  for(int i=0;i<w+2;i++){
    cout<<'#';
  }
}

Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i

if n == 1
  puts 0
  exit
elsif n == 2
  puts 2
  exit
end

zero = 10.pow(n, MOD) - 9.pow(n, MOD)
nine = 10.pow(n, MOD) - 9.pow(n, MOD)
soto = 8.pow(n, MOD)
puts (soto + zero + nine - 10.pow(n, MOD) + MOD*10) % MOD

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

int max_gcd(int n, int m) {
    if (n == 1) return m;
    for (int gcd = m / n; gcd > 0; --gcd) {
        if (m % (gcd * n) % gcd == 0) return gcd;
    }
    return 1;
}

int main() {
    int N, M;
    std::cin >> N >> M;
    std::cout << max_gcd(N, M) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),_ed=(b);i<=_ed;++i)
#define DREP(i,a,b) for(int i=(a),_ed=(b);i>=_ed;--i)
#define mp(x,y) make_pair((x),(y))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x;
}

const int mod=1000000007;
int n,a[200005],b[200005],f[4005][4005],fac[8005],ifc[8005];
#define f(x,y) f[x+2000][y+2000]
inline void inc(int& x,int y){x=x+y<mod?x+y:x+y-mod;}
inline void dec(int& x,int y){x=x-y>=0?x-y:x-y+mod;}
inline int power(int b,int n){int ans=1;for(;n;n>>=1,b=1ll*b*b%mod)if(n&1)ans=1ll*ans*b%mod;return ans;}
inline int C(int n,int m){return (n<0||m<0||n<m)?0:1ll*fac[n]*ifc[m]%mod*ifc[n-m]%mod;}

int main(){
	// freopen("in.in","r",stdin);
	REP(i,fac[0]=1,8001)fac[i]=1ll*fac[i-1]*i%mod;
	ifc[8001]=power(fac[8001],mod-2);
	DREP(i,8001,1)ifc[i-1]=1ll*ifc[i]*i%mod;
	n=read();
	REP(i,1,n){
		a[i]=read(),b[i]=read();
		++f(-a[i],-b[i]);
	}
	REP(i,-2000,2000)REP(j,-2000,2000)
		inc(f(i+1,j),f(i,j)),inc(f(i,j+1),f(i,j));
	int ans=0;
	REP(i,1,n)inc(ans,f(a[i],b[i]));
	REP(i,1,n)dec(ans,C(a[i]*2+b[i]*2,a[i]*2));
	ans=1ll*ans*(mod+1)/2%mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 64512
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n, m;
    cin >> n >> m;
    vector<bool> flg(n+1, false);
    rep(i, m) {
        int a;
        cin >> a;
        flg[a] = true;
    }
    vector<ll> dp(n+1, 0);
    dp[0] = 1;
    rep(i, n) {
        if (!flg[i+1]) dp[i+1] = (dp[i+1] + dp[i]) % mod;
        if (i+2>n) continue;
        if (!flg[i+2]) dp[i+2] = (dp[i+2] + dp[i]) % mod;
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
def main():
    n, w = map(int, input().split())
    weight_list = []
    value_list = []
    wv_list = []
    for i in range(n):
        weight, value = map(int, input().split())
        weight_list.append(weight)
        value_list.append(value)
    
    dp = [[0] * (w+1) for i in range(n)]
    for i in range(w+1):
        if weight_list[0] <= i:
            dp[0][i] = value_list[0]
    for i in range(1, n):
        for j in range(0, w+1):
            if weight_list[i] <= j:
                # print(dp[i-1][j-weight_list[i]]+value_list[i])
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - weight_list[i]] + value_list[i])
            else:
                dp[i][j] = dp[i - 1][j]
    print(dp[-1][-1])
if __name__ == "__main__":
    main()

Measured memory_bytes: 147492
# C - Colorful Leaderboard

N = int(input())
a = list(map(int, input().split()))

n_gray_to_red = len(set([x//400 for x in a if x < 3200]))
n_3200_and_above = len([x for x in a if x >= 3200])

print(max(n_gray_to_red, 1), n_gray_to_red + n_3200_and_above)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define reg register
using namespace std;
bool v[222];
int main()
{
    string a;
	bool v[2]={0};
    cin>>a;
    for(reg int i=0;i<a.length();++i)
	{
        if(a[i]=='C') v[0]=1;
        if(a[i]=='F'&&v[0])  v[1]=1;
    }
    if(v[1]) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 768