akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
    let n: usize = read();
    let mut map: Vec<i64> = vec![0; n + 1];
    for i in 1..n {
        let a: i64 = read();
        map[a as usize] += 1;
    }

    for i in 1..n + 1 {
        println!("{}", map[i]);
    }
}


Measured memory_bytes: 3532
/*
 * Welcome to my code!
 * -------------------------------------------- *
 * author : lynmisakura(twitter : @andoreiji11)
 */

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

//Simple Array Input
#define SAI int n;cin >> n;vi a(n);ain(a)
//Simple Graph Input
#define SGI(m) for(int i=0;i<m;i++){int a,b;cin >> a >> b;g[--a].pb(--b);g[b].pb(a);}
//Simple Tree Input
#define STI SGI(n-1)

typedef long long ll;
typedef long long integer;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){
    for(int i=0;i<a.size();i++)cout << a[i] << (i < a.size()-1 ? ' ' : '\n');
}

ll dp[110][4][2];

int main(void){
  string s;cin >> s;
  int n = s.length();
  
  int k;cin >> k;
  
  dp[0][0][0] = 1;
  
  rep(i,n){
    rep(j,k+1){
      rep(ov,2){
        rep(num,10){
          
          int ni = i+1,nj = j,nov = ov;
          
          if(num == 0){
            nov = ov || (s[i] != '0');
          }else{
            if(j == k)continue;
            nj = j + 1;
            
            if(!ov && s[i] - '0' < num)continue;
            
            nov = ov || (s[i] - '0' > num);
          }
          
          dp[ni][nj][nov] += dp[i][j][ov];
        }
      }
    }
  }
  
  cout << dp[n][k][0] + dp[n][k][1] << '\n';
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N,i,K;
	cin>>N>>K;
	int dp[N];
	long long int A[N];
	long long int cost[N],j,k,m=0;
	for(i=0;i<N;i++)
	{
	cin>>A[i];
	}
	cost[0]=0;
	cost[1]=abs(A[1]-A[0]);
	if(N==2)
	cout<<cost[1];
	else
	{
		for(i=2;i<N;i++)
		{
			k=cost[i-1]+abs(A[i]-A[i-1]);
			for(j=i-2;(j>=0)&&(j>(i-K-1));j--)
			k=min(k,(cost[j]+abs(A[i]-A[j])));
			cost[i]=k;
		}
		cout<<cost[N-1];
	}
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>

using namespace std;

void solve(int r, int g, int b) {
    int num = 100*r + 10*g + b;
    if (num%4 == 0) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}

int main() {
    struct timeval start,end;
    long long span;
    int r, g, b;

    gettimeofday(&start,NULL);

    std::cin >> r >> g >> b;
    solve(r, g, b);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 256
const main = (standardInput) =>{
    const length_list = standardInput.split(' ');
    const vartical_length = Number.parseInt(length_list[0]);
    const horizon_length = Number.parseInt(length_list[1]);
    
    console.log(`${vartical_length * horizon_length} ${(2*vartical_length) + (2*horizon_length)}`);
}
main(require('fs').readFileSync('/dev/stdin','UTF-8'));


Measured memory_bytes: 15112
const stdin: string[] = [];

function main() {
    const input = stdin[0];
    const L = parseInt(input, 10);

    const N = L / 3;
    console.log(N * N * N);
}

require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
}).on("line", _ => {
    stdin.push(_);
}).on("close", () => main());



Measured memory_bytes: 7628
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

constexpr ll MOD = 1000003LL;
ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif

	auto FAC = make_v(MOD + 1, 0LL);
	auto DEFAC = make_v(MOD + 1, 0LL);
	FAC[0] = 1;
	FAC[1] = 1;
	FOR(i, MOD) {
		auto j = i + 2;
		if (j >= MOD) break;
		FAC[j] = (FAC[j - 1] * static_cast<ll>(j)) % MOD;
	}
	DEFAC[MOD - 1] = myPow(FAC[MOD - 1], MOD - 2, MOD);
	for (auto i = MOD - 2; i > 0; --i) {
		DEFAC[i] = DEFAC[i + 1] *  ll(i+1 ) % MOD;
	}
	DEFAC[0] = -1;


	
	ll Q; cin >> Q;


	FOR(i, Q) {
		ll x, d, n;
		cin >> x >> d >> n;
		if (d == 0) {
			cout << myPow(x, n, MOD) << endl;
			continue;
		}
		ll k = (x * myPow(d, MOD - 2, MOD) % MOD);
		ll rightLimit = k + n - 1;
		ll ans;
		if (rightLimit >= MOD or k == 0) {
			ans = 0;
		}
		else {
			ans = FAC[rightLimit];
			ans = ans * DEFAC[k - 1] % MOD;
			ans = ans * (myPow(d, n, MOD)) % MOD;
		}

		cout << ans % MOD << endl;

	}

	return 0;
}


Measured memory_bytes: 16512
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    la = rli()
    la.sort()
    if la[-1] < 0:
        la.sort(reverse=True)
    lo = []
    # 符号の判定

    if la[0] * la[-1] <= 0:
        m = sum(abs(a) for a in la)
        l = la[0]
        r = la[-1]
        la = la[1:-1]
    else:
        m = sum(abs(a) for a in la[2:]) + abs(la[0]-la[1])
        if la[0] < 0:
            l = la[1]
            r = la[0]
        else:
            l = la[0]
            r = la[1]
        la = la[2:]
    while len(la) > 0:
        c = la.pop()
        if c >= 0:
            lo.append((l, r))
            l, r = min(l-r, c), max(l-r, c)
        else:
            lo.append((r, l))
            l, r = min(r-l, c), max(r-l, c)
    if r-l > l-r:
        lo.append((r, l))
    else:
        lo.append((l, r))

    print(m)
    for o in lo:
        print(o[0], o[1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 19112
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<queue>
#include<vector>
#define LL long long
#define ULL unsigned long long
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define itn int
#define pritnf printf
#define mp make_pair
#define pb push_back
using namespace std;

LL n;

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

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;

# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
# define pb push_back
 
ll N;

ll findSumOfDigits(ll n);
ll findSumOfDigits(ll n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N;
    ll min = INF;
    
    reps(i,N-1) {
        // A+B = N
        // B = N -A
        ll j = N - i;
        
        ll sumOfDigitsOfA = findSumOfDigits(i);
        ll sumOfDigitsOfB = findSumOfDigits(j);
        ll s = sumOfDigitsOfA + sumOfDigitsOfB;
        if (min > s) {
            min = s;
        }
    }
    
    cout << min << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#define int long long
using namespace std;

int n;
vector<int> et[100000];
vector<int> ec[100000];
int q, r;
int x, y;
int dist[100000];

void dfs(int v, int p = -1, int d = 0) {
	dist[v] = d;
	for (int i = 0; i < et[v].size(); i++) {
		if (et[v][i] == p) continue;
		dfs(et[v][i], v, d + ec[v][i]);
	}
}

signed main() {
	int i;
	
	cin >> n;
	for (i = 0; i < n - 1; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		et[a].push_back(b);
		et[b].push_back(a);
		ec[a].push_back(c);
		ec[b].push_back(c);
	}
	
	cin >> q >> r;
	r--;
	
	dfs(r);
	
	for (i = 0; i < q; i++) {
		cin >> x >> y;
		x--; y--;
		cout << dist[x] + dist[y] << endl;
	}
	return 0;
}

Measured memory_bytes: 21376
#include <iostream>
#include <cstdlib>
#include <string.h>

using namespace std;

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

    //! 集合の最大値を見つける。これが N となる
    int xMax = 0;
    int indexMax = 0;
    for (int i = 0; i < N; i++)
    {
        if (xMax < X[i])
        {
            xMax = X[i];
            indexMax = i;
        }
    }
    
    //! comb を最大にし得る理想の target を求める
    int xTarget = xMax/2;

    int R = -1; //! (-1) よりも、target までの距離が近くなる R が必ず存在する

    int distanceMin = abs(xTarget - R); 
    for (int i = 0; i < N; i++)
    {
        //! 同じ X を参照した場合、除外
        if (!(i != indexMax))
        {
            continue;
        }
        
        //! この時点で xMax が集合の最大値であることは求まっているので
        //! N >= R は保証しなくてよい

        int tmpR = X[i];
        int tmpDistance = abs(xTarget - tmpR);
        //! 現状の最小距離よりも短い距離のものが見つかった場合、更新
        if (distanceMin > tmpDistance)
        {
            R = tmpR;
            distanceMin = tmpDistance;
        }
    }
    
    cout << xMax << " " << R << endl;    
}

Measured memory_bytes: 640
n = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a, b, c, d, e]

for i in f:
    n += ((i - 1) // 10 + 1) * 10

g = [(f[i] - 1) % 10 + 1 for i in range(5)]
n = n - 10 + min(g)
print(n)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define pb pop_back
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define Sim template<class n
Sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
Sim> auto operator << (ostream &p, n y) -> 
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
Sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
Sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
Sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " = ", (x), " "
#define A(a, i) #a "[" #i " = ", i, "] = ", a[i], " "
const int M = 1024 * 256;

int n;
string s;
int T[M];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cin >> n >> s;
	FORD(i, n - 1, 0)
	{
		T[i] = T[i + 1] + (s[i] == '.');
	}
	int res = T[0], tmp = 0;
	FOR(i, 0, n - 1)
	{
		tmp += (s[i] == '#');
		mini(res, tmp + T[i + 1]);
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 1428
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,i,j,k,l,n;
  cin>>n>>a>>b;
  n--;
  for(i=0;i<n;i++){
    cin>>j>>k;
    l=max((a-1)/j,(b-1)/k)+1;
    a=l*j;
    b=l*k;
    //cout << a << " " << b << endl;
  }
  cout << a+b << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int n;
    int a[100010];
    bool same[100010] = {};
    int ans = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i+1 == a[i]) {
            same[i+1] = true;
        }
    }

    for (int i = 1; i <= n; i++) {
        if (same[i]) {
            if (same[i+1]) {
                i++;
                ans++;
            }
            else {
                ans++;
            }
        }
    }

    cout << ans << endl;

}



Measured memory_bytes: 896
#include <iostream>

using namespace std;
const int MAXN = 1e5+5;
int arr[MAXN];
int main(){
    int n,z,w;
    cin>>n>>z>>w;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    if(n == 1){
        cout<<abs(arr[1]-w)<<endl;
        return 0;
    }
    cout<<max(abs(arr[n]-w),abs(arr[n-1]-arr[n]));
}

Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
    const ll MOD = 1e9+7;
    ll n;
    std::cin >> n;
    vector<ll> t(n);
    vector<ll> a(n);
    
    for (int i = 0; i < n; i++) {
        std::cin >> t[i];
    }
    ll last_max_index = -1;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        if(i>0){
            if(a[i] < a[i-1] && last_max_index == -1){
                last_max_index = i-1;
            }
        }
    }
    if(a[0] != t[n-1]){
        std::cout << 0 << std::endl;
        return 0;
    }
    
    
    if( last_max_index == -1){
        last_max_index = n-1;
    }
    
    ll now = -1;
    ll result = 1;
    
    for (int i = 0; i < last_max_index; i++) {
        // 固定
        if( t[i] > a[i] ){
            std::cout << 0 << std::endl;
            return 0;
        }
        if(t[i] == now){
            result *= now;
            result %= MOD;
        }else{
            now = t[i];
        }
    }
    now = -1;
    
    for (int i = n-1; i >= last_max_index; i--) {
        if( t[i] < a[i] ){
            std::cout << 0 << std::endl;
            return 0;
        }
        if(a[i] == now){
            result *= now;
            result %= MOD;
        }else{
            now = a[i];
        }
    }
    
    std::cout << result << std::endl;
}


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

using namespace std;

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

  string s, t;
  cin >> s >> t;

  // for (int i = 0; i < s.size(); ++i) {
  //   if (s[i] != t[i]) {
  //     cout << "No" << '\n';
  //     return 0;
  //   }
  // }
  // cout << "Yes" << '\n';

  t.pop_back();
  if (s == t)
    cout << "Yes" << '\n';
  else
    cout << "No" << '\n';

  return 0;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, n);
  in(string, s);
  int ans = 0;
  rep(i, n + 1) {
    set<char> a, b;
    rep(j, n)(j < i ? a : b).insert(s[j]);
    int cnt = 0;
    for (char c : a)
      if (b.count(c)) ++cnt;
    ans = max(ans, cnt);
  }
  out(ans);
}


Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int c[][] = new int[3][3];

		for (int i = 0; i < 3; i++) {
			String str[] = br.readLine().split(" ");
			for (int j = 0; j < 3; j++) {
				c[i][j] = Integer.parseInt(str[j]);
			}
		}

		for (int i = 0; i < 3; i++) {
			int s = c[(i + 1) % 3][0] - c[i][0];
			int t = c[(i + 1) % 3][1] - c[i][1];
			int u = c[(i + 1) % 3][2] - c[i][2];

			if (s != t || t != u || u != s) {
				System.out.println("No");
				return;
			}
		}

		System.out.println("Yes");
	}
}


Measured memory_bytes: 21076
#define REP(i, n) for (int i = 0;i<(int)(n);i++)
#define REPI(i, a, n) for(int i=int(a);i<int(b);i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

typedef long long ll;

#include <bits/stdc++.h>

using namespace std;


int main(){
    std::cin.tie(0);
    int n,a;
    int i;
    int cnt=0;
    cin >> n;

    REP(i,n){
        cin>>a;
        while(a%2==0){
            a/=2;
            cnt++;
        }
    }
    cout<<cnt<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli r, c, n;
vector<pair<lli, lli>> a;

lli f(lli x, lli y) {
  lli p = 0;
  if (x == 0) p = y;
  else if (y == c) p = c + x;
  else if (x == r) p = c + r + (c - y);
  else if (y == 0) p = 2*c + r + (r - x);
  return p;
}

int main() {
  cin >> r >> c >> n;
  for (lli i=0; i<n; ++i) {
    lli x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if ((x1 == 0 || x1 == r || y1 == 0 || y1 == c)
        && (x2 == 0 || x2 == r || y2 == 0 || y2 == c)) {
      lli p1 = f(x1, y1), p2 = f(x2, y2);
      a.emplace_back(min(p1, p2), max(p1, p2));
    }
  }
  sort(begin(a), end(a));
  vector<lli> r;  
  bool ok = true;
  for (auto& p : a) {
    while (true) {
      if (r.empty()) { r.push_back(p.second); break; }
      else if (r.back() < p.first) { r.pop_back(); }
      else if (p.second < r.back()) { r.push_back(p.second); break; }
      else { ok = false; goto out; }
    }
  }
out:
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}



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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

ll n,x,ans=1ll<<60;
ll a[2005],mina[2005][2005];

int main(){
	n=readint(); x=readint();
	for(int i=1;i<=n;i++) a[i]=readint();
	for(int i=1;i<=n;i++){
		int now=i;
		mina[i][0]=a[i];
		for(int j=1;j<=n;j++){
			now=(now+n-2)%n+1;
			mina[i][j]=min(mina[i][j-1],a[now]);
//			cout<<mina[i][j]<<' ';
		}
//		cout<<endl;
	}
	for(int i=0;i<=n;i++){
		ll now=0;
		for(int j=1;j<=n;j++) now+=mina[j][i];
		ans=min(ans,now+i*x);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;  cin >> n >> m;
    if (m >= n * 2) {
      m -= n * 2;
      cout << n + m / 4 << endl << '\n';
    } else {
      cout << m / 2 << '\n';
    }

    return 0;
}


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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

ll a, b;

bool read() {
    if (!(cin >> a >> b))
        return false;
    
    return true;
}

void solve() {
    if (a > 0) {
        cout << "Positive\n";
    } else if (a <= 0 && b >= 0) {
        cout << "Zero\n";
    } else {
        if ((b - a) % 2 == 0)
            cout << "Negative\n";
        else
            cout << "Positive\n";
    }
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
    while (read())
        solve();
    
    return 0;
}



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

int main(){
    set<pair<int, pair<int, int> > > s;
    for(int i=1;i<=200;++i){
        for(int j=1;j<i;++j){
            s.insert(make_pair(i*i+j*j,make_pair(j,i)));
        }
    }
    while(true){
        int h, w;
        set<pair<int, pair<int, int> > >::iterator it;
        cin >> h >> w;
        if(!(h||w)) break;
        it = s.find(make_pair(h*h+w*w,make_pair(h, w)));
        ++it;
        cout << (*it).second.first << ' ' << (*it).second.second << endl;
    }
}

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

int main()
{
	int n, l;
	string w;
	cin.tie(0);

	while (cin >> w && w != "-") {
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> l;
			w = w.substr(l) + w.substr(0, l);
		}
		cout << w << "\n";
	}
}



Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <climits>
#include <set>
#include <queue>
#include <unordered_set>
using namespace std;

#define ll long long

const ll mod = 1e9 + 7;

class Solver
{
private:
	ll n;
	ll a;
	ll b;
	vector<ll> h;
	priority_queue<ll> que;
public:
	Solver();
	bool binary_check(ll times);
	void exec();
};

Solver::Solver(){
	cin >> n >> a >> b;
	for (int i = 0; i < n; ++i)
	{
		ll tmp;
		cin >> tmp;
		h.push_back(tmp);
		que.push(tmp);
	}

}

bool Solver::binary_check(ll times){
	priority_queue<ll> q = que;
	ll min_v = b * times;
	ll dif = a - b;
	if(min_v >= q.top()) return true;
	ll count = 0;
	// cout << min_v << " " << que.size() << endl;
	while(!q.empty()) {
		ll cur = q.top();
		q.pop();
		// cout << cur << " ";
		if(cur <= min_v) return true;
		// cout << (cur - min_v + dif) / dif << endl;
		count += (cur - min_v + dif - 1) / dif;
		if(count > times) return false;
	}
	return true;

}

void Solver::exec(){
	ll left = 0;
	ll right = mod;
	while(left + 1 < right){
		ll mid = (left + right) / 2;
		if(binary_check(mid)){
			right = mid;
		}else{
			left = mid;
		}
	}
	// cout << binary_check(800000000) << endl;
	cout << right << endl;

}

int main(){
	Solver solution = Solver();
	solution.exec();
}


Measured memory_bytes: 2796
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;

char c[2000][2000];
int u[2000][2000];
int l[2000][2000];
int d[2000][2000];
int r[2000][2000];
int main(){
    int H,W;
    cin >> H >> W;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> c[i][j];
        }
    }
    
    for(int i=0; i<W; i++){
        if(c[0][i]=='#'){
            u[0][i]=-1;
        }else{
            u[0][i]=0;
        }
        
        if(c[H-1][i]=='#'){
            d[H-1][i]=-1;
        }else{
            d[H-1][i]=0;
        }
    }
    for(int i=0; i<H; i++){
        if(c[i][0]=='#'){
            l[i][0]=-1;
        }else{
            l[i][0]=0;
        }
        
        if(c[i][W-1]=='#'){
            r[i][W-1]=-1;
        }else{
            r[i][W-1]=0;
        }
    }
    
    for(int i=1; i<H; i++){
        for(int j=0; j<W; j++){
            if(c[i][j]=='#'){
                u[i][j]=-1;
                continue;
            }
            u[i][j]=u[i-1][j]+1;
        }
    }
    for(int i=H-2; i>=0; i--){
        for(int j=0; j<W; j++){
            if(c[i][j]=='#'){
                d[i][j]=-1;
                continue;
            }
            d[i][j]=d[i+1][j]+1;
        }
    }
    for(int i=0; i<H; i++){
        for(int j=1; j<W; j++){
            if(c[i][j]=='#'){
                l[i][j]=-1;
                continue;
            }
            l[i][j]=l[i][j-1]+1;
        }
    }
    for(int i=0; i<H; i++){
        for(int j=W-2; j>=0; j--){
            if(c[i][j]=='#'){
                r[i][j]=-1;
                continue;
            }
            r[i][j]=r[i][j+1]+1;
        }
    }
    
    int ans=0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(c[i][j]=='#'){
                continue;
            }
            
            ans = max(ans, 1+u[i][j]+d[i][j]+l[i][j]+r[i][j]);
        }
    }
    
    cout<<ans<<endl;
    
//    for(int i=0; i<H; i++){
//        for(int j=0; j<W; j++){
//            if(d[i][j]==-1){
//                cout<<'#';
//            }else{
//                cout<<d[i][j];
//            }
//        }
//        cout<<endl;
//    }
    return 0;
}






Measured memory_bytes: 66688
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	vector<ll> a(n);
	REP(i,n) cin >> a[i];
	ll cnt = 0;
	REP(i,n) cnt += a[i] % 2 ? 0 : 1;
	if(cnt % 2) cout << "First" << endl;
	else {
		ll t = 0;
		bool upd = true;
		while(cnt == n - 1 && upd) {
			upd = false;
			REP(i,n) if(a[i] % 2) {
				if(a[i] == 1) break;
				upd = true;
				t++;
				a[i]--;
				ll g = a[0];
				REP(j,n) g = gcd(g, a[j]);
				REP(j,n) a[j] /= g;
				cnt = 0;
				REP(j,n) cnt += a[j] % 2 ? 0 : 1;
				break;
			}
		}
		if(cnt % 2 != t % 2) cout << "First" << endl;
		else cout << "Second" << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
  int w,h,x,y,r;
  scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
  if(x+r<=w&&x-r>=0&&y+r<=h&&y-r>=0)printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 1012
import sys
def input(): return sys.stdin.readline().strip()

def main():
    S = input()
    T = input()
    s = len(S)
    t = len(T)
    if s < t:
        print("UNRESTORABLE")
        return
    for i in range(s - t, -1, -1):
        correspond = True
        for j in range(t):
            if S[i + j] != '?' and S[i + j] != T[j]:
                correspond = False
                break
        if correspond:
            ans = [S[k] for k in range(s)]
            for j in range(t): ans[i + j] = T[j]
            for k in range(s):
                if ans[k] == '?': ans[k] = 'a'
            print("".join(ans))
            return
    print("UNRESTORABLE")

if __name__ == "__main__":
    main()


Measured memory_bytes: 62116
#include <stdio.h>
int main(void)
{
  int n;
  int max,min,sum;
  int i;
  int ans;
  while(1){
    sum=0;
    scanf("%d",&n);
    if(!n) break;
    int a[n];
    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
      sum+=a[i];
    }
    max=a[0];min=a[0];
    for(i=0;i<n;i++){
      if(max<a[i])
	max=a[i];
      if(min>a[i])
	min=a[i];
    }
    ans=(sum-max-min)/(n-2);
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 600
N = int(input())
topdigi = int(str(N)[0])
keta = len(str(N))

candidate = int(str(topdigi) + "9" * (keta - 1))

if candidate > N:
    ans = (topdigi - 1) + 9 * (keta - 1)
else:
    ans = topdigi + 9 * (keta - 1)
print(ans)


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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

const ll MOD = 998244353;

ll dp[200010];
pair<ll,ll> a[200010];
int seg[1000010];
int n;

void add(int t, int start, int end, int idx, int val)
{
    seg[t] = max(seg[t], val);
    if(start == end) return;
    int mid = (start + end)/2;
    if(idx <= mid) return add(2*t, start, mid, idx, val);
    return add(2*t+1, mid+1, end, idx, val);
}

int get(int t, int start, int end, int idx)
{
    if(start == end) return seg[t];
    int mid = (start + end) / 2;
    if(idx <= mid) return get(2*t, start, mid, idx);
    return get(2*t+1, mid+1, end, idx);
}

int query(int t, int start, int end, int l, int r)
{
    if(start > r || end < l) return 0;
    if(l <= start && r >= end) return seg[t];
    int mid = (start + end) / 2;
    int r1 = query(2*t, start, mid, l, r);
    int r2 = query(2*t+1, mid+1, end, l, r);
    return max(r1, r2);
    //return seg[t];
}

bool sortiraj(pair<ll,ll> x1, pair<ll,ll> x2)
{
    return x1.fi < x2.fi;
}

int bin(int l, int r, int x)
{
    if(l == r) return l;
    int p = (l + r + 1)/2;
    if(a[p].fi >= x) return bin(l, p - 1, x);
    return bin(p, r, x);
}

int binarna(int ind)
{
    int kraj;
    kraj = bin(ind, n - 1, a[ind].fi + a[ind].se);
    //if(ind == 0) cout << ind << " .. " << kraj << "\n";
    int k = query(1, 0, n-1, ind, kraj);
    //if(ind == 0) cout << k << "\n";
    return k;
}

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

    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i].fi >> a[i].se;

    sort(a, a + n, sortiraj);
    dp[n] = 1;
    for(int i = 0; i < n; i++)
        add(1, 0, n - 1, i, i + 1);
    for(int i = n - 1; i >= 0; i--)
    {
        int index = binarna(i);
        dp[i] = (dp[i+1] + dp[index]) % MOD;
        add(1, 0, n - 1, i, index);

        /*cout << i << ": ";
        for(int i = 0; i < n; i++) cout << get(1, 0, n - 1, i) << " ";
        cout << "\n";*/
    }
    //cout << dp[1] << "\n";
    cout << dp[0];

    return 0;
}


Measured memory_bytes: 8832
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,l[211]={},a=0;
	cin>>n;
	FOR(i,0,2*n)cin>>l[i];
	sort(l,l+2*n);
	FOR(i,0,2*n){
		a+=l[i];
		i++;
	}
	cout<<a;

    return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ab = br.readLine().split(" ");
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);
        
        if (a==1) System.out.println(1);
        else System.out.println(a-b+1);
        
    }
    
    
}


Measured memory_bytes: 21204
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
using ll=long long;

int main(){
	ll n,a[5],MIN=1e+15,ans;

	cin>>n;
	for(int i=0;i<5;i++){
		cin>>a[i];
		if(MIN>=a[i])
			MIN=a[i];
	}
	if(n%MIN==0)ans=n/MIN+4;
	else ans=n/MIN+5;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
n = int(input())
n1 = n//1000
n2 = (n-n1*1000)//100
n3 = (n-n1*1000-n2*100)//10
n4 = (n-n1*1000-n2*100-n3*10) 

if n1 == n2 or n2 == n3 or n3 == n4:
  print("Bad")
else:
  print("Good")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a(M);
  vector<int> b(M);
  for(int i=0;i<M;i++){
    cin>>a.at(i)>>b.at(i);
  }
  vector<int> ans(N);
  for(int i=M;i<N;i++){
    a.push_back(0);
    b.push_back(0);
  }
  for(int i=0;i<M;i++){
    if(a.at(i)!=0 && b.at(i)!=0){
      ans.at(a.at(i)-1)++;
      ans.at(b.at(i)-1)++;
    }
  }
  for(int i=0;i<N;i++){
    cout<<ans.at(i)<<endl;
  }
  return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT12 istream& operator>>(istream &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT12 ostream& operator<<(ostream &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 ostream& operator<<(ostream &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT istream& operator>>(istream &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT ostream& operator<<(ostream &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;







void _main() {
        int a, b; cin >> a >> b;
        cout << a * b;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> v;
for(int i =0;i<n;i++)
{
   int a;
cin>>a;
v.push_back(a);
}
int sum =0;
for(int i =0;i<n;i++)
{
	for(int j =i+1;j<n;j++)
	sum+=v[i]*v[j];
}
cout<<sum;
return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    private static Map<Long, Integer> map = new HashMap<>();

    private static void primeFactors(long n) {
        while (n % 2 == 0) {
            map.put(2L, map.getOrDefault(2L, 0) + 1);
            n /= 2;
        }
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            while (n % i == 0) {
                map.put(i, map.getOrDefault(i, 0) + 1);
                n /= i;
            }
        }
        if (n > 2) {
            map.put(n, map.getOrDefault(n, 0) + 1);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        final long MOD = 1_000_000_007;
        for (int i = 2; i <= n; i++) {
            primeFactors(i);
        }
        long sum = 1;
        for (Entry<Long, Integer> e : map.entrySet()) {
            sum *= e.getValue() + 1;
            sum %= MOD;
        }
        System.out.println(sum);
    }

}


Measured memory_bytes: 36824
n = input()
a = list(map(int, input().split()))
flg = True
cnt = 0

while flg:
    for i in range(len(a)):
        if a[i] % 2 != 0:
            flg = False
        a[i] = a[i] / 2
    cnt += 1

print(cnt - 1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ratio>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<ll, ll> mp;

int main()
{
	ll n;
	cin >> n;
	ll mod = n % 11;
	ll ans = n / 11*2;
	if (mod >= 7) ans += 2;
	else if (mod > 0) ans++;
	cout << ans << endl;
}


Measured memory_bytes: 3684
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0;i<n;i++){
            a[i] = sc.nextInt();
        }
        int tabe = 0;
        for(int i = 0;i<d;i++){
            for(int j = 0;j<n;j++){
                if(i%a[j] == 0){
                    tabe++;
                }
            }
        }
        tabe += x;
        System.out.println(tabe);
        sc.close();
    }
}

Measured memory_bytes: 22996
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int N;
  long long p = 1;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    if (p > 1000000007) p %= 1000000007;
    p *= i;
  }

  p %= 1000000007;
  cout << p << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
B,W = map(int,input().split())
mod = 10**9+7

fact = [0]*(10**6+1)
fact[0] = 1
for i in range(10**6):
    fact[i+1] = fact[i]*(i+1)%mod

def comb_(n,k):
    return fact[n]*pow(fact[k],mod-2,mod)*pow(fact[n-k],mod-2,mod)*pow(2,(n+1)*(mod-2),mod)%mod

f_B = defaultdict(lambda:pow(2,mod-2,mod))
f_W = defaultdict(lambda:pow(2,mod-2,mod))
g = defaultdict(lambda:pow(2,W*(mod-2),mod))

for i in range(B,B+W):
    f_B[i+1] = f_B[i]-comb_(i-1,B-1)*pow(2,mod-2,mod)
    f_B[i+1] %= mod

for i in range(W,B+W):
    f_W[i+1] = f_W[i]-comb_(i-1,W-1)*pow(2,mod-2,mod)
    f_W[i+1] %= mod

for i in range(W+1,B+W):
    g[i+1] = g[i] + comb_(i-1,W-1)
    g[i+1] %= mod

for i in range(1,B+W+1):
    if i < W+1:
        print(f_B[i])
    else:
        print((f_B[i]+f_W[i]+g[i]-pow(2,mod-2,mod))%mod)



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

long long int a[3000] = {0};
int used[3000][3000] = {0};
long long int dp[3000][3000] = {0};

long long int f(int l, int r) {
    if (used[l][r]){
        return dp[l][r];
    }
    used[l][r] = 1;

    if (l==r){
        dp[l][r] = a[r];
    }
    else {
        dp[l][r] = max(a[l]-f(l+1,r), a[r]-f(l, r-1));
    }
    
    return dp[l][r];
}

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

    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    cout << f(0, N-1) << endl;
    return 0;
}

Measured memory_bytes: 105216
#include<iostream>
#include<vector>
#include<algorithm>
#include<deque>
#include<climits>
#include<cassert>
#include<cmath>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 110

using namespace std;

int V,E,ans;
vector<int> G[MAX];
int COST[MAX][MAX];
bool used[MAX];

void dfs(int node,deque<int>& deq,int sp){
  if(node >= 15)return;

  if(node >= 2){
    auto check = [&]()mutable->int{
      int ret = 0,len = deq.size();
      int mincost[len];
      //for(int& i : mincost)i = IINF;
      rep(i,len)mincost[i] = IINF;
      for(int i=0;i<len;i++){
	for(int j=i+1;j<len;j++){
	  int cost = COST[deq[i]][deq[j]];
	  if(cost==0)return -1;
	  mincost[i] = min(mincost[i],cost);
	  mincost[j] = min(mincost[j],cost);
	}
      }
      //for(int& i : mincost) ret += i;
      rep(i,len) ret += mincost[i];
      return ret;
    };
    int tmp = check();
    if(tmp != -1)ans = max(ans,tmp);
  }

  REP(i,sp,V){
    if(used[i])continue;
    if(G[i].size() < node)continue;
    used[i] = true;
    deq.push_back(i);
    dfs(node+1,deq,i+1);
    deq.pop_back();
    used[i] = false;
  }
}

int main()
{
  int test[4];
  for(int& i : test);
  cin >> V >> E;
  rep(i,V)G[i].clear();
  rep(i,E){
    int u,v,f;
    cin >> u >> v >> f;
    u--,v--;
    G[u].push_back(v);
    G[v].push_back(u);
    COST[u][v] = COST[v][u] = f;
  }

  deque<int> deq;
  dfs(0,deq,0);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1264
def d_maze_master():
    from collections import deque
    H, W = [int(i) for i in input().split()]
    Maze = [list(input()) for _ in range(H)]

    def bfs(start_row, start_col):
        diff = ((-1, 0), (0, 1), (1, 0), (0, -1))

        def is_inside(row, col):
            return 0 <= row < H and 0 <= col < W

        queue = deque([(start_row, start_col)])
        dist = [[-1 for _ in range(W)] for _ in range(H)]
        dist[start_row][start_col] = 0
        while queue:
            row, col = queue.pop()
            for dr, dc in diff:
                nr, nc = row + dr, col + dc
                if is_inside(nr, nc) and Maze[nr][nc] != '#' and dist[nr][nc] == -1:
                    queue.appendleft((nr, nc))
                    dist[nr][nc] = dist[row][col] + 1
        return dist

    ans = 0
    for start_row in range(H):
        for start_col in range(W):
            if Maze[start_row][start_col] == '#':
                continue
            dist = bfs(start_row, start_col)
            for row in range(H):
                for col in range(W):
                    if Maze[row][col] != '#':
                        ans = max(ans, dist[row][col])
    return ans

print(d_maze_master())


Measured memory_bytes: 3316
import numpy

s = list(input())
N = len(s)
count_A = 0
count_B = 0

for i in range(N):
    s[i] = int(str(s[i]))

A = numpy.empty(N)
B = numpy.empty(N)

for j in range(N):
    if j % 2 == 0 :
        A[j] = 1
        B[j] = 0
    else:
        A[j] = 0
        B[j] = 1

for k in range(N):
    A[k]=s[k]-A[k]
    B[k]=s[k]-B[k]
    if A[k] != 0:
        count_A = count_A + 1
    if B[k] != 0:
        count_B = count_B + 1

if count_A > count_B :
    print(count_B)
else :
    print(count_A)





Measured memory_bytes: 15028