akhauriyash/Code-Regression huggingface dataset:
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}


fn main(){
    let line = read_as_vec::<usize>();

    let (n, c) = (line[0], line[1]);

    let mut channels: Vec<Vec<(usize, usize)>> = vec![vec![];c];

    let mut v_len = 0;
    for _ in 0..n{
        let line = read_as_vec::<usize>();
        v_len = cmp::max(v_len, line[1]+1);
        channels[line[2]-1].push((line[0], line[1]));
    }
    let mut v: Vec<Vec<i64>> = vec![vec![0 as i64;v_len];c];

    for i in 0..channels.len(){
        for &(s, t) in &channels[i]{
            v[i][s] += 1;
            v[i][t] -= 1;
        }
    }
    let mut memo: Vec<Vec<i64>> = vec![vec![0;v[0].len()];c];
    for i in 0..v.len(){
    let mut acc = 0;
        for j in 0..v[0].len(){
            let tmp = v[i][j];
            if tmp == -1{
                memo[i][j] += 1;
            }
            v[i][j] += acc;
            acc += tmp;
        }
    }
    let mut ans = 0;
    /*
    for row in &v{
        println!("{:?}", row);
    }
    */

    for i in 0..v[0].len(){
        let mut cur_ans = 0;
        for j in 0..v.len(){
            if memo[j][i] > 0{
                cur_ans += memo[j][i];
            }
            cur_ans += v[j][i];
        }
        ans = cmp::max(cur_ans, ans);
    }

    println!("{}", ans);
}


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

int main() {
    char c;
    cin >> c;
    vector <char> vowels{'a', 'e', 'i', 'o', 'u'};
    for (char v: vowels) {
        if (c==v) {
            cout << "vowel\n";
            return 0;
        }
    }
    cout << "consonant\n";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 1e9+7;
ll inf = 1e18;

//

int main(void){
	ll dp[100010][4];
	rep(i,100010)rep(j,4)dp[i][j]=0;
	string s;
	cin>>s;
	dp[0][0]=1;
	rep(i,s.size()){
		if(s[i]=='?'){
			rep(j,4)dp[i+1][j] = (dp[i+1][j]+dp[i][j]*3) % mod;
		}else{
			rep(j,4)dp[i+1][j] = (dp[i+1][j]+dp[i][j]) % mod;
		}
		if(s[i]=='A' || s[i]=='?')dp[i+1][1] = (dp[i+1][1]+dp[i][0]) % mod;
		if(s[i]=='B' || s[i]=='?')dp[i+1][2] = (dp[i+1][2]+dp[i][1]) % mod;
		if(s[i]=='C' || s[i]=='?')dp[i+1][3] = (dp[i+1][3]+dp[i][2]) % mod;
	}
	// rep(i,s.size()+1){
	// 	rep(j,4)printf("%lld ",dp[i][j]);
	// 	printf("\n");
	// }
	cout<<dp[s.size()][3]<<endl;
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
template <typename T, typename U>ostream &operator<<(ostream &out, const pair<T, U> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>void print(const ContainerType<ValueType, Args...> &c){for (const auto &v : c)cout << v << ' ';cout << '\n';} void print(){cout<<'\n';}
template <typename T, typename... Args>void print(T a, Args... args){cout << a << " ";print(args...);}
lli llipower(lli x, lli y, lli p = LLONG_MAX){lli res = 1;x = x % p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}

//8====================================D
int main(){
    int n;
    cin>>n;
    vector<lli> a(n);
    fori(n) cin>>a[i];
    a.pb(0);

    lli s=0;
    lli m=1000;
    for(lli i=0;i<n;i++){
        if(a[i+1]>a[i]){
            s += m / a[i];
            m = m % a[i];
        }
        else if(a[i+1]<a[i]){
            m+=s*a[i];
            s=0;
        }
    }
    m+=s*a[n-1];
    s=0;
   
    cout<<max(m,0LL)<<endl;
}

Measured memory_bytes: 3596
#include<cstdio>
const long long mod = 998244353;
long long f[3001][3001];
//consider the overlap from different source
int main(){
    long long a,b,c,d;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    for(long long i = a; i <= c; i++){
        for(long long j = b; j <= d; j++){
            if(i==a && j==b) f[i][j] = 1;
            else{
                f[i][j] = 0;
                if(i>a) f[i][j] = (f[i][j]+f[i-1][j]*j%mod)%mod;
                if(j>b) f[i][j] = (f[i][j]+f[i][j-1]*i%mod)%mod;
                if(i>a && j>b){
                    f[i][j] -= f[i-1][j-1]*(i-1)*(j-1)%mod;
                    if(f[i][j]<0) f[i][j] += mod;
                }
            }
        }
    }
    printf("%lld\n",f[c][d]);
    return 0;
}


Measured memory_bytes: 71996
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

ll N, s[128], dp[100][21];

int main(){
  scanf("%lld", &N);
  rep(i, N) scanf("%lld", s+i);
  dp[0][s[0]] = 1;
  REP(i, 1,N) rep(j, 21){
    if(j + s[i] <= 20) dp[i][j+s[i]] += dp[i-1][j];
    if(j - s[i] >= 0) dp[i][j-s[i]] += dp[i-1][j];
  }
  /*  rep(i, 21){
    rep(j, N+1) printf("%lld ", dp[i][j]); puts("");
    }*/
  printf("%lld\n", dp[N-2][s[N-1]]);
  return 0;
}

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

int main() {
	int N, K; cin >> N >> K;
	long ans=0;
	for(int i=K+1; i<=N; ++i){
	    int mul=N/i;
	    ans += N-(mul*K+max(0, min(K-1, N%i)));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int,int>
#define sz(x) x.size()

using namespace std;

int main(){
    int n;cin>>n;
    vector<int>a(n);
    for(int i =0;i <n;i++){
        cin>>a[i];
    }
    int c= 0;
    for(int i = 1;i <n-1;i++){
        if((a[i]<a[i+1] && a[i] > a[i-1])||(a[i] < a[i-1] && a[i] > a[i+1])){
            c++;
        }
    }
    cout<<c;
}

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

using namespace std;

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

    sort(A, A+N);
    cout << A[N-1] - A[0] << endl;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


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


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;


bool t[MAX_N];

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

  t[4] = t[7] = true;
  REP(i, 1e3) {
    if (t[i]) {
      REP(j, MAX_N) {
	if (i + 7 * j >= 1e4) continue;
	t[i + 7 * j] = true;
	t[i + 4 * j] = true;
      }
    }
  }

  CIN(N);
  OK(t[N]);
  

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll n,k,c[100010];
vector<vector<ll>>a(100010);
void dep(ll now,ll col,ll p){
	if(a[now].size()==1&&a[now][0]==p){
		return;
	}
	for(int i=0;i<a[now].size();i++){
		ll next=a[now][i];
		if(next==p){
			continue;
		}
		c[next]=col;
		dep(next,k-2,now);
		col--;
	}
}
int main() {
	cin>>n>>k;
	for(int i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		a[x].push_back(y);
		a[y].push_back(x);
	}
	c[0]=k;
	dep(0,k-1,-1);
	ll ans=1;
	for(int i=0;i<n;i++){
		ans*=c[i];
		ans%=inf;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h> 
using namespace std;
 #define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{ 
	FIO;
	int str ,str2;
	cin>>str>>str2;
	
	 if((str2 - 1) % (str - 1) == 0){
    cout << (str2 - 1) / (str - 1) << endl;
  }
 
  else{
    cout << (str2 - 1) / (str - 1) + 1 << endl;
	
	}}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
 
  vector<int> cnt(M);
  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++) {
      int A;
      cin >> A;
      A--;
      cnt[A]++;
    }
  }
 
  int ans = 0;
  for (int i = 0; i < M; i++) {
    if (cnt[i] == N) {
      ans++;
    }
  }
 
  cout << ans << endl;
}

Measured memory_bytes: 256
use std::io::{self, BufRead};

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let xs: Vec<usize> = lines.next().unwrap().unwrap().split(' ').map(|x| x.parse().unwrap()).collect();
  let (n, k) = (xs[0], xs[1]);
  if n * (n - 1) / 2 - n + 1 < k {
    println!("-1");
    return;
  }
  let mut edges = n * (n - 1) / 2 - n + 1 - k;
  let count = n + edges - 1;
  println!("{}", count);
  for i in 2..(n+1) {
    println!("{} {}", 1, i);
  }
  for i in 2..n {
    for j in (i+1)..(n+1) {
      if edges == 0 {
        return;
      }
      println!("{} {}", i, j);
      edges -= 1;
    }
  }
}

Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll frac[300005], shita[300005];

void prepare() {
  ll h = mod1 - 2;
  ll two;
  for(int i=0;i<300005;++i) shita[i] = 1;
  ll tmp[300005];
  while(h>0) {
    two = 1;
    for(int i=0;i<300005;++i) tmp[i] = frac[i];
    while(2*two<h) {
      two *= 2;
      for(int i=0;i<300005;++i) {
        tmp[i] *= tmp[i];
        tmp[i] %= mod1;
      }
    }
    h -= two;
    for(int i=0;i<300005;++i) {
      shita[i] *= tmp[i];
      shita[i] %= mod1;
    }
  }
}

ll comb(ll a, ll b) {
  return frac[a]*shita[a-b]%mod1*shita[b]%mod1;
}

int main() {
  frac[0] = 1;
  for(ll i=1;i<300005;++i) {
    frac[i] = frac[i-1]*i%mod1;
  }
  prepare();
  ll N, A, B, K;
  cin>>N>>A>>B>>K;
  ll ans = 0;
  for(ll x=0;x<=N;++x) {
    if(K-A*x<0) continue;
    if((K-A*x)%B!=0) continue;
    if((K-A*x)/B>N) continue;
    ans += comb(N, x)*comb(N, (K-A*x)/B)%mod1;
    ans %= mod1;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 10668
#include <iostream>
#include <math.h>
#include <string>

using namespace std;
int main() {
  string a,b;
  cin>>a;
  int n=a.size();
  for (int i=0;i<n;i++){
    if (a[i]!='B'){
      b+=a[i];
      }else if(b!=""){
        b.pop_back();}
        }
  cout<<b<<endl;
  return 0;
}

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

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

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

// factorial(階乗)の計算
const int N_MAX = pow(10,6);
ll fac[N_MAX+1] ={};
ll c_fac(int n=N_MAX) {
  if (fac[n]!=0) return fac[n];
  if (n==0) return fac[n]=1;
  return fac[n] = (c_fac(n-1)*n)%MOD;
}

// inverse(逆元)の計算
ll inv(ll a,ll m=MOD) {
  ll b = m, x = 1, y = 0;
  while (b!=0) {
    ll d = a/b;
    a -= b*d; swap(a, b);
    x -= y*d; swap(x, y);
  }
  return x>=0 ? x : x+m;
}

// combinataionの計算
ll nck(ll n, ll k) { 
  c_fac(n);
  if (n<k) return 0;
  ll nume = fac[n];
  ll deno = ( inv(fac[n-k],MOD) * inv(fac[k],MOD) ) % MOD;
  return ( nume * deno ) % MOD;
}

int main() {
  ll B, W; cin >> B >> W;
  ll deno = 1, nb = 0, nw = 0;
  rep(i, B+W) {
    if (i>=B) {
      nb += nck(i-1,B-1)*inv(deno);
      nb %= MOD;
    }
    if (i>=W) {
      nw += nck(i-1,W-1)*inv(deno);
      nw %= MOD;
    }
    // cout << nb << " " << nw << endl;
    ll result = (MOD+((1-nb+nw)*inv(2))%MOD)%MOD;
    cout << result << endl;
    deno <<= 1; deno %= MOD;
  }
  return 0;
}

Measured memory_bytes: 5376
fun main(args: Array<String>){

    val (S, T) = readLine()!!.split(" ")
    val (A, B) = readLine()!!.split(" ").map { it.toInt() }
    val U = readLine()!!

    if(S==U) println("${A-1} $B") else println("$A ${B-1}")
}

Measured memory_bytes: 36104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int bit_count(int n) {
    int ret = 0;
    for (int i = 0; i < 26; i++) {
        if (n & (1<<i)) ret++;
    }
    return ret;
}

class SegmentTree {
private:
    int n;
    vector<ll> node, v;
    ll INF = (1ll << 31) - 1;
public:
    SegmentTree(int N, string S) {
        n = 1;
        while (n < N) n *= 2;
        node.resize(2 * n - 1, 0);
        v.resize(N);
        for (int i = 0; i < N; i++) v[i] = S[i] - 'a';
        for (int i = 0; i < N; i++) node[i + n - 1] = 1<<v[i];
        for (int i = n - 2; i >= 0; i--) {
            node[i] = node[2 * i + 1] | node[2 * i + 2];
        }
    }

    void update(int i, int x) {
        node[i + n - 1] -= (1<<v[i]);
        v[i] = x;
        node[i + n - 1] += (1<<x);
        i += (n - 1);
        while (i > 0) {
            i = (i - 1) / 2;
            node[i] = node[2 * i + 1] | node[2 * i + 2];
        }
    }

    int query(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 sum_l = query(a, b, 2 * k + 1, l, (l + r) / 2);
        int sum_r = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return sum_l | sum_r;
    }
};

int main() {
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    vector<int> ans;
    int q, x, y;
    char c;
    SegmentTree st(N, S);
    for (int i = 0; i < Q; i++) {
        cin >> q;
        if (q == 1) {
            cin >> x >> c;
            st.update(x - 1, c - 'a');
        } else {
            cin >> x >> y;
            ans.push_back(st.query(x - 1, y));
        }
    }
    for (int i : ans) {
        cout << bit_count(i) << "\n";
    }
    return 0;
}

Measured memory_bytes: 13444
while True:
    (a, op, b) = input().split()
    a = int(a)
    b = int(b)
    if op == '?':
        break
    elif op == '+':
        print(a + b)
        pass
    elif op == '-':
        print(a - b)
        pass
    elif op == '*':
        print(a * b)
        pass
    else:
        print(a // b)

Measured memory_bytes: 6724
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
int mod = (int) 1e9 + 7;
long C = 1e18;

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

    vector<long> a(n, 0);
    long ans = 1;
    
    rep(i,n){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << "\n";
            return 0;
        }
    }
    
    rep(i,n){
        if (a[i] > C / ans){
            cout << -1 << "\n";
            return 0;
        }
        ans *= a[i];
    }
    
    cout << ans << "\n";
    
    return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
const int N = 1e5, M = 7 + 1e9;
int n, k, a[100], dp[N+1];
int main()
{
	cin >> n >> k;
	f(i, 0, n)
		cin >> a[i];
	f(i, 0, a[0])
		dp[i] = 0;
	f(i, a[0], k+1){
		dp[i];
		f(j, 0, n)
			if(i >= a[j])
				dp[i] |= !dp[i-a[j]];
	}
	cout << (dp[k] ? "First" : "Second");

}

Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    Map<Long, BigInteger> a = new HashMap<>();
    BigInteger xor = BigInteger.ZERO;
    for (long i = 0; i < n; i++) {
      BigInteger ai = new BigInteger(sc.next());
      xor = xor.xor(ai);
      a.put(i, ai);
    }
    for (long i = 0; i < n; i++) {
      BigInteger bigInteger = a.get(i);
      System.out.print(bigInteger.xor(xor));
      if (i != n - 1) {
        System.out.print(" ");
      }
    }
    System.out.println();
  }
}


Measured memory_bytes: 86296
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 998244353;

ll modpow(ll x,ll k){
	if(k == 0)return 1;
	return (modpow(x,k-1)*x)%M;
}

int main(){
	static int n,m;
	static int a[302][302];
	scanf("%d%d",&n,&m);
	rep1(i,n)rep1(j,m)scanf("%d",&a[i][j]);
	
	int k = 1;
	int r = n;
	rep1(i,n){
		while(1){
			if(k == m+1)break;
			bool con = true;
			for(int i_ = i ; i_ <= n ; i_ ++){
				if(a[i_][k]){
					if(i != i_){
						for(int j = k ; j <= m ; j ++)swap(a[i][j],a[i_][j]);
					}
					con = false;
					break;
				}
			}
			if(!con)break;
			k ++;
		}
		if(k == m+1){
			r = i-1;
			break;
		}
		for(int i_ = i+1 ; i_ <= n ; i_ ++){
			if(a[i_][k]){
				for(int j = k ; j <= m ; j ++){
					a[i_][j] ^= a[i][j];
				}
			}
		}
		k ++;
	}
	
	ll ret = modpow(2,n)-modpow(2,n-r)+M; ret %= M;
	ret *= modpow(2,m-1); ret %= M;
	cout << ret << endl;
}


Measured memory_bytes: 640
import bisect
N = int(input())
Ln = list(map(int,input().split(' ')))

def binary_area_search(target_list: list, target_item: int) -> int:
    '''
    @params
    target_list: [1,3,5](ACC)
    target_item: 2

    @return
    return index
    '''
    low = 0
    high = len(target_list) - 1
    while low <= high:
        mid = (low + high) //2
        guess = target_list[mid]
        if guess > target_item:
            if mid == 0:
                return 0
            if target_item > target_list[mid-1]:
                return mid 
            high = mid -1
        else:
            if mid == len(target_list) - 1:
                return None
            if target_list[mid+1] > target_item:
                return mid + 1 
            low = mid + 1
    return None

def main():
    '''
    N^2*logN
    '''
    Ln.sort()
    count = 0
    for a in range(N):
        a_l = Ln[N-a-1]
        for b in range(a+1, N):
            b_idx = N-b-1
            b_l = Ln[b_idx]
            c_threshold = a_l - b_l
            #c_list = Ln[0:N-b-1]
            c_idx = bisect.bisect_right(Ln,c_threshold)
            #c_idx = binary_area_search(c_list,c_threshold)
            if c_idx >= b_idx:
                continue
            count += b_idx - c_idx
    print(count)

def main2():
    '''
    N^2
    '''
    Ln.sort(reverse=True)
    count = 0
    for a in range(N):
        a_l = Ln[a]
        current_min = N-1
        b = a +1
        while b <= current_min:
            c_idx = current_min
            bc = Ln[b] + Ln[c_idx]
            if a_l < bc:
                count += (current_min - b)
                b += 1
                continue
            current_min -= 1
    print(count)
main()

Measured memory_bytes: 3188
#if os(Linux)
import Glibc
#else
import Darwin.C
#endif

let INPUT = stdin

func scanInts(count: Int) -> [Int] {
    let format: String
    switch count {
        case 1: format = "%lld"
        case 2: format = "%lld %lld"
        case 3: format = "%lld %lld %lld"
        case 4: format = "%lld %lld %lld %lld"
        case 5: format = "%lld %lld %lld %lld %lld"
        case 6: format = "%lld %lld %lld %lld %lld %lld"
        default: format = repeatElement("%lld", count: count).joined(separator: " ")
    }
    let ptr = UnsafeMutablePointer<CLongLong>.allocate(capacity: count)
    let ptrArray = Array(ptr ..< ptr+count)
    let read = withVaList(ptrArray) {
        vfscanf(INPUT, format, $0)
    }
    assert(read == count)
    return ptrArray.map { Int($0.pointee) }
}
func scanInt() -> Int {
    scanInts(count: 1)[0]
}
func scanIntPair() -> (Int, Int) {
    let a: [Int] = scanInts(count: 2)
    return (a[0], a[1])
}

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

let N = scanInt()
var sumE = 0
for _ in 1..<N {
    var (u, v) = scanIntPair()
    if u > v { swap(&u, &v) }
    sumE += u * (N-v+1)
}

let sumV = N*(N+1)*(N+2) / 6
print(sumV - sumE)


Measured memory_bytes: 14176
N = int(input())
V = [float(v) for v in input().split()]
V.sort()
for i in range(N-1):
    if len(V) == 2:
        print((V[0] + V[1]) / 2)
        exit()
    V.append((V[0] + V[1]) / 2)
    V.sort()
    del V[0], V[1]


Measured memory_bytes: 2940
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N, K, As):
    ans = []
    for i in range(N-K):
        left_a = As[i]
        right_a = As[i+K]
        if left_a < right_a:
            ans.append("Yes")
        else:
            ans.append("No")

    return "\n".join(ans)


if __name__ == "__main__":
    N, K = tuple(map(int, input().split(" ")))
    As = list(map(int, input().split(" ")))
    print(solve(N, K, As))


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

int x;
string order;
int num;

int main() {
  priority_queue<int> Q; //int型を格納するキュー
  while (cin >> order){
    if (order == "insert"){
	  cin >> num;
	  Q.push(num);
	  }
	else if (order == "extract"){
	  int n = Q.top();
	  Q.pop();
	  cout << n << endl;
	  }
	else if (order == "end") break;
	  }
}
  

Measured memory_bytes: 6772
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}
ll dx[2]={1,0};
ll dy[2]={0,1};

int main(){
    IOS;
    make(string,s);
    ll n=s.length();
    ll ans=0;
    ll c=0;
    for(ll i=0;i<n;i++){
        if(s[i]=='B') c++;
        else ans+=c;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3776
// ctrl+shift+b
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll N, K;
vector<ll> A;


ll binary_search(ll l, ll r){
    map<ll, bool> tried;
    tried[l] = false;
    tried[r] = true;

    while (true){
        ll mid = (r + l) / 2; // 最も長い丸太

        ll k_sum = 0;
        for (auto a: A){
            // 許容長さ3だとして，6/3 なら1回だが7/3なら2回切る必要が..
            k_sum += ((ll) ceil((double) a / mid) - 1);
        }

        if (k_sum <= K){
            r = mid;
            tried[mid] = true;
        } else {
            l = mid;
            tried[mid] = false;
        }

        // 一つ前ではだめで，ここではokという変曲点があるはず
        if (tried.find(mid+1) != tried.end() && tried[mid + 1] && !tried[mid]){
            return mid + 1;
        }
        if (tried.find(mid-1) != tried.end() && !tried[mid - 1] && tried[mid]){
            return mid;
        }
    }
}

void Main() {
    // 状態数的にDPではなさそう
    // 最小の長さに関して二分探索
    cin >> N >> K;
    rep(i, N){ll a; cin >> a; A.push_back(a);}
    sort(A.begin(), A.end());
    if (K == 0){
        cout << A.at(A.size() - 1) << endl;
    } else {
        cout << binary_search(0, 1000000001) << endl;
    }
}

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


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;

int gcd(int a, int b){
  if(a < b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  if(b == 0){
    return a;
  }
  return gcd(b, a%b);
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<int>> g(H, vector<int>(W, -1));
  queue<pair<int, int>> q;
  REP(i, H){
    REP(j, W){
      char c;
      cin >> c;
      if(c == '#'){
        g[i][j] = 0;
        q.push(make_pair(i, j));
      }
    }
  }
  while(!q.empty()){
    pair<int, int> p = q.front();
    q.pop();
    REP(i, 4){
      int x = p.first + dx[i], y = p.second + dy[i];
      if(0 <= x && x < H && 0<=y && y < W && g[x][y] == -1){
        q.push(make_pair(x, y));
        g[x][y] = g[p.first][p.second] + 1;
      }
    }
  }
  int ans = 0;
  REP(i, H){
    REP(j, W){
      ans = max(ans, g[i][j]);
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
// end of Template

int n,f;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
        int temp;cin>>temp;
        if(temp!=i){f++;}
    }

    if(f<=2)cout<<"YES\n";
    else cout<<"NO\n";

}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	void solve(){
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) a[i] = in.nextInt();
		Arrays.sort(a);
		for(int i = 1; i <= a[0]; i++){
			for(int j = 0; j < n; j++){
				if(a[j] % i != 0) break;
				if(j == n-1) System.out.println(i);
			}
		}
	}

	
}

Measured memory_bytes: 26268
#include <bits/stdc++.h>
#include <iomanip> 
using namespace std; 
#define rep(i,a,b)		for(long int i=a;i<=b;i++)
#define MOD 1e9+7

int a,b,cnt=0;
string s;
int main() 
{ 
	ios::sync_with_stdio(false);
    cin.tie(NULL);  

	cin>>a>>b;
	int n = a+b+1;
	cin>>s;
	for(int i=0;i<n;i++)
		if(isdigit(s[i]))
			cnt++;
	if(cnt==n-1 and s[a]=='-')
		cout<<"Yes";
	else
		cout<<"No";

}
	

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

int main(){
  int n, l;
  cin >> n >> l;
  int ans;
  ans = (l + l + n - 1) * n / 2;
  if (l+n-1 < 0) ans -= l+n-1;
  if (l > 0) ans -= l;
  cout << ans << endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using vl=vector<ll>;
using vb=vector<bool>;
using vs=vector<string>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

vvl adj;

void doit(ll N, ll offset, ll level) {
	if (N == 1) return;

	ll left = N / 2;
	ll right = N - left;


	FOR(i, 0, left) {
		FOR(j, 0, right) {
			adj[offset + i][offset+left+j] = level;
		}
	}
	doit(left, offset, level+1);
	doit(right, offset+left, level+1);
}

int main(){ cin.sync_with_stdio(0);
	ll N; cin >> N;

	adj.resize(N, vl(N));

	doit(N, 0, 1);

	FOR(i, 0, N) {
		FOR(j, i+1, N) {
			cout << adj[i][j] << ' ';
		}
		cout << endl;
	}
} //cin.tie(0) bei schnellem Wechseln


Measured memory_bytes: 2432
while 1:
    x,y,z=(i for i in input().split())
    if y=='?':
        break
    elif y=='+':
        print(int(x)+int(z))
    elif y =='-':
        print(int(x)-int(z))
    elif y=='*':
        print(int(x)*int(z))
    else :
        print(int(x)//int(z))

Measured memory_bytes: 7728
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <utility>
#include <map>
int main(){
	int N=0,M,X;
    std::string s;
	std::cin >>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1'){
            N++;
        }
    }
    std::cout << N << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
using ll = long long;
//#define int ll
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int a,b; cin >> a >> b;
    int ans = 0;
    if(a<=b)cout<<a<<endl;
    else cout << a-1 << endl;
}


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

int main(void){
	char str[10000];
	int cut_i,len;
	int count_JOI,count_IOI;

	while(gets(str)){
		len=strlen(str);
		int count_JOI=0;
		int	count_IOI=0;

		for(cut_i=0;cut_i<len-2;cut_i++){
			if((str[cut_i]=='J') && (str[cut_i+1]=='O') && (str[cut_i+2]=='I')){
			 	count_JOI++;
				cut_i++;
			}
			else if((str[cut_i]=='I') && (str[cut_i+1]=='O') && (str[cut_i+2]=='I')){
				count_IOI++;
				cut_i++;
			}
		}
		printf("%d\n",count_JOI);
		printf("%d\n",count_IOI);
	}
	return 0;
}

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

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

using namespace std;

int main(){
  int n;cin>>n;
  rep(i,n+1){
    if(n < 1<<i){
      cout<<(1<<(i-1));
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 256
import math
import fractions
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

#最小公倍数
def union_lcm(lists):
    if len(lists)==1:
        return lists[0]
    elif len(lists)>1:
        num=lists[0]
        for i in range(1,len(lists)):
            num=num*lists[i]//fractions.gcd(num,lists[i])
        return num


#最大公約数
def union_gcd(lists):
    if len(lists)==1:
        return lists[0]
    elif len(lists)>1:
        num=lists[0]
        for i in range(1,len(lists)):
            num=fractions.gcd(num,lists[i])
        return num
mod=10**9+7   
n=int(input())
lists=list(map(int,input().split()))
a=union_lcm(lists)
c=0
a=a%mod

for i in range(n):
    c+=a*modinv(lists[i],mod)
    c=c%mod
print(c)


Measured memory_bytes: 68184
#include<iostream>
#include<vector>
#include<map>
using namespace std;
class UnionFind {
private:
	unsigned size_; std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

int n, m, p, a, b;
int main() {
	cin >> p >> n >> m;
	UnionFind UF1(p + 1), UF2(p + 1);
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		UF1.unite(a, b);
	}
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		UF2.unite(a, b);
	}
	map<pair<int, int>, int>E;
	for (int i = 1; i <= p; i++) {
		E[make_pair(UF1.root(i), UF2.root(i))]++;
	}
	for (int i = 1; i <= p; i++) {
		if (i >= 2)cout << " ";
		cout << E[make_pair(UF1.root(i), UF2.root(i))];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 15104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
	class Program
	{
		static void Main(string[] args)
		{
			string ab = Console.ReadLine();
			string[] hoge = ab.Split(' ');

			
			int a = int.Parse(hoge[0]);
			int b = int.Parse(hoge[1]);
		
			var ans1 = 0;
			var ans2 = 0;

			ans1 = a * b;
			ans2 = (a + b) * 2;

			Console.WriteLine("{0} {1}", ans1, ans2);

		}
	}
}



Measured memory_bytes: 17948
#include<stdio.h>
short a[26], i;
char c;
int main(){
  c=getchar();
  while(c!=10){
    a[c-'a']++;
    c=getchar();
  }
  for(i=0; i<26; i++){
    if(a[i]&1==1){printf("No\n"); return 0;}
  }
  printf("Yes\n");
}


Measured memory_bytes: 256
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  if n%2==1 or n<10:
    return 0

  st=10
  ans=[]
  while st<=n:
    ans.append(n//st)
    st*=5

  return sum(ans)

# main()
print(main())


Measured memory_bytes: 10728
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,m;
	cin>>n>>m;
	vector<long long>v;
	for(long long x=1;x*x<=m;x++)
	{
		if(m%x==0)
		{
		 if(m/x>=n)
		 {
			v.push_back(x);
		 }
		 if(x>=n)
         {
             v .push_back(m/x);
         }
		}
	}
sort(v.begin(),v.end());
cout<<v.back()<<endl;
return 0;
}


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

#define OUT(x)  cerr << #x << " = " << x << endl;
#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define piii    pair<int, pair<int, int>>

int main() {
        long long h, w, n;
        cin >> h >> w >> n;
        set<pii> s;
        vector<long long> ans(10, 0);
        ans[0] = (h - 2) * (w - 2);
        for (int k = 0; k < n; k ++) {
                long long a, b;
                cin >> a >> b;
                a --, b --;
                for (long long i = max(0LL, a - 2); i < min(a + 1, h - 2); i ++) {
                        for (long long j = max(0LL, b - 2); j < min(b + 1, w - 2); j ++) {
                                int cnt = 0;
                                for (long long y = i; y < i + 3; y ++) {
                                        for (long long x = j; x < j + 3; x ++) {
                                                if (s.count(mp(y, x))) cnt ++;
                                        }
                                }
                                ans[cnt] --;
                                ans[cnt + 1] ++;
                        }                 
                }
                s.insert(mp(a, b));
        }
        for (int i = 0; i < 10; i ++) {
                cout << ans[i] << endl;
        }
        return 0;
}



Measured memory_bytes: 4992
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a = sc.nextInt();
	  int b = sc.nextInt();
	  int c = sc.nextInt();
	  if (a < b && b < c) { System.out.println("Yes"); }
	  else { System.out.println("No");}
  }
}


Measured memory_bytes: 26124
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

bool yes[100000] = {false};
int cnt[100000];

signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int2(n, m);
    rep(i, 100000)cnt[i] = 1;
    yes[0] = true;

    rep(k, m){
      int2(x, y); --x; --y;
      cnt[y]++; cnt[x]--;

      if(yes[x]){
        yes[y] = true;
        if(cnt[x] == 0)yes[x] = false;
      }


    }

    int res = 0;
    rep(i, n)if(yes[i])++res;
    pri(res);


/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 768
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,L=MAP()

A=[]
for i in range(L, L+N):
    A.append(i)

mn=INF
idx=0
for i, a in enumerate(A):
    if abs(a)<mn:
        idx=i
        mn=abs(a)

print(sum(A)-A[idx])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
vector<int> pathes[100500];
int degree[100050];
int dp[100500];
int parent[100050];
bool exist[100050];

void bfs(int from) {
    //cerr << from << endl;
    int num = 0;
    for(int i = 0; i < pathes[from].size(); i++) {
        int to = pathes[from][i];
        if(to == parent[from]) continue;
        parent[to] = from;
        bfs(to);
        dp[from] += dp[to];
        exist[from] |= exist[to];
        if(!exist[to]) num++;
    }
    if(num >= 2) {
        dp[from] += num - 1;
        exist[from] = true;
    }
    //cerr << from << " " << dp[from] << endl;
}

int main() {
    //cout.precision(10);
    cin >> N;
    for(int i = 1; i < N; i++) {
        int a, b;
        cin >> a >> b;
        pathes[a].push_back(b);
        pathes[b].push_back(a);
        degree[a]++;
        degree[b]++;
    }
    int maxi = 0;
    for(int i = 1; i < N; i++) {
        if(degree[i] > degree[maxi]) maxi = i;
    }
    for(int i = 0; i < N; i++) parent[i] = -1;
    cerr << maxi << endl;
    if(degree[maxi] <= 2) {
        cout << 1 << endl;
        return 0;
    }
    bfs(maxi);
    cout << dp[maxi] << endl;
    return 0;
}


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

static const int N=100;


int main(){
  int i,l,k,j,n,p[N+1],m[N+1][N+1];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }

   for(i=1;i<=n;i++){
     m[i][i]=0;
   }

    for(l=2;l<=n;l++){
      for(i=1;i<=n-l+1;i++){
	j=i+l-1;
	m[i][j]=(1 << 21);
	for(k=i;k<=j-1;k++){
	  if(m[i][j]>(m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]))
	    m[i][j]=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];

	}
      }
    }

    printf("%d\n",m[1][n]);

    return 0;
}




Measured memory_bytes: 2056
use proconio::input;

fn main() {
    input!(k: i32);
    input!(a: i32);
    input!(b: i32);
    let mut flag = false;
    for i in a..(b+1) {
        if i % k == 0 {
            flag = true
        }
    }
    println!("{}", if flag { "OK" } else { "NG" })
}

Measured memory_bytes: 2120