akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define loop(n) for(int i=0; i<n; i++)
void solve()
{
	int k,a,b;cin>>k>>a>>b;
	int x=(b/k)*k;
	if(x>=a)cout<<"OK\n";
	else cout<<"NG\n";
	return;
}
int32_t main() 
{ 
	fast;
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0; 
}

Measured memory_bytes: 3572
M=10**9+7
class Combinatorics
  def initialize(n, mod)
    @mod = mod
    @fact, @inv, @finv = Array.new(3){[1, 1]}
    2.upto(n) do |i|
      @fact[i] = (@fact[i-1] * i) % @mod
      @inv[i]  = (@inv[@mod % i] * (@mod - @mod / i) ) % @mod
      @finv[i] = (@finv[i-1] * @inv[i] ) % @mod
    end
  end
  def combination(n, r)
    return 0 if (n < r) || (n < 0) || (r < 0)
    (@fact[n] * @finv[n-r] % @mod) * @finv[r] % @mod
  end
  def permutation(n, r)
    @fact[n] * @finv[n-r] % @mod
  end
end

N,K=gets.split.map(&:to_i)
C=Combinatorics.new(N+1,M)
ans=0
0.upto(N) do |n|
  break if K<n
  ans += C.combination(N,n) * C.combination(N-1,N-n-1)
  ans %= M
end
p ans

Measured memory_bytes: 19100
n = list(map(int, input().split()))
n = n[0]

primes = []

for i in range(n+1):
    if(i<2):
        continue
    flag = 1
    for j in range(len(primes)):
        flag *= i%primes[j]
    if(flag != 0):
        primes.append(i)

nump = len(primes)
times = [0 for i in range(nump)]

for i in range(nump):
    for j in range(10):
        times[i] += n//primes[i]**(j+1)


ans = 1
for i in range(nump):
    ans = (ans*(times[i]+1))%1000000007

print(ans)

        

Measured memory_bytes: 3064
S = input()
front = int(S[:2])
back  = int(S[2:])

YYMM = 1 <= back  <= 12
MMYY = 1 <= front <= 12

if YYMM and MMYY:
  print("AMBIGUOUS")
  exit()

if not YYMM and not MMYY:
  print("NA")
  exit()

if YYMM:
  print("YYMM")

if MMYY:
  print("MMYY")

Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
string A;
long long K;
int main(void){
	cin >> A >> K;
	for(int i = 0; i < A.size(); i++){
		if('1' < A[i]){
			if(K < i+1) cout << 1 << '\n';
			else cout << A[i] << '\n';
			return 0;
		}
	}
	cout << 1 << '\n';
	return 0;
}

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


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

string name = "";
int po = 0;
pair<pair<string,int>,int> p[110];

for (int i = 0; i < N; i++)
{
    /* code */
    cin >> name;
    cin >> po;
    p[i] = make_pair(make_pair(name,-po),i);
}
std::sort(p,p+N);

for (int i = 0; i < N; i++)
{
    /* code */
    cout << p[i].second  + 1<< endl;

}

}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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 a,b;
  cin>>a>>b;
  if(a>9||b>9){
    cout << -1 << endl;
  }else {
    cout << a*b << endl;
  }
}


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

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

  int n;
  cin >> n;
  uint64_t sum = 0;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    sum += tmp - 1;
  }
  cout << sum << "\n";
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  ll avg = accumulate(a.begin(), a.end(), 0) / n;

  ll ans = 1e10;
  for (auto e : {avg, avg + 1}) {
    ll num = 0;
    for (int i = 0; i < n; i++) num += pow(e - a[i], 2);
    ans = min(num, ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3460
X,N = (int(x) for x in input().split())
if N==0:
    print(X)
else:
    P = [int(x) for x in input().split()]
    Target = X
    if Target not in P:
        print(Target)
    else:
        Count = 0 
        Flag  = True
        while Flag:
            Count += 1
            Target = [X-Count,X+Count]
            if Target[1] not in P:
                Flag = False
                Disp = Target[1]
            if Target[0] not in P:
                Flag = False
                Disp = Target[0]
        print(Disp)

Measured memory_bytes: 61968
from collections import deque, defaultdict
from time import time
S = time()

N = int(input())
A = [deque(map(lambda a: int(a) - 1, input().split())) for _ in range(N)]

canBattle = defaultdict(lambda: False)
D = [0] * N

while True:
    isChanged = False
    for i, a in enumerate(A):
        if not a:
            continue
        j = a[0]
        canBattle[(i, j)] = True

        if canBattle[(j, i)]:
            isChanged = True
            A[i].popleft()
            A[j].popleft()
            d = max(D[i], D[j])
            D[i], D[j] = d + 1, d + 1
    if all(len(a) == 0 for a in A):
        print(max(D))
        exit()
    if time() - S >= 1.700:
        print(N * (N - 1) // 2)
        exit()
    if not isChanged:
        break

print(-1)


Measured memory_bytes: 154188
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int,Int> pii;
typedef pair<Int,double> pid;
typedef pair<double,double> pdd;
typedef pair<Int,pii> pip;
typedef pair<double,Int> pdp;
#define A first
#define B second
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define Itype(a) typeof(a.begin()) 
#define REP(i,a,b) for(int i = (a);i <= (b);i++)
#define FORO(i,n) REP(i,0,(int)n-1)
#define FORI(i,n) REP(i,1,(int)n)
#define FORIT(i,t) for(Itype(t) i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a,_b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
template<typename T>void getMin(T &a,T b) { if(a > b) a = b; }
template<typename T>void getMax(T &a,T b) { if(a < b) a = b; }
template<typename T> vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T> vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T> vector<T> getEmptyVector() { return vector<T>(); }
// #define X first
// #define Y second
const ll MOD = 1000000007;

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

    int N;
    cin >> N;
    auto f = getVector<int>(N + 1);
    int sqrtN = sqrt(N) + 1;
    FORI(x, sqrtN) {
        FORI(y, sqrtN) {
            FORI(z, sqrtN) {
                int p = x * x + y * y + z * z + x * y + y * z + z * x;
                if(p <= N) {
                    f[p]++;
                }
            }
        }
    }
    FORI(n, N) cout << f[n] << endl;

    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <stack>
#include <climits>
#include <unordered_map>
#include <algorithm>
using namespace std;

void topsortutil(int node, vector<vector<int>> &graph, vector<bool> &visited, stack<int> &s){
	visited[node] = 1;
	for(int i = 0; i < graph[node].size(); i++){
		if(!visited[graph[node][i]]){
			topsortutil(graph[node][i], graph, visited, s);
		}
	}
	s.push(node);
}

vector<int> topsort(vector<vector<int>> &graph){
	vector<int> answer; stack<int> s; vector<bool> visited(graph.size(), 0);
	for(int i = 0;i < graph.size(); i++){
		if(!visited[i]){
			topsortutil(i, graph, visited, s);
		}
	}
	while(!s.empty()){
		answer.push_back(s.top());
		s.pop();
	}
	return answer;
}

int maxlen(vector<vector<int>> &graph, vector<int> &sortednodes){
	unordered_map<int, int> m;
	for(int i = 0; i < sortednodes.size(); i++){
		m[sortednodes[i]] = i;
	}
	int *dp = new int[graph.size()];
	for(int i = 0; i < graph.size(); i++){
		if(graph[sortednodes[i]].size()==0){
			dp[i] = 0;
		}
		else{
			int answer = INT_MIN;
			for(int j = 0; j < graph[sortednodes[i]].size(); j++){
				answer = max(answer, 1 + dp[m[graph[sortednodes[i]][j]]]);
			}
			dp[i] = answer;
		}
	}
	int answer = INT_MIN;
	for(int i = 0; i < graph.size(); i++){
		answer = max(dp[i], answer);
	}	
	return answer;	
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("/home/afzalrao/Desktop/Academics/2nd Year/3rd Sem/ESO207/CP/Text Files/input.txt", "r", stdin);
	freopen("/home/afzalrao/Desktop/Academics/2nd Year/3rd Sem/ESO207/CP/Text Files/output.txt", "w", stdout);
	#endif
	int n, m, *x, *y;
	cin >> n >> m;
	x = new int[m]; y = new int[m];
	for(int i = 0; i < m; i++){
		cin >> x[i] >> y[i];
	}
	vector<vector<int>> graph(n);
	for(int i = 0; i < m; i++){
		graph[x[i]-1].push_back(y[i]-1);
	}
	vector<int> sortednodes = topsort(graph);
	reverse(sortednodes.begin(), sortednodes.end());
	cout << maxlen(graph, sortednodes);
	return 0;	
}

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

int func(int a){
  if(a ==2) return 0;
  else if(a==4 || a== 6 || a == 9 || a==11) return 1;
  else return 2;
}

int main(){
  int x,y;
  cin >> x >> y;
  
  if(func(x) == func(y)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	sort(all(a)) ;
	if(n&1){
		ll r1,r2 ;
		r1 = r2 = 0 ;
		for(int i=0;i<n;i++){
			if(i<=n/2) r1 -= 2*a.at(i) ;
			else r1 += 2*a.at(i) ;
			if(i<n/2) r2 -= 2*a.at(i) ;
			else r2 += 2*a.at(i) ;
		}
		r1 += a.at(n/2)+a.at(n/2-1) ;
		r2 -= a.at(n/2)+a.at(n/2+1) ;
		cout << max(r1,r2) << endl ;
	}else{
		ll ans = 0 ;
		for(int i=0;i<n;i++){
			if(i<n/2) ans -= 2*a.at(i) ;
			else ans += 2*a.at(i) ;
		}
		ans += a.at(n/2-1) ;
		ans -= a.at(n/2) ;
		cout << ans << endl ;
	}
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <deque>
#include <functional>
#include <sstream>
using namespace std;

// 정답이 ll 이상일 경우 INF를 98765432100000 정도까지 크게 해야함
// 입력받는 값이 10^9 이고 답이 뭔가 그것들을 더하는 연산이라면 답은 ll 일수 있다
// priority_queue 는 기본적으로 내림차순 정렬이다. 오름차순으로 하고 싶다면 priority_queue<int, vector<int>, greater<int>>
// queue에서 pop하기 전에는 반드시 empty인 경우를 체크하고 예외처리 해줘라


#define INF 9876543210
#define mod 1000000007
#define mt make_tuple
#define mp make_pair
typedef long long ll;

char str[13];

int main() {

	scanf("%s", str);
	for (int i = 0; i < 12; i++) {
		if (i == 4) printf(" ");
		printf("%c", str[i]);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

const int N = 210;
bool adj[N][N];
int dis[N];
bool done[N];

int solve(int root, int n) {
	fill(dis, dis + n, N);
	fill(done, done + n, false);
	queue<int> Q;
	Q.push(root); dis[root] = 1; 

	int ans = 1;
	while (!Q.empty()) {
		int u = Q.front(); Q.pop();
		if (done[u]) continue;
		done[u] = true;
		for (int v = 0; v < n; v++) {
			if (adj[u][v]) {
				if (dis[v] == N) {
					dis[v] = dis[u] + 1;
					Q.push(v);
					ans = max(ans, dis[v]);
				}
				if (abs(dis[u] - dis[v]) != 1) return -1;
			}
		}
	}
	// for (int u = 0; u < n; u++) {
	// 	for (int v = 0; v < n; v++) {
	// 		if (adj[u][v] && abs(dis[u] - dis[v]) != 1) return -1;
	// 	}
	// }
	return ans;
}

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

	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		string line; cin >> line;
		for (int j = 0; j < n; j++) {
			adj[i][j] = line[j] == '1';
		}
	}

	int ans = -1;
	for (int u = 0; u < n; u++) {
		ans = max(ans, solve(u, n));
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    int n, k; cin >> n >> k;
    int ans = 0;
    rep(i,n) {
        int h; cin >> h;
        if (h >= k)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const int INF = INT_MAX;
// const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (100000 + 2)

void exec(){
  int n, a[MAX_N][3];
  ll dp[MAX_N][3];
  cin >> n;
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 3; j++){
      scanf("%d", &a[i][j]);
      dp[i][j] = 0;
    }
  }

  dp[0][0] = a[0][0];
  dp[0][1] = a[0][1];
  dp[0][2] = a[0][2];

  for (int i = 1; i < n; i++){
    for (int j = 0; j < 3; j++){
      for (int k = 0; k < 3; k++){
        if (j == k){
          continue;
        }
        dp[i][j] = max(dp[i][j], dp[i-1][k] + a[i][j]);
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < 3; i++){
    ans = max(dp[n-1][i], ans);
  }

  cout << ans << endl;


}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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


Measured memory_bytes: 3712
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _Ty> static _Ty tp_abs(const _Ty& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _Ty> static _Ty tp_min(_Ty a, _Ty b) {
	return a < b ? a : b;
}
template <class _Ty> static _Ty tp_max(_Ty a, _Ty b) {
	return a > b ? a : b;
}

static void get2int(int& a, int& b) {
	if (scanf(" %d %d", &a, &b) < 0) puts("g2int Error");
}
static void get3int(int& a, int& b, int& c) {
	if (scanf(" %d %d %d", &a, &b, &c) < 0)	puts("g3int Error");
}

static const int EduDp_INF = 1100000000;

static void E_task();


int main()
{
	E_task();
	fflush(stdout);
	return 0;
}


class Baggage
{
public:
	int weight = 0;
	int value = 0;
};

static void E_task()
{
	int N, W;
	get2int(N, W);

	auto bgg = new Baggage[N];
	int ttlValue = 0;
	for (int i = 0; i < N; i++) {
		get2int(bgg[i].weight, bgg[i].value);
		ttlValue += bgg[i].value;
	}

	auto dp = new LLONG[N + 1][1000 * 100 + 2];
	std::fill(&dp[0][0], &dp[N - 1][1000 * 100 + 2], EduDp_INF);
	dp[0][0] = 0;
	for (int i = 0; i < N; i++) {
		for (int v = 0; v <= ttlValue; v++) {
			LLONG weight;
			if (v - bgg[i].value >= 0) {
				dp[i + 1][v] = dp[i][v - bgg[i].value] + bgg[i].weight;
			}
			dp[i + 1][v] = tp_min<LLONG>(dp[i + 1][v], dp[i][v]);
		}
	}

	int value = 0;
	for (int i = ttlValue; i >= 0; i--) {
		if (dp[N][i] <= W) {
			value = i;
			break;
		}
	}
	printf("%d\n", value);
	delete[] dp;
	delete[] bgg;
}


Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    bool f=true;
    ll ans=0;
    vector<ll> c(n);
    while(f){
        ll cnt=0;
        for(int i=0;i<n;i++){
            cnt+=a[i]/n;
        }
        for(int i=0;i<n;i++){
            a[i]=a[i]%n+cnt-a[i]/n;
        }
        ans+=cnt;
        bool g=true;
        for(int i=0;i<n;i++){
            if(a[i]>=n){
                g=false;
            }
        }
        if(g){
            f=false;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 1e6 + 10;
ll n;
int ans;
void solve(ll n, ll x)
{
	if(x == 1) return;
	while(n % x == 0) n /= x;
	if(n % x == 0 || n % x == 1) ++ans;
}
int main()
{
	cin >> n;
	for(ll i = 1; i * i <= n; ++i)
	{
		if(n % i) continue;
		solve(n, i);
		if(i * i != n) solve(n, n / i);
	}
	--n;
	for(ll i = 1; i * i <= n; ++i)
	{
		if(n % i) continue;
		ans += (i > 1);
		if(i * i != n) ans += (n / i > 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n, k, q = map(int, input().split())
point = [0] * n
for _ in range(q):
    a = int(input())
    point[a-1] += 1

ans = [k] * n
for i, p in enumerate(point):
    ans[i] -= q - p

for a in ans:
    if a > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 51428
s=input()
a=int(s[0]+s[1])
b=int(s[2]+s[3])

if a>=13 and b>=1 and b<=12:
  print("YYMM")
elif a==0 and b>=1 and b<=12:
  print("YYMM")  
elif a>=1 and a<=12 and b>=13:
  print("MMYY")
elif a>=1 and a<=12 and b==0:
  print("MMYY")
elif a>=1 and a<=12 and b>=1 and b<=12:
  print("AMBIGUOUS")
else:
  print("NA")


Measured memory_bytes: 3064
A = int(input())
B = int(input())
C = int(input())
X = int(input())

i = 0
for j in range(A+1):
    for k in range(B+1):
        for l in range(C+1):
            Y = 500 * j + 100 * k + 50 * l
            if Y == X:
                i +=1
print(i)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<queue>
#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() {
  const double PI=3.14159265358979323846;
  int r;
  cin >> r;
  double ans;
  ans = (double)2*PI * r;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3252
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val A = Array.fill(N)(sc.nextInt)

    (A.max - A.min).toString
  }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    string N;
    cin>>N;
    int a=N.length()-1;
    if(N[a]=='2'||N[a]=='4'||N[a]=='5'||N[a]=='7'||N[a]=='9'){
        cout<<"hon"<<endl;
    }else if(N[a]=='0'||N[a]=='1'||N[a]=='6'||N[a]=='8'){
        cout<<"pon"<<endl;
    }else{
        cout<<"bon"<<endl;
    }
    return 0;
}

//a=97,z=122

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

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

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n, k, s; cin >> n >> k >> s;
  lint dam = s + 1;
  if(s == 1000000000) dam = 1;
  for(int i = 0; i < k; i++) cout << s << " ";
  for(int i = k; i < n; i++) cout << dam << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
  int N,temp;
  int total;
  scanf("%d",&N);
  for(temp=1;temp<=N;temp++){
    total++;
    if(temp==9){
      temp=99;
    }
    else if(temp==999){
      temp=9999;
    }
    else if(temp==99999){
      break;
    }
  }
  printf("%d",total);
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
#define N 200001
#define DD 1000000007
int a[N];
long long f = 1;
map<int,long long> m;
int main()
{
	int n,tot = 1;
	cin >> n;
	for(int i = 1;i <= n;i ++)
		cin >> a[i];
	for(int i = 2;i <= n;i ++)
	{
		if(a[i] != a[i - 1])
			a[++tot] = a[i];
	}
	for(int i = 1;i <= tot;i ++)
	{
		f = (f + m[a[i]]) % DD;
		m[a[i]] = f;
	}
	cout << f << endl;
	return 0;
}


Measured memory_bytes: 13568
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int n;

vector<int> children_sum(200010);
ll ans = 0;

ll modpow(ll a, ll b){
    if(b == 0) return 1;
    else if(b % 2 == 0){
        ll d = modpow(a, b/2) % MOD;
        return (d * d) % MOD;
    }
    else{
        return (a * modpow(a, b-1)) % MOD;
    }
}

void dfs(int cv, int pv, vector<vector<int>> &G){
    int children_cnt = 1;
    vector<int> v;
    for(auto nv : G[cv]){
        if(nv == pv) continue;
        dfs(nv, cv, G);
        children_cnt += children_sum[nv];
        v.emplace_back(children_sum[nv]);
    }

    v.emplace_back(n - children_cnt);

    ll sum = 0;
    for(auto i : v){
        sum += modpow(2, i) - 1;
        sum %= MOD;
    }

    ans += modpow(2, n - 1) - 1 - sum + MOD;
    ans %= MOD;

    children_sum[cv] = children_cnt;
    return ;
}

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

    cin>>n;
    vector<vector<int>> G(n);
    for(int i=0; i<n-1; i++){
        int a, b; cin>>a>>b;
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    dfs(0, -1, G);

    ll all = modpow(2, n);

    cout << ans * modpow(all, MOD - 2) % MOD << endl;

    return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")
int table[365][26];
int main()
{
	
	int D;
	cin >> D;
	vec(C);
	vec(Las);
	fx(26) {
		vecp(C);
		Las.push_back(0);
	}

	fx(D) {
		fy(26) {
			cin >> table[x][y];
		}
	}

	vec(T);
	srand((time(NULL)));
	fx(D) {
		pb(T, rand() % 26 + 1);
	}
	ll sum = 0;
	vector<int> S(D,0);

	int preDay = 0;
	fx(5000) {
		int d;
		 
		 int dif = INT_MAX, ind = 0;
		 fw(D-1) {
			 if (S[w+1]-S[w]<dif) {
				 ind = w + 1;
				 dif = S[w + 1] - S[w];
			 }
		 }
		 d = ind;
		 if (d==preDay) {
			 d = (d + 1) % D + 1;
		 }
		 preDay = d;

		 for (int q = 1; q <= 26; q++) {
			 int pre = T[d - 1];
			 if (q == pre) { continue;}
			 T[d - 1] = q;
			 ll ans = 0;
			 vector<int> G(S);
			 fy(26) {
				 Las[y] = 0;
			 }
			 fw(D) {

				 ans += table[w][T[w] - 1];
				 Las[T[w] - 1] = w + 1;
				 fz(26) {
					 ans -= C[z] * (w + 1 - Las[z]);
				 }
				 S[w] = ans;
			 }
			 if (ans > sum) {
				 sum = ans;
				 S = G;
			 }
			 else {
				 T[d - 1] = pre;
			 }
		 }
	
	}

	fx(D) {
		ce(T[x])
	}

    return 0;
}



Measured memory_bytes: 3648
n = int(input())
data = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]


for _ in range(n):
    b,f,r,v=map(int,input().split())
    data[b-1][f-1][r-1]+=v
for b in range(4):
    for f in data[b]:
        print("",*f)
    if b != 3:
        print("#"*20)



Measured memory_bytes: 5624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <unordered_set>

#define MIN(a,b) (a)>(b)?(b):(a)

using namespace std;

int main() {
	int K, X;
	cin >> K >> X;
	for (int i = 0; i < K * 2 - 1; i++) {
		cout << X - (K - 1) + i << " ";
	}
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        x: i32,
        y: i32,
    }
    let mut ok = true;
    if (y - 2 * x) % 2 != 0 {
        ok = false
    }
    let b = (y - 2 * x) / 2;
    let a = x - b;
    if a < 0 || b < 0 {
        ok = false;
    }
    if ok {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2156
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rep2(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rev(i, n) for (int (i) = (n)-1; (i) >= 0; (i)--)
#define rev2(i, a, b) for (int (i) = (a)-1; (i) >= (b); (i)--)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pll = pair<long long, long long>;
template<class T> using Vec = vector<T>;
template<class T> using VVec = vector<vector<T>>;
long long TEN(int i) {return !i ? 1 : TEN(i-1)*10LL;}
template<class T, class U> 
bool chmin(T& a, const U& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T, class U> 
bool chmax(T& a, const U& b) {if (a < b) {a = b; return 1;} return 0;}
 
struct IoSetup {
  	IoSetup() {
    	cin.tie(nullptr);
    	ios::sync_with_stdio(false);
    	cout << fixed << setprecision(10);
  	}
} iosetup;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

int N, K;
int V[55];

int main() {
	cin >> N >> K;
	rep (i, N) cin >> V[i];

	ll ans = 0;
	rep (i, N + 1) rep2 (j, i, N + 1) {
		int ij = j - i;
		if (N - ij > K) continue;
		Vec<int> koho;
		rep (k, i) koho.pb(V[k]);
		rep2 (k, j, N) koho.pb(V[k]);
		sort(rrng(koho));
		rep (k, K - (N - ij)) if (koho.size() && koho[koho.size() - 1] < 0) koho.pop_back();
		ll sum = 0;
		rep (k, koho.size()) sum += koho[k];
		chmax(ans, sum);
	}

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


Measured memory_bytes: 3656
a, b, k = map(int, input().split())
if k >= -(-(b - a + 1)//2):
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range(b + 1 - k, b + 1):
        print(i)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	if(a<=k){
		ans+=a;
		k-=a;
		if(b<=k){
			k-=b;
			if(c<=k){
				ans-=c;
			}else ans-=k;
		}
		else{
			ans+=k;
		}
	}
	else{
		ans+=k;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int x;
    cin >> x;
    if(x >= 30) cout << "Yes\n";
    else    cout << "No\n";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
struct edge{int to; ll cost;};
typedef pair<ll,int> P;
const ll INF = 1e17;

void dijkstra(int n, int s, vector<vector<edge>>& g, vector<ll>& d){
  priority_queue<P,vector<P>,greater<P>> que;
  rep(i,n) d[i] = INF;
  d[s] = 0;
  que.push(P(0,s));
  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(auto e : g[v]){
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){
  int n, x, y;
  cin >> n >> x >> y;
  x--; y--;
  vector<vector<edge>> g(n);
  vector<ll> d(n);
  rep(i,n-1) {
    g[i].push_back(edge{i+1,1});
    g[i+1].push_back(edge{i,1});
  } 
  g[x].push_back(edge{y,1});
  g[y].push_back(edge{x,1});
  vector<int> ans(n);
  rep(i,n) {
    dijkstra(n,i,g,d);
    rep(j,n) ans[d[j]]++;
  }
  for(int i = 1; i < n; i++) cout << ans[i]/2 << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

vector<int>pos[27];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s,t;
    cin>>s>>t;
    int n=s.length(),m=t.length();
    for(int i=0;i<n;i++){
        pos[s[i]-'a'].push_back(i);
    }
    for(int i=0;i<=25;i++){
        sort(pos[i].begin(),pos[i].end());
    }
    ll res=0;
    int last=-1;
    for(int i=0;i<m;i++){
        if(pos[t[i]-'a'].size()==0){cout<<-1<<endl;return 0;}
        auto it=upper_bound(pos[t[i]-'a'].begin(),pos[t[i]-'a'].end(),last);
        if(it==pos[t[i]-'a'].end()){res+=n;last=*pos[t[i]-'a'].begin();}
        else{last=*it;}

    }
    cout<<res+last+1<<endl;
    return 0;
    }


Measured memory_bytes: 1228
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {

	auto data = readln.split.to!(int[]);
	auto N = data[0], K = data[1];
	auto S = readln.split[0];
	
	auto groupS = S.group().array;
	if (groupS[0][0] == '0')   groupS = [tuple('1'.to!dchar, 0.to!uint)] ~ groupS;
	if (groupS[$-1][0] == '0') groupS ~= tuple('1'.to!dchar, 0.to!uint);
	
	if ( 2*K + 1 > groupS.length ) { S.length.writeln; return; }
	
	auto l = groupS.length;
	auto sums = [0.to!uint];
	foreach (n; groupS) {
		sums ~= sums[$-1] + n[1];
	}
	writeln( ((l-1-2*K)/2 + 1).iota.map!( x => sums[2*x + 2*K+1] - sums[2*x] ).reduce!"max(a,b)" );
}



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

int bubbleSort(int A[], int N)
{
  int s = 0;
  for(int i = 0; i < N - 1; i++)
    for(int j = N - 1; j > i; j--)
      if(A[j] < A[j - 1]){
	int tmp = A[j - 1];
	A[j - 1] = A[j];
	A[j] = tmp;
	s++;
      }
  return s;
}

int main()
{
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++)
    cin >> A[i];
  int n = bubbleSort(A, N);
  for(int i = 0; i < N; i++)
    if(i)
      cout << " " << A[i];
    else 
      cout << A[i];
  cout << endl << n << endl;
}

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

ll mod = 1e9 + 7;

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n);
    for(ll i=0; i<n; i++){
        cin>>a[i];
    }
    ll noa = 0,nop = 0,sum = 0;
    for(ll i=0; i<n; i++){
        noa = 0;
        nop = 0;
        for(ll j=0; j<n; j++){
            if(a[i]>a[j]){
                if(i>j){
                    nop++;
                }
                else if(i<j){
                    noa++;
                }
            }
        }
        ll mid = k*(nop+noa) + (noa-nop);
        ll nay = k;
        if(mid%2 == 0){
            mid = mid/2;
        }
        else{
            nay = nay/2;
        }
        mid = mid%mod;
        ll add = (nay*mid)%mod;
        sum = sum + add;
        sum = sum%mod;
    }
    cout<<sum;


return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
using namespace std;
int main(void)
{
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>> c(m);
  REP(i,m) cin >> c[i].first >> c[i].second;
  SORT(c);
  vector<int> mi(n),ma(n);
  REP(i,n) mi[i]=i;
  REP(i,n) ma[i]=i;
  REP(i,m){
    mi[c[i].second]=mi[c[i].second-1];
    ma[c[i].second-1]=ma[c[i].second];
  }
  REP(i,n){
   if(i) cout << " ";
   cout << ma[i]-mi[i]+1;
  }
  cout << endl;
  return 0;
}

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

int main(){
    unsigned long N;
    cin >> N;
    vector<unsigned long> L;
    L.reserve(N);
    copy_n(istream_iterator<unsigned long>(cin), N, back_inserter(L));
    sort(L.begin(), L.end());
    unsigned long ans{0};
    for(unsigned long i = 2; i < N; ++i)for(unsigned long j = 1; j < i; ++j)for(unsigned long k = 0; k < j; ++k)ans += (L[i] < L[j] + L[k]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  const int INF=(1<<29);
  int n,m,c[25],i,j,dp[25][50010];
  scanf("%d %d\n",&n,&m);
  for(i=1;i<=m;i++){
    scanf("%d ",&c[i]);
  }
  for(i=0;i<=m;i++){
    for(j=0;j<=n;j++){
      dp[i][j]=INF;
    }
  }
  dp[0][0]=0;
  for(i=1;i<=m;i++){
    for(j=0;j<=n;j++){
      dp[i][j]=min(dp[i][j],dp[i-1][j]);
      if(j-c[i]>=0){
        dp[i][j]=min(dp[i][j],dp[i][j-c[i]]+1);
      }
    }
  }
  printf("%d\n",dp[m][n]);
  return 0;
}


Measured memory_bytes: 7312
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;}
ll lcm(ll x, ll y) {return x/gcd(x,y)*y;}
// 素因数分解 O(√n)
// たとえば 60 = 2^2 x 3 x 5 だったら {(2, 2), (3, 1), (5, 1)} を返す
// 素因数の個数はlogn
vector<pair<ll,ll>> prime_factorize(ll n){
    vector<pair<ll,ll>> res;
    for(ll p=2;p*p<=n;p++){
        if(n%p!=0) continue;
        int num=0; // 指数
        while(n%p==0){
            num++;
            n/=p;
        }
        res.push_back({p,num});
    }
    if(n!=1) res.push_back({n,1});
    return res;
}

int main(){
    ll a,b;
    cin>>a>>b;

    auto pf=prime_factorize(gcd(a,b));
    cout<<pf.size()+1<<endl;
}


Measured memory_bytes: 3600
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <iostream> 
#include <iomanip>  
#include <string>
#include <sstream>  
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <cstring>
#include <cmath>
#include <cassert>


#define INF              (int)1000000007
#define EPS              1e-9
#define pb               push_back
#define mp               make_pair
#define all(c)           c.begin(), c.end()
#define forall(i,a,b)    for(int i=a;i<(b);++i)
#define trav(a,x)        for(auto & a: x)
#define in(a,b)          ((b).find(a) != (b).end())
#define sz(c)            (int)(c).size()
#define input(a)         for(auto & x : a) cin >> x;

using namespace std;

typedef vector<int>      vi;
typedef pair<int,int>    ii;
typedef vector<vi>       vvi;
typedef vector<ii>       vii;
typedef long long        ll;
typedef unsigned long long        ull;

#ifdef DEBUG
#define trace(...)       __f(#__VA_ARGS__, __VA_ARGS__)
#define debug(args...)   {dbg,args; clog<<endl;}
#define print_( a )      for( auto & x : a ) clog << x << ' '; clog << '\n';
#define printPair_( a )  for( auto & x : a ) clog << '(' << x.first << ',' << x.second << ')' << ' '; clog << '\n';
#else
#define trace(...)       
#define debug(args...)            
#define print_( a )               
#define printPair_( a )           
#endif

struct debugger {
  template<typename T> debugger& operator , (const T& x) {    
    clog << x << " ";    return *this;    
  }
}dbg;

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " | ";
    __f(comma + 1, args...);
}

auto ____ =[]() { std::ios::sync_with_stdio(0); cin.tie(0); return nullptr; }();

int main( int argc, char * argv[] ){
  int n; cin >> n; 
  trace(n);
  vector<ull> v(n); input(v);

  vector<ull> cnt(60, 0);
  forall(i,0,n){
    ull x = v[i];
    ull b = 1;
    forall(j,0,60){
      if( x & (b<<j) ) cnt[j]++;
    }
  }
  print_(cnt);

  ull res = 0;
  forall(i,0,60){
    ull tmp = cnt[i] * (n-cnt[i]);
    tmp %= INF;
    trace(i,tmp);
    ull fact = (1LL<<i)%INF;
    tmp *= fact;
    trace(tmp);
    tmp %= INF;
    res += tmp;
    res %= INF;
  }
  cout << res << endl;

  /*
  ll ans = 0;
  forall(i,0,n-1){
    ll x = v[i];
    forall(j,i+1,n){
      ans += x^v[j];
      ans %= INF;
    }
  }
  cout << ans << endl;
  */


  return 0;
}


Measured memory_bytes: 2560
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))

n, k = map(int, input().split())
sunuke = [0]* n
for i in range(k) :
    d = int(input())
    List = list(map(int, input().split()))
    for j in List:
        sunuke[j - 1] += 1

print(sunuke.count(0))


Measured memory_bytes: 9152
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>

using namespace std;

int main() {
    int a, b;
    while (cin >> a >> b) {
        int sum = a + b;
        int res = 1;
        while (sum >= 10) {
            res ++;
            sum /= 10;
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3052
#include <stdio.h>

int		main()
{
	char	S[101];
	int		hug = 0;
	int		len = 0;
	int		i = 0;

	scanf("%s\n", S);
	while (S[len])
		len++;
	len--;
	while (i < len)
	{
		if (S[i] != S[len])
			hug++;
		len--;
		i++;
	}
	printf("%d\n", hug);
	return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <string.h>
#define NMAX 15
using namespace std;
char s[NMAX],t[NMAX];
int main(){
    int n,m;
    scanf("%s",s);
    scanf("%s",t);
    n = strlen(s);
    m = strlen(t);
    if(m != n + 1){
      cout << "No" << "\n";
      return 0;
    }
    for(int i = 0;i < n;i ++){
      if(s[i] != t[i]){
        cout << "No" << "\n";
        return 0;
      }
    }
    cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 3720
s = input()
ls = len(s)
K = int(input())
ss = sorted(set(list(s)))
ssl = len(ss)
kl = []
m = set()
for t in ss[0:min(ssl,K)]:
    kkl = []
    i = 0
    while True:
        if i > ls-1:break
        if s[i] == t:
            kkl.append(s[i:])
        i += 1
    for sub in sorted(kkl):
        lsub = len(sub)
        for i in range(0,lsub):
            m.add(sub[0:i+1])
        if len(m) >=5:break
    if len(m) >=5:break
print(sorted(m)[K-1])

Measured memory_bytes: 15604
#include<iostream>
#include<string>
#include<vector>


using namespace std;

typedef long long ll;

int main(){
string s; cin >> s;
  string t;
  for(int i = 0; i < s.size(); i++){
    if(s[i] =='A'){ t += 'T';}
    if(s[i] == 'G'){ t += 'C';}
    if(s[i] == 'T'){ t +='A';}
    if(s[i] == 'C'){ t += 'G';}
    
  }
  cout << t << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define szof(s) (int)s.size()
#define pb push_back
#define int long long
#define all(s) s.begin(), s.end()
#define pii pair<int, int>
#define fr first
#define sc second

using namespace std;
const int N = (int)2e5 + 5;

void solve() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < s.size() - 3 + 1; i++) {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
      ans++;
    }
  }
  cout << ans;
}

main() {
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

string s, t;
int main(void) {
	cin >> s >> t;
	vector<string> ans;
	rep(i, s.size()) {
		string d = s.substr(i, t.size());
		if(d.size() < t.size()) continue;
		bool f = true;
		rep(j, d.size()) {
			if(!(d[j] == '?' || d[j] == t[j])) f = false;
		}
		if(!f) continue;
		string ts = s;
		reps(j, i, i + t.size()) ts[j] = t[j - i];
		rep(j, ts.size()) if(ts[j] == '?') ts[j] = 'a';
		ans.pb(ts);
	}
	sort(all(ans));
	if(ans.size() == 0) cout << "UNRESTORABLE" << endl;
	else cout << ans[0] << endl;
	return 0;
}

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

int main() {
	char a, b;
	cin >> a >> b;
	if (a == b) cout << 'H';
	else cout << 'D';
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

場合分け、してみようか
1. a=='H'かつb=='H' 正直者
2. a=='H'かつb=='D' 嘘つき
3. a=='D'かつb=='H' 嘘つき
4. a=='D'かつb=='D' 正直者
よってaとbの値が違うか否かのみで判定できるね
*/

Measured memory_bytes: 256
x1, y1 ,x2, y2 = map(int,input().split())

x_idou = x2 - x1
y_idou = y2 - y1

print(x2-y_idou,y2+x_idou,x2-y_idou-x_idou,y2+x_idou-y_idou)

Measured memory_bytes: 3060
H,W = map(int,input().split())
S = [input() for _ in range(H)]
answer = [[0 if cell == '.' else '#' for cell in row] for row in S]

import itertools
for i in range(H):
  for j in range(W):
    if S[i][j] != '#':
      continue
    for dx,dy in itertools.product([-1,0,1],repeat=2):
      x = i+dx
      y = j+dy
      if x < 0 or x >= H:
        continue
      if y < 0 or y >= W:
        continue
      if S[x][y] == '#':
        continue
      answer[x][y] += 1

      
for row in answer:
  print(*row,sep='')

Measured memory_bytes: 3444
import sys
from copy import deepcopy
input=sys.stdin.readline
n,m=map(int,input().split())
XYZ=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in range(8):
    a=1 if i&1 else -1
    b=1 if (i>>1)&1 else -1
    c=1 if (i>>2)&1 else -1
    xyz=deepcopy(XYZ)
    l=[]
    for j in range(n):
        l.append(xyz[j][0]*a+xyz[j][1]*b+xyz[j][2]*c)
    l.sort(reverse=True)
    ans=max(ans,sum(l[:m]))
print(ans)


Measured memory_bytes: 4212