akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define N 100000010
//#define int long long
#define INF 1e9
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	register char cc = getchar();register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus;
}
signed main()
{
	int a, b, n;
	a = read();
	b = read();
	n = read();
	int l = max(a, b);
	int ans(0);
	ans = n / l;
	if(ans * l < n) ans ++;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    int a = readint;

    writeln(n % 500 <= a ? "Yes" : "No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define long long long
using namespace std;
int a,b,ans;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  cin>>a>>b;
  if(b>=a)cout<<a<<endl;
  else cout<<a-1<<endl;

  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<String>().chars().collect::<HashSet<_>>();
    if n.contains(&'9') {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<iostream>
#include<queue>

using namespace std;

static const int N = 100;
static const int INFTY=(1<<21);

int n,M[N][N];
int d[N];

void bfs(int s){
  queue<int> q;
  q.push(s);
  for(int i=0; i<n;i++) 
      d[i]=INFTY;
  d[s]=0;
  int u;
  while(!q.empty()){
    u=q.front();
    q.pop();
    for(int v=0;v<n;v++){
      if(M[u][v]==0) 
          continue;
      if(d[v]!=INFTY) 
          continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int i=0;i<n;i++){
    cout<<i+1<<" "<<((d[i]==INFTY)?(-1):d[i] ) << endl;
  }
}

int main(){
  int u,k,v;

  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++) M[i][j]=0;
  }

  for(int i=0;i<n;i++){
    cin>>u>>k;
    u--;
    for(int j=0;j<k;j++){
      cin>>v;
      v--;
      M[u][v]=1;
    }
  }
  bfs(0);

  return 0;
}



Measured memory_bytes: 3128
/*
Author : Gaurav Singh
*/
#include<bits/stdc++.h>
using namespace std;
#define N 200005
#define MOD 1000000007
#define ll long long
#define ld long double
#define ull unsigned long long
#define li long int
#define str string
#define vll vector<ll>
#define pb push_back
#define frn(i,n) for(ll (i) = 0; (i) <(n) ; (i)=(i+1))
#define fr(i,n) for(ll (i) = 1; (i) <=(n) ; (i)=(i+1))
#define frev(i,n) for(ll (i) = n-1; (i) >=(0) ; (i)--)
#define fr1(j,a,b,c) for(ll (j) = a; (j) <c ; (i)=(i+b))
#define w(t) while(t--)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
void solve(){
    ll n,i,s=1;
    str a;
    cin>>n>>a;
    if(n%2==0){
        frn(i,n/2){
            if(a[i]!=a[i+n/2]){
                s=0;
                break;
            }
        }
        s==0?cout<<"No":cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}
int main()
{   
   fast;
   int t=1;
    w(t){
        solve();
    }
   return 0;
}   


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>


int n,k;
int asum=0;
int a[1000],b[1000];


bool f(int d){
  /*
  rep(i,n){
    cout<<a[i]<<' ';
  }
  cout<<endl;
  */
  rep(i,n){
    b[i]=a[i]%d;
  }
  /*
  rep(i,n){
    cout<<b[i]<<' ';
  }
  cout<<endl;
  */
  sort(b,b+n);
  
  int res=INF;
  int l=0,r=0;
  rep(i,n){
    r+=d-b[i];
  }

  rep(i,n){
    l+=b[i];
    r-=d-b[i];
    if(l==r) res=min(res,l);
  }

  return res<=k;
}

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

  cin>>n>>k;
  
  rep(i,n){
    cin>>a[i];
    asum+=a[i];
  }

  if(k==0){
    int ans=a[0];
    rep(i,n){
      ans=__gcd(ans,a[i]);
    }
    cout<<ans<<endl;
    return 0;
  }

  vi res;
  for(int i=1;i*i<=asum;i++){
    if(asum%i) continue;
    res.PB(asum/i);
    res.PB(i);
  }
  sort(all(res));
  reverse(all(res));

  rep(i,res.size()){
   
    if(f(res[i])){
      cout<<res[i]<<endl;
      break;
    }
  }

  

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

vl<ll> divisor(ll n)
{
    vl<ll> v;
    for(int i=1;i<=sqrt(n);i++)
    {
        if(n%i==0) 
        {
            if(n/i==i) v.pb(i);
            else
            {
                v.pb(i);
                v.pb(n/i);
            }
        }
    }
    return v;
}

int main()
{
    ll a,b,i,j,n,m,k,t;
    cin>>a>>b;
    vl<ll> da=divisor(a),db=divisor(b);
    vl<ll> com,ans;
    for(i=0;i<da.size();i++)
    {
        for(j=0;j<db.size();j++)
        {
            if(da[i]==db[j])
            {
                com.pb(da[i]);
                break;
            }
        }
    }
    sort(com.begin(),com.end());
    ans.pb(com[0]);
    for(i=1;i<com.size();i++)
    {
        ll flag=0;
        for(j=0;j<ans.size();j++)
        {
            if(__gcd(ans[j],com[i])!=1)
            {
                flag=1;
                break;
            }
        }
        if(flag==0) ans.pb(com[i]);
    }
    //for(i=0;i<ans.size();i++) cout<<ans[i]<<" ";cout<<endl;
    cout<<ans.size();
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,m,ans=0;
	cin>>n>>m;
	if(m>=2*n)
	   ans=n+(m-n*2)/4;
	else
	    ans=m/2;
	 cout<<ans;   
	return 0;
}

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

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

Measured memory_bytes: 3632
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int dp[1010][10101];

void solve(int H, int N, std::vector<int> A, std::vector<int> B){
    REP(i, 1010){
        REP(j, 10101){
            dp[i][j]=10e7;
        }
    }
    REP(i,1010)dp[i][0]=0;
    for(int i=1; i<=N; i++){
        for(int j=0; j<=10000; j++){
            //debug((int)ceil(j/A[i-1]));
            dp[i][j] = min(dp[i][j],B[i-1]*(int)ceil(j/(double)A[i-1]));
            if(j>=A[i-1]) dp[i][j] = min(dp[i-1][j], dp[i][j-A[i-1]]+B[i-1]);
            else dp[i][j] = min(dp[i][j], dp[i-1][j]);
        }
    }
    REP(i,4){
        REP(j,10){
            // debug(i)debug(j)
            //debug(dp[i][j])
        }
    }
    cout<<dp[N][H]<<endl;

}

int main(){
    int H;
    scanf("%d",&H);
    int N;
    scanf("%d",&N);
    std::vector<int> A(N);
    std::vector<int> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%d",&A[i]);
        scanf("%d",&B[i]);
    }
    solve(H, N, std::move(A), std::move(B));
    return 0;
}


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

typedef struct {
  char mark;
  int value;
} Card;

int isStable(Card *, Card *, int);


int main() {
  Card *IN, *OUTBubble, *OUTSelection, temp;
  char c;
  int i, j, N, minj;
  
  scanf( "%d" , &N );
  IN = malloc(N * sizeof(Card));
  OUTBubble = malloc(N * sizeof(Card));
  OUTSelection = malloc(N * sizeof(Card));
  for ( i=0; i<N; i++ ) {
    scanf( " %c" , &(IN[i].mark) );
    scanf( "%d" , &(IN[i].value) );
    OUTBubble[i] = OUTSelection[i] = IN[i];
  }
  
  for ( i=0; i<N; i++ )
    for ( j=(N-1); j>i; j-- )
      if ( OUTBubble[j].value < OUTBubble[j-1].value ) {
	temp = OUTBubble[j];
	OUTBubble[j] = OUTBubble[j-1];
	OUTBubble[j-1] = temp;
      }
  
  for ( i=0; i<(N-1); i++ )
    printf( "%c%d " , OUTBubble[i].mark , OUTBubble[i].value ); 
  printf( "%c%d\n" , OUTBubble[N-1].mark , OUTBubble[N-1].value );
  if ( isStable(IN, OUTBubble, N) == 1 ) printf( "Stable\n" );
  else printf( "Not stable\n" );

  for ( i=0; i<N; i++ ) {
    minj = i;
    for ( j=i; j<N; j++ )
      if ( OUTSelection[j].value < OUTSelection[minj].value ) minj = j;
    temp = OUTSelection[i];
    OUTSelection[i] = OUTSelection[minj];
    OUTSelection[minj] = temp;
  }

  for ( i=0; i<(N-1); i++ )
    printf( "%c%d " , OUTSelection[i].mark , OUTSelection[i].value ); 
  printf( "%c%d\n" , OUTSelection[N-1].mark , OUTSelection[N-1].value );
  if ( isStable(IN, OUTSelection, N) == 1 ) printf( "Stable\n" );
  else printf( "Not stable\n" );
  
  return 0;
}


int isStable(Card *IN, Card *OUT, int N) {
  int i, j, a, b;
  for ( i=0; i<N; i++ )
    for ( j=(i+1); j<N; j++ )
      for ( a=0; a<N; a++ )
	for ( b=(a+1); b<N; b++ )
	  if ( (IN[i].value == IN[j].value)
	       && (IN[i].mark == OUT[b].mark)
	       && (IN[i].value == OUT[b].value)
	       && (IN[j].mark == OUT[a].mark)
	       && (IN[j].value == OUT[a].value) ) return 0;
  return 1;
}



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

int main() {
	long long N, M,ans=0; cin >> N >> M;
	if (N >= M / 2)ans = M / 2;
	else {
		M -= N * 2;
		ans = N + M / 4;
	}
	cout << ans << endl;
}


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

int main(){
	int n;
	cin >> n;
	ll ans(0),a;
	rep(i,n){
		cin >> a;
		ans += a-1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string ans = "";
  
  while(1){
    c -= b;
    if (c <= 0){
      ans = "Yes";
      break;
    }
    a -= d;
    if (a <= 0){
      ans = "No";
      break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int sum=0;
	string a;
	cin>>a;
	int l=a.length();
	for(int i=0;i<=l-2;i++)
	if(a[i]!=a[i+1])
	sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 512
N,M,K = map(int,input().split())

p = 998244353
# 何個を同じ色の組にするか0~K
cnt = 0
com = 1
for k in range(K+1):
    l = N-k
    # N-1個の組のうちどれを同じ色にするかN-1Ck
    # それぞれで、N-k個を別の色の順列にする
    # M*(M-1)**(N-k-1)
    x = pow((M-1),(l-1),p)
    cnt += M * x * com
    cnt %= p

    # 次のkのnCk
    com *= N-(k+1)
    com *= pow(k+1,p-2,p)
    com %= p


print(cnt)


Measured memory_bytes: 68412
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    t, a = Input()
    h = Input()

    h = [t-i*0.006 for i in h]
    h = [abs(a-i) for i in h]
    min_h = min(h)

    print(h.index(min_h)+1)


main()

Measured memory_bytes: 9228
#include<bits/stdc++.h>
using namespace std;
int check(string s,string t)
{
    if(s.length()>10)
    return 0;
    else if(t.length()-s.length()!=1)
    return 0;
    int i;
    for(i=0;i<s.length();i++)
    {
        if(s[i]!=t[i])
        return 0;
    }
    return 1;
}
main()
{
    string s,t;
    cin>>s;
    cin>>t;
    if(check(s,t))
    cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 3628
N,C,K=map(int,input().split())
T=[]
for i in range(N):
    p=int(input())
    T.append(p)
  
ans = 1
T = sorted(T)
ind = 0
 
for i in range(len(T)):
    if T[i] > T[ind]+K:
        ans += 1
        ind = i
    elif i >= ind + C:
        ans += 1
        ind = i
print(ans)

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;
typedef pair<LL,LL> Pll;
typedef pair<int,int> Pin;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

template<typename T>
void dump_2d_mat(T &m, int N, int M) {
    REP(i, N) {
        REP(j, M) {
            cout << m[i][j] << " ";
        }
        cout << endl;
    }
}

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

    LL INF = 1LL << 50;
    
    int N;
    cin >> N;

    vector<Pll> E[N];
    REP(i, N-1) {
        LL a, b;
        LL c;
        cin >> a >> b >> c;

        E[a-1].pb(mp(b-1, c));
        E[b-1].pb(mp(a-1, c));
    }

    int Q, K;
    cin >> Q >> K;
    --K;

    typedef pair<int, int> P;
    priority_queue<P, vector<P>, greater<P>> q;

    LL dist[N];
    REP(i, N) dist[i] = INF;
    dist[K] = 0;
    q.push(P(0, K));

    while(!q.empty()) {
        P p = q.top(); q.pop();
        int src = p.se;

        if (dist[src] < p.fi) continue;

        REP(i, E[src].size()) {
            Pll dc = E[src][i];
            LL dst = dc.fi;
            LL c = dc.se;

            if(dist[dst] > dist[src] + c) {
                dist[dst] = dist[src] + c;
                q.push(P(dist[dst], dst));
            }
        }
    }

    cout << fixed << setprecision(20);

    REP(i, Q) {
        int x, y;
        cin >> x >> y;
        cout << dist[x - 1] + dist[y - 1] << endl;
    }

}


Measured memory_bytes: 10992
#include <stdio.h>
#define X 100
int main()
{
  int N,i,A[X],flag=1,j,temp,count=0;

  scanf("%d",&N);

  if(N>=1 && N<=100){
    for(i=0;i<N;i++){
      scanf("%d",&A[i]);
    }
    i=0;
    while(flag==1){
      flag=0;
      for(j=N-1;j>=i+1;j--){
	if(A[j]<A[j-1]){
	  temp=A[j];
	  A[j]=A[j-1];
	  A[j-1]=temp;
	  flag=1;
	  count+=1;
	}
      }
      if(flag==1){
	i=+1;
      }    }
    for(i=0;i<N-1;i++){
      printf("%d ",A[i]);
    }
    printf("%d",A[N-1]);
    printf("\n%d\n",count);
  }
  return 0;
}

 

Measured memory_bytes: 600
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
int const MAXN=3001;
int memo[MAXN][MAXN];
int mov[MAXN][MAXN];
string s, t;
int dp(int i, int j){
	int &x=memo[i][j];
	if(x!=-1)
		return x;
	if(i==s.size() || j==t.size())
		return 0;
	int a=-1, b=dp(i+1,j), c=dp(i,j+1);
	if(s[i]==t[j])
		a=1+dp(i+1,j+1);
	if(a>=b && a>=c)
		mov[i][j]=1;
	else if(b>=a && b>=c)
		mov[i][j]=2;
	else mov[i][j]=3;
	return x=max({a,b,c});
}
int main(){
	cin>>s>>t;
	memset(memo,-1,sizeof(memo));
	dp(0,0);
	int i=0, j=0;
	string res="";
	while(mov[i][j]){
		int x=mov[i][j];
		if(x==1){
			res+=s[i];
			i++;
			j++;
		}else if(x==2){
			i++;
		}
		else j++;
	}
	cout<<res;
}


Measured memory_bytes: 71040
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    int c = scanner.nextInt();
    int[] k =new int [] {a,b,c};

    if (k[0]>k[1]){
      int t = k[0];
      k[0]=k[1];
      k[1]=t;
    }
      if(k[1]>k[2]){
        int p = k[1];
        k[1]=k[2];
        k[2]=p;
      }
        if(k[0]>k[1]){
          int v = k[0];
          k[0]=k[1];
          k[1]=v;
        }


    System.out.println(k[0]+" "+k[1]+" "+k[2]);
  }
}


Measured memory_bytes: 26128
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = 0;
  ans += (b / c - (a - 1) / c);
  // P(b / c + (a - 1) / c);
  ans += (b / d - (a - 1) / d);
  // P(b / d + (a - 1) / d);
  ll ma = lcm(c, d);
  ans -= (b / ma - (a - 1) / ma);
  // P(b / ma - (a - 1) / ma);
  P(b - a - ans + 1);

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,m;
  cin>>n>>m;
  int dp[n+1][m+1];
  char mat[n+1][m+1];
  for(i=0;i<n+1;i++)
  {
    for(j=0;j<m+1;j++)
    {
      dp[i][j]=0;
      if(i==0||j==0)
      {
        
        mat[i][j]='#';
        continue;
      }
      cin>>mat[i][j];
    }
  }
  dp[1][1]=1;
  for(i=1;i<=n;i++)
  {
    for(j=1;j<=m;j++)
    {
      if(mat[i][j]=='#' or i+j==2)
      {
        continue;
      }else
      {
      dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
      }
    //  cout<<dp[i][j]<<" ";
    }
    //cout<<endl;
  }
  cout<<dp[n][m];
  return 0;
}

Measured memory_bytes: 5120
#include<stdio.h>
#include<stdbool.h>

const int CAKE = 4;
const int DONUT = 7;

bool dfs(int n) {
	if(n == 0) {
		return true;
	} else if(n < 0) {
		return false;
	} else {
		return dfs(n-CAKE) || dfs(n-DONUT);
	}
}

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

	if(dfs(n)) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 128
//============================================================================
// Name        : abc127A.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	if(A >= 13){
		cout << B << endl;
	}
	else if(6 <= A && A <= 12){
		cout << B / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}


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

int main(void){
    int n;
    cin >> n;
    double total = 0.0;
    for (int i = 0; i < n; i++){
        double a;
        cin >> a;
        total += 1 / a;
    }
    cout << 1 / total << endl; 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}

signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int l=0,r=8e17;
    int mn=1e18;
    while (l<=r)
    {
        int mid=l+(r-l)/2;
        bool flag=false;
        for(int j=max(mid-100,0LL);j<=mid+100;j++)
        {
            int temp[n+1];
            for(int i=1;i<=n;i++)
            {
                temp[i]=a[i]+j;
            }
            int tot=0;
            for(int i=1;i<=n;i++)
            {
                tot+=temp[i]/(n+1);
                temp[i]%=n+1;
                if(temp[i]==n)
                    tot++;
            }
            if(tot<=j)
            {
                flag=true;
                mn=min(mn,j);
            }
        }
        if(flag)
        {
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }        
    }
    cout<<mn;
    

} 
    


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const double inf=1e8;
int main(){
	int n;
	cin>>n;
	vd dp(n),in(n);
	rep(i,n)cin>>in[i];
	rep(i,n){
		dp[i]=in[i];
		rep(j,i)dp[i]=max<double>(dp[i],dp[j]+2*sqrt(in[i]*in[j]));
	}
	rep(i,n)dp[i]+=in[i];
	rep(i,n-1)dp[i+1]=max<double>(dp[i],dp[i+1]);
	cout<<shosu(9)<<dp[n-1]<<endl;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
const int64_t INF = (1LL << 60);

int main()
{
  int64_t N, M, K, ans = 0;
  cin >> N >> M >> K;
  vector<int64_t> A(N), B(M), sa(N + 1, 0), sb(M + 1, 0);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
    sa[i + 1] = A[i] + sa[i];
  }
  for (int i = 0; i < M; i++)
  {
    cin >> B[i];
    sb[i + 1] = B[i] + sb[i];
  }
  for (int n = 0; n <= N; n++)
  {
    int64_t limb = K - sa[n];
    if (limb < 0)
      break;
    auto it = upper_bound(sb.begin(), sb.end(), limb);
    it--;
    int64_t idx = distance(sb.begin(), it);
    ans = max(ans, n + idx);
  }
  cout << ans << endl;
}

Measured memory_bytes: 9596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define f first
#define s second
#define mset(m,v) memset(m,v,sizeof(m))
#define mod 1000000007
const int N = 2e5 + 5, INF = 1E9 + 7;
#define PI acos(-1.0)
long double EPS = 1e-9;
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(int x, int y) { x -= y; if (x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
void solve() {
	
	int n, k;
	cin >> n >> k;
	vi v(n);
	in(v);
	for (int i = k; i < n; i++) {
		
		if (v[i-k] <v[i] ) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}
signed main()
{
	fastio;
	//cout<<fixed<<setprecision(15);
	//clock_t begin = clock();
	int tc;
	tc = 1;
	//cin >> tc;
	while (tc--) {
		solve();
	}
	return 0;
	//clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}


//Error?
// clear lists for every test case
// print new line for each tc
// check for int or ll
// check if problem can be solved without any heavy DS like priority_queue or map



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int n;
  cin >> n;
  int ans=0;
  REP(i,n){
    int a;
    cin >> a;
    if(i%2==1)continue;
    if(a%2==1)ans++;
  }
  PRINT(ans);
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;cin>>s;
    s="A"+s;
    int ans=0;
    for(int i=0;i<s.size();i++){
        if(s[i-1]>=s[i])
            ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3160
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main() {
	int n; cin >> n;
	vector<int>v(n);
	for(int i = 0; i < n;i++){
		cin >> v[i];
	}

	int ans = 1e9;
	for(int i = 1; i < n; i++){
		int l = 0, r = 0;
		for(int j = 0; j < i; j++)
			l += v[j];
		for(int j = i; j < n; j++)
			r+= v[j];

		ans = min(ans, abs(l-r));
	}

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


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

#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int N = 3005;

int dp[N][N],n,m;
string s,t;

void solve()
{
  cin >> s >> t;
    
  n=s.length();
  m=t.length();  
    
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)   
      if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1] + 1; 
      else dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
    
    int nn = n;
    int mm = m;
 
    vector<char> v;
    
    while(nn >= 1 && mm>=1)
    {
        if(s[nn-1] == t[mm-1])
        {
         v.pb(s[nn-1]);
         nn--; mm--;
        }
        else if(dp[nn][mm-1] > dp[nn-1][mm]) mm--;   
        else nn--;
    }
    
    reverse(v.begin(),v.end());
    
    for(auto z : v) cout <<z;    
}

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

Measured memory_bytes: 35456
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import chain
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

IA = lambda: [int(x) for x in input().split()]

X,Y,Z,K = IA()
A, B, C = IA(), IA(), IA()
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
S = (A,B,C)

from heapq import *

inf = float('inf')
known = set()
q = []
c = (0,0,0)
v = sum([s[i] for s,i in zip(S, c)])
known.add(c)
heappush(q, (-v, c))
for _ in range(K):
    v, c = heappop(q)
    v = -v
    print(v)
    for i in range(3):
        n = c[i] + 1
        if len(S[i]) > n:
            nc = c[:i] + (n,) + c[i+1:]
            if nc not in known:
                known.add(nc)
                nv = sum([s[i] for s,i in zip(S, nc)])
                heappush(q, (-nv, nc))



Measured memory_bytes: 5236
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert
#define fh(x,v) for(auto x:v)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}



main(){
    string s;
    cin>>s;
    int c[3]={};
    fh(x,s)c[x-'a']++;
    if(max({c[0],c[1],c[2]})-min({c[0],c[1],c[2]})<=1)dump("YES");
    else dump("NO");
}














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

int main()
{
    int N;
    cin>>N;
    int A[N];
    for(int i=0; i<N; i++)
        cin>>A[i];
    int H[N];
    H[0]=0;
    H[1]=abs(A[1]-A[0]);
    for(int i=2; i<N; i++)
        H[i]= min(H[i-1]+abs(A[i]-A[i-1]),H[i-2]+abs(A[i]-A[i-2]));
    cout<<H[N-1];    
        
}

Measured memory_bytes: 4340
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<functional>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<unordered_map>
#include<math.h>
#include<stack>
#include<deque>
using namespace std;

signed main() {
	string a; cin >> a;
	if (a[0] == '9' || a[1] == '9')puts("Yes");
	else puts("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    for(char a = 'a'; a <= 'z'; a++) {
        bool on = false;
        for(int i = 0; i < S.size(); i++) {
            if(S[i] == a) on = true;
        }
        if(!on) {
            cout << a << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a) for(int i=lst[a];i;i=nxt[i])
using namespace std;

typedef long long ll;

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=105;

int t[N<<1],nxt[N<<1],lst[N],l;
void add(int x,int y) {t[++l]=y;nxt[l]=lst[x];lst[x]=l;}

int n,fa[N],son[N],dep[N],p[N],mx,d,u,v,r,s[N];

void dfs(int x,int y,int d) {
	if (d>mx) mx=d,r=x;fa[x]=y;
	rep(i,x) if (t[i]!=y) dfs(t[i],x,d+1);
}

int calc(int x,int y) {
	son[x]=0;int mx=0;
	rep(i,x) if (t[i]!=y) son[x]++,dep[t[i]]=dep[x]+1,mx=max(mx,calc(t[i],x));
	if (!son[x]) son[x]=1;
	return mx+1;
}

int main() {
	n=read();
	fo(i,1,n-1) {
		int x=read(),y=read();
		add(x,y);add(y,x);
	}
	mx=r=0;dfs(1,0,1);u=r;
	mx=r=0;dfs(u,0,1);v=r;
	for(int x=v;x;x=fa[x]) p[++d]=x;
	printf("%d ",(d+1)/2);
	if (d&1) {
		int x=p[(d+1)/2];
		dep[x]=0;calc(x,0);
		fo(i,0,d) s[i]=0;
		fo(i,1,n) s[dep[i]]=max(s[dep[i]],son[i]);
		ll tmp=1,ans=9e18;
		fo(i,0,d/2) tmp=tmp*s[i];
		ans=min(ans,tmp);
		rep(i,x) {
			int y=t[i];dep[x]=dep[y]=0;
			if (max(calc(y,x),calc(x,y))<=d/2+1) {
				fo(j,0,d) s[j]=0;
				fo(j,1,n) s[dep[j]]=max(s[dep[j]],son[j]);
				ll tmp=2;
				fo(j,0,d/2) tmp=tmp*s[j];
				ans=min(ans,tmp);
			}
		}
		printf("%lld\n",ans);
	} else {
		int x=p[d/2],y=p[d/2+1];
		dep[x]=dep[y]=0;
		calc(x,y);calc(y,x);
		fo(i,0,d) s[i]=0;
		fo(i,1,n) s[dep[i]]=max(s[dep[i]],son[i]);
		ll ans=2;
		fo(i,0,d/2-1) ans=ans*s[i];
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
#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>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
using Graph =vector<vector<int>>;
//xor ^
int main(){
  double L;cin>>L;
  double ans;
  ans=L*L*L/27;
  cout<<setprecision(12)<<ans<<endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	long int W,H,X,Y;
  int b;
  scanf("%ld %ld %ld %ld",&W,&H,&X,&Y);
  if(X*2==W && Y*2==H)b=1;
  else b=0;
	
  printf("%lf %d\n",(double)(W)*(double)(H)/2,b);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;cin>>a>>b;
    ll x = __gcd(a,b);
    ll aa = a/x, bb = b/x;
    set<ll> res,cand;
    ll lim = a/x*b;
    ll tmp = x;
    bool chk[1000020]={};
    DEBUG{
        printf("%lld %lld %lld\n",x,aa,bb);
    }
    res.insert(1);
    for(ll i=2;i*i<=x;i++){
        if(chk[i]){continue;}
        if(x%i==0){
            res.insert(i);
            while(tmp%i==0){
                tmp/=i;
            }
        }
        ll j = 1;
        while(i*j<1000020){
            chk[i*j]=true;
            j++;
        }
    }
    res.insert(tmp);
    cout << res.size() << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;

using namespace std;
int f[1005][20];
int p[1005][20];
int b[2000];
int sum[1000];
int ji = 0;
int ans;
int n;
void dfs(int cur)
{
    memset(sum, 0, sizeof(sum));
    for(int i = 0; i < 10; i++)
    {
        if(cur&(1<<i))
        for(int j = 1; j <= n; j++)
        {
            for(int k = 1; k <= 10; k++)
            if(f[j][k] == 1 && k == i+1)sum[j]++;
        }
    }
    int sum1 = 0;
    for(int i = 1; i <= n; i++)
    {
        sum1 += p[i][sum[i]];
    }
    ans = max(ans, sum1);
}
int main()
{
    scanf("%d", &n);
    FOR(i,1,n)
    FOR(j,1,10)
    cin >> f[i][j];
    FOR(i,1,n)
    FOR(j,0,10)
    cin >> p[i][j];
    memset(b, 0, sizeof(b));
    ans = -INF;
    for(int i = 1; i < (1<<10); i++)
    dfs(i);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN=1100005,MOD=1000000007;
int n,m,K,a[MAXN],b[MAXN],c[MAXN],tr[25][MAXN][2];
int x[MAXN],y[25][MAXN];
bool f[MAXN];
int dig(int x,int b){return (x>>b)&1;}
inline void Add(int &a,int b){a+=b;(a>=MOD)?a-=MOD:0;}
int main(){
	scanf("%d%d%d",&n,&m,&K);
	n--;
	for(int i=0;i<K;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]),b[i]--;
	for(int k=0;k<(1<<n);k++)
		for(int i=0;i<n;i++){
			if(dig(k,i))tr[i][k][0]=-1;else tr[i][k][0]=k;
			if(dig(k,i))tr[i][k][1]=k;
			else{
				tr[i][k][1]=k^(1<<i);
				for(int j=i+1;j<n;j++)if(dig(k,j)){
					tr[i][k][1]^=1<<j;
					break;
				}
			}
		}
	x[0]=1;
	for(int i=0;i<m;i++){
		memset(y,0,sizeof(y));
		for(int k=0;k<(1<<n);k++)y[0][k]=x[k];
		for(int j=0;j<n;j++)
			for(int k=0;k<(1<<n);k++){
				tr[j][k][0]!=-1?Add(y[j+1][k],y[j][k]):void(0);
				Add(y[j+1][tr[j][k][1]],y[j][k]);
			}
		memset(f,1,sizeof(f));
		for(int j=0;j<K;j++)if(a[j]==i+1){
			for(int k=0;k<(1<<n);k++)(dig(k,b[j])!=c[j])?f[k]=0:0;
		}
		for(int k=0;k<(1<<n);k++)x[k]=f[k]?y[n][k]:0;
	}
	int ans=0;
	for(int k=0;k<(1<<n);k++)Add(ans,x[k]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 233856
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back







int main()
{

	ll n, w;
	cin >> n >> w;

	ll wts[n + 1];
	ll vals[n + 1];

	for (int i = 1; i <= n; i++)
	{	cin >> wts[i];
		cin >> vals[i];
	}


	ll dp[n + 1][w + 1];



	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= w; j++)
		{
			dp[i][j] = 0;
		}
	}

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			if (j - wts[i] >= 0)
				dp[i][j] = max(dp[i - 1][j - wts[i]] + vals[i], dp[i - 1][j]);
			else
				dp[i][j] = dp[i - 1][j];
		}
	}

	// for (int i = 0; i <= n; i++)
	// {
	// 	for (int j = 0; j <= w; j++)
	// 	{
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	cout << dp[n][w] << endl;

}





Measured memory_bytes: 79104
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> d(n);
	REP(i,n) cin>>d[i];
	sort(ALL(d));
	ll buf=d[n-1];
	ll ans=1;
	FOR(i,1,n) {
		if(d[n-1-i]<buf) {
			buf=d[n-1-i];
			ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include<cstring>
//#include<cstdio>
//#include<stdio.h>
//#include<cmath>
//#include<math.h>
//#include<vector>
//#include<set>
//#include<queue>
//#include<map>
//#define forn(i,n) for(int (i)=0;i<(n);i++)
//#define pb push_back
//#define mp make_pair
//using namespace std;
//typedef pair<int,int>pii;
//typedef long long ll;
//typedef pair<ll,ll> pll;
//const int MAXN=100005;
//const int INF=2147483647;
//const ll LINF=9223372036854775807;
//const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
//int cnt[100005],ans;
//int n; 
//int main()
//{
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cin>>n;
//	forn(i,n)
//	{
//		int x;
//		cin>>x;
//		if(x>100000)continue;
//		cnt[x]++;
//	}
//	forn(i,100001)
//		if(cnt[i]>=i)ans+=i;
//	cout<<n-ans<<endl;
//	return 0;
//}

#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int ans;
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		int x;
		cin>>x;
		mp[x]++;
	}
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		if((*it).second<(*it).first)ans+=(*it).second;
		else ans+=(*it).second-(*it).first;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

#define V_MAX   1010
#define E_MAX   V_MAX(V_MAX-1)/2


int s, g;
priority_queue< cp2, vector<cp2>, greater<cp2> >pq;
vector< cp2 >P[V_MAX];
int d[V_MAX];
bool flag[V_MAX];
cp2 base;
int idx;
int dist;
int num;

void daijkstra( int S ){
	fill( d, d+V_MAX, -1 );
	fill( flag, flag+V_MAX, 1 );
	
	d[S] = 0;
	pq.push( cp2( 0, S ) );
	while( !pq.empty() ){
		base = pq.top();
		pq.pop();
		if( !flag[base.se] ) continue;
		flag[base.se] = 0;
		REP( i, P[base.se].size() ){
			idx = P[base.se][i].se;
			dist = P[base.se][i].fi;
			if( d[idx] < 0 ) d[idx] = dist+base.fi;
			d[idx] = min( d[idx], dist+(int)base.fi );
			if( flag[idx] ) pq.push( cp2( d[idx], idx ) );
		}
	}	
}

int N, M;
int a, b;
int ans = 0;

vector< int >E[53];

int main(){
	
	cin>>N>>M;
	
	REP( i, M ){
		scanf("%d %d", &a, &b);
		P[a].push_back( cp2( 0, b ) );
		P[b].push_back( cp2( 0, a ) );
	}
	
	FOR( i, 1, N+1 ){
		REP( j, P[i].size() ){
			P[i][j].fi = 1;
			daijkstra( (int)i );
			int key = P[i][j].se;
			if( d[key] ) ans++;
			P[i][j].fi = 0;
		}
	}
	
	cout<<ans/2<<endl;
	
}



Measured memory_bytes: 256
k = int(input())
keta = 1
ima = 1
def sunuke(n) :
    a = 0
    for i in str(n) :
        a += int(i)
    return(n/a)
count = 0
while count < k :
    if sunuke(ima) <= sunuke(ima+keta) :
        print(ima)
        ima += keta
        count += 1
    else :
        ima += 9*keta
        keta *= 10

Measured memory_bytes: 3188