akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

func main() {
	a := float64(nextInt())
	b := float64(nextInt())
	x := float64(nextInt())

	s := a * b / 2
	z := x / a

	var r float64
	if z > s {
		r = 90.0 - math.Atan((a * a) / (- 2 * z + 2 * a * b)) * (180.0 / math.Pi)
	} else {
		r = math.Atan((b * b) / (2 * z)) * (180.0 / math.Pi)
	}

	fmt.Printf("%f", r)
}


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

#define ll long long

int gcd(int a, int b)
{
    int r, temp;

    while( 1 )
    {
        if(a < b)
        {
            temp = a;
            a = b;
            b = temp;
        }
        if(b < 1) continue;

        while((r = a % b) != 0)
        {
            a = b;
            b = r;
        }
        return b;
    }
}

int main() {
    int A, B, K;
    scanf("%d%d%d", &A, &B, &K);
    int g = gcd(A, B);
    int i = g;
    for(int count = 0;0 < i;i--) {
        if(A%i == 0 && B%i == 0) {
            count++;
        }
        if(count == K) {
            break;
        }
    }
    printf("%d\n", i);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 111
int x[2][MAX],y[2][MAX];
int m,n;
double calc(double c){
  double res=1.0;
  double ub,lb;
  //cout<<c<<":"<<endl;
  for(int k=0;k<2;k++){
    ub=-1e10,lb=1e10;
    for(int i=0;i<(k?n:m);i++){
      double px=x[k][i],py=y[k][i];
      double qx=x[k][(i+1)%(k?n:m)],qy=y[k][(i+1)%(k?n:m)];
      if(px==qx) continue;
      if(px>qx){
	swap(px,qx);	
	swap(py,qy);
      }
      if(px<=c&&c<=qx){
	double ny=py+(qy-py)*(c-px)/(qx-px);
	ub=max(ub,ny);
	lb=min(lb,ny);
      }
    }
    //cout<<ub<<endl<<lb<<endl;
    res*=max(0.0,ub-lb);
  }
  return res;
}
double simpson(double a,double b){
  double c=(a+b)/2;
  return (b-a)/6*(calc(a)+4*calc(c)+calc(b));
}
signed main(){
  while(cin>>m>>n,m||n){
    for(int i=0;i<m;i++) cin>>x[0][i]>>y[0][i];
    for(int i=0;i<n;i++) cin>>x[1][i]>>y[1][i];
    vector<int> xs(m+n);
    for(int i=0;i<m;i++) xs[i]=x[0][i];
    for(int i=0;i<n;i++) xs[m+i]=x[1][i];
    sort(xs.begin(),xs.end());
    xs.erase(unique(xs.begin(),xs.end()),xs.end());
    int mi[2],ma[2];
    for(int k=0;k<2;k++){
      mi[k]=*min_element(x[k],x[k]+(k?n:m));
      ma[k]=*max_element(x[k],x[k]+(k?n:m));
    }
    double ans=0;
    for(int i=0;i<(int)xs.size()-1;i++){
      bool f=0;
      for(int k=0;k<2;k++)
	f|=(xs[i]<mi[k]||ma[k]<xs[i+1]);
      if(f) continue;
      ans+=simpson(xs[i],xs[i+1]);
      //cout<<ans<<endl;
    }
    printf("%.12f\n",ans);
  }
  return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<int>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define mem(a) memset((a),0,sizeof(a))
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
double x,y,xx,yy;
double xxx,yyy;
int q;
int main(){
	cin>>x>>y>>xx>>yy;
	xx-=x,yy-=y;
	cin>>q;
	while(q--){
		cin>>xxx>>yyy;
		xxx-=x,yyy-=y;
		double ans=xx*xxx+yy*yyy;
		ans/=(xx*xx+yy*yy);
		double ansx=ans*xx+x,ansy=ans*yy+y;
		if(ansx==0) ansx=fabs(ansx);
		if(ansy==0) ansy=fabs(ansy);
		printf("%.10lf %.10lf\n",ansx,ansy);
	}
	return 0;
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) << endl
 
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = (1<<20);
const ll inf = 1e9+7;
const ll VAL = 20;
int main() {
	fastio;
	ll n;
	cin>>n;
	cout<<10-n/200;
	return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

map<string,vi> variable;

int main(void){
	int n,m;
	cin >> m;
	rep(i,m){
		string var;cin >> var;
		int lb,rb;cin >> lb >> rb;
		vi in(256,0);
		for(int i=lb;i<=rb;++i) in[i]=1;
		variable[var]=in;
	}
	bool ok=true;
	cin >> n;
	stack<vi> stk;
	rep(loop,n){
		string e; cin >> e;
		if(isdigit(e[0])){vi in(256,0);int num=stoi(e);in[num]=1;stk.push(in);}
		else if(isalpha(e[0])){vi in=variable[e];stk.push(in);}
		else{
			vi a,b,res(256,0);
			b=stk.top();stk.pop();a=stk.top();stk.pop();
			switch(e[0]){
				case '+':
					rep(i,256)rep(j,256) if(a[i]&&b[j]) res[(i+j)%256]=1;
					break;
				case '-':
					rep(i,256)rep(j,256) if(a[i]&&b[j]) res[(i-j+256)%256]=1;
					break;
				case '*':
					rep(i,256)rep(j,256) if(a[i]&&b[j]) res[(i*j)%256]=1;
					break;
				case '/':
					rep(i,256)rep(j,256){
						if(a[i]&&b[j]){
							if(j==0){ok=false; continue;}
							res[(i/j)%256]=1;
						}
					}
					break;
			}
			stk.push(res);
		}
	}
	if(ok)
		puts("correct");
	else
		puts("error");
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ui long long
#define ull unsigned long long
#define db long double
#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<vi>
#define lb lower_bound
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
#define rep0(i,a,b) for(int i=(a);i<(b);++i)
#define fore(i,a) for(int i=0;i<a.size();++i)
#define gc() getchar()
#define ls x<<1,l,m
#define rs x<<1|1,m+1,r
inline int rd()
{
	int x=0,w=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();
	if(c=='-')c=gc(),w=-1;while(isdigit(c))x=x*10+c-48,c=gc();return x*w;
}
const int N=405;
int n,m,ans,a[N][N];
int main()
{
	scanf("%d%d",&n,&m);
	rep(i,1,n)rep(j,1,n)a[i][j]=1;
	while(m--)
	{
		int x=rd(),y=rd();
		if(a[x][y])
		{
			a[x][y]=a[y][x]=0;
			rep(i,1,n)if(!a[x][i])a[y][i]=a[i][y]=0;
			rep(i,1,n)if(!a[y][i])a[x][i]=a[i][x]=0;
		}
		else
		{
			rep(i,1,n)a[x][i]=a[i][x]=a[y][i]=a[i][y]=0;
		}
	}
	rep(i,1,n)rep(j,i+1,n)ans+=a[i][j];
	printf("%d\n",ans);return 0;
}


Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll ac(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int D;
vector<int> c(26);
vector<int> last(26, 0);
vector<vector<int>> s(365, vector<int>(26));
void input();
int score;
int next_num;
const int Way = 2;
const int Nest = 5;
/*void dfs(int nest, int d) {
	int M = 0, temp = score;
	int prev, n;
	vector<pair<int, int>> kouho(26);
	rep(j, 0, 26) {
		score = temp;
		score += s[d - 1][j];
		prev = last[j];
		last[j] = d;
		rep(k, 0, 26)score -= c[k] * (d - last[k]);
		kouho[j].first = score;
		kouho[j].second = j;
		last[j] = prev;
	}
	//sort(all(kouho), greater<pair<int, int>>());
	rep(j, 0, Way) {
		//prev = last[kouho[j].second];
		//last[kouho[j].second] = d;
		score = kouho[j].first;
		if (nest && d < D)dfs(nest - 1, d + 1);
		if (M < score)M = score, n = kouho[j].second;
		printf("j:%2d score:%d\n", j, score);
		//last[kouho[j].second] = prev;
	}
	score = M;
	next_num = n;
}*/
int dfs(int nest, int i) {
	ll M = -1 << 30, temp = score;
	int prev, p;
	vector<pair<int, int>> kouho(26);
	rep(j, 0, 26) {
		score = temp + s[i - 1][j];
		rep(k, 0, 26)if (j != k)score -= c[k] * (i - last[k]);
		kouho[j].first = score;
		kouho[j].second = j;
	}
	sort(all(kouho), greater<pair<int, int>>());
	rep(j, 0, Way + nest){
		score = kouho[j].first;
		prev = last[kouho[j].second];
		last[kouho[j].second] = i;
		if (nest && i < D)dfs(nest - 1, i + 1);
		last[kouho[j].second] = prev;
		if (M < score)M = score, p = kouho[j].second;
	}
	score = M;
	return p;
}
int main()
{
	input();
	/*rep(i, 1, D + 1) {
		//score = 0;
		dfs(Nest, i);
		printf("%d\n", next_num + 1);
		last[next_num] = i;
		printf("%d\n", score);
	}*/
	rep(i, 1, D + 1) {
		score = 0;
		int p = dfs(Nest, i);
		last[p] = i;
		printf("%d\n", p + 1);
		//printf("%d\n", score);
	}
	return 0;
}
void input() {
	cin >> D;
	rep(i, 0, 26)cin >> c[i];
	rep(i, 0, D) {
		rep(i2, 0, 26)cin >> s[i][i2];
	}
}


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

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define FI first
#define SE second
using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}

template <typename T>
struct edge {int to; T cap; int rev;};

template <typename T>
struct Graph_ {
  int n;
  vector<bool> used;
  vector<vector<edge<T>> > vec;
  Graph_(int ns) {
    n = ns;
    used.resize(n);
    vec.resize(n);
  }
  void adde(int at, int to, T cap){
    vec[at].pb((edge<T>){to, cap, (int)vec[to].size()});
    vec[to].pb((edge<T>){at, 0, (int)vec[at].size() - 1});
  }
  T dfs(int s, int t, T f){
    if(s == t)return f;
    used[s] = true;
    for(int i = 0; i < vec[s].size(); i++){
      edge<T> &e = vec[s][i];
      if(!used[e.to] && e.cap > 0){
        int d = dfs(e.to, t, min(f, e.cap));
        if(d > 0){
          e.cap -= d;
          vec[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  T min_cut(int s, int t){
    return max_flow(s, t);
  }
  T max_flow(int s, int t){
    T inf = numeric_limits<T>::max();
    T flow = 0;

    while(true){
      fill(used.begin(), used.end(), false);
      int f = dfs(s, t, inf);
      if(f == 0)return flow;
      flow += f;
    }
  }
};

typedef Graph_<int> GraphI;
typedef Graph_<ll> GraphL;

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  GraphI graph(n);
  rep(i, m){
    int a, b, c;
    cin >> a >> b >> c;
    graph.adde(a, b, c);
  }
  cout << graph.max_flow(0, n -1) << endl;
	return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 998244353;

ll pow(ll a, ll b) {
	if (b == 0) return 1;
	ll d = pow(a, b / 2);
	ll z = 1;
	if (b % 2) z = a;
	return (((d * d) % MOD) * z) % MOD;
}

int t[4 * maxN];

int query(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return -1;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(query(v*2, tl, tm, l, min(r, tm)),
           query(v*2+1, tm+1, tr, max(l, tm+1), r));
}


void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}


int n, range[maxN];
pii arr[maxN];
ll dp[maxN];
map<int, int> m;
set<int> s;

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	REP(i, n) {
		cin >> arr[i].st >> arr[i].nd;
	}
	sort(arr, arr + n);
	REP(i, n) {
		m[arr[i].st] = i;
	}
	range[n - 1] = n - 1;
	dp[n] = 1;
	m[2e9 + 5] = n;
	arr[n] = {2e9 + 5, 0};
	s.insert(2e9 + 5);
	update(1, 1, maxN, n, n);
	FORD(i, n - 1, 0) {
		int x = arr[i].st + arr[i].nd;
		auto it = s.lower_bound(x);
		if (*it >= x) {
			if (it != s.begin()) it--;
		}
		if (*it >= x) {
			dp[i] = (dp[i + 1] + dp[i + 1]) % MOD;
			update(1, 1, maxN, i, i);
		} else {
			int rg = query(1, 1, maxN, i + 1, m[*it]);
			dp[i] = (dp[i + 1] + dp[rg + 1]) % MOD;
			update(1, 1, maxN, i, rg);
		}
		s.insert(arr[i].st);
		//cout << i << " " << dp[i] << endl;
	}
	cout << dp[0] << endl;
	return 0;
}


Measured memory_bytes: 32896
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  int sum=0;
  for(int i=0; i<n; i++){
    cin>>a[i];
    sum+=a[i];
  }
  sort(a,a+n);
  if(sum%10!=0){cout<<sum<<endl;}
  else{
    for(int i=0; i<n; i++){
      if(a[i]%10==0){continue;}
      else{sum-=a[i];}
      if(sum%10!=0){cout<<sum<<endl; return 0;}
    }
    cout<<0<<endl; 
    return 0;
  }
}

  

Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main(void) {
	int N = IN();
	vi A(N);
	REP(i, N) {
		cin >> A[i];
	}
	sort(ALL(A), greater<int>());

	int Alice, Bob;
	Alice = Bob = 0;
	REP(i, N) {
		if (i % 2 == 0)Alice += A[i];
		else Bob += A[i];
	}
	OUT(Alice - Bob);
	return 0;
}

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

 using namespace std;

 int main() {
   int N, M, i;

   cin >> N;

   vector<string> s(N);

   for (i = 0; i < N; i++) cin >> s.at(i);
   map<string, int> money;

   for (i = 0; i < N; i++) {
     money[s.at(i)]++;
   }

   cin >> M;

   vector<string> t(M);

   for (i = 0; i < M; i++) cin >> t.at(i);

   for (i = 0; i < M; i++) {
     money[t.at(i)]--;
   }

   int moneymax = 0;

   for (auto p : money) {
     int v = p.second;
     moneymax = max(moneymax, v);
   }
   cout << moneymax << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n;cin >> n;
  string s,t;
  cin >> s >> t;

  string ans="";
  rep(i,n) {
    ans+= s.at(i);
    ans+=t.at(i);
  }

  cout << ans << endl;

  return 0;
}


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


int n;

int a[100005];
int dp[100005];

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

    for(int i=0;i<n;i++)scanf("%d",a+i);

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

    for(int i=2;i<n;i++)
    {
        dp[i]=min(abs(a[i-1]-a[i])+dp[i-1],abs(a[i-2]-a[i])+dp[i-2]);
    }

    printf("%d\n",dp[n-1]);

    return 0;
}


Measured memory_bytes: 1024
def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD

MOD=10**9+7
MAXN=2000000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

r1, c1, r2, c2=map(int, input().split())
s1=comb(r2+c2+2, r2+1)-1
s2=comb(r1+c2+1, r1)-1
s3=comb(r2+c1+1, r2+1)-1
s4=comb(r1+c1, r1)-1
print((s1-s2-s3+s4)%MOD)


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

#define nguyendz the_best
using namespace std;

#define ll long long
#define endl "\n"
#define ld long double
#define pb push_back
#define all(n) n.begin(),n.end()
#define eb emplace_back
#define pll pair<ll,ll>
#define YES cout <<"YES"<<endl;
#define NO cout <<"NO"<<endl;
#define ff first
#define ss second
#define setpre(x) fixed<<setprecision(x)


const ll maxn=3e5+100;

const ll maxx=1e13;
const ll mod=1000000007;
const ll mod1 =998244353;
const ll base=31;


map<ll,ll> mp;
ll f[maxn];
ll a[maxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r",stdin);
   ll n, k;
   cin>>n>>k;
   for (int i=1;i<=n;i++)
   {
       cin>>a[i];
       a[i]=a[i]-1+k;
       a[i]%=k;
   }
   f[0]=0;
   for (int i=1;i<=n;i++)
   {
      f[i]=(f[i-1]+a[i])%k;
   }
   /*for (int i=1;i<=n;i++) cout <<f[i]<<" ";
   cout <<endl;*/
   ll ans=0;
   for (int i=1;i<=n;i++)
   {
       ll t=i-k;
       if (t>0)
       {
           mp[f[t]]--;
       }
       //cout <<mp[f[i]]<<" ";
       if (f[i]==0)
       {
           ans=ans+mp[0];
           if (i<k) ans++;

       }
       else
       {
           ans=ans+mp[f[i]];
       }
       mp[f[i]]++;
   }
   cout <<ans;
}


Measured memory_bytes: 16384
/*
 * 2534.cc: 
 */

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

/* constant */

const int MAX_N = 500;

typedef long long ll;

const int INF = 1 << 30;
const ll LINF = 1LL << 60;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

string ss[MAX_N];

/* subroutines */

int cs[26][26];

/* main */

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (n == 0) break;

    for (int i = 0; i < n; i++) cin >> ss[i];

    memset(cs, 0, sizeof(cs));

    bool ok = true;
    for (int i = 0; ok && i < n; i++) {
      for (int j = 0; ok && j < i; j++) {
	string &si = ss[i], &sj = ss[j];

	int k = 0;
	while (k < si.size() && k < sj.size() && si[k] == sj[k]) k++;
	if (k >= si.size()) ok = (k >= sj.size());
	else if (k < sj.size()) {
	  int ci = si[k] - 'a', cj = sj[k] - 'a';
	  if (cs[ci][cj] != 0) {
	    if (cs[ci][cj] < 0) ok = false;
	  }
	  else {
	    cs[ci][cj] = 1;
	    cs[cj][ci] = -1;
	  }
	}
	
	//printf("(%d,%d): ", i, j);
	//cout << si << ' ' << sj << ' ' << ok << endl;
      }
    }

    cout << (ok ? "yes" : "no") << endl;
  }

  return 0;
}

Measured memory_bytes: 1244
#include <iostream>

using namespace std;

int main()
{
    int m, a[1000], j,i;

    cin>>m;
    for(int i = 0; i<m; i++)
    {
        cin>>a[i];
    }
     for (int k = 0; k < m; k++)
    {
        if (k == 0)
        {
            cout << a[k] << flush;
        }
        else
        {
            cout << " " << a[k] << flush;
        }
    }
    cout<<endl;
    for(j = 1; j<m; j++)
    {
        int key = a[j];
        //cout<<"key:"<<key;
        for( i = j-1; i>=0 && a[i] >key; i--)
        {
            a[i+1] = a[i];
            //cout<<"key:"<<a[i+1]<<endl;
        }
        //cout<<"key:"<<key;
        a[i+1]=key;
        //cout<<"key:"<<a[i+1]<<endl;
        for(int n=0; n<m; n++)
        {
            if(n>0)
                cout<<" ";
            cout<<a[n];
        }
        cout<<endl;
    }


    return 0;
}

Measured memory_bytes: 3092
# coding: utf-8
# Your code here!

import math

A, B, C, D, E = int(input()), int(input()), int(input()), int(input()), int(input())
a = [A, B, C, D, E]
b = list(map(lambda x: (x - 1) % 10, a))
tmp = a[b.index(min(b))]
del a[b.index(min(b))]
c = list(map(lambda x: (math.ceil(x / 10) * 10), a))
print(sum(c) + tmp)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }

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

    int high = 0;
    int ans = 0;
    for(ll i = 0; i < n - 1; i++){
        if(h[i] >= h[i + 1]){
            high++;
        }else{
            ans = max(ans, high);
            high = 0;
        }
    }
    ans = max(ans, high);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String, Integer> map = new HashMap<String, Integer>();
		while (sc.hasNext()) {
			String penki = sc.next();
			if (!map.containsKey(penki)) {
				map.put(penki, 1);
			}
		}
		int ret = 0;
		Iterator<Map.Entry<String, Integer>> itr = map.entrySet().iterator();
		while (itr.hasNext()) {
			// nextを使用して値を取得する
			Map.Entry<String, Integer> entry = itr.next();
			ret++;
		}
		System.out.println(ret);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
int n, prn, pr[2000], p[1000], q[1000];
s64 a[502][502];
bool vis[100000];
s64 gcd(s64 x, s64 y) {return y?gcd(y, x%y):x;}
s64 lcm(s64 x, s64 y) {return x/gcd(x, y)*y;}
int main() {
	std::cin>>n;
	if(n==2) {
		puts("4 7\n23 10");
		return 0;
	}
	for(int i=2; prn<2*n; ++i) {
		if(!vis[i]) pr[prn++]=i;
		for(int j=0; j<prn&&i*pr[j]<100000; ++j) {
			vis[i*pr[j]]=true;
			if(i%pr[j]==0) break;
		}
	}
	for(int i=1; i<=2*n-2; i+=2) p[i]=pr[--prn];
	for(int i=n&1; i<=2*n-2; i+=2) q[i]=pr[--prn];
	for(int i=0; i<=n; ++i) a[i][0]=a[0][i]=a[i][n+1]=a[n+1][i]=1;
	for(int i=1; i<=n; ++i)
		for(int j=(i&1)+1; j<=n; j+=2)
			a[i][j]=(s64)p[i+j-2]*q[i-j+n-1];
	for(int i=1; i<=n; ++i)
		for(int j=(~i&1)+1; j<=n; j+=2)
			a[i][j]=lcm(lcm(a[i-1][j], a[i+1][j]), lcm(a[i][j-1], a[i][j+1]))+1;
	for(int i=1; i<=n; ++i) {
		for(int j=1; j<=n; ++j) printf("%lld ", a[i][j]);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 5248
package main

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

/*-----------Main-----------*/

func main() {
	N := readI()
	L := readIs(N)

	ans := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			for k := j + 1; k < N; k++ {
				if ok(L[i], L[j], L[k]) {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}

func ok(a, b, c int) bool {
	if kt(a, b, c) && sk(a, b, c) {
		return true
	}
	return false
}

func kt(a, b, c int) bool {
	if a == b || b == c || c == a {
		return false
	}
	return true
}

func sk(a, b, c int) bool {
	if a < b+c && b < c+a && c < a+b {
		return true
	}
	return false
}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-4.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


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

void MAIN() {
    int n, m;
    scanf("%d%d", &n, &m);
    std::vector<int> cnt(n, 1);
    std::vector<bool> has(n);
    has[0] = true;
    for(int i = 0; i < m; ++ i) {
        int x, y;
        scanf("%d%d", &x, &y);
        -- x, -- y;
        if(has[x]) {
            has[y] = true;
        }
        if(-- cnt[x] == 0) {
            has[x] = false;
        }
        ++ cnt[y];
    }
    int ans = 0;
    for(int i = 0; i < n; ++ i) {
        ans += has[i];
    }
    printf("%d\n", ans);
}

int main() {
    MAIN();
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;


int main(){

    int N,X,m[110]={},ans=0,min=INT32_MAX;
    cin >> N>>X;
    for(int i=1;i<=N;i++){
        cin >>m[i];
        X-=m[i];
        ans+=1;
        if(m[i]<min)min=m[i];
    }

    ans+=X/min;

    cout <<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int a[3005],b[3005],l1,l2,f[3005][3005],ans[3005];
int print[3005][3005],last1[3005][3005],last2[3005][3005];
char c[3005];

int main(void){
	scanf("%s",c);
	l1=strlen(c);
	for(int i=0;i<l1;i++)
	a[i+1]=c[i]-'a';
	scanf("%s",c);
	l2=strlen(c);
	for(int i=0;i<l2;i++)
	b[i+1]=c[i]-'a';
	memset(print,-1,sizeof(print));
	for(int i=1;i<=l1;i++){
		for(int j=1;j<=l2;j++){
			if(a[i]==b[j]){
				f[i][j]=f[i-1][j-1]+1;
				print[i][j]=a[i];
				last1[i][j]=i-1;
				last2[i][j]=j-1;
			}
			else 
			if(f[i-1][j]>=f[i][j-1]){ 
				f[i][j]=f[i-1][j];
				last1[i][j]=i-1;
				last2[i][j]=j;
			}
			else
			if(f[i-1][j]<f[i][j-1]){
				f[i][j]=f[i][j-1];
				last1[i][j]=i;
				last2[i][j]=j-1;
			} 
		}
	}
	int nowx=l1,nowy=l2;
	while(1){
		int xx=nowx;
		int yy=nowy;
		if(print[nowx][nowy]!=-1)
		ans[++ans[0]]=print[nowx][nowy];
		nowx=last1[xx][yy];
		nowy=last2[xx][yy];
		if(nowx<=0||nowy<=0)break;
	}
	for(int i=ans[0];i>=1;i--)
	printf("%c",ans[i]+'a');
}
/*
asdfghjkl
zxvvnna
*/ 

Measured memory_bytes: 141184
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<sstream>
#include<set>
#include<cctype>
#include<iomanip>
using namespace std;

int main()
{
ios::sync_with_stdio(false);
/***
#ifdef ONLINE_JUDGE
#else
    freopen("1.txt", "r", stdin);
#endif
***/
int n,m;
cin>>n>>m;
int a[n+1]={0};
int d[n+1]={1};
for(int i=1;i<=n;i++)
    d[i]=1;
d[0]=0;
a[1]=1;
for(int i=0;i<m;i++)
{ int c,b;
  cin>>c>>b;

  if(d[c]>1&&a[c]==1)  a[b]=1;
 else if(d[c]==1&&a[c]==1)  {a[c]=0;a[b]=1;}
  d[c]--;
  d[b]++;
}
int ant=0;
for(int i=1;i<=n;i++)
{
    if(a[i]==1) ant++;
}
cout<<ant;
return 0;
}


Measured memory_bytes: 1024
class Map(dict):
    def __missing__(self, key):
        return 0


def main():
    int(input())

    d = Map()
    ans = 0
    for i, height in enumerate(input().split()):
        height = int(height)
        d[i + height] += 1
        ans += d[i - height]

    return ans


if __name__ == '__main__':
    print(main())

# 大いに参考にした。
# https://kmjp.hatenablog.jp/entry/2020/05/03/1030


Measured memory_bytes: 46404
#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
  long long n,d,x,y,cou=0;
  cin>>n>>d;
  for(int i=0;i<n;i++){
    cin>>x>>y;
    if(x*x+y*y<=d*d)
      cou++;
  }
  cout<<cou<<endl;
}

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

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#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 all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
using namespace std;

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int N;
vector<int> a;

signed main()
{
    cin >> N;
    a.resize(N);

    rep(i, N)
    {
        cin >> a[i];
    }

    int m = 0;
    rep(i, N)
    {
        m += a[i] - 1;
    }

    cout << m << endl;

    return 0;
}


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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> vs(n + 1);
	fill(vs.begin(), vs.end(), 0);
	
	for(int i = 0; i < m; i++) {
		int f, t;
		cin >> f >> t;
		vs[f]++;
		vs[t]++;
	}
	bool success = true;
	for(int i = 1; i <= n; i++) {
		if(vs[i] % 2 == 1) {
			success = false;
			break;
		}
	}
	cout << (success ? "YES" : "NO") << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <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 <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}

struct S{
    int number;
    int AC[10]={},WA[10]={},time=0;
    int sumAC=0;
};

bool cmp(S a,S b){
    if(a.sumAC==b.sumAC){
        if(a.time==b.time)return a.number>b.number;
        return a.time<b.time;
    }
    return a.sumAC>b.sumAC;
}

signed main (){
    string s;cin>>s;
    string t="2019/04/30";
    if(s<=t)cout<<"Heisei"<<endl;
    else cout<<"TBD"<<endl;
}
    
/*
*/


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
 
int main() {
	string s;
  	cin >> s;
  	int cnt{0}, res{0};
  	for (char c : s) {
    	if (c == 'S') {
        	cnt = 0;
        } else {
        	cnt++;
        }
      	res = max(res, cnt);
    }
  
  	cout << res << endl;
}

Measured memory_bytes: 3136
x=raw_input()

n,a,b = [int(i) for i in x.split()]


s = raw_input()

a_c = 0
b_c = 0

for p in s:
    if(p=='a' and a_c+b_c<a+b):
        print 'Yes'
        a_c += 1
    
    elif(p=='b' and a_c+b_c<a+b and b_c<b):
        print 'Yes'
        b_c += 1

    else:
        print 'No'

Measured memory_bytes: 3076
import java.util.*; 
import java.lang.*; 

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
		long X = scan.nextLong();
                long money = 100;
                double m = 0;
                int year = 0;
                while(X>money){
                    m = money*1.01;
                    money = (long)m;
                    year++;
                }
                
                System.out.println(year);
	}
}

Measured memory_bytes: 35768
#define ll long long
#define MOD 1000000007 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#include <bits/stdc++.h>
using namespace std;
ll dp[3005][3005]={0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n;
  ll a[3005];
  cin>>n;
  for(int i=1;i<=n;i++)
  cin>>a[i];
  for(int i=n;i>=1;i--)
  {
    for(int j=i;j<=n;j++)
    {
      if((j-i+1)%2!=n%2)
      dp[i][j]=min(dp[i+1][j]-a[i],dp[i][j-1]-a[j]);
      else 
      dp[i][j]=max(dp[i+1][j]+a[i],dp[i][j-1]+a[j]);
    }
  }
  cout<<dp[1][n];
  return 0;
}

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

int main() {
	typedef complex<double> com;
	double x1, y1, x2, y2, x3, y3, xp, yp, s1, s2, s3;
	while ( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ) {
		s1 = ( conj( com( x1 - xp, y1 - yp ) ) * com( x2 - xp, y2 - yp ) ).imag();
		s2 = ( conj( com( x2 - xp, y2 - yp ) ) * com( x3 - xp, y3 - yp ) ).imag();
		s3 = ( conj( com( x3 - xp, y3 - yp ) ) * com( x1 - xp, y1 - yp ) ).imag();
		if ( s1 * s2 > 0 && s2 * s3 > 0 && s3 * s1 > 0 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

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


int main() {
    string S;
    cin >> S;
    int n = S.size();
    int ans = 1e6;
    rep(i, n - 2) {
        int X = (S[i] - '0') * 100 + (S[i+1] - '0') * 10 + (S[i+2] - '0');
        ans = min(ans, max(X - 753, 753 - X));
    }
    cout << ans << endl;
}


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

using namespace std;

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

using ll = long long;
using ull = unsigned long long;

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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int h, n;
  cin >> h >> n;

  vector<int> a(n + 1), b(n + 1);

  for (auto i = 1; i <= n; ++i) {
    cin >> a[i] >> b[i];
  }

  const int INF = 1e9 + 4;

  vector<int> dp(h + 1, INF);

  dp[h] = 0;

  for (auto i = h - 1; i > 0; --i) {
    for (auto j = 1; j <= n; ++j) {
      dp[i] = min(dp[i], i + a[j] <= h ? dp[i + a[j]] + b[j] : INF);
    }
  }

  for (auto i = 1; i <= h; ++i) {
    for (auto j = 1; j <= n; ++j) {
      (dp[0] = min(dp[0], a[j] >= i ? dp[i] + b[j] : INF));
    }
  }

  dbg(dp);

  cout << dp[0] << '\n';

  return 0;
}

Measured memory_bytes: 256
f=lambda:[*map(int,input().split())]
n,x=f()
l=f()
d=[x-l[0]]
for i in range(n-1):
  d+=[l[i+1]-l[i]]
a=d[0]
from math import *
for i in d:
  a=gcd(a,i)
print(a)

Measured memory_bytes: 20008
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


int main(){
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<int> Nums;

    int now = 1; // 今みている数
    int cnt = 0; // 連続数
    rep(i, N) {
        if (S[i] == (char)('0' + now)) cnt++;
        else {
            Nums.push_back(cnt);
            now ^= 1;
            cnt = 1;
        }
    }
    if (cnt != 0) Nums.push_back(cnt);
    if (Nums.size() % 2 == 0) Nums.push_back(0);

    int ans = 0;
    int add = 2 * K + 1;
    int left = 0;
    int right = 0;
    int tmp = 0;
    for (left=0;left<Nums.size();left+=2) {
        while (right < min(left + add, (int)Nums.size())) {
            tmp += Nums[right];
            right++;
        }

        ans = max(tmp, ans);
        tmp -= Nums[left];
        tmp -= Nums[left + 1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1020
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))

typedef long long ll;
typedef complex<double> point;

// up right down left
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

const double EPS = 1e-9;
const int days[]     = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    // 01234567
    string final="01234567";

    map<string,int> M;
    set<string> S;
    queue<pair<string,int> > Q;
    Q.push(mp(final,0));
    while(!Q.empty()){
        string s = Q.front().first;
        int ini = Q.front().second;
        Q.pop();
        if(S.find(s) != S.end()) continue;
        S.insert(s);
        M[s] = ini;
        int zerop = 0;
        rep(i,8) if(s[i] == '0') zerop = i;
        rep(i,4){
            int newp = zerop + dx[i];
            newp += 4*dy[i];
            if(zerop == 3 and newp == 4) continue;
            if(zerop == 4 and newp == 3) continue;
            if(0 <= newp and newp <= 7){
                string news = s;
                swap(news[zerop],news[newp]);
                Q.push(mp(news,ini+1));
            }
        }
    }
    string s;
    while(getline(cin,s)){
        stringstream ss;
        ss << s;
        string inp;
        rep(i,8){
            char c;
            ss >> c;
            inp.push_back(c);
        }
        cout << M[inp] << endl;
    }
    return 0;
}

Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int mat[15][15];
int main()
{
	int n,m,x;
	cin>>n>>m>>x;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			cin>>mat[i][j];
		}
	}
	ll mn=INT_MAX;
	int tot=pow(2,n);
	for(int i=1;i<tot;i++)
	{
		
		ll cs=0;
		int arr[m+1]={0};
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				
				cs+=mat[j][0];
				for(int k=1;k<=m;k++)
				{
					arr[k]+=mat[j][k];
				}
				//cout<<"hi";
			}
		}
		
		int f=0;
		for(int j=1;j<=m;j++)
		{
			if(arr[j]<x)
			{
				f=1;
				break;
			}
		}
		if(f==0)
			mn=min(mn,cs);
	}
	if(mn==INT_MAX)
	{
		cout<<-1<<"\n";
	}
	else
	{
		cout<<mn<<"\n";
	}
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <deque>
#include <stack>
using namespace std;
int main()
{
    int num;
    cin >> num;
    deque<int> box;
    deque<int> que;
    box.push_back(0);
    int current;
    for(int i=1;i<=num;i++){
        cin >> current;
        box.push_back(current);
    }

    for(int i=num;i>0;i--){
        bool judge = true;
        for(int j=i;j>0;j--){
            if(box[j]==j){
                que.push_front(j);
                box.erase(box.begin()+j);
                judge = false;
                break;
            }
        }
        if(judge){
            cout << "-1" << endl;
            return 0;
        }
    }

    for(int i=0;i<num;i++){
        cout << que[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a[30]={0}; //アルファベットは26種類.
  string s; cin >> s;
  for(char c:s){
    int i = c - 'a';
    a[i]++;
  }
  for(int j=0;j<26;j++){
    if(a[j]==0){
      cout << (char)('a' + j) << endl;
      return 0;
    }
  }
  cout << "None" << endl; // すべてのアルファベットが出ている場合.
  return 0;
}

Measured memory_bytes: 512
reader = list(map(int, input().split()))
a = reader[0]
b = reader[1]
dif = b - a

towers = [1]
for i in range(1000):
    towers.append(towers[i]+(i+2))
    if towers[i+1]-towers[i] == dif:
        print(str(towers[i]-a))


Measured memory_bytes: 38256