akhauriyash/Code-Regression huggingface dataset:
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e15;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

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


void solve()
{
    string s;
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='7')
        {
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}


int32_t main()
{
    
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef vector<pair<int,string> > vpis;
int parse(const vpis &v,int l,int r){
	if(v[l].second!="+"&&v[l].second!="*")return strtol(v[l].second.c_str(),NULL,10);
	int unit=v[l].second=="+"?0:1;
	for(int i=l+1;i<r;){
		int j=i+1;
		if(v[i].second=="+"||v[i].second=="*"){
			for(;j<v.size()&&v[j].first>v[i].first;j++);
		}
		int n=parse(v,i,j);
		i=j;
		if(v[l].second=="+")unit+=n;
		else unit*=n;
	}
	return unit;
}
int main(){
	int N;
	string s;
	for(;cin>>N,N;){
		vpis v(N);
		for(int i=0;i<N;i++){
			cin>>s;
			int idx=0;
			for(;s[idx]=='.';idx++);
			v[i]=make_pair(idx,s.substr(idx));
		}
		printf("%d\n",parse(v,0,N));
	}
}

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


int main() {
  long long N;
  cin>>N;
  
  vector<long long> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  long long sum=0;
  for(int i=0;i<N;i++){
    while(vec.at(i)%2==0){
      sum++;
      vec.at(i)=vec.at(i)/2;
    }
  }
  cout<<sum<<endl;
  
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
int Cnt[1001000];
int main()
{
  int N;
  cin>>N;
  for(int i=1;i<=100;i++)
    for(int j=1;j<=100;j++)
      for(int k=1;k<=100;k++)
        Cnt[i*i+j*j+k*k+i*j+j*k+i*k]++;
  for(int i=1;i<=N;i++)
    cout<<Cnt[i]<<endl;
  return 0;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

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

    int h,w;
    cin >> h >> w;

    int sx,sy,gx,gy;
    cin >> sy >> sx >> gy >> gx;
    sx--;sy--;gx--;gy--;

    string sur[h];

    for(int i = 0; i < h; i++) cin >> sur[i];
    queue<pair<int,int>> p,q;

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

    p.push(make_pair(sx,sy));

    int can = 0;

    while(!p.empty()){
        while(!p.empty()){
            pair<int,int> now = p.front();
            p.pop();
            q.push(now);
            for(int i = 0; i < 4; i++){
                pair<int,int> nxt = make_pair(now.first+dx[i],now.second+dy[i]);
                if(0 <= nxt.first && nxt.first < w && 0 <= nxt.second && nxt.second < h){
                    if(sur[nxt.second][nxt.first] == '.'){
                        if(nxt == make_pair(gx,gy)){
                            cout << can << endl;
                            return 0;
                        }
                        p.push(nxt);
                        sur[nxt.second][nxt.first] = '#';
                    }
                }
            }
        }
        can++;
        while(!q.empty()){
            pair<int,int> now = q.front();
            q.pop();
            for(int i = -2; i < 3; i++){
                for(int j = -2; j < 3; j++){
                    pair<int,int> nxt = make_pair(now.first+i,now.second+j);
                    if(0 <= nxt.first && nxt.first < w && 0 <= nxt.second && nxt.second < h){
                        if(sur[nxt.second][nxt.first] == '.'){
                            if(nxt == make_pair(gx,gy)){
                                cout << can << endl;
                                return 0;
                            }
                            p.push(nxt);
                            sur[nxt.second][nxt.first] = '#';
                        }
                    }
                }
            }
        }
    }

    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 4760
#include <cstdio>
#include <vector>
#include <map>

using namespace std;

typedef long long ll;

int main() {
    vector< pair<ll, ll> > b = {{0, 0}};
    ll n;
    scanf("%lld", &n);
    if (!n) {
        printf("0\n");
        return 0;
    }
    while (-b.back().first > n || b.back().second < n) {
        if (b.size() % 2) b.push_back({b.back().first, b.back().second + (1LL << (b.size() - 1))});
        else b.push_back({b.back().first + (1LL << (b.size() - 1)), b.back().second});
    }
    for (ll i = b.size() - 1; i >= 1; --i) {
        if ((-b.at(i).first <= n && -b.at(i - 1).first > n) || (b.at(i).second >= n && b.at(i - 1).second < n)) {
            printf("1");
            n -= (i % 2 ? 1 : -1) * (1LL << (i - 1));
        } else printf("0");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int n;
		int m;
		String id_str;
		int[] a = new int[10];

		int[] dp = new int[10];
		int[] dp_temp = new int[10];
		Arrays.fill(dp, 0);
		dp[0] = 1;
		Arrays.fill(dp_temp, 0);

		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		id_str = sc.next();
		m = sc.nextInt();
		for(int i=0; i<m; i++) a[i] = sc.nextInt();

		sc.close();

		char[] id_char = new char[n];
		id_char = id_str.toCharArray();

		for(int i=0; i<n; i++){

			Arrays.fill(dp_temp, 0);

			if(id_char[n-1-i] == '*'){
				for(int j=0; j<m; j++){
					if(i%2==0){
						for(int k=0; k<10; k++){dp_temp[(k+a[j])%10] += dp[k];}
					}else{
						for(int k=0; k<10; k++){dp_temp[(k+a[j]*2-9*(a[j]/5))%10] += dp[k];}
					}
				}
			}else{
				if(i%2==0){
					for(int k=0; k<10; k++){dp_temp[(k+(id_char[n-1-i]-'0'))%10] = dp[k];}
				}else{
					for(int k=0; k<10; k++){dp_temp[(k+(id_char[n-1-i]-'0')*2-9*((id_char[n-1-i]-'0')/5))%10] = dp[k];}
				}

			}

			for(int k=0; k<10; k++){
				dp[k] = dp_temp[k];
			}
		}

		System.out.println(dp[0]);
	}
}

Measured memory_bytes: 25712
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
int main(){
   string s, last="";
   cin >> s;
   map<string, int> m;
   int n = s.size();
   int cnt=0, ans=0;
   for(cnt = 0; cnt < n; cnt++){
       string x = s.substr(cnt, 1);
       if(last==x&&cnt < n-1){
         x = s.substr(cnt, 2);
         cnt++;  
       }
       if(last != x) ans++;
       last = x;
   }
   cout << ans << endl;
}

    



Measured memory_bytes: 640
#include<cmath>
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	char a;
	cin>>a;
	if(a=='a' || a=='e' || a=='i' || a=='o' || a=='u')
	{
		printf("vowel\n");
	}
	else
	printf("consonant\n");
	return 0;
}

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

using namespace std;

int main(){
    double N,K,ans=0;
    cin >> N >> K;

    for(int i=1;i<N+1;i++){
        double count=0,num=i;
        while(num<K){
            num*=2;
            count++;
        }
        ans += 1.0/pow(2,count)/N;
    }

    cout << setprecision(14) << ans << endl;
}

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

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

    ll z;
    ll max_value = a * c;

    z = a * d;
    max_value = max(max_value, z);

    z = b * c;
    max_value = max(max_value, z);

    z = b * d;
    max_value = max(max_value, z);

    cout << max_value << endl;

    return 0;
}

Measured memory_bytes: 3632
N = int(input())

ans = 0

d = 2
while d * d <= N:
  e = 0
  while N % d == 0:
    e += 1
    N //= d
  i = 1
  while i <= e:
    ans += 1
    e -= i
    i += 1
  d += 1

if N > 1:
  ans += 1
print(ans)



Measured memory_bytes: 8936
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const int INF=1e7;
const LL LINF=1e18;

int main(){
    int H,W;
    cin >> H >> W;
    char s[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> s[i][j];
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(s[i][j]=='#'){
                if(s[i-1][j]=='#'&&s[i][j-1]=='#'&&i-1>0&&j-1>0){
                    puts("Impossible");
                    return 0;
                }
                if(s[i+1][j]=='#'&&s[i][j+1]=='#'&&i+1>0&&j+1>0){
                    puts("Impossible");
                    return 0;
                }
            }
        }
    }
    puts("Possible");
    return 0;
}

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

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

    int N, M;
    cin >> N >> M;
    vector<int64_t> A(N);
    vector<pair<int64_t, int64_t> > CB(M);
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < M; i++) cin >> CB[i].second >> CB[i].first;

    sort(CB.rbegin(), CB.rend());
    
    priority_queue<int64_t> que;
    for(int i = 0; i < M; i++){
        for(int j = 0; j < CB[i].second; j++){
            que.push(CB[i].first);
            if(que.size() == N) break;
        }
        if(que.size() == N) break;
    }
    for(int i = 0; i < N; i++) que.push(A[i]);

    int64_t ans = 0;
    for(int i = 0; i < N; i++){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4724
#include<bits/stdc++.h>
#define LL long long
using namespace std;

const int N = 105;

int n, h[N];
LL ans = 1, mod = 1e9 + 7;
struct node {
	LL x, y;
};

LL fsp(LL a, LL b) {
	LL rst = 1;
	while(b > 0) {
		if(b&1) rst = rst*a%mod;
		b = b>>1;
		a = a*a%mod;
	}
	return rst;
}

node solve(int l, int r, LL up) {
	int cnt = 0, mi = 1e9 + 5, last = 0;
	node rst;
	for(int i = l; i <= r; i++)
		if(h[i] == mi) cnt++;
	    else if(h[i] < mi) mi = h[i], cnt = 1;
	if(cnt == r - l + 1) {
		rst.x = (fsp(2, mi - up) + fsp(2, r - l + 1) - 2 + mod)%mod;
		rst.y = fsp(2, mi - up);
		return rst;
	}
	LL c1 = 1, c2 = 1;
	for(int i = l; i <= r + 1; i++) {
		if(h[i] > mi && !last) last = i;
		else if(h[i] == mi || i > r) {
			if(!last) continue;
			node tmp = solve(last, i - 1, mi);
			c1 = c1*(tmp.x + tmp.y)%mod;
			c2 = c2*tmp.y%mod;
			last = 0;
		} 
	}
	c1 = (c1*fsp(2, cnt)%mod + c2*(fsp(2, mi - up) - 2 + mod)%mod)%mod;
	c2 = c2*fsp(2, mi - up)%mod;
	rst = (node) {c1, c2};
	return rst;
}

int main() {
    cin>>n;
    for(int i = 1; i <= n; i++) 
    	cin>>h[i];
    for(int i = 1; i <= n; i++)
    	if(h[i] > max(h[i - 1], h[i + 1])) {
    		ans = ans*fsp(2, h[i] - max(h[i - 1], h[i + 1]))%mod;
            h[i] = max(h[i - 1], h[i + 1]);
    	}
    node tmp = solve(1, n, 0);
    cout<<tmp.x*ans%mod<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
    }
    vector<int> a;
    for(int i=0;i<N;i++){
        a.push_back(vec.at(i));
    }
    sort(vec.begin(), vec.end());
    for(int i=0;i<N;i++){
        if(a.at(i)==vec.at(N-1)){
            cout <<vec.at(N-2)<<endl;
            }
            else{
                cout<<vec.at(N-1)<<endl;
                }
            }
}


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int x = sc.nextInt();

        for (int i = x - k + 1; i < x + k; i++ ) {
            System.out.println(i);
        }

        sc.close();
    }
}

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

//#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    bool flag = false;
    string a, b;
    cin >> a >> b;
    if (b.length() != a.length()+1) {
        cout << "No\n";
        exit(0);
    }
    for (int i = 0; i < a.length(); i++) if (a[i] != b[i]) flag = true;
    if (flag) cout << "No\n";
    else cout << "Yes\n";
}
/*

 */

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = (int)(n)-1; i >=0; i--)
#define INF 1000000000000
using ll = long long;

int factorial(int x){
  if(x==1)return 1;
  else return x*factorial(x-1);
}

int main(){
  int n;
  cin >> n;
  vector<double> x(n),y(n);
  rep(i,n)cin >> x.at(i) >> y.at(i);
  //階乗が必要
  double ans = 0;
  int times = factorial(n-1)*2;
  for(int i = 0; i <= n-2; i++){
    for(int j = i+1; j <= n-1; j++){
      int tmp = (x.at(j)-x.at(i))*(x.at(j)-x.at(i)) + (y.at(j)-y.at(i))*(y.at(j)-y.at(i));
      ans += sqrt(tmp)*times;
    }
  }
  ans/=factorial(n);
  cout<<setprecision(20)<<ans<<endl;
  return 0;
}


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

int32_t main()
{
	string s;
	cin>>s;
	string t;
	cin>>t;
	int len = s.length();
	int len2 = t.length();
	for(int i=0;i<len;i++)
	{
		if(s[i] != t[i])
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;



}

Measured memory_bytes: 3592
# -*- coding: utf-8 -*-

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
S = input()
A = [0] * N
for i, s in enumerate(S):
    if s == 'G':
        A[i] = 1
    elif s == 'B':
        A[i] = 2

acc = list2d(3, N, 0)
for i, a in enumerate(A):
    acc[a][i] = 1
for i in range(3):
    acc[i] = list(accumulate(acc[i][::-1]))[::-1]

ans = 0
for i, a1 in enumerate(A):
    for j in range(i+1, N):
        a2 = A[j]
        if a1 == a2:
            continue
        a3 = 3 - a1 - a2
        cnt = acc[a3][j]
        dist = j - i
        if j + dist < N and A[j+dist] == a3:
            cnt -= 1
        ans += cnt
print(ans)


Measured memory_bytes: 68632
import java.util.*;

public class Main{ 
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    
    char[] list = S.toCharArray();
    
    int count = 0;
    int countMax = 0;
    
    for(int i = 0; i < list.length; ++i){
      if(list[i] == 'A' || list[i] == 'C' || list[i] == 'G' || list[i] == 'T'){
        count++;
        for(int j = i+1; j < list.length; ++j){
          if(list[j] == 'A' || list[j] == 'C' || list[j] == 'G' || list[j] == 'T'){
            count++;
          }
          else{
             break; 
          }
        }
      }
      if(countMax < count){
         countMax = count;
      }     
      count = 0;
    }
    

      
     System.out.println(countMax);
  }
} 


Measured memory_bytes: 35540
#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100];
int dp[100001][2]; 
// dp[number of remain stone][player id] = winner
// {player id : {First: 0, Second: 1}}
// {winner : {0: First, 1: Second, -1: unknown}}

int dfs(int stones, int player){
  if(dp[stones][player] != -1) return dp[stones][player];
  bool win = false;
  for(int i=0;i<n && (!win);i++){
    if(stones - a[i] >= 0){
      if(dfs(stones-a[i], (player+1)%2) == player)
        win = true;
    }
  }
  if(win) dp[stones][player] = player;
  else dp[stones][player] = (player+1)%2;
  return dp[stones][player];
}


int main(){
  cin >> n >> k;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<=k;i++){
    dp[i][0] = -1;
    dp[i][1] = -1;
  }
  for(int i=0;i<a[0];i++){
    dp[i][0] = 1;
    dp[i][1] = 0;
  }
  cout << (dfs(k, 0) == 0?"First":"Second") << endl;
}

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

int ctoi(char c){
  if(c=='0') return 0;
  else if(c=='1') return 1;
  else if(c=='2') return 2;
  else if(c=='3') return 3;
  else if(c=='4') return 4;
  else if(c=='5') return 5;
  else if(c=='6') return 6;
  else if(c=='7') return 7;
  else if(c=='8') return 8;
  else if(c=='9') return 9;
}

int main() {

  string s;
  cin >> s;

  bool m1,m2;

  int s1 = ctoi(s[0])*10 + ctoi(s[1]);
  int s2 = ctoi(s[2])*10 + ctoi(s[3]);

  //cout << s1 << "\n" << s2;

  m1 = (1 <= s1 && s1 <= 12);
  m2 = (1 <= s2 && s2 <= 12);

  if(m1 && m2) cout << "AMBIGUOUS";
  else if(m1 && !m2) cout <<"MMYY";
  else if(!m1 && m2) cout << "YYMM";
  else if(!m1 && !m2) cout << "NA";

  return 0;
}


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


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Date;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);

	int debt=100000;
	double temp;

	int n=sc.nextInt();
	
  	for(int i=0;i<n;i++){
	    temp=debt*1.05;
	    if(temp%1000>0){
		temp=temp-temp%1000+1000;
	    }
	    debt=(int)temp;
    	}
	System.out.println(debt);
    }
}

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

int main() {
    int N, n1,n2,n3,n4;
    cin >> N ;

    n1 = N % 10;

    N /= 10;
    n2 = N % 10;

    N /= 10;
    n3 = N % 10;

    N /= 10;
    n4 = N % 10;
    
    if ((n1 == n2 && n2 == n3) || (n2 == n3 && n3 == n4))
        cout << "Yes" << endl;
    else 
        cout << "No"<< endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N; cin >> N;
    bool flag = false;
    rep(i, 0, N){
        char S; cin >> S;
        if(S == 'Y') flag = true;
    }
    if(flag) cout << "Four" << endl;
    else cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int seki = a * b;
		if(seki % 2 == 0) {
			System.out.println("Even");
		}else {
			System.out.println("Odd");
		}
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll MOD = 1e9+7;

class mint{
    ll n;
public:
    mint(ll m = 0){
        n = ((m % MOD) + MOD) % MOD;
    }
    mint operator-() const {
        return mint(-n);
    }
    mint& operator+=(const mint& m){
        n += m.n;
        if(n >= MOD) n -= MOD;
        return *this;
    }
    mint& operator-=(const mint& m){
        n += MOD - m.n;
        if(n >= MOD) n -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& m){
        n *= m.n;
        n %= MOD;
        return *this;
    }
    mint operator+(const mint& m) const{
        mint res(*this);
        res += m;
        return res;
    }
    mint operator-(const mint& m) const{
        mint res(*this);
        res -= m;
        return res;
    }
    mint operator*(const mint& m) const{
        mint res(*this);
        res *= m;
        return res;
    }
    mint pow(ll t) const{
        if(t == 0) return mint(1);
        mint m = pow(t>>1);
        m *= m;
        if(t & 1 == 1) m *= *this;
        return m;
    }
    // for prime modulo
    mint inv() const{
        return pow(MOD-2);
    }
    mint& operator/=(const mint& m){
        (*this) *= m.inv();
        n %= MOD;
        return *this;
    }
    mint operator/(const mint& m) const{
        mint res(*this);
        res /= m;
        return res;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.n;
        return os;
    }
};

mint dp[110][10];
ll H,W,K;
mint p[10][3];

int main(){
    cin >> H >> W >> K;
    dp[0][0] = mint(1);
    for(int i=0;i<(1<<(W-1));i++){
        bitset<10> bt(i);
        bool f = true;
        for(int j=1;j<(W-1);j++){
            if(bt[j-1] == 1 && bt[j] == 1) f = false;
        }
        if(!f) continue;
        for(int j=0;j<W;j++){
            if(j == 0){
                if(bt[0] == 1) p[0][2] += mint(1);
                else p[0][0] += mint(1);
                continue;
            }
            if(j == W-1){
                if(bt[W-2] == 1) p[W-1][1] += mint(1);
                else p[W-1][0] += mint(1);
                continue;
            }
            if(bt[j-1] == 0 && bt[j] == 0){
                p[j][0] += mint(1);
                continue;
            }
            if(bt[j-1] == 1) p[j][1] += mint(1);
            else p[j][2] += mint(1);
        }
    }
    for(int i=1;i<W;i++) dp[0][i] = mint(0);
    for(int h=1;h<=H;h++){
        for(int w=0;w<W;w++){
            dp[h][w] = dp[h-1][w] * p[w][0];
            if(w > 0) dp[h][w] += dp[h-1][w-1] * p[w][1];
            if(w < W-1) dp[h][w] += dp[h-1][w+1] * p[w][2];
        }
    }
    cout << dp[H][K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
b = list(a)
b.sort()
s, t = 0, 0
for i in range(n):
    x = bisect.bisect_left(b, a[i])
    if i % 2 == 0 and x % 2 == 1:
        s += 1
    elif i % 2 == 1 and x % 2 == 0:
        t += 1
print(max(s, t))

Measured memory_bytes: 8296
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> 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)*}
    };
}

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, 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")
    };
}

fn main() {
    input! {
        N: usize,
        K: usize,
        ps: [i64; N],
    }
    use std::cmp::max;
    let mut ans = 0;
    let ps2: Vec<_> = ps.iter().map(|x| x + 1).collect();
    let mut cursum = vec![0; N+1];
    for i in 0..N {
        cursum[i+1] = cursum[i] + ps2[i];
    }

    let mut ans = 0;
    for i in 0..(N - K + 1) {
        ans = max(ans, cursum[i + K] - cursum[i]);
    }
    println!("{}", ans as f64 / 2.0);
}


Measured memory_bytes: 10492
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int n = stdIn.nextInt();
        int k = stdIn.nextInt();
        //int b = stdIn.nextInt();
        //int num[] = new int[3];
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        //boolean flag = true;
        
        if(n % k == 0){
            System.out.println(0);
        }else{
            System.out.println(1);
        }
        
        //System.out.println();
        //System.out.print();
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

void solve(int n){
    vector<int> A(n), B(n);
    for (auto &&i : A) scanf("%d", &i);
    for (auto &&i : B) scanf("%d", &i);
    sort(A.begin(),A.end(), greater<>());
    sort(B.begin(),B.end(), greater<>());
    int cur = 0;
    for (int i = 1; i < n; ++i) {
        if(A[i-1] <= B[cur]) cur++;
        if(i-i/2 > cur) {
            cout << i << "\n";
            return;
        }
    }
    puts("NA");
}

int main() {
    int n;
    while(cin >> n, n) solve(n);

    return 0;
}


Measured memory_bytes: 3340
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
from pprint import pprint
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, S = MAP()
graph = [[] for _ in range(N)]
for _ in range(M):
	U, V, A, B = MAP()
	graph[U-1].append((V-1, A, B))
	graph[V-1].append((U-1, A, B))

C, D = ZIP(N)

def Extdijkstra(E, start):
    global S
    N_d = len(E)
    M = 2500
    if S >= M: S = M-1
    dist = [[INF]*M for _ in range(N_d)]
    dist[start][S] = 0
    q = [(0, S, start)]

    while q:
        d, num, v = heappop(q)
        if num+C[v] < M and d+D[v] < dist[v][num+C[v]]:  # 自己ループ
            dist[v][num+C[v]] = d+D[v]
            heappush(q, (d+D[v], num+C[v], v))
        for node, c, t in E[v]:
            if num >= c and d + t < dist[node][num-c]:
                dist[node][num-c] = d+t
                heappush(q, (d+t, num-c, node))
    return dist

d = Extdijkstra(graph, 0)
for i in range(1, N):
	print(min(d[i]))


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int H, W;
char G[20][20];
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int cost[20][20];

int f(int sy, int sx, int gy, int gx) {
  rep(i, H) rep(j, W) cost[i][j] = INF;
  cost[sy][sx] = 0;
  queue<pii> Q;
  Q.push(mp(sx, sy));

  while (!Q.empty()) {
    int x = Q.front().F;
    int y = Q.front().S;
    Q.pop();

    rep(i, 4) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (!(0 <= nx && nx < W && 0 <= ny && ny < H)) continue;
      if (G[ny][nx] == '#') continue;
      if (cost[ny][nx] <= cost[y][x] + 1) continue;
      cost[ny][nx] = cost[y][x] + 1;
      if (nx == gx && ny == gy) return cost[ny][nx];
      Q.push(mp(nx, ny));
    }
  }

  return -1;
}

int main() {
  cin >> H >> W;
  rep(i, H) rep(j, W) cin >> G[i][j];

  int ans = 0;
  rep(i, H) rep(j, W) rep(p, H) rep(q, W) {
    if (G[i][j] == '.' && G[p][q] == '.') ans = max(ans, f(i, j, p, q));
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,M;cin>>N>>M;
    vector<pair<int,int>> work(N);
    REP(i,N) cin>>work[i].first>>work[i].second;
    priority_queue<int> que;
    sort(All(work));
    int ans=0,r=0;
    for(int i=M;i>=0;--i){
        while(r<N&&work[r].first<=M-i) que.push(work[r++].second);
        if(!que.empty()){
            ans+=que.top();
            que.pop();
        }
    }
    cout<<ans<<endl;
}

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

long a(long& b, long c) {
	return c ? a(c, b % c) : b;
}

long b(long& b, long& c) {
	return b * c / a(b, c);
}

int main() {
	long A, B, C, D;
	cin >> A >> B >> C >> D;
	cout << (A - 1) / C - (A - 1) / b(C, D) - A - B / C - B / D + (A - 1) / D + 1 + B + B / b(C, D);
}

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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; }

int main()
{
    string s;
    cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == 'A') a++;
        if (s[i] == 'B') b++;
    }
    if (a == 3 or b == 3) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}



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

int main()
{
  int ans = 1;
  vector<int> x(5);
  for(int i = 0;i < 5;i++){
    cin >> x[i];
    if(x[i] == 0) ans += i;
  }
  cout << ans << endl;
}


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

int a[100005];
bool visited[100005];

int solve(int n)
{
    pair<int, int> p[n];
    
    for (int i = 0; i < n; i++)
    {
        p[i].first = a[i];
        
        // Storing the original position of a[i]
        p[i].second = i;
    }
    
    sort(p, p+n);
    int ans = 0;
    
    for (int i = 0; i < n; i++)
    {	
    	//visited[i]=true indicates that index i belongs to a cycle that is already counted
        
        //p[i].second = i denotes that the ith element was at its correct position
        
        if (visited[i] || p[i].second == i)
            continue;
            
        int cycle_size = 0;
        int j = i;
        
        //Counting the size of the cycle
        while (!visited[j])
        {
            visited[j] = 1;
            j = p[j].second;
            cycle_size++;
        }
        
        ans += (cycle_size - 1);
    }
    
    return ans;
    
}

int main()
{

    int n;
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    
    int ans = solve(n);
    if (ans <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
    
}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()

//#if __cplusplus >= 201103
typedef long long ll;
//#endif
typedef pair<int, int> P;
typedef pair<int, P> IP;

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

const int INF = 100000000;
//#if __cplusplus >= 201103
const ll LINF = 10000000000000000ll;
//#endif
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
// }}}

ll N, M;
vector<int> g[100010];
int color[100010];

void init()
{
}

bool dfs(int v, int c)
{
    color[v] = c;
    for(auto vtx: g[v]){
        if(color[vtx] == c) return false;
        if(color[vtx] == 0 && !dfs(vtx, -c)) return false;
    }
    return true;
}

void solve()
{
    bool bipertite = dfs(0, 1);
    if(!bipertite){
        cout << (N*(N-1))/2 - M << endl;
    }else{
        ll white = 0;
        REP(i, N){
            if(color[i] == 1) white++;
        }
        ll edges = white * (N - white);
        cout << edges - M << endl;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    REP(i, M){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 6528
n, k = map(int,input().split())
mod = 10**9 + 7

combination = [[0]*(2002) for i in range(2002)]
combination[0][0] = 1
for i in range(2001):
    for j in range(2001):
        combination[i + 1][j] += combination[i][j]%mod
        combination[i + 1][j + 1] += combination[i][j]%mod

ans = [0]*(k + 1)
for i in range(1,k + 1):
    ans[i] = combination[n - k + 1][i]*combination[k-1][i-1]
for i in range(1,k + 1):
    print(ans[i]%mod)

Measured memory_bytes: 75516
#include <stdio.h>

int d(int x)
{
	int r = 0;
	while (x){
		r += x % 10;
		x /= 10;
	}
	return r;
}

int main()
{
	int N,mx=0x7fffffff;
	scanf ("%d",&N);
	for (int i=1;i<N;i++){
		int u = d(i) + d(N-i);
		if (mx > u)
			mx = u;
	}
	printf ("%d\n",mx);

	return 0;
}

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

inline bool isYYMM(int a, int b) { return 1 <= b && b <= 12; }
inline bool isMMYY(int a, int b) { return 1 <= a && a <= 12; }

int main() {
  string S;
  cin >> S;
  int n = stoi(S);
  bool yymm = isYYMM(n / 100, n % 100);
  bool mmyy = isMMYY(n / 100, n % 100);
  if(yymm && mmyy) {
    cout << "AMBIGUOUS" << endl;
  } else if(!yymm && !mmyy) {
    cout << "NA" << endl;
  } else {
    if(yymm) {
      cout << "YYMM" << endl;
    } else if(mmyy) {
      cout << "MMYY" << endl;
    }
  }

  return 0;
}

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

int main(){
    int N, A[3000];
    cin >> N;
    pair<int, int> AI[3000];
    for(int i=0; i<N; i++){
        cin >> A[i];
        AI[i] = {A[i], i};
    }
    sort(AI, AI+N);

    vector<int> edges[3000];
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    bitset<3000> win;
    for(int t=0; t<N; t++){
        int i = AI[t].second;
        for(int j : edges[i]) if(A[i] > A[j] && !win[j]) win[i] = 1;
    }

    vector<int> ans;
    for(int i=0; i<N; i++) if(win[i]) ans.push_back(i+1);
    for(int i=0; i<ans.size(); i++) cout << ans[i] << " \n"[i==ans.size()-1];
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

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

    vector<vector<ll>> dp(n+1,vector<ll>(3));
    vector<vector<ll>> a(n+1,vector<ll>(3,0));
    REP(i,n) REP(j,3) cin>>a[i][j];
    
    REP(i,n) REP(j,3) REP(k,3){
        if(j==k) continue;
        chmax(dp[i+1][k],dp[i][j]+a[i][k]);
    }
    
    cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

unordered_map<ll, int> mp;
unordered_set<int> st[100010];
queue<pii> q;
int n, f[100010];

int find(int x)
{
    if (f[x] == x)
        return x;
    return f[x] = find(f[x]);
}

ll getid(int x, int y)
{
    if (x < y)
        swap(x, y);
    return (ll)x * n + y;
}

int main()
{
    // freopen("B.in", "r", stdin);
    // freopen("B.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n * 2 - 2; ++i)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        st[x].insert(y);
        st[y].insert(x);
        mp[getid(x, y)]++;
        if (mp[getid(x, y)] == 2)
            q.push(pii(x, y));
    }
    for (int i = 1; i <= n; ++i)
        f[i] = i;
    unordered_set<int>::iterator it;
    while (!q.empty())
    {
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        x = find(x);
        y = find(y);
        if (x == y)
            continue;
        st[x].erase(y);
        st[y].erase(x);
        if (st[x].size() < st[y].size())
            swap(x, y);
        for (it = st[y].begin(); it != st[y].end(); ++it)
        {
            int z = *it;
            mp[getid(y, z)] = 0;
            st[z].erase(y);
            st[z].insert(x);
            mp[getid(x, z)]++;
            st[x].insert(z);
            if (mp[getid(x, z)] == 2)
                q.push(pii(x, z));
        }
        f[y] = x;
        st[y].clear();
    }
    int s = 0;
    for (int i = 1; i <= n; ++i)
        s += (f[i] == i);
    if (s == 1)
        puts("YES");
    else
        puts("NO");
    return 0;
}

Measured memory_bytes: 38216
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b;
    cin>>n;
    for(int i=1;i<=9;i++)
    {
        if(n%i==0)
        {
            a=n%i;
            b=n/i;
            if(a<=9 && b<=9)
            {
                cout<<"Yes\n";
                return 0;
            }
            
        }
    }
    cout<<"No\n";
}

Measured memory_bytes: 3584
function Main(input) {
  	let counter = 0
	let tempArr = input.split('\n')
    let target = Number(tempArr[0].split(' ')[1])
    let coordinatesArr = tempArr.splice(1,tempArr.length-1)
    for(let i=0;i<coordinatesArr.length;i++){
    	let arr = coordinatesArr[i].split(' ')
        let x = Number(arr[0])
        let y = Number(arr[1])
      	let result = Math.sqrt(Math.pow(x,2)+Math.pow(y,2))
        if(result <= target){
        	++counter
        }
      //console.log(counter,result)
    }
  	console.log(counter)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 64032
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		if (n == 0) {
			System.out.println(0);
			return;
		}

		int rem = 0;
		String ans = "";
		while (n != 0) {
			rem = n % -2;
			n /= -2;
			if (rem == -1) {
				n++;
				rem = 1;
			}
			ans = rem + ans;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 22736
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;

int main(){
int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin>>a.at(i);
  int ans =0;

  for(int i=0;i<n-1;i++){
     for(int j=i+1;j<n;j++){
        ans += a.at(i)*a.at(j);
     }
  }
  
  cout <<ans<<endl;
}

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

using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

/*
全体の最大公約数の倍数かつ最大値より小さければ作れる
*/

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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

void solve(){
    int n,k;
    cin >> n >> k;
    int a[n+10];
    rep(i,n){
        cin >> a[i];
    }
    int g=a[0];
    int m=a[0];
    for(int i=1;i<n;i++){
        g=gcd(g,a[i]);
        m=max(m,a[i]);
    }
    if(k%g==0&&m>=k){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }

}

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


Measured memory_bytes: 640