akhauriyash/Code-Regression huggingface dataset:
/* generated by esotope-bfc */
#include <stdio.h>
#include <stdint.h>
#define GETC() (fflush(stdout), fgetc(stdin))
#define PUTC(c) fputc(c, stdout)
#define PUTS(s) fwrite(s, 1, sizeof(s)-1, stdout)
static uint8_t m[30000], *p = m;
int main(void) {
	p[5] = GETC();
	++p[5];
	p[9] = 0;
	p[6] = 0;
	p[7] = 0;
	while (p[5]) {
		--p[5];
		++p[6];
		p[9] += p[7]+1;
		p[7] = GETC();
		++p[7];
		p += 2;
	}
	--p[4];
	--p[7];
	p[3] = 0;
	int loopcnt0;
	for (loopcnt0 = p[7]; loopcnt0 > 0; --loopcnt0) {
		p[8] += 4;
		++p[4];
		int loopcnt1;
		for (loopcnt1 = p[8]; loopcnt1 > 0; --loopcnt1) {
			p[5] += 4;
			p[6] += 8*p[5];
			p[5] = 0;
		}
		p[8] = 0;
	}
	p[7] = 0;
	if (p[6]) {
		++p[5];
		--p[4];
		p[6] = 0;
	}
	p[6] = 0;
	if (p[4]%2) {
		while (1); /* infinite loop */
	}
	p[3] += p[4]/2;
	p[4] = 0;
	while (p[3]) {
		while (p[1]) {
			while (p[2] != 0) p -= 2;
			--p[3];
			while (p[4] != 0) p += 2;
			--p[1];
		}
		while (p[2] != 0) p -= 2;
		if (p[3]) {
			++p[4];
			p[3] = 0;
		}
		p[3] = 0;
		--p[4];
		p[6] += p[4];
		p[4] = 0;
		while (p[6] != 0) p += 2;
		--p[4];
		p[3] += p[5]-1;
		p[5] = p[7];
		p[7] = 0;
	}
	while (p[5]) {
		p[1] = 0;
		--p[5];
		--p[2];
		p -= 2;
	}
	p[6] -= 9;
	++p[7];
	while (p[4]) {
		while (p[6]) {
			++p[6];
			p += 2;
		}
		while (p[7]) {
			++p[5];
			p[6] -= 9;
			p += 2;
		}
		--p[2];
		p -= 2;
	}
	if (p[5]) {
		p[4] += 6;
		p[5] += 8*p[4];
		p[4] = 0;
		PUTC(p[5]);
		p[5] = 0;
	}
	p[6] += 57;
	PUTC(p[6]);
	PUTS("\n");
	return 0;
}


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

int main() {

int n,m;
cin>>n>>m;

int f=0,s=INT_MAX;
for(int index=0;index<m;index++)
{
   int first,second;
   cin>>first>>second;
   
  f=max(first,f);
  s=min(second,s);
    
} 
cout<<max(s-f+1,0)<<endl;
	return 0;
}


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

int main(void) {
    map<string, vector<int>> hm;
    
    string name; int page;
    while(cin >> name >> page) {
        hm[name].push_back(page);
        //cout << "hm[" << name << "] = " << hm[name] << endl;
    }
    for(auto ite = hm.begin(); ite != hm.end(); ite++) {
        cout << ite->first << endl;
        sort(ite->second.begin(), ite->second.end());
        for(int r = 0; r < ite->second.size(); r++) {
            cout << ite->second[r];
            if(r == ite->second.size()-1) putchar('\n');
            else putchar(' ');
        }
    }
    return(0);
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, x;
	cin >> n >> x;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	ll ans = 0;
	rep(i, n - 1) {
		ll tmp = a[i] + a[i + 1];
		if (tmp <= x) continue;
		if (tmp - a[i + 1] <= x) {
			ans += (tmp - x);
			a[i + 1] -= tmp - x;
		}
		else {
			a[i + 1] = 0;
			ans += tmp - x;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)

typedef long long ll;

const int N=2333,NN=5e6;
const ll p=1e9+7;

int n,k;
ll jc[NN+3],njc[NN+3],f[N][N],g[N][N];

ll ksm(ll x,ll w){
	ll ans=1;
	while(w){
		if(w&1ll) (ans*=x)%=p;
		(x*=x)%=p;
		w>>=1;
	}
	return ans;
}

ll C(ll a,ll b){
	return (jc[a]*njc[b]%p)*njc[a-b]%p;
}

int main(){
	scanf("%d%d",&n,&k);

	if(k==1){
		printf("1\n");
		return 0;
	} 

	jc[0]=njc[0]=1;int L=5e6;
	rep(i,1,L) jc[i]=(jc[i-1]*i)%p;
	rep(i,1,L) njc[i]=ksm(jc[i],p-2);

	rep(j,1,n) g[n][j]=1;f[n][n]=1;
	per(i,n-1,1){
		rep(j,i,n)
			f[i][j]=(g[i+1][j]*C(n-j+(n-i+1)*(k-1)-1,k-2))%p;
		per(j,n,1) g[i][j]=(g[i][j+1]+f[i][j])%p;
	} 

	ll ans=0;
	rep(i,1,n) (ans+=f[1][i])%=p;
	(ans*=jc[n])%=p;

	printf("%lld\n",ans);

	return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int n;
  cin >> n;
  int a[n+1] = {};
  for(int i=2; i<=n; i++){
    int tmp = i;
    for(int j=2; j<=n; j++){
      if(tmp==0) break;
      if(tmp%j==0){
        while(tmp%j==0){
          tmp /= j;
          a[j]++;
        }
      }
    }
  }
  vector<int> ans(80, 0);
  ans[1] = 1;
  for(int i=1; i<=n; i++){
    if(a[i]) for(int j=75; j>=1; j--){
      for(int k=1; k<=a[i]; k++){
        if(j*(k+1)<=75) ans[j*(k+1)] += ans[j];
      }
    }
  }
  cout << ans[75] << endl;
  return 0;
}


Measured memory_bytes: 256
/// {{{ Author: Wang, Yen-Jen
// include
#include <bits/stdc++.h>

// using
using namespace std;

// types
typedef long long ll;
typedef pair<int,int> pii;

// macro
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin() , (x).end()
#define REP(i , n) for(int i = 0; i < int(n); i++)
#define REP1(i , a , b) for(int i = a; i <= int(b); i++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LC o<<1 , l , m
#define RC o<<1|1 , m + 1 , r
#define MS(x , v) memset(x , (v) , sizeof(x))

// input
inline bool SR(int &x) {
  return scanf("%d",&x) == 1;
}

inline bool SR(ll &x) {
  return scanf("%lld",&x) == 1;
}

inline bool SR(double &x) {
  return scanf("%lf",&x) == 1;
}

inline bool SR(char *s) {
  return scanf("%s",s) == 1;
}

inline bool RI() {
  return true;
}

template<typename I , typename... T> inline bool RI(I &x , T&... tail) {
  return SR(x) && RI(tail...);
}

// output
inline void SP(const int x) {
  printf("%d",x);
}

inline void SP(const ll x) {
  printf("%lld",x);
}

inline void SP(const double x) {
  printf("%.16lf",x);
}

inline void SP(const char *s) {
  printf("%s",s);
}

inline void PL() {
  puts("");
}

template<typename I , typename... T> inline void PL(const I x , const T... tail) {
  SP(x);
  if(sizeof...(tail)) putchar(' ');
  PL(tail...);
}

// debug
#define WangYenJen

#ifdef WangYenJen
template<typename I> void _DOING(const char *s , I&& x) {
  cerr << s << " = " << x << endl;
}

template<typename I , typename... T> void _DOING(const char *s , I&& x , T&&... tail) {
  int c = 0;
  while(*s != ',' || c != 0) {
    if(*s == '(' || *s == '[' || *s == '{') c++;
    if(*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1 , tail...);
}

#define DEBUG(...) \
do {\
  fprintf(stderr , "%s: Line %d - ",__PRETTY_FUNCTION__,__LINE__);\
  _DOING(#__VA_ARGS__ , __VA_ARGS__);\
} while(0);

#else
#define DEBUG(...)

#endif

// constant number
const int INF = 0x3f3f3f3f;
const ll INF64 = 0x3f3f3f3f3f3f3f3fll;

// random function
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) % 0x7fffffff;
}
/// }}}

const int MAX_N = 100000 + 10;

int a[MAX_N];
unordered_set<int> rd;

int main() {
  int n;
  RI(n);
  REP(i , n) RI(a[i]);
  for (int i = 0; i < n; i += 2) rd.insert(a[i]);
  int ans = 0;
  sort(a, a + n);
  for (int i = 1; i < n; i += 2) ans += rd.count(a[i]);
  PL(ans);
  return 0;
}



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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const ll mod = 1e9+7;

vector<vector<pii>> r;

const ll INF = 1LL<<50;
vector<ll> dijkstra(int s){
	priority_queue< pii, vector<pii>, greater<pii> > que;
	vector<ll> d(sz(r), INF); 
	vector<bool> usd(sz(r));
	d[s] = 0;   
	que.push(pii(0, s));
	while(!que.empty()){
		int cost, v; tie(cost, v) = que.top();
		que.pop();
		if(d[v] < cost) continue;
		usd[v] = true;
		for(const auto& rp : r[v]){ 
			int rct, rto; tie(rto, rct) = rp;
			if(!usd[rto] && d[rto] > d[v] + rct){
				d[rto] = d[v] + rct;
				que.push(pii(d[rto], rto));
			}
		}
	}
	return d;
}


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,q,k;
	cin >>n;
		r.resize(n);
	rep(i,n-1){
		int a,b, c;
		cin >>a >>b >>c;
		r[a-1].push_back(pii(b-1,c));
		r[b-1].push_back(pii(a-1,c));
	}
	cin >>q >>k;
	auto ds = dijkstra(k-1);
	//for(auto x :ds) printf("%lld, ",x); puts("");
	rep(i,q){
		int x,y; cin >>x >>y;
		cout << ds[x-1] + ds[y-1] <<"\n";
	}
	return 0;
}


Measured memory_bytes: 11120
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

void build_heap(vector<int> &heap, int H) {
	for (int i = H / 2; i >= 1; i--) {
		int r = i, k = r * 2;
		while (k <= H) {
			if (k < H && heap[k + 1] > heap[k]) k++;
			if (heap[r] > heap[k]) break;
			swap(heap[r], heap[k]);
			r = k, k = r * 2;
		}
	}
}

int main() {
	int H;
	cin >> H;
	vector<int> heap(H + 1);
	for (int i = 1; i <= H; i++) cin >> heap[i];
	build_heap(heap, H);
	for (int i = 1; i <= H; i++) {
		cout << " " << heap[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 4608
#include <iostream>
#include <string>

void rec(int n, char nxt, const std::string& s) {
    if (n == 0) {
        std::cout << s << std::endl;
        return;
    }

    for (char c = 'a'; c <= nxt; ++c) {
        rec(n - 1, nxt + (c == nxt), s + c);
    }
}

void solve() {
    int n;
    std::cin >> n;
    rec(n, 'a', "");
}

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

    solve();

    return 0;
}


Measured memory_bytes: 1536
#include <stdio.h>
int main(void){
    char S[9999];
    int N,i;
    scanf("%d",&N);
    scanf("%s",S);
    for(i=0;S[i]!='\0';i++){
        S[i]=S[i]+N;
        if(S[i]>'Z'){
            S[i]=S[i]-26;
        }
    }
    printf("%s",S);
}

Measured memory_bytes: 128
use std::cmp;
use std::collections::*;
use std::i32;
use std::io::{self, Read};
use std::mem;

const MOD: usize = 1000000007;

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let k: usize = sc.read().unwrap();

    // 2: 1 * 0 = 0, ()
    // 3: 1 * 2 = 2, (2, 1), (2, 3)
    // 4: 2 * 2 = 4, (2, 1), (2, 3), (4, 1), (4, 3)
    // 5: 2 * 3 = 6
    // 6: 3 * 3 = 9
    // 7: 3 * 4 = 12
    // 8: 4 * 4 = 16
    // 9: 4 * 5 = 20
    // 10: 5 * 5 = 25
    // 11: 5 * 6 = 30
    // n: (n / 2) * ((n / 2) + (n % 2))

    println!("{}", (k / 2) * ((k / 2) + (k % 2)));
}

struct Scanner<R: Read> {
    reader: R,
}

impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse()
            .ok()
    }

    fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Option<Vec<T>> {
        (0..n).map(|_| self.read()).collect()
    }

    fn read_vec2d<T: std::str::FromStr>(&mut self, m: usize, n: usize) -> Option<Vec<Vec<T>>> {
        (0..m).map(|_| self.read_vec(n)).collect()
    }

    fn read_board(&mut self, n: usize) -> Option<Vec<Vec<char>>> {
        (0..n)
            .map(|_| {
                self.read::<String>()
                    .map(|s| s.chars().collect::<Vec<char>>())
            })
            .collect()
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<map>

using namespace std;

#define x first
#define y second
#define NMAX 100005
#define LMAX 21

int answer, n, mask[NMAX], viz[NMAX];
vector<int> tree[NMAX];

void dfs(int node){
    viz[node] = 1;
    
    int lim = tree[node].size(), f[LMAX];
    memset(f, 0, sizeof(f));
    
    for(int i = 0; i < lim; i++){
        int neigh = tree[node][i];
        if(!viz[neigh]){
            dfs(neigh);
            for(int j = 0; j < LMAX; j++)
                if(mask[neigh] & (1 << j))
                    f[j]++;
        }
    }
    
    int lastComm = -1;
    for(int i = LMAX - 1; i >= 0; i--){
        if(f[i] >= 2){
            lastComm = i;
            break;
        }
    }
    
    int takenMex = 0;
    for(int i = lastComm + 1; i < LMAX; i++){
        if(f[i] && takenMex)
            mask[node] += (1 << i);
        else if(!f[i] && !takenMex){
            answer = max(answer, i);
            mask[node] += (1 << i);
            takenMex = 1;
        }
    }
}

int main (){
    int a, b;
    
    scanf("%d",&n);
    for(int i = 1; i < n; i++){
        scanf("%d%d",&a,&b);
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
        
    dfs(1);
    
    printf("%d\n", answer);
    
    return 0;
}



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

  int main(){
    string S;
    cin >> S;
    int a[26]={};
    string r;
    for (int i=0;i<S.size();i++){
      a[S[i]-'a']=1;
    }
    for (int i=0;i<26;i++){
      if (a[i]==0){
        char c=i+'a';
        cout << c << endl;
        return 0;
      }
    }
    cout << "None" << endl;
  }


Measured memory_bytes: 512
from math import sqrt
N, D = map(int, input().split())
X = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        dis = 0
        for k in range(D):
            dis += (X[i][k] - X[j][k]) ** 2
        dis = sqrt(dis)
        if (dis % 1 == 0): ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x,y;cin >> x >> y;
	if(abs(x-y)<=1) cout << "Brown" << endl;
	else cout << "Alice" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#define pb push_back
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = 1; i <= n; ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define rng(x) x.begin(),x.end()
#define sz(x) int((x).size())
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;

const int MX = 100005;
const int INF = 1001001001;

struct seg {
  vector<vi> d; int x2;
  seg() {}
  seg(int mx) {
    x2 = 1; while (x2 < mx) x2 <<= 1;
    d = vvi(x2<<1);
  }
  void fil() {
    drep(i,x2) {
      d[i] = d[i<<1];
      d[i].insert(d[i].end(),rng(d[i<<1|1]));
      sort(rng(d[i]));
    }
  }
  int get(int a, int b, int x, int i=1, int l=0, int r=-1) {
    if (r == -1) r = x2;
    if (a <= l && r <= b) {
      return upper_bound(rng(d[i]),x)-d[i].begin();
    }
    int c = (l+r)>>1;
    int res = 0;
    if (a < c) res += get(a,b,x,i<<1,l,c);
    if (c < b) res += get(a,b,x,i<<1|1,c,r);
    return res;
  }
};

struct SA {
  string s;
  int n;
  vi id, rank, lcp;
  seg t;
  void cons() {
    s += '$';
    n = sz(s);
    id = rank = vi(n);
    vi tmp(n);
    rep(i,n) id[i] = i, rank[i] = s[i];
    int k;
    auto comp = [&](int i, int j) {
      if (rank[i] != rank[j]) return rank[i] < rank[j];
      int ri = i+k<sz(rank)?rank[i+k]:-1;
      int rj = j+k<sz(rank)?rank[j+k]:-1;
      return ri < rj;
    };
    for (k = 1; k < n; k <<= 1) {
      sort(rng(id),comp);
      tmp[id[0]] = 0;
      for (int i = 1; i < n; ++i) {
        tmp[id[i]] = tmp[id[i-1]] + comp(id[i-1],id[i]);
      }
      rank = tmp;
    }
    // cons_lcp();
    t = seg(n+5);
    rep(i,n) t.d[i+t.x2] = vi(1,id[i]);
    t.fil();
    // rep(i,n) cout<<i<<" "<<id[i]<<" "<<s.substr(id[i])<<endl;
  }
  // void cons_lcp() {
  //   lcp = vi(n);
  //   int h = 0;
  //   rep(i,n-1) {
  //     int j = id[rank[i]-1];
  //     if (h > 0) --h;
  //     for (; i+h < n && j+h < n && s[i+h] == s[j+h]; ++h);
  //     lcp[rank[i]-1] = h;
  //   }
  // }

  int getl(string &t) {
    int l = 0, r = n+1, c;
    while (l+1<r) {
      c = (l+r)>>1;
      if (s.compare(id[c],sz(t),t) < 0) l = c; else r = c;
    }
    return r;
  }
  int getr(string &t) {
    int l = -1, r = n, c;
    while (l+1<r) {
      c = (l+r)>>1;
      if (s.compare(id[c],sz(t),t) > 0) r = c; else l = c;
    }
    return l;
  }
  int f(int l, int r, int x) {
    int res = t.get(l,r,x);
    // cout<<l<<" "<<r<<" "<<x<<" "<<res<<endl;
    return res;
  }
};

char ss[MX];
string s;
int q;

int main() {
  scanf("%s",ss);
  SA sa;
  sa.s = ss;
  sa.cons();
  scanf("%d",&q);
  rep(qi,q) {
    int l, r;
    scanf("%d%d",&l,&r);
    scanf("%s",ss);
    string t = ss;
    r -= sz(t)-1;
    int a = sa.getl(t);
    int b = sa.getr(t)+1;
    // cout<<a<<" "<<b<<endl;
    int ans = 0;
    if (a < b && l <= r) ans = sa.f(a,b,r)-sa.f(a,b,l-1);
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 22840
#include <iostream>
using namespace std;
int main()
{
	
	int n;
	cin >> n;
	if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
		cout << "hon";
	else if(n%10==0||n%10==1||n%10==6||n%10==8)
		cout << "pon";
	else
	cout << "bon";
	return 0;
}


Measured memory_bytes: 3608
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int N, M;
    std::cin >> N >> M;

    struct Path {
        int from;
        int to;
    };

    std::vector<Path> P;
    for (int64_t i = 0; i < M; ++i) {
        Path t;
        std::cin >> t.from >> t.to;

        t.from--;
        t.to--;

        P.push_back(t);
    }

    size_t count = 0;

    for (int64_t i = 0; i < M; ++i) {
        std::map<int, std::vector<int>> g;
        for (int64_t j = 0; j < M; ++j) {
            if (i == j) {
                continue;
            }
            g[P[j].from].push_back(P[j].to);
            g[P[j].to].push_back(P[j].from);
        }

        std::vector<bool> l(N);
        auto f = [&g, &l](auto F, int n, int prev) -> void {
            if (l[n]) {
                return;
            }
            l[n] = true;
            for (auto to: g[n]) {
                if (to != prev) {
                    F(F, to, n);
                }
            }
        };

        f(f, 0, -1);

        if (!std::all_of(l.begin(), l.end(), [](auto v) { return v; })) {
            count++;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	int n;
	map<string,int>mp;
	map<int,string>mp2;
	int cnt=0;
	cin>>n;
	REP(i,n)
	{
		string s;
		cin>>s;
		if(!mp[s])
		{
			mp2[cnt++]=s;
		}
		mp[s]++;
	}
	int mx=-1;
	REP(i,cnt)
	{
		if(mp[mp2[i]]>mx)mx=mp[mp2[i]];
	}
	vector<string>v;
	REP(i,cnt)
	{
		if(mp[mp2[i]]==mx)v.pb(mp2[i]);
	}
	sort(v.begin(),v.end());
	REP(i,v.size())
		cout<<v[i]<<endl;
	return 0;
}



Measured memory_bytes: 39408
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	string a;
	set<string> s;
	for(int i =0 ; i < n; i++)
	{
		cin >>a;
		s.insert(a);
	}
	cout << s.size();
}	


Measured memory_bytes: 19264
#include<iostream>
#include<algorithm>
using namespace std;
struct stu{
	int number,rank;
	bool operator < (const stu s)
	{
		return rank<s.rank;
	}
};
stu ss[100010];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		ss[i].number=i;
		cin>>ss[i].rank;
	}
	sort(ss+1,ss+n+1);
	for(int i=1;i<=n;i++)
	{
		cout<<ss[i].number;
		if(i!=n)
			cout<<" ";
	}
	cout<<endl;
 } 

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

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

    double a, b, c;
    cin >> a >> b >> c;
    cout << (a + b) * c / 2 << endl;

    return 0; 
}   

Measured memory_bytes: 512
#nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

#nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない

#nの素因数分解(O(n**0.5)
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass


if __name__ == '__main__':
    ta, tb = map(int,input().split())

    # めんどくさいのでa<=bの場合で考える
    if ta > tb:
        a = tb
        b = ta
    else:
        a = ta
        b = tb

    a_div_set = set(divisor(a))
    b_div_set = set(divisor(b))
    common_div_set = (a_div_set & b_div_set)

    answer = 0
    for e in common_div_set:
        if e == 1 or is_prime(e):
            answer += 1
    print(answer)




Measured memory_bytes: 5064
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-10;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  repi(i, n) cin >> a[i];
  rep(ki, k)
  {
    vector<int> b(n + 1, 0);
    repi(i, n)
    {
      int l = max(0, i - a[i]);
      int r = min(n, i + a[i] + 1);
      b[l]++, b[r]--;
    }
    repi(i, n) b[i + 1] += b[i];
    b.pop_back();
    if (a == b)
      break;
    a = b;
  }
  repi(i, a.size()) cout << a[i] << (i == (int)a.size() - 1 ? "\n" : " ");
}

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


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

int main() {
	long long N; cin >> N;
  long long L;
  if (N % 7 == 0)L = N / 7 * 9;
  else L = N * 9;
    vector<long long>A(10000000, 1);
    for (long long i = 1; i <= L; i++) {
        A.at(i) = (A.at(i - 1) * 10);
        A.at(i) %= L;
    }
    for (long long i = 1; i <= L; i++) {
        if (A.at(i) == 1) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 81348
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size() 
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ***********************************/


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

    int n, w; cin >> n >> w;
    vector <int> weight(n), values(n);
    for (int i = 0; i < n; ++i) 
        cin >> weight[i] >> values[i];

    vector <vector<ll>> dp(n+1, vector<ll> (w+1, 0));
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= w; ++j) {
            dp[i][j] = dp[i-1][j]; // don't use current item
            int left = j - weight[i-1]; // weight-> index [0, n-1]
            if (left >= 0)
                dp[i][j] = max(dp[i][j], values[i-1] + dp[i-1][left]);
        }
    }

    cout << dp[n][w];

    return 0;
}


Measured memory_bytes: 80256
#include<iostream>
#include<cstdio>
#include<ctype.h>
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
int head[57],cnt,tot,Index,ans;
int dfn[57],low[57],stack[57];
bool vis[57];
struct Edge{
    int next,to;
}edge[2457];
inline void add_edge(int from,int to){
	edge[++cnt].next=head[from];
	edge[cnt].to=to;head[from]=cnt;
}
void Tarjan(int x,int fa){
	dfn[x]=low[x]=++tot;
	vis[x]=1;stack[++Index]=x;
	for(int i=head[x];i;i=edge[i].next){
		int to=edge[i].to;if(to==fa)continue;
		if(!dfn[to])Tarjan(to,x),low[x]=min(low[x],low[to]);
		else if(vis[to])low[x]=min(low[x],dfn[to]);
		if(low[to]>dfn[x])ans++;
	}
}
int main(){
	int n=read(),m=read();
	while(m--){
		int u=read(),v=read();
		add_edge(u,v),add_edge(v,u);
	}
	for(int i=1;i<=n;i++)if(!dfn[i])Tarjan(i,0);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
    int N, M, X, Y, ma=0, mi=0;
    cin >> N >> M >> X >> Y;
    ma=Y;
    mi=X;
    for (int i=0;i<N;i++){
        int a;
        cin >> a;
        mi=max(mi,a);
    }
    for (int i=0;i<M;i++){
        int a;
        cin >> a;
        ma=min(ma,a);
    }
    mi<ma ? cout << "No War" : cout << "War";
    return 0;
}

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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, A[200001], B[200001];
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> A[i];
		B[i] = A[i];
	}
	sort(B, B + n);
	for (int i = 0; i < n; ++i)
	{
		if (A[i] == B[n - 1])
			cout << B[n - 2] << '\n';
		else
			cout << B[n - 1] << '\n';
	}
	return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int le = a+b;
  int ra = c+d;
  
  if( le == ra ){
	cout << "Balanced" << endl;
  	}else if( le > ra ){
    cout << "Left" << endl;
   	}else if( le < ra ){
  	cout << "Right" << endl;
  	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<=9;++i)
    {
        string pattern;
        pattern+=to_string(i);
        pattern+=to_string(i);
        if(s.find(pattern) != string::npos)
        {
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
}

Measured memory_bytes: 256
def check(L,m,n,d):
    i = 0
    for _ in xrange(m):
        s = 0
        while i < n:
            if s+L[i] > d:
                break
            s += L[i]
            i += 1
    return i == n

def bs(L,m,n):
    left,right = 0,sum(L)
    while left != right:
        mid = (left+right)/2
        if check(L,m,n,mid):
            right = mid
        else:
            left = mid+1
    return left

while True:
    m,n = map(int,raw_input().split())
    if m|n == 0:
        break
    L = [input() for _ in xrange(n)]
    print bs(L,m,n)

Measured memory_bytes: 4240
#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)

using ll = long long;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	vector<int> sw[m];
	vector<int> p(m);
	rep (i, m) {
	  int k;
	  cin >> k;
	  rep (j, k) {
		int s;
		cin >> s;
		sw[i].push_back(s - 1);
	  }
	}
	rep (i, m) cin >> p[i];
	int res = 0;
	rep (bit, 1 << n) {
	  vector<int> on(n);
	  rep (i, n) {
		if (bit & (1 << i)) on[i] = 1;
	  }
	  bool ok = true;
	  rep (i, m) {
		int cnt = 0;
		rep (j, sw[i].size()) {
		  if (on[sw[i][j]]) cnt++;
		}
		if (cnt % 2 != p[i]) {
		  ok = false;
		  break;
		}
	  }
	  if (ok) res++;
	}
	cout << res << endl;

  return 0;
}


Measured memory_bytes: 3652
S= input()
T= input()

def check(in_str,out_str):
  for i,j in zip(in_str,out_str):
    if j == "?" or i==j:
      continue
    else:
      return False
  else:
    return True
  
for i in range(len(S)-len(T),-1,-1):
  if check(T, S[i:i+len(T)]):
    print((S[:i]+T+S[i+len(T):]).replace("?","a"))
    break
else:
  print("UNRESTORABLE")

Measured memory_bytes: 38384
//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
//#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

vi xx = { 1, 0, -1, 0 };
vi yy = { 0, 1, 0, -1 };
string dir = "LRUD";

const int N = 2e5 + 50, oo = 3e18 + 500;
//const int mod = 998244353;
const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-12, PI = 2 * acos(0.0);
int n, m, k;
long long cnt = 0;
int lg = 18;
set<int> g[N];
vi rg[N];
vi visit(N, 0);

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("abbreviation.in", "r", stdin);
	freopen("abbreviation.out", "w", stdout);*/

	cin >> n;

	vi a(n);
	vi mp(N, 0);

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

	cin >> k;

	while (k--)
	{
		int b, c;
		cin >> b >> c;

		cnt -= mp[b] * b;
		cnt += mp[b] * c;
		mp[c] += mp[b];
		mp[b] = 0;

		cout << cnt << endl;
	}
}



Measured memory_bytes: 16080
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

int main (int argc, char* argv[]) {
	int a, b, t;
	cin >> a >> b >> t;
	cout << (t / a) * b << endl;
}


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

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int xb = sc.nextInt();
        
        for (int i = 2001; i <= 2010; i++) {
            int x = r * xb - d;
            System.out.println(x);
            xb = x;
        }
    }
}

Measured memory_bytes: 21588
// C++11
#include <iostream>
#include <valarray>
#include <utility>

using std::cin;
using std::cout;
using std::endl;
using std::valarray;
using std::swap;

void dump(int N, valarray<int> vals, valarray<char> suits) {
  for (int i = 0; i < N; i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << suits[i] << vals[i];
  }
  cout << endl;
}

void bubble(int N, valarray<int> vals, valarray<char> suits) {
  for (int i = 0; i < N; i++) {
    for (int j = N-1; j > i; j--) {
      if (vals[j] < vals[j-1]) {
        swap(vals[j], vals[j-1]);
        swap(suits[j], suits[j-1]);
      }
    }
  }
  dump(N, vals, suits);
  cout << "Stable" << endl;
}

void selection(int N, valarray<int> vals, valarray<char> suits) {
  bool stable = true;
  for (int i = 0; i < N; i++) {
    int mini = i;
    for (int j = i; j < N; j++) {
      if (vals[j] < vals[mini]) {
        mini = j;
      }
    }
    if (i != mini) {
      swap(vals[i], vals[mini]);
      if (suits[i] == suits[mini]) {
        stable = false;
      }
      swap(suits[i], suits[mini]);
    }
  }
  dump(N, vals, suits);
  if (stable) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
}

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

  valarray<int> vals(N);
  valarray<char> suits(N);

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

  bubble(N, vals, suits);
  selection(N, vals, suits);

  return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define loop for(;;)
#define rep(i, n) for(long i = 0; i < (long)(n); ++i)
typedef std::vector<long> LI;

struct Solver {
   void solve() {
      long n, m; std::cin >> n >> m;
      if( n == 0 and m == 0 ) exit(0);
      LI ds(n), vs(n);
      rep(i, n) std::cin >> ds[i] >> vs[i];
      LI xs(m+1, 0);
      rep(i, n) {
         xs[ds[i]] = std::max(xs[ds[i]], vs[i]);
      }
      long res = 0;
      rep(i, m+1) {
         res += xs[i];
      }
      printf("%ld\n", res);
   }
};

int main() { loop std::shared_ptr<Solver>(new Solver())->solve(); }

Measured memory_bytes: 3192
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define MP make_pair
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

bool isprime(ll p){
  	if(p<2) return false;
	ll rp = floor(sqrt(p));
  	rep3rev(i,rp+1,2){
    	if(p%i==0) return false;
    }
  	return true;
}
/*
ll nextprime(ll p){
	if(p==2) return 3;
  	if(p==3) return 5;
  	if(p==5) return 7;
  	while(1){
      	switch(p%15){
          case 1: 
            p += 6;
            break;
          case 2: 
            p += 2;
            break;
          case 4:
            p += 4;
            break;
          case 7: 
            p += 4;
            break;
          case 8:
            p += 6;
            break;
          case 11: 
            p += 2;
            break;
          case 13: 
            p += 4;
            break;
          case 14:
            p += 2;
            break;
        }
      	if(isprime(p)) return p;
    }
}

vi factor(ll n){
  	vi ans;
  	ll a = 2;
	while(n >= a*a){
  		if(n%a==0){
          	ans.push_back(a);
			n /= a;
        }
      	a++;
    }
  	ans.push_back(n);
  	return ans;
}
*/
void Main()
{
	ll a, b;
  	cin >> a >> b;
  	
  	// gcd(a,b) の素因数の種類 + 1 を答える
	ll g = gcd(a,b);  	
  	ll p = 2;  	
  	int count = 0;
  	int flag;
    //cout << g << endl;
  	if(g==1) {
		cout << 1 << endl;
      	return;
    }
  	
	if(isprime(g)) {
      cout << 2 << endl;
  		return;
    }
  	
  	while(g!=1){
      	flag = 0;
      	while(g%p==0){
          	flag = 1;
    		g /= p;
        }
      	//cout << p << " " << g << endl;
      	if(flag) {
          	count++;
          	if(isprime(g)) {
              	cout << count+2 << endl;
              	return;
            }
        }
      	if(p==2) p++;
      	else p += 2;
      	//cout << "count = " << count << ", nextp = " << p << endl;
    }
    
  	cout << count+1 << endl;
	/*
  	p = 2;
  	count = 0;
	while(p<10000){
      	count++;
      	p = nextprime(p);
    }
    cout << count << endl;
	*/
	return;
}

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

Measured memory_bytes: 256
mod = 1000000007
n= int(input())
t= list(map(int,input().split()))
a= list(map(int,input().split()))
tb = [-1]*n
pre=-1
for i in range(n):
    if i==0:tb[i]=1
    else:
        if pre!=t[i]:tb[i]=1
    pre=t[i]
ab = [-1]*n
post=-1
for i in range(n-1,-1,-1):
    if i==n-1:ab[i]=1
    else:
        if post!=a[i]:ab[i]=1
    post=a[i]
er = False
if a[0]!=t[-1]:er=True
else:
    b=1
    for i in range(n):
        if tb[i]==1 or ab[i]==1:
            if tb[i]==1 and ab[i]==1:
                if t[i]==a[i]:pass
                else:
                    er=True
                    break
            else:
                if tb[i]==1:
                    if a[i]<t[i]:
                        er=True
                        break
                elif ab[i]==1:
                    if a[i]>t[i]:
                        er = True
                        break
        else:
            m = min(a[i],t[i])
            b = ((b% mod) * (m % mod)) % mod
if er:print(0)
else:print(b)


Measured memory_bytes: 19012
k = list(map(int, input().split()))
h = list(map(int, input().split()))
m = [list(map(int, input().split())) for i in range(k[1])]

import networkx as nx
G = nx.Graph()
for i in range(k[0]):
  G.add_node(i +1)
for i in m:
  G.add_edge(i[0],i[1])
re = 0
for i in list(G.nodes):
  if len(list(nx.all_neighbors(G, i))) != 0:
    max_height = max([h[x - 1] for x in list(nx.all_neighbors(G, i))])
    if h[i-1] > max_height:
      re +=1
  else:
    re +=1
print(re)

Measured memory_bytes: 161972
class UnionFind:
    def __init__(self, N):
        """
        N:要素数
        root:各要素の親要素の番号を格納するリスト.
             ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.
        rank:ランク
        """
        self.N = N
        self.root = [-1] * N
        self.rank = [0] * N

    def __repr__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    def find(self, x):
        """頂点xの根を見つける"""
        if self.root[x] < 0:
            return x
        while self.root[x] >= 0:
            x = self.root[x]
        return x

    def union(self, x, y):
        """x,yが属する木をunion"""
        # 根を比較する
        # すでに同じ木に属していた場合は何もしない.
        # 違う木に属していた場合はrankを見てくっつける方を決める.
        # rankが同じ時はrankを1増やす
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.rank[x] > self.rank[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def same(self, x, y):
        """xとyが同じグループに属するかどうか"""
        return self.find(x) == self.find(y)

    def count(self, x):
        """頂点xが属する木のサイズを返す"""
        return - self.root[self.find(x)]

    def members(self, x):
        """xが属する木の要素を列挙"""
        _root = self.find(x)
        return [i for i in range(self.N) if self.find == _root]

    def roots(self):
        """森の根を列挙"""
        return [i for i, x in enumerate(self.root) if x < 0]

    def group_count(self):
        """連結成分の数"""
        return len(self.roots())

    def all_group_members(self):
        """{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す"""
        return {r: self.members(r) for r in self.roots()}





import sys
input = sys.stdin.readline
n, q = map(int, input().split())
uf = UnionFind(n)
for i in range(q):
    t, u, v = map(int, input().split())
    if t:
        print(int(uf.same(u, v)))
    else:
        uf.union(u, v)


Measured memory_bytes: 74440
use std::collections::{HashMap, HashSet, VecDeque};

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, // ノード数
        m: usize, // ノード数
        edges: [(usize1, usize1, usize); m], // usize1 は 1-origin to 0-origin変換を行う
    }

    let mut edgemap = HashMap::new();

    for (n0, n1, l) in edges {
        edgemap.entry(n0).or_insert(vec![]).push((n1, l));
        edgemap.entry(n1).or_insert(vec![]).push((n0, l));
    }

    let mut visit = HashSet::new();
    let mut q = VecDeque::new();
    let mut ans = 0;

    for i in 0..n {
        if visit.contains(&i) {
            continue;
        }
        ans += 1;
        q.push_back(i);
        while q.len() > 0 {
            let n = q.pop_front().unwrap();
            visit.insert(n);
            match edgemap.get(&n) {
                Some(nexts) => {
                    for &(nx, _) in nexts {
                        if !visit.contains(&nx) {
                            q.push_back(nx);
                        }
                    }
                }
                None => {}
            }
        }
    }

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


Measured memory_bytes: 24828
n=gets.to_i
s=gets.chomp.chars.map(&:to_i)
z=s.reverse
f=[]
l=[]
10.times do |i|
  f[i]=s.index(i)
  f[i]=f[i]+1 if f[i]
  l[i]=z.index(i)
  l[i]=n-2-l[i] if l[i]
end
a=0
[*0..9].repeated_permutation(2) do |ff,ll|
  c=[0]*10
  if f[ff]&&l[ll]
    f[ff].upto(l[ll]) do |i|
      c[s[i]]=1 if c[s[i]]=0
    end
  end
  a+=c.count(1)
end
puts a


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int ar[200005] = {};
    long long ans =0;
    int n, k, x;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> ar[i];
        ans += ar[i];
    }
    sort(ar, ar + n, greater<int>());
    for (int i = 0; i < k; i++)
    {
        ans -= ar[i];
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define y1 stupid_cmath
#define left stupid_left
#define right stupid_right
#define vi vector <int>
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))

const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

ll read_long() {
    ll ans = 0;
    char c;
    bool started = false;
    bool is_negative = false;
    while (true) {
        c = getchar();
        if ((c < '0' || c > '9') && c != '-' && !started) continue;
        if ((c < '0' || c > '9') && c != '-' && started) break;
        if (started) {
            ans = ans * 10;
        }
        started = true;
        if (c == '-') is_negative = true;
        else ans += c - '0';
    }
    if (is_negative) ans *= -1;
    return ans;
}

int f(int n) {
    if (n < 10) return n;
    return n % 10 + f(n / 10);
}

int main(){

    int n;
    cin >> n;
    int ans = inf;

    for (int i = 1; i < n; i++) {
        ans = min(ans, f(i) + f(n - i));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int array[] = new int[10];
		for(int i=0; i<10; i++){
			array[i] = Integer.parseInt(std.next());
		}
		Arrays.sort(array);
		for(int i=9; i>6; i--){
			System.out.println(array[i]);
		}
	}
}

Measured memory_bytes: 26240
A, B, C, D = map(int, input().split())

A_player = [A, B]
B_player = [C, D]

# A = 0, B = 1
turn = 0
while((A_player[0] > 0) and (B_player[0] > 0)):

	if(turn == 0):
		B_player[0] -= A_player[1]
	else:
		A_player[0] -= B_player[1]
	
	turn = (turn+1) % 2

if(A_player[0] <= 0):
	print("No")
else:
	print("Yes")

	


Measured memory_bytes: 9192
#include <iostream>

using namespace std;

int main()
{
  int i;
  int a;
  int b;
  int c;
  int count=0;
  
  cin >> a >>b >>c;
  for(i=a;i<=b;i++)
    {
    if(c%i==0)
    count++;
    }
  cout << count <<"\n";
}

Measured memory_bytes: 1168