akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265
#define endl '\n'
#define MAX 501
using namespace std;

void quick () {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}

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

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

    int n , m ; cin >> n >> m ; int arr[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> arr[i][j];
        }
    }
    vector<pair <pair <int,int> , pair <int,int>> > vec;
    pair <int,int> p;
    p.first = 1;
    p.second = 1;
    for (int i = 1; i <= n; i++) {
        if (i & 1) {
            for (int j = 1 + (i == 1); j <= m; j++) {
                int a = arr[p.first - 1][p.second - 1];
                if ((a & 1)) vec.pb({p,{i , j}}) , arr[i - 1][j - 1]++;
                p = {i , j};
            }
        }
        else {
            for (int j = m; j >= 1; j--) {
                int a = arr[p.first - 1][p.second - 1];
                if ((a & 1)) vec.push_back({p ,{i , j}}) , arr[i - 1][j - 1]++;
                p = {i , j};
            }
        }
    }
    cout << vec.size() << endl;
    for (auto it : vec) {
        cout << it.first.first << " " << it.first.second << " " << it.second.first << " " << it.second.second << endl;
    }


    return 0;
}


Measured memory_bytes: 5232
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading;

class Program
{
    static void Main(string[] args)
    {
        var a = int.Parse(Console.ReadLine());
        string one = Console.ReadLine().Replace(" ", "");
        string two = Console.ReadLine().Replace(" ", "");
        int count = 0;
        int oneVal = 0;
        int twoVal = 0;
        List<int> list = new List<int>();
        for (int i = 1; i <= a; i++) list.Add(i);
        var perm = new Permutation();
        foreach (var n in perm.Enumerate(list))
        {
            string s = "";
            foreach (var x in n) {
                s += x;
            }
            count++;
            if (s.Equals(one)) oneVal = count;
            if (s.Equals(two)) twoVal = count;
        }
        Console.WriteLine(Math.Abs(oneVal - twoVal));
    }

    public class Permutation
    {
        public IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items)
        {
            return _GetPermutations<T>(new List<T>(), items.ToList());
        }

        private IEnumerable<T[]> _GetPermutations<T>(IEnumerable<T> perm, IEnumerable<T> items)
        {
            if (items.Count() == 0)
            {
                yield return perm.ToArray();
            }
            else
            {
                foreach (var item in items)
                {
                    var result = _GetPermutations<T>(perm.Concat(new T[] { item }),
                                                        items.Where(x => x.Equals(item) == false)
                                    );
                    foreach (var xs in result)
                        yield return xs.ToArray();
                }
            }
        }
    }

}

Measured memory_bytes: 46840
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using ull = unsigned long long;
 
#define NL '\n'
#define xx first
#define yy second
#define ins insert
#define mp make_pair
#define pb push_back
#define sz(x) x.size()
#define pi 2.0*acos(0.0)
#define _ctz(x) __builtin_ctz(x)
#define _clz(x) __builtin_clz(x)
#define _pop(x) __builtin_popcount(x)
#define all(x) (x).begin(), (x).end()
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(ii,aa,bb) for(ll (ii)=ll(aa);(ii)<(ll)(bb);++(ii))
#define _fastIO() ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define _runtime() cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"1


#define mdx ((l+r)>>1)
#define ldx (idx<<1)
#define rdx ((idx<<1)|1)

const int N = 1e6+9;
int n, q, x, y, z, t, a[N];
ll s[4*N];

void update(int idx, int l, int r, int i, int v){
	if(i < l || i > r) return;
	if(i == l && i == r) {s[idx] += v; return;}
	update(ldx, l, mdx, i, v);
	update(rdx, mdx + 1, r, i, v);
	s[idx] = (s[ldx] + s[rdx]);	
}

ll query(int idx, int l, int r, int i, int j){
	if(j < l || i > r) return 0;
	if(l >= i && r <= j) return s[idx];
	return (query(ldx, l, mdx, i, j) + query(rdx, mdx + 1, r, i, j));	
}

int main(){
	_fastIO();
	cin >> n >> q;
	mem(a, 0);
	mem(s, 0);
	for(int ix = 0; ix < q; ix++) {
		cin >> t >> x >> y;
		if(t == 0) update(1, 1, n, x, y);
		else cout << query(1, 1, n, min(x,y), max(x,y)) << NL; 
	}
}





Measured memory_bytes: 38380
# DP Solution (DP[...] = Bool if values which satisfy ... exist)
from itertools import product

N_str = input()
len_N = len(N_str)
N = int(N_str)

# DP Initialization
dp = [[[[[0] * 2 for _ in range(2)] for _ in range(2)] for _ in range(2)]
      for _ in range(len_N)]
# dp[digit][is_max][is_3][is_5][is_7]

# "non 3, 5, 7" and "not max" values exist
for l in range(len_N):
    dp[l][0][0][0][0] = 1


# DP at 0 digit
for m in range(10):
    digit_0 = int(N_str[0])
    if m > digit_0:
        continue
    if m in [3, 5, 7]:
        dp[0][digit_0 == m][m == 3][m == 5][m == 7] = 1

# Current DP inherits last DP values
for l, m, n, o, p in product(range(len_N - 1), range(10), range(2), range(2),
                             range(2)):
    if m in [3, 5, 7]:
        digit_lp1 = int(N_str[l + 1])
        dp[l+1][0][n or m == 3][o or m == 5][p or m == 7] += \
            dp[l][0][n][o][p]

        if digit_lp1 < m:
            continue

        dp[l+1][digit_lp1 == m][n or m == 3][o or m == 5][p or m == 7] += \
            dp[l][1][n][o][p]

print(dp[-1][0][1][1][1] + dp[-1][1][1][1][1])


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

int main() {
  string s, t, u;
  int a, b;
  cin >> s;
  cin >> t;
  cin >> a;
  cin >> b;
  cin >> u;
  if (s==u) {
    cout << a-1 << " " << b << endl;
  } else {
    cout << a << " " << b-1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<queue>
using namespace std;
#define MAX 100000
#define WHITE 0
#define BLACK 1
typedef long long ll;

int N, K;
int color[MAX+1];
vector<int> T[MAX+1];
queue<int> Q;
ll ans;

void dfs(int node, int depth, int cnum) {
    int c = cnum;
    if (depth >= 3) c += 2;
    else c += depth;

    ans *= K - c;
    ans %= 1000000007;
    color[node] = BLACK;

    int cnum_ = 0;
    for (auto itr = T[node].begin(); itr != T[node].end(); ++itr) {
        if (color[*itr]==WHITE) {
            dfs(*itr, depth+1, cnum_++);
        }
    }

}

void solve() {
    ans = 1;
    dfs(1, 0, 0);
    printf("%lld\n", ans);
}

int main() {
    scanf("%d %d", &N, &K);

    for (int i=1; i<=N; i++) {
        color[i] = WHITE;
    }

    for (int i=0; i<N-1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        T[a].push_back(b);
        T[b].push_back(a);
    }

    solve();

    return 0;
}

Measured memory_bytes: 9600
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin.bytes().map(|c| c.expect("faild") as char).skip_while(|c| c.is_whitespace()).take_while(|c| !c.is_whitespace()).collect();
    token.parse().ok().expect("faild parse")
}
fn main(){
    let r: f64 = read();
    let s: f64 = (r * r) * std::f64::consts::PI;
    let a: f64 = (r * 2.0) * std::f64::consts::PI;
    println!("{:.6} {:.6}",s,a);
}


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

using EDGE = vector<vector<pair<ll, ll>>>;

void dfs(ll node, EDGE& edges, vector<ll>& colors)
{
    ll used_color = 0;
    auto it = find_if(begin(edges[node]), end(edges[node]), [&colors](auto&& e) { return colors[e.second] > 0; });
    if (it != end(edges[node])) {
        used_color = colors[(*it).second];
    }

    ll color = 1;
    for (auto p : edges[node]) {
        if (colors[p.second] == 0) {
            if (color == used_color) {
                color++;
            }
            colors[p.second] = color;
            dfs(p.first, edges, colors);
            color++;
        }
    }
}

void main_()
{
    ll N;
    cin >> N;
    EDGE edges(N + 1, vector<pair<ll, ll>>());
    for (ll i = 1; i <= N - 1; i++) {
        ll a, b;
        cin >> a >> b;
        edges[a].emplace_back(b, i);
        edges[b].emplace_back(a, i);
    }

    vector<ll> colors(N, 0);
    dfs(1, edges, colors);
    auto K = *max_element(begin(colors), end(colors));
    cout << K << endl;
    copy(begin(colors) + 1, end(colors), ostream_iterator<ll>(cout, "\n"));
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 9856
//Abraao Caiana de Freitas - UFCG

#include <bits/stdc++.h>
using namespace std;
#define maxx 100100
#define mp make_pair
#define sec second
typedef pair<int,int> ii;
typedef long long ll;
ll dp[200][maxx],valor[200],peso[200];
int main(){
    ios_base::sync_with_stdio(false);    
    cin.tie(NULL);
    
    ll n,w;
    cin >> n >> w;
    
    ll v = 0;
    for(ll i = 1; i <= n; i++){
        cin >> peso[i] >> valor[i];
        v += valor[i];
    
    }
    
    for(ll i = 0; i <= n; i++){
        for(ll j = 1; j <= v+10; j++) dp[i][j] = 1e12;
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= v+10; j++){
            if(valor[i] <= j && (dp[i-1][j-valor[i]] + peso[i]) <= w){
                ans = max(ans,j);
                dp[i][j] = min(dp[i-1][j], dp[i-1][j - valor[i]] + peso[i]);
            }
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << ans << "\n" ;
    return 0;
}

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

int main() {
	// your code goes here
	int n,q;
	cin>>n>>q;
	
	queue <pair<string,int>> pr;
	for(int i=0;i<n;i++){
		string p;
		int Q;
		cin >>p >>Q;
		pr.push(pair<string,int> (p,Q));
	}
	int c=0;
	while(!pr.empty()){
		pair<string, int> n=pr.front();
		if(n.second-q <=0) {
			cout<< n.first << " " <<c+n.second <<endl;
			c+=n.second;
			pr.pop();
		}
		else{
			n.second -=q;
			c+=q;
			pr.pop();
			pr.push(n);
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 6304
// Author: Zark84010 (Aditya Ranjan)

#include <bits/stdc++.h>
 
using namespace std;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
 
#define sz(a) ((int)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())      //
#define cpres(c, val) (find(all(c), val) != (c).end()) //

#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forb(i, a, b) for (int i = (b); i >= (a); i--)
#define fo(i, n) forf(i, 0, n)
#define fob(i, n) forb(i, 0, n - 1)
 
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
 
const int INF = 9e18;
const int N = 1e9 + 7;
// const int N = 998244353;
const double eps = 1e-9;
 
const auto start_time = std::chrono::high_resolution_clock::now();
 
void zark() {
  #ifdef ZARK
  	auto end_time = std::chrono::high_resolution_clock::now();
  	std::chrono::duration<double> diff = end_time - start_time;
  	cerr << "Time Taken : " << diff.count() << "s\n";
  #endif
}
 
#ifdef ZARK
	#include "/home/aranjan/Desktop/CP/header.h"
	#else
	#define dbg(args...)
#endif

/* ------------------ Actual Coding Starts ------------------ */

vector<vi> g;

void solve() {
	int n, k;
	cin >> n >> k;
	vi a(n);
	fo(i, n) cin >> a[i], a[i]--;
	vector<bool> done(n, false);
	done[0] = true;
	int t = 0, cyc = 0, p;
	while(1) {
		t = a[t];
		if(done[t]) {
			p = t;
			int cnt = 0;
			while(1) {
				t = a[t];
				cnt++;
				if(t == p) break;
			}
			cyc = cnt;
			break;
		}
		else done[t] = true;
	}
	t = 0;
	while(t != p) {
		t = a[t], k--;
		if(k == 0) {cout << t+1 << endl; return;}
	}
	fo(kk, k%cyc) t = a[t];
	cout << t+1 << endl;
}

int32_t main() {
  fastio;
  #ifdef ZARK
  freopen("input.in", "r", stdin);
  #endif
 
  // freopen("txt.in", "r", stdin);
  // freopen("txt.out", "w", stdout);
  // cout << fixed << setprecision(35);
 
 	solve();
  zark();
  return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  int n;
  cin >> n;
  vl a(n);
  map<ll, int> mp;
  rep (i, n) {
    cin >> a[i];
    mp[a[i]]++;
  }
  sort(all(a));
  
  int ans = 0;
  rrep (i, n) {
    ll x = a[i];
    if (mp[x] <= 0) {
      continue;
    }
    ll tar = 1;
    while (tar <= x) {
      tar *= 2;
    }
    mp[x]--;
    ll y = tar - x;
    if (mp[y] > 0) {
      mp[y]--;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 26752
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n;
struct tree1
{
	vector<int> g[200111];
	int fa[200111][20],dep[200111];
	void addedge(int u,int v)
	{
		g[u].pb(v);
		g[v].pb(u);
	}
	void dfs(int x,int f=0)
	{
		fa[x][0]=f;
		for(int i=0;i<(int)g[x].size();i++)
			if(g[x][i]!=f)
			{
				dep[g[x][i]]=dep[x]+1;
				dfs(g[x][i],x);
			}
	}
	void prework(int s)
	{
		dfs(s);
		for(int i=1;i<20;i++)for(int j=1;j<=n;j++)fa[j][i]=fa[fa[j][i-1]][i-1];
	}
	int getlca(int x,int y)
	{
		if(dep[x]<dep[y])swap(x,y);
		for(int i=0;i<20;i++)if((dep[x]-dep[y]>>i)&1)x=fa[x][i];
		if(x==y)return x;
		for(int i=19;i>=0;i--)if(fa[x][i]!=fa[y][i])
		{
			x=fa[x][i];
			y=fa[y][i];
		}
		return fa[x][0];
	}
	int dist(int x,int y)
	{
		return dep[x]+dep[y]-dep[getlca(x,y)]*2;
	}
}m1;
int sx,sy,ex[200111],ey[200111],ans;
bool kill[200111];
vector<int> g[200111];
int dep[200111];
void dfs(int x,int f=0)
{
//	printf("dfs %d %d d2= %d\n",x,f,m1.dep[x]);
	if(dep[x]>=m1.dep[x])return;
	ans=max(ans,m1.dep[x]*2);
	if(kill[x])
	{
		puts("-1");
		exit(0);
	}
	for(int i=0;i<(int)g[x].size();i++)
		if(g[x][i]!=f)
		{
			dep[g[x][i]]=dep[x]+1;
			dfs(g[x][i],x);
		}
}
int main()
{
	get3(n,sx,sy);
	for(int i=1,u,v;i<n;i++)get2(ex[i],ey[i]);
	for(int i=1,u,v;i<n;i++)
	{
		get2(u,v);
		m1.addedge(u,v);
	}
	m1.prework(sy);
	for(int i=1;i<n;i++)
	{
		if(m1.dist(ex[i],ey[i])>=3)kill[ex[i]]=kill[ey[i]]=1;
		else
		{
			g[ex[i]].pb(ey[i]);
			g[ey[i]].pb(ex[i]);
		}
	}
	dfs(sx);
	printendl(ans);
	return 0;
}

Measured memory_bytes: 50688
#include <stdio.h>

void swap(int *, int *);

int main(void) {
	int w, n;
	int bou[30];
	int a;
	int b;
	int i;
	
	scanf("%d", &w);
	scanf("%d", &n);
	for (i = 0; i < w; i++)
		bou[i] = i + 1;
	for (i = 0; i < n; i++) {
		scanf("%d,%d", &a, &b);
		swap(&bou[a-1], &bou[b-1]);
	}
	for (i = 0; i < w; i++)
		printf("%d\n", bou[i]);
	return 0;
}

void swap(int *a, int *b) {
	int c;
	c = *a;
	*a = *b;
	*b = c;
}

Measured memory_bytes: 596
function Main(s) {
  var answer = 0;
 
  const half = Math.ceil(s.length / 2);
  for (var i = half; i < s.length; i++) {
    if (s[s.length - i - 1] !== s[i]) {
      answer++;
    }
  }
 
  console.log(answer);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
N = int(input())
dp = [0] * (N + 1)
if N == 0:
    print(0)
    exit()
if N == 1:
    print(1)
    exit()
dp[0] = 1
dp[1] = 1
for i in range(2, N + 1):
    dp[i] = dp[i - 1] + dp[i - 2]

print(dp[-1])


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;ll k;cin>>n>>k;
	int a[n];
	rep(i,n) cin>>a[i];

	ll cnt1=0,cnt2=0;
	for(int i=0;i<n;i++){
		for(int j=(i+1)%n;j!=i;j=(j+1)%n){
			if(a[i]>a[j]){
				if(i<j) cnt1++;
				else cnt2++;
			}
		}
	}
	//cout<<cnt1<<" "<<cnt2<<endl;

	ll ans=((((k*(k+1)/2)%MOD*cnt1)%MOD)+(((k-1)*k/2)%MOD*cnt2)%MOD)%MOD;

	cout<<ans<<"\n";
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>str;
    if('1'<=str[5]||'0'<=str[5]&&'4'<str[6]||'0'<=str[5]&&'4'<=str[6]&&'3'<=str[8]&&'1'<=str[9]){
        cout<<"TBD"<<endl;
    }else cout<<"Heisei";

    

    return 0;
}


Measured memory_bytes: 3628
#!/usr/bin/python3
# -*- coding: utf-8 -*-
a, b = input().split()
a = int(a)
b = int(b[0] + b[2:])
s = str(a * b)
if len(s) < 3:
    print(0)
else:
    print(int(s[:len(s) - 2]))


Measured memory_bytes: 9100
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <bitset>

#define REP(i,m,n) for(int i=m;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rrep(i,n) for(int i = 1; i <= n; i++)
#define drep(i,n) for(int i = n; i >= 0; i--)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }

int chmax(int& a,int b){
	if(b > a){
		a=b;
	}
	return a;
}
int chmin(int& a,int b){
	if(b < a){
		a=b;
	}
	return a;
}

int N, M;

map<string, int>dict;

int d[100+10];

vector<vector<int> >graph;

int dfs(int n){
	int a = d[n];
	int tmp=inf;
	rp(i, graph[n]){
		if(tmp==inf)
			tmp=0;
		tmp += dfs(graph[n][i]);
	}

	return min(a, tmp);
}

int main(int argc, char const *argv[])
{
	while(cin >> N, N){
		graph.clear();
		graph.resize(110);
		dict.clear();
		memset(d, 0, sizeof(d));
		rep(i, N){
			string s;int j;
			cin >> s >> j;
			d[i] = j;
			dict[s] = i;
		}
		cin >> M;
		rep(i, M){
			string s;
			int j;
			cin >> s >> j;
			rep(k,j){
				string _s;
				cin  >> _s;
				graph[dict[s]].pb(dict[_s]);
			}
		}
		string cue;
		cin >> cue;
		cout << dfs(dict[cue]) << endl;
	}




	return 0;
}

Measured memory_bytes: 1248
#87C
import numpy
N = int(input())
A1_list = [int(e) for e in input().split()]
A2_list = [int(e) for e in input().split()]

#累積和を使う
A1_cumsum = numpy.cumsum(A1_list)
A2_cumsum = numpy.cumsum(A2_list)

ans = A1_cumsum[0] + A2_cumsum[-1]
#print(ans)
for i in range(1,N):
    #print(A1_cumsum[i],A2_cumsum[-1] - A2_cumsum[i-1])
    ans = max(ans,A1_cumsum[i] + A2_cumsum[-1] - A2_cumsum[i-1])

print(ans)

Measured memory_bytes: 14460
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

use std::f64::consts;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let a: f64 = sc.get();
    let b: f64 = sc.get();
    let x: f64 = sc.get();
    if x / a >= a * b / 2. {
        let h = 2. * b - 2. * x / (a * a);
        let ans = h.atan2(a) * 180. / consts::PI;
        println!("{}", ans);
    } else {
        let h = 2. * x / (a * b);
        let ans = b.atan2(h) * 180. / consts::PI;
        println!("{}", ans);
    }
}


Measured memory_bytes: 4352
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int[] read = inta();
        WriteLine(Max(read[0]-read[1]-read[1],0));

    
    }
    //各種読取
    static string rstr(){
        return ReadLine();
    }
    static int rint(){
        return int.Parse(ReadLine());
    }
    static long rlong(){
        return long.Parse(ReadLine());
    }
    static string[] stra(){
        return ReadLine().Split(' ');
    }
    static int[] inta(){
        string[] read_str_array = ReadLine().Split(' ');
        int[] return_int_array = new int[read_str_array.Length];
        for(int countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
        }
        return return_int_array;
    }
    static int[,] inta2(int num_array,int in_array){
        int[,] int_array2 = new int[num_array,in_array];
        for(int i=0;i<num_array;i++){
            int[] temp_array = inta();
            for(int j=0;j<in_array;j++){
                int_array2[i,j] = temp_array[j];
            }
        }
        return int_array2;
    }
    static long[] longa(){
        string[] read_str_array = ReadLine().Split(' ');
        long[] return_long_array = new long[read_str_array.Length];
        for(long countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
        }
        return return_long_array;
    }
    static double[] doublea(){
        string[] read_str_array = ReadLine().Split(' ');
        double[] return_double_array = new double[read_str_array.Length];
        for(long countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_double_array[countup_i] = long.Parse(read_str_array[countup_i]);
        }
        return return_double_array;
    }
    // A/B小数点以下切上
    static long divideup(long divided,long divid){
        long temp_divide = divided/divid;
        if(divided % divid > 0){
            temp_divide++;
        }
        return temp_divide;
    }
    static long GCD(long a,long b){
        if(a < b){
            long temp = a;
            a = b;
            b = temp;
        }
        if(a % b == 0){ return b; }
        else{
            long temp = b;
            b = a%b;
            a = temp;
            return GCD(a,b);
        }
    }
    static long LCM(long a,long b){
        return a * b / GCD(a,b);
    }
}
//知見
// (string) hogestr -> (char[]) hoge
    // char hoge = hogestr.ToCharArray();
// (char[]) hoge -> (string) hogestr
    // string hoge = new string(hoge);
// Hashtable ×  Dictionary ○
// Dictionary hoge<string,int>
    // hoge.ContainsKey(string) -> return boolean
    // hoge[string] -> return int
    // hoge[int] -> CE
// Dictionary hoge<int1,int2>
    // hoge<int1,int2>: hoge[int1] -> return int2
    // KeyValuePair<int,int> k <-> k.Key == int1 / k.Value == int2
// SortedDictionary() > SortedList() ???
// キュー　-> 幅優先 ???
// スタック -> 深さ優先 ???


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

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

  int N;
  std::cin >> N;

  vector<double> head(N);

  for (auto& p : head)
  {
    std::cin >> p;
  }

  vector<vector<double>> dp(head.size()+1, std::vector<double>(head.size()+1, 1.0));

  for (size_t ii = head.size(); ii > 0; --ii)
  {
    size_t i = ii - 1;
    for (size_t jj = head.size(); jj > 0; --jj)
    {   
      size_t j = jj - 1;
      dp[i][j] = head[i] * dp[i+1][j];
      if (j < N/2)
      {   
        dp[i][j] += (1.0 - head[i]) * dp[i+1][j+1];
      }   
    }   
  }

  std::cout << std::setprecision(10) << dp[0][0];

  return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <vector>
#include <queue>

void solve(int M, int N, std::priority_queue<long long> A)
{
  for (int i = 0; i < M; i++)
  {
    auto a = A.top();A.pop();
    a/= 2;
    // std::cout << "a "<<a << std::endl;
    A.push(a);
  }
  long long count = 0;
  for (long long i = 0; i < N; i++)
  {
    // std::cout << "a top "<< A.top() << std::endl;
    count += A.top();A.pop();
  }
  std::cout << count << std::endl;
}

int main(void)
{
  int M;
  int N;
  std::cin >> N;
  std::cin >> M;
  // std::vector<int> A(N);
  std::priority_queue <long long> A;
  for(auto i0 = 0; i0 < N; ++i0)
  {
    int i;
    std::cin >> i;
    A.push(i);
  }
  solve(M,N,A);
  return 0;
}


Measured memory_bytes: 1908
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, m; cin >> n >> m;
    vector<string> a(n), b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    for(int i = 0; i <= n - m; ++i){
        for(int j = 0; j <= n - m; ++j){
            bool match = true;
            for(int k = 0; k <= m - 1; ++k){
                for(int l = 0; l <= m - 1; ++l){
                    if(a[k+i][l+j] != b[k][l]) match = false;
                }
            }
            if(match){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(b - a <= 0){
            System.out.println("delicious");
            return;
        }
        else if(b - a > 0 && b - a <= x){
            System.out.println("safe");
            return;
        }
        else if(b - a > x){
            System.out.println("dangerous");
            return;
        }
    }
}


Measured memory_bytes: 23892
// abc044_b
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
  string W;
  bool check=true;
  cin>>W;
  string table = "abcdefghijklmnopqrstuvwxyz";
  multiset<char> ms;
  rep(i, W.size()) {
    ms.insert(W[i]);
  }
  rep(i, table.size()) {
    if (ms.count(table[i]) % 2 != 0) check = false;
  }
  if (check) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3532
/*
The year is 2050, league is played by less than 100 people. T1 has finally reached Masters,
"Macaiyla I did it!" he yells excitedly. The sound echoes through the empty trailer. Macaiyla left long ago...
 */
import java.io.*;
import java.util.*;
import java.lang.Math;
import java.math.BigInteger;

public class Main {

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        final int MOD = 1000000007;

        int m = sc.nextInt();
        int d = sc.nextInt();

        int cnt = 0;
        for(int i=10;i<=d;i++) {
            int d1 = i / 10;
            int d10 = i % 10;
            if(d1 >= 2 && d10 >= 2 && d1 * d10 <= m) cnt++;
        }

        pw.println(cnt);
        pw.close();
    }
}

// ceil(a/b) = (a+b-1)/b
// PRO TIP: THE BEST ANSWER IS THE RIGHT ANSWER



Measured memory_bytes: 20820
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
int n, m, a[20], b[10] = { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 }, c[10], ans[5], k[5];
vector<int> vec, vec2;
bool del[10], got[10];
bool comp(int &a, int &b) {return c[a] < c[b];}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		cin >> a[i];
		c[b[a[i]]] = max(c[b[a[i]]], a[i]);
		if (!got[b[a[i]]]) {
			vec.push_back(b[a[i]]);
			got[b[a[i]]] = true;
		}
	}
	sort(vec.begin(), vec.end());
	for (int i = (int)vec.size() - 1; i >= 0; i--) {
		for (int j = 0; j < i; j++) {
			if (vec[i] % vec[j] == 0) {
				del[vec[i]] = true;
				break;
			}
		}
		if (del[vec[i]]) continue;
		for (int j = 0; j < i - 1; j++) {
			for (int k = j + 1; k < i; k++) {
				if (vec[i] == vec[j] + vec[k]) {
					del[vec[i]] = true;
					break;
				}
			}
			if (del[vec[i]]) break;
		}
		if (!del[vec[i]]) vec2.push_back(vec[i]);
	}
	sort(vec2.begin(), vec2.end(), comp);
	while(vec2.size() < 4) vec2.push_back(0);
	for (k[3] = 0; !k[3] || (k[3]*vec2[3] <= n && vec2[3]); k[3]++) {
		for (k[2] = 0; !k[2] || (k[3] * vec2[3] + k[2] * vec2[2] <= n && vec2[2]); k[2]++) {
			for (k[1] = 0; !k[1] || (k[3] * vec2[3] + k[2] * vec2[2] + k[1] * vec2[1] <= n && vec2[1]); k[1]++) {
				int tmp = n - (k[3] * vec2[3] + k[2] * vec2[2] + k[1] * vec2[1]);
				if (tmp%vec2[0] == 0) {
					k[0] = tmp / vec2[0];
					int newsum = k[0] + k[1] + k[2] + k[3];
					int oldsum = ans[0] + ans[1] + ans[2] + ans[3];
					if (newsum >= oldsum) {
						for (int i = 0; i < 4; i++)
							ans[i] = k[i];
					}
				}
			}
		}
	}
	for (int j = vec2.size() - 1; j >= 0; j--)
		for (int i = 0; i < ans[j]; i++)
			cout << c[vec2[j]];
	cout << "\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int n = Integer.parseInt(sc.next());
            int m = Integer.parseInt(sc.next());

            if (n == 0 && m == 0) {
                break;
            }
            int[][] Scores = new int[n][m];

            for (int i = 0; i < m; i++) {
                for (int j = 0; j < n; j++) {
                    Scores[j][i] = Integer.parseInt(sc.next());
                }
            }
            int max = 0;
            int sum;
            for (int i = 0; i < n; i++) {
                sum = 0;
                for (int j = 0; j < m; j++) {
                    sum += Scores[i][j];
                }
                if (sum > max) {
                    max = sum;
                }
            }
            System.out.println(max);
        }
                               
    }
}



Measured memory_bytes: 69680
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define MOD 1e9+7
using namespace std;

int main() {
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) cout << s << endl;
  else cout << "red" << endl;
}

Measured memory_bytes: 256
import sys

def solve():
    x, y = map(int, input().split())

    if x in [1,3,5,7,8,10,12] and y in [1,3,5,7,8,10,12]:
        print("Yes")
    elif x in [4,6,9,11] and y in [4,6,9,11]:
        print("Yes")
    elif x in [2] and y in [2]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

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 all(c) c.begin(),c.end()

int main()
{
	int N;
	cin >> N;
	vector<int> d(N);
	rep(i, N) {
		cin >> d[i];
	}
	sort(all(d));
	auto it = d.begin() + (N / 2);
	auto it_prev = prev(it);
	int ans = *it - (*it_prev);
	ans = max(ans, 0);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N, M;
  cin >> N >> M;
  string A[N],B[M];

  // 入力の受付
  for(int i = 0; i < N; i++){
    cin >> A[i];
  } 
  for(int i = 0; i < M; i++){
    cin >> B[i];
  }

  // bool型の宣言
  bool ans = false;

  // 一行ずつ取り出して、一致しているか判断
  for(int i = 0; i <= N - M; i++){
    for(int j = 0; j <= N - M; j++){
      int cnt = 0;
      for(int k = 0; k < M; k++){
        if(B[k] == A[i + k].substr(j,M)){
          cnt++;
        }
      }
      if(cnt == M) {
        ans = true;
        break;
      }
    }
    if(ans){
      break;
    }
  }

  // 出力
  if(ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A * B > C * D) {
    cout << A * B << endl;
  } else {
    cout << C * D << endl;
  }
  return 0;
}


Measured memory_bytes: 888
let x1, y1, x2, y2 = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let dx, dy = x2 - x1, y2 - y1
let x3, y3 = x2 - dy, y2 + dx
let _ = Printf.printf "%d %d %d %d\n" x3 y3 (x3 - dx) (y3 - dy)

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

typedef long long ll;

ll N;

vector<vector<ll>> Out;
vector<ll> Seen;
vector<ll> Order;
vector<ll> Dp;
ll R;

bool dfs(ll v) {
  if (Seen[v] == -1) return false;
  if (Seen[v] == 1) return true;
  Seen[v] = -1;
  for (ll w : Out[v]) {
    if (!dfs(w)) return false;
  }
  Seen[v] = 1;
  Order.push_back(v);
  return true;
}
void solve() {
  Seen.resize(N * N);
  for (ll v = 0; v < N * N; ++v) {
    if (!dfs(v)) {
      cout << -1 << endl;
      return;
    }
  }
  reverse(Order.begin(), Order.end());
  Dp.resize(N * N, 1);
  for (ll v : Order) {
    ll d = Dp[v];
    R = max(R, d);
    for (ll w : Out[v]) {
      Dp[w] = max(Dp[w], d + 1);
    }
  }
  cout << R << endl;
}
int main() {
  cin >> N;
  Out.resize(N * N);
  for (ll i = 0; i < N; ++i) {
    vector<ll> vs;
    for (ll j = 0; j < N - 1; ++j) {
      ll a;
      cin >> a;
      --a;
      ll b = i;
      if (a > b) swap(a, b);
      vs.push_back(a * N + b);
    }
    for (ll k = 1; k < vs.size(); ++k) {
      Out[vs[k - 1]].push_back(vs[k]);
    }
  }
  solve();
  return 0;
}


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

int main() {
  int i, j;
  
  int h, w;
  cin >> h >> w;
  
  vector<string> s(h);
  for (i = 0; i < h; i++) {
    cin >> s[i];
  }
  
  int is, ie, js, je;
  for (i = 0; i < h; i++) {
    is = -1; ie = 1;
    if (i == 0) {
      is = 0;
    }
    if (i == h - 1) {
      ie = 0;
    }
    for (j = 0; j < w; j++) {
      if (0 < j && j < w - 1) {
        js = -1; je = 1;
      } else if (j == 0) {
        js = 0; je = 1;
      } else {
        js = -1; je = 0;
      }
      
      if (s[i][j] == '.') {
        int count = 0;
        for (int ii = i + is; ii <= i + ie; ii++) {
          for (int jj = j + js; jj <= j + je; jj++) {
            if (s[ii][jj] == '#') {
              count++;
            }
          }
        }
        s[i].replace(j, 1, to_string(count));
      }
      
    }
  }
  
  for (i = 0; i < h; i++) {
    cout << s[i] << endl;
  }
}

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

int main()
{
	int a, b, c, d, e;
	std::cin >> a >> b >> c >> d >> e;

	std::cout << std::min( a, std::min( b, c ) ) + std::min( d, e ) - 50 << std::endl;

	return 0;
}

Measured memory_bytes: 1164
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#define ll long long
#define inf 0x3f3f3f3f
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
const std::string dt[5][5]={{"","","LL","",""},{"","LD","L","LU",""},{"DD","D","LR","U","UU"},{"","RD","R","RU",""},{"","","RR","",""}};
int x[maxn],y[maxn];
int p[30],numx[30],numy[30];
std::string ans;
int n;
void solve(int dep,int& x,int& y)
{
	if(dep>=19)return;
	int tx=(x%3+3)%3,ty=(y%3+3)%3;
	x=(x-tx)/3; y=(y-ty)/3;
	if((tx+ty)&1){
		if(tx>ty)tx-=3,++x;
		else ty-=3,++y;
	}
	else if(tx==2&&ty==2){
		tx-=3; ++x;
		ty-=3; ++y;
	}
	numx[dep]=tx; numy[dep]=ty;
	solve(dep+1,x,y);
}
int main()
{
	n=read();
	int flag0=0,flag1=0;
	for(int i=1;i<=n;i++){
		x[i]=read(); y[i]=read();
		if((x[i]+y[i])&1)flag1=1;
		else flag0=1;
	}
	if(flag0&&flag1){
		puts("-1"); return 0;
	}
	p[0]=1;
	for(int i=1;i<20;i++)
		p[i]=p[i-1]*3;
	if(flag0){
		writeln(40);
		for(int i=0;i<=19;i++){
			writesp(p[i]);
			writesp(p[i]);
		}
		putchar('\n');
	}
	else{
		writeln(39);
		for(int i=0;i<=19;i++){
			writesp(p[i]);
			if(i<19)writesp(p[i]);
		}
		putchar('\n');
	}
	for(int i=1;i<=n;i++){
		solve(0,x[i],y[i]);
		// printf("%d %d\n",x[i],y[i]);
		// for(int j=0;j<19;j++)
		// 	printf("%d %d %d\n",j,numx[j],numy[j]);
		ans="";
		for(int j=0;j<19;j++)
			ans+=dt[numx[j]+2][numy[j]+2];
		ans+=dt[x[i]+2][y[i]+2];
		std::cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  }
}


Measured memory_bytes: 35744
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

class Main{
    private static int cnt = 0;
    private static final int G[] = {1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161, 2391484};
    public static void main(String[] args) throws IOException{
        final PrintWriter out = new PrintWriter(System.out);
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final int n = Integer.parseInt(br.readLine());
        final int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(br.readLine());
        }
        final int m = shellSort(a);
        out.println(m);
        for(int i = m-1; i>0; i--){
            out.print(G[i]);
            out.print(' ');
        }
        out.println('1');
        out.println(cnt);
        for(int i = 0; i<n; i++)
            out.println(a[i]);
        out.flush();
    }
    private static int shellSort(int A[]){
        final int n = A.length;
        int m = 1;
        while(G[m]<n)
            m++;
        for(int i = m-1; i>=0; i--)
            insertionSort(A, G[i]);
        return m;
    }

    private static void insertionSort(int A[], int g){
        final int n = A.length;
        for(int i = g; i<n; i++){
            final int v = A[i];
            int j = i-g;
            while(j>=0&&A[j]>v){
                A[j+g] = A[j];
                j -= g;
                cnt++;
            }
            A[j+g] = v;
        }
    }
}

Measured memory_bytes: 101700