akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int maxm = maxn*10;
const int inf = 0x3f3f3f3f;
typedef long long ll;

int n,a[maxn];
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i = 1;i<=n;i++) {
        cin>>a[i]; a[i] -= i;
    }
    sort(a+1,a+1+n);    
    ll ans = 0,mid;
    if(n%2==0) mid = (a[n/2] + a[n/2+1]) /2;
    else mid = a[n/2+1];
    for(int i = 1;i<=n;i++) {
        ans += abs(a[i] - mid);
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

namespace id_0535cs
{
    public class BreakingIce
    {
        int[,] _board;

        public BreakingIce(int[,] givenBoard)
        {
            _board = givenBoard;
        }

        public int StartSolve()
        {
            var results = new List<int>();
            for(var i = 0; i < _board.GetLength(0);i++)
            {
                for(var j = 0; j < _board.GetLength(1);j++)
                {
                    if (_board[i, j] == 1)
                    {
                        results.Add(Solve(i, j, 1, _board));
                    }
                }
            }
            return results.Max();
        }

        public int Solve(int i ,int j,int moves,int[,] tmpBoard)
        {
            if (tmpBoard[i + 1, j] == 0 &&
                tmpBoard[i - 1, j] == 0 &&
                tmpBoard[i, j + 1] == 0 &&
                tmpBoard[i, j - 1] == 0)
            {
                return moves;
            }
            var nextBoard = tmpBoard.Clone() as int[,];
            nextBoard[i, j] = 0;
            var result = new List<int>();
            if (nextBoard[i + 1, j] == 1)
            {
                result.Add(Solve(i + 1, j, moves + 1, nextBoard));
            }
            if (nextBoard[i - 1, j] == 1)
            {
                result.Add(Solve(i - 1, j, moves + 1, nextBoard));
            }
            if (nextBoard[i, j + 1] == 1)
            {
                result.Add(Solve(i, j + 1, moves + 1, nextBoard));
            }
            if (nextBoard[i, j - 1] == 1)
            {
                result.Add(Solve(i, j - 1, moves + 1, nextBoard));
            }
            return result.Max();
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var m = int.Parse(Console.ReadLine());
                var n = int.Parse(Console.ReadLine());
                if (m == 0 && n == 0)
                {
                    return;
                }
                int[,] board = new int[n+2,m+2];
                for (int i = 1; i < n + 1; i++)
                {
                    var tmp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                    for (int j = 1; j < m + 1; j++)
                    {
                        board[i, j] = tmp[j - 1];
                    }
                }
                var x = new BreakingIce(board);
                Console.WriteLine(x.StartSolve());

            }
        }
    }
    
}



Measured memory_bytes: 11316
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    ll n;
    cin >> n;
    vector<string> s(n);
    map<string, ll> t;
    rep(i, n){
        string ss;
        cin >> ss;
        sort(ss.begin(), ss.end());
        t[ss]++;
    }
    ll ans = 0;
    for(auto i : t){
        if(i.second == 1) continue;
        ans += i.second*(i.second - 1)/2;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 11904
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
//AtCoderC++.cpp

using namespace std;

inline int ceiling(int n, int d) {
	return n % d == 0 ? n / d : n / d + 1;
}

int main() {
	long long a, b, x; cin >> a >> b >> x;
	long long answer = 0;
	if (a != 0)answer += (b / x + 1) - ((a - 1) / x + 1);
	else answer += (b / x + 1);
	cout << answer << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    H = string_to_int(inputs[0])
    min_h = -1

    if len(H) == 1:
        return "Yes"

    not_operation_start = 0
    for i in range(len(H)-1):
        flg = True
        if H[i] - H[i+1] >= 2:
            return "No"
        elif H[i] - H[i+1] == 1:
            if i - 1 >= 0:
                if H[i] - H[i-1] >= 1:
                    flg = True
                else:
                    flg = False
            else:
                flg = True
            if flg is False and not_operation_start != -1:
                if not_operation_start - 1 >= 0:
                    # if H[not_operation_start] - H[not_operation_start-1] >= 1
                    flg = False
                    for j in range(not_operation_start, i+1):
                        if H[j] - H[j - 1] >= 1:
                            flg = True
                            break
                else:
                    flg = True
            if flg:
                H[i] -= 1
            else:
                return "No"
            not_operation_start = -1
        else:
            if not_operation_start == -1:
                not_operation_start = i
    return "Yes"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


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

void setmax(uint8_t& a, int v) {
	if (v > a) a = uint8_t(v);
}

const int MAXX = 190;
const int MAXY = 190;
const int MAXV = 18;
int X, Y;
char A[MAXX][MAXY];
int pref[MAXX][MAXY];
uint8_t dpx[MAXX][MAXY][MAXY][MAXV];
uint8_t dpy[MAXX][MAXY][MAXX][MAXV];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> X >> Y;
	for (int x = 0; x < X; x++) {
		cin >> A[x];
		//for (int y = 0; y < Y; y++) { A[x][y] = ".#"[(x+y)&1]; }
	}
	for (int x = 1; x <= X; x++) {
		for (int y = 1; y <= Y; y++) {
			pref[x][y] = pref[x-1][y] + pref[x][y-1] - pref[x-1][y-1] + (A[x-1][y-1] == '#');
		}
	}
	auto rectSum = [&](int xlo, int xhi, int ylo, int yhi) -> int {
		return pref[xhi][yhi] - pref[xlo][yhi] - pref[xhi][ylo] + pref[xlo][ylo];
	};

	auto isUniform = [&](int xlo, int xhi, int ylo, int yhi) -> int {
		int s = rectSum(xlo, xhi, ylo, yhi);
		return s == 0 || s == (xhi - xlo) * (yhi - ylo);
	};

	for (int xlo = X-1; xlo >= 0; xlo--) {
		for (int ylen = 1; ylen <= Y; ylen++) {
			for (int ylo = 0, yhi = ylen; yhi <= Y; ylo++, yhi++) {
				if (isUniform(xlo, xlo+1, ylo, yhi)) {
					if (xlo + 1 < X && isUniform(xlo, xlo+2, ylo, yhi)) {
						dpx[xlo][ylo][yhi][0] = dpx[xlo+1][ylo][yhi][0];
					} else {
						dpx[xlo][ylo][yhi][0] = uint8_t(xlo + 1);
					}
				} else {
					dpx[xlo][ylo][yhi][0] = uint8_t(xlo);
				}
			}
		}
	}
	for (int ylo = Y-1; ylo >= 0; ylo--) {
		for (int xlen = 1; xlen <= X; xlen++) {
			for (int xlo = 0, xhi = xlen; xhi <= X; xlo++, xhi++) {
				if (isUniform(xlo, xhi, ylo, ylo+1)) {
					if (ylo+1 < Y && isUniform(xlo, xhi, ylo, ylo+2)) {
						dpy[xlo][ylo][xhi][0] = dpy[xlo][ylo+1][xhi][0];
					} else {
						dpy[xlo][ylo][xhi][0] = uint8_t(ylo + 1);
					}
				} else {
					dpy[xlo][ylo][xhi][0] = uint8_t(ylo);
				}
			}
		}
	}
	if (isUniform(0, X, 0, Y)) {
		cout << 0 << '\n';
		exit(0);
	}
	for (int v = 1; v < MAXV; v++) {
		for (int xlo = 0; xlo < X; xlo++) {
			for (int ylo = 0; ylo < Y; ylo++) {
				for (int yhi = ylo+1; yhi <= Y; yhi++) {
					if (dpx[xlo][ylo][yhi][v-1] == X) {
						dpx[xlo][ylo][yhi][v] = uint8_t(X);
						continue;
					}
					dpx[xlo][ylo][yhi][v] = dpx[dpx[xlo][ylo][yhi][v-1]][ylo][yhi][v-1];
				}
				for (int xhi = xlo + 1; xhi <= X; xhi++) {
					if (dpy[xlo][ylo][xhi][v-1] == Y) {
						dpy[xlo][ylo][xhi][v] = uint8_t(Y);
						continue;
					}
					dpy[xlo][ylo][xhi][v] = dpy[xlo][dpy[xlo][ylo][xhi][v-1]][xhi][v-1];
				}

				for (int xhi = xlo + 1; xhi <= X; xhi++) {
					int yhi = dpy[xlo][ylo][xhi][v];
					setmax(dpx[xlo][ylo][yhi][v], xhi);
				}
				for (int yhi = ylo + 1; yhi <= Y; yhi++) {
					int xhi = dpx[xlo][ylo][yhi][v];
					setmax(dpy[xlo][ylo][xhi][v], yhi);
				}
				for (int xhi = X-1; xhi > xlo; xhi--) {
					setmax(dpy[xlo][ylo][xhi][v], dpy[xlo][ylo][xhi+1][v]);
				}
				for (int yhi = Y-1; yhi > ylo; yhi--) {
					setmax(dpx[xlo][ylo][yhi][v], dpx[xlo][ylo][yhi+1][v]);
				}
			}
		}
		if (dpx[0][0][Y][v] == X) {
			cout << v << '\n';
			exit(0);
		}
	}
	assert(false);

	return 0;
}


Measured memory_bytes: 240000
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=998244353;

struct Problem{
    int n;
    vector<LL> x,y,c;
    vector<vector<LL>> dp;
    Problem(LL n):n(n),x(n),y(n),c(n+1),dp (n+1,vector<LL>(n+1)){};

    void solve(){
        dp[0][0]=1;
        for(LL i=0; i<=n; ++i){
            dp[0][i]=1;
            dp[i][0]=1;
        }
        for(LL i=1; i<=n; ++i){
            for(LL j=1; j<=n; ++j){
                dp[i][j]=(dp[i][j-1]+dp[i-1][j])%MOD;
            }
        }
        //nCk = dp[n-k][k]
        for(LL i=0; i<n; ++i){
            cin >> x[i] >> y[i];
        }
        vector<LL> sum(n+1);
        for(int i=3; i<=n; ++i){
            for(int j=3; j<=i; ++j){
                sum[i]=(sum[i]+dp[i-j][j])%MOD;
            }
        }
        LL ans =sum[n];
        for(int i=n; i>0; --i){
            sum[i]=sum[i]-sum[i-1];
        }
        DBG(ans)
        for(int i=0; i<n; ++i){
            vector<LL> used(n);
            for(int j=i+1; j<n; ++j){
                if(used[j])continue;
                LL tmp =0;
                for(int k=j+1; k<n; ++k){
                    bool f =false;
                    if(x[i]==x[j] and x[i] == x[k])f=true;
                    else if(y[i]==y[j] and y[i] == y[k])f=true;
                    else if((x[k]-x[i])*(y[k]-y[j])==(x[k]-x[j])*(y[k]-y[i])) f=true;
                    DBG(i,j,k,f)
                    if(f){
                        used[k]=1;
                        tmp++;
                    }
                }
                DBG(tmp)
                ans = (ans-sum[tmp+2]+MOD)%MOD;
                DBG(ans)
            }
        }
        cout << (ans+MOD)%MOD <<endl;
    }

};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}



Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

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

    int counter = 0;

    while (input.ready())
    {
      final String[] INPUT_STR = input.readLine().split(" ");
      final int FROM_YEAR = Integer.valueOf(INPUT_STR[0]);
      final int TO_YEAR = Integer.valueOf(INPUT_STR[1]);

      if (TO_YEAR == 0)
      {
        break;
      }

      if (counter > 0)
      {
        System.out.println();
      }
      counter++;

      ArrayList<Integer> ansList = leapYearCount(FROM_YEAR, TO_YEAR);

      if (ansList.size() == 0)
      {
        System.out.println("NA");
        continue;
      }

      for (Integer each : ansList)
      {
        System.out.println(each);
      }
    }

  }

  private static ArrayList<Integer> leapYearCount(int fromYear, int toYear)
  {
    ArrayList<Integer> yearList = new ArrayList<>();
    for (int i = fromYear; i <= toYear; i++)
    {
      if (isLeapYear(i))
      {
        yearList.add(i);
      }
    }
    return yearList;
  }

  private static boolean isLeapYear(int year)
  {
    if (year % 4 != 0)
    {
      return false;
    }

    if (year % 100 == 0)
    {
      if (year % 400 == 0)
      {
        return true;
      }
      return false;
    }
    return true;
  }
}

Measured memory_bytes: 25872
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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()
{
  int n ;
  cin >> n ;
  vector<ll> vec(n) ;
  REP(i,n){
    cin >> vec.at(i) ;
  }
  if(vec.at(0)!=0){
    cout << 0 <<endl;
    return 0 ;
  }
  vector<ll> col(3,0) ;
  col.at(0) = 1;
  ll ans = 1 ;
  
  FOR(i,1,n){
    ll a = vec.at(i) ;
    ll b = 0 ;
    REP(j,3){
      if(col.at(j)==a){
        b++ ;
      }
    }
    REP(j,3){
      if(col.at(j)==a){
        col.at(j)++ ;
        break ;
      }
    }
    ans = ans*b%MOD ;
  }
  
  cout <<ans*3%MOD <<endl ;
      
  
  return 0 ;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
L = sorted([list(map(int, input().split())) for _ in range(n)])
ans = 0
cnt = 0
for a, b in L:
    if cnt + b < m:
        ans += a*b
        cnt += b
    else:
        ans += (m - cnt) * a
        print(ans)
        break

Measured memory_bytes: 28656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int x[5];
    int ans = 0;
    for(int i = 0; i < 5; i++) {
       cin >> x[i];
       if (x[i] == 0) ans = i+1;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main()
{
        //input->compute->output//
        string A;
        cin >> A;
        if ((A[0] == A[1] && A[1] == A[2]) || (A[1] == A[2] && A[2] == A[3]))
        {
                cout << "Yes" << endl;
        } else{
                cout << "No" << endl;
        }


        return 0;
}


Measured memory_bytes: 256
from math import log2


def build():
    dfs()
    pk0 = parent[0]
    for k in range(1, logn):
        pk1 = parent[k]
        for v in range(n):
            pkv = pk0[v]
            pk1[v] = -1 if pkv < 0 else pk0[pkv]
        pk0 = pk1


def dfs():
    stack = [(0, -1, 0)]
    while stack:
        v, p, d = stack.pop()
        parent[0][v] = p
        depth[v] = d
        stack.extend((child, v, d + 1) for child in tree[v])


def get(u, v):
    du, dv = depth[u], depth[v]
    if du > dv:
        u, v = v, u
        du, dv = dv, du
    for k in range(logn):
        if (dv - du) >> k & 1:
            v = parent[k][v]
    if u == v:
        return u
    for k in range(logn - 1, -1, -1):
        pk = parent[k]
        if pk[u] != pk[v]:
            u, v = pk[u], pk[v]
    return parent[0][u]


n = int(input())
tree = [set(map(int, input().split()[1:])) for _ in range(n)]

logn = int(log2(n)) + 1
parent = [[0] * n for _ in range(logn)]
depth = [0] * n
build()

q = int(input())
for _ in range(q):
    print(get(*map(int, input().split())))

Measured memory_bytes: 60180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  string s;
  cin >> s;
  ll k;
  cin >> k;
  set<string> count;
  for(ll i=1;i<=k;i++) {
    for(ll j=0;j<s.size()-i+1;j++) {
      count.insert(s.substr(j,i));
    }
  }
  ll temp=0;
  for(auto p: count) {
    temp++;
    if(temp==k) cout << p << endl;
  }
}

Measured memory_bytes: 1664
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int testsalam;cin >> testsalam;while(testsalam--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
#define endl '\n'
//void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}
string inttostr(ll n){std::stringstream ss;ss << n;string out=ss.str();return out;}
ll stringtoint(string s){istringstream iss (s);ll n;iss >> n;return n;}
typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    int n;
    cin >> n;
    string s=inttostr((ll)n);
    int r=n%10;
    if(r==3)
    	cout<<"bon"<<endl;
    else if(r==1 or r==6 or r==8 or r==0)cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
}


Measured memory_bytes: 3644
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sumMonster = sum(A)

for i in range(N):
    if B[i] >= A[i]:
        A[i+1] -= B[i] - A[i]
        if A[i+1] < 0:
            A[i+1] = 0
        A[i] = 0
    else:
        A[i] -= B[i]

print(sumMonster-sum(A))

Measured memory_bytes: 19156
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const* argv[])
{
    int n;
    int profit = -1E9;
    int max = 0;
    int min;
    cin >> n;
    vector<int> ary(n);
    for(auto& i: ary) {
        cin >> i;
    }
    min = ary[0];
    for(int i = 1; i < n; i++) {
        if ((ary[i] - min) > profit) {
            profit = ary[i] - min;
        }
        if (min > ary[i]) {
            min = ary[i];
            continue;
        }
    }
    std::cout << profit << std::endl;
}

Measured memory_bytes: 3528
while True:
    a1, a2 = map(int, input().split())
    if a1 == 0:
        break
    ans = 'A'
    maxi = a1+a2
    for i in range(1,5):
        x1, x2 = map(int, input().split())
        if x1+x2 > maxi:
            maxi = x1+x2
            ans = chr(ord('A')+i)
    print(ans,maxi)



Measured memory_bytes: 5592
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int N;
    cin >> N;
    cout << ((N/100 == N%10) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
s = input()
f = int(s[:2])
b = int(s[2:])

if 1 <= f <= 12:
    if 1 <= b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= b <= 12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

struct UnionFind {
	std::vector<int> par;

	UnionFind(int N)
		: par(N)
	{
		for (int i = 0; i < N; i++) {
			par[i] = i;
		}
	}

	int root(int x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx != ry) {
			par[rx] = ry;
		}
	}

	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n, k, l;
	cin >> n >> k >> l;

	UnionFind uf(n), uf2(n);
	rep(i, k) {
		int p, q;
		cin >> p >> q;
		p--; q--;
		uf.unite(p, q);
	}
	rep(i, l) {
		int r, s;
		cin >> r >> s;
		r--; s--;
		uf2.unite(r, s);
	}

	map<pair<int, int>, int> ma;
	rep(i, n) {
		pair<int, int> p(uf.root(i), uf2.root(i));
		ma[p]++;
	}

	rep(i, n) {
		pair<int, int> p(uf.root(i), uf2.root(i));
		cout << ma[p] << " ";
	}

	return 0;
}

Measured memory_bytes: 13568
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int a[1000000];
//odd(a)为序列a中奇数个数
//要使得所有数全相等，那么相等关系至少为n-1对
//(n-odd(a))/2+(n-odd(b))/2>=n-1
//odd(a)+odd(b)<=2
//当a中奇数个数>2时无解
//否则我们把a的奇数放到两侧然后构造答案
int main()
{
	int m=gi(),n=gi(),i;
	for (i=1;i<=n;i++) a[i]=gi();
	for (i=2;i<n;i++) if (a[i]&1) { swap(a[i],a[1]); break; }
	for (i=2;i<n;i++) if (a[i]&1) { swap(a[i],a[n]); break; }
	for (i=2;i<n;i++) if (a[i]&1) return puts("Impossible"),0;
	if (n==1)
		if (m==1) puts("1\n1\n1");
		else printf("%d\n2\n1 %d\n",a[1],a[1]-1);
	else {
		for (i=1;i<=n;i++) printf("%d ",a[i]);putchar(10);
		printf("%d\n",n-(a[1]==1));
		if (a[1]!=1) printf("%d ",a[1]-1);
		for (i=2;i<n;i++) printf("%d ",a[i]);
		printf("%d",a[n]+1);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define loop(i, sta, end, inc) for(int i = sta; i <= end; i += inc)
#define itr(it, l)             for(auto it = l.begin(); it != l.end(); it ++)
#define in(a, b, c)            assert( b <= a && a <= c)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define what_is(x) cerr<<#x<<" ="<<x<<" ";
#define error(args...)  { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define LINT_MAX  9223372036854775807
#define LINT_MIN -9223372036854775808
#define EPS 1e-9
#define MOD 1000000007
#define DEBUG 0

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
void err(istream_iterator<string> it) { cerr<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    if(DEBUG == 0)return;
	cerr << *it << " = " << a <<" ";
	err(++it, args...);
}

long long A[100];
long long dp[100001][100];
int main(){
   // freopen("test.txt", "r", stdin);
    int n,k;cin>>n>>k;
    forn(i,n)cin>>A[i];
    dp[0][0]=1;
    forn1(i,k){dp[i][0]=(A[0]>=i?1:0);dp[i][0]+=dp[i-1][0];}
    //forn(i,k+1)cout<<dp[i][0]<<endl;
    forn(i,n)dp[0][i]=1;
    forn1(i,n-1){
    	forn1(j,k){
    		dp[j][i]=(j>A[i]?((dp[j][i-1]-dp[j-A[i]-1][i-1]+MOD)%MOD):((dp[j][i-1])%MOD));
    		dp[j][i]=(dp[j][i]%MOD+dp[j-1][i]%MOD)%MOD;
    	}
    }
	/*forn(j,k+1){
		forn(i,n)cout<<dp[j][i]<<" ";
		cout<<endl;
	}*/
	cout<<(dp[k][n-1]-dp[k-1][n-1]+MOD)%MOD<<endl;
    

    
    return 0;
}



Measured memory_bytes: 78336
#include <bits/stdc++.h>
    using namespace std;
    typedef unsigned long long ull;
    typedef long long ll;
    typedef long double ld;
    #define FOR(type,a,b,c,d) for(type i = a;i b c;i += d)
    #define QUICK ios_base::sync_with_stdio(0);cout << fixed;
    #define MOD 1000000007

    string upper(string);
    string lower(string);
    bool isalup(string);
    bool isalow(string);

    int main(){
    int a,c = 0;
    double b;
    cin >> a >> b;
    while(a--){

        double e,d;
        cin >> e >> d;
        if(sqrt(e*e+d*d)<=b)
            c++;

    }
cout << c;

        return 0;
    }









                string upper(string a){
                    for(char& c:a){
                        if(islower(c))
                            c -= 32;
                       }
                    return a;
                }
                    string lower(string a){
                        for(char& c : a){
                            if(isupper(c))
                                c += 32;
                        }
                        return a;
                    }
                    bool isalup(string a){
                        for(char& c: a){
                            if(islower(c))
                                return false;
                        }
                        return true;
                    }
                    bool isalow(string a){
                        for(char& c:a){
                            if(isupper(c))
                                return false;
                        }
                       return true;
                    }


Measured memory_bytes: 3784
l = []
for i in range(3):
  l.append(list(map(int,input().split())))
n = int(input())
b = []
for i in range(n):
  b = int(input())
  for i in range(3):
    for j in range(3):
      if l[i][j] == b:
        l[i][j] = 0

for i in range(3):
  if l[i][0] == 0 and l[i][1] == 0 and l[i][2] == 0:
    print('Yes')
    exit()
for j in range(3):
  if l[0][j] == 0 and l[1][j] == 0 and l[2][j] == 0:
    print('Yes')
    exit()
if l[0][0] == 0 and l[1][1] == 0 and l[2][2] == 0:
    print('Yes')
    exit()
if l[0][2] == 0 and l[1][1] == 0 and l[2][0] == 0:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 38256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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



string s, t;
int s_tran[30];
int t_tran[30];

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

  int n = s.size();

  Rep(i, 30) {
    s_tran[i] = -1; t_tran[i] = -1;
  }

  bool ans = true;

  Rep(i, n) {
    int s_tmp = s[i] - 'a';
    int t_tmp = t[i] - 'a';

    if ((s_tran[s_tmp] == -1) && (t_tran[t_tmp] == -1)) {
      s_tran[s_tmp] = t_tmp; t_tran[t_tmp] = s_tmp;
    }
    else if (s_tran[s_tmp] == -1) {
      ans = false;
      break;
    }
    else if (t_tran[t_tmp] == -1) {
      ans = false;
      break;
    }
    else {
      if ((s_tran[s_tmp] != t_tmp) || (t_tran[t_tmp] != s_tmp)) {
        ans = false;
        break;
      }
    }
  }

  cout << (ans ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 776
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimize("02")
using namespace std;
const int maxn=1e5+5;
long long n,m;
bool b; 
string s;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>s;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-1-i]){
			b=1;
		}
	}
	for(int i=0;i<(s.size())/4;i++){
		if(s[i]!=s[(s.size()/2)-i-1]){
			b=1;
		}
	}
	for(int i=(s.size()+3)/2-1;i<(((s.size()+3)/2-1)+(s.size()))/2;i++){
		if(s[i]!=s[s.size()-i+(s.size()+3)/2-2]){
			b=1;
		}
	}
	if(!b){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}


Measured memory_bytes: 256
N, M = map(int, input().split())
correct = [0 for _ in range(N)]
missed = [0 for _ in range(N)]
penalty = 0
ans = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)

    if s == "AC" and correct[p - 1] == 0:
        correct[p - 1] = 1
        penalty += missed[p - 1]
    elif s == "WA" and correct[p - 1] == 0:
        missed[p - 1] += 1

print(sum(correct), penalty)


Measured memory_bytes: 4760
import java.util.*;
import java.io.*;

public class Main {
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader() throws FileNotFoundException {
            // reader = new BufferedReader(new FileReader("count.in"));
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        String next() { // reads in the next String
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() { // reads in the next int
            return Integer.parseInt(next());
        }

        public long nextLong() { // reads in the next long
            return Long.parseLong(next());
        }

        public double nextDouble() { // reads in the next double
            return Double.parseDouble(next());
        }

        public int[] nextIntArr(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) arr[i] = nextInt();
            return arr;
        }

        public long[] nextLongArr(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) arr[i] = nextLong();
            return arr;
        }

        public double[] nextDoubleArr(int size) {
            double[] arr = new double[size];
            for (int i = 0; i < size; i++) arr[i] = nextDouble();
            return arr;
        }
    }

    public static void main(String[] args) throws IOException, FileNotFoundException {
        InputReader in = new InputReader();
        PrintWriter pw = new PrintWriter(System.out);

        int n = in.nextInt();
        int[][] pts = new int[n][3];

        for (int i = 0; i < n; i++)
            for (int j = 0; j < 3; j++)
                pts[i][j] = in.nextInt();

        int[][] dp = new int[n + 1][3];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                dp[i + 1][j] = Math.max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + pts[i][j];
            }
        }

        /*
        for (int i = 0; i <= n; i++) {
            pw.println(Arrays.toString(dp[i]));
        }
         */
        pw.println(max(dp[n][0], dp[n][1], dp[n][2]));

        pw.close();
    }

    public static int max(int a, int b, int c) {
        return Math.max(a, Math.max(b, c));
    }
}


Measured memory_bytes: 61072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
  int N, R;
  cin >> N >> R;
  if(N < 10) {
    R += (10 - N) * 100;
  }
  cout << R << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, i, num, min = 0, profit;

	scanf("%d", &n);
	for(i = 0; i < 2; i++) {
		scanf("%d", &num);	
		if(min == 0) {
			min = num;	
			continue;
		}
		profit = num - min;
		if(num < min)
			min = num;
	}
	for(; i < n; i++) {
		scanf("%d", &num);	
		if(profit < num - min)
			profit = num - min;
		if(num < min)
			min = num;
	}
	printf("%d\n", profit);
	return 0;
}

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

int euclidean(int a, int b) {
    if (a < b)
        return euclidean(b, a);
    int r;
    while ((r=a%b)){
        a = b;
        b = r;
    }
    return b;
}

int main(){
    int N, X;
    cin >> N >> X;
    vector<int> x(N);
    for(size_t i = 0; i < N; i++)
    {
        int this_x;
        cin >> this_x;
        x[i] = abs(this_x - X);
    }
    int ret = x[0];
    for(size_t i = 1; i < N; i++)
    {
        ret = euclidean(ret, x[i]);
    }
    cout << ret << endl;
    
    return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	set<int>a;
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		a.insert(x);
	}
	vector<long long>dp(n+1);
	if (a.count(0))dp.at(0) = 0;
	else dp.at(0) = 1;
	if (a.count(1))dp.at(1) = 0;
	else dp.at(1) = dp.at(0);
	for (int i = 2; i <= n; i++) {
		if (a.count(i))dp.at(i) = 0;
		else dp.at(i) = dp.at(i - 1) + dp.at(i - 2);
		dp.at(i) = dp.at(i) % 1000000007;
	}
	cout << dp.at(n)%1000000007 << endl;

}

Measured memory_bytes: 5760
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#include <array>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__)
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
template <typename T>
vector<T> divisor(T n) {
    vector<T> res;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i * i != n) {
                res.push_back(n / i);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}
template <typename T>
map<T, int> prime_factor(T n) {
    map<T, int> res;
    for (T i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1) {
        res[n]++;
    }
    return res;
}
template <typename T>
T gcd(T a, T b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
int main(){
    int n;
    cin >> n;
    if(n<=10){
        cout << n << endl;
        return 0;
    }
    set<ll> st;
    rep(i,9)st.insert(i+1);
    int cnt = (int)st.size();
    while(1){
        set<ll> st2;
        for(auto x : st){
            int t = x%10;
            st2.insert(x*10+t);
            if(t==0){
                st2.insert(x*10+1);
            }else if(t==9){
                st2.insert(x*10+8);
            }else{
                st2.insert(x*10+t-1);
                st2.insert(x*10+t+1);
            }
        }
        st = st2;
        cnt += st.size();
        if(cnt >= n)break;
    }
    while(cnt>n){
        st.erase(*st.rbegin());
        cnt--;
    }
    cout << *st.rbegin() << endl;
}


Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (long long i = l; i < r; i++)
using namespace std;
typedef pair<int, int> P;

struct edge {
	int to, cost;
};
class dijkstra {
	int V;
	int d[100002];
	priority_queue<P, vector<P>, greater<P>> que;
	void update(int s, vector<edge> G[]) {
		fill(d, d + V + 1, 100000000000ll);
		d[s] = 0;
		que.push(make_pair(0, s));
		while (!que.empty()) {
			P p = que.top();
			que.pop();
			int v = p.second;
			if (d[v] < p.first) continue;
			rep(i, G[v].size()) {
				edge e = G[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					que.push(make_pair(d[e.to], e.to));
				}
			}
		}
	}

  public:
	dijkstra(int v, int s, vector<edge> G[]) {
		V = v;
		update(s, G);
	}
	int find(int e) {
		return d[e];
	}
};
int gcd(int a, int b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
bool prime(int a) {
	if (a == 1) return false;
	for (int i = 2; i * i <= a; i++) {
		if (a % i == 0) return false;
	}
	return true;
}
class Union_Find {
  private:
	vector<int> t, s;

  public:
	Union_Find(int max_length) {
		rep(i, max_length + 1) {
			t.push_back(i);
			s.push_back(1);
		}
	}
	void Union(int x, int y) {
		if (same(x, y)) return;
		int tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}
	int Find(int n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}
	bool same(int x, int y) {
		return Find(x) == Find(y);
	}
	int get_Size(int a) {
		return s[a];
	}
};
signed main() {
	int r,d,x;
	cin>>r>>d>>x;
	rep(i,10){
		x=r*x-d;
		cout<<x<<endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  const double PI=3.14159265358979323846;
  //整数の時はint
  int a,b,m;
  double c;
  //文字の時はstring
  string s;
 
  cin>>s;

  if(s=="ABC")
  cout<<"ARC"<<endl;
  else
    cout<<"ABC"<<endl; 

 
  return 0;
}



Measured memory_bytes: 3624
S = str(input())
N = len(S)

A = '01' * (N//2) + '01'[(N-1)%2]
B = '10' * (N//2) + '10'[(N-1)%2]
ans_A = 0
for i in range(N):
    if S[i] != A[i]:
        ans_A += 1

ans_B = 0
for i in range(N):
    if S[i] != B[i]:
        ans_B += 1

print(min(ans_A, ans_B))

Measured memory_bytes: 3316
#include <iostream>                                                                                                                      
#include <string>                                                                                                                        
using namespace std;                                                                                                                     
int main() {                                                                                                                             
                                                                                                                                         
  long long  D, T, S;                                                                                                                    
  cin >> D >> T >> S;                                                                                                                    
                                                                                                                                         
  long long L = S*T;                                                                                                                     
                                                                                                                                         
  if (D <= L) cout << "Yes" << endl;                                                                                                     
  else cout << "No" << endl;                                                                                                             
                                                                                                                                         
  return 0;                                                                                                                              
                                                                                                                                         
}                                                                                                                                        
     

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		//int x = sc.nextInt();
		//String s = sc.next();

		//String[] ss = s.split("");

		//int[] a = new int[n];
		String ans="No";
		if( n>81) {
		}else {
			for(int i=1;i<10;i++) {
				if(n%i==0) {
					if(n/i<10) {
						ans="Yes";
					}
				}
			}
		}

		System.out.println(ans);

		/*
		TreeMap<Integer,Integer> treeMap = new TreeMap<>();//sorted no duplication
		treeMap.put(b[n], n);
		*/

	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


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

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

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
  ll A,B;
  cin >> A >> B;
  ll g = GCD(A,B);
  auto pf = prime_factorize(g);
  ll ans = 1;
  for(auto p: pf) ans++;
  cout << ans << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int n;
vector<string> s;

int dp[MX][5][5][5];

int solve(int idx, int a, int b, int c){
	if(a < 0 || b < 0 || c < 0 || a > 4 || b > 4 || c > 4) return 0;
	if(idx == n){
		return a >= 0 && b >= 0 && c >= 0;
	}

	auto &ret = dp[idx][a][b][c];
	if(ret != -1) return ret;

	ret = 0;

	if(s[idx] == "AB"){
		ret |= solve(idx + 1, a - 1, b + 1, c);
		ret |= solve(idx + 1, a + 1, b - 1, c);
	}
	else if(s[idx] == "AC"){
		ret |= solve(idx + 1, a - 1, b, c + 1);
		ret |= solve(idx + 1, a + 1, b, c - 1);
	}
	else{
		ret |= solve(idx + 1, a, b - 1, c + 1);
		ret |= solve(idx + 1, a, b + 1, c - 1);
	}

	return ret;
}


void build(int idx, int a, int b, int c){

	if(idx == n) return;
	
	if(s[idx] == "AB"){
		if(solve(idx + 1, a - 1, b + 1, c)){
			cout << "B\n", build(idx + 1, a - 1, b + 1, c);
		}
		else{
			cout << "A\n", build(idx + 1, a + 1, b - 1, c);
		}
	}
	else if(s[idx] == "AC"){
		if(solve(idx + 1, a - 1, b, c + 1)){
			cout << "C\n", build(idx + 1, a - 1, b, c + 1);
		}
		else{
			cout << "A\n", build(idx + 1, a + 1, b, c - 1);
		}
	}
	else{
		if(solve(idx + 1, a, b + 1, c - 1)){
			cout << "B\n", build(idx + 1, a, b + 1, c - 1);
		}
		else{
			cout << "C\n", build(idx + 1, a, b - 1, c + 1);
		}
	}
}

int main(){

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

	int a, b, c;
	cin >> n >> a >> b >> c;

	s.resize(n);
	for(auto &x : s) cin >> x;

	memset(dp, 0xff, sizeof dp);

	a = min(a, 3);
	b = min(b, 3);
	c = min(c, 3);

	if(solve(0, a, b, c) == 1){
		cout << "Yes\n";
		build(0, a, b, c);
	}
	else{
		cout << "No\n";
	}

	return 0;
}

Measured memory_bytes: 63116
//B - Two Anagrams: 
//Assunto: 
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100005
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    string s, t;
    bool g, ans = false;;
    cin >> s >> t;
    sort(all(s));
    sort(rall(t));
    if(s.size() == t.size()) {
        if(s < t) ans = true;
    } else {
        if(s.size() < t.size()) {
            if(s <= t.substr(0, s.size())) ans = true;
        } else {
            if(s < t) ans = true;
        }
    }
    if(ans) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256