akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1 ; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1 ; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const bool debug = 0;
/***************************************/

int N;
int a[1000];

int main() {
	while (cin >> N, N) {
		REP(i, N) scanf("%d", a + i);
		sort(a, a + N);
		
		int ans = INF;
		REP(i, N - 1) chmin(ans, a[i + 1] - a[i]);
		if (debug) printf("@ ");
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3116
my $N = <STDIN>;
if($N==1){print "$N";exit;}
my $sum =0;
my $mod = 10**9+7;
my @del;
for(my $i=0;$i<$N;$i++){
 $del[$i] = 0;
}
for(my $i=$N;$i>0;$i--){
 $count = int((($N - ($N%$i))/$i));
 $del[$i] = powmod($count,3,$mod);
}
for(my $i=$N;$i>1;$i--){
 $count = int((($N - ($N%$i))/$i));
 if($count > 1){
 for(my $j=2;$j<=$count;$j++){
    $del[$i]= $del[$i] - $del[$i*$j];
 }
 }
 $del[1]=$del[1] - $del[$i];
 $sum = $sum + $i*$del[$i];
 #print "i$i del$del{$i} $sum\n";
}
$sum = $sum + $del[1];
print "$sum";
exit;

sub powmod{
   my ($a,$b,$m) = @_;
   if($b==1){return $a;}
   my $c = powmod(($a*$a)%$m,int($b/2),$m);
   if($b%2){
     $c = ($c*$a)%$m;
   }
   return $c;
}

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

using ll = long long int;

ll f(ll b,ll n){
    if( n < b ) return n;
    
    return f(b,n/b) + ( n % b );
}


int main(void){
    // Your code here!
    
    ll n,s;
    cin >> n >> s;
    
    //n = pb + q
    //p + q = s
    if(n == s){
        cout << n + 1 << endl;
        return 0;
    }

    for(ll i = 2; i <= sqrt(n); i++){
        if(f(i,n) == s){
            cout << i << endl;
            return 0;
        }
    }
    
    for(ll p = sqrt(n); p > 0; p--){
        ll b = (n-s)/p+1;
        if( b >= 2 && f(b,n) == s ) {
            cout << b << endl;
            return 0;
        }
    }
    
    cout << -1 << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(), (c).end());
const long long MOD = 1e9 + 7;
typedef long long ll;

int main(){
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int L1 = x2 - x1;
	int L2 = y2 - y1;
	cout << x2 - L2 << " " << y2 + L1 << " " << x1 - L2 << " " << L1 + y1 << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  for(auto& num : vec){
    cin >> num;
  }
  int min = 10000;
  for(int i=1; i<n; i++){
    int a = 0, b = 0;
    for(int j=0; j<i; j++){
      a += vec[j];
    }
    for(int j=i; j<n; j++){
      b += vec[j];
    }
    if(abs(a - b) < min) min = abs(a - b);
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main (String[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int M = sc.nextInt();
    int sum = 0;
    
    for(int i=0;i<M;i++){
      int a = sc.nextInt();
      sum += a;
    }
    if(sum<=N){
      System.out.println(N-sum);
    }else{
      System.out.println(-1);
    }
  }
}

Measured memory_bytes: 46532
fun main(args: Array<String>) {
   	val(n, k) = readLine()!!.split(" ").map{ i -> i.toInt() }
    var h =  Array(n, {readLine()!!.toInt()})
    var min = 10e9.toInt()
  
    h.sortDescending()
   
    for ( i in 0..n-k ){
        var sub = h[i] - h [i + k - 1]
        
        if( sub < min){
           	min = sub
        }
    }
    println(min)
}

Measured memory_bytes: 44816
#include <iostream>
#include <vector>
#define N 100000
#define white 0
using namespace std;

int color[N], n, S[N];
vector<int> c[N];



void tansaku_2(int a, int b) {
    int i, t, co, u;
    S[0] = a;
    t = 0;
    co = 1;
    while (1) {
        u = S[t];
        for (i = 0; i < c[u].size(); ++i) {
            if (color[c[u][i]] == white){
                color[c[u][i]] = b;
                S[co++] = c[u][i];
            }
        }
        S[t++] = 0;
        if (t == co) break;
    }
}

void tansaku() {
    int i, d;
    d = 1;
    
    for (i = 0; i < n; ++i) {
        if (color[i] == white) {
            color[i] = d;
            tansaku_2(i , d++);
        }
    }
}

int main() {
    int m, q, i, a, b;
    
    cin >> n >> m;
    for (i = 0; i < n; ++i) {
        color[i] = white;
    }
    for (i = 0; i < m; ++i) {
        cin >> a >> b;
        c[a].push_back(b);
        c[b].push_back(a);
    }
    tansaku();
    
    cin >> q;
    
    for (i = 0; i < q; ++i) {
        cin >> a >> b;
        if (color[a] == color[b]) {
            cout << "yes" << endl;
        }
        else{
            cout << "no" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 9384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int money;
  int f1,f2,f1_1;
  cin >> money;
  if(money>=500){
  	f1 = money%500;
  	f1_1 = money/500;
  	f2 = f1/5;
    cout << ((f1_1*1000)+(f2*5)) << endl;
  }else{
  	f2=money/5; 
    cout << f2*5 << endl;
  }
}

Measured memory_bytes: 256
///*****************************************************///
///*.......................Faiyaj Bin Amin............................*///
///*...................................................................*///
///*.........................KUET CSE 2K17......................*///
///*...................................................*///
///*****************************************************///

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

#define fastio      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define ret return
#define rep(q, i, n) for(int q=i; q<n; q++)
#define forn(i, n) for(int i=0; i<n; i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pdd pair<double, double>

#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";

#define PI 2*acos(0.0)
#define lcm(a, b)  ((a / __gcd(a, b) ) * b)

#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)

#define mx 100005
#define INF 1e18
#define MOD 1000000007
#define MIN 0

//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0}; // Directional
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

/**------------------------------------BITMASK------------------------------------------**/
//int Change(int N, int pos){return N= N^(1<<pos);}
//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1
/**-----------------------------------------------------------------------------------------------**/

//using namespace __gnu_pbds;
using namespace std;

int main()
{
////    fastio;


    ll w,h,x,y;

    cin >>w>>h>>x>>y;

    double l = (w*h)/2.0;
    printf("%lf ", l);
    if(w%2==0 && h%2==0)
    {
        if(x==w/2 && y==h/2)
        {
            cout << "1\n";
        }
        else
            cout << "0\n";
    }
    else
        cout << "0\n";
    return 0;
}


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

int main(){
  long long k,a,b;
  cin >> k >> a >>b;
  long long k2 = k;
  long long bis=1,m=0;
    k-=a-1;
  if(k<=1){cout << 1+k2 << endl;
          return 0;}
    if(k%2==0){
      bis=b,m=1,k-=2;
      bis+=(k/2)*(b-a);
    }else{
      bis=b,m=1,k-=2;
      bis+=(k/2)*(b-a)+1;
    }
  cout << max(bis,1+k2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

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();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	string right_s = "yuiophjklnm";
	string left_s = "qwertasdfgzxcvb";
	set<char> right;
	set<char> left;

	for(int i = 0; i < right_s.length(); i++) right.insert(right_s[i]);
	for(int i = 0; i < left_s.length(); i++) left.insert(left_s[i]);

	for(string s; getline(cin, s), s != "#";) {
		int ans = 0;
		bool prev = (right.find(s[0]) != right.end());
		for(int i = 1; i < s.length(); i++) {
			if(prev != (right.find(s[i]) != right.end())) {
				ans++;
				prev = (right.find(s[i]) != right.end());
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>

const int N = 200000 + 7;

int n, m, a[N];

int calc(int x) {
	int ans = 0;
	for (int i = 1; i <= x; ++i)
		ans = std::max(ans, a[i] + a[2 * x - i + 1]);
	for (int i = 1; x + i <= n; ++i) {
		if (a[2 * x + i] + a[2 * n - i + 1] < m) return -1;
		ans = std::max(ans, a[2 * x + i] + a[2 * n - i + 1] - m);
	}
	return ans;
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n * 2; ++i) scanf("%d", a + i);
	std::sort(a + 1, a + n * 2 + 1);
	int l = 0, r = n;
	for (int m; l < r; )
		~calc(m = l + r >> 1) ? (r = m) : (l = m + 1);
	printf("%d", calc(r));
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

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

#define INF INT_MAX

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

int main(int, char**)
{
    int n;
    cin >> n;

    string s;
    vector<P> prn(n);
    rep(i,n) {
        cin >> s;
        rep(j,s.size()) {
            if (s[j] == '(') prn[i].first++;
            else {
                if (prn[i].first > 0) prn[i].first--;
                else prn[i].second++;
            }
        }
    }
    int l1, l2, r1, r2;
    l1 = r1 = 0;
    l2 = r2 = INF;
    int sum1 = 0, sum2 = 0;
    rep(i,n) {
        sum1 += prn[i].first;
        sum2 += prn[i].second;
        if (prn[i].first == 0) r1 += prn[i].second;
        else if (prn[i].second == 0) l1 += prn[i].first;
        else if (prn[i].first > prn[i].second) l2 = min(l2, prn[i].second);
        else r2 = min(r2, prn[i].first);
    }
    if (l2 == INF) l2 = 0;
    if (r2 == INF) r2 = 0;

    if (sum1 == sum2 && l1 >= l2 && r1 >= r2) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

const int MOD = 1e9+7;
const int MAX_N = 10006;
string K;
int N, D;
ll dp[MAX_N][102];

ll dfs(int at, int rem, bool zero, bool less)
{
	if(at == N){
		if(!rem && !zero) return 1;
		else return 0;
	}
	if(!zero && less){
		ll res = dp[at][rem];
		if(res != -1) return res;
	}
	ll res = 0;
	for(int i=0;i<=(less?9:K[at]-'0');++i){
		(res += dfs(at+1, (rem+i)%D, (zero&&!i), (less||(i<(K[at]-'0')))))%=MOD;
	}
	if(!zero && less) dp[at][rem]=res%MOD;
	return res;
}

void solve()
{
	N = K.length();
	memset(dp, -1, sizeof(dp));
	int ans = dfs(0,0,true,false);
	cout << ans << '\n';
}

int main()
{
	cin >> K >> D;
	solve();
	return 0;
}

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

int main()
{
	int N = 0;
	cin >> N;
	vector<int> p(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> p[i];
	}
	
	if (is_sorted(p.begin(), p.end()))
	{
		cout << "YES";
		return 0;
	}
	for (int i = 0; i < N - 1; ++i)
	{
		for (int j = i; j < N; ++j)
		{
			auto p_c = p;
			iter_swap(p_c.begin() + i, p_c.begin() + j);
			if(is_sorted(p_c.begin(), p_c.end()))
			{
				cout << "YES";
				return 0;
			}
		}
	}
	cout << "NO";
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
import bisect
import numpy as np
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
count_b=np.zeros(n,dtype=np.int64)
def lower_elements(A, b):
    ''' リストAの要素のうち，b未満のものの個数を返す関数 '''
    lower_bound = -1
    upper_bound = len(A)
    while upper_bound - lower_bound > 1:
        middle = (lower_bound + upper_bound) // 2
        if A[middle] < b:
            lower_bound = middle
        else:
            upper_bound = middle
    return lower_bound + 1
 
 
def upper_elements(C, b):
    ''' リストCの要素のうち，cより大きいものの個数を返す関数 '''
    i = -1
    j = len(C)
    while j - i > 1:
        m = (i + j) // 2
        if C[m] > b:
            j = m
        else:
            i = m
    return len(C) - j

for i in range(n):
    count_b[n-1-i]=upper_elements(c,b[i])
count=np.cumsum(count_b)
ans=0
for i in range(n):
    x=upper_elements(b,a[i])
    if x!=0:
        ans+=count[x-1]
print(ans)

Measured memory_bytes: 31440
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	/* ??¶?´??????????????????? */
	public static int judge(ArrayList<Integer> parse2) {
		int result=0;
		if (parse2.get(0) <= 0 || parse2.get(0) > 100) {
			result = 0;
		} else if (parse2.get(1) <= 0 || parse2.get(1) > 100) {
			result = 1;
		} else if (parse2.get(2) < -100 || parse2.get(2) > 100) {
			result = 2;
		} else if (parse2.get(3) < -100 || parse2.get(3) > 100) {
			result = 3;
		} else if (parse2.get(4) <= 0 || parse2.get(4) > 100) {
			result = 4;
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		int w, h, x, y, r;
		String str1,str2,str3,str4,str5;

		/**
		 * ????????????????????¨???
		 */
		ArrayList<String> st = new ArrayList<String>();
		ArrayList<Integer> parse2 = new ArrayList<Integer>(); //int??????

		/**
		 * ??\?????¨????????????????´?
		 */
		Scanner scan = new Scanner(System.in);
		for(int i = 0; i < 5; i++){
		st.add(scan.next());
		}
		str1 = st.get(0);
		str2 = st.get(1);
		str3 = st.get(2);
		str4 = st.get(3);
		str5 = st.get(4);

		w = Integer.parseInt(str1); parse2.add(w);
		h = Integer.parseInt(str2); parse2.add(h);
		x = Integer.parseInt(str3); parse2.add(x);
		y = Integer.parseInt(str4); parse2.add(y);
		r = Integer.parseInt(str5); parse2.add(r);


		/* ????????¨???????????? */


		if ((x - r < 0 || x + r > w) || (y - r < 0 || y + r > h)){
			System.out.println("No");
		}
		else if ((x - r >= 0 && x + r <= w) && (y - r >= 0 && y + r <= h)){
			System.out.println("Yes");
		}
		/**
		 * judge??????????????§??\???????????????
		 */
		else if (judge(parse2)==0){
			System.out.println("w?????\?????????1~100??\???????????§???.???????????????.");
		}
		else if (judge(parse2)==1){
			System.out.println("h?????\?????????1~100??\???????????§???.???????????????.");
		}
		else if (judge(parse2)==2){
			System.out.println("x?????\?????????-100~100??\???????????§???.???????????????.");
		}
		else if (judge(parse2)==3){
			System.out.println("y?????\?????????-100~100??\???????????§???.???????????????.");
		}
		else if (judge(parse2)==4){
			System.out.println("r?????\?????????1~100??\???????????§???.???????????????.");
		}

	}

}

Measured memory_bytes: 26204
import sys
def input():
    return sys.stdin.readline()[:-1]
def main():
#    N = int(input())
    A, B = map(int,input().split())
#    S = input()
    if A >= 13:
        print(B)
    elif A >= 6:
        print(B//2)
    else:
        print(0)
if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <cstdio>
using namespace std;

int main()
{
  char S[4];
  int num = 0, i;
  scanf("%s", S);
  for (i = 0; i < 4; i++)
  {
    num += S[i] == '+' ? 1 : -1;
  }
  printf("%d\n", num);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


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;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

 
int main() {
   
    int X;
    cin >> X ;
    int ma = -1;
    FOR(i,1, 36){
        int x = i;
        FOR(j, 1, 11){
            x *= i;
            if(x > X){
                break;
            }
            ma = max(ma, x);
        }
    }
    cout << ma << endl;

}



Measured memory_bytes: 3596
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n;cin>>n;
  vi d(n);
  rep(i,n) cin>>d[i];
  ll ret = 0;
  rep(i,n){
    for(int j=i+1;j<n;++j){
      ret += d[i]*d[j];
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 3616
import numpy as np
import math

N = int(input())

# N = 4 a + 7 b

DP = []
DP.append(True)

for i in range(1, N+1):
    if (i - 4 >= 0 and DP[i - 4]) or \
       (i - 7 >= 0 and DP[i - 7]):
        DP.append(True)
    else:
        DP.append(False)

if DP[N]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 16024
import sys
from fractions import gcd

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


X = ini()


def solve():
    y = gcd(360, X)
    return 360 // y


print(solve())


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

#define llint long long int

using namespace std;

int main()
{
    llint N;
    int Q;

    cin >> N >> Q;

    llint ans = (N - 2) * (N - 2);

    vector<int> right_v(N + 1, 0), bottom_v(N + 1, 0);
    set<int> right_s, bottom_s;

    right_v[N] = N;
    bottom_v[N] = N;
    right_s.insert(N);
    bottom_s.insert(N);

    for (int q = 0; q < Q; q++)
    {
        int num, x;

        cin >> num >> x;

        if (num == 1)
        {
            auto it = bottom_s.upper_bound(x);
            bottom_s.insert(x);
            bottom_v[x] = bottom_v[*it];
            ans -= bottom_v[x] - 2;
            it = right_s.upper_bound(bottom_v[x] - 1);

            if (x < right_v[*it])
            {
                right_v[*it] = x;
            }
        }
        else
        {
            auto it = right_s.upper_bound(x);
            right_s.insert(x);
            right_v[x] = right_v[*it];
            ans -= right_v[x] - 2;
            it = bottom_s.upper_bound(right_v[x] - 1);

            if (x < bottom_v[*it])
            {
                bottom_v[*it] = x;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 14344
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int n,a[100000];
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
   }
  vector<long int>dp(n);
  dp[0]=0;
  for(int i=1;i<n;i++)
  {
    if(i-2>=0)
    {
      dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
     }
     else{
     dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
                      }
                      }
                      cout<<dp[n-1]<<endl;
                      }

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    string x;
    cin >> x;
    
    int s = 0, minus = 0;
    for(int i = 0; i < x.size(); i++){
        if(x[i] == 'S') s++;
        else{
            if(0 < s){
                s--;
                minus += 2;
            }
        }
    }

    cout << (int)x.size()-minus << endl;

    return 0;
}

Measured memory_bytes: 720
#include <cstdio>
using namespace std;
  
int a[4];
int c[8];
int k;
  
int calc(){
    int op = c[k++];
    int ret = 0;
    if(op >= 0){
        ret = op;
    }
    else if(op >= -3){
        int x = calc();
        int y = calc();
        if(op == -1){
            ret = x + y;
        }
        else if(op == -2){
            ret = x - y;
        }
        else{
            ret = x * y;
        }
    }
    else{
        throw 0;
    }
    return ret;
}
  
void print(){
    int op = c[k++];
    if(op >= 0){
        printf("%d", op);
    }
    else{
        char ch;
        if(op == -1){ ch = '+'; }
        else if(op == -2){ ch = '-'; }
        else{ ch = '*'; }
  
        putchar('(');
        print();
        printf(" %c ", ch);
        print();
        putchar(')');
    }
}
  
void solve(int i, int S, int oprem, int numrem){
    if(i == 6){
        for(int j = 0; j < 4; ++j){
            if(S >> j & 1){
                c[6] = a[j];
            }
        }
        try{
            k = 0;
            if(calc() == 10 && k == 7){
                k = 0;
                print();
                puts("");
                throw "";
            }
        }catch(int){}
        return;
    }
  
    if(oprem > 0){
        for(int op = -1; op >= -3; --op){
            c[i] = op;
            solve(i + 1, S, oprem - 1, numrem + 1);
        }
    }
  
    if(numrem > 0){
        for(int j = 0; j < 4; ++j){
            if(S >> j & 1){
                c[i] = a[j];
                solve(i + 1, S ^ 1 << j, oprem, numrem - 1);
            }
        }
    }
}
  
int main(){
    while(1){
        for(int i = 0; i < 8; ++i){
            c[i] = -9;
        }
        for(int i = 0; i < 4; ++i){
            scanf("%d", &a[i]);
        }
        if(a[0] == 0){ break; }
        try{
            solve(0, 15, 3, 0);
            puts("0");
        }catch(...){}
    }
}

Measured memory_bytes: 1128
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main() {
	int a; cin >> a;
	int b[a];
	REP(i, a){
		cin >> b[i];
	}
	
	sort(b, b + a);

	int c;
	REP(i, a - 1){
		c += b[i];
	}
	if (c > b[a - 1]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  int a[4] = {};
  for(int i = 0; i < n; i++){
    char c;
    cin >> c;
    if(c == 'P'){
      a[0] = 1;
    }else if(c == 'W'){
      a[1] = 1;
    }else if(c == 'G'){
      a[2] = 1;
    }else if(c == 'Y'){
      a[3] = 1;
    }
  }
  int cnt = 0;
  for(int i = 0; i < 4; i++){
    if(a[i] == 1){
      cnt++;
    }
  }
  if(cnt == 3){
    cout << "Three\n";
  }else{
    cout << "Four\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
const int MAX = 1000001;

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

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

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

signed main(){
  int X,Y;
  cin>>X>>Y;
  int ans=0;
  COMinit();
  if((X+Y)%3==0&&2*Y>=X&&2*X>=Y){
    int A=(2*Y-X)/3;
    int B=(X-A)/2;
    ans=COM(A+B,A);
  }
  cout<<ans<<endl;
  }



Measured memory_bytes: 23680
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)*}
    };

    ($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(unused_imports)]
use std::cmp::{min, max};
use std::collections::VecDeque;

fn main() {
    input!{
        n: usize,
        m: usize,
        v: [(usize1, usize1); m]
    }
    let mut g = vec![vec![]; n];
    for &(a, b) in &v {
        g[a].push(b);
        g[b].push(a);
    }
    let mut q = VecDeque::new();
    let mut ans = vec![n; n];
    ans[0] = 0;
    q.push_back(0);
    while let Some(i) = q.pop_front() {
        for &j in &g[i] {
            if ans[j] == n {
                ans[j] = i;
                q.push_back(j);
            }
        }
    }
    println!("Yes");
    for &a in ans.iter().skip(1) {
        println!("{}", a + 1);
    }
}


Measured memory_bytes: 14976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    int n, k;
    string s;
    cin >> n >> s >> k;
    char t = s[k - 1];
    rep(i, n)
    {
        if (s[i] != t)
            s[i] = '*';
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
march = ["M", "A", "R", "C", "H"]
d = {"M":0, "A":0, "R":0, "C":0, "H":0}


for i in range(n):
    s = input()
    if s[0] in march:
        d[s[0]] = d.get(s[0], 0)+1
ans = 0
li = []
for i in d:
    for j in d:
        for k in d:
            if i!=j and j!=k and k!=i and not set([i,j,k]) in li:
                li.append(set([i,j,k]))
                ans += d[i]*d[j]*d[k]
print(ans)

Measured memory_bytes: 9096
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define BR cout<<endl;
#define LEN(s) s.length();
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const ll mod=1000000007;

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

    int len =  s.length();
    if(s[len - 1]=='s')cout << s << "es" << endl;
    else cout << s << 's' << endl;


    return 0;
}



Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
using namespace std;


int GCD(int x, int y){
    if (x < y) swap(x, y);

    while (y > 0){
        x = x % y;
        swap(x, y);
    }
    return x;
}

//因数にint型の整数、出力はvector<int>型の素数配列
vector<int> Prime_Factorize(int N){
    vector<int> out;
    while (N % 2 == 0){
        N /= 2;
        out.push_back(2);
    }
    //3以上の素数は全部奇数！！
    int Odds = 3;
    while (Odds * Odds <= N){
        if (N % Odds == 0){
            N /= Odds;
            out.push_back(Odds);
        }else{
            Odds += 2;
        }
    }
    if (N != 1) out.push_back(N);

    return out;
}


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

    vector<int> A(N);
    for (int i = 0; i < N; ++i){
        cin >> A[i];
    }

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

    int sup = 1000000;
    int flag = 0;

    int table[sup];
    for (int i = 0; i < sup; ++i){
        table[i] = 0;
    }

    for (int i = 0; i < N; ++i){
        int num = A[i];
        vector<int> lst;
        lst = Prime_Factorize(num);
        for (int j = 0; j < lst.size(); ++j){
            if (table[lst[j]] == 1) flag = 1;
        }
        for (int j = 0; j < lst.size(); ++j){
            table[lst[j]] = 1;
        }
    }
    
    if (flag == 0){
        cout << "pairwise coprime" << endl;
    }

    int gcd = A[0];
    for (int i = 1; i < N; ++i){
        gcd = GCD(gcd, A[i]);
    }

    if (flag == 1){
        if (gcd == 1){
            cout << "setwise coprime" << endl;
        } else{
            cout << "not coprime" << endl;
        }
    }
}



Measured memory_bytes: 11108
//    https://youtu.be/mRHBP3xwgn4

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

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))
ll ans[200010],a[200010];
vector<ll>v[200010];
bool vis[200010];
void dfs(ll node,ll carry){
    carry+=a[node];
    ans[node]+=carry;
    for(ll i=0;i<v[node].size();i++){
        if(!vis[v[node][i]]){
            vis[v[node][i]]=true;
            dfs(v[node][i],carry);
        }
    }
}
int main(){
    fast;
    ll t,n,m,i,j,k,temp,flag,q,A,b,p,x;
    cin>>n>>q;
    for(i=0;i<n-1;i++){
        cin>>A>>b;
        v[A].pb(b);
        v[b].pb(A);
    }
    while(q--){
        cin>>p>>x;
        a[p]+=x;
    }
    vis[1]=true;
    dfs(1,0);
    for(i=1;i<=n;i++){
        cout<<ans[i]<<' ';
    }
    return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var x = input[0];
            var y = input[1];
            var mov = new List<int>();
            var cnt = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == 'F') cnt++;
                else
                {
                    mov.Add(cnt);
                    cnt = 0;
                }
            }
            if (S[S.Length - 1] == 'F') mov.Add(cnt);

            var X = new List<int>();
            var Y = new List<int>();
            for (int i = 0; i < mov.Count; i++)
            {
                if (i % 2 == 0) X.Add(mov[i]);
                else Y.Add(mov[i]);
            }

            var xSum = X.Sum();
            if (Math.Abs(x) > xSum)
            {
                Console.WriteLine("No");
                return;
            }
            var xCnt = X.Count();
            var xDp = new bool[xCnt, 2 * xSum + 1];
            xDp[0, xSum + X[0]] = true;
            for (int i = 1; i < xCnt; i++)
            {
                for (int j = 0; j < 2 * xSum + 1; j++)
                {
                    if (xDp[i - 1, j])
                    {
                        xDp[i, j + X[i]] = true;
                        xDp[i, j - X[i]] = true;
                    }
                }
            }
            if (!xDp[xCnt - 1, xSum + x])
            {
                Console.WriteLine("No");
                return;
            }

            if (Y.Count == 0 && y != 0)
            {
                Console.WriteLine("No");
                return;
            }
            else if (Y.Count == 0 && y == 0)
            {
                Console.WriteLine("Yes");
                return;
            }

            var ySum = Y.Sum();
            if (Math.Abs(y) > ySum)
            {
                Console.WriteLine("No");
                return;
            }
            var yCnt = Y.Count();
            var yDp = new bool[yCnt, 2 * ySum + 1];
            yDp[0, ySum + Y[0]] = true;
            yDp[0, ySum - Y[0]] = true;
            for (int i = 1; i < yCnt; i++)
            {
                for (int j = 0; j < 2 * ySum + 1; j++)
                {
                    if (yDp[i - 1, j])
                    {
                        yDp[i, j + Y[i]] = true;
                        yDp[i, j - Y[i]] = true;
                    }
                }
            }
            if (!yDp[yCnt - 1, ySum + y])
            {
                Console.WriteLine("No");
                return;
            }

            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 28896
#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 mod 1000000007
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; }
//V,P(大文字)使用不可
//乗算の際にオーバーフローに注意せよ！！（適切にmodをとれ）
//制約をよく読め！

const ll INF=1e18;

ll f(ll n){
    ll m=1;
    rep(i,n) m*=10;
    return m;
}

signed main(){
    int n,p;
    cin>>n>>p;
    string s;
    cin>>s;
    ll ans=0;
    if(p==2){
        rep(i,n){
            if((s[i]-'0')%2==0) ans+=(ll)i+1;
        }
    }else if(p==5){
        rep(i,n){
            if((s[i]-'0')%5==0) ans+=(ll)i+1;
        }
    }else{
        map<ll,ll> mp;
        ll cnt=0;
        ll x=1;
        for(ll i=n-1;i>=0;i--){
            cnt+=((ll)s[i]-'0')*x;
            cnt%=p;
            mp[cnt]++;
            x=(x*10)%p;
        }
        mp[0]++;
        for(auto p:mp){
            ans+=p.sc*(p.sc-1)/2;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1028
/*
	Name: 
	Copyright: 
	Author: 
	Date: 12/01/19 21:42
	Description: 这种做法的本质思路，有点接近于数值计算，数值分析里的编程设计思路，通过对要计算的表达式的改造来实现精度控制。
*/

#include <cstdio>
#include <cmath>
#include <stdbool.h>
#include <cstring>
int main(){
	int N, A, B;
	long long num;
	scanf("%d %d %d", &N, &A, &B); 

	if(N == 1){
		if(A == B){ 
			printf("1\n");
			return 0;
		}
		else {
			printf("0\n");
			return 0;
		}
	}	
	if(B < A) {
		printf("0\n");
		return 0;
	}
	num = (long long)(B - A)*(N-2)+1;
	printf("%lld\n", (long long)(B - A)*(N-2)+1);
	return 0;	
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	s := next()

	c := 0
	for l := 0; l < len(s); l++ {
		r := l
		for r < len(s) && (s[r] == 'A' || s[r] == 'T' || s[r] == 'G' || s[r] == 'C') {
			r++
		}
		if c < r-l {
			c = r - l
		}
	}

	fmt.Println(c)
}


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

#define iosx ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20)
#define hell 1000000007LL
#define INF 100000000000000000LL
#define hmap unordered_map
#define hset unordered_set
#define PQ priority_queue
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define lld long double
#define ll int
#define all(C) begin(C),end(C)
#define rep(i,a,b) for(ll i = (a); i < (b); ++(i))
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll,ll>
#define len(C) (ll)(C).size()
#define lexcmp lexicographical_compare
#define whats(C,n) 	rep(i,0,n) cout<<(C)[i]<<" \n"[i+1==n]
#define what(V)     cout<<(V)<<'\n'

void solve(int tm){
	ll n;
	// string s;
	cin>>n;

	ll f=n/100, s=n%100;

	if ((1<=f and f<=12) and (1<=s and s<=12))
		cout<<"AMBIGUOUS";
	else if (1<=s and s<=12)
		cout<<"YYMM";
	else if (1<=f and f<=12)
		cout<<"MMYY";
	else
		cout<<"NA";
}


	// rep(i,0,n)
		// cout<<a[i]<<" \n"[i+1==n];

// g++.exe -static -DONLINE_JUDGE -lm -s -x c++ -Wl,--stack=268435456 -O2 -std=c++14 sol.cpp & a.exe & del a.exe
// vim cli: !g++ -static -lm -s -x c++ -O2 -std=c++14 sol.cpp -o out; ./out; 
int main(){ 
	iosx; 
	int t=1;
    // cin >> t;

	for(int i=1; i<=t; ++i)
        solve(i);

	return 0;
}

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

const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

long double f(long double a, long double b, long double theta) {
    if (theta > PI / 2.0 - EPS) {
        return 0.0;
    }

    long double res;
    if (a * tan(theta) <= b) {
        res = a * a * b - a * a * a * tan(theta) / 2.0;
    } else {
        res = b * b / tan(theta) * a / 2.0;
    }

    return res;
}

int main() {
    long double a, b, x;
    cin >> a >> b >> x;

    long double ok = PI / 2.0;
    long double ng = 0.0;

    for (int _ = 1; _ <= 100000; _++) {
        long double mid = (ok + ng) / 2.0;
        if (f(a, b, mid) < x) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << fixed << setprecision(10) << ok / PI * 180 << endl;
    return 0;
}

Measured memory_bytes: 384
use std::iter;
use std::collections::VecDeque;

#[derive(Clone, Eq, PartialEq, PartialOrd, Ord)]
enum Stage {
    Bottom, Second, Top,
}

use Stage::*;

fn main(){
    let n: usize = read();
    let mut a: Vec<u32> = read_vec();
    let mut b: Vec<u32> = read_vec();
    let mut c: Vec<u32> = read_vec();
    
    let mut bc: Vec<(u32, Stage)> = b.iter().cloned().zip(iter::repeat(Second)).chain(c.iter().cloned().zip(iter::repeat(Bottom))).collect();
    bc.sort();
    let mut ab: Vec<(u32, Stage)> = a.iter().cloned().zip(iter::repeat(Top)).chain(b.iter().cloned().zip(iter::repeat(Second))).collect();
    ab.sort();
    
    let mut vec: VecDeque<u64> = VecDeque::new();
    let mut state: u64 = n as u64;
    for (size, stage) in bc {
        match stage {
            Bottom => state -= 1,
            Second => vec.push_back(state),
            _ => {},
        }
    }
    
    let mut sum: u64 = vec.iter().sum();
    let mut ans = 0;
    for (size, stage) in ab {
        match stage {
            Top => ans += sum,
            Second => sum -= vec.pop_front().unwrap(),
            _ => {},
        }
    }
    
    println!("{}", ans);
}

use std::io::*;
use std::str::*;

fn read_one<T: std::str::FromStr>() -> T {
    let mut s = stdin().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.trim().parse().ok().unwrap()
}

fn read<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 14504
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using llv = vector<ll>;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD7 = 1000000007;
	constexpr ll MOD9 = 1000000009;

	void reverse(string& s){
		reverse(all(s));
	}

	template<typename T>
	void init(vector<T>& v, T initVal = T()){
		for(auto& e : v){
			e = initVal;
		}
	}

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	void reverse(vector<T>& v){
		reverse(all(v));
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T1, typename T2>
	inline vector<T1>& operator+=(vector<T1>& v1, const vector<T2>& v2){
		for(const auto& e : v2) v1.push_back(e);
		return v1;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T1, typename T2>
	void in(vector<T1>& v1, vector<T2>& v2){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i];
	}
	template<typename T1, typename T2, typename T3>
	void in(vector<T1>& v1, vector<T2>& v2, vector<T3>& v3){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i] >> v3[i];
	}
	template<typename T1, typename T2, typename T3, typename T4>
	void in(vector<T1>& v1, vector<T2>& v2, vector<T3>& v3, vector<T4>& v4){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i] >> v3[i] >> v4[i];
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	template<typename T>
	inline set<T>& operator+=(set<T>& v, const T& e){
		v.insert(e);
		return v;
	}

	template<typename T1, typename T2>
	inline set<T1>& operator+=(set<T1>& v1, const set<T2>& v2){
		for(const auto& e : v2) v1.insert(e);
		return v1;
	}

	constexpr ll modPow(ll x, ll n, ll m){ // O(logn)
		if(n == 0) return 1;
		else if(n % 2 == 0) return modPow((x * x) % m, n / 2, m);
		else return x * modPow(x, n - 1, m) % m;
	}
}
using namespace atcoder;
#endif

int main(){
	cout << fixed << setprecision(15);
	
	
	string s;cin>>s;
	cout << (s=="AAA"||s=="BBB"?"No":"Yes");
}

Measured memory_bytes: 256
fn main() {
    let x = read::<u64>();

    let mut money: u64 = 100;
    let mut i = 1;
    loop {
        money = money + money / 100;
        if money >= x {
            break;
        }
        i += 1
    }
    println!("{}", i);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 2156