akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        a: i64,
        b: i64,
        c: i64,
        d: i64,
        e: i64,
    }
    let arr = [a, b, c, d, e];
    let min = arr.iter().min().unwrap();
    let ans = n / min + if n % min == 0 { 0 } else { 1 } + 4;
    println!("{}", ans);
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define MX              200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define ull unsigned long long
#define ll long long

void add(int &a,int b){
    a+=b;
    if(a>=mod)
        a-=mod;
}
int nCr(long long m, long long n){

    //6 * 5 * 4 *../ 1*2*3*...
    int ans = 1;
    for (long long i = 1; i <= n; i++){
        ans = ans * (m - i + 1) / i;
 
    }
    return ans;
}

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


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

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    for(int i=min(a,b);;i--){
        if(a%i==0&&b%i==0){
            k--;
        }
        if(k==0){
            cout<<i<<endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,M; cin >> N >> M;
    vector<pll> AB(N);
    for(auto& in:AB) cin >> in.first >> in.second;
    sort(AB.begin(),AB.end());
    for(auto p:AB){
        res += p.first*min(p.second,M);
        M -= min(p.second,M);
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin >> n;

  cout << pow(n, 3) << endl;

  
  
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<climits>
#include<random>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;
 
/////////////////////////////////////////////
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
////////////////////////////////
 
//#define int long long

const int mod = 1e9 + 7;
const int N = 10001;
int n;
int x;
string s;
int dp[N][10][2][100];
// f is zero means we can do anything .
// f is not zero means we are limited .
int calc(int pos ,int val , int f , int sum){

	if(pos==n){

		return (sum==0);
	}

	int &ans = dp[pos][val][f][sum];

	if(ans!=-1)
		return ans;

	int lim = 9;

	if(f==1)
		lim = s[pos]-'0';
	ans = 0;
	for(int i = 0 ; i <= lim ; ++i){

		if(f==0)
			ans += calc(pos+1 , i , 0 , (sum+i)%x);
		else if(i==lim && f==1)
			ans += calc(pos + 1 , i , 1 , (sum + i)%x);
		else ans += calc(pos+1 , i , 0 , (sum + i)%x);

		ans >= mod ? ans-=mod : true;
	}

	return ans;

}

void solve(){

	memset(dp , -1 , sizeof dp);

	cin>>s;

	n = s.size();

	cin>>x;


	int ans = calc(0 , 0 , 1 , 0);

	--ans;

	if(ans < 0)
		ans += mod;

	cout<<ans<<endl;
}
 
signed main(){
 
    fast;
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 79360
alp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

ans = ''
for i in range(len(S)):
  tmp = alp.index(S[i])
  tmp += N
  ans += alp[tmp]
print(ans)
  


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

int main() {
    int n;
    cin >> n;
    string blue[n];
    
	for (int i = 0; i < n; i++) {
        cin >> blue[i];
    }
    
	int m;
    cin >> m;
    string red[m];
    
	for (int i = 0; i < m; i++) {
        cin >> red[i];
    }

    int ans = 0;
    for (int i=0; i<n; i++)
	{
		string word=blue[i];   //"apple", "orange"
		int count=0;
		
		for (int j=0; j<n; j++){
			if (blue[j]==word) count++;
		}
		
		for (int j=0; j<m; j++){
			if (red[j]==word) count--;
		}
		
		ans = max(ans, count);
	}
	
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

void printDebug(const vector<int> &a) {
    for(int i = 0; i < a.size(); i++) {
        cout << a[i];
    }
    cout << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    reverse(ALL(s));
    int n = s.size();
    vector<int> keta(n + 10, 0);
    vector<int> oturi(n + 10, 0);

    for(int i = 0; i < n; i++) {
        int num = (int)(s[i] - '0');
        num += keta[i];
        if(num >= 10) {
            keta[i + 1] += num / 10;
            num = num % 10;
        }
        if(num <= 5) {
            if(num == 5 && i < n - 1) {
                int hoge = (int)(s[i + 1] - '0');
                hoge += keta[i + 1];
                if(hoge >= 10) {
                    keta[i + 2] += hoge / 10;
                    hoge %= 10;
                }
                if(hoge >= 5) {
                    keta[i] = 0;
                    keta[i + 1]++;
                    oturi[i] = 10 - num;
                    continue;
                }
            }
            keta[i] += (num - keta[i]);
        } else {
            keta[i] = 0;
            keta[i + 1]++;
            oturi[i] = 10 - num;
        }
    }
    reverse(ALL(keta));
    reverse(ALL(oturi));
    reverse(ALL(s));
    // cout << ' ' << s << endl;
    // printDebug(keta);
    // printDebug(oturi);
    ll ans = 0;
    for(int i = 0; i < keta.size(); i++) {
        ans += keta[i] + oturi[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 9116
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 2e5 + 5;
const int maxa = 1e6 + 5;
int a[maxn];
bool vis[maxa];
int main()
{
	ios::sync_with_stdio(false);
	int n, maxnum = 1;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		maxnum = max(maxnum, a[i]);
	}
	sort(a + 1, a + n + 1);
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		int u = a[i];
		if (!vis[u])
		{
			if (i != n && a[i] != a[i - 1] && a[i] != a[i + 1])
				ans++;
			else if (i == n && a[i] != a[i - 1])
				ans++;
		}
		for (int i = 1; i * u <= maxnum; i++)
		{
			vis[i * u] = true;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5368
n,k=map(int,input().split())
s=input()
if s[k-1]=="A":
    print(s[:k-1]+"a"+s[k:])
elif s[k-1]=="B":
    print(s[:k-1]+"b"+s[k:])
else:
    print(s[:k-1]+"c"+s[k:])

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int A,B,ans;

    scanf("%d %d", &A , &B);

    if(A>=0 && A<=23 && B>=0 && B<=23)
    {
        ans = A+B;
        if(ans>=24)
        printf("%d\n",ans-24);
        else
            printf("%d\n",ans);
    }
    else
            return;

}


Measured memory_bytes: 128
#include <stdio.h>

int que[1000000],l,r;

void push(int x) {
  que[r]=x;
  r++;
  if(r>=1000000) r=0;
}

int pop() {
  int d=que[l];
  l++;
  if(l>=1000000) l=0;
  return d;
}

int main() {
  l=r=0;
  int n,q,i;
  scanf("%d%d",&n,&q);
  char ch[n][10];
  int c[n];
  for(i=0; i<n; i++) {
    scanf("%s %d",ch[i],&c[i]);
    push(i);
  }
  int sum=0;
  while(l!=r) {
    int x=pop();
    if(q<c[x]) {
      sum+=q;
      c[x]-=q;
      push(x);
    } else {
      sum+=c[x];
      printf("%s %d\n",ch[x],sum);
    }
  }
  return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

typedef long long ll;

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

const long long INF = 1LL << 60;

char next(char c) {
  if(c=='0') {
    return '1';
  } else if(c='1') {
    return '0';
  }
}

int solve(string s, char startC) {
  char c = startC;
  int res = 0;
  
  rep(i, s.length()) {
    if(s[i]!=c) ++res;
    c = next(c);
  }
  return res;
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s; cin>>s;
  
  int res1 = solve(s, '0');
  int res2 = solve(s, '1');
  
  int res = min(res1, res2);
  cout<<res;
  
  return 0;
}

Measured memory_bytes: 3780
n,a,b,c,d = map(int, input().split())
s = str(input())

a,b,c,d = a-1,b-1,c-1,d-1

cnt = 0
for i in range(a,max(c,d)+1):
    if s[i] == '#':
        cnt += 1
        if cnt >= 2:
            print('No')
            exit()
    else:
        cnt = 0

cnt = 0
if b >= 2:
    if s[b-2] == '.' and s[b-1] == '.':
        cnt = 2

if s[b-1] == '.':
    cnt = 1

if c > d:
    if s[d-1] == '.' and s[d+1] == '.':
        print('Yes')
        exit() 
    for i in range(b,d+1):
        if s[i] == '.':
            cnt += 1
            if cnt >= 3:
                print('Yes')
                exit()
        else:
            cnt = 0
        if i == d:
            print('No')
            exit()
else:
    print('Yes')



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

int main(){
  
    long long int A,B,C;cin>>A>>B>>C;
    if(A%2==1&&B%2==1&&C%2==1){
        if(max(A,max(B,C))==A) cout<<B*C<<endl;
        else if(max(A,max(B,C))==B) cout<<A*C<<endl;
        else cout<<A*B<<endl;
    }
    else cout<<0<<endl;
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sr = new Scanner(System.in);
        int a = sr.nextInt();
        int b = sr.nextInt();
        
        double x = (a + b) / 2d;
        int x_2 = (int)Math.ceil(x);
        System.out.println(x_2);
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
    }
}

Measured memory_bytes: 21844
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

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

  set<int> st;

  while(st.count(s) == 0){
    st.insert(s);
    if(s%2 == 0) s = s/2;
    else s = 3*s+1;
  }

  cout << st.size() + 1 << endl;
  
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DFloorFunction {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int A, B, N;
        cin >> A >> B >> N;

        int val = min(B - 1, N);
        cout << A * val / B << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DFloorFunction solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int pd[26]={0};
int main()
{
    char s[100010];
    while(~scanf("%s",&s))
    {

        memset(pd,0,sizeof(pd));
        int l=strlen(s);
        for(int i=0;i<l;i++)
        {
            pd[s[i]-'a']=1;
            //printf("%c\n",i+'a');
        }
        int j=0;
        for(j=0;j<26;j++)
        {
            if(pd[j]==0){printf("%c\n",j+'a');break;}
        }
        if(j==26)cout<<"None"<<endl;
        memset(s,0,sizeof(s));
    }
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
  int n;
  while(cin >>n){
    int ans = 0;
    for(int i=0; i<10; i++)
      for(int j=0; j<10; j++)
	for(int k=0; k<10; k++)
	  if(n-i-j-k>=0 && n-i-j-k<=9) ans++;
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <cstdio>

int main()
{
    char buf[20];
    while( 1 == scanf("%s", buf) ) {
        const char s[] = "CODEFESTIVAL2016";
        int count = 0;
        for (int i = 0; s[i]; ++i) {
            if (buf[i] != s[i]) {
                ++count;
            }
        }
        printf("%d\n", count);
    }
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stdio.h>
#include<cstdio>
#include<string.h>
#include<cmath>
using namespace std;
double lst[100010];
int main() {
	int n,pos;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> lst[i];
	}
	sort(lst, lst + n);
	for (int i = 1; i < n; i++) {
		lst[i] = (lst[i] + lst[i - 1]) / 2;
	}
	cout << lst[n-1] << endl;
	return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <cstdlib>
using namespace std;
int main(void){
    int n,m=0,l=0,a[100002],b[100001];
    cin>>n;
    a[0]=a[n+1]=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        
        m+=abs(a[i]-a[i-1]);
    }
    m+=abs(a[n]);
    for(int i=1;i<=n;i++){
        cout<<m+abs(a[i+1]-a[i-1])-abs(a[i+1]-a[i])-abs(a[i]-a[i-1])<<endl;
    }
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <algorithm>
#define vll vector<ll>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
using namespace std;
ll P = 1000000007;
ll I = 500000004;
typedef tuple<int, int, ll> p;

int main(int argc, char const *argv[]) {
  ll n, q;std::cin >> n >> q;
  vll a(n);re(i, n) scanf("%lld", &a[i]);

  vvl query = VV(q, 2, 0, ll);
  re(i, q) {
    scanf("%lld %lld", &query[i][0], &query[i][1]);
    query[i][0]--, query[i][1]--;
  }
  reverse(query.begin(), query.end());
  vvl dp = VV(n+1, n+1, 0, ll); //iの方が前にある
  for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) dp[i][j] = 1;

  ll z = 1;
  for(int i=0;i<q;i++) z = (z*2)%P;
  for(auto v:query){
    vector<p> tmp;
    ll x = v[0], y = v[1];
    if(x>y) swap(x, y);

    // x, y
    tmp.push_back(p(y, x, dp[x][y]));
    tmp.push_back(p(x, y, dp[y][x]));

    for(int i=0;i<n;i++){
      if(i==x||i==y) continue;
      tmp.push_back(p(i, x, dp[i][y]));
      tmp.push_back(p(x, i, dp[y][i]));
    }

    for(int i=0;i<n;i++){
      if(i==x||i==y) continue;
      tmp.push_back(p(i, y, dp[i][x]));
      tmp.push_back(p(y, i, dp[x][i]));
    }

    for(auto ad:tmp){
      ll s = get<0>(ad);
      ll t = get<1>(ad);
      ll u = get<2>(ad);
      dp[s][t] = (dp[s][t] + u)%P;
    }
    dp[x][y] = (dp[x][y]*I)%P;
    dp[y][x] = (dp[y][x]*I)%P;
    for(int i=0;i<n;i++){
      if(i==x||i==y) continue;
      dp[i][x] = (dp[i][x]*I)%P;
      dp[i][y] = (dp[i][y]*I)%P;
      dp[x][i] = (dp[x][i]*I)%P;
      dp[y][i] = (dp[y][i]*I)%P;
    }
  }

  ll ans = 0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(a[i]<a[j]) ans = (ans + (z*dp[j][i])%P)%P;
      if(a[i]>a[j]) ans = (ans + (z*dp[i][j])%P)%P;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 73376
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
constexpr double PI=3.14159265358979323846;
constexpr int INF = INT_MAX/2;

int main() {
	int N1, N2, N3, N4, N5;
	cin >> N1 >> N2 >> N3 >> N4 >> N5;
	if (N1==0) {
		std::cout << "1" << '\n';
	} else if (N2==0) {
		std::cout << "2" << '\n';
	} else if (N3==0) {
		std::cout << "3" << '\n';
	} else if (N4==0) {
		std::cout << "4" << '\n';
	} else if (N5==0) {
		std::cout << "5" << '\n';
	}
}


Measured memory_bytes: 3520
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define INF 1000000000000
#define min(p,q)((p)<(q)?(p):(q))
#define max(p,q)((p)>(q)?(p):(q))
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

ll a[100010];
ll b[100010];
ll la,ra,lb,rb;
int n,nn,q;

void f(ll x){
	int l=0,r=n;
	while(r-l>1){
		int m=(l+r)/2;
		if(a[m]<=x)l=m;
		else r=m;
	}
	if(a[l]==x){
		la=ra=a[l];
	}else{
		la=a[l];
		ra=a[l+1];
	}

	l=0,r=nn;
	while(r-l>1){
		int m=(l+r)/2;
		if(b[m]<=x)l=m;
		else r=m;
	}
	if(b[l]==x){
		lb=rb=b[l];
	}else{
		lb=b[l];
		rb=b[l+1];
	}

}

int main(){
	scanf("%d%d%d",&n,&nn,&q);
	for(int i=0;i<n;i++)scanf("%lld",a+i);
	a[n]=-INF,a[n+1]=INF;
	n+=2;
	sortup(a,n);
	for(int i=0;i<nn;i++)scanf("%lld",b+i);
	b[nn]=-INF,b[nn+1]=INF;
	nn+=2;
	sortup(b,nn);
	while(q--){
		ll x;
		scanf("%lld",&x);
		f(x);
		ll ans=min(min(min(
			x-min(la,lb),
			max(ra,rb)-x  ),
			(x-la)+(rb-x)+min(x-la,rb-x)  ),
			(x-lb)+(ra-x)+min(x-lb,ra-x)  );
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int n;string s;int ans=0;
    cin>>n>>s;
    rep(i,n+1){
        string l=s.substr(0,i);
        string r=s.substr(i,n-i);
        int abcl[27]={},abcr[27]={},tmp=0;
        rep(i,l.size()){
            abcl[(l[i]-'a')]++;
        }
        rep(i,r.size()){
            abcr[(r[i]-'a')]++;
        }
        rep(i,27){
            if(abcr[i]>0&&abcl[i]>0)    tmp++;
        }
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std; 

int main(){
	int a[3], b[3], c[4] = {};
	bool ans = true;

	for (int i = 0; i < 3; ++i)
		cin >> a[i] >> b[i];

	for (int i = 0; i < 3; ++i){
		++c[a[i] - 1];
		++c[b[i] - 1];
	}

	for (int i = 0; i < 4; ++i){
		if (c[i] > 2 || c[i] == 0)
			ans = false;
	}

	if (ans)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
s = input()
s = s[::-1]
l = len(s)
se = dict()

k = 0
for i in range(0,l):
    k+=(pow(10,i,2019)*int(s[i]))
    k%=2019
    if k in se:
        se[k]+=1
    else:
        se[k]=1

ans=0
for j in se:
    i=se[j]
    if i>1:
        ans+=(i*(i-1)//2)
    if j==0:
        ans+=i
print(ans)

Measured memory_bytes: 68712
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

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

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  int N;
  cin >> N;

  cout << (N - 2) * 180 << endl;

  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
a = Array.new n 
b = Array.new n 
n.times do |i|
  a[i], b[i] = gets.split.map(&:to_i)
end

if n.odd?
  min = a.sort[n/2]
  max = b.sort[n/2]
  puts max - min + 1
else
  a = a.sort
  b = b.sort
  min = (a[n/2] + a[n/2-1])
  max = b[n/2] + b[n/2-1]
  puts max - min + 1
end

Measured memory_bytes: 22124
n = int(input())
ans = 0
dp = [False for _ in range(10001)]
dp[0] = True
for _ in range(n):
    s = int(input())
    for i in range(10001, s - 1, -1):
        if dp[i - s]:
            dp[i] = True
            if i % 10 != 0:
                ans = max(ans, i)
print(ans)

Measured memory_bytes: 67796
//https://atcoder.jp/contests/abc158/tasks/abc158_d
//D - String Formation
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,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 (b<a) { a=b; return 1; } return 0;}
int main() {
	string S; cin>>S;
	ll Q; cin>>Q;
	deque<char> lst;
	for(auto& c:S){
		lst.push_back(c);
	}

	bool swf=false;
	REP(i,Q){
		ll t; cin>>t;
		if(t==1){
			swf=!swf;
		}else{
			ll fb; cin>>fb;
			char c; cin>>c;
			if(swf) {
				fb = (fb==1)?2:1;
			}
			if(fb==1){
				lst.push_front(c);
			}else{
				lst.push_back(c);
			}
		}
	}
	if(swf){
		reverse(lst.begin(),lst.end());
	}

	for(const auto&c:lst){
		cout<<c;
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 1024
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;
const int primeAproxFactor = 20;  // factor 20 is good for up to MAXN=5000000, ie max prime ==1e8
const int MAXN = 1000000;
vector<int> pr(MAXN);
vector<bool> notpr(MAXN * primeAproxFactor, false);

void init() {

	ll c = 0;
	ll i = 2;
	while (i < MAXN * primeAproxFactor && c < MAXN) {
		if (!notpr[i]) {
			pr[c] = i;
			c++;
			ll j = 1LL * i * i;
			while (j < primeAproxFactor * MAXN) {
				notpr[j] = true;
				j += i;
			}
		}
		i++;
	}
}

void solve() {
	cini(x);
	while (notpr[x])
		x++;
	cout << x << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	init();
	solve();
}



Measured memory_bytes: 6656
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,K=get_i
h=array(N)
N.times do|i|
    h[i]=gets.to_i
end
h.sort!
ans=INF
(N-K+1).times do|i|
  ans=min(ans,h[i+K-1]-h[i]) 
end
puts ans

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

int main(){
  string w;
  cin>>w;
  unordered_map<char,int> m;
  for(int i=0;i<w.size();i++) m[w[i]]++;
  string ans="Yes";
  for(auto p : m)
    if(p.second%2!=0) ans="No";
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
s = input()
ans = True
res = []
now = n + 1
for i in range(n, 0, -1):
    flag = 0
    if i > now:
        continue
    for j in range(max(0, i - m), i):
        if s[j] == '0':
            flag = 1
            res.append(i - j)
            now = j
            break
    if flag == 0:
        ans = False
        break
if ans == False:
    print(-1)
else:
    for i in range(len(res) - 1, -1, -1):
        print(res[i])

Measured memory_bytes: 4848
#include <stdio.h>

main(){
   int S, h1, h2, m, s;

   scanf("%d", &S);

   h1 = S / 3600;
   h2 = S % 3600;
   m = h2 / 60;
   s = h2 % 60;

   printf("%d:%d:%d\n", h1, m, s);

   return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M,T;
int A[101010],B[101010];
bitset<50500> S[50505];
int ok[50505],C[50505];


void uniform() {
	int i,j;
	
	FOR(i,M) S[A[i]]=S[B[i]]=S[A[i]]|S[B[i]];
	FOR(i,N) if(S[i].count()==N) {
		ok[i]=1;
		
		string R(M,'^');
		for(i=M-1;i>=0;i--) {
			if(ok[B[i]]) R[i]='v';
			ok[A[i]]=ok[B[i]]=ok[A[i]]|ok[B[i]];
			
		}
		cout<<R<<endl;
		return;
	}
	cout<<-1<<endl;
}

void nonuniform() {
	int i,j;
	
	if(N==2) return _P("-1\n");
	FOR(i,N) {
		ok[i]=i;
		C[i]++;
	}
	
	string R(M,'^');
	for(i=M-1;i>=0;i--) {
		if(C[ok[A[i]]]>=2) {
			R[i]='v';
			C[ok[A[i]]]--;
			ok[A[i]]=ok[B[i]];
			C[ok[A[i]]]++;
		}
		else {
			R[i]='^';
			C[ok[B[i]]]--;
			ok[B[i]]=ok[A[i]];
			C[ok[B[i]]]++;
		}
	}
	cout<<R<<endl;
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M>>T;
	FOR(i,N) S[i][i]=1;
	FOR(i,M) {
		cin>>A[i]>>B[i];
		A[i]--;
		B[i]--;
	}
	
	if(T==1) {
		uniform();
	}
	else {
		nonuniform();
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 310272
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <bits/stdc++.h>

#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define mod 1000000007
#define pii pair <int, int>
#define all(x) x.begin(), x.end()
#define FOR(i, x, y) for (int i = x; i <= y; i++)
//#define tr(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

//using namespace __gnu_pbds;

using namespace std;

//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int n, m;

char A[55][55];
char B[55][55];

bool good(int a, int b)
{
	for (int i = a; i < a+m; i++)
		for (int h = b; h < b+m; h++)
			if (A[i][h]!=B[i-a+1][h-b+1])
				return 0;
	return 1;
}

int main()
{
	cin >> n >> m;
	
	FOR (i, 1, n)
		FOR (h, 1, n)
			cin >> A[i][h];
	
	FOR (i, 1, m)
		FOR (h, 1, m)
			cin >> B[i][h];
	
	FOR (i, 1, n)
		FOR (h, 1, n)
			if (i+m-1 <= n && h+m-1 <= n && good(i, h)) {
				cout << "Yes";
				return 0;
			}
	cout << "No";
}


Measured memory_bytes: 256
def examA():
    AB = [I() for _ in range(2)]
    for i in range(1,4):
        if not i in AB:
            ans = i
            break
    print(ans)
    return

def examB():
    N = I()
    S,T = LSI()
    ans = ""
    for i in range(N):
        ans += S[i]+T[i]
    print(ans)
    return

def gcd(x, y):
    if y == 0:
        return x
    while y != 0:
        x, y = y, x % y
    return x
def lcm(x, y):
    return x * y // gcd(x, y)
def examC():
    A, B = LI()
    ans = lcm(A,B)
    print(ans)
    return

def examD():
    N = I()
    A = LI()
    ans = N; cur = 1
    for a in A:
        if cur==a:
            ans -=1
            cur +=1
    if ans==N:
        ans = -1
    print(ans)
    return

def examE():
    N = I()
    ans = 0
    if N%2==0:
        N //=2
        while(N>0):
            ans +=N//5
            N //=5
    print(ans)
    return

def examF():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examE()


Measured memory_bytes: 38384
N = int(input())
table = [[0 for i in range(N+1)] for j in range(3)]
for i in range(N):
    abc = list(map(int, input().split()))
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            table[k][i+1] = max(table[k][i+1], table[j][i]+abc[k])
ans = max([table[i][-1] for i in range(3)])
print(ans)

Measured memory_bytes: 15004
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>
#include <set>
#include <unordered_map>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b >= c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;

class Solve{
    static void Main(string[] args){
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split();
        int answer = int.MaxValue;
        for (int i = 0; i < N; i++){
            var ai = int.Parse(A[i]);
            var count = 0;
            while ((ai & 1) == 0){
                ai >>= 1;
                count++;}
            answer = Math.Min(count, answer);}
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 27604
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 1;
  REP(i, n) {
    if (ans * 2 <= ans + k) {
      ans *= 2;
    } else {
      ans += k;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=1e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
    return 0;
}


Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    bridge_count = [0] * N
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1; b -= 1
        bridge_count[a] += 1
        bridge_count[b] += 1
    for i in range(N):
        print(bridge_count[i])

if __name__ == "__main__":
    main()


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005


int main()
{
    _FastIO;
    int a , b , c , k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    if(k){
            int x = min(a , k);
        k -= x;
        ans += x;
    }
    if(k){
        int x = min(b  , k);
        k -= x;
    }
    if(k){
        int x = min(k , c);
        k -= c;
        ans -= x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
var n,i,j,left,right:int64;
    A:array[1..200050] of int64;
begin
read(n);
left:=0;
right:=0;
for i := 1 to n do   read(A[i]);
i:=0;j:=0;
while i+j<n do
 if right >= left then
  begin
   left := left+A[i+1];
   inc(i);
   
  end
 else 
  begin
   right := right+A[N-j];
   inc(j);
   
  end;
write(abs(right-left))
end.

Measured memory_bytes: 1664
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;


int main(){
    int n, x;
    scanf("%d%d", &n, &x);
    int sum = 0, cnt = 0;
    for(int i = 0 ; i < n ; ++i){
        cnt += (sum <= x);
        int X;
        scanf("%d", &X);
        sum += X;
    }
    cnt += (sum <= x);
    printf("%d\n", cnt);
}

Measured memory_bytes: 256
function main(input) {
  const s = input[0].split("");
  const t = input[1].split("");

  let count = 0;
  
  for(let i=0;i<s.length;i++){
    if(s[i] != t[i]){
      count++;
    }
  }
  console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 36552
#include <iostream>
#include <math.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    cout << n << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    string s;
    cin >> s;

    ll cnt = 0;
    ll ans = 0;
    rep(i, s.size()){
        if(s[i] == 'B') cnt++;
        if(s[i] == 'W'){
            ans += cnt;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 720
package main

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

const BIG_COST = 200000

type Path struct {
	node int
	cost int
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	nNodes := scanInt(sc)

	// 各頂点につながる頂点一覧を得るための隣接リスト
	graph := make([][]Path, nNodes)

	for i := 0; i < nNodes; i++ {
		u := scanInt(sc)
		k := scanInt(sc)
		graph[i] = make([]Path, k)
		for d := 0; d < k; d++ {
			graph[u][d] = Path{
				node: scanInt(sc),
				cost: scanInt(sc),
			}
		}
	}

	// 0 から各頂点への最小コストを保存する配列
	minCosts := make([]int, nNodes)

	minCosts[0] = 0
	for i := 1; i < nNodes; i++ {
		minCosts[i] = BIG_COST
	}

	// 各頂点が調査済みかどうかを保持する配列
	checked := make([]bool, nNodes)

	// 最小コストのパスを高速に取得するためのヒープ。
	// コストが小さいものほどルートに来るようにする。
	heap := NewHeap(func(a, b Path) bool {
		return a.cost < b.cost
	})

	heap.insert(Path{node: 0, cost: 0})
	for heap.size > 0 {
		u := heap.extractMax()

		// 隣接行列を使っていた時とは違い、ヒープには
		// 同じノードへのパスが複数含まれうる。そのため既によりコストの低い
		// パスが見つかっている場合は無視する。
		if minCosts[u.node] < u.cost {
			continue
		}

		checked[u.node] = true

		for _, v := range graph[u.node] {
			cost := v.cost + u.cost
			if !checked[v.node] && cost < minCosts[v.node] {
				minCosts[v.node] = cost
				heap.insert(Path{node: v.node, cost: cost})
			}
		}
	}

	w := bufio.NewWriter(os.Stdout)
	for i, cost := range minCosts {
		fmt.Fprintf(w, "%d %d\n", i, cost)
	}
	w.Flush()
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

// --- From ALDS1_9_C: Priority Queue

type Heap struct {
	size   int
	heap   []Path
	isHigh func(a, b Path) bool
}

func NewHeap(isHigh func(a, b Path) bool) Heap {
	heap := make([]Path, 1) // 先頭は不使用
	return Heap{size: 0, heap: heap, isHigh: isHigh}
}

func (h *Heap) insert(v Path) {
	h.size += 1
	if h.size > len(h.heap)-1 {
		h.heap = append(h.heap, v)
	} else {
		h.heap[h.size] = v
	}

	for i := h.size; i > 1; {
		parent := i / 2
		if h.isHigh(h.heap[parent], h.heap[i]) {
			break
		}
		h.heap[i], h.heap[parent] = h.heap[parent], h.heap[i]
		i = parent
	}
}

func (h *Heap) extractMax() Path {
	if h.size <= 0 {
		panic("cannot extract from empty heap")
	}

	max := h.heap[1]
	h.heap[1] = h.heap[h.size]
	h.size -= 1
	h.maxHeapify(1)

	return max
}

func (h *Heap) maxHeapify(idx int) {
	left := idx * 2
	right := left + 1
	largest := idx

	if left <= h.size {
		if h.isHigh(h.heap[left], h.heap[idx]) {
			largest = left
		}
		if right <= h.size && h.isHigh(h.heap[right], h.heap[largest]) {
			largest = right
		}
	}

	if largest != idx {
		h.heap[idx], h.heap[largest] = h.heap[largest], h.heap[idx]
		h.maxHeapify(largest)
	}
}



Measured memory_bytes: 11024
#include<iostream>

using namespace std;

int main() {
	int S;
	int sec, min, hour;
	
	cin >> S;

	sec = S % 60;
	min = ((S - sec)/60) % 60;
	hour = ((S - sec - min)/3600) % 60;

	cout << hour << ":" << min << ":" << sec << endl;
	return 0;
}

Measured memory_bytes: 1164