akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <list>
#include <array>
#include <cstdlib>
#include <stack>
#include <string>
#include <queue>
#include <chrono>
#include <functional>
#include <limits>
#include <cmath>
#include <algorithm>
#include <random>
#include <regex>
#include <tuple>
#include <numeric>
#include <cassert>
#include <utility>
#include <bitset>
#include <complex>
#include <iomanip>
#include <ostream>
#include <sstream>
#include <ctime>
using namespace std;
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define index INDEX
#ifndef ONLINE_JUDGE
#define print(x) PRINT(x, #x)
template<typename T> void PRINT(T VARIABLE, const string& NAME) {
	cerr << NAME << " = " << fixed << VARIABLE << "\n";
}
#else
#define print(x) 0 
#endif
int generate_random() {
	const int MAX_RANDOM = (int)1e6;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	return uniform_int_distribution<int>(0, MAX_RANDOM)(rng);
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll INFLL = 2 * (ll)1e18 + 100;
#define int ll
#ifdef int 
const int INFINT = INFLL;
#else
const int INFINT = 2 * (int)1e9 + 100;
#endif
const double PI = atan(1) * 4;
const double EPS = 1e-6;
const int SEED = (int)1e3 + 7;
const int MOD = (int)1e9 + 7;
const int NMAX = (int)1e6 + 5;

int v[NMAX];
int dp[NMAX];

int32_t main() {
#ifndef ONLINE_JUDGE
	double START_PROGRAM = clock();
#endif
	srand(time(NULL));
	cout << setprecision(20) << fixed;
	FASTIO;
    int n;
    int k;
    cin >> n >> k;
    for1(i, n)
    {
        cin >> v[i];
    }
    dp[1] = 0;
    for(int i = 2; i <= n; i++) dp[i] = INFINT;
    for(int i = 2; i <= n; i++)
    { 
        for(int j = 1; j <= k && i - j > 0; j++)
        {
            dp[i] = min(dp[i - j] + abs(v[i] - v[i - j]), dp[i]);
        }
    }
    cout << dp[n];







#ifndef ONLINE_JUDGE
	double END_PROGRAM = clock();
	double ELAPSED_TIME = (END_PROGRAM - START_PROGRAM) / CLOCKS_PER_SEC;
	cerr << "\n\nElapsed Time: " << ELAPSED_TIME * 1000 << "\n";
#endif
	return 0;
}







Measured memory_bytes: 5120
#include <iostream>
using namespace std;
int f(int x) {
  return x * x;
}
int main() {
  int d, i, r;
  while (cin >> d) {
    for (i = r = 0; i < (600 / d); i++) {
      r += f(d * i) * d;
    }
    cout << r << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int sx, sy, tx, ty;

    scanf("%d%d%d%d", &sx, &sy, &tx, &ty);

    for(int i = 0; i < tx - sx; i++){
        printf("R");
    }
    for(int i = 0; i < ty - sy; i++){
        printf("U");
    }
    for(int i = 0; i < tx - sx; i++){
        printf("L");
    }
    for(int i = 0; i < ty - sy; i++){
        printf("D");
    }
    printf("D");
    for(int i = 0; i < tx - sx + 1; i++){
        printf("R");
    }
    for(int i = 0; i < ty - sy + 1; i++){
        printf("U");
    }
    printf("LU");
    for(int i = 0; i < tx - sx + 1; i++){
        printf("L");
    }
    for(int i = 0; i < ty - sy + 1; i++){
        printf("D");
    }
    printf("R\n");

    return 0;
}

Measured memory_bytes: 1712
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

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

// constexpr inline ll MOD = 1'000'000'007;

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s; cin>>s;
    int res = 0;
    REP(i, s.size()){
        for (int j = i; j <= s.size(); j++)
        {
            bool b = true;
            for (int k = i; k < j; k++) {
                b &= (s[k] == 'A' || s[k] == 'T' || s[k] == 'C' || s[k] == 'G');
            }
            res = (b ? max(res, j - i) : res);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const ll inf = 1020304050607080910;
const int INF = 1073741823;
const ll mod = 1000000007;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x,ll y){if(x>y)swap(x, y);while(x!=0){y%=x;swap(x, y);}return y;}
ll mpow(ll x,ll r){if(r==0)return 1;if(r%2==1){return x*mpow(x,r-1)%mod;}else{ll aa=mpow(x,r/2);return aa*aa%mod;}}

int main(){
	int a; cin >> a;
	cout << a + a*a + a*a*a << endl;
	return 0;
}


Measured memory_bytes: 3620
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)

//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

void solve()
{
    IN(n, R);
    cout << (n >= 10 ? R : R + 100 * (10 - n)) << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 998244353
#define INF ((1LL<<62LL) - 1)

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

    int n,k; cin >> n >> k;
    int a[k], b[k];
    for(int i=0;i<k;i++){
        cin >> a[i] >> b[i];
    }

    int dp[n+1];
    int pre[n+1];
    memset(dp, 0, sizeof(dp));

    dp[0] = 0;
    pre[0] = 0;
    dp[1] = 1;
    pre[1] = 1;
    for(int i=2;i<=n;i++){
        for(int j=0;j<k;j++){
            int lo = i - b[j] - 1;
            if(lo<0) lo = 0;

            int hi = i - a[j];
            if(hi <= 0){
                continue;
            } else {
                int temp = (pre[hi] - pre[lo])%M;
                temp+=M;
                temp%=M;

                dp[i] += temp;
                dp[i]%=M;
            }
        }

        pre[i] = (pre[i-1] + dp[i])%M;
    }

    cout << dp[n] << "\n";




}


Measured memory_bytes: 6776
#include <iostream>
#include <bits/stdc++.h>
#define ll long long

using namespace std;
const ll Mod = 1e9 + 7;
ll fact[200100];

long long fastpower(long long a,long long b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a;
    long long res = fastpower(a,b/2)%Mod;
    res = (res %Mod  * res % Mod )%Mod;
    if(b%2!=0)
        res*=a;
    return res % Mod;
}

ll C(ll n , ll k){

    if(n < k)  return 0;
    ll x = fact[n];
    ll y = (fact[k] * fact[n - k])%Mod;
    return ((x * fastpower(y , Mod - 2))%Mod);
}

void add_self(ll &x , ll y){
    x = (x + y)%Mod;
}

void sub_self(ll &x , ll y){
    x = ((x - y)%Mod)+Mod;
}

vector < ll > v , v2;

int main()
{
    ll n,m,k;  cin >> n >> m >> k;
    fact[0] = 1;
    for(int i = 1;i<=200000;i++)  fact[i] = (fact[i - 1] * i) % Mod;
    ll sum = 0;
    for(int i = 1;i<=n;i++){
        for(int j = 1;j<=m;j++){
            v.push_back(i);
            v2.push_back(j);
        }
    }
    sort(v.begin() , v.end());
    sort(v2.begin() , v2.end());
    ll Ans = 0;
    for(ll i = 0;i<v.size();i++){
        ll Ways  = C(n * m - 2 , k - 2);
        sub_self(Ans , v[i] * ((ll)v.size() - (i + 1)) * Ways +  Mod);
        add_self(Ans , v[i] * i % Mod * Ways);
    }
    for(ll i = 0;i<v2.size();i++){
        ll Ways  = C(n * m - 2 , k - 2);
        sub_self(Ans , v2[i] * ((ll)v2.size() - (i + 1)) * Ways + Mod);
        add_self(Ans , v2[i] * i % Mod * Ways);
    }
    cout << Ans;
    return 0;
}


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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  int A;
  set<int> s;
  rep(i, n) {
    cin >> A;
    s.insert(A);
  }

  if (s.size() == n) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 9728
#include<bits/stdc++.h>
#define lson l, mid, i<<1
#define rson mid+1, r, i<<1|1
#define PII pair<int, int>
#define Size(x) (int)(x.size())
using namespace std;
typedef long long LL;
//const int MOD = 1e9+7;
//const auto INF = 0x3f3f3f3f;
const int N = 1e5+5;

LL a[N];

bool cmp(const int &u, const int &v) {
    return u>v;
}
int main() {
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; i++) {
        scanf("%lld", &a[i]);
    }
    sort(a+1, a+1+n, cmp);
    int cnt = 1;
    LL answer = 0, pre = -1;
    for(int i=1; i<=n+1 && !answer; i++) {
        if(i == 1 || i==n+1 || a[i] != a[i-1]) {
//            printf("cnt=%d i=%d a=%lld pre=%lld\n", cnt, i, a[i], pre);
            if(cnt >= 4) {
                if(pre == -1) {
                    answer = (LL)a[i-1]*(LL)a[i-1];
                } else
                    answer = a[i-1]*pre;
                break;
            } else if(cnt >= 2) {
                if(pre != -1) {
                    answer = (LL)a[i-1]*pre;
                    break;
                } else
                    pre = a[i-1];
            }
            cnt = 1;
        } else
            cnt++;
    }
    printf("%lld\n", answer);
}




Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n;
int a[110],b[110];
int main()
{
	cin>>n;
	for(int i=1;i<=n-1;i++)
	{
		cin>>b[i];
	}
	a[1]=a[2]=b[1];
	for(int i=2;i<=n-1;i++)
	{
		if(b[i]>b[i-1])
		{
			a[i+1]=b[i];
		}
		if(b[i]<b[i-1])
		{
			a[i]=a[i+1]=b[i];
		}
		if(b[i]==b[i-1])
		{
			a[i+1]=b[i];
		}
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		sum=sum+a[i];
	}
	printf("%d",sum);
	return 0;
} 

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint x(n);
  rep(i, n) cin >> x[i];

  vint dx(n-1);
  rep(i, n-1) dx[i] = x[i+1]-x[i];

  int m, k;
  cin >> m >> k;
  vint a(m);
  rep(i, m) cin >> a[i], --a[i];

  vint id(n-1);
  iota(all(id), 0);
  rep(i, m) swap(id[a[i]-1], id[a[i]]);

  rep(i, 60) {
    if((k>>i)&1) {
      vint tmp = dx;
      rep(j, n-1) dx[j] = tmp[id[j]];
    }

    vint tmp = id;
    rep(j, n-1) id[j] = tmp[tmp[j]];
  }

  vint ans(n);
  ans[0] = x[0];
  rep(i, n-1) ans[i+1] = ans[i] + dx[i];

  rep(i, n) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int N = 3005;
const int MOD = 1e9 + 7;
const int INV2 = 5e8 + 4;

template <typename T> inline void read(T &AKNOI) {
    T x = 0, flag = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') flag = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    AKNOI = flag * x;
}

namespace ModCalculator {
	inline void Inc(int &x, int y) {
		x += y; if (x >= MOD) x -= MOD;
	}
	inline void Dec(int &x, int y) {
		x -= y; if (x < 0) x += MOD;
	}
	inline int Add(int x, int y) {
		Inc(x, y); return x;
	}
	inline int Sub(int x, int y) {
		Dec(x, y); return x;
	}
	inline int Mul(int x, int y) {
		return 1LL * x * y % MOD;
	}
}
using namespace ModCalculator;

int n, q, a[N], dp[N][N];

void init() {
	read(n); read(q);
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
	}
}

void solve() {
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n ; ++j) {
			dp[i][j] = (a[i] < a[j]);
		}
	}
	int pw = 1, x, y, ans = 0;;
	while (q--) {
		Inc(pw, pw);
		read(x); read(y);
		dp[x][y] = dp[y][x] = Mul(Add(dp[x][y], dp[y][x]), INV2); // 1/2 the same, 1/2 changed
		for (int i = 1; i <= n; ++i) {
			if (i == x || i == y) continue;
			dp[i][x] = dp[i][y] = Mul(Add(dp[i][x], dp[i][y]), INV2);
			dp[x][i] = dp[y][i] = Mul(Add(dp[x][i], dp[y][i]), INV2);
		}
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j < i; ++j) {
			Inc(ans, dp[i][j]);
		}
	}
	printf("%d\n", Mul(ans, pw));
}

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


Measured memory_bytes: 35584
import sys


def input():
    return sys.stdin.readline().strip()


def main():
    size = int(input())
    dp = [0] * 3
    for _ in range(size):
        z = (list(map(int, input().split())))
        newDp = [0] * 3
        for i in range(3):
            for j in range(3):
                if j != i:
                    # import pdb
                    # pdb.set_trace()
                    newDp[j] = max(newDp[j], dp[i] + z[j])
        dp = newDp
    print(max(dp[0],dp[1],dp[2]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include<iostream>
#include<string>
using namespace std;
string S;
bool search(string F) {
	string U[3]; F += '&'; string G = ""; int cnt = 0;
	for (int i = 0; i<F.size(); i++) {
		if (F[i] == '&') { U[cnt] = G; cnt++; G = ""; }
		else G += F[i];
	}
	if (U[0].size() == 1 && U[1].size() == 2 && U[0][0] == U[1][1])return false;
	if (U[0].size() == 1 && U[2].size() == 2 && U[0][0] == U[2][1])return false;
	if (U[1].size() == 1 && U[2].size() == 2 && U[1][0] == U[2][1])return false;
	if (U[0].size() == 2 && U[1].size() == 1 && U[0][1] == U[1][0])return false;
	if (U[0].size() == 2 && U[2].size() == 1 && U[0][1] == U[2][0])return false;
	if (U[1].size() == 2 && U[2].size() == 1 && U[1][1] == U[2][0])return false;
	return true;
}
int main() {
	while (true) {
		cin >> S; if (S == "#")break;
		S += '|'; string T = ""; bool OK = false;
		for (int i = 0; i<S.size(); i++) {
			if (S[i] == '|') { if (search(T) == true)OK = true; T = ""; }
			if (S[i] != '|' && S[i] != '(' && S[i] != ')')T += S[i];
		}
		if (OK == true)cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

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

typedef long long ll;

void func(string &a, string b ) {
  if ( a == "-" ) a = b;
  else if (a.size() < b.size()) a = b;
  else if (a.size() == b.size()) {
    if ( a < b ) a = b;
  }
}

string dp[11000];
int main() {
  int N,M; cin >> N >> M;
  int A[10];
  int B[10]={0,2,5,5,4,5,6,3,7,6};
  for ( int i = 0; i < M; i++ ) cin >> A[i];
  for ( int i = 0; i < 11000; i++ ) dp[i] = "-";
  dp[0] = "";

  for ( int i = 0; i <= N; i++ ) {
    if ( dp[i] == "-" ) continue;
    for ( int j = 0; j < M; j++ ) {
      if ( i+B[A[j]] <= N )
      func(dp[i+B[A[j]]],dp[i]+(char)('0'+A[j]));
    }
  }


  
  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 44800
#include<iostream>
#include<string>
using namespace std;
int main()
{
	long a, b, c, n;
	long i, j;
	unsigned long ans = 1;
	unsigned long tmp, tmp2;

	cin >> n;
	for (i = 2; i <= n - 1; i++) {
		tmp = 1;
		j = i;
		for (a = 2; a*a <= j; a++) {
			if (j%a == 0) {
				tmp2 = 1;
				while (j%a == 0) {
					j = j / a;
					tmp2++;
				}				
				tmp *= tmp2;
			}
		}
		if (j == 1) {
			ans += tmp;
		}
		else {
			ans += (tmp * 2);
		}
	}
	cout << ans << endl;
	return 0;
}



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

template<class node> class ST {
    vector<node> t;
    int n;


public:
    ST(vector<node> &arr) {
        n = arr.size();
        t.resize(n*2);
        copy(arr.begin(), arr.end(), t.begin() + n);
        for (int i = n-1; i > 0; --i)
            t[i] = node(t[i<<1], t[i<<1|1]);
    }


    // 0-indexed
    void set_point(int p, const node &value) {
        for (t[p += n] = value; p > 1; p >>= 1)
            t[p>>1] = node(t[p], t[p^1]);
    }


    // inclusive exclusive, 0-indexed
    node query(int l, int r) {
        node ansl, ansr;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l&1) ansl = node(ansl, t[l++]);
            if (r&1) ansr = node(t[--r], ansr);
        }
        return node(ansl, ansr);
    }
};

struct rminq {
    int value;
    rminq() {value = INT_MAX;}
    rminq(int x) {value = x;}
    rminq(const rminq &a, const rminq &b) {
        value = min(a.value, b.value);
    }
};

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

    int n, Q;
    cin>>n>>Q;
    vector<rminq> arr(n, rminq(INT_MAX));
    ST<rminq> st(arr);
    rep(q,Q) {
        int cmd, x, y;
        cin>>cmd>>x>>y;
        if (cmd == 0) {
            st.set_point(x, rminq(y));
        } else {
            cout<<st.query(x, y+1).value<<'\n';
        }
    }

    return 0;
}

Measured memory_bytes: 4084
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
//		new AOJ0260().doIt();
		new AOJ0259().doIt();
	}
	
	
	class AOJ0259{
		
		String solve(String input){
			int[] num = new int[4];
			for(int i=0;i<4;i++)num[i] = Integer.parseInt(input.charAt(i)+"");
			if(num[0]==num[1]&&num[0]==num[2]&&num[0]==num[3])return "NA";
			int cnt = 0;
			while(true){
				if(num[0]==6&&num[1]==1&&num[2]==7&&num[3]==4)break;
				Arrays.sort(num);//小さい
//				for(int i=0;i<num.length;i++)System.out.println(num[i]);
				int l = Integer.parseInt(Integer.toString(num[3])+Integer.toString(num[2])+
						Integer.toString(num[1])+Integer.toString(num[0]));
				int s = Integer.parseInt(Integer.toString(num[0])+Integer.toString(num[1])+
						Integer.toString(num[2])+Integer.toString(num[3]));
				String a = Integer.toString(l-s);
				if(a.length()<4)for(int i=0;i<4-a.length();i++)a = "0"+a;
				for(int i=0;i<a.length();i++)num[i] =Integer.parseInt(a.charAt(i)+"");
				cnt++;
			}
			return Integer.toString(cnt);
		}
		
		void doIt(){
			while(true){
				String input = in.next();
				if(input.equals("0000"))break;
				String solve = solve(input);
				System.out.println(solve);
			}
		}
	}
	
	class AOJ0260{
		void doIt(){
			while(true){
				int n = in.nextInt();
			}
		}
	}
	
}

Measured memory_bytes: 60324
#include <bits/stdc++.h>
#include <stdio.h>
#define ll long long
#define fr(i,p,n) for(ll i=p;i<n;i++)
#define fr1(i,p,n) for(ll i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;
using namespace std;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        int k;
        cin>>k;
        string s;
        cin>>s;
        int n=s.size();
        if(k>=n) cout<<s<<endl;
        else
        {
            fr(i,0,k) cout<<s[i];
            cout<<"..."<<endl;
        }
    }
    return 0;
}


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

using namespace std;

#define MOD 1000000007
typedef long long ll;


long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}



ll solve(ll n) {
    if (n == 1) {
        return 0;
    }
    ll c = 1;
    for (int i = 0; i < n; i++) {
        c *= 10;
        c %= MOD;
    }

    // 0も9もない
    ll d = 1;
    for (int i = 0; i < n; i++) {
        d *= 8;
        d %= MOD;
    }

    // 0がない
    ll e = 1;
    for (int i = 0; i < n; i++) {
        e *= 9;
        e %= MOD;
    }

    // 0がある
    ll a = mod(c - e, MOD);
    
    ll ans = mod((2 * a) - mod((c - d), MOD), MOD);
    assert(a >= 0 && c >= 0 && d >= 0 && e >= 0 && ans >= 0);
    // if (a >= 0 && c >= 0 && d >= 0 && e >= 0 && ans >= 0) {
    return ans;
    // }
    // cout << "a = " << a << endl;
    // cout << "c = " << c << endl;
    // cout << "d = " << d << endl;
    // cout << "e = " << e << endl;
    // cout << "ans = " << ans << endl;
}



int main() { 
    ll n;
    cin >> n;
    // for (ll i = 1; i < 100; i++) {
        // solve(i);
    // }
    cout << solve(n) << endl;
    return 0;
}

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

int main()
{
    int A, B;
    string S, T, U;

    cin >> S >> T >> A >> B >> U;

    if (S == U)
    {
        A--;
    }
    else
    {
        B--;
    }

    cout << A << ' ' << B << endl;
}

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

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        while(n != 0){
            if(n % 10 == 7){
                System.out.println("Yes");
                return;
            }
            n /= 10;
        }
        System.out.println("No");
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 32572
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int pt[1005][1005];

int main(){
  int n,k;
  cin >> n >> k;
  vector<int>x(n),y(n);
  vector<char> c(n);
  int p,q,r,s;
  for(int i=0;i<n;i++){
    bool cl=0;
    cin >> x[i] >> y[i] >> c[i];
    p=x[i]/k;
    q=y[i]/k;
    r=x[i]%k;
    s=y[i]%k;
    if(c[i]=='B')cl=1;
    if((p+q)%2)cl= !cl;
    if(cl){
      pt[k][k]++;
      pt[r][k]--;
      pt[k][s]--;
      pt[r][s]+=2;
    }
    else{
      pt[r][k]++;
      pt[k][s]++;
      pt[r][s]-=2;
    }
  }
  int ans=0;
  for(int j=k;j>=0;j--)
    for(int i=k;i>=0;i--){
      pt[i][j]=pt[i+1][j]+pt[i][j+1]-pt[i+1][j+1]+pt[i][j];
      ans=max(ans,max(pt[i][j],n-pt[i][j]));
    }

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


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n ;
  vector <vector<int>> vec(n , vector<int>(2));
  for (int i = 0; i < n; i++){
  for (int j = 0; j < 2; j++){
  cin >> vec.at(i).at(j);
  }
  } 
  int count = 0;
  for (int i = 0; i < n; i++){
  count += vec.at(i).at(1) - vec.at(i).at(0) + 1;
  }
  cout << count;
  }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s;

signed main() {
	cin >> s;
	int n = (int)s.size();
	for (int i = 0; i < n / 2; i++)if (s[i] != s[n - 2 - i]) {
		cout << -1 << endl;
		return 0;
	}
	if (s[n - 1] == '1' || s[0] == '0') {
		cout << -1 << endl;
		return 0;
	}
	cout << 1 << " " << n << endl;
	int k = 1;
	for (int i = 1; i < n - 1; i++) {
		cout << k << " " << i + 1 << endl;
		if (s[i] == '1')k = i + 1;
	}
}

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

int main() {
	int n;
	cin >> n;
	map<int, int>num;
	int ans = 0;
	for (int i = 0;i < n;i++) {
		int x;
		cin >> x;
		if (x > n)ans++;
		else num[x-1]++;
	}
	for (int i = 0;i < n;i++) {
		if (num[i] > i + 1)ans += num[i] - i - 1;
		if (num[i] < i + 1)ans += num[i];
	}
	cout << ans << endl;
}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

lint pow_mod(lint p, lint n){
    lint ret = 1;
    while (0 < n){
        if ((n%2) == 0){
            p = p*p%MOD;
            n /= 2;
        } else {
            ret = ret*p%MOD;
            n--;
        }
    }
    return ret;
}

/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

lint a[100100];

void solve(){  
    lint N;
    cin >> N;
    lint K;
    cin >> K;         //distinct integers;

   lint ret = 0;
    for(lint gcd = K;gcd >= 1; --gcd) { 
            a[gcd] = pow_mod(K/gcd,N);

          for(lint exc = gcd*2;exc <= K; exc += gcd) {
             a[gcd] = (a[gcd] - a[exc] + MOD)%MOD;
          }
       ret = (ret + a[gcd]*gcd)%MOD;
    }

    cout << ret << endl;
}

int main(){   
  
 solve();

 return 0;
}


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

int main() {
  int n;
  set<int> a;
  string ans = "YES";
  cin >> n;
  rep(i,n) {
    int t;
    cin >> t;
    if(a.find(t) == a.end()) {
      a.insert(t);
    } else {
      ans = "NO";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9600
<?php

// 0 <= S < 86400
fscanf(STDIN, '%d', $S);
$h = $S / (60 * 60);
$m = $S % (60 * 60) / 60;
$s = $S % (60 * 60) % 60;
printf('%d:%d:%d%s', $h, $m, $s, PHP_EOL);

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

#define o(output) cout << output << endl
#define priolity_queue pq
#define push p
#define top t

using namespace std;

string s;
int a,b,c,d;
char A,B;

int main(){
  cin>>a;
  for(int i=1;i<=a;i*=2){
    b=i;
    }
  o(b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  string s;
  cin >> s;
  string k = "keyence";
  for (int i = 0; i < s.size(); ++i) for (int j = i; j < s.size(); ++j) {
    if (s.substr(0, i) + s.substr(j) == k) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll dp[100001];
vector<vector<ll> > v(100001);
ll dfs(ll n){
    if(dp[n]!=-1)return dp[n];
    ll maki=v[n].size();
    ll num=0;
    for(int i=0;i<maki;i++){
        num=max(num,1+dfs(v[n][i]));
    }
    dp[n]=num;
    return num;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    memset(dp,-1,sizeof(dp));
    ll a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        a--;b--;
        v[a].pb(b);
    }
    ll ans=0;
    for(ll i=0;i<n;i++){
        ans=max(ans,dfs(i));
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;++i)
const ll MOD=1e+9 +7;
const ll MAX = 1100000;


ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int n,k; cin >> n >> k;
    vector<ll> a(n);
    COMinit();
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    ll ans = 0;
    for(int i=0;i<n;++i){
        ans+=a[i] * (COM(i,k-1)-COM(n-1-i,k-1)) % MOD;
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 26752
using System;

namespace ConsoleApplication45
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            double x1 = double.Parse(input[0]);
            double y1 = double.Parse(input[1]);
            double x2 = double.Parse(input[2]);
            double y2 = double.Parse(input[3]);
            double p1 = Math.Pow(x2 - x1,2);
            double p2 = Math.Pow(y2 - y1, 2);
            double a = Math.Sqrt(p1 + p2);
            Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 9492
#include <cstdio>
#include <fstream>
#include <vector>

using namespace std;

struct binSearch {
	vector <int> list;
	vector <int> findThis;
	int size = 0;
	int size2 = 0;
	int counter = 0;
	binSearch(int Size, vector <int> List, int Size2, vector <int> FindThis){
		size = Size;
		list = List;
		size2 = Size2;
		findThis = FindThis;
		search();
	}
	void search() {
		for (int i = 0; i < size2; i++) {
			int left = 0;
			int right = size - 1;
			int med = (left + right) / 2;
			while (left <= right) {
//				printf("now j= %d\n", med);
				if (findThis[i] > list[med]) {
					left = med + 1;
				} else if (findThis[i] < list[med]) {
					right = med - 1;
				} else if (findThis[i] == list[med]) {
					counter++;
					break;
				}
				med = (left + right) / 2;
			}
		}
		printf("%d\n", counter);
	}
};
int main() {
	char oinput[20000];
	int size = 0;
	int size2 = 0;
	int num = 0;

	scanf("%d%*c", &size);
	vector<int> list(size);
	for (int i = 0; i < size; i++) {
		scanf("%d", &list[i]);
	}
	scanf("%d%*c", &size2);
	vector <int> findThis(size2);
	for (int i = 0; i < size2; i++) {
		scanf("%d", &findThis[i]);
	}
	binSearch* l = new binSearch(size, list, size2, findThis);
	return 0;
}



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

signed main(void){
    long long N;
    cin >> N;
    
    vector<long long> D(N+1,0);
    
    for(long long i=1;i<=N;i++){
        for(long long j=i;j<=N;j+=i){
            D[j]++;
        }
    }
    
    long long Answer = 0;
    for(long long i=1;i<=N;i++){
        Answer += (i*D[i]);
    }
    
    cout << Answer << endl;
    
    return 0;
}


Measured memory_bytes: 81380
#include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 2e5 + 9, M = 1e7 + 9, OO = 1e9 + 7, MOD = 1e9 + 7, MOD2 = 998244353;
const ll INF = 2e18;

int n, sz[N], dpDown[N], fact[N], inv[N], dp[N];
vector<int> adj[N];

int mul(int x, int y) {
	return (1ll * x * y) % MOD;
}

int C(int n, int r) {
	if(r > n || n < 0) return 0;
	return mul(fact[n], mul(inv[r], inv[n - r]));
}

int fastPow(int x, int k) {
	int ret = 1;
	while(k) {
		if(k & 1)
			ret = mul(ret, x);
		k /= 2;
		x = mul(x, x);
	}
	return ret;
}

void dfs(int node, int par) {
	sz[node] = 1;
	dpDown[node] = 1;
	for(auto it: adj[node]) {
		if(par == it) continue;
		dfs(it, node);
		sz[node] += sz[it];
	}
	int r = sz[node] - 1;
	for(auto it: adj[node]) {
		if(par == it) continue;
		dpDown[node] = mul(dpDown[node], mul(dpDown[it], C(r, sz[it])));
		r -= sz[it];
	}
}

void dfs2(int node, int par) {
	if(~par) {
		int x = mul(dpDown[node], C(n - 1, sz[node]));
		x = mul(dp[par], fastPow(x, MOD - 2));
		x = mul(x, C(n - 1, n - sz[node]));
		dp[node] = mul(x, dpDown[node]);
	} else {
		dp[node] = dpDown[node];
	}
	for(auto it: adj[node]) {
		if(it == par) continue;
		dfs2(it, node);
	}
}

int main() {
	fastIO;
#ifdef LOCAL
	freopen("input.in", "rt", stdin);
#endif
	cin >> n;
	fact[0] = 1, inv[0] = 1;
	for (int i = 1; i <= n; ++i) {
		fact[i] = mul(i, fact[i - 1]);
		inv[i] = fastPow(fact[i], MOD - 2);
	}
	int u, v;
	for (int i = 1; i < n; ++i) {
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(1, -1);
	dfs2(1, -1);
	for (int i = 1; i <= n; ++i)
		cout << dp[i] << '\n';
	return 0;
}


Measured memory_bytes: 17908
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      int A,B,C;
      cin >> A >> B >> C;
      int ans;
      if(A==B)ans = C;
      else{
        if(A==C) ans = B;
        else ans = A;
      }
      cout << ans << endl;
    }

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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    string S; cin>>S;

    string out = "";

    for(int i=0;i<S.size();i++){
        out+='x';
    }
    cout<<out<<endl;

    return 0;
}

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

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int l=0,r=0;

    for (int i = 0; i < m; i++){
        int a;
        cin >> a;
        if(a > x)   r++;
        else    l++;
    }

    cout << min(r, l) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e6 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fin;
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    ll aux = k - a;
    if(aux <= 0)
        cout << k << '\n';
    else{
        ans += a;
        k -= a;
        aux = k - b;
        if(aux <= 0)
            cout << ans << '\n';
        else{
            k -= b;
            aux = k - c;
            if(aux <= 0)
                cout << ans - k << '\n';
            else
                cout << ans - aux << '\n';
        }
    }
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}   

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


int main(){
  int n;
  cin >> n;
  long a[n];
  rep(i,n)cin>> a[i];
  sort(a,a+n);
  long ans = 0;
  rep(i,n-1){
    ans += a[n-1-(i+1)/2];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5200
import fractions

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
  
a,b = map(int, input().split())
GCD = fractions.gcd(a,b)
print(len(factorize(GCD)) + 1)

Measured memory_bytes: 5048
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]


n = input()

for i in range(3):
    if n[i] == "9":
        print("1",end="")
    else:
        print("9",end="")


Measured memory_bytes: 8996
#include <iostream>
int main(){
  int i=0,n,h[101],a=0,t=0;
  std::cin>>n;
  while(std::cin>>h[i])++i;
  for(int i=0;i!=n;++i){
    if(h[i]<t)a+=t-h[i];
    t=h[i];
  }
  a+=t;
  std::cout<<a<<"\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7,iv=(mod+1)/2;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
int h,w,n,x[33],y[33],prex[1111111],prey[1111111],ans,arrx[111],arry[111],cntx,cnty,dist[111][111],res;
int fx[111],fy[111];
bool ex[1111111],ey[1111111],ff[111][111];
map<pair<int,int>,int> mp;
bool In(int x,int y)
{
	return (x>=1 && x<=cntx && y>=1 && y<=cnty);
}
void bfs(int i,int j)
{
	memset(dist,-1,sizeof(dist));
	dist[i][j]=0;
	queue<pair<int,int> > q;
	q.push(make_pair(i,j));
	while(!q.empty())
	{
		int xx=q.front().first,yy=q.front().second;
		q.pop();
		for (int i=0;i<4;i++)
		{
			int xxx=xx+dx[i],yyy=yy+dy[i];
			if (!In(xxx,yyy) || ff[xxx][yyy]) continue;
			if (!~dist[xxx][yyy])
			{
				dist[xxx][yyy]=dist[xx][yy]+1;
				q.push(make_pair(xxx,yyy));
			}
		}
	}
}
int main()
{
	scanf("%d%d%d",&h,&w,&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&x[i],&y[i]);x[i]++;y[i]++;
		ex[x[i]]=ey[y[i]]=1;
		mp[make_pair(x[i],y[i])]=1;
		prex[x[i]]++;prey[y[i]]++;
	}
	for (int i=1;i<=h;i++) prex[i]+=prex[i-1];
	for (int i=1;i<=w;i++) prey[i]+=prey[i-1];
	for (int i=1;i<h;i++)
	{
		if (!ex[i] && !ex[i+1])
		{
			ans=(1ll*(1ll*w*i-prex[i])%mod*((1ll*w*(h-i)-(n-prex[i]))%mod)+ans)%mod;
		}
	}
	for (int i=1;i<w;i++)
	{
		if (!ey[i] && !ey[i+1])
		{
			ans=(1ll*(1ll*h*i-prey[i])%mod*((1ll*h*(w-i)-(n-prey[i]))%mod)+ans)%mod;
		}
	}
	for (int i=1;i<=h;i++)
	{
		if (ex[i] || ex[i-1] || i==1) 
		{
			arrx[++cntx]=i;
			if (ex[i]) fx[cntx]=1;
			else
			{
				for (int j=i;j<=h && !ex[j];j++)
				{
					fx[cntx]++;
				}
			}
		}
	}
	for (int i=1;i<=w;i++)
	{
		if (ey[i] || ey[i-1] || i==1) 
		{
			arry[++cnty]=i;
			if (ey[i]) fy[cnty]=1;
			else
			{
				for (int j=i;j<=w && !ey[j];j++)
				{
					fy[cnty]++;
				}
			}
		}
	}
	for (int i=1;i<=cntx;i++)
	{
		for (int j=1;j<=cnty;j++)
		{
			ff[i][j]=mp[make_pair(arrx[i],arry[j])];
		}
	}
	for (int i=1;i<=cntx;i++)
	{
		for (int j=1;j<=cnty;j++)
		{
			if (ff[i][j]) continue;
			bfs(i,j);
			for (int k=1;k<=cntx;k++)
			{
				for (int h=1;h<=cnty;h++)
				{
					if (!ff[k][h]) res=(1ll*dist[k][h]*fx[i]%mod*fy[j]%mod*fx[k]%mod*fy[h]+res)%mod;
				}
			}
		}
	}
	ans=(1ll*res*iv+ans)%mod;
	printf("%d\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 12120
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

count=0
for i in range(n):
      count+=min(A[i],B[i])
      if A[i]<B[i]:
            pre=A[i+1]
            A[i+1]=max(0,A[i+1]-(B[i]-A[i]))
            count+=pre-A[i+1]
print(count)

Measured memory_bytes: 18624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push back
int main()
{
    int n;
    cin>>n;
    string x;
    cin>>x;
    for(int i=0;i<x.size();i++)
    {
        int p=x[i]+n;
        if(p>90)
        {
            int temp=90-x[i];
            //cout<<temp<<endl;
            x[i]='A'+(n-temp-1);
        }
        else x[i]+=n;
    }
    cout<<x<<endl;

}


Measured memory_bytes: 256
while 1:
    n=int(input())
    if n==0:break
    a=[list(map(int,input().split())) for _ in range(n)]
    p,q,r,c=map(int,input().split())
    b=[x[0] for x in a if x[1]<=p and x[2]<=q and x[3]<=r and 4*(x[1]+x[3])+9*x[2]<=c]
    if len(b):print(*b,sep='\n')
    else:print('NA')

Measured memory_bytes: 8068
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N;
    int64_t A, B;
    cin >> N >> A >> B;
    vector<int64_t> X(N);
    for(int i=0; i<N; i++) {
        cin >> X[i];
    }

    int64_t ans = 0;
    adjacent_difference(X.begin(), X.end(), X.begin());
    for(int i=1; i<N; i++) {
        ans += min(X[i]*A, B);
    }

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


Measured memory_bytes: 1024
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int Q; cin >> Q;
    vl A(Q), B(Q);
    REP(i, Q) cin >> A[i] >> B[i];

    REP(i,Q) {
        if(A[i] == B[i]) {
            cout << (2 * A[i] - 2) << endl;
            continue;
        }

        ll l = 1, r = A[i] + B[i];
        while(r - l > 1) {
            ll m = (l + r) / 2;
            ll pd = (m + 1) / 2 * (m + 1 - (m + 1) / 2);

            if (pd >= A[i]*B[i]) r = m;
            else l = m;
        }

        ll ans = l - 1;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;

void solve(int a, int b, int c) {
	bool f = false;
	int max_num = max(a, max(b, c));
	int sub1, sub2;
	if (max_num != a) {
		sub1 = a;
		if (max_num != b) sub2 = b;
		else sub2 = c;
	} else if (max_num != b) {
		sub1 = b;
		sub2 = c;
	} 		
	if (pow(max_num, 2) == pow(sub1, 2) + pow(sub2, 2)) f = true;
	if (f) cout << "YES" << endl;
	else cout << "NO" << endl;
}

int main() {
	int num, a, b, c;
	cin >> num;
	for (int i=0; i<num; i++) {
		cin >> a >> b >> c;
		solve(a,b,c);
	}
	return 0;
}


Measured memory_bytes: 2988
A,B,C=map(int,input().split())
C_7=7*A+B
week_day,week_rem,day_0,day_rem=C//C_7*7,C%C_7,C//A,C%A

if C<=A:
    print(1)
elif C<C_7:
    if A*7<week_rem<=C:
        print(7)
    elif 0<day_rem<=A:
        print(day_0+1) 
    elif day_rem==0:
        print(day_0)
    else:
        print(day_0+day_rem)
elif B==0:
    if day_rem==0:
        print(day_0)
    else:
        print(day_0+1)
elif week_rem==0:
    print(week_day)
elif C>C_7:
    if 0<week_rem<=A:
        print(week_day+1)
    elif A*7<week_rem<=C_7:
        print(week_day+7)
    else:
        print(week_day+week_rem)  


Measured memory_bytes: 5600
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int main() {
	int X, A, B;
		cin >> X >> A >> B;
		int Y = X * A;
		if (Y < B) {
			cout << Y << endl;
		}
		else {
			cout << B << endl;
		}
}


Measured memory_bytes: 256