akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define pii 3.14
#define mod (ll)(1e9 + 7)
#define inf (ll)(1e18)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5+5)

void solve()
{
    ll n,k;
    cin>>n>>k;

    bool check[n+1] = {0};
    while(k--)
    {
        ll d,x;
        cin>>d;
        while(d--)
        {
            cin>>x;
            check[x]=1;
        }
    }

    int ans = 0;
    for(int i=1;i<=n;i++)
    {
        if(!check[i])
            ans++;
    }

    cout<<ans<<"\n";

}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 3656
n , a , b = map(int,input().split())
s = input()
couab = 0
coub = 0
for i in range(n):
    if s[i] == "a":
        if couab < a+b:
            print("Yes")
            couab += 1
        else:
            print("No")
    elif s[i] == "b":
        coub += 1
        if couab < a+b and coub <= b:
            print("Yes")
            couab += 1
        else:
            print("No")
    elif s[i] == "c":
        print("No")

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;
vl a(401, 0);
vector<vl> cost(401, vl(401, 0));
vector<vl> vol(401, vl(401, 0));

int main(void){
  
  IN(N);
  FOR(i, 1, N+1) IN(a[i]);
  FOR(i, 1, N+1) {
    cost[i][i] = 0;
    vol[i][i] = a[i];
  }
  FOR(x, 1, N) {
    FOR(y, 1, N-x+1) {
      ll r = x + y;
      ll l = y;
      vol[l][r] = a[l] + vol[l+1][r];
      ll c = LINF;
      c = min(c, cost[l+1][r]);
      FOR(m, l+1, r-1) {
        c = min(c, cost[l][m] + cost[m+1][r]);
      }
      c = min(c, cost[l][r-1]);

      cost[l][r] = vol[l][r] + c;
      // DEBUG(cost[l][r]);
    }
    // LN();
  }

  PRINT(cost[1][N]);

}


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

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }
#define fi first
#define se second
#define mkp std::make_pair
typedef long long ll;
typedef double ff;
typedef std::pair <int, int> pii;
const int kN = 4e5 + 5, kInf = 0x3f3f3f3f;
const ll kMod = 998244353, kInfLL = 0x3f3f3f3f3f3f3f3fLL;

int n, H, cnt[kN], dg[kN], fa[kN], siz[kN]; bool flag = true;
void Add(int u, int v) { ++dg[u]; --dg[v]; }
int Find(int x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); }
void Merge(int u, int v) {
	int f_u = Find(u), f_v = Find(v);
	if(f_u == f_v) return;
	fa[f_u] = f_v; siz[f_v] += siz[f_u];
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
#endif
	int T = 1; //rd(T);
	while(T--) {
		rd(n, H);
		for(int i = 1; i <= 4 * H; ++i) fa[i] = i, siz[i] = 1;
		for(int i = 1; i <= n; ++i) {
			int A, B, C, D, d1, d2, d3; rd(A, B, C, D);
			d1 = C ? H + C : A; d2 = D ? 3 * H + D : 2 * H + B;
			d3 = D ? D : H + B;
		//	printf("A: (%d %d)\n", d1, d2);
		//	printf("B: (%d %d)\n", d2, d3);
			Merge(d1, d2); Merge(d2, d3);
			Add(d1, d2); Add(d2, d3);
		}
		//for(int i = 1; i <= 4 * H; ++i) printf("%d ", Find(i));
		//printf("\n");
		for(int i = 1; i <= 4 * H; ++i) {
			//printf("%d ", dg[i]);
			if((dg[i] > 0 && i > H) || (dg[i] < 0 && (i > 2 * H || i <= H))) {
				flag = false; break;
				//printf("?");
			}
			if(dg[i]) ++cnt[Find(i)];
		}
		//printf("\n");
		/*for(int i = 1; i <= 4 * H; ++i) if(Find(i) == i) {
			printf("%d %d %d %d\n", i, cnt1[i], cnt2[i], siz[i]);
		}*/
		for(int i = 1; i <= 4 * H; ++i)
			if(Find(i) == i && siz[i] > 1 && !cnt[i])
				flag = false;
		if(!flag) printf("NO\n");
		else printf("YES\n");
	} return 0;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n, m;
    cin >> n >> m;
    if (m < n)
        cout << "No\n";
    else
        cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
X, N = list(map(int, input().split()))
P = list(map(int, input().split()))

cands = [True for i in range(0, 102)]

for p in P:
    cands[p] = False

flag = False

if cands[X]:
    result = X
    flag = True

for i in range(1, 102):
    if flag:
        break
    if X + i < 102 and cands[X + i]:
        flag = True
        result = X + i
    if 0 <= X - i and cands[X - i]:
        flag = True
        result = X - i

print(result)


Measured memory_bytes: 9180
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	int N;
	cin >> N;
	int a, b, c, d,e;
	a = N % 100;
	b = N % 10;
	c = a - b;
	d = N - a ;
	e = a - b;
	if (e == 70 || b == 7 || d== 700) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;
const int maxn = 1e5;

map <int, int> m;
int seq[maxn + 5];
int main()
{
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++){
		scanf("%d", seq + i);
		m[seq[i]]++;
	}
	int ans = 0;
	for(int i = 1;i <= maxn;i++){
		if(m[i] > i) ans += m[i] - i;
		if(m[i] < i && m[i]) ans += m[i];
	}
	for(int i = 1;i <= n;i++){
		if(seq[i] > maxn) ans++;
		}
	cout << ans << endl;
	return 0;
}

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

using namespace std;


typedef long long ll;
int main() {
  ll n, m;
  cin >> n >> m;
  if (n==1 && m==1) {
    cout << 1 << endl;
  } else if (n==1 || m==1) {
    cout << max(n, m)-2 << endl;
  } else {
    cout << (n-2)*(m-2) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [[a for a in input()] for _ in range(H)]
mod = 10 ** 9 + 7
DP = [[0] * (W + 1) for _ in range(H+1)]
DP[1][1] = 1
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i-1][j-1] == '#':
            continue
        if i == 1 and j == 1:
            continue
        DP[i][j] = DP[i - 1][j] + DP[i][j - 1]
        DP[i][j] %= mod

print(DP[-1][-1])


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

int main(){
    int n;
    cin >> n;
    int p[n];
    int count =0;
    for(int i=0;i<n;i++)cin >>p[i];
    for(int i=0;i<n-2;i++){
        if(p[i]<=p[i+1]&&p[i+1]<=p[i+2]||p[i]>=p[i+1]&&p[i+1]>=p[i+2])count++;
    }
    cout << count << 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>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e30
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N, M, Q, H, W, L, R, K, X,Y, A, B, C, Z;
ll ans;
string S;
ll a[200];
ll x[100000000];
ll y[100000000];
ll nowcost = 1;
ll twopow[202020];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll dp[1000001];
ll p[1000000];
ll pos[1000000];

int main() {
	cin>>N>>A>>B;
	ll oldpos=0;
	cin>>oldpos;
	ll nowpos;
	rep(i,1,N){
		cin>>nowpos;
		ans+=min(B,A*(nowpos-oldpos));
		oldpos=nowpos;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  string s;
  cin >> s;

  if(s[0]==s[1]){
    cout << "Bad" << endl;
  }
  else if(s[1]==s[2]){
    cout << "Bad" << endl;
  }
  else if(s[2]==s[3]){
    cout << "Bad" << endl;
  }
  else{
    cout << "Good" << endl;
  }


  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=1005;
const int MAXM=200005;
struct edge{int x,y;}a[MAXM];
vector<pii> vec[MAXN];

//bitset<MAXN> bi[MAXM+MAXN],bnow;
int vi[MAXN][MAXN],cnt;
void dfs1(int x,int o)
{
	if(vi[o][x])return ;
	vi[o][x]=1;
	for(int i=0;i<vec[x].size();++i)cnt++,dfs1(vec[x][i].first,o);
}
int bi[2][MAXN],tim;
void dfs2(int x,int o)
{
	if(bi[o][x])return ;
	bi[o][x]=tim;
	for(int i=0;i<vec[x].size();++i)dfs2(vec[x][i].first,o);
}
int ans[MAXM],sta[MAXM],tp;
int n,m;
int main()
{
//	freopen("a.in","r",stdin);
	n=read();m=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read();
		vec[x].push_back(mp(y,i));
		a[i].x=x;a[i].y=y;
	}
	for(int i=1;i<=n;i++)dfs1(i,i);
	for(int i=1;i<=n;i++)
	{
		tp=0;memset(bi,0,sizeof(bi));
		bi[0][i]=bi[1][i]=1;
//		for(int k=last[i],lst=1;k;k=a[k].next,lst++)
		for(int k=0,lst=1;k<vec[i].size();k++,lst++) 
		{
			sta[++tp]=vec[i][k].second;tim=lst;
			dfs2(vec[i][k].first,0);
		}
		sta[tp+1]=0;
		while(tp)
		{
			if(sta[tp+1])dfs2(a[sta[tp+1]].y,1);
			int y=a[sta[tp]].y;
			if(vi[y][i]==(bi[1][y]||(bi[0][y]<tp&&bi[0][y])))
				ans[sta[tp]]=1;
			tp--;
		}
	}
//	return 0;
	for(int i=1;i<=m;i++)
	{
		if(ans[i])puts("same");
		else puts("diff");
	}
	return 0;
}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned ll
#define all(x) x.begin(), x.end()
#define CHECK_BIT(var, pos) ((var) & (1<<(pos)))
#define eb emplace_back
const int M = 1e9 + 7;

typedef long double ldb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update> ordered_set;

int main() {
    int n;
    cin >> n;
    vi v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }

    sort(all(v));
    cout << max(0, v[n / 2] - v[n / 2 - 1]) << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N + 1), v(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }
    int M = N * 1e3 + 1;
    vector<vector<ll>> dp(N + 1, vector<ll>(M, 1e13));
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j < M; j++) {
            if (i == 0) {
                if (j == 0) dp[i][j] = 0;
                continue;
            }
            if (j >= v[i]) {
                dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i]] + w[i]);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < M; i++) {
        if (dp[N][i] <= W) ans = i;
    }
    cout << ans << endl;
}

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

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

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

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

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

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

    ll a, b; cin>>a>>b;

    cout << a * b / __gcd(a, b) << endl;

    return 0;
}

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

typedef long long ll;

using namespace std;

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

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;

ll max_ll(ll n,ll k){
    if(n >= k) return n;
    else return k;
}


int main(){
    ll A,B,K;
    cin >> A >> B >> K;
    ll genkai = max_ll(A-K,0);
    if(genkai == 0) B = max_ll(B-K+A,0);
    cout << genkai << " " << B << endl;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>

int leap_year(int y) {
    if( y % 400 == 0) {
        return 1;/*Leap Year*/
    } else if (y % 100 == 0 && y % 400 != 0) {
        return 0;/*Not Leap Year*/
    } else if (y % 4 == 0 && y % 100 != 0) {
        return 1;
    } else {
        return 0;
    }
}
int main()
{
    int a, b;
    int n =0;/*output kaisuu - 1*/
    while (true) {
        std::cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        } else {
            if (n >0) {
                std::cout << std::endl;/*2 kaime ikou no output de kuugyou*/
            }
            int sum = 0;
            for (int k = a; k <= b; k++) {
                sum = sum + leap_year(k);
            }
            if (sum == 0 /*Subete Leap Year de nai*/) {
                std::cout << "NA" << std::endl;
            } else {
                for (int i =a; i <= b; i++) {
                    if (leap_year(i) == 1) {
                        std::cout << i << std::endl;
                    }
                }
            }
        }
    n++;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <cstdint>
#include <iostream>
#include <vector>
#include <algorithm>

int main(void)
{
    uint32_t N, X;

    std::cin >> N >> X;

    std::vector<uint32_t> m_list;

    for (uint32_t i = 0; i < N; ++i) {
        uint32_t m;
        std::cin >> m;
        m_list.emplace_back(m);
        X -= m;
    }

    std::sort(m_list.begin(), m_list.end());

    std::cout << m_list.size() + X/m_list.at(0) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll c[3][3], a[3][3], b[3][3];
 
int main(int argc, char **argv) {
	REP(i, 3) REP(j, 3) cin >> c[i][j];
	REP(i, 3) REP(j, 3) a[i][j] = c[i][j] - c[0][j];
	REP(i, 3) REP(j, 3) b[i][j] = c[i][j] - c[i][0];
	cout << (a[1][0] == a[1][1] && a[1][1] == a[1][2]
		&& a[2][0] == a[2][1] && a[2][1] == a[2][2]
		&& b[0][1] == b[1][1] && b[1][1] == b[2][1]
		&& b[0][2] == b[1][2] && b[1][2] == b[2][2]
		? "Yes" : "No") << endl;
	return 0;
}
 

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

int main(){
    long long int n;
    int m;
    long long int a[10000] = {};
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i];
    }
    long long int w=0;
    for(int i=0;i<m;i++){
        w = w + a[i];
    }
    if(n-w<0){
        cout<<-1<<endl;
    }
    else{
        cout<<n-w<<endl;
    }
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
char get(int x){
    if(x<10) return x+'0';
    else if(x<36) return x-10+'a';
    else return x-36+'A';
}
int main(){
        LL n;
        cin>>n;
        LL x=n%10;
        if(x==0|| x==1 || x==6 || x==8) {
            cout<<"pon"<<endl;
            }
            else if(x==2|| x==4 || x==5 || x==7 || x==9) {
            cout<<"hon"<<endl;
            }
     else cout<<"bon"<<endl;
    return 0;
}

Measured memory_bytes: 3600
n = int(input())

gou = [[]for _ in range(n)]
for i in range(n):
    a,b = map(int,input().split())
    gou[i].append(a+b)
    gou[i].append(a)
    gou[i].append(b)

gou.sort()
gou.reverse()

ans = 0
for i in range(n):
    if i%2==0:
        ans += gou[i][1]
    else:
        ans -= gou[i][2]

print(ans)


Measured memory_bytes: 55968
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

divs = make_divisors(n)
lengths = list()
o = int(len(divs)//2 + len(divs) % 2)
for i in range(o):
    a = divs[i]
    b = divs[::-1][i]

    lengths.append(a-1+b-1)


print(min(lengths))




Measured memory_bytes: 40940
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
  	ll A, B, K;
  	cin >> A >> B >> K;
  	ll ansA = A - K;
  	K -= A;
  	chmax(K, 0LL);
  	cout << max(0LL, ansA) << " " << max(0LL, B - K) << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using ll = long long;
using namespace std;

int main(){
ll N;
cin>>N;
vector<ll> V(N);
vector<ll> C(N);
ll ans =0;
	for(ll i=0;i<N;i++){
	cin>>V[i];
	}
	for(ll i=0;i<N;i++){
	cin>>C[i];
	}
	for(ll i=0;i<N;i++){
	if(V[i]-C[i]>0)
		ans+=V[i]-C[i];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
function main(input) {
  const lines = input.split("\n");
  const K = lines[0]

  let total = 0;
  for (let a = 1; a <= K; a++) {
    for (let b = 1; b <= K; b++) {
      for (let c = 1; c <= K; c++) {
        total += gcd(gcd(a, b), c);
      }
    }
  }

  function gcd(n1, n2) {
    if (n2 === 0) return n1;
    return gcd(n2, n1 % n2);
  }

  console.log(total);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

struct Node
{
    int key;
    Node *right, *left, *parent;
};
Node *root, *NIL;
void insert(int k)
{
    Node *y = NIL;
    Node *x = root;
    Node *z;
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL)
    {
        y = x;
        if(z->key < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL)
    {
        root = z;
    }
    else
    {
        if(z->key < y->key)
            y->left = z;
        else
            y->right = z;
    }
}
void inorder(Node *u)
{
    if(u == NIL)   return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}
void preorder(Node *u)
{
    if(u == NIL)    return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}
int main()
{
    int n, m;
    string s;
    cin >> n;

    while(cin >> s)
    {
        if(s[0] == 'i')
        {
            cin >> m;
            insert(m);
        }
        else if(s[0] == 'p')
        {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 26572
#include <stdio.h>
#include <vector>
 
using namespace std;
 
struct Node{
    Node(){
        parent = -1;
        depth = num_of_children = 0;
    }
    int parent;
    int depth;
    vector<int> children;
    int num_of_children;
};
 
void calcDepth(Node nodes[],int root_id){
    for(int i = 0;i < nodes[root_id].num_of_children;i++){
        nodes[nodes[root_id].children[i]].depth = nodes[root_id].depth+1;
        calcDepth(nodes,nodes[root_id].children[i]);
    }
}
 
int main(){
    int n,id,k,child_id,root_id;
    scanf("%d",&n);
    Node nodes[n];
 
    for(int i = 0; i < n; i++){
        scanf("%d %d",&id,&k);
        for(int j = 0; j < k; j++){
            scanf("%d",&child_id);
            nodes[id].children.push_back(child_id);
            nodes[id].num_of_children++;
            nodes[child_id].parent = id;
        }
    }
 
    for(root_id = 0; root_id < n; root_id++){
        if(nodes[root_id].parent == -1) break;
    }
 
    calcDepth(nodes,root_id);
 
    for(int i = 0; i < n; i++){
        if(nodes[i].parent == -1){
            printf("node %d: parent = -1, depth = 0, root, ",i);
        }else if(nodes[i].num_of_children == 0){
            printf("node %d: parent = %d, depth = %d, leaf, ",i,nodes[i].parent,nodes[i].depth);
        }else{
            printf("node %d: parent = %d, depth = %d, internal node, ",i,nodes[i].parent,nodes[i].depth);
        }
        printf("[");
        for(int j = 0; j < nodes[i].num_of_children-1; j++){
            printf("%d, ",nodes[i].children[j]);
        }
        if(nodes[i].num_of_children > 0){
            printf("%d",nodes[i].children[nodes[i].num_of_children-1]);
        }
        printf("]\n");
    }
}



Measured memory_bytes: 7472
#define _CRT_SECURE_NO_WARNINGS
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

#define GETI1(buf,p1)           do{ GETSTR(buf); sscanf((buf), "%d", &(p1));                          } while(0)
#define GETI2(buf,p1,p2)        do{ GETSTR(buf); sscanf((buf), "%d%d ", &(p1),&(p2));                 } while(0)
#define GETI3(buf,p1,p2,p3)     do{ GETSTR(buf); sscanf((buf), "%d%d%d ", &(p1),&(p2),&(p3));         } while(0)
#define GETI4(buf,p1,p2,p3,p4)  do{ GETSTR(buf); sscanf((buf), "%d%d%d%d ", &(p1),&(p2),&(p3),&(p4)); } while(0)

#ifdef _DEBUG
#define pf printf
#else
#define pf(...) /* */
#endif

typedef long long ll;
typedef unsigned long long ull;

int main(void){

    vector<int> v;
    int n;
    while(cin >> n){
        v.push_back(n);
    }
    sort(v.begin(), v.end(), greater<int>());

    FOREACH(it, v){
        if(it != v.begin()) cout << " ";
        cout << *it;
    }
    cout << endl;

    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<pair<int, int>> AB(N - 1);
  vector<int> c(N - 1, 0);
  vector<vector<pair<int, int>>> graph(N);
  for(int i = 0; i < N - 1; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    AB[i] = make_pair(a, b);
    graph[a].push_back(make_pair(i, 0));
    graph[b].push_back(make_pair(i, 0));
  }
  
  int K = 0;
  for(int i = 0; i < N; i++){
    K = max(K, (int)graph[i].size());
  }
  
  for(int i = 0; i < N; i++){
    set<int> color;
    for(int j = 0; j < graph[i].size(); j++){
      color.insert(c[graph[i][j].first]);
    }
    int k = 1;
    for(int j = 0; j < graph[i].size(); j++){
      if(c[graph[i][j].first] == 0){
        while(color.find(k) != color.end() && k <= K){
          k++;
        }
        c[graph[i][j].first] = k;
        color.insert(k);
      }
    }
  }
  
  cout << K << endl;
  for(int i = 0; i < N - 1; i++){
    cout << c[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 7680
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    if (N%2 == 0) {
      System.out.println(N / 2);
    }else{
      System.out.println(N / 2 + 1);
    }
  }
}


Measured memory_bytes: 35556
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

int main(){
    int n; cin>>n;
    ll min_price = 999999999; ll max_revenue = -999999999;

    for(int i=0;i<n;i++){
        ll m; cin>>m;
        if(i==0){
            min_price = m;
            continue;
        }
            
        max_revenue = max(max_revenue, m-min_price);
        min_price = min(m, min_price);
    }
    cout<<max_revenue<<endl;
}






Measured memory_bytes: 3108
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int h,w;
char a[55][55];
void solve(int x,int y)
{
    int sum=0;
    for(int i=-1;i<=1;++i)
    {
        for(int j=-1;j<=1;++j)
        {
            if(i!=0||j!=0)
            {
                if(x+i>=0&&y+j>=0&&x+i<h&&y+j<w)
                {
                    if(a[x+i][y+j]=='#')
                        sum++;
                }
            }
        }
    }
    a[x][y]='0'+sum;
}
int main()
{
    scanf("%d%d",&h,&w);
    for(int i=0;i<h;++i)
    {
        scanf("%s",&a[i]);
    }
    for(int i=0;i<h;++i)
    {
        for(int j=0;j<w;++j)
        {
            if(a[i][j]!='#')
                solve(i,j);
        }
    }
    for(int i=0;i<h;++i)
    {
        for(int j=0;j<w;++j)
        {
            printf("%c",a[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

ll n,m,v,p;
lvector A;

bool canwin(ll i) {
  if(n-i<=p) return true;
  ll val=A[i]+m;
  lvector B(n);
  rep(j,n) {
    if(j>=n-p+1) B[j]=m;
    else B[j]=min(val-A[j],m);
  }
  if(*min_element(ALL(B))<0) return false;
  B[i]=0;
  ll sum=0;for(ll j:B) sum+=j;
  return sum>=m*(v-1);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n>>m>>v>>p;
  A.resize(n);rep(i,n) cin>>A[i];sort(ALL(A));
  ll l=-1,r=n-1,x;
  while(l+1<r) {
    x=(l+r)/2;
    if(canwin(x)) r=x;else l=x;
  }
  print(n-r);
  return 0;
}

Measured memory_bytes: 4804
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int n, w;
	cin >> n >> w;
	vector<vector<char>> rap(n ,vector<char>(w));
	vi memo_n(n+1,0);
	vi memo_w(w+1,0);
	repz(i, n) {
		repz(j, w) {
			cin >> rap[i][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for(int j = 0;j < w; ++j) {
			if (rap[i][j] == '#')break;
			if (j == (w - 1))memo_n[i] = 1;
		}
	}

	for (int i = 0; i < w; i++) {
		for (int j = 0; j < n; ++j) {
			if (rap[j][i] == '#')break;
			if (j == (n - 1))memo_w[i] = 1;
		}
	}

	repz(i, n) {
		repz(j, w) {
			if (memo_n[i] == 0 && memo_w[j] == 0)cout << rap[i][j];
			if (j == w - 1 && memo_n[i] == 0)cout << endl;
		}
	}

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////


int main() {
	ll N, K;
	cin >> N >> K;

	string S;
	cin >> S;

	ll c = 0;//見ている位置
	rep(i, K) {
		if (c % 2 == 0) {
			if (S[c%N] == 'A') { S[c%N] = 'B'; }
			else { c++; }
		}

		else {
			if (S[c%N] == 'B') { S[c%N] = 'A'; }
			else { c++; }
		}

		if (c > N && (K - i - 1) % 2 == 0) { break; }
	}


	rep(i, N) {
		char t = S[(c + i) % N];
		if(c%2==1) {
			if (t == 'A') { t = 'B'; }
			else { t = 'A'; }
		}
		cout << t;
	}

	cout << endl;
}


Measured memory_bytes: 772
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int red =0;
    int blue = 0;
    for(int i=0; i<S.length(); i++){
      if(S.substring(i, i+1).equals("0")){
        //System.out.println(S.substring(i, i+1));
        red++;
      }else{
        blue++;
      }
    }
    System.out.println(Math.min(red, blue)*2);
  }
}

    
    

Measured memory_bytes: 44136
import java.util.Scanner;

public class Main {
    static final Scanner sc  = new Scanner(System.in);
    static final int     MOD = (int) 1E9 + 7;
    static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        int N = nint();
        final int A = 0, B = 1, C = 2;
        int[][] in = new int[3][N];
        for (int n = 0; n < N; n++) {
            for (int x = A; x <= C; x++) {
                in[x][n] = nint();
            }
        }
        
        int[][] dp = new int[3][N];
        for (int x = A; x <= C; x++) {
            dp[x][0] = in[x][0];
        }
        
        for (int i = 1; i < N; i++) {
            for (int x = A; x <= C; x++) {
                dp[x][i] = max(dp[(x+1) % 3][i-1], dp[(x+2) % 3][i-1]) + in[x][i];
            }
        }
        
        System.out.println(max(dp[A][N-1], dp[B][N-1], dp[C][N-1]));
    }
    static int max(int... ints) {
        int max = -INF;
        for (int i: ints) {
            max = Math.max(i, max);
        }
        return max;
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0);
    }

    private static char[][] nchars2(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}


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

int main( )
{
    vector<string> v;
    string s;
    int n, l;
    cin >> n >> l;
    while (n--) {
        cin >> s;
        v.push_back(s);
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < (int) v.size(); i++) {
        cout << v[i];
    }
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

vector<int> ans;
G g(200005);

void dfs(int v, int p = -1) {
  for (int u: g[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main() {
  IOS;
  int n,q; cin >> n >> q;
  REP(i,n-1) {
    int a,b; cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  ans.resize(n);
  REP(i,q) {
    int p,x; cin >> p >> x;
    p--;
    ans[p] += x;
  }
  dfs(0);

  REP(i,n) {
    if (i > 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 24224
N = int(input())
W = list(map(int,input().split()))
W_sum = sum(W)
W_val = 0
W_abs_list = []
for i in range(0,N):
  W_val += W[i]
  W_sum_remain = W_sum - W_val
  W_abs = abs(W_sum_remain - W_val)
  W_abs_list.append(W_abs)
print(min(W_abs_list))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,i,k,j;
	scanf("%d%d",&a,&b);
	if(b>=a)
	{
		printf("%d",a);
	}
	else if(b<a)
		printf("%d",a-1);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt(),b=scan.nextInt();
		if(a+b<10) {
			System.out.println(a+b);
		}
		else {
			System.out.println("error");
		}

	}

}

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

int main() {
	string s;
	cin >> s;
	int l = (int)s.size();
	bool ok = false;
	for (int i = 0; i < l; i++) {
		for (int j = i; j < l; j++) {
			string t = s.substr(0, i);
			string u = s.substr(j, l - i);
			if (t + u == "keyence") ok = true;
		}
	}
	if (ok) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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


int main(){
    int N = 99;
    string result;
    string S;
    cin >> S;
    int flag = 0;

    int pre = stoi(S.substr(0, 2));
    int post = stoi(S.substr(2));


    if (pre <= 0 || 13 <= pre){ // MMYYではない
        if (post <= 0 || 13 <= post){ //YYMMではない
            result = "NA";
        }else {
            result = "YYMM";
        }
    } else if ( (1 <= pre && pre <= 12) && (1 <= post && post <= 12)){
        result = "AMBIGUOUS";
    } else {
        result = "MMYY";
    }

    cout << result << endl; 
    
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//bool f[100001];//1000000以下の素数を調べよう！
//rrep(i,2,100001){
  //      f[i]=false;
    //}
//rrep(i,2,100001){
  //      if(!f[i]){
    //        for(int j=i+i;j<=100000;j+=i){
      //          f[j]=true;
        //    }
        //}
    //}
    //for(int i=3;i<=100000;i+=2){
      //  if(!f[i]){
        //    c[i]++;
      //  }
   // }

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=2,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >> n >> m;
      // rep(i,m){
           ans+=1900*m+(n-m)*100;
       //}
       rrep(i,1,m){
           cnt*=2;
       }
       Cout(ans*cnt);
       
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod=1000000007;
const double PI = 3.14159265359;
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define INF 1000000000000
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define count_1(n)  __builtin_popcountll(n)
#define parity(n)   __builtin_parityll(n)   //Even parity 0 as output
void show    (int a[], int arraysize) { for (int i = 0; i < arraysize; ++i)  {cout << a[i] << " ";}	cout<<endl;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
void sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}
int main()
{FAST
int n;
ld m,sum=0;
cin>>n>>m;
int a[n];
FOR(i,n)
{
	cin>>a[i];
	sum+=a[i];
}
ld x=sum/(4*m);
FOR(i,n)
{
	if(a[i]>=x)
	{
		m--;
	}
	if(m==0)
	{
		break;
	}
}
if(m==0)
{
	cout<<"Yes\n";
}
else
{
	cout<<"No\n";
}
return  0;
}






Measured memory_bytes: 3708
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
//using namespace __gnu_pbds;
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define maxn 100005
#define inf 1e18
#define boost ios::sync_with_stdio(false);cin.tie(0)
#define fr freopen("source.txt","r",stdin),freopen("output.txt","w",stdout)
#define SET(a,b) memset(a,b,sizeof(a))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define ps(x,y) fixed<<setprecision(y)<<x
//template<typename T>
//using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out <<  "(" << a.F << ", " << a.S << ")";
}
 
template<class A> ostream& operator << (ostream& out, const vector<A> &a) {
	out << "[";
	for (auto it = a.begin(); it != a.end(); ++it) {
		if (it != a.begin())
			out << ", ";
		out << *it;
	}
	return out << "]";
}
int main()
{
    boost;
    ll n,i,j,x,t,y;
	cin>>n;
	set<string>s;
	string c;
	for(i=0;i<n;i++){
		cin>>c;
		s.insert(c);
	}
	cout<<s.size();
}

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

using namespace std;

int main(){
	int num[4] = {0};
	for(int i = 0;i < 3;i++){
		int a,b;
		cin >> a >> b;
		num[a-1]++;
		num[b-1]++;
	}
	
	int max_num = 0;
	for(int i = 0;i < 4;i++){
		max_num = max(max_num,num[i]);
	}
	
	if(max_num == 2){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define simplify ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;


int32_t main(){

    simplify

    int n;
    cin>>n;

    string s;
    vector<int>arr(n);
    cin>>s;

    int r,g,b;
    r=g=b=0;

    for(int i=0;i<n;i++){
        if(s[i]=='R'){
            arr[i]=1; r++;
        }
        else if(s[i]=='G'){
            arr[i]=2; g++;
        }
        else{
            arr[i]=5; b++;
        }
    }

    int total=r*g*b;
    int substract=0;
    int sum;
    for(int gap=1;gap<n;gap++){
        for(int i=0;i<n;i++){
            if(i+gap>=n)break;
            if(arr[i]+arr[i+gap]+arr[i+2*gap]==8)substract++;

        }
    }
    total-=substract;
    cout<<total;





    
    return 0;
}


Measured memory_bytes: 3648
import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial, std.numeric;

void main(){
    auto nk=readln.split.map!(to!long).array;
    auto N=nk[0];
    auto K=nk[1];
    int[][] arr;
    foreach(i;0..N)arr~=(readln.split.map!(to!int).array);
    arr.sort();
    long count=0;
    foreach(elm;arr){
        count+=elm[1];
        if(count>=K){
            writeln(elm[0]);
            return;
        }
    }
}


Measured memory_bytes: 11644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

int n;
int k = 0;
vector<vector<int>> g;
map<int, int> ans;
int a[100005], b[100005];

void dfs(int u, int par, int color) {
    int c = 1;
    for (int v:g[u]) {
        if (v == par) continue;
        if (c == color) c++;
        
        ans[max(u, v) * n + min(u, v)] = c;
        dfs(v, u, c);
        c++;
    }
    k = max(k, c - 1);
}

int main() {
    cin >> n;
    g.resize(n + 1);

    for (int i = 0; i < n - 1; i++) {
        cin >> a[i] >> b[i];
        
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }

    dfs(1, 0, -1);

    cout << k << endl;
    for (int i = 0; i < n - 1; i++) {
        cout << ans[b[i] * n + a[i]] << endl;
    }


    return 0;
}


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

int main() {
	// your code goes here
	int n,x;
	cin>>n>>x;
	int a[n];
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	sort(a,a+n);
	cout<<(n+((x-sum)/a[0]));
	return 0;
}

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

int main(){
    //input
    int n,x;
    cin >> n >> x;
    int count=0;
    int sum = 0;
    int mi = INT_MAX;
    for(int i=0;i<n;i++){
        int m;
        cin >> m;
        sum += m;
        mi = min(mi,m);
        count++;
    }
    int rest = x - sum;
    cout <<  count + rest / mi << endl;

    return 0;
}

Measured memory_bytes: 256