akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define mz 998244353
#define pq priority_queue
using namespace std;

struct Node
{
    int a,c,d;
}p;
vector <Node> vec[15];
int n,m,ans;
int num[15];
void dfs(int x,int y,int sum)
{
    if(x==n+1)
        ans=max(ans,sum);
    else
    {
        int now;
        for(int i=y;i<=m;i++)
        {
            num[x]=i;
            now=sum;
            for(int j=0;j<vec[x].size();j++)
            {
                if(num[x]-num[vec[x][j].a]==vec[x][j].c)
                    now+=vec[x][j].d;
            }
            dfs(x+1,i,now);
        }
    }
}

int main()
{
    scanf("%d%d",&n,&m);
    int q,b;
    scanf("%d",&q);
    while(q--)
    {
        scanf("%d%d%d%d",&p.a,&b,&p.c,&p.d);
        vec[b].push_back(p);
    }
    dfs(1,1,0);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3824
#include<stdio.h>
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int i, j, k;
	int a[10];
	for (i = 0; i < m; i++)
		scanf("%d", &a[i]);
	int c[10] = { 1000000009,2,5,5,4,5,6,3,7,6 };
	int dp[10004][10];
	for (i = 0; i < 10004; i++)
		for (j = 0; j < 10; j++)
			dp[i][j] = 0;
	for (i = 0; i <= n; i++)
		dp[i][0] = -1;
	dp[0][0] = 0;
	int v[10], p;
	for (i = 1; i <= n; i++)
	{
		for (j = 0; j < m; j++)
		{
			if (i >= c[a[j]])
			{
				if (i == 10)
					i = 10;
				if (dp[i-c[a[j]]][0]>=0 && dp[i][0] < dp[i - c[a[j]]][0] + 1)
				{
					for (k = 0; k < 10; k++)
						dp[i][k] = dp[i - c[a[j]]][k];
					dp[i][0]++;
					dp[i][a[j]]++;
				}
				if (dp[i][0] == dp[i - c[a[j]]][0] + 1 && dp[i - c[a[j]]][0] >= 0)
				{
					for (k = 0; k < 10; k++)
						v[k] = dp[i - c[a[j]]][k];
					v[0]++;
					v[a[j]]++;
					p = -1;
					for (k = 9; k > 0; k--)
					{
						if (dp[i][k] > v[k])
							break;
						if (dp[i][k] < v[k])
						{
							p = 1;
							break;
						}
					}
					if (p > 0)
					{
						for (k = 0; k < 10; k++)
							dp[i][k] = v[k];
					}
				}
			}
		}
	}
	for (i = 9; i > 0; i--)
		for (j = 0; j < dp[n][i]; j++)
			printf("%d", i);
	printf("\n");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;

int main(){
	ll n,k;
	cin>>n>>k;
	ll d[10];
	rep(i,0,k)cin>>d[i];
	ll ans=0;
	bool p=false;
	rep(i,n,n*10+1){
		ll n1=i;
		p=false;
		while(n1!=0){
			rep(j,0,k) if(n1%10==d[j]){p=true;break;}
			n1/=10;
		}
		if(!p){ans=i;break;}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
	int n;
	std::cin >> n;

	if (n % 2 == 1) {
		std::cout << (n - 1)*(n - 1) / 2 << std::endl;

		for (int i = 1; i < n; ++i)
			std::cout << i << " " << n << std::endl;

		for (int i = 1; i < n; ++i)
			for (int j = i + 1; j < n; ++j)
				if (i + j != n)
					std::cout << i << " " << j << std::endl;
	}
	else {
		std::cout << n * (n - 2) / 2 << std::endl;

		for (int i = 1; i < n; ++i)
			for (int j = i + 1; j <= n; ++j)
				if (i + j != n + 1)
					std::cout << i << " " << j << std::endl;
	}
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int N; cin >> N;
    if(N%10 == 2 || N%10 == 4 || N%10 == 5 || N%10 == 7 || N%10 == 9)cout << "hon" << endl;
    else if(N%10 == 0 || N%10 == 1 || N%10 == 6 || N%10 == 8) cout << "pon" << endl;
    else cout << "bon" << endl;
}

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

using namespace std;

int main() {
	int64_t n, m, k;
	cin >> n >> m >> k;
	vector<int64_t> N(n+1), M(m+10);
	int64_t a=0, b=0;

	N.at(0) = 0;
	M.at(0) = 0;
	int64_t sum=0;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a);
		//cin >> a;
		sum += a;
		N.at(i) = sum;
	}

	sum = 0;
	for (int i = 1; i <= m; i++) {
		scanf("%lld", &b);
		//cin >> b;
		sum += b;
		M.at(i) = sum;
	}

	int64_t tmpmax = 0;
	int64_t j = m;
	for (int64_t i = 0; i <=n; i++) {
		if (N.at(i) > k) { break; }
		while ( M.at(j) > k - N.at(i)) {
			j--;
		}
		tmpmax = max(tmpmax, i + j);

	}

	cout << tmpmax << endl;
	return 0;

}

Measured memory_bytes: 6432
n = int(input())
b = [ [] for _ in range(n) ]
for i in range(n):
    a = int(input())
    b[i] = [a, i]

b.sort()
cnt = 0
for i in range(n):
    if (i & 1) != (b[i][1] & 1):
        cnt += 1

print(cnt // 2)

Measured memory_bytes: 20076
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while (true) {
			int n = stdIn.nextInt();
			int x = stdIn.nextInt();
			if((n+x) == 0)
				break;

			int count = 0;

			for (int i=1; i<=n-2; i++) {
				for (int j=i+1; j<=n-1; j++) {
					for (int k=j+1; k<=n; k++) {
						if((i+j+k) == x && i!=j && j!=k && k!=i)
							count++;
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 19864
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define max 100001
struct node {int p,l,r;};
struct node t[max];
int d[max],h[max],n;
void getdepth(int i,int j){
  d[i]=j;
  if(t[i].r!=-1)getdepth(t[i].r,j+1);
  if(t[i].l!=-1)getdepth(t[i].l,j+1);
}
int getheigt(int j){
  int h1=0,h2=0;

  if(t[j].r!=-1)h1=getheigt(t[j].r)+1;
  if(t[j].l!=-1)h2=getheigt(t[j].l)+1;
  //if(j==0)cout<<"h1:"<<h1<<" h2:"<<h2<<endl;
  return h[j]=(h1>h2)?h1:h2;
}
int gatdegree(int i){
  if(t[i].r!=-1&&t[i].l!=-1)return 2;
  else if(t[i].r==-1&&t[i].l==-1) return 0;
  else return 1;
  
}
int main(){
  int i,id,m;
  cin>>n;
  for(int i=0;i<n;i++)
    t[i].p=t[i].l=t[i].r=-1;
  for(i=0;i<n;i++){
    cin>>id;
    cin>>t[id].l>>t[id].r;
    if(t[id].l!=-1)t[t[id].l].p=id;
    if(t[id].r!=-1)t[t[id].r].p=id;
    //cout<<"id:"<<id<<" tl:"<< t[t[id].l].p<<":"<<t[t[id].r].p<<endl;
  }

  for(int i=0;i<n;i++){
    if(t[i].p==-1)m=i;
  }
  getdepth(m,0);
  getheigt(m);
  for(int i=0;i<n;i++){
    if(t[i].p!=-1)m=(t[t[i].p].l!=i)?t[t[i].p].l:t[t[i].p].r;
    else m=-1;
    cout<<"node "<<i
	<<": parent = "<<t[i].p
	<<", sibling = "<<m
	<<", degree = "<<gatdegree(i)
	<<", depth = "<<d[i]
	<<", height = "<<h[i]<<", ";
    if(t[i].p==-1)cout<<"root"<<endl;
    else if(t[i].l==-1&&t[i].r==-1)cout<<"leaf"<<endl;
    else cout<<"internal node"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3136
a,b,c,k = map(int,input().split())
ans = 0

if a >= k:
  ans = k
  print(ans)
elif a + b >= k:
  ans = (k-b)
  print(ans)
elif a + b + c >= k :
  ans = a + (k-a-b)*(-1)
  print(ans)

Measured memory_bytes: 9128
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Diagnostics.Tracing;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //int n=ReadInt();
            //string[] str = Console.ReadLine().Split(' ');
            string[] str = Console.ReadLine().Split(' ');

            int d = int.Parse(str[0]);
            int t = int.Parse(str[1]);
            int s = int.Parse(str[2]);


            if (t * s >= d) Cout("Yes");
            else Cout("No");

            //ここまで
        }


        static void Cout(string s)
        {
            Console.WriteLine(s);
            return;
        }

        static void Cout(int n)
        {
            Console.WriteLine(n);
            return;
        }

        static void Cout(long n)
        {
            Console.WriteLine(n);
            return;
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] ReadArray(int n)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i=0; i < n; i++){ a[i] = int.Parse(str[i]); }
            return a;
        }
        static long[] ReadArray(long n)
        {
            string[] str = Console.ReadLine().Split(' ');
           long[] a = new long[n];
            for (long i = 0; i < n; i++) { a[i] = long.Parse(str[i]); }
            return a;
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int Min(int a, int b)
        {
            if (a < b) return a;
            return b;
        }

        static int Max(int a, int b)
        {
            if (a > b) return a;
            return b;
        }


    }

}


Measured memory_bytes: 27468
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

int main() {
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> G(N);
  FOR(i, N - 1) {
    int a, b;
    cin >> a >> b;
    G[a - 1].push_back(b - 1);
    G[b - 1].push_back(a - 1);
  }
  vector<int> ct(N);
  FOR(i, Q) {
    int p, x;
    cin >> p >> x;
    ct[p - 1] += x;
  }
  queue<int> q;
  q.push(0);
  vector<bool> used(N, 0);
  vector<int> ans(N, 0);
  used[0] = 1;
  ans[0] = ct[0];
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int x : G[v]) {
      if (!used[x]) {
        q.push(x);
        used[x] = 1;
        ans[x] = ans[v] + ct[x];
      }
    }
  }
  FOR(i, N) { cout << ans[i] << " "; }
  cout << endl;
  return 0;
}
#include <algorithm>

Measured memory_bytes: 16372
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
using namespace std;
 
ll cnt;
 
int main(){
	ll n;
	cin >> n;
	ll a[n];
	cinf(a,n);
	ll start=1;
	while(start!=2){
		start=a[start-1];
		cnt++;
		if(cnt>n){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << cnt << endl;
}

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

int main(){
  long n,k;
  cin >> n >> k;
  int b[4*k][4*k],w[4*k][4*k];
  for(int i = 0;i < 4*k;i++){
    for(int j = 0;j < 4*k;j++){
      b[i][j] = 0;
      w[i][j] = 0;
    }
  }
  for(long i = 0;i < n;i++){
    long x,y;
    char c;
    cin >> x >> y >> c;
    x %= 2*k;y %= 2*k;
    if(c == 'W'){
      w[x][y]++;
      w[x][y+2*k]++;
      w[x+2*k][y]++;
      w[x+2*k][y+2*k]++;
    }
    else{
      b[x][y]++;
      b[x+2*k][y]++;
      b[x][y+2*k]++;
      b[x+2*k][y+2*k]++;
    }
  }
  int bsum[4*k][4*k],wsum[4*k][4*k];
  for(long i = 0;i < 4*k;i++){
    bsum[0][i] = 0;bsum[i][0] = 0;
    wsum[0][i] = 0;wsum[i][0] = 0;
  }
  for(long i = 0;i < 4*k-1;i++){
    for(long j = 0;j < 4*k-1;j++){
      bsum[i+1][j+1] = bsum[i][j+1] + bsum[i+1][j] - bsum[i][j] + b[i][j];
      wsum[i+1][j+1] = wsum[i][j+1] + wsum[i+1][j] - wsum[i][j] + w[i][j];
    }
  }
  int ans = 0;
  for(long i = 0;i < 2*k;i++){
    for(long j = 0;j < 2*k;j++){
      int cur = 0;
      cur += wsum[i+k][j+k] - wsum[i][j+k] - wsum[i+k][j] + wsum[i][j];
      cur += wsum[i+2*k][j+2*k] - wsum[i+k][j+2*k] - wsum[i+2*k][j+k] + wsum[i+k][j+k];
      cur += bsum[i+k][j+2*k] - bsum[i][j+2*k] - bsum[i+k][j+k] + bsum[i][j+k];
      cur += bsum[i+2*k][j+k] - bsum[i+k][j+k] - bsum[i+2*k][j] + bsum[i+k][j];
      ans = max(ans,cur);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 250240
N, K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')] * (N+1)
dp[0:2] = [0,0]
for i in range(2, N+1):
    for j in range(1,K+1):
        if i-j <= 0:
            break
        dp[i] = min(dp[i], dp[i-j]+abs(h[i-1]-h[i-j-1]))
print(dp[N])


Measured memory_bytes: 54880
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n, c;

	cin>>n>>c;

	vvi time(c, vi(100001, 0));

	vi sum(100002, 0);

	rep(i, n){
		int s, t, ch;
		cin>>s>>t>>ch;
		time[ch-1][s]++;
		time[ch-1][t]--;
	}
	rep(i, c){
		rep(j, 100001){
			if(time[i][j]==1){
				sum[j]++;
			}else if(time[i][j]==-1){
				sum[j+1]--;
			}
		}
	}
	int ans=-1;
	rep(i, 100001){
		sum[i+1]=sum[i]+sum[i+1];
		if(ans<sum[i+1]) ans=sum[i+1];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 12416
from itertools import product
N, M = map(int, input().split())
x, y, z = zip(*(map(int, input().split()) for _ in range(N)))


def f(a, b, c):
    return sum(sorted(map(sum, zip(a, b, c)), reverse=True)[:M])


def g(k, a):
    return [k * e for e in a]


ans = max(
    f(g(p, x), g(q, y), g(r, z))
    for p, q, r in product((-1, 1), repeat=3)
)
print(ans)


Measured memory_bytes: 3700
def gcd(a,b):
    z = a%b
    while z != 0:
        a = b
        b = z
        z = a%b
    return b

n = int(input())
a = list(map(int,input().split()))
div = gcd(a[0],a[1])
for i in range(1,n-1):
    div = gcd(div,a[i+1])
print(div)

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

int main() {
  string S, T;
  cin >> S >> T;

  bool jg = true;

  for(int i=0; i<S.size(); i++){
    if(S.at(i)==T.at(i)) continue;
    jg = false;
  }

  if(S.size()+1 !=T.size()) jg = false;

  if( jg ) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 3628
import sys
from fractions import gcd
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().strip().split()))

l_gcd = []
r_gcd = []

for i, a in enumerate(A):
    if i == 0:
        l_gcd.append(a)
    else:
        l_gcd.append(gcd(l_gcd[i-1], a))
for i, a in enumerate(reversed(A)):
    if i == 0:
        r_gcd.append(a)
    else:
        r_gcd.append(gcd(r_gcd[i-1], a))
ans = 1
for i in range(N):
    if i == 0:
        ans = max(ans, r_gcd[N-2])
    elif i == N-1:
        ans = max(ans, l_gcd[i-1])
    else:
        ans = max(ans, gcd(l_gcd[i-1], r_gcd[N-2-i]))
print(ans)


Measured memory_bytes: 89580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
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 OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll INF = 100000007;
#define REP10(i, j, M) for(ll i = j; i <= M; i++)



int main() {
  IN(ll, N);
  IN(ll, M);
  AIN(ll,H,N);
  A2IN(ll, A,ll,B,M);
  vector<ll> isgood(N,1);
  REP(i, M){
    if(H.at(A.at(i)-1) <= H.at(B.at(i)-1))
      isgood.at(A.at(i)-1) = 0;
    if(H.at(A.at(i)-1) >= H.at(B.at(i)-1))
      isgood.at(B.at(i)-1) = 0;
  }
  ll count = 0;
  REP(i,N){
    if(isgood.at(i) == 1)
      count++;
  }
  OUT(count);
}





Measured memory_bytes: 6428
// Created by Bingoo on 7/8/2020.
#include"bits/stdc++.h"
using namespace std ;
#define ll  long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

template <class ...Args>
auto &see(const Args &...args) {return ((cerr << " " << args), ...) << '\n';}
#define bug(...)  cerr << "[ "#__VA_ARGS__" ] = "; see(__VA_ARGS__) << '\n';
//C++17
template<typename... Args>
void read(Args&... args){((cin >> args), ...);}
template<typename... Args>
void write(Args... args){((cout << args << " "), ...);}

ll mod = 1e6 +3 ;
ll power(ll a, ll b)	//a is base, b is exponent
{
    if (b == 0)
        return 1;
    if (b == 1)
        return a;
    if (b % 2 == 1)
        return (power(a, b - 1) * a) % mod;
    ll q = power(a, b / 2);
    return (q * q) % mod;
}

bool comp(pair<int,int>&a ,pair<int,int>&b)
{
    return a.second > b.second ;
}

string s;

int k ,n ;

int main(){
    cin >> n ;
    int m = n % 100;
    int y = n / 100 ;
    //bug(y,m)

   if(m>=1 && m <=12){
       if(y>=1 && y <=12)cout<<"AMBIGUOUS\n";
       else cout << "YYMM\n";
   }
   else if(y >=1 && y <=12){
       if(m>=1 && m <=12)cout<<"AMBIGUOUS\n";
       else cout << "MMYY\n";
   }
   else cout << "NA\n";



}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c<=a){
        cout << b+c; return 0;
    }else{
        if(c-a>b){
            cout << a+ b*2+1; return 0;
        }else if(c-a==b){
            cout << a+b*2; return 0;
        } else{
            cout << a+ (c-a)*2+b-(c-a); return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 100005
vector<int >v[N];
int d[N],n,m,vis[N],S;
bool cmp(int a,int b){return d[a]<d[b];}
bool dfs(int x,int from)
{
	if(vis[S]&&x==S)return 1;if(x!=S&&d[x]>2)return 0;vis[x]=1;
	for(int i=0;i<v[x].size();i++)
		if((v[x][i]!=from)&&(!vis[v[x][i]]||v[x][i]==S)&&dfs(v[x][i],x))return 1;
	vis[x]=0;
	return 0;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		d[x]++,d[y]++;
		v[x].push_back(y),v[y].push_back(x);
	}
	for(int i=1;i<=n;i++)sort(v[i].begin(),v[i].begin(),cmp);
	int num=0,tmp=0;
	for(int i=1;i<=n;i++)if(d[i]&1)return puts("No"),0;//puts("Yes");
	for(int x=1;x<=n;x++)num+=(d[x]>=4),tmp+=(d[x]>=6);
	if(num+tmp>2)return puts("Yes"),0;
	if(num==1&&tmp==1)return puts("Yes"),0;
	if(num==2)
	{
		for(int i=1;i<=n;i++)if(d[i]==4)
		{
			S=i;
			if(!dfs(S,0))return puts("No"),0;
		}
		puts("Yes");
	}else puts("No");
}

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

using namespace std;

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

    string S;
    cin >> S;

    vector<int> counterWtoE(N);
    vector<int> counterEtoW(N);

    counterWtoE[0] = 0;
    counterEtoW[0] = 0;

    for (int i = 0; i < N - 1; ++i) {
        counterWtoE[i + 1] = counterWtoE[i];
        if (S.substr(i, 1) == "W") {
            ++counterWtoE[i + 1];
        }
    }

    reverse(S.begin(), S.end());

    for (int i = 0; i < N - 1; ++i) {
        counterEtoW[i + 1] = counterEtoW[i];
        if (S.substr(i, 1) == "E") {
            ++counterEtoW[i + 1];
        }
    }

    reverse(counterEtoW.begin(), counterEtoW.end());

    int min = N;
    for (int i = 0; i < N; ++i) {
        int num = counterWtoE[i] + counterEtoW[i];
        if (min > num) {
            min = num;
        }
    }

    cout << min << endl;
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
    #include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
    #include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ld long double
#define ull unsigned long long
#define pi std::pair<int, int>
#define stdabs std::abs
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=
#define npm next_permutation
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll& x, ll& y);
ll nCr(ll n, ll r);
void stat();
template <typename T> T fact(T num);
constexpr ll mod = 1000000000 + 7;
int main()
{
    stat();
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 1; i != s.size(); ++i) {
        if (s[i] == s[i - 1]) {
		++ans;
            if (s[i - 1] == '0') { s[i] = '1'; }
            else {
                s[i] = '0';
            }
        }
    }
    cout<<ans<<endl;

return 0;
}
ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat(){
#ifdef local
    rep(i, 2){std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

template <typename T> T fact(T num)
{
    if (num == 1) { return 1; }
    return num * fact(num - 1);
}


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

using namespace std;

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

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   int x;
   cin >> x;
   cout << a[x - 1];
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
  string s;
  string t;
  cin >> s;
  cin >> t;
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == t[i]){
      ans++;
    }
  }
  cout << ans;
  return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    string s;
    int res = 0;
    cin >> n >> s;
    rep (i, s.size()) {
        if (s[i] == 'A' && i + 2 < s.size()) {
            if (s[i + 1] == 'B' && s[i + 2] == 'C') res++;
        }
    }
    cout << res << endl;
    
    return 0;
}



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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    lint N;
    cin >> N;
    lint cnt = 0;
    for (lint a = 1; a <= N; a++) {
        if (not(a % 3 == 0 or a % 5 == 0)) { cnt += a; }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(void){
        int n,m,i,j,num,tmp;
        int *B,**A;
        scanf("%d %d",&n,&m);
        B = (int *)malloc(sizeof(int)*m);
        A = (int **)malloc(sizeof(int *)*n);
        for(i=0;i<n;i++){
                A[i] = (int *)malloc(sizeof(int )*m);
        }
        for(i=0;i<n;i++){
                for(j=0;j<m;j++){
                        scanf("%d",&A[i][j]);
                }
        }
        for(i=0;i<m;i++){
                scanf("%d",&B[i]);
        }
        for(i=0;i<n;i++){
                tmp = 0;
                for(j = 0;j<m;j++){
                        tmp = tmp + A[i][j] * B[j];
                }
                printf("%d\n",tmp);
        }
        for(i=0;i<n;i++){
                free(A[i]);
        }
        free(A);
        return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <string>
#include <map>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define Set(i, v) memset(i, v, sizeof i)
#define pb push_back
#define x first
#define y second

using namespace std;

const int N = 200010;

typedef long long LL;

int c[N];

int n, m;

inline int lowbit(int x){
	return x & (-x);
}

void add(int x, int v){
	while(x <= n){
		c[x] = max(c[x], v);
		x += lowbit(x);
	}
}

int sum(int x){
	int ret = 0;
	while(x){
		ret = max(ret, c[x]);
		x -= lowbit(x);
	}
	return ret;
}

struct Point{
	int x, y;

	bool operator < (const Point& A) const{
		return x < A.x;
	}
}P[N];

int Sx, Sy, Tx, Ty;

int rk[N], val[N];

bool cmp(int x, int y){
	return P[x].y < P[y].y;
}

typedef long double Lf;

const Lf PI = 3.14159265358979323846;

int main(){
	scanf("%d%d%d%d%d", &Sx, &Sy, &Tx, &Ty, &m);
	if(Sx > Tx) swap(Sx, Tx), swap(Sy, Ty);
	int Maxy = max(Sy, Ty), Miny = min(Sy, Ty);
	For(i, 1, m){
		++n;
		scanf("%d%d", &P[n].x, &P[n].y);
		if(P[n].x < Sx || P[n].x > Tx || P[n].y < Miny || P[n].y > Maxy) --n;
	}
	sort(P + 1, P + n + 1);
	bool flag1 = true, flag2 = true;
	For(i, 2, n) flag1 &= P[i].x == P[i - 1].x + 1;
	For(i, 1, n){
		rk[i] = i;
		if(Sy > Ty) P[i].y = -P[i].y;
	}
	if(Sy > Ty) Sy = -Sy, Ty = -Ty;
	sort(rk + 1, rk + n + 1, cmp);
	For(i, 2, n) flag2 &= P[rk[i]].y == P[rk[i - 1]].y + 1;
	flag1 &= P[1].x == Sx && P[n].x == Tx, flag2 &= P[rk[1]].y == Sy && P[rk[n]].y == Ty;
	For(i, 1, n) val[rk[i]] = i;
	int ans = 0;
	For(i, 1, n){
		int ret = sum(val[i]) + 1;
		ans = max(ans, ret);
		add(val[i], ret);
	}
	Lf dis = Lf(Tx - Sx + abs(Sy - Ty)) * 100.0;
	dis -= Lf(ans) * (20.0 - PI * 5.0);
	if((flag1 || flag2) && ans == n) dis += PI * 5;
	printf("%.15Lf", dis);
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int n,m;
long long sum,ans,a;
int main(){
	scanf("%lld",&a);
	sum=1;
	ans=0;
	while(sum<=a)
	{
		ans+=sum;
		sum*=2;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
/*
  AtCoder Beginner Contest 097
  B - Exponential
*/

#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;

int X;
vector<int> exps;

int main() {
  scanf("%d", &X);
  
  exps.push_back(1);
  int m = ceil(sqrt(X));
  for (int i = 2; i < m + 1; ++i) {
    int buf = i;
    while (buf * i <= X) {
      buf *= i;
      exps.push_back(buf);
    }
  }

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

  printf("%d\n", exps[exps.size()-1]);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>x(n), y(n); 
	rep(i, n) {
		cin >> x[i]; y[i] = x[i];
	}
	sort(y.begin(), y.end());
	int tmp = y[n / 2 - 1];
	int tmp2 = y[n / 2];
	rep(i, n) {
		if (x[i] < tmp2) {
			cout << tmp2 << endl;
		}
		else {
			cout << tmp << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
#define pii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define fo(n) for(int i = 0;i < int(n);i++)
#define foo(a,b) for(int i = int(a);i <= int(b);i++)
#define mk make_pair
#define pb push_back
#define MAXN (int)1e6
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define fastio ios_base:: sync_with_stdio(false)
#define inf (int)1e9

int main(){
	
	fastio;
	int x,a;
	cin >> x >> a;

	if(x < a) cout << 0 << endl;
	else cout << 10 << endl;

	return 0;
 }	

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
    long int n;
    long int i;
    long int sum;
    long int sq;
    double sqr;
    long int count;
    long int s[10000] = {0}; 
    long int c;
    long int x;
    scanf("%d\n",&n);
    while(n!=0){
        sum = 0;
        sq = (int)sqrt(n);
        sqr = sqrt(n);
        //printf("sq : %d\n",sq);
        count = 0;
        for(i=1;i<=sq;i++){
            //printf("%d %d\n",n ,i);
            if(n==1){
                break;
            }
            else if(n%i==0){
                s[count] = i;
                count++;
                if(i == sqrt(n)){
                    sum -= i;
                    
                }
            }
        }
        c = count;
        for(i=0;i<c;i++){
            if(s[i] != 1){
                x = n / s[i];
                s[count++] = x;
            }
        }
        //printf("%d \n",count);
        for(i=0;i<count;i++){
            //printf("i : %d\n",s[i]);
            sum += s[i];
        }
        //printf("%d %d\n",n,sum);
        if(n==sum){
            printf("perfect number\n");
            
        }
        else if(n>sum){
            printf("deficient number\n");
        }
        else if(n<sum){
            printf("abundant number\n");
        }
        scanf("%ld\n",&n);
    }
    return 0;
}

Measured memory_bytes: 1100
import numpy as np

N=int(input())
H=np.array(input().split(),dtype=np.int32)

flag=True

for i in range(N-1,0,-1):
    if(H[i]>=H[i-1]):
        continue
    else:
        H[i-1]=H[i-1]-1
        if(H[i]<H[i-1]):
            flag=False

if(flag):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 24320
#include<stdio.h>
int n,a[20],flg[10000000];
void dfs(int x,int sum){
    if(x==n){
        flg[sum]=1;
        return;
    }
    dfs(x+1,sum);
    dfs(x+1,sum+a[x]);
}
int main(){
    int i,q,key;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    dfs(0,0);
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&key);
        if( flg[key]==1 ) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


Measured memory_bytes: 2628
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MOD = 1e9+7;

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

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

    bool ok = true;
    cout << ( (c+b-1)/b <= (a+d-1)/d ? "Yes" : "No" ) << endl;

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(c) (c).begin(),(c).end()
#define fs first
#define sc second
typedef pair<int,int> P;
P dp[32][32][32][32];		//dp[大きさ-1][初め]=分割数,最小値(q以上が無理なら-1,-1)
int sum[32][32][32][32];
int main(){
	while(true){
		int h,w,s,u[32][32]={},su=0;
		cin >> h >> w >> s;
		if(h==0) break;
		rep(i,h) rep(j,w){
			cin >> u[i][j];
			sum[0][0][i][j]=u[i][j];
			su+=u[i][j];
		}
		s=su-s;				//s以上に
		rep(i,h) rep(j,w){
			if(u[i][j]>=s) dp[0][0][i][j]=P(1,u[i][j]);
			else dp[0][0][i][j]=P(-1,-1);
		}
		rep1(i,h){				//縦の大きさ
			rep1(j,w){			//横の大きさ
				if(i==1 && j==1) continue;
				rep(k,h-i+1){		//縦の初め
					rep(l,w-j+1){	//横の初め
						if(i!=1) sum[i-1][j-1][k][l]=sum[0][j-1][k][l]+sum[i-2][j-1][k+1][l];
						else sum[i-1][j-1][k][l]=sum[i-1][0][k][l]+sum[i-1][j-2][k][l+1];
						//cout << sum[i-1][j-1][k][l] << endl;
						if(sum[i-1][j-1][k][l]<s) dp[i-1][j-1][k][l]=P(-1,-1);
						else dp[i-1][j-1][k][l]=P(1,sum[i-1][j-1][k][l]);
						rep1(m,i-1){	//ちぎった方の大きさ
							P one=dp[m-1][j-1][k][l],two=dp[i-1-m][j-1][k+m][l];
							if(one.fs==-1 || two.fs==-1) continue;
							dp[i-1][j-1][k][l]=max(dp[i-1][j-1][k][l],P(one.fs+two.fs,min(one.sc,two.sc)));
						}
						rep1(m,j-1){	//ちぎった方の大きさ
							P one=dp[i-1][m-1][k][l],two=dp[i-1][j-1-m][k][l+m];
							if(one.fs==-1 || two.fs==-1) continue;
							dp[i-1][j-1][k][l]=max(dp[i-1][j-1][k][l],P(one.fs+two.fs,min(one.sc,two.sc)));
						}
					}
//					cout << endl;
				}
//				cout << endl;
			}
//			cout << endl;
		}
/*		while(true){
			int x,y,xx,yy;
			cin >> x >> y >> xx >> yy;
			cout << sum[x-1][y-1][xx][yy] << endl;
		}
*/
		cout << dp[h-1][w-1][0][0].fs << " " << dp[h-1][w-1][0][0].sc-s << endl;
	}
	return 0;
}

Measured memory_bytes: 13460
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#define x real() 
#define y imag()
#define px second
#define py first
using namespace std;
typedef complex<double> vectol;
typedef pair <int,int> P;
P G[100001];
vector <P> stc;

int ccw(vectol a,vectol b,vectol c) {
  vectol ab=b-a, ac =c-a;
  vectol d =ac*conj(ab); 
  if(d.y > 0) return true;
  return false;
}

int mk(int i,int flg) {
  vectol av = vectol(stc[stc.size()-2].px,stc[stc.size()-2].py);
  vectol bv = vectol(stc[stc.size()-1].px,stc[stc.size()-1].py);
  vectol cv = vectol(G[i].px,G[i].py);
  if(ccw(av,bv,cv) && stc.size()!=1)stc.pop_back(),i+=flg;
  else  stc.push_back(G[i]);
  return i;
}

int main() {
  int n;
  cin >> n;
  for(int i=0;i<n;i++)cin >> G[i].px >> G[i].py;
  sort(G,G+n);
  
  stc.push_back(G[0]),stc.push_back(G[1]);
  for(int i=2;i<n;i++) i=mk(i,-1);
  for(int i=n-2;i>=0;i--) i=mk(i,1);
  stc.pop_back();
  
  cout <<stc.size()<<endl;
  for(int i=stc.size();i>0;i--) cout<<stc[i%stc.size()].px <<" "<<stc[i%stc.size()].py<<endl;
  return 0;
}

Measured memory_bytes: 2836
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){

	int X,t;
	cin>>X>>t;
		
	cout<<max(X-t,0)<<endl;
		
	
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

ll modpow(ll n, ll k, ll mod) {
  ll res = 1;
  while(k>0){
    if(k&1){
      res = res * n % mod;
    }
    n = n*n%mod;
    k /= 2;
  }
  return res;
}

ll modcom(ll n, ll r){
  ll ans=1;
  for(ll i=n;i>n-r;i--){
    ans=ans*i%MOD;
  }
  for(ll i=1;i<=r;i++){
    //ans/i==ans*i^p-2(iのmod[MOD]における逆元)
    ans=(ans*modpow(i,MOD-2,MOD))%MOD;
  }
  return ans;
}


int main(){
  ll N;
  cin >> N;
  int a,b;
  cin >> a >> b;
  cout<< (modpow(2,N,MOD)-modcom(N,a)-modcom(N,b)+2*MOD -1)%MOD << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=1e4+5,M=5e3+5,INF=1e9,mod=998244353;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
char s1[N],s2[N];
ll fac[N],ifac[N],f[N][N];;
ll C(int n,int m){
	if(n<0||m<0||n-m<0)return 0;
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main(){
	scanf("%s%s",s1+1,s2+1);int len=strlen(s1+1);
	int sam=0,dif=0;fac[0]=1;
	rep(i,1,len)if(s1[i]=='1'&&s2[i]=='1')sam++;
	rep(i,1,len)if(s1[i]=='1'&&s2[i]=='0')dif++;
	rep(i,1,len)fac[i]=fac[i-1]*i%mod;
	ifac[len]=qpow(fac[len],mod-2,mod);
	repd(i,len-1,0)ifac[i]=ifac[i+1]*(i+1)%mod;
	rep(i,0,dif)f[0][i]=1ll*fac[i]*fac[i]%mod;
	rep(i,1,sam)rep(j,1,dif)f[i][j]=1ll*(1ll*f[i-1][j]*i%mod+1ll*f[i][j-1]*j%mod)*j%mod;
	ll ans=0;
	rep(i,0,sam){
		ans=(ans+1ll*f[sam-i][dif]*fac[i]%mod*fac[i]%mod*C(sam,i)%mod*C(sam+dif,i)%mod)%mod;
	}cout<<ans<<endl;
}

Measured memory_bytes: 365312
#include <cstdio>
#include <iostream>
#include <cmath>

#define INF 1000000.0

using namespace std;

struct P{
	double x, y;
	P(double X=0.0, double Y=0.0){
		x = X;
		y = Y;
	} 
	P operator+( const P &in ){
		P tmp( x + in.x , y + in.y );
		return tmp;
	}
	P operator-( const P &in ){
		P tmp( x - in.x , y - in.y );
		return tmp;
	}
	P operator*( const double &in ){
		P tmp( x * in , y * in );
		return tmp;
	}
	double dot( const P &in ){
		return x * in.x + y * in.y;
	}
	double cross( const P &in ){
		return x * in.y - y * in.x;
	}
};


//交差しているか求める(どの3点も同直線上にない)
bool check(P a1, P a2, P b1, P b2){
	P va = a2 - a1, vb = b2 - b1;
	P v1 = b1 - a1, v2 = b2 - a2;

//	cout << "va " << va.first << " " << va.second << endl;
//	cout << "vb " << vb.first << " " << vb.second << endl;
//	cout << "v1 " << v1.first << " " << v1.second << endl;
//	cout << "v2 " << v2.first << " " << v2.second << endl;
//	cout << "va.cross(v1) " << va.cross( v1 ) << endl;
//	cout << "va.cross(v2) " << va.cross( v2 ) << endl;
	
	if( ( va.cross( v1 ) * va.cross( v2 ) ) >= 0 )
		return false;

	if( ( vb.cross( v1 ) * vb.cross( v2 ) ) >= 0 )
		return false;
	
	return true;
}

//2円の交点を求める(2円の中心の中点cからのベクトルvを返す(交点はc±v) )
P circlecross(P a, double ra, P b, double rb, P *cen){
	//P cen = ( a + b ) * 0.5;
//	double r = ra / (ra + rb);

	double c = sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) );
	double r = (ra*ra - rb*rb + c*c ) / ( 2.0 * c*c );
//	cout << "r  " << r << endl;
	double e = c * r;
//	cout << "e  " << e << endl;
	double d = sqrt( ra*ra - e*e );
//	cout << "d  " << d << endl;
	
	P tmp;
//	cout << "d " << d << "  c " << c << endl;
	tmp.x = d * (a.y - b.y) / c;
	tmp.y = d * (b.x - a.x) / c;

	*cen = a * (1.0-r) + b * r;
	
	return tmp;
}

int n;

int solve(){
	P c[100], p[101][2];
	double r[100];
	double dist[205][205];
	
	cin >> c[0].x >> c[0].y >> r[0];
	p[0][0] = c[0];
	p[0][1] = c[0];
	for(int i=1; i<n; i++){
		cin >> c[i].x >> c[i].y >> r[i];
		P cen;
		P d = circlecross( c[i-1], r[i-1], c[i], r[i], &cen );
//		cout << "circlecross " << d.x << d.y << endl;
	//	double rate = sqrt( (r[i-1]*r[i-1] - r[i]*r[i] + c*c ) / ( 2.0 * c*c ) );
//		P cen = ( c[i] * (1-rate) + ( c[i-1] * rate );
		p[i][0] = cen + d;
		p[i][1] = cen - d;
	}
	p[n][0] = c[n-1];
	p[n][1] = c[n-1];

	//求める
	fill( dist[0], dist[0]+205*205, INF );
	for(int i=0; i<n*2; i++){
		for(int j=i+1; j<=n*2; j++){
			bool f=true;
			for(int k=i/2+1; k<j/2; k++){
	//			cout << "ijk " << i << " " << j << " " << k << endl;
				if( !check( p[i/2][i%2], p[j/2][j%2], p[k][0], p[k][1] ) )
					f = false;
			}
			if( f ){
				double x = p[i/2][i%2].x - p[j/2][j%2].x;
				double y = p[i/2][i%2].y - p[j/2][j%2].y;
				dist[i][j] = sqrt( x*x + y*y );
			}
		}
	}
	//最短経路
	for(int k=1; k<n*2; k++){
		for(int i=0; i<=n*2; i++){
			for(int j=0; j<=n*2; j++){
				dist[i][j] = min( dist[i][j], dist[i][k] + dist[k][j] );
			}
		}
	}

//	cout << dist[0][n*2] << endl;
	printf("%0.6f\n", dist[0][n*2] );
	
	return 0;
}

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

Measured memory_bytes: 1584
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <vector>
#include <vector>

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

signed main(void)
{
  int num;
  map<string, int> mem;

  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    string s; cin >> s;
    ++mem[s];
  }
  int m; cin >> m;
  for (int i = 0; i < m; ++i) {
    string t; cin >> t;
    --mem[t];
  }

  // num = (*(mem.cbegin())).second;
  num = 0;
  for (auto it = mem.cbegin(); it != mem.cend(); ++it) {
    num = max(num,(*it).second);
  }

  cout << num << endl;
  
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w, n;
	cin >> h >> w >> n;
	int ans = (n + max(h, w) - 1) / max(h, w);
	cout << ans << endl;
	return 0;
}

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

bool solve(int n, const vector<int> & in){
  for(const auto a : in){
    if (a%2 != 0)return false;
  }
  return true;
}

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> in(n);
  for(int i = 0;i<m;i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    in[a]++;
    in[b]++;
  }
  if (solve(n, in))cout << "YES" << endl;
  else cout <<"NO" << endl;
  return 0;
}


Measured memory_bytes: 640