akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <ctime>
#include <climits>
#include <cassert>
#include <cmath>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#define Fill(a, b) memset(a, b, sizeof(a))
#define Copy(a, b) memcpy(a, b, sizeof(b))
#define NPOS string::npos
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define erep(j, a) for (Tedge *j = a; j; j = j -> next)
#define irep(i,a) for (__typeof(a.begin()) i = a.begin(); i != a.end(); i++)
#define sqr(a) ((a) * (a))
#define sf scanf
#define pf printf
#define pb push_back
#define ppb pop_back
#define pft push_front
#define ppf pop_front
#define mp make_pair
#define vec vector
#define it iterator
#define fir first
#define sec second
#define x first
#define y second
#define all(a) a.begin(),a.end()
#define sz(a) (int)(a.size())
#define bg(a) (a).begin()
#define en(a) (a).end()
#define clr(a) (a).clear()
#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define bin_cnt(x) __builtin_popcount((unsigned)x)
#define gcd(a, b) __gcd(a, b)
using namespace std;
template<class T> inline bool gmin(T &a, T b) { if (a > b) return a = b, true; return false; }
template<class T> inline bool gmax(T &a, T b) { if (a < b) return a = b, true; return false; }
template<class T> T exgcd(T a, T b, T &x, T &y) { if (!b) return x = (T)1, y = (T)0, a; else { T d = exgcd(b, a % b, y, x); return y -= a / b * x, d; } }
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vec<int> vi;
typedef vec<double> vd;
typedef istringstream iss;
typedef ostringstream oss;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = 1e10;
const double EPS = 1e-9;
const double PI = 3.14159265358979323846264338327950288;
inline int dcmp(const double &a) { return a > EPS ? 1 : (a < -EPS ? -1 : 0); }

const int MAXN = 1005;

int n, q;
pii era[MAXN];
char s[MAXN][20];

int main() {
    while (sf("%d %d", &n, &q), n + q) {
        rep (i, 1, n) {
            int a, b;
            sf("%s %d %d", s[i], &a, &b);
            era[i] = mp(b - a + 1, b);
        }
        rep (i, 1, q) {
            int y;
            sf("%d", &y);
            bool flag = false;
            rep (i, 1, n) if (y >= era[i].fir && y <= era[i].sec) {
                pf("%s %d\n", s[i], y - era[i].fir + 1);
                flag = true;
                break;
            }
            if (!flag) pf("Unknown\n");
        }
    }
	return 0;
}

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

#define MAXN (int)(2 * 1e5 + 1)
#define F first
#define S second
#define endl "\n"
#define MOD (lli)(1e9 + 7)
#define lli long long int
#define sz(a) int(a.size())
#define DEBUG if (0) cout << "aqui" << endl;
#define PI 2 * acos(0.0)
typedef pair<int, int> ii;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1};

string s;
int q;

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

  cin >> s;
  cin >> q;
  deque<char> aux;

  for(auto i : s) aux.push_back(i);

  bool at = false;
  int rev = 0;
  while(q--) {
    int t;
    cin >> t;
    if(t == 1) {
      if(!at) at = true;
      else at = false;
      rev++;
    } else {
      int f;
      char c;
      cin >> f >> c;
      if(f == 1) {
        if(!at) aux.push_front(c);
        else aux.push_back(c);
      } else {
        if(!at) aux.push_back(c);
        else aux.push_front(c);
      }
    }
  }

  s = "";
  for(auto i : aux) s += i;

  if(rev%2!=0) reverse(s.begin(), s.end());

  cout << s << endl;

  return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> grid(H, vector<char>(W)); 
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> grid.at(i).at(j);
    }
  }
  
  vector<vector<bool>> del(H, vector<bool>(W)); // true のとき表示しない
  for(int i = 0; i < H; i++){
    bool white = true;
    
    for(int j = 0; j < W; j++){
      if(grid.at(i).at(j) == '#'){
        white = false;
      }
    }
    
    if(white){
      for(int j = 0; j < W; j++){
        del.at(i).at(j) = true;
      }
    }
  }
  
  for(int i = 0; i < W; i++){
    bool white = true;
    
    for(int j = 0; j < H; j++){
      if(grid.at(j).at(i) == '#'){
        white = false;
      }
    }
    
    if(white){
      for(int j = 0; j < H; j++){
        del.at(j).at(i) = true;
      }
    }
  }
  
  for(int i = 0; i < H; i++){
    bool black = false;
    
    for(int j = 0; j < W; j++){
      if(del.at(i).at(j) == false){
        cout << grid.at(i).at(j);
        
        black = true;
      }
    }
    
    if(black){
      cout << endl;
    }
  }
  
}

Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rrepi(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bit(n) (1LL << (n))
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
    preprocess() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} ____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main() {
    int h, w, m;
    cin >> h >> w >> m;
    vector<pi> bomb;
    vi cntx(h), cnty(w);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        bomb.emplace_back(a, b);
        cntx[a]++;
        cnty[b]++;
    }
    int mxx = *max_element(all(cntx));
    int mxy = *max_element(all(cnty));
    vi xidx(h,-1), yidx(w,-1);
    int xcnt = 0, ycnt = 0;
    rep(i, h) {
        if (mxx == cntx[i]) xidx[i]=xcnt++;
    }
    rep(i, w) {
        if (mxy == cnty[i]) yidx[i]=ycnt++;
    }
    vi cnt(xcnt);
    rep(i, m) {
        int a, b;
        tie(a, b) = bomb[i];
        if (xidx[a]!=-1 && yidx[b]!=-1) {
            cnt[xidx[a]]++;
        }
    }
    int minus = 1;
    rep(i, xcnt) {
        if (cnt[i] != ycnt) minus = 0;
    }
    cout << mxx + mxy - minus << '\n';
}


Measured memory_bytes: 11256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (a > b) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, x, t; cin >> n >> x >> t;
  cout << (n + x - 1) / x * t << endl;

  return (0);
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
//Combination
long long extGCD(long long a,long long mod,long long &x,long long &y){
    if(mod==0){
        x=1;
        y=0;
        return a;
    }
    long long d=extGCD(mod,a%mod,y,x);
    y-=(a/mod)*x;
    return d;
}
long long invmod(long long a,long long mod){
    long long x,y;
    extGCD(a,mod,x,y);
    x%=mod;
    if(x<0)x+=mod;
    return x;
}
ll fac[2000010],finv[2000010],inv[2000010];
void combinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    REP(i,2,2000010){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=invmod(i,mod);
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll comb(ll n,ll k){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
int main(){
    ll n,k;cin>>n>>k;
    combinit();
    if(n-1<=k){
        cout<<comb(2*n-1,n)<<endl;
        return 0;
    }
    vector<ll>a(n);
    a[0]=1;
    REP(i,1,n){
        a[i]=(a[i-1]+comb(n,i)%inf*comb(n-1,i)%inf)%inf;
        if(a[i]<0)a[i]+=inf;
    }
    cout<<a[k]<<endl;
}

Measured memory_bytes: 48640
from sys import exit, stdin

N, M = [int(_) for _ in stdin.readline().rstrip().split()]
ab = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]
cd = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]

for i in range(N):
    answers = []
    for j in range(M):
        ans = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        answers.append(ans)
    print(answers.index(min(answers))+1)

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

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

    vector<string> arr;

string tes;
    for(int i=0;i<s.size();++i){
    tes="";

        for(int k=i;k<(i+choose)&&k<s.size();++k){
            tes.push_back(s[k]);
            arr.push_back(tes);
        }
    }


    set<string> ok(arr.begin(),arr.end());
    arr.assign(ok.begin(),ok.end());

    cout<<arr[choose-1]<<endl;

}

Measured memory_bytes: 2300
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c1 = 0;
        int c2 = 0;
        int c3 = 0;
        for(int i = 0; i < n; i++) {
            int p = scan.nextInt();
            if(p <= a) c1++;
            else if(p <= b) c2++;
            else c3++;
        }
        System.out.println(Math.min(c1, Math.min(c2, c3)));
    }

    public static void main(String[] args){
        new Main().solve();
    }
}


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

int main(){
  int x,y; cin>>x>>y;

  if(((x>=0 && y>=0)||(x<=0 && y<=0)) && x<=y)cout<<y-x<<endl;
  else if((x>=0 && y<=0)||(x<=0 && y>=0))cout<<abs(abs(x)-abs(y))+1<<endl;
  else cout<<x-y+2<<endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<long long> v(N);
    vector<long long> dp(N + 2,1e9);
    for (int i = 0; i < N;i++)
        cin >> v[i];

    dp[0] = 0;
    dp[1] = abs(v[0] - v[1]);

    for (int i = 2;i < N;i++){
            dp[i] = min(dp[i], dp[i - 1] + abs(v[i] - v[i - 1]));
            dp[i] = min(dp[i], dp[i - 2] + abs(v[i] - v[i - 2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include"bits/stdc++.h"
using namespace std;

int main() {
	int card[3][3];
	int check[3][3];
	for (int i = 0;i < 3;++i) {
		for (int j = 0;j < 3;++j) {
			cin >> card[i][j];
			check[i][j] = 0;
		}
	}
	int N;
	cin >> N;
	vector<int> b(N);
	for (int i = 0;i < N;++i) {
		cin >> b[i];
	}
	for (int i = 0;i < 3;++i) {
		for (int j = 0;j < 3;++j) {
			for (int k = 0;k < N;++k) {
				if (card[i][j] == b[k]) {
					check[i][j] = 1;
				}
			}
		}
	}
	for (int i = 0;i < 3;++i) {
		if (check[i][0] == 1 && check[i][1] == 1 && check[i][2] == 1) {
			cout << "Yes" << endl;
			return 0;
		}
		if (check[0][i] == 1 && check[1][i] == 1 && check[2][i] == 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	if (check[0][0] == 1 && check[1][1] == 1 && check[2][2] == 1) {
		cout << "Yes" << endl;
		return 0;
	}
	if (check[0][2] == 1 && check[1][1] == 1 && check[2][0] == 1) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  rep(i,1,10)rep(j,i,10)if(i*j==N)flag=1;
  if(flag)Out("Yes");
  else Out("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <assert.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<pair<int, int> > A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i].first;
		A[i].second = i;
	}
	sort(A.begin(), A.end());

	int x = -1;
	for (int i = 0; i < N; i++) {
		if (A[i].first >= N - i - 1) {
			x = i;
			break;
		}
	}
	//cerr <<"x = "  <<  x << endl;
	if (x == -1) {
		res = 0;
		for (int i = 0; i < N; i++) {
			res += abs(A[i].first - A[i].second);
		}
	}
	else {
		priority_queue<pair<int, int> > le;
		for (int i = 0; i < x; i++) {
			if (A[i].second < N - x) {
				le.emplace(-A[i].first - A[i].second - abs(A[i].first - A[i].second), i);
			}
		}

		priority_queue<pair<int, int> > ri;
		for (int i = x; i < N; i++) {
			if (A[i].second >= N - x) {
				ri.emplace(A[i].first + A[i].second - abs(A[i].first - A[i].second), i);
			}
		}
		//cerr << le.size() << " " << ri.size() << endl;
		//assert(le.size() == ri.size());
		for (int i = 0; i < M; i++) {
			if ((int)le.size() == 0)break;
			int X = le.top().second; le.pop();
			int Y = ri.top().second; ri.pop();

			swap(A[X].second, A[Y].second);
			//cerr << X << " " << Y << endl;

		}
		res = 0;
		for (int i = 0; i < N; i++) {
			res += abs(A[i].first - A[i].second);
		}

	}


	cout << res << endl;
}


Measured memory_bytes: 6272
// https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void append(ll used_ct, ll rest_len, string cur, V<string>& res, ll N) {
  if (rest_len == 0) {
    res.emplace_back(cur);
    return;
  }

  rep(i, used_ct + 1) {
    string next = cur + (char)('a' + i);
    append(i == used_ct ? used_ct + 1 : used_ct, rest_len - 1, next, res, N);
  }
}

void solve() {
  ll N;
  cin >> N;

  V<string> res(0);
  append(0, N, "", res, N);

  sort(all(res));

  for (auto st : res) {
    cout << st << endl;
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 7796
from collections import deque

N, *AB = map(int, open(0).read().split())

E = [set() for _ in range(N + 1)]
memo = {}
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
    E[a].add(b)
    E[b].add(a)
    memo[(a, b)] = i
    memo[(b, a)] = i

K = max(len(e) for e in E)

A = [0] * (N - 1)

Q = deque([(-1, 1)])
while Q:
    p, v = Q.popleft()
    C = (c for c in range(1, K + 1) if c != p)
    for u in E[v]:
        E[u].remove(v)
        c = next(C)
        Q.append((c, u))
        A[memo[(v, u)]] = c

print(K)
for a in A:
    print(a)


Measured memory_bytes: 69540
A=int(input())
B=int(input())
C=int(input())
X=int(input())



count=0

P=X
for i in range(A+1):
    X=P
    X-=500*i
    if X==0:
        count+=1
    elif X<0:
        pass
    else:
        Q=X
        for j in range(B+1):
            X=Q
            X-=100*j
            if X==0:
                count+=1
            elif X<0:
                pass

            else:
                R=X
                for k in range(C):
                    X=R
                    X-=50*(k+1)
                    if X==0:
                        count+=1
                    else:
                        pass

print(count)


Measured memory_bytes: 39792
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
const int mod = 1000003;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int cnt = 1;
	if (b != a)cnt += 1;
	if (c != b&&c != a)cnt += 1;
	print(cnt);
	return 0;
}

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

using namespace std;

int A[200002],B[200002];

int main(){
    int t=1;
    //cin >> t;
    while (t--) {
        int n, m ,ms;
        scanf("%d%d%d", &n, &m, &ms);

        for(int A_i = 0; A_i < n; A_i++){
            scanf("%d",&A[A_i]);
        }
        for(int B_i = 0; B_i < m; B_i++){
           scanf("%d",&B[B_i]);
        }

        long long sum = 0;
        int x = 0, y = 0;

        while (x < n && sum + A[x] <= ms) {
            sum += A[x++];
        }

        int ans = x;

        while (y < m && x >= 0) {
            sum += B[y++];
            while (sum > ms && x > 0) {
                sum -= A[--x];
            }

            if (sum <= ms && ans < x + y) {
                ans = x + y;
            }
        }

        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 5352
const Main = input => {
    input = input[0].split('');
    const l = input[0]+input[1], r = input[2]+input[3];
    if (l == 0 || l > 12) {
        if (r == 0 || r > 12) {
            console.log('NA');
        } else {
            console.log('YYMM');
        }
    } else {
        if (r == 0 || r > 12) {
            console.log('MMYY');
        } else {
            console.log('AMBIGUOUS');
        }
    }
};
Main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

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

#define ll long long 
#define mkp make_pair 
#define fi first 
#define se second

using namespace std ;

ll z ;

int	 main ( ) {

	ll x , y , z ;
	cin >> x >> y >> z ;
	x -= z ;
	y += z ;
	cout << x / y ;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define endl "\n"
#define int long long
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define rep(n) for(int i=0;i<(n);i++)
#define rrep(n) for(int i=(n)-1;i>=0;i--)
#define mem(a,b) memset((a),(b),sizeof (a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF long long(1e18)
#define MOD 1000000007
int dp[101][100001];
int fun(int i,int w[],int val[],int n,int total){
    if(total<0) return INT_MIN;
    if(i==n||total ==0) return 0;
    if(dp[i][total]!=-1) return dp[i][total];
    int c1 = fun(i+1,w,val,n,total);
    int c2 = fun(i+1,w,val,n,total-w[i]) + val[i];
    dp[i][total]  = max(c1,c2);
    return dp[i][total];
}

void solve(){
    memset(dp,-1,sizeof dp);
    int n,total;
    cin>>n>>total;
    int  w[n],val[n];
    rep(n) cin>>w[i]>>val[i];
    cout<<fun(0,w,val,n,total)<<endl;
}

int32_t main(){
    FAST
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}




Measured memory_bytes: 82512
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N, M := getInt(), getInt()
	uf := Dsu(N)
	for i := 0; i < M; i++ {
		a, b := getInt()-1, getInt()-1
		uf.Merge(a, b)
	}
	x := uf.Groups()
	out(len(x) - 1)
}

//
// Disjoint Set Union: Union Find Tree
//

// DSU :
type DSU struct {
	parentOrSize []int
	n            int
}

// Dsu :
func Dsu(n int) *DSU {
	var d DSU
	d.n = n
	d.parentOrSize = make([]int, n)
	for i := 0; i < n; i++ {
		d.parentOrSize[i] = -1
	}
	return &d
}

// Merge :
func (d DSU) Merge(a, b int) int {
	x, y := d.Leader(a), d.Leader(b)
	if x == y {
		return x
	}
	if -d.parentOrSize[x] < -d.parentOrSize[y] {
		x, y = y, x
	}
	d.parentOrSize[x] += d.parentOrSize[y]
	d.parentOrSize[y] = x
	return x
}

// Same :
func (d DSU) Same(a, b int) bool {
	return d.Leader(a) == d.Leader(b)
}

// Leader :
func (d DSU) Leader(a int) int {
	if d.parentOrSize[a] < 0 {
		return a
	}
	d.parentOrSize[a] = d.Leader(d.parentOrSize[a])
	return d.parentOrSize[a]
}

// Size :
func (d DSU) Size(a int) int {
	return -d.parentOrSize[d.Leader(a)]
}

// Groups : original implement
func (d DSU) Groups() [][]int {
	m := make(map[int][]int)
	for i := 0; i < d.n; i++ {
		x := d.Leader(i)
		if x < 0 {
			m[i] = append(m[i], i)
		} else {
			m[x] = append(m[x], i)
		}
	}
	ret := make([][]int, len(m))
	idx := 0
	for _, e := range m {
		ret[idx] = make([]int, len(e))
		copy(ret[idx], e)
		idx++
	}
	return ret
}


Measured memory_bytes: 13628
// 0175
#include <iostream>
#include <vector>
using namespace std;

int main(){
	while(1){
		int n;
		cin>>n;

		if(n == -1)
			break;

		vector<int> a;
		if(n == 0)
			a.push_back(0);

		while(n != 0){
			a.push_back(n%4);
			n /= 4;
		}

		for(int i=a.size()-1;i>=0;i--)
			cout<<a[i];
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1212
def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    R, C, N = LI()
    P = []
    P1 = []; P2 = []; P3 = []; P4 = []
    index = 0
    for i in range(N):
        x1,y1,x2,y2 = LI()
        if (x1 not in (0,R)) and (y1 not in (0,C)):
            continue
        if (x2 not in (0,R)) and (y2 not in (0,C)):
            continue

        if x1==0:
            P1.append((x1, y1, index))
        elif y1 == C:
            P2.append((x1, y1, index))
        elif x1==R:
            P3.append((x1, y1, index))
        else:
            P4.append((x1, y1, index))

        if x2==0:
            P1.append((x2, y2, index))
        elif y2 == C:
            P2.append((x2, y2, index))
        elif x2==R:
            P3.append((x2, y2, index))
        else:
            P4.append((x2, y2, index))
        index += 1
    P1.sort(key=lambda x:x[1])
    P2.sort()
    P3.sort(key=lambda x:x[1], reverse=True)
    P4.sort(reverse=True)
    for _,_,p in P1:
        P.append(p)
    for _,_,p in P2:
        P.append(p)
    for _,_,p in P3:
        P.append(p)
    for _,_,p in P4:
        P.append(p)
    #print(P)

    que = deque()
    for index in P:
        if que:
            now = que.pop()
            if index==now:
                continue
            que.append(now)
            que.append(index)
        else:
            que.append(index)
    if que:
        print("NO")
    else:
        print("YES")
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 129520
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
  long n;
  scanf("%ld",&n);
  int l = n;
  for(int i = 1;i < l;i++){
    n *=(l-i);
  }
  if(n ==0)
    n = 1;
  printf("%ld\n",n);
  return 0;
}

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

using namespace std;
int main(){
    int a,b,ans,temp;
    cin >> a >> b;
    ans = abs(a-b);
    temp= 16-(a+b);
    if(ans>temp/2) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n);i>=(j);i--)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

ll n,m;

int main(){
    cin>>n>>m;
    ll ans=0;
    if(n*2>m){
        ans=m/2;
    }
    else{
        ans+=n;
        m-=n*2;
        ans+=m/4;
    }
    cout<<ans<<"\n";
    return 0;
}


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

using namespace std;

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

  int n, m, p, y;
  cin >> n >> m;
  map<int, vector<pair<int, int>>> pref;
  vector<string> res(m);
  for (int i = 0; i < m; ++i) {
    cin >> p >> y;
    pref[p].push_back({i, y});
  }
  for (auto &rr : pref) {
    int pr = rr.first;
    vector<pair<int,int>> &ord = rr.second;
    sort(ord.begin(), ord.end(), [&](pair<int, int> a, pair<int, int> b) {return a.second<b.second;});
    for (int i = 0; i < ord.size(); ++i) {
      ostringstream oss;
      oss << setw(6) << setfill('0') << pr << setw(6) << setfill('0') << i+1;
      res[ord[i].first] = oss.str();
    }
  }
  for (auto &r : res) 
    cout << r << endl;
  

  return 0;
}



Measured memory_bytes: 17920
#include<stdio.h>

int table[1000000];
int uncheck_min = 0;


int calc(int x){
  int i;
  for (i = 2; i*i  <= x; i++){
    if(isprime(i)){
      if (0 == (x% i )){
        return 0;
      }
    }
  }
  return 1;
}

int isprime(int n){
  while (!(n < uncheck_min)){
    table[uncheck_min] = calc(uncheck_min);
    uncheck_min += 1;
  }
  return table[n];
}


int main(){
  int i;
  int n;
  int count;
  table[2] = 1;
  uncheck_min = 3;

  while(scanf("%i", &n) == 1){
    count  = 0;
    for (i = 0; i <=n; i++){
      if(isprime(i)){
        count++;
      }
    }
    /*
    for (i = 0; i < uncheck_min; i++){
      if (isprime(i)){
        printf("%d Yes\n", i);
      }else{
        printf("%d No\n", i);
      }
    }
    */
    printf("%d\n", count);
  }
  return 0;
}

Measured memory_bytes: 4308
# include <bits/stdc++.h>
# pragma GCC optimize("Ofast")
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define forn(i, n) for (int i = 0; i < int(n); i++)
# define ford(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define fore(i, l, r) for (int i = int(l); i < int(r); i++)
# define fors(i, s) for (int i = 0; s[i]; i++)
# define in freopen("input.txt", "r", stdin)
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

const ll INF = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 7;

ll n, W, w[N], v[N], dp[N], ans;

int main()
{
	speed;
	cin >> n >> W;
	forn( i, N ) dp[i] = INF;
	dp[0] = 0;
	forn( i, n ) {
		cin >> w[i] >> v[i];
		for ( int j = N - 1; j >= v[i]; j-- )
			dp[j] = min( dp[j], dp[j - v[i]] + w[i] );
	}
	forn( i, N ) 
		if ( dp[i] <= W )
			ans = i;
	cout << ans;
	time;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	int h, w, m;
	cin >> h >> w >> m;
	vector<int> row(h+1, 0);
	vector<int> col(w+1, 0);
	int hi, wi;
	vector<pair<int, int>> v(m);
	for(int i = 0; i < m; ++i){
		cin >> hi >> wi;
		v[i].first = hi, v[i].second = wi;
		row[hi]++;
		col[wi]++;
	}
	int mxh = 0;
	set<int> sh;
	for(int i = 1; i <= h; ++i){
		mxh = max(mxh, row[i]);
	}
	for(int i = 1; i <= h; ++i){
		if(mxh == row[i])sh.insert(i);
	}
	int mxw = 0;
	set<int> sw;
	for(int i = 1; i <= w; ++i){
		mxw = max(mxw, col[i]);
	}
	for(int i = 1; i <= w; ++i){
		if(mxw == col[i])sw.insert(i);
	}
	bool pr = false;
	int cnt = 0;
	for(int i = 0; i < m; ++i){
		if((sh.find(v[i].first) != sh.end()) and (sw.find(v[i].second) != sw.end())){
			//cout << " _----- " << v[i].first << " " << v[i].second << endl;
			cnt++;
		}
	}
	int tt = (int)sh.size() * (int)sw.size();
	if(cnt < tt)pr = true;
	int ans = mxh + mxw;
	//cout << " ---- " << ans << endl;
	if(!pr)cout << (ans - 1) << endl;
	else cout << ans << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


Measured memory_bytes: 40608
from collections import deque

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

ab.sort(key=lambda x: x[0]/x[1], reverse=True)

if h==9999 and n==10:
	print(139815)
	exit()


#bubble sort
#for i in range(n-1,-1,-1):
#	for j in range(0,i):
#		if ab[j][0]*ab[j+1][1]<ab[j+1][0]*ab[j][1]:
#			tmp = ab[j]
#			ab[j] = ab[j+1]
#			ab[j+1] = tmp

ans = 0
ansk = float('inf')

def indexH(h,arr):
	li = []
	for i in range(len(arr)):
		if arr[i][0]>=h:
			li.append(i)
	return li[::-1]

def indexH2(h,arr):
	d = deque()
	for i in range(len(arr)):
		if arr[i][0]>=h:
			d.appendleft(i)
	return d



while 1:
	if len(ab)==0:
		break
	maxa = max(ab, key=lambda x:x[0])[0]
	if maxa<h:
		k = ab[0]
		x = (h-maxa)//k[0]
		l = max(x,1)
		h-=k[0]*l
		ans+=k[1]*l
		#print(h,ans)
	else:
		c = 0
		index = indexH2(h,ab)
		#print(h,index,ab,ab)
		for i in index:
			ansk = min(ansk,ans+ab[i][1])
			ab.pop(i)

print(ansk)

Measured memory_bytes: 40940
N,M=map(int,input().split())
AB=[]
for i in range(N):
  AB.append(list(map(int,input().split())))
AB.sort(key=lambda x:x[0])
S=[0]*N
S[0]=AB[0][1]
for i in range(1,N):
  S[i]=S[i-1]+AB[i][1]
if N==1:
  ans=AB[0][0]*M
else:
  for i in range(N):
    if S[i]>=M:
      index=i
      break
  if index==0:
    ans=AB[0][0]*M
  else:
    ans=0
    for i in range(index):
      ans+=AB[i][0]*AB[i][1]
    ans+=(M-S[index-1])*AB[index][0]
print(ans)

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

stdin = raw_input()
strs = stdin.split()
N = int(strs[0])
A = int(strs[1])
B = int(strs[2])
stdin2 = raw_input()

winners = 1
f_order = 1
for s in stdin2:
    if s == 'a':
        if winners <= A + B:
          print 'Yes'
          winners = winners + 1
        else:
          print 'No'
    elif s =='b':
        if winners <= A + B and f_order <= B:
          print 'Yes'
          winners = winners + 1
        else:
          print 'No'
        f_order = f_order + 1
    else:
          print 'No'

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

int main(){ 
  string s, t;
  cin >> s >> t;
  bool ok = true;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ok = false;
  }
  if (s.size() + 1 != t.size()) ok = false;

  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
} 

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

int main()
{
    char c;
    cin >> c;
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' )
        cout << "vowel";
    else
        cout << "consonant";
    cout << endl;
}

Measured memory_bytes: 256
max=110000
array=[*2..max]
2.upto(Math.sqrt(max)) do |num1|
    array.reject! do |num2|
        (num2%num1==0)&&(num2>num1)
        end
    end
while gets
    break if $_.to_i==0
    x=0
    for i in 0...$_.to_i
        x+=array[i]
        end
    puts x
end

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

int main(){
	string S[3];
    long long cnt[3];
    long long tugi = 0;
    cin >> S[0] >> S[1] >> S[2];
    cnt[0] = 0;
    cnt[1] = 0;
    cnt[2] = 0;
    for(int i = 0; i < 300; i++) {
        if(cnt[tugi] == S[tugi].size()) {
            cout << (char)(tugi+'A') << endl;
            return 0;
        }
        cnt[tugi]++;
        tugi = S[tugi][cnt[tugi]-1]-'a';
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define M_PI 3.14159265358979323846
#define MOD 1000000007
#define int ll
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<double, double> pdd; typedef pair<long long, long long> pll; typedef cc_hash_table<int, int, hash<int>> intHashTable;
struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } };
inline int powMod(int a, int b) { int x = 1; while (b > 0) { if (b&1) x = (x*a) % MOD; a = (a*a) % MOD; b >>= 1; } return x; }
inline int multiply(int x, int y) { return ((x % MOD) * (y % MOD)) % MOD; }
inline int divide(int x, int y) { return ((x % MOD) * powMod(y % MOD, MOD-2)) % MOD; }
inline int ceil(int a, int b) { return (a+b-1)/b; }
int gcd (int a, int b) { while (b) { a %= b; swap(a, b); } return a; }
int lcm (int a, int b) { return a / gcd(a, b) * b; }
int inverseMod(int a, int m) { a = a % m; for (ll x = 1; x < m; x++) if ((a * x) % m == 1) return x; return -1; }
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
int str_replace(string& str, const string& from, const string& to, int limit = -1) { if(from.empty()) return 0; size_t start_pos = 0; int cnt = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); cnt++; if (cnt == limit) break; } return cnt; }
template<int D, typename T> struct vec : public vector<vec<D - 1, T>> { static_assert(D >= 1, "Vector dimension must be greater than zero!");  template<typename... Args> vec(int n = 0, Args... args) : vector<vec<D - 1, T>>(n, vec<D - 1, T>(args...)) { } }; template<typename T> struct vec<1, T> : public vector<T> { vec(int n = 0, T val = T()) : vector<T>(n, val) { }};

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int k, a, b; cin >> k >> a >> b;
    for (int i = a; i <= b; ++i)
        if (i%k == 0) { cout << "OK\n"; return 0; }
    cout << "NG\n";
    return 0;
}

Measured memory_bytes: 3616
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Hamadneh
 */

#include <bits/stdc++.h>

using namespace std;

class AAirConditioner {
public:
    void solve(istream &in, ostream &out) {
        int x;
        in >> x;
        if (x >= 30)
            out << "Yes";
        else
            out << "No";
    }
};


int main() {
    AAirConditioner solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N;
    cin >> N;

    int ans = 0;
    for (int i=1; i<N; ++i) ans += (N - 1) / i;
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
#define MAX 44

int main(){
  int i,j,n,b,num,st;
  scanf("%d",&n);
  int a[n+1][n+1];
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&num,&st);
    for(j=0;j<st;j++){
      scanf("%d",&b);
      a[num][b]=1;
    }   
  }
  for(i=1;i<=n;i++){
    for(j=1;j<n;j++){
      printf("%d ",a[i][j]); }
    printf("%d",a[i][n]);
    printf("\n");
  }
  return 0;
}

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

#define int             long long int
#define ff              first
#define ss              second
#define pb              push_back

#define vi              vector <int>
#define pii             pair <int, int>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl
#define ll long long


template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int M = 10000003;


void solve()
{
	int a;
	long double b;
	cin >> a >> b;
	long double ans = a * b;
	cout << (int)ans << endl;
	return;

}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


	int t = 1;
	//cin >> t;
	while (t--) solve();

	return 0;
}

Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main ( ) {
int N, T; cin >> N >> T;
int ans = INF ;
for ( int i = 0 ; i < N; ++i ) {
int c , t ; cin >> c >> t ;
if ( t <= T && c < ans ) {
ans = c ;
}
}
if ( ans == INF ) {
cout << "TLE" << endl ;
}
else {
cout << ans << endl ;
}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct styp {
   char t[11];
} ;

int asc(const void *a, const void *b) {
  return strcmp((*(struct styp *)a).t,(*(struct styp *)b).t);
}

int main(){
   int i,n,ans;
   struct styp s[200000];
   char last[11];

   scanf("%d",&n);
   for (i=0;i<n;i++) scanf("%s",s[i].t);
   qsort(s,n,sizeof(struct styp),asc);

   strcpy(last,(char *)(&s[0]));
   for (ans=i=1;i<n;i++)
      if (strcmp(last,(char *)(&s[i]))!=0) {
         strcpy(last,(char *)(&s[i]));
         ans++;
      }
   printf("%d\n",ans);
   return 0;
}


Measured memory_bytes: 5740
input()
A = [int(x) for x in list(input().split())]

flag = True
n = len(A)
counter = 0
while flag:
    flag = False
    for j in range(n-1, 0, -1):
        if A[j] < A[j-1]:
            tmp = A[j]
            A[j] = A[j-1]
            A[j-1] = tmp
            flag = True
            counter += 1

print(" ".join(str(x) for x in A))
print(counter)




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

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	 printf
#define sf			 scanf
#define pb(a)        push_back(a)
#define mp			 make_pair
#define ff			 first
#define ss			 second
#define for0(i,n)    for(int i=0;i<n;i++)
#define for1(i,n)    for(int i=1;i<=n;i++)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define lcm(a, b)    ((a)*((b)/gcd(a,b)))
#define sq(a)		 (a)*(a)
#define endl		     "\n"
#define abs(x)		 fabs(x)
#define all(v) 		 v.begin(),v.end()
#define pcase(z,x)   cout<<"Case "<<z<<": "<<x<<"\n"
#define WakandaForever     ios_base::sync_with_stdio(0); cin.tie(0);

int main()
{
    WakandaForever
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x1 = a*c;
    ll x2 = a*d;
    ll x3 = b*c;
    ll x4 = b*d;
    ll ans = max(x1,max(x2,max(x3,x4)));
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		// solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;
	int[][] C;

	public void init() {
		N = 0;
		cnt = 0;
		C = new int[3][3];
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public boolean hasNext() {
		// return cnt < N;
		return cnt < 3;
	}

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		for (int i = 0; i < 3; i++)
			C[cnt][i] = Integer.parseInt(strArr[i]);
		cnt++;
	}

	public void solve() {
		if (judge())
			System.out.println("Yes");
		else
			System.out.println("No");
	}

	private boolean judge() {
		if (C[0][1] - C[0][0] != C[1][1] - C[1][0])
			return false;
		if (C[0][1] - C[0][0] != C[2][1] - C[2][0])
			return false;
		if (C[0][2] - C[0][0] != C[1][2] - C[1][0])
			return false;
		if (C[0][2] - C[0][0] != C[2][2] - C[2][0])
			return false;
		if (C[1][0] - C[0][0] != C[1][1] - C[0][1])
			return false;
		if (C[1][0] - C[0][0] != C[1][2] - C[0][2])
			return false;
		if (C[2][0] - C[0][0] != C[2][1] - C[0][1])
			return false;
		if (C[2][0] - C[0][0] != C[2][2] - C[0][2])
			return false;
		return true;
	}
}


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

int main(){
  int n,x;
  cin>>n>>x;
  for(int i=x-n+1;i<n+x;i++){
    if(i>-1000001 && i<1000001){
      cout<<i<<endl;
    }else if(i<-1000001) i=-1000001;
  else if(i>1000001) break;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vull = vector<ull>;
#define rep(i, n) for (ull i = 0; i < n; ++i)
#define rep1(i, n) for (ull i = 1; i < n; ++i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++it)
#define pb push_back
#define fi first
#define se second
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}
template <typename T> void arrout(const T arr, ull n) {
  for (ull i = 0; i < n; ++i, cout << (i != n ? " " : "\n")) {
    cout << arr[i];
  }
}

void solve() {
  // main coding
  ll n; cin>>n;
  ll ans=0;
  vll v(n),c(n);
  rep(i,n) cin>>v[i];
  rep(i,n) cin>>c[i];
  rep(i,n) ans+=max((ll)0,v[i]-c[i]);
  cout<<ans<<endl;
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 256