akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;
#define oorret true //std::out_of_rangeが返された時
#define oor(x) [&](){try{x;} catch(const std::out_of_range& oor){return oorret;} return x;}()
double pi = 3.141592653589793238;
ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
int D;
void calculate(vector<int> c, vector<vector<int>> s, int contest,int day, vector<int> &t, ll &score){
    ll p=0;
    int a[26];
    rep(i, 26){
        a[i]=0;
    }
    rep(i, D){
        rep(j, 26){
            p-=c[j]*(i+1-a[j]);
        }
        if(i!=day){
            p+=s[i].at(t[i])+c[t[i]]*(i+1-a[t[i]]);
            a[t[i]]=i+1;
        }else{
            p+=s[day].at(contest)+c[contest]*(day+1-a[contest]);
            a[contest]=i+1;
        }
        
    }
    if(score<p){
        score=p;
        t[day]=contest;
    }
}

int main(){
cin>>D;
vector<int> c(26);
rep(i, 26){
    cin>>c[i];
}
vector<vector<int>> s(D);
int r;
rep(i, D){
    rep(j, 26){
        cin>>r;
        s[i].push_back(r);
    }
}
int M[26];
rep(i, 26){
    M[i]=0;
}
vector<vector<int>> m(D);
rep(i, D){
    rep(j, 26){
        m[i].push_back(0);
    }
}
vector<int> a(26);

rep(i, 26){
    a[i]=0;
}
rep(i, D){
}
vector<int> t(D);
ll score=0;
rep(i, D){
    rep(j, 26){
        M[j]=0;
    }
    rep(j, 26){
        score-=c[j]*(i+1-a[j]);
        rep(k, j+1){
            if(s[i].at(j)+c[j]*(i+1-a[j])>M[k]){
                rep(l, j-k){
                    M[j-l]=M[j-l-1];
                    m[i].at(j-l)=m[i].at(j-l-1);
                }
                M[k]=s[i].at(j)+c[j]*(i+1-a[j]);
                m[i].at(k)=j;
                break;
            }
        }
    }
    score+=M[0];
    a[m[i].at(0)]=i+1;
    t[i]=m[i].at(0);
}
rep(j, 14){
    rep(i, j+2){
        rep(k, D){
            calculate(c, s, m[k].at(i),k, t, score);
        }
    }
    rep(i, j+2){
        rep(k, D){
            calculate(c, s, m[k].at(i),k, t, score);
        }
    }
}
rep(i, D){
    cout<<t[i]+1<<endl;
}
}


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

#define fo(i, n) for(int i=0; i<n; i++)
#define endl "\n"

int main() {

	int n;
	cin >> n;

	long arr[n][3], dp[n][3];
	fo(i, n) fo(j, 3) cin >> arr[i][j];

	fo(i, n) {
		if (i == 0) {
			dp[i][0] = arr[i][0];
			dp[i][1] = arr[i][1];
			dp[i][2] = arr[i][2];
		} else {
			dp[i][0] = arr[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
			dp[i][1] = arr[i][1] + max(dp[i - 1][2], dp[i - 1][0]);
			dp[i][2] = arr[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
		}
	}

	cout << max(dp[n - 1][1], max(dp[n - 1][0], dp[n - 1][2]));

	return 0;
}

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

using namespace std;

int longestPath(int node, vector<vector<int>> &graph, vector<int> &memo) {
    if (memo[node] != -1) {
        return memo[node];
    }
    memo[node] = -1;
    for (int next : graph[node]) {
        memo[node] = max(memo[node], longestPath(next, graph, memo));
    }
    memo[node]++;
    return memo[node];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    int n, m;
    cin >> n >> m;
    vector<vector<int>> graph(n+1);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        graph[x].push_back(y);
    }
    vector<int> memo(n+1, -1);
    int longest = 0;
    for (int i = 1; i <= n; i++) {
        longest = max(longest, longestPath(i, graph, memo));
    }
    cout << longest << endl;
    return 0;
}


Measured memory_bytes: 8832
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

import itertools
import math


p = list(itertools.permutations(range(N)))

Sum_N = 0

for i in range(len(p)):

    Sum = 0

    for j in range(N - 1):
        Sum += math.sqrt((x[p[i][j]] - x[p[i][j + 1]]) ** 2 + (y[p[i][j]] - y[p[i][j + 1]]) ** 2)

    Sum_N += Sum

print(Sum_N / len(p))



Measured memory_bytes: 46956
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	long double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	long double x_diff = x1 - x2;
	long double y_diff = y1 - y2;
	printf("%.8Lf\n", sqrt((x_diff * x_diff) + (y_diff * y_diff)));
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const int n_max = 310;
ll dp[n_max][n_max];

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

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

  vector<int> h(n+1);
  h[0]=0;
  rep(i,n){
    cin >> h[i+1];
  }
  rep(i,n+1)rep(j,n+1) dp[i][j] = LLONG_MAX/10;
  dp[0][0]=0;
  rep1(i,n){
    rep1(j,min(n-k,i)){
      rep(l,i){
	dp[i][j] = min(dp[i][j],dp[l][j-1] + max(0,h[i]-h[l]));
      }
      //      cout << "i j dp "<< i << " " << j << " " << dp[i][j] << endl;
    }
  }
  ll ans = LLONG_MAX;
  rep(i,n+1){
    ans = min(ans, dp[i][n-k]);
  }
  cout << ans << endl;
  
  //cout << endl << endl;
  //cout << static_cast<double>(clock()) / CLOCKS_PER_SEC << "s"<<endl;
  return 0;
    

}


Measured memory_bytes: 1152
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n, m; cin >> n >> m;
    vector<tuple<ll, int>> v;
    REP(i, n) {
        ll a; int b; cin >> a >> b;
        v.push_back(make_tuple(a, b));
    }
    sort(ALL(v));
    // sort(
    //     v.begin(),
    //     v.end(),
    //     [](tuple<ll, int> const &lhs, tuple<ll, int> const &rhs) {
    //         if (get<0>(lhs) != get<0>(rhs)) return get<0>(lhs) < get<0>(rhs);
    //         if (get<1>(lhs) != get<1>(rhs)) return get<1>(lhs) > get<1>(rhs);
    //         return true;
    //     }
    // );
    ll cost = 0;
    REP(i, n) {
        cost += get<0>(v[i]) * min(get<1>(v[i]), m);
        m -= min(get<1>(v[i]), m);
        if (m == 0) {
            break;
        }
    }
    cout << cost << endl;
    return 0;
}

Measured memory_bytes: 2420
n=int(input())
arr=list(map(int,input().strip().split()))[:n-1]
dict1={}
for i in arr:
	if i in dict1:
		dict1[i]+=1
	else:
		dict1[i]=1
for i in range(1,n+1):
	if i in dict1:
		print(dict1[i])
	else:
		print(0)

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;


const int H = 105;
const int W = 10;
const int MOD = 1e9 + 7;
int h, w, k;
ll dp[H][W];
ll C[W];

void init() {
    C[1] = 2;
    int a = 1, b = 1;
    for (int i = 2; i < w; ++i) {
        int na = b;
        int nb = a + b;
        C[i] = na + nb;
        a = na;
        b = nb;
    }
}

ll cnt(int x) {
    if (x <= 0) return 1;
    return C[x];
}

int main() {
    cin >> h >> w >> k;
    init();
    for (int i = 0; i < w; ++i) {
        if (i == k - 1)
            dp[h][i] = 1;
        else
            dp[h][i] = 0;
    }
    // cout << dp[15][4] << endl;
    // dp[0][0] => dp[h - 1][k - 1]
    for (int i = h - 1; i >= 0; --i) {
        for (int j = 0; j < w; ++j) {
            dp[i][j] = dp[i + 1][j] * cnt(j - 1) % MOD * cnt(w - j - 2) % MOD; // 0 j 0
            if (j > 0)
                dp[i][j] = (dp[i][j] + dp[i + 1][j - 1] * cnt(j - 2) % MOD * cnt(w - j - 2) % MOD) % MOD; // 1 j 0
            if (j < w - 1)
                dp[i][j] = (dp[i][j] + dp[i + 1][j + 1] * cnt(j - 1) % MOD * cnt(w - j - 3) % MOD) % MOD; // 0 j 1

            // cout << i << ' ' << j << ' ' << dp[i][j] << endl;
        }
    }
    cout << dp[0][0] << endl;
    return 0;
}


Measured memory_bytes: 3592
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define rall(n) std::rbegin(n), std::rend(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void init() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
}

void calc() {

	Int A, B, C, K; std::cin >> A >> B >> C >> K;
	Int ans = 0;
	Int cnt = 0;
	if (cnt + A <= K)ans += A;
	else {
		ans += (K - cnt);
	}
	cnt += A;
	cnt += B;
	if (cnt < K)ans -= (K - cnt);

	std::cout << ans;

}


int main() {

	init();
	calc();

	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define int long long
int ans=0;
int func(int n)
{
    for(int i=0; i<40; i++)
    {
        int sm=(i*(i+1))/2;
        if(sm>n)
        {
            return i-1;
        }
    }

}
void primeFactors(int n)
{
    int c=0;
    while (n%2 == 0)
    {
        c++;
        n = n/2;
    }
    ans+=func(c);
    c=0;
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            c++;
            n = n/i;
        }
        ans+=func(c);
        c=0;
    }
    if (n > 2)
        ans++;
}
main()
{
    int n;
    cin>>n;
    primeFactors(n);
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3660
#include<iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {

	int N, i, sum=100000;

	cin >> N;

	for (i = 0; i < N; i++) {
		sum *= 1.05;
		if(sum -(sum/1000)*1000 != 0)
			sum = ((sum + 1000) / 1000) * 1000;
	}

	cout << sum << endl;

	return 0;

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    long long a;
    long long b;
    long long k;
    long long aa=0;
    long long bb=0;
    
    cin >> a >> b >> k;
    
    aa = a - k;
    
    if(aa<0){
        
        bb = b + aa;
        aa = 0;
        
        if(bb<0){
            
            bb = 0;
            
        }
        
    } else {
        
        bb = b;
        
    }
    
    cout << aa << " " << bb << endl;
    
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a); i >=(b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod1=1000000007;
ll mod2=67280421310721;
ll mod3=998244353;
ll INF=1e18;

ll binpow1(ll a,ll b){
    ll res=1;
    while (b>0){
        if (b&1)
        res=res*a;
        a=a*a;
        b>>=1;
    }
    return res;
}

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

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

map<ll,ll> fact(ll n) {
    map<ll,ll> factorization;ll c=0;
    while (n % 2 == 0) {
        c++;
        n /= 2;
    }
    if(c>0)
    {
        factorization.insert({2,c});
    }c=0;
    for (ll d = 3; d * d <= n; d += 2) {
        while (n % d == 0) {
            c++;
            n /= d;
        }
        if(c>0)
    {
        factorization.insert({d,c});
    }c=0;
    }
    if (n > 1)
       {
           factorization.insert({n,1});
       }
    return factorization;
}

ll func1(ll n, ll r, ll p)
{
    // Optimization for the cases when r is large
    if (r > n - r)
        {r = n - r;}

    // The array C is going to store last row of
    // pascal triangle at the end. And last entry
    // of last row is nCr
    ll C[r + 1];
    memset(C, 0, sizeof(C));

    C[0] = 1; // Top row of Pascal Triangle

    // One by constructs remaining rows of Pascal
    // Triangle from top to bottom
    for (ll i = 1; i <= n; i++) {

        // Fill entries of current row using previous
        // row values
        for (ll j = min(i, r); j > 0; j--)

            // nCj = (n-1)Cj + (n-1)C(j-1);
           {
               C[j] = (C[j] + C[j - 1]) % p;
           }
    }
    return C[r];
}

ll dp[2001];

ll func(ll n)
{
    if(dp[n]!=-1)
    {
        return dp[n];
    }
    ll ans=0;
    if(n>=3)
    {
        ans=1;
    }
    FOR(i,3,n+1)
    {
        ans=ans+(func(n-i)%mod1);
    }
    dp[n]=ans%mod1;
    return dp[n];
}

int main()
{ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    ll n;
    cin>>n;
    memset(dp,-1,sizeof(dp));
    cout<<func(n);




	return 0;
}













Measured memory_bytes: 3644
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	int n;
	cin>>n;
	vp in(n);
	rep(i,n){
		ll a;
		cin>>a;
		in[i]={-a,i};
	}
	sort(all(in));
	vvi co(n,vi(3,-1));
	vvi G(n);
	rep(i,n-1){
		if(co[i][1]==-1)co[i]={0,1};
		int it=lower_bound(all(in),pii(in[i].first+n-2*co[i][1],-1))-in.begin();
		if(in[i].first+n-2*co[i][1]!=in[it].first){
			cout<<-1<<endl;
			return 0;
		}
		if(co[it][1]==-1)co[it]={0,1};
		co[it][0]+=co[i][0]+co[i][1];
		co[it][1]+=co[i][1];
		G[in[it].second].pb(in[i].second);
	}
	if(-co[n-1][0]!=in[n-1].first){
		cout<<-1<<endl;
		return 0;
	}
	rep(i,n)rep(j,G[i].size())
		cout<<i+1<<" "<<G[i][j]+1<<endl;
}









Measured memory_bytes: 13952
def solve():
    N = int(input())
    A = list(map(int,input().split()))

    for i in range(N):
        if (A[i]%2==1):
            continue
        elif(A[i]%3!=0 and A[i]%5!=0):
            print("DENIED")
            return
    print("APPROVED")
    return

solve()

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

int n;
string s;
int a[4];

int main()
{
	ios::sync_with_stdio(0);
	cin >> n;
	while(n--)
	{
		cin >> s;
		if(s == "AC") a[0]++;
		else if(s == "WA") a[1]++;
		else if(s == "TLE") a[2]++;
		else if(s == "RE") a[3]++;
	}
	
	cout << "AC x " << a[0] << endl;
	cout << "WA x " << a[1] << endl;
	cout << "TLE x " << a[2] << endl;
	cout << "RE x " << a[3] << endl;
  	return 0;
}

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

int main() {
  char a,b;
  cin >> a >> b;
  
  if((a=='H' && b=='H') || (a=='D'&&b=='D')){
    cout << 'H' << endl;
  }
  else{
    cout << 'D' << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 1e-10;

struct star {
    double x, y, z;
};

struct telescope {
    double x, y, z, phi;
};

star s[505];
telescope t[51];
int n;  // number of stars
int m;  // number of telescopes

bool check(int tn, int sn)
{
    double inner, ss, ts, theta;
 
    inner = t[tn].x * s[sn].x + t[tn].y * s[sn].y 
        + t[tn].z * s[sn].z;
    ss = sqrt(s[sn].x * s[sn].x + s[sn].y * s[sn].y
              + s[sn].z * s[sn].z);
    ts =  sqrt(t[tn].x * t[tn].x + t[tn].y * t[tn].y
               + t[tn].z * t[tn].z);
    ts = abs(ts);
    theta = acos(inner / (ss * ts));

    return (theta < t[tn].phi) ? true : false;
}

void solve()
{
    int ans = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (check(j, i)) {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    while (cin >> n, n) {
        for (int i = 0; i < n; i++) 
            cin >> s[i].x >> s[i].y >> s[i].z;
        cin >> m;
        for (int i = 0; i < m; i++)
            cin >> t[i].x >> t[i].y >> t[i].z >> t[i].phi;

        solve();
    }

    return 0;
}

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

int main(){
   int n;
  cin >> n;
  string str;
  cin >> str;
  int ans=1;
  rep(i,n-1) if(str[i]!=str[i+1]) ans++;
  cout << ans << endl;
  
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <deque>

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

using namespace std;

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

	if (s.substr(0,4)=="YAKI")
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <unordered_map>

using namespace std;

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

int main()
{
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans;
  if (k <= a)
  {
    ans = k;
  }
  else if (k <= a + b)
  {
    ans = a;
  }
  else
  {
    ans = a - (k - a - b);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <cstdio>
        #include <vector>
        #include <utility>
        #include <algorithm>
        #include <set>
        #include <random>
        using namespace std;
        typedef pair<int,int> ii;
        const int INF=1000000005;
        int n;
        vector<ii> range;
        multiset<int> mina,maxa,minb,maxb;
        int main(){
            scanf("%d",&n);
            int a,b;
            int ans=0;
            for (int x=0;x<n;x++){
                scanf("%d%d",&a,&b);
                range.push_back(ii(a,b));
                mina.insert(a);
                maxa.insert(b);
            }
         
            for (vector<ii>::iterator it=range.begin();it!=range.end();it++){
                mina.erase(mina.find((*it).first));
                maxa.erase(maxa.find((*it).second));
                ans=max(ans,(*it).second-(*it).first+1+max(0,*maxa.begin()-*mina.rbegin()+1));
                mina.insert((*it).first);
                maxa.insert((*it).second);
            }
         
            sort(range.begin(),range.end(),[](ii i,ii j){
                if (i.first!=j.first) return i.first<j.first;
              	else return i.second>j.second;
            });
         
            while (range.size()!=1){
                minb.insert(range.back().first);
                maxb.insert(range.back().second);
                mina.erase(mina.find(range.back().first));
                maxa.erase(maxa.find(range.back().second));
                range.pop_back();
                ans=max(ans,max(0,*maxa.begin()-*mina.rbegin()+1)+max(0,*maxb.begin()-*minb.rbegin()+1));
            }
         
            printf("%d\n",ans);
        }

Measured memory_bytes: 10484
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;




int main()
{
   
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll k,m;
    cin>>k>>m;
    if((k*500)>=m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import scala.io.Source

object Main extends App {
  val src: List[String] = Source.stdin.getLines.toList
  val ring: String = src(0) * 2
  val pattern: String = src(1)

  val wordList: List[String] = ring.sliding(pattern.length, 1).toList

  def isIncluded(ws: List[String], pattern: String): Boolean = ws match {
    case Nil => false
    case h :: tail => if (h == pattern) true else isIncluded(tail, pattern)
  }

  if (isIncluded(wordList, pattern)) println("Yes") else println("No")
}

Measured memory_bytes: 45680
/*
 * W H x y
*/

#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <cassert>

using namespace std;

int main() {
  long long W, H, x, y;
  cin >> W >> H >> x >> y;

  double a1 = W * H / 2.0;
  int a2 = (x * 2 == W && y * 2 == H) ? 1 : 0;

  cout << a1 << " " << a2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
}

signed main(){
  string s;
  cin >> s;
  vector<int> ans(int(s.size() + 1), 0);
  rep(i,int(s.size())){
    if(s[i] == '<')
      chmax(ans[i + 1],ans[i] + 1);
  }
  rrep(i,int(s.size())){
    if(s[i]=='>'){
      chmax(ans[i], ans[i + 1] + 1);
    }
  }
  ll res = 0;
  for(auto u : ans)
    res += u;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 5932
N = gets.to_i
line = gets
data = line.split(" ")
count = Hash.new
data.each do |item|
  item = item.to_i
  [-1, 0, 1].each do |i|
    if !count.key?(item + i)
      count[item + i] = 1
    else
      count[item + i] += 1
    end
  end
end
p count.max{|x, y| x[1] <=> y[1]}[1]

Measured memory_bytes: 16004
// Aizu Vol-1 0194: Delivery Company
// 2017.8.28 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX 20
#define QMAX 100000
int H, V, D;
int light[MAX+2][MAX+2];
char rc[MAX+2][MAX+2][MAX+2][MAX+2];
int jam[MAX+2][MAX+2][MAX+2][MAX+2];
int s[2], g[2];
int time[MAX+2][MAX+2][102][4];
#define E 0
#define N 1
#define W 2
#define S 3

typedef struct { int h, v, t, d; } QUE;
QUE Q[QMAX+3], *top, *end, *qmax = Q+QMAX;

int m[4][4] = { {-1,0,N,S}, {1,0,S,N}, {0,1,E,W}, {0,-1,W,E} };

int available(int t, int ha, int va, int hf, int vf)
{
	int ns, T, odd;
	if ((T = light[ha][va]) == 0) return 1;
	ns = (vf == va), odd = (t/T) & 1;
	if (ns && odd) return 0;
	if (!ns && !odd) return 0;
	return 1;
}

void getHV(char *p, int *h, int *v)
{
	*h = *p - 'a' + 1;
	p += 2, *v = 0;
	if (*p >= '0' && *p <= '9') *v = *p++ - '0';
	if (*p >= '0' && *p <= '9') *v = *v * 10 + *p - '0';
}

int main()
{
	int n, k, h1, v1, h2, v2, t1, t2, d1, d2;
	char b1[10], b2[10];

	while (scanf("%d%d", &H, &V) && H) {
		memset(light, 0, sizeof(light)), memset(rc, 0, sizeof(rc));
		memset(jam, 0, sizeof(jam)), memset(time, 0, sizeof(time));
		scanf("%d%d", &D, &n); while (n-- > 0) {
			scanf("%s%d", b1, &k);
			getHV(b1, &h1, &v1), light[h1][v1] = k;
		}
		scanf("%d", &n); while (n-- > 0) {
			scanf("%s%s", b1, b2);
			getHV(b1, &h1, &v1), getHV(b2, &h2, &v2);
			rc[h1][v1][h2][v2] = rc[h2][v2][h1][v1] = 1;
		}
		scanf("%d", &n); while (n-- > 0) {
			scanf("%s%s%d", b1, b2, &k);
			getHV(b1, &h1, &v1), getHV(b2, &h2, &v2);
			jam[h1][v1][h2][v2] = jam[h2][v2][h1][v1] = k;
		}
		scanf("%s%s", b1, b2);
		getHV(b1, s, s+1), getHV(b2, g, g+1);	// start, goal
		
		top = end = Q;
		end->h = s[0], end->v = s[1], end->t = 0, end->d = E, end++;
		while (top < end) {
			h1 = top->h, v1 = top->v, t1 = top->t, d1 = top->d; if (++top >= qmax) top = Q;
//			printf("(%d,%d), t %d, d %d\n", h1, v1, t1, d1);
			for (k = 0; k < 4; k++) {
				h2 = h1+m[k][0], v2 = v1+m[k][1], d2 = m[k][2];
				if (h2 <= 0 || h2 > H || v2 <= 0 || v2 > V || d1 == m[k][3]) continue;
				if (rc[h1][v1][h2][v2]) continue;
				if ((t2 = t1 + D + jam[h1][v1][h2][v2]) > 100) continue;
				if (!available(t2, h2, v2, h1, v1)) continue;
				if (time[h2][v2][t2][d2]) continue;
				time[h2][v2][t2][d2] = 1;
				end->h = h2, end->v = v2, end->t = t2, end->d = d2; if (++end >= qmax) end = Q;
			}
		}
		for (t1 = 0; t1 <= 100; t1++) for (d1 = 0; d1 < 4; d1++) {
			if (time[g[0]][g[1]][t1][d1]) { printf("%d\n", t1); t1 = 101; break; }
		}
	}
	return 0;
}

Measured memory_bytes: 3496
n = int(input())
mod = 10**9+7
n_prime = [[2,0]]
x = 1
ans = 1
for i in range(2,n+1):
  for j in range(x):
    while(i % n_prime[j][0] == 0):
      n_prime[j][1] += 1
      i /= n_prime[j][0]
  if i != 1:
    n_prime.append([i,1])
    x += 1
for k in range(x):
  ans = ans * (n_prime[k][1]+1) % mod
print(ans)

Measured memory_bytes: 42096
#include <iostream>

using namespace std;

void print3times(char c);

int main()
{
    char abc_time[3];
    int i;

    cin >> abc_time;

    if(abc_time[0] < abc_time[1] || (abc_time[0] == abc_time[1] && abc_time[0] < abc_time[2])){
        print3times(abc_time[0]+1);
    }else{
        print3times(abc_time[0]);
    }

    return 0;

}

void print3times(char c)
{
    int i;

    for(i = 0; i < 3; i++){
        cout << c;
    }

    cout << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#define pi 3.14159
using namespace std;

long long int fact(long long int n) {
	if(n == 1) return 1;
	else return n * fact(n - 1);
}

int main() {
	long long int n;
	cin >> n;
	cout << fact(n) <<endl;

	

	return 0;
}

Measured memory_bytes: 1156
r=j=x=1
M=10**9+7
`sed 1d`.split.map{x=$*[k=_1.to_i]||x+1
$*[k]=$.+=1}.map{|i|p (-j+r=r*($.+1-i)%M*s=i.pow(M-2,M))%M
j=j*(x-i)*s%M}

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

using ll = long long;

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

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

int main(){
  long long N, D, A; cin >> N >> D >> A;
  D *= 2;
  vector<pair<long long, long long>> P;
  rep(i, N) {
    int X, H; cin >> X >> H;
    P.emplace_back(X, H);
  }

  sort(P.begin(), P.end());

  queue<pair<int, int>> q;
  long long damage = 0;

  long long ans = 0;
  rep(i, N) {
    long long X, H;
    tie(X, H) = P[i];
    while (!q.empty()) {
      if (q.front().first >= X) break;
      damage -= q.front().second * A;
      q.pop();
    }
    if (H <= damage) continue;
    H -= damage;
    long long t = (H + A - 1) / A;
    ans += t;
    q.push(make_pair(X + D, t));
    damage += t * A;
  }

  cout << ans << endl;
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
#define N 200000
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n; ll a[N],ans;
int main()
{
	n=read(); ans=1000000000000000ll;
	for(int i=1;i<=n;i++) a[i]=read(),a[i]+=a[i-1];
	for(int i=1;i<n;i++)
		ans=min(ans,abs(a[i]-a[n]+a[i]));
	cout << ans << endl;
	return 0 ;
}

Measured memory_bytes: 1792
n, k = map(int,input().split())
l = set(map(str, input().split()))
x = list(set(['0','1','2','3','4','5','6','7','8','9']) - l)
y = len(str(n))

from itertools import product
z = list(product(x, repeat = y))
z += list(product(x, repeat = y + 1))

for i in range(len(z)):
    z[i] = int(''.join(z[i]))

z.sort()
for j in z:
    if j >= n:
        print(j)
        break

Measured memory_bytes: 9824
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n,m,memo;
  cin >> n >> m;
  
  if(n>m) {
    memo = n;
    n = m;
    m = memo;
  }
  
  if(n==1 && m==1){
    cout << 1 << endl;
    return 0;
  }
  if(n==1){
    cout << m-2 << endl;
    return 0;
  }
  cout << (n-2)*(m-2) << endl;
  return 0;
}


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

int judge(string s){
    int counter = 0;
    if(s[0] == '1') counter++;
    if(s[1] == '1') counter++;
    if(s[2] == '1') counter++;
    return counter;
}

int main() {
    string a;
    cin >> a;
    cout << judge(a) << endl;
}



Measured memory_bytes: 256
count = [0,0,0,0,0]
a1,b1=map(int,input().split())
count[a1]=count[a1]+1
count[b1]=count[b1]+1
a1,b1=map(int,input().split())
count[a1]=count[a1]+1
count[b1]=count[b1]+1
a1,b1=map(int,input().split())
count[a1]=count[a1]+1
count[b1]=count[b1]+1

if max(count)== 3:
	print("NO")
else:
	print("YES")

Measured memory_bytes: 3064
n, k, c = list(map(int, input().split()))
s = input()
l1 = [None] * k
l2 = [None] * k
i = 0
j = 0
while j<k and i<n:
    if s[i]=="o":
        l1[j] = i
        i += (c+1)
        j += 1
    else:
        i += 1
i = n-1
j = k-1
while j>=0 and i>=0:
    if s[i]=="o":
        l2[j] = i
        i -= (c+1)
        j -= 1
    else:
        i -= 1
for item1, item2 in zip(l1, l2):
    if item1==item2:
        print(item1+1)

Measured memory_bytes: 57292
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
}

int main(void) {

  ll a, b, n, m;
  cin >> a >> b >> n;
  ll ans = 0;
  if (n >= b-1) m = b;
  else m = n + 1;
  ans = (a*(m-1LL)/b)-a*((m-1LL)/b);
  cout << ans << endl;
}


Measured memory_bytes: 3580
import collections
n=int(input())
s=[None]*n
for i in range(n):
    s[i]=input()
c=collections.Counter(s)
print("AC x " + str(c["AC"]))
print("WA x " + str(c["WA"]))
print("TLE x " + str(c["TLE"]))
print("RE x " + str(c["RE"]))

Measured memory_bytes: 16224
{-# OPTIONS_GHC -O #-}

import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main = do
    n<-readLn :: IO Int
    (a:a1s) <- unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    a2s <- unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    --
    print $ (\(a,b) -> max a b) $ solve a a a1s a2s

solve :: Int -> Int -> [Int] -> [Int] -> (Int,Int)
solve a b [] (l:_) = (a+l,b+l)
solve a b (a1:a1s) (b1:b1s) = solve (a+a1) (max (a+b1) (b+b1)) a1s b1s


Measured memory_bytes: 508
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll INF=1e18;

int main()
{
    ll n;
    cin >> n;
    vector<ll> p(n);
    ll ans=0;
    rep(i,n){
        cin >> p[i];
        ans+=p[i];
    }
    sort(p.rbegin(),p.rend());
    ans-=p[0]/2;
    cout << ans << endl;
    return 0;
} 

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

const ll mod = 1e9+7;

ll dp[200010][2][2];

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

  int n = sz(s);
  dp[0][0][1] = 1;
  rep(i,n) {
    const int sD = s[i] - '0'; 
    if (t[i] == '?') {
      rep(j,2) {
        for (int d = 0; d <= (j ? 9 : sD); d++) {
          (dp[i+1][j||(d<sD)][0] += dp[i][j][0] * 10 + d * dp[i][j][1]) %= mod;
          (dp[i+1][j||(d<sD)][1] += dp[i][j][1]) %= mod;
        }
      }
    } else {
      const int tD = t[i] - '0';
      rep(j,2) {
        if (sD < tD && j == 0) continue;
        (dp[i+1][j||(tD<sD)][0] += dp[i][j][0] * 10 + tD * dp[i][j][1]) %= mod;
        (dp[i+1][j||(tD<sD)][1] += dp[i][j][1]) %= mod;
      }
    }
  }
  cout << (dp[n][0][0] + dp[n][1][0]) % mod << endl;
  return 0;
} 


Measured memory_bytes: 9696
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,i,j;
int main()
{
	cin>>n>>m;
	if (m<n) swap(n,m); 
	if (n==1)
	{
		if (m==1)
		{
			cout<<1;
			return 0;
		}
		cout<<m-2;
		return 0;
	}
	if (n==2)
	{
		cout<<0;
		return 0;
	}
	cout<<(n-2)*(m-2);
	return 0; 
}

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





int main(){
  int n;
  cin>>n;
  int dp[100010]={};
  
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    for(int t=a;t<b+1;t++){dp[t]++;}
  }
  
  int mx=0;
  for(int i=n+1;i>1;i--){
    if(dp[i]>=i-1){mx=i-1; break;}
  }
  cout<<mx<<endl;
  
    
  return 0;
}



Measured memory_bytes: 3488
using System;
using System.Linq;
namespace AISing.Problems
{
    class D
    {
        static void Main()
        {
            int[] pc = new int[300000];
            for (int d = 0; d < pc.Length; d++)
            {
                int cnt = 0;
                int m = d;
                while (m != 0)
                {
                    if (m % 2 == 1) cnt++;
                    m /= 2;
                }
                pc[d] = cnt;
            }

            int n = int.Parse(Console.ReadLine());
            char[] cs = Console.ReadLine().ToCharArray();

            int pcX = cs.Count(c => c == '1');

            if (pcX == 1)
            {
                if (cs[n-1] == '1')
                {
                    for (int i = 0; i < n-1; i++)
                    {
                        Console.WriteLine(2);
                    }
                    Console.WriteLine(0);
                }
                else
                {
                    for (int i = 0; i < n-1; i++)
                    {
                        if (cs[i] == '1') Console.WriteLine(0);
                        else Console.WriteLine(1);
                    }
                    Console.WriteLine(2);
                }
            }
            else
            {
                int xModPcXp1 = 0;
                int xModPcXm1 = 0;
                foreach (var c in cs)
                {
                    xModPcXp1 = (xModPcXp1 * 2) % (pcX + 1);
                    xModPcXp1 = c == '1' ? (xModPcXp1 + 1) % (pcX + 1) : xModPcXp1;

                    xModPcXm1 = (xModPcXm1 * 2) % (pcX - 1);
                    xModPcXm1 = c == '1' ? (xModPcXm1 + 1) % (pcX - 1) : xModPcXm1;
                }
                int[] exp2ModPcXp1 = new int[n];
                int[] exp2ModPcXm1 = new int[n];
                exp2ModPcXp1[0] = 1 % (pcX + 1);
                exp2ModPcXm1[0] = 1 % (pcX - 1);
                for (int i = 1; i < n; i++)
                {
                    exp2ModPcXp1[i] = exp2ModPcXp1[i-1] * 2 % (pcX + 1);
                    exp2ModPcXm1[i] = exp2ModPcXm1[i-1] * 2 % (pcX - 1);
                }

                for (int i = 0; i < n; i++)
                {
                    int res = 1;
                    if (cs[i] == '0')
                    {
                        int y = (xModPcXp1 + exp2ModPcXp1[n-i-1]) % (pcX + 1) ;
                        while (y != 0)
                        {
                            res++;
                            y %= pc[y];
                        }
                    }
                    else
                    {
                        int y = (xModPcXm1 - exp2ModPcXm1[n-i-1]) % (pcX - 1);
                        y = (y + (pcX - 1)) % (pcX - 1);
                        while (y != 0)
                        {
                            res++;
                            y %= pc[y];
                        }
                    }
                    Console.WriteLine(res);
                }
            }
            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 31828
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    
    let y = n / 100;
    let m = n % 100;
    
    let yy = 1 <= y && y <= 12;
    let mm = 1 <= m && m <= 12;
    
    if yy && mm {
        println!("AMBIGUOUS");
    } else if yy {
        println!("MMYY");
    } else if mm {
        println!("YYMM");
    } else {
        println!("NA");
    }
    
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
long long p  = 998244353;
//long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}
#define end_s(a) cout <<a<<endl;return 0
int sol(int val, vel &a) {
	int m = a.size();
	vel b(m + 2);
	b[0] = a[0]; b[m + 1] = a[m - 1];
	rep(i, m) { b[i + 1] = a[i]; }
	m += 2;
	rep(i,m){
		if (b[i] <= val) { b[i] = 0; }
		else { b[i] = 1; }
	}
	int n = m / 2;
	if (b[n - 1] == b[n] || b[n + 1] == b[n]) { return b[n]; }
	pin lef;
	rep(i, n) {
		if (b[i] == b[i + 1]) { lef = mkp(i, b[i]); }
	}
	pin ri;
	for (int i = m - 1; i > n; i--) {
		if (b[i] == b[i - 1]) { ri = mkp(i, b[i]); }
	}
	if (lef.first + ri.first >= 2 * n) { return lef.second; }
	else { return ri.second; }
}
signed main(){
	int n, q; cin >> n >> q;
	if (q == 0) {
		rep(i, n) { cout << 1 << endl; }
		return 0;
	}
	vel a(q);
	a[0] = n;
	rep(i, q - 1) { cin >> a[i + 1]; }
	rev(a);
	int now_max = 1; int now_mod; cin >> now_mod;
	map<int,int> se;
	rep(i, q) {
		int nex_mod = a[i];
		int nex_max = now_max * (now_mod / nex_mod);
		se[now_mod%nex_mod]+=now_max;
		auto itr = se.lower_bound(nex_mod);
		while (itr != se.end()) {
			int val = itr->first;
			itr++;
			se[val%nex_mod] += se[val];
			nex_max += se[val] * (val / nex_mod);
			se.erase(val);
		}
		now_max = nex_max; now_mod = nex_mod;
	}
	vel ans(n, 0);
	auto itr = se.begin();
	while (itr != se.end()) {
		int val = itr->first;
		itr++;
		if (val != 0) {ans[val - 1] += se[val];}
	}
	ans[n - 1] += now_max;
	for (int i = n - 2; i >= 0; i--) { ans[i] += ans[i + 1]; }
	rep(i, n) { cout << ans[i] << endl; }
	return 0;
}

Measured memory_bytes: 10624
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;
//abc168

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int x=n%10;
    if(x==3) cout<<"bon"<<endl;
    else if(x==0||x==1||x==6||x==8) cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

Measured memory_bytes: 3652
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

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

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

use std::collections::HashSet;

fn main() {
    input!{n: usize, ws: [chars;n]}
    let mut set = HashSet::new();
    set.insert(ws[0].clone());
    for i in 1..n {
        let tmp = ws[i].clone();
        let before = ws[i-1][ws[i-1].len()-1];
        let after  = ws[i][0];
        if before != after || set.contains(&tmp) {
            println!("No"); return;
        }
        set.insert(tmp);
    }
    println!("Yes");
}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

struct Point { double x,y; };
typedef pair<double,int> di;
typedef pair<double,double> Segment;
const int MAX_N = 2010;
const int IINF = INT_MAX;
int N;
double sx[MAX_N],sy[MAX_N],ex[MAX_N],ey[MAX_N];

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }
inline bool inside(double a,double b,double c) { return LTE(a,c) && LTE(c,b); }
inline double getDist(double x,double y) { return sqrt(x*x+y*y); }

int main(){
  cin >> N;
  vector<Segment> segs(N);
  rep(i,N) {
    cin >> sx[i] >> sy[i] >> ex[i] >> ey[i];
    vector<Point> vec(4);
    vec[0] = (Point){sx[i],sy[i]};
    vec[1] = (Point){sx[i],ey[i]};
    vec[2] = (Point){ex[i],sy[i]};
    vec[3] = (Point){ex[i],ey[i]};
    segs[i] = Segment(IINF,-IINF);
    rep(j,4){
      double arg = atan2(vec[j].y,vec[j].x) * 180 / M_PI;
      if( LT(arg,0.0) ) arg += 360;
      if( sx[i] > 0 && sy[i] < 0 && ey[i] >= 0 ) {
        if( LTE(0.0,arg) && LTE(arg,91.0) ) arg += 360;
      } 
      segs[i].first  = min(segs[i].first ,arg);
      segs[i].second = max(segs[i].second,arg);
    }
  }

  sort(segs.begin(),segs.end());
  rep(i,N) segs.push_back(Segment(segs[i].first+360,segs[i].second+360));
  int ans = N;
  rep(i,N){
    int cost = 0;
    double L,R;
    REP(j,i,i+N){
      cost++;
      L = segs[j].first, R = segs[j].second;
      while( j+1 < i+N && ( inside(L,R,segs[j+1].first) || inside(L,R,segs[j+1].second) ) ){
        j++;
        L = max(L,segs[j].first);
        R = min(R,segs[j].second);
      }
    }
    ans = min(ans,cost);
    }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1476