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

struct SegmentTree {
private:
    int n;
    vector<int> node;
public:
    SegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void add(int k, int val) {
        k += (n - 1);
        node[k] += val;

        while(k > 0) {
            k = (k - 1) / 2;
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    int getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];

        int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        int vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};


int main() {
  int N, Q;
  string S;
  cin >> N >> S >> Q;
  vector< SegmentTree > seg(26, SegmentTree(vector<int>(N, 0)) );
  vector< vector< int > > CA(26, vector<int>(N+1,0));
  REP(i,N) {
    CA[S[i]-'a'][i+1] = 1;
  }
  REP(i,N) {
    REP(j,26) CA[j][i+1] += CA[j][i];
  }
  REP(i,Q) {
    int a;
    cin >> a;
    if ( a==1 ) {
      int b;
      string c;
      cin >> b >> c;
      b--;
      if ( S[b] != c[0] ) {
        seg[S[b]-'a'].add(b, -1);
        seg[c[0]-'a'].add(b, 1);
        S[b] = c[0];
      }
    } else {
      int l,r;
      cin >> l >> r;
      int num = 0;
      REP(j,26) {
        if ( (CA[j][r] - CA[j][l-1]) + seg[j].getsum(l-1,r) > 0) num++;
      }
      cout << num << endl;
    }
  }
}


Measured memory_bytes: 160092
fun main(args : Array<String>) {
    val (a, b, c, d) = readLine()!!.split(" ").map { it.toLong() }
    val ans = mutableListOf<Long>()

    // plus * plus
    if (b >= 0 && d >= 0) {
        ans.add(b * d)
    }

    // minus * minus
    if (a < 0 && c < 0) {
        ans.add(a * c)
    }

    // plus * minus
    if (a >= 0 && d < 0) {
        ans.add(a * d)
    }

    // minus * plus
    if (b < 0 && c >= 0) {
        ans.add(b * c)
    }

    println(ans.max()!!)
}

Measured memory_bytes: 36444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include <vector>
using namespace std;
int main() {
  int n;
  vector <int> a;
  scanf("%d", &n);
  long long ans = 0;
  map <int, int> cnt;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
    if (cnt[x] > 1)
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  a.resize(unique(a.begin(), a.end()) - a.begin());
  reverse(a.begin(), a.end());
  for(int i = 0; i < a.size(); i++) {
    if (cnt[a[i]] > 4) {
      ans = max(ans, 1ll * a[i ] * a[i]);
    } 
    if (i - 1 >= 0) {
      ans = max(ans, 1ll * a[i] * a[i - 1]);
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=42, Max=(1<<17)+10, MOD=1e9+7;
ll n, x, y, z, f[N][Max], sum=1, ans;
inline ll M(ll a){return a%MOD;}

void work(){
	for(int i = 0; i < n; i++) sum = M(sum*10);
	ll cnt = (1<<x+y+z) -1;
	ll tot = (1<<x-1) | (1<<x+y-1) | (1<<x+y+z-1); 
	f[0][0] = 1;
	for(int i = 1; i <= n; i++) 
		for(int j = 0; j <= cnt; j++) 
			for(int h = 1;h <= 10; h++){
				ans = (j<<h)|(1<<h-1);
				ans &= cnt;
				if((ans&tot)!=tot) f[i][ans] = M(f[i][ans]+f[i-1][j]);
			}
	for(int i = 0; i <= cnt; i++)
		sum = M(sum-f[n][i]+MOD);
}

int main(){
	scanf("%lld%lld%lld%lld",&n,&x,&y,&z);
	work();
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 42240
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let n: i32 = buf.trim().parse().unwrap();

    let mut elements = vec![];
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.trim().split_whitespace();
    for _ in 0..n {
        let element: i64 = iter.next().unwrap().parse().unwrap();
        elements.push(element);
    }
    println!(
        "{} {} {}",
        elements.iter().min().unwrap(),
        elements.iter().max().unwrap(),
        elements.iter().sum::<i64>()
    );
}



Measured memory_bytes: 5040
N, X=map(int, input().split())

def A(x):
  return pow(2, x+2)-3

def P(x):
  return pow(2, x+1)-1

def f(n, x):
  if n==0:
    return 1
  if n==1:
    return min(x-1, 3)
  if x<=n:
    return 0
  if A(n)//2+1==x:
    return P(n-1)+1
  if A(n)==x:
    return P(n)
  if A(n)//2>=x:
    return f(n-1, x-1)
  return P(n-1)+1+f(n-1, x-A(n)//2-1)

print(f(N, X))

Measured memory_bytes: 9196
#include <iostream>
#include <cmath>

int main() {
    int A, B, C, K;
    std::cin >> A >> B >> C >> K;

    int max = std::max(std::max(A, B), C);
    int result = (max << K) - max + A + B + C;

    std::cout << result << std::endl;

    return 0;
}


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

using namespace std;


void solve() {
    int N; cin >> N;
    vector<pair<int, int>> red(N), blue(N);
    for (int i = 0; i < N; i++) {
        int a, b; cin >> a >> b;
        red[i] = make_pair(a, b); //(x, y)
    }
    for (int i = 0; i < N; i++) {
        int c, d; cin >> c >> d;
        blue[i] = make_pair(c, d); //(x, y)
    }

    sort(blue.begin(), blue.end());
    
    vector<bool> use(N);
    int ans = 0;

    for (int i = 0; i < N; i++) {
        int ma = -1, maxj;
        bool flag = false;
        for (int j = 0; j < N; j++) {
            if (red[j].first < blue[i].first && red[j].second < blue[i].second && red[j].second > ma && !use[j]) {
                ma = red[j].second;
                maxj = j;
                flag = true;
            }
        }
        if (flag) {
            use[maxj] = true;
            ans++;
        }
    }

    cout << ans << endl;
}


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

Measured memory_bytes: 256
import bisect
from collections import deque
N = int(input())
A = [int(input()) for n in range(N)]

tree = deque([[A[0]]])
leaf = deque([A[0]])
for n in range(1,N):
    a = A[n]
    pos = min(n-1,bisect.bisect_left(leaf,a)-1)
    if pos==-1:
        tree.appendleft([a])
        leaf.appendleft(a)
    else:
        tree[pos].append(a)
        leaf[pos] = a
print(len(tree))

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

int main(){
	int N;
	cin >> N;
	vector<int> d;
	int tmp;

	for(int i = 0; i < N; i++){
		cin >> tmp;
		d.push_back(tmp);
	}
	sort(d.begin(), d.end());
	cout << d[N/2] - d[N/2-1] << endl;
}


Measured memory_bytes: 892
n, k = map(int, input().split())
p = [(int(p) + 1) / 2. for p in input().split()]
sumexp = sum(p[:k])
maxexp = sumexp
for i in range(n-k):
  sumexp += p[i+k] - p[i]
  if sumexp > maxexp:
    maxexp = sumexp
print(maxexp)

Measured memory_bytes: 23588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dbg(x) cerr << #x << " : " << x << endl;
typedef long double ld;
int main(){
    int n;
    cin >> n;
    vector<ld> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    cout.precision(12);
    cout << fixed;
    ld ans=0;
    for(int i=0;i<n;i++) ans+=1/a[i];
    ans=1/ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;using ull=unsigned ll;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v).begin(),(v).end()
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define bit(n) (1ll<<(n))
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(a>b){a=b;return 1;}return 0;}
#define cut(n, Min, Max) max(min(n,Max),Min)
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<v.first<<' '<<v.second;return o;}

int main(){
    int n,m;
    cin>>n>>m;
    vector<P> mise;
    REP(i,n){
        int a,b;
        cin>>a>>b;
        mise.push_back({a,b});
    }
    sort(all(mise));
    ll ans=0;
    REP(i,n){
        ll ko=min(mise[i].second,m);
        //cerr<<ko<<endl;
        ans+=mise[i].first*ko;
        m-=ko;
        if(m==0)break;
    }
    cout<<ans<<endl;
    return 0;
}


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

    
    int a,x=0;
    cin>>a;
   
    if(a%10==1){
        x++;
    }
     if ((a/10)%10==1){
        x++;
    }
     if ((a/100)%10==1){
        
    x++;
    }
    cout<<x;
    

    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int n, i, j, count, temp, minj, a[100];
	
	scanf("%d", &n);
	
	for(i=0; i<n; i++)
		scanf("%d", &a[i]);
	
	count = 0;
	
	for(i=0; i<n; i++){
		minj = i;
		
		for(j=i;j<n;j++){
			if(a[j] < a[minj]){
				minj = j;
			}
		}
		
		if(minj != i){
			temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
			
			count++;
		}
	}
	
	for(i=0; i<n; i++){
		if(i != n-1){
			printf("%d ", a[i]);
		}else{
			printf("%d\n", a[i]);
		}
	}
	
	printf("%d\n", count);
	
	return 0;
}

Measured memory_bytes: 600
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

r += p[:x]
r += q[:y]
r.sort(reverse=True)

ans = sum(r[:x + y])
print(ans)


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

//Binomial Coefficients
const long long c_max = 1000003;
const long long mod = 1e9+7;
long long fac[c_max], finv[c_max], inv[c_max];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (long long i = 2; i < c_max; 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;
    }
}
// 二項係数計算
long long COM(long long comn, long long comk){
    if (comn < comk) return 0;
    if (comn < 0 || comk < 0) return 0;
    return fac[comn] * (finv[comk] * finv[comn - comk] % mod) % mod;
}

void solve_A(){
	int r;
    cin >> r;
    cout << r*r << endl;
}

void solve_B(){
	int n,i;
    char c[505];
    bool ans=true;
    cin >> n >> c;
    if(n%2==1){
        cout << "No" << endl;
        ans=false;
    } else {
        for(i=0;i<n/2;i++){
            if(c[i]!=c[n/2+i]){
                cout << "No" << endl;
                ans=false;
            }
        }
    }
    if(ans) cout << "Yes" << endl;
}

void solve_C(){
	int n,i,f=1;
    double x[15],y[15],ans=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> x[i] >> y[i];
        f*=(i+1);
    }
    vector<int> p;
    for(i=0;i<n;i++) p.push_back(i);
    do{
        double memo;
        for(i=1;i<n;i++){
            memo=(x[p[i-1]]-x[p[i]])*(x[p[i-1]]-x[p[i]])+(y[p[i-1]]-y[p[i]])*(y[p[i-1]]-y[p[i]]);
            memo=sqrt(memo);
            ans+=memo;
        }
    }while(next_permutation(p.begin(),p.end()));
    ans=ans/(double)f;
    printf("%.13lf\n",ans);
}

void solve_D(){
	long long x,y,n,i;
    bool t=true;
    cin >> x >> y;
    if((x+y)%3!=0){
        cout << "0" << endl;
    } else {
        n=(x+y)/3;
        if(x-n<0||2*n-x<0){
            cout << "0" << endl;
        } else {
            COMinit();
            cout << COM(n,x-n) << endl;
        }
    }
}

int main() {
	// your code goes here
	//solve_A();
    solve_B();
    //solve_C();
    //solve_D();
	return 0;
}

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

int k;
bool used[1000002];

int main(){
	memset(used,0,sizeof used);
	cin >> k;
	int tmp=7, ans=1;
	while(!used[tmp]){
		used[tmp]=1;
		tmp%=k;
		if (tmp==0){
			cout << ans << "\n";
			return 0;
		}
		tmp*=10;
		tmp%=k;
		tmp+=7;
		tmp%=k;
		ans++;
	}
	cout << -1 << "\n";
}

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)

  int d, t, s;
  cin >> d >> t >> s;
  cout << ((d <= t * s) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int N = 0;
int A[210];
int ans = 0;

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    
    while (true) {
        bool flag = false;
        for (int i = 0; i < N; i++) {
            if (A[i] % 2 == 0) A[i] /= 2;
            else flag = true;
        }
        if (flag) break;
        ans++;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
     ll n,k,i;
     cin>>n>>k;
     ll arr[n];
     for(i=0;i<n;i++)
     {
         cin>>arr[i];
     }
     ll ans = (n-1)/(k-1);
     if((n-1)%(k-1)!=0)
     {
         ans++;
     }
     cout<<ans<<endl;
}


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

int main() {
	vector <vector<int>> A(3, vector<int> (3));
	for (int i=0; i<3; i++){
	    for (int j=0; j<3; j++){
	        cin >> A.at(i).at(j);
	    }
	}
	int N;
	cin >> N;
	for (int i=0; i<N; i++){
	    int B;
	    cin >> B;
	    for (int j=0; j<3; j++){
	        for (int k=0; k<3; k++){
	            if (A.at(j).at(k)==B) A.at(j).at(k)=0;
	        }
	    }
	}
	bool bingo=false;
	for (int i=0; i<3;i++) {
	    if(A.at(i).at(0)==0 && A.at(i).at(1)==0 &&A.at(i).at(2)==0){
	    bingo=true;
	    }
	}
	for (int i=0; i<3; i++){
	    if (A.at(0).at(i)==0 && A.at(1).at(i)==0 && A.at(2).at(i)==0) bingo=true;
	}
	if (A.at(0).at(0)==0 &&A.at(1).at(1)==0&&A.at(2).at(2)==0) bingo=true;
	if (A.at(2).at(0)==0 &&A.at(1).at(1)==0&&A.at(0).at(2)==0) bingo=true;
	if (bingo) cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>

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

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;

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

    int x,n; cin >> x >> n;
    std::unordered_set<int> p; 
    rep(i,n){
        int a; cin >> a;
        p.insert(a);
    }

    int ans = -100000;
    
    for(int i=-1; i<=105; i++){
        if(p.find(i) == p.end() && abs(ans-x) > abs(i-x)) ans = i;
    }

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

Measured memory_bytes: 3544
// '
#include <bits/stdc++.h>
// #include <bits/extc++.h>
using namespace std;
// using namespace __gnu_pbds;
typedef unsigned short sint;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
const ld TAU=2*acos(-1);
const ld eps=1e-8;
const int inf=1e9+99;
const ll linf=1e18+99;

const int N=100<<10;
int n;
vector<int> adj[N];
int cc[N],tt[N];
pair<int,int> topush[12][N];

int32_t main() {
	int m; scanf("%d%d",&n,&m);
	for(;m--;) {
		int u,v; scanf("%d%d",&u,&v);
		adj[u].pb(v);
		adj[v].pb(u);
	}

	int q; scanf("%d",&q);
	for(int i=1;i<=q;i++) {
		int v,d,c; scanf("%d%d%d",&v,&d,&c);
		topush[d][v]={i,c};
	}
	for(int d=10;d>=0;d--) {
		for(int u=1;u<=n;u++) {
			int i=topush[d][u].fi;
			int c=topush[d][u].se;
			if(!i) continue;
			if(i>tt[u]) tt[u]=i, cc[u]=c;
			if(!d) continue;
			for(int v:adj[u]) {
				if(i>topush[d-1][v].fi) topush[d-1][v]=topush[d][u];
			}
		}
	}
	for(int i=1;i<=n;i++) printf("%d\n",cc[i]);
}








Measured memory_bytes: 16888
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
#include<numeric>
using namespace std;
typedef long long int lli;
#define rep(i,n) for(lli i = 0;i<((lli)(n));i++)
#define reg(i,a,b) for(lli i = ((lli)(a));i<=((lli)(b));i++)
#define irep(i,n) for(lli i = ((lli)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(lli i = ((lli)(b));i>=((lli)(a));i--)
typedef pair<lli, lli> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprllif(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	lli n; cin >> n;
	vector<lli> a(n*3, 0);
	rep(i, n*3) cin >> a[i];
	
	lli s[2][n+1];
	pque(lli) q[2];
		
	rep(i, n){
		q[0].push(a[i]);
		q[1].push(-a[n*2+i]);
	}
	
	s[0][0] = accumulate(a.begin(), a.begin() + n, 0ll);
	s[1][0] = -accumulate(a.begin() + n*2, a.end(), 0ll);;
	
	rep(i, n){
		q[0].push(a[n+i]);
		s[0][i+1] = s[0][i] + a[n+i] - q[0].top();
		q[0].pop();
		q[1].push(-a[n*2-1-i]);
		s[1][i+1] = s[1][i] - a[n*2-1-i] - q[1].top();
		q[1].pop();
	}

	lli ans = -LINF;
	rep(i, n+1) ans = max(ans, s[0][i] + s[1][n-i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5996
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

int main() {
    int N; cin >> N;
    vector<int>A(N);
    bool f=false;
    rep(i,N) {
        cin >> A[i];
        if(A[i]%2==1){
            f=true;
        }
    }

    if(f)
        cout << "first" << endl;
    else
        cout << "second" << endl;

    return 0;
}

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

int main(){
  
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i=0; i<n; i++) cin >> p.at(i);
  int m = 0;
  for (int i=0; i<n; i++) {
    m = max(m,p[i]);
  }
  int ans = 0;
  for (int i=0; i<n; i++) ans+=p.at(i);
  cout << ans-(m/2) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a, b, c, d;
	scanf("%d", &a);
	d = a % 10;
	a /= 10;
	c = a % 10;
	a /= 10;
	b = a % 10;
	a /= 10;
	if (a + b + c + d == 7)
		printf("%d+%d+%d+%d=7\n", a, b, c, d);
	else if (a + b + c - d == 7)
		printf("%d+%d+%d-%d=7\n", a, b, c, d);
	else if (a + b - c + d == 7)
		printf("%d+%d-%d+%d=7\n", a, b, c, d);
	else if (a + b - c - d == 7)
		printf("%d+%d-%d-%d=7\n", a, b, c, d);
	else if (a - b + c + d == 7)
		printf("%d-%d+%d+%d=7\n", a, b, c, d);
	else if (a - b + c - d == 7)
		printf("%d-%d+%d-%d=7\n", a, b, c, d);
	else if (a - b - c + d == 7)
		printf("%d-%d-%d+%d=7\n", a, b, c, d);
	else
		printf("%d-%d-%d-%d=7", a, b, c, d);
	return 0;
}

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int h, w; 
    while(true){
        cin >> h >> w;
        if(h == 0 && w == 0)break;
        for (int i = 0; i < h; i++){
            for (int e = 0; e < w; e++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3160
using System;
class Program{
  static void Main(string[] args){
    int t, a, b;
    string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
    t = int.Parse(str[0]);
    a = int.Parse(str[1]);
    b = int.Parse(str[2]);
    int cnt = Math.Min(t*a, b);
    Console.WriteLine(cnt);//改行付き出力
    

    
  }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; i++) cin >> vec.at(i);
	//vecの中のj番目=j(配列内最大)を取り除いていくゲーム
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		int max_match = 0;
		for (int j = 0; j < vec.size(); j++) {
			if (j + 1 == vec.at(j)) {
				if (max_match < vec.at(j)) max_match = vec.at(j);
			}
		}
		if (max_match == 0) {
			cout << -1 << endl;
			ans.clear();
			break;
		}
		else {
			ans.at(i) = max_match;
		}
		vec.erase(vec.begin() + max_match - 1);
	}
	reverse(ans.begin(), ans.end());
	if (ans.size() == n) {
		cout << ans.at(0);
		for (int i = 1; i < n; i++) cout << endl << ans.at(i);
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for (int i=a;i<=b;i++)
using namespace std;
int n,a[100010],ans=0;
inline ll read()
{
    ll 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;
}
int main()
{
	n=read();
	For(i,1,n)
	{
		int x=read();
		a[x]++;a[x+1]++;a[x+2]++;
	}
	For(i,0,100005)ans=max(ans,a[i]);
	cout<<ans<<endl;
}

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

class Progaram
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine().Split(' ');
        var f = double.Parse(s[0] + s[1]);
        if (Math.Pow((int)Math.Sqrt(f), 2) == f)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}


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

using ll = long long;

int main() {
    int n;
    while(cin >> n, n) {
        string res;
        while(n > 0) {
            int oct = n & 7;
            if(oct <= 3) {
                res += '0' + oct;
            } else if(4 == oct) {
                res += '0' + oct + 1;
            } else {
                res += '0' + oct + 2;
            }
            n >>= 3;
        }
        reverse(res.begin(), res.end());
        cout << res << endl;
    }
}


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

#define MAX_N 1000

string S, T;
vector<string>v;
char voin[6] = "aiueo";
char musei[6] = "ksthp";
int p[256];
int h[MAX_N];
int chokuzen;

void bunkatsu() {
	int pass = 0;
	T = "'";
	for (int i = 0; i < 5; i++) {
		p[int(voin[i] - 'a')] = 1;
	}
	for (int i = 0; i < 5; i++) {
		p[(int)(musei[i] - 'a')] = 2;
	}
	p[13] = 3;
	while (pass < S.size()) {
		int P = S[pass] - 'a';
		if (p[P] == 1)//Voin.
		{
			v.push_back(S.substr(pass, 1));
			pass += 1;
		}
		else if (S[pass] == S[pass + 1])//Sokuon.
		{
			v.push_back(S.substr(pass, 1));
			pass += 1;
		}
		else if (S[pass] == 'n')//N.
		{
			if (pass != S.size() - 1)
			{
				if (S[pass + 1] == T[0])
				{
					v.push_back(S.substr(pass, 2));
					pass += 2;
				}
				else if (p[(int)(S[pass + 1] - 'a')] == 1)
				{
					v.push_back(S.substr(pass, 2));
					pass += 2;
				}
				else
				{
					v.push_back(S.substr(pass, 1));
					pass += 1;
				}
			}
			else
			{
				v.push_back(S.substr(pass, 1));
				pass += 1;
			}
		}
		else if (S[pass + 1] == 'y')//3-moji tango.
		{
			v.push_back(S.substr(pass, 3));
			pass += 3;
		}
		else//shiin + voin.
		{
			v.push_back(S.substr(pass, 2));
			pass += 2;
		}
	}
}

void hantei() {
	chokuzen = 2;
	for (int i = 0; i < v.size(); i++)
	{
		for (int j = 0; j < v[i].size(); j++)
		{
			if (p[(int)(v[i][j] - 'a')] == 1)
			{
				chokuzen++;
			}
		}
		if (v[i].size() >= 2)
		{
			if (v[i][v[i].size() - 1] == 'i' || v[i][v[i].size() - 1] == 'u')//Pat.1
			{
				if (p[(int)(v[i][0] - 'a')] == 2)
				{
					if (i != v.size() - 1)
					{
						if (p[(int)(v[i + 1][0] - 'a')] == 2 && chokuzen >= 2)
						{
							h[i] = 1;
							chokuzen = 0;
						}
					}
					else if (chokuzen >= 2)
					{
						h[i] = 1;
						chokuzen = 0;
					}
				}
			}
			if (v[i][v[i].size() - 1] == 'a' || v[i][v[i].size() - 1] == 'o')
			{
				if (i != v.size() - 1 && p[(int)(v[i][0] - 'a')] == 2)
				{
					if (v[i + 1].size() >= 2 && p[(int)(v[i + 1][0] - 'a')] == 2 && v[i + 1][v[i + 1].size() - 1] == v[i][v[i].size() - 1])
					{
						if (p[(int)(v[i + 1][v[i + 1].size() - 1] - 'a')] == 1 && chokuzen >= 2)
						{
							h[i] = 1;
							chokuzen = 0;
						}
					}
				}
			}
		}
	}
}

int main() {
	while (true) {
		for (int i = 0; i < MAX_N; i++)
		{
			h[i] = 0;
		}
		v.clear();
		cin >> S;
		if (S == "#") { break; }
		bunkatsu();
		hantei();
		for (int i = 0; i < v.size(); i++)
		{
			if (h[i] == 1)
			{
				for (int j = 0; j < v[i].size(); j++)
				{
					if (p[(int)(v[i][j] - 'a')] == 1)
					{
						cout << '(' << v[i][j] << ')';
					}
					else {
						cout << v[i][j];
					}
				}
			}
			else
			{
				cout << v[i];
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1196
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String k = sc.nextLine();
    int ik = Integer.parseInt(k);
    String s = sc.nextLine();

    if(s.length() > ik){
        s = s.substring(0, ik);
        s = s+"...";
    }
    System.out.println(s);
  }
}

Measured memory_bytes: 38536
n = int(input())
a = list(map(int, input().split()))

dp = [[0] * (n+1) for _ in range(n+1)]

for i in range(n)[::-1]:
    for j in range(n + 1):
        if i >= j:
            continue
        minus = (n - i + j) % 2 * (-2) + 1
        dp[i][j] = max(a[j - 1]-dp[i][j - 1], a[i]-dp[i + 1][j])

print(dp[0][n])


Measured memory_bytes: 112476
#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(void){
    double a, b, c, d;
    cin >> a >> b >> c >> d;
    printf("%f\n",sqrt((a - c)*(a - c) + (b - d)*(b - d)));
    return 0;
}


Measured memory_bytes: 3280
#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 mod=1000000007;
const int INF=1001001001;
int main() {
  int K;
  cin>>K;
  int t=7;
  vector<bool>use(K,false);
  for(int i=0;i<K;i++){
    if(use[t%K]){cout<<-1<<endl;return 0;}
    if(t%K==0){cout<<i+1<<endl;return 0;}
    use[t%K]=true;
    t%=K;t*=10;t+=7;
  }
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define oo 2000000000
#define inf 1000000000000000LL
#define M 1000000007
typedef long long ll;
using namespace std;
const int N = 105001;

map<string,string> mp;

signed main(){
    mp["Sunny"]="Cloudy";
    mp["Cloudy"]="Rainy";
    mp["Rainy"]="Sunny";
    string s;
    cin >> s;
    cout << mp[s] << endl;
    
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

const int N = 50005, M = 100005;

int n, m, t, u[M], v[M];
int x[M][2], y[M][2];
pair<bool, bool> tr[M][2];
bitset<N> bi[N];
bool chk[N];

bool trans(int &x, int &y, int u, int v, bool c) {
    if (x == u) {
        if (c) {
            x = v;
        }
        return !c;
    } else if (y == u) {
        if (c) {
            y = v;
        }
        return !c;
    } else if (x == v) {
        if (c) {
            x = u;
        }
        return c;
    } else {
        if (c) {
            y = u;
        }
        return c;
    }
}

void solve_1() {
    for (int i = 1; i <= n; i++) {
        bi[i].set(i);
    }
    for (int i = 1; i <= m; i++) {
        bi[v[i]] = (bi[u[i]] |= bi[v[i]]);
    }
    for (int i = 1; i <= n; i++) {
        if (bi[i].count() == n) {
            chk[i] = true;
            for (int j = m; j >= 1; j--) {
                if (chk[v[j]]) {
                    swap(u[j], v[j]);
                }
                chk[v[j]] |= chk[u[j]];
            }
            for (int j = 1; j <= m; j++) {
                cout << (u[j] < v[j] ? '^' : 'v');
            }
            return;
        }
    }
    cout << -1;
}

void solve_2() {
    if (n == 2) {
        return void(cout << -1);
    }
    if (u[1] == 1 && v[1] == 2) {
        x[0][0] = 1; y[0][0] = 3;
        x[0][1] = 2; y[0][1] = 3;
    } else if (u[1] == 1 && v[1] == 3) {
        x[0][0] = 1; y[0][0] = 2;
        x[0][1] = 2; y[0][1] = 3;
    } else {
        x[0][0] = 1; y[0][0] = 2;
        x[0][1] = 1; y[0][1] = 3;
    }
    for (int i = 1; i <= m; i++) {
        if (u[i] == x[i - 1][0] && v[i] == y[i - 1][0]) {
            for (int j = 0; j < 2; j++) {
                x[i][j] = x[i - 1][1]; y[i][j] = y[i - 1][1]; tr[i][j].fi = 1;
                tr[i][j].se = trans(x[i][j], y[i][j], u[i], v[i], j);
            }
        } else if (u[i] == x[i - 1][1] && v[i] == y[i - 1][1]) {
            for (int j = 0; j < 2; j++) {
                x[i][j] = x[i - 1][0]; y[i][j] = y[i - 1][0]; tr[i][j].fi = 0;
                tr[i][j].se = trans(x[i][j], y[i][j], u[i], v[i], j);
            }
        } else {
            for (int j = 0; j < 2; j++) {
                x[i][j] = x[i - 1][j]; y[i][j] = y[i - 1][j]; tr[i][j].fi = j;
                tr[i][j].se = trans(x[i][j], y[i][j], u[i], v[i], 0);
            }
        }
        for (int j = 0; j < 2; j++) {
            if (x[i][j] > y[i][j]) {
                swap(x[i][j], y[i][j]);
            }
        }
    }
    for (int i = m, cur = 0; i >= 1; i--) {
        chk[i] = tr[i][cur].se;
        cur = tr[i][cur].fi;
    }
    for (int i = 1; i <= m; i++) {
        cout << (chk[i] ? '^' : 'v');
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1; i <= m; i++) {
        cin >> u[i] >> v[i];
    }
    if (t == 1) {
        solve_1();
    } else {
        solve_2();
    }
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;
  vll a(n), b(n);

  rep(i, n) {
    cin >> a[i];
  }
  rep(i, n) {
    cin >> b[i];
  }

  ll cnt = 0;
  rep(i, n) {
    if (a[i] > b[i]) {
      cnt -= a[i] - b[i];
    } else {
      cnt += (b[i] - a[i]) / 2;
    }
  }

  if (cnt >= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int h, H, w, W;
	scanf("%d %d %d %d", &H, &W, &h, &w);
	if(W%w!=0){
		printf("%s\n", "Yes");
		int x=W/w+1;
		for(int i=1; i<=H; i++){
			for(int j=1; j<=W; j++){
				if(j%w!=0){
					printf("%d ", x);
				}else{
					printf("%d ", -x*(w-1)-1);
				}
			}
			printf("\n");
		}
	}else if(H%h!=0){
		printf("%s\n", "Yes");
		int x=H/h+1;
		for(int i=1; i<=H; i++){
			for(int j=1; j<=W; j++){
				if(i%h!=0){
					printf("%d ", x);
				}else{
					printf("%d ", -x*(h-1)-1);
				}
			}
			printf("\n");
		}
	}else{
		printf("%s\n", "No");
	}
	return 0;
}

Measured memory_bytes: 1280
use strict;
use warnings;

sub main {
    chomp(my $S = <STDIN>);
    print solver($S);
}
main() unless caller;

sub solver {
    my ($S) = @_;
    my @s = split(//,$S);
    my $ans = 0;
    for my $i(0 .. scalar(@s) -1){
        if($i%2==0){
            if($s[$i] eq 'L'){
                return 'No';
            }
        } else {
            if($s[$i] eq 'R'){
                return 'No';
            }
        }
    }
    return 'Yes';
}

Measured memory_bytes: 640
#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>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, P> Pll;
typedef pair<int, ll> Pl;

int par[4002];
int rk[4002];
 
void init(int n){
	for(int i=0; i<n; i++){
		par[i]=i;
	}
}
 
int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}
 
void unite(int x, int y){
	x=find(x);
	y=find(y);
	if(x==y) return;
	if(rk[x]<rk[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(rk[x]==rk[y]) rk[x]++;
	}
}
 
bool same(int x, int y){
	return find(x)==find(y);
}

vector<Pl> g[4000];
ll mx[4000][4000];
bool used[4000];

void dfs(int s, int x){
	used[x]=1;
	for(int i=0; i<g[x].size(); i++){
		int y=g[x][i].first;
		if(used[y]) continue;
		mx[s][y]=max(mx[s][x], g[x][i].second);
		dfs(s, y);
	}
}

int main()
{
	int n, m;
	cin>>n>>m;
	vector<Pll> eg;
	for(int i=0; i<m; i++){
		int a, b; ll c;
		cin>>a>>b>>c;
		a--; b--;
		eg.push_back(Pll(c, P(a, b)));
	}
	sort(eg.begin(), eg.end());
	init(n);
	ll sum=0;
	int ct=0;
	for(int i=0; i<m; i++){
		int a=eg[i].second.first, b=eg[i].second.second;
		if(same(a, b)) continue;
		unite(a, b);
		ct++;
		ll c=eg[i].first;
		sum+=c;
		g[a].push_back(Pl(b, c));
		g[b].push_back(Pl(a, c));
		if(ct==n-1) break;
	}
	for(int i=0; i<n; i++){
		fill(used, used+n, 0);
		dfs(i, i);
	}
	int q;
	cin>>q;
	for(int i=0; i<q; i++){
		int s, t;
		cin>>s>>t;
		s--; t--;
		cout<<sum-mx[s][t]<<endl;
	}
    return 0;
}

Measured memory_bytes: 134760
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n; cin >>n;
    string s; cin >>s;

    int ans = 0;
    int x = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'I') {
            x++;
        } else {
            x--;
        } 
        ans = max(ans, x);
    }

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




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

int main(){
    int N;
    scanf("%d",&N);
    int L[N];
    int i,max=0,sum=0;
    for(i=0;i<N;i++){
        scanf("%d",&L[i]);
        max = max>L[i]? max:L[i];
        sum += L[i];
    }
    if(2*max < sum) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>

int main(){
    long long n;
    scanf("%lld",&n);
    if(n%2 || n==0) printf("0\n");
    else{
        long long ans = 0;
        n /= 2ll;
        while(n){
            ans += (n/5ll);
            n /= 5ll;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 128
import java.math.BigDecimal

fun main(args: Array<String>) {
    val (a, b, c) = readLongList()
    val ab = 4 * a * b
    var tmp = c - a - b
    val ans = if (tmp > 0 && ab < tmp * tmp) {
        "Yes"
    } else {
        "No"
    }

    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1000000007;
const int INF = 1<<18;
const lint INFLINT = 1LL << 60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

string s;

int main() {
#define int double
    int n, m, x, y;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    
    int ans = 0;
    double limit = sum / 4.0 / m;
    rep(i, n) {
        if(limit <= a[i]) {
            ans++;
        }
    }
    
    if(ans < m) cout << "No";
    else cout << "Yes";
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

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

int main() {
	string s;
	cin >> s;

	bool ans = true;

	for (int i = 0; i < s.size(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'R' || s[i] == 'U' || s[i] == 'D') {
				ans == true;
			}
			else {
				ans = false;
			}
		}
		if (i % 2 != 0) {
			if (s[i] == 'L' || s[i] == 'U' || s[i] == 'D') {
				ans == true;
			}
			else {
				ans = false;
			}
		}
	}
	puts(ans ? "Yes" : "No");

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String []args)
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        if(n>=1 && n<=999)
            System.out.println("ABC");
        else if(n>999 )
            System.out.println("ABD");

    }
}


Measured memory_bytes: 23124
s = [int(x) for x in input()]
correto_0 = []
correto_1 = []
for i in range(len(s)):
    if i % 2 != 0:
        correto_0.append(0)
        correto_1.append(1)
    else:
        correto_0.append(1)
        correto_1.append(0)
for i in range(len(s)):
    correto_0[i] = correto_0[i] - s[i]
    correto_1[i] = correto_1[i] - s[i]
resp_0 = [abs(x) for x in correto_0]
resp_1 = [abs(x) for x in correto_1]
print(min(sum(resp_0),sum(resp_1)))


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

using namespace std;

string s;

int main() {
  cin >> s;
  int len = s.size();
  long long ans = 0;
  for (int t = 0; t < (1 << (len - 1)); t++) {
    long long num = s[0] - '0';
    for (int i = 0; i < len - 1; i++) {
      if (t & (1 << i)) {
        ans += num;
        num = 0;
      }
      num = num * 10 + s[i + 1] - '0';
    }
    ans += num;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    if(c-b==b-a)
        cout<<"YES"<<endl;
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n,m;
map<ll,ll> cnt;

int main(){
	cin>>n;
  rep(i,n){
    ll d;
    cin>>d;
    cnt[d]++;
  }
  cin>>m;
  rep(i,m){
    ll d;
    cin>>d;
    if(cnt[d]==0){
      cout<<"NO"<<endl;
      return 0;
    }
    cnt[d]--;
  }
  cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 12800
#include<stdio.h>
int main(void)
{
	int H,W,i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0)break;
	for(i = 0;i < H;i++){
		for(j = 0;j < W;j++){
			printf("#");
		}
		printf("\n");
	}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
int n;
double d,x,ans;
int main(){
	scanf("%d%lf%lf",&n,&d,&x);
	for (;n;--n){
		ans+=d+(n-0.5)*x;
		d=(((n+1)<<1)*d+5*x)/(n<<1);
		x=((n+2)<<1)*x/(n<<1);
	}
	printf("%.9f\n",ans);
}

Measured memory_bytes: 256
abcd=input()

ans=''
for i in range(2**3):
    num=''
    for j in range(3):
        num+=abcd[j]
        if i>>j &1:
            num+='+'
        else:
            num+='-'
    num+=abcd[3]
    if eval(num)==7:
        ans=num+'=7'
        break
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define maxx 10000005
#define MOD 1000003
#define sf(n) scanf("%lld", &n);
#define sff(n,m) scanf("%lld %lld", &n, &m)
#define pf(n) printf("%lld\n", n)
#define pff(n,m) printf("%lld %lld\n", n, m)
#define mem(a) memset(a, 0, sizeof(a))
#define fr(i,n) for(ll i=0; i<n; i++)
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))
#define pi 2*acos(0.0)
#define F first
#define S second
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll n,m;
    cin>>n>>m;
    ll sum=0;
    for(int i=0;i<m;i++)
    {
        ll x;
        cin>>x;
        sum+=x;
    }
    if(sum>=n)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 13;
int n, m, a[maxN], cnt;
int main () {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
	cin >> a[i];
	if (a[i] % 2 == 1)
	    cnt++;
    }
    if (cnt > 2)
	return cout << "Impossible" << endl, 0;
    if (m == 1) {
	cout << a[0] << '\n';
	if (a[0] == 1) {
	    cout << 1 << '\n';
	    cout << 1 << '\n';
	    return 0;
	}
	cout << 2 << '\n';
	cout << 1 << " " << a[0] - 1 << '\n';
	return 0;
    }
    if (m == 2) {
	cout << a[0] << " " << a[1] << '\n';
	if (a[0] == 1) {
	    cout << 1 << '\n';
	    cout << a[1] + 1 << '\n';
	}
	else {
	    cout << 2 << '\n';
	    cout << a[0] - 1 << " " << a[1] + 1 << '\n';
	}
	return 0;
    }
	    
    for (int i = 0; i < m - 1; i++) {
	if (a[i] % 2 == 1)
	    swap(a[i], a[i + 1]);
    }
    for (int i = m - 2; i > 0; i--) {
	if (a[i] % 2 == 1)
	    swap(a[i], a[i - 1]);
    }
    for (int i = 0; i < m; i++)
	cout << a[i] << " ";
    cout << '\n';
    if (a[0] == 1) {
	cout << m - 1 << '\n';
	for (int i = 1; i < m - 1; i++)
	    cout << a[i] << " ";
	cout << a[m - 1] + 1 << '\n';
    }
    else {
	cout << m << '\n';
	cout << a[0] - 1 << " ";
	for (int i = 1; i < m - 1; i++)
	    cout << a[i] << " ";
	cout << a[m - 1] + 1 << '\n';
    }
}


Measured memory_bytes: 256
import itertools
n, m = map(int,input().split())
edges = {tuple(sorted(map(int,input().split()))) for i in range(m)}
#print(edges)
ans = 0
a = 0
for i in itertools.permutations(range(2, n+1), n-1):
  l = [1] + list(i)
  #print(l, l[1:])
  ans += sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges) == n-1
  #print(sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges) == n-1)
print(ans)

Measured memory_bytes: 3064
# coding: utf-8

import math
import re
import numpy as np
import copy

S1 = input().split(" ")
A = int(S1[0])
V = int(S1[1])

S2 = input().split(" ")
B = int(S2[0])
W = int(S2[1])

T = int(input())

#距離
dist = abs(A-B)
#速さの差
speed = V - W
#フラグ
possible = False

if speed > 0:
    if dist / speed <= T:
        possible = True

if possible:
    print("YES")
else:
    print("NO")



Measured memory_bytes: 27172