akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
ll dp[105][100500];
ll dprev[105][100500];
ll dpsum[105][100500];
ll dprevsum[105][100050];
ll num[100500];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    for(int i = 1; i <= 1e5; i++) {
        dp[1][i] = 1;
        dpsum[1][i] = i;
    }
    ll sum = 0;
    for(ll val = 1; val <= 1e5; val++) {
        ll over = N / val;
        chmax(over, (ll)1e5);
        ll under = N / (val + 1) + 1;
        chmax(under, (ll)1e5 + 1);
        num[val] = over - under + 1;
        sum += num[val];
        //cerr << val << " " << num[val] << endl;
    }
    for(int i = 1; i <= 1e5; i++) {
        dprev[1][i] = num[i];
        dprevsum[1][i] = (dprevsum[1][i-1] + dprev[1][i]) % mod;
    }
    cerr << sum << endl;
    for(int index = 2; index <= K; index++) {
        for(ll after = 1; after <= min(N, (ll)1e5); after++) {
            //dp[index][after] = dpsum[index-1][(ll)1e5] + (dprevsum[index-1][(ll)1e5] - dprevsum[index-1][after - 1]) + mod;
            dp[index][after] = (dprevsum[index-1][(ll)1e5] - dprevsum[index-1][after - 1]) + mod;
            ll over = N / after;
            chmin(over, (ll)1e5);
            dp[index][after] += dpsum[index-1][(ll)over];
            dp[index][after] %= mod;
        }
        for(ll after = 1; after <= 1e5; after++) {
            dprev[index][after] = num[after] * dpsum[index-1][after] % mod;
        }
        for(int val = 1; val <= 1e5; val++) {
            dpsum[index][val] = (dpsum[index][val-1] + dp[index][val]) % mod;
            dprevsum[index][val] = (dprevsum[index][val-1] + dprev[index][val]) % mod;
        }
    }
    ll ans = (dpsum[K][(ll)1e5] + dprevsum[K][(ll)1e5]) % mod;
    cerr << dpsum[K][(ll)1e5] << " " << dprevsum[K][(ll)1e5] << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 321024
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var N=Arr.shift()-0;
var AB=(Arr.shift()).split(" ").map(Number);
var C=Arr.shift()-0;
var arr=[];
for(var i=0;i<N;i++){
   var v=Arr.shift()-0;
   arr.push(v);
}
arr.sort(function(a,b){return b-a;});
var ans=[];
var money=AB[0];
var cal=C;
for(var i=0;i<N;i++){
   money+=AB[1];
   cal+=arr[i];
   var v=cal/money;
   ans.push(v);
}
var max=Math.max.apply(null,ans);
console.log(Math.floor(max));

Measured memory_bytes: 8436
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ((int)(x).size)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
 
int main(){
    ll x=1,g=0,n,h,w,k,m,ans=0,ptr=0;
    string s,s1,s2;
    cin >> n;
    VI l(n);
    rep(i,n){
        cin >> l[i];
	}
    sort(ALL(l));
 
    for(int i=n-1; i>=0; i--){
        for(int j=0; j<i;j++){
            for(int k=j+1; k<i;k++)
                if(l[i] < l[j]+l[k])
                    ans++;
        }
    }
    /*for(int i=0; i<n-2; i++){
        if(l[i+2] < l[i]+l[i+1] && l[i+1] < l[i+2]+l[i] && l[i] < l[i+1]+l[i+2] )
            ans++;
    }*/
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const double PI = 2 * acos(0);
int N;
int arr[200001];
LL dp[200001][3];

LL rek(int idx, int jatah) {
	if (idx >= N) return 0;
	if (dp[idx][jatah] == -1) {
		if (jatah > 0) {
			dp[idx][jatah] = max(rek(idx + 1, jatah - 1), rek(idx + 2, jatah) + arr[idx]);
		} else dp[idx][jatah] = rek(idx + 2, jatah) + arr[idx];
	}
	return dp[idx][jatah];
}

int main() {
	memset(dp, -1, sizeof dp);
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &arr[i]);
	}
	LL ans = rek(0, 1 + (N % 2));
	printf("%lld\n", ans);
}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int aray[200005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int K, N; gi(K), gi(N);
	int ans = -1;
	rep(i, N) gi(aray[i]);
	rep1(i, N-1) ans = max(ans, aray[i] - aray[i-1]);
	ans = max(ans, aray[0] - aray[N-1] + K);
	print(K-ans);
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define int long long
const int inf=1145141919;
const int mod=1000000007;
const int dd[]={0,-1,0,1,0};
using namespace std;
int a,b,c,d;
int p[100001],q[100001];
signed main(){
	int x,y,z,w;
	string s,t;
	cin>>s>>t;
	int i=1;
	for(auto e:s){
		p[i]=p[i-1]+(e=='A'?1:2);
		i++;
	}
	i=1;
	for(auto e:t){
		q[i]=q[i-1]+(e=='A'?1:2);
		i++;
	}
	cin>>a;
	for(i=0;i<a;i++){
		cin>>x>>y>>z>>w;
		if((p[y]-p[x-1])%3==(q[w]-q[z-1])%3)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 2432
N, x = map(int, input().split())
As = list(map(int, input().split()))

# 隣り合う箱の和を取る
# sum_As = [0 for i in range(N-1)]
# for i in range(N-1):
#     sum_As[i] = As[i] + As[i+1]

count = 0
# 両側があふれていたら減らせるだけ減らそう
for i in range(1, N-1):
    if As[i-1]+As[i] > x and As[i]+As[i+1] > x:
        minus = min(As[i], As[i-1]+As[i]-x, As[i]+As[i+1]-x)
        As[i] -= minus
        count += minus

# 片側があふれていたら減らせるだけ減らそう
if As[0]+As[1] > x:
    minus = min(As[0], As[0]+As[1]-x)
    As[0] -= minus
    count += minus

for i in range(1, N-1):
    if As[i-1]+As[i] > x:
        minus = min(As[i], As[i-1]+As[i]-x)
        As[i] -= minus
        count += minus
    if As[i]+As[i+1] > x:
        minus = min(As[i], As[i]+As[i+1]-x)
        As[i] -= minus
        count += minus

if As[N-2]+As[N-1] > x:
    minus = min(As[N-1], As[N-2]+As[N-1]-x)
    As[N-1] -= minus
    count += minus

print(count)


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

int main(){
	int d;
	while(cin >> d){
		int ans = 0;
		for(int i = 0; i < 600/d; i++){
			ans += (d*d*d)*(i*i);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define INF 1000000000000
typedef long long LL;
int n,m,s,g1,g2;
LL d[101][101];

int main(){
    while(cin>>n>>m>>s>>g1>>g2,n+m+s+g1+g2){
        s--;g1--;g2--;
        REP(i,101){
            REP(j,101){
                d[i][j]=INF;
            }
            d[i][i]=0;
        }
        REP(i,m){
            int a,b,c;
            cin>>a>>b>>c;
            a--;b--;
            d[a][b]=c;
            //d[b][a]=c;
        }
        REP(k,n){
            REP(i,n){
                REP(j,n){
                    d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
                }
            }
        }
        LL ans=1e12;
        REP(i,n){
            ans=min(ans,d[s][i]+d[i][g1]+d[i][g2]);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define ABS(a) ((a) > (0) ? (a) : -(a))

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *a = (i32 *) calloc (n, sizeof (i32));
  i32 sum = 0;
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
    sum += a[i];
  }
  i32 min = 0;
  for (i32 i = 1; i < n; ++i) {
    if (ABS(sum - n * a[min]) > ABS(sum - n * a[i])) {
      min = i;
    }
  }
  printf ("%" PRIi32 "\n", min);
}

int main (void) {
  run ();
  return 0;
}


Measured memory_bytes: 128
#include "stdio.h"
const int MAX_V = 10000; // 1????????§????´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°,0????´???°??§?????????
int main() {
    int i, k, n;
    for(i = 2; i <= MAX_V; i++){
        prime[i] = 1; // 2??\???????´???°??¨??????
    }
    for(i = 2; i * i <= MAX_V; i++) {
        if(prime[i]) {
            for(k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0; // ?´???°???2?????\???????????°????´???°??§?????????
            }
        }
    }
   while (1) {
        scanf("%d",&n);
        if (n == 0)break;
//        while(scanf("%d", &n) != 0) {
        int p1 = 0,q1 = 0;
        for(i = n;3 <= i;i--){
            if(prime[i] == 1 && prime[i-2] == 1){  //??????????´???°
                q1 = i;
                p1 = i-2;
                break;
            }
        }
        printf("%d %d\n",p1,q1);//for?????????????????????
    }
    return 0;
}
//????¨??????¨????????????????????????

Measured memory_bytes: 1064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vd a(5);
	cin>>a;
	puta((int)(a[0]-max(ceil(a[1]/a[3]),ceil(a[2]/a[4]))));
	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll ans = 0;
    ll next = 1;
    rep(i, N) {
        ll a = A[i];
        if (a == next) {
            next ++;
        }else {
            ans ++;
        }
    }
    if (next == 1) {
        cout << -1 << '\n';
    }else {
        cout << ans << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, a[123];
bool b[123];
vector<int>ans;
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	for (int i = 1; i <= n; i++) {
		int p = 1, e = -1;
		for (int j = 1; j <= n; j++) {
			if (!b[j]) {
				if (a[j] == p)e = j;
				p++;
			}
		}
		if (e == -1) {
			cout << "-1\n";
			return 0;
		}
		ans.push_back(a[e]);
		b[e] = 1;
	}
	for (int i = ans.size() - 1; i >= 0; i--)cout << ans[i] << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define rrep(i , n) for ( int i = n-1; i >=0 ; i--)

#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	ull size_; 
	std::vector<ull> par, rank, count;

public:
	UnionFind() : size_(0), par(std::vector<ull>()), rank(std::vector<ull>()), count(std::vector<ull>()) {};
	UnionFind(ull size__) : size_(size__) {
		par.resize(size_); rank.resize(size_); count.resize(size__);
		for (ull i = 0; i < size_; i++) par[i] = i, rank[i] = 0, count[i] = 1;
	}
	ull size() { return size_; }
	// ull root(ull x) { return par[x] == x ? x : par[x] = root(par[x]); }
	
	ull root(ull x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	
	bool same(ull x, ull y) { return root(x) == root(y); }

	void unite(ull x, ull y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y, count[y]+=count[x], count[x]=0;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++, count[x]+=count[y], count[y]=0;
		else par[y] = x, count[x] += count[y], count[y] = 0;
	}

	ull size__(ull x)
	{
		return count[root(x)];
	}

	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};
/*
maybe sth wrong 
got wa in one problem
*/
ll modpow(ll a, ll b)
{
	if (b == 0)
	{
		return 1;
	}

	if (b % 2)
	{
		return a * modpow(a, b-1) % MOD;
	}
	else
	{
		ll halfB = b / 2;
		ll half = modpow(a, halfB);
		return half * half % MOD;
	}
}

ll calcComb(ll n, ll m)
{
	if (m > n-m)
	{
		return calcComb(n, n-m);
	}

	ll ansMul = 1;
	ll ansDiv = 1;

	rep(i, m)
	{
		ansMul *= (n-i);
		ansDiv *= (i+1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}

	return ansMul * modpow(ansDiv, MOD - 2) % MOD;
}

__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}


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

	ll total = 0;
	for(ll i = 1; i < sqrt(N); i++)
	{
		if (N % i == 0 && (i < N /i -1))
		{
			total += N / i - 1;
		}
	}
	
	cout << total << endl;
	return 0;
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair

const int MOD = 1000000007;

class EHopscotchAddict {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, m;
        in >> n >> m;
        vector<vector<int>> adj(n + 1);
        int a, b;
        for (int i = 0; i < m; i++) {
            in >> a >> b;
            adj[a].pb(b);
        }
        int s, t;
        in >> s >> t;
        int vis[n+1][3];

        for(int i=0;i<n+1;i++)
        {
            vis[i][0]=1000000000000;
            vis[i][1]=1000000000000;
            vis[i][2]=1000000000000;
        }
        queue<pair<pair<int,int>,int>> bfs;
        bfs.push(mp(mp(s, 0), 0));
        int fans=1e17;
        int cmp=fans;
        while(!bfs.empty())
        {
            int x=bfs.front().first.first;
            int f=bfs.front().first.second;
            int ans=bfs.front().second;
            bfs.pop();
            if(ans>=vis[x][f])
                continue;
            vis[x][f]=ans;
            if(f==0)
                f=3;
            if(x==t&&f==3)
            {
                fans=min(ans,fans);
                continue;
            }
            for(auto it:adj[x])
            {
                if(f==3)
                bfs.push(mp(mp(it, f-1), ans+1));
                else
                bfs.push(mp(mp(it, f-1), ans));
            }
        }
        if(fans==cmp)
            out<<-1;
        else
        out<<fans;
    }
};

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

    EHopscotchAddict solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int m = max(a + b, a - b);
  m = max(m, a * b);
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;


int main(void) {
  int a, b;
  while( cin >> a >> b ){
    cout << a + b << endl;
  }
  return 0;
}





// EOF

Measured memory_bytes: 3088
#if TEST
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
#endif

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;

namespace at_coder
{
#if TEST
    [TestClass]
#endif
    public class Test_156_a
{
        
#if TEST
        public static void Test_Main()
#else
        public static void Main()
#endif
        {
            var ar = ReadIntArray();

            int N = ar[0];
            int R = ar[1];

            int K = N;
            int D;
            if (K >= 10)
            {
                D = R;
            } 
            else
            {
                // 
                D = R + 100 * (10 - K);
            }
            Console.WriteLine(D.ToString());
        }

        private static int[] ReadIntArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ar[i] = int.Parse(ss[i]);
            }
            return ar;
        }

#if TEST
#else
    }
}
#endif

Measured memory_bytes: 11092
n = int(input())
s = input()

ans = 0
for i in range(10):
    a = s.find(str(i))
    # find()は見つからなかったら-1を返す
    if a == -1:
        continue
    for j in range(10):
        # find(探すもの, どこから探すか(, どこまで探すか))
        b = s.find(str(j), a+1)
        if b == -1:
            continue
        for k in range(10):
            c = s.find(str(k), b+1)
            if c != -1:
                ans += 1
print(ans)

Measured memory_bytes: 38384
n,l=map(int,input().split())
ans=l*n+(-1)*n
for i in range(1,n+1):
	ans+=i
aji=float('inf')
for i in range(1,n+1):
	if aji>abs(l+i-1):
		aji=abs(l+i-1)
		sin=l+i-1
print(ans-sin)



Measured memory_bytes: 38384
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
  int x, y, W, H, r;
  cin >> W >> H >> x >> y >> r;
  if (x > 0 && y > 0 && x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H) {
    cout << "Yes" << endl;

  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3084
package main

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

var N, ans int

func main() {
	fmt.Scan(&N)
	a := make(map[int]int, N)

	reader := bufio.NewScanner(os.Stdin)
	reader.Split(bufio.ScanWords)

	for i := 0; i < N; i++ {
		reader.Scan()
		t, _ := strconv.Atoi(reader.Text())
		a[t]++
		a[t-1]++
		a[t+1]++
	}

	for _, value := range a {
		ans = max(ans, value)
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}

type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 3968
fn main() {
  let mut buffer = String::new();
  std::io::stdin().read_line(&mut buffer).ok();
  let (x, a) = {
    let mut input = buffer.split_whitespace();
    (
      input.next().unwrap().parse::<i32>().unwrap(),
      input.next().unwrap().parse::<i32>().unwrap(),
    )
  };

  if x < a {
    println!("0");
  } else {
    println!("10");
  }
}

Measured memory_bytes: 4352
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int ret = 0;
    for(;;){
        string s;
        if(!(cin >> s)){
            cout << ret << endl;
            return 0;
        }
        
        int n = s.size();
        for(int i=0; i<n; ++i){
            if('0' <= s[i] && s[i] <= '9'){
                int j = i+1;
                while(j < n && '0' <= s[j] && s[j] <= '9')
                    ++ j;
                ret += atoi(s.substr(i, j-i).c_str());
                i = j;
            }
        }
    }
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long x = sc.nextLong();
        long y = sc.nextLong();

        long num = x;
        int cnt = 1;
        while (true) {
            num *= 2;
            if (num <= y)
                cnt++;
            else
                break;
        }

        System.out.println(cnt);
    }
}

Measured memory_bytes: 23892
function main(input){
  input = input.split('\n');
  const [X, N] = input[0].split(' ').map(Number);
  if(N===0) return console.log(X);
  const p = input[1].split(' ').map(Number);

  let answer = X;
  let i=0;
  while(true){
    if(!p.includes(answer-i)) {return console.log(answer-i);}
    if(!p.includes(answer+i)) {return console.log(answer+i);}
    i++;
  }

}

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

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

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) \
    for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, pair<T1, T2> P) {
    return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream& operator<<(ostream& s, vector<T> P) {
    for (int i = 0; i < P.size(); ++i) {
        if (i > 0) {
            s << " ";
        }
        s << P[i];
    }
    return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<vector<T> > P) {
    for (int i = 0; i < P.size(); ++i) {
        s << endl << P[i];
    }
    return s << endl;
}
template <class T>
ostream& operator<<(ostream& s, set<T> P) {
    EACH(it, P) { s << "<" << *it << "> "; }
    return s << endl;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, map<T1, T2> P) {
    EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; }
    return s << endl;
}
template <class T>
void show(vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        cerr << v[i] << " ";
    }
    cerr << "\n";
}
typedef long long ll;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    string ans = "";
   
    while (n > 0) {
        n--;
        ans+=(char)('a' +n%26);
        n/=26;
     }
     
    reverse(ALL(ans));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3660
main(a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
for(A=2147483647,f=i=0;!f;i++)
	for(j=0;j<=i;j++)
		if(a*j+b*(i-j)==c||a*j==b*(i-j)+c||a*j+c==b*(i-j))
			if(f=1,A>a*j+b*(i-j))A=a*j+b*(i-j),X=j,Y=i-j;
exit(0);}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n, m, sum = 0, a;
  cin >> n >> m;
  REP(i, m) {
    cin >> a;
    sum += a;
  }
  cout << max(n - sum, -1) << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string.h>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	LL N;
	cin>>N;
	char n[100];
	sprintf(n,"%lld",N);
	char *p=n;
	int s=0;
	while (*p!='\0'){
		s+=*p-'0';
		p++;
	}
	if (N%s==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}

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

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

  int minv = 753;
  for (int i = 0; i < N.size()-1; i++){
    int X = stoi(N.substr(i, 3));
    minv = min (minv, abs(753-X));
  }
  
  cout << minv << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int I,O,T,J,L,S,Z;
  cin>>I>>O>>T>>J>>L>>S>>Z;
  int ans=I/2*2+J/2*2+L/2*2+O;
  if(I!=0 && J!=0 && L!=0)
    cout<<max((I-1)/2*2+(J-1)/2*2+(L-1)/2*2+3+O,ans)<<endl;
  else
    cout<<ans<<endl;
}

Measured memory_bytes: 3604
#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() {  
  int n;
  cin >> n;
  map<string, int> S;
  ll ans = 0;
  for(int i = 0; i < n; i++) {
    string s;
  	cin >> s;
    sort(s.begin(), s.end());
    if(S.count(s)) {
    	ans += S.at(s);
        S.at(s)++;
    }
    else {
    	S[s] = 1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 11136
N = int(input())
A = list(map(int, input().split()))

d = {}
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)


Measured memory_bytes: 86348
n = int(input())
A = list(map(int, input().split()))

ans, cnt = 0, 0
s = 0
for t in range(n):
    while cnt & A[t]:
        ans += t - s
        cnt -= A[s]
        s += 1
    
    cnt += A[t]

ans += (t-s+1) * (t-s+2) // 2
        
    
print(ans)

Measured memory_bytes: 100380
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int, int, int> P;

int main()
{
	long long H, W, N;
	vector<P> p;
	cin.sync_with_stdio(false);
	cin >> H >> W >> N;
	vector<int> a(N), b(N);
	p.reserve(N * 9);
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
		for (int j = -1; j <= 1; j++) {
			for (int k = -1; k <= 1; k++) {
				if (a[i] + j >= 2 && a[i] + j < H && b[i] + k >= 2 && b[i] + k < W) {
					p.push_back(P(a[i] + j, b[i] + k, 0));
				}
			}
		}
	}
	sort(p.begin(), p.end());
	p.erase(unique(p.begin(), p.end()), p.end());
	for (int i = 0; i < N; i++) {
		for (int j = -1; j <= 1; j++) {
			for (int k = -1; k <= 1; k++) {
				if (a[i] + j >= 2 && a[i] + j < H && b[i] + k >= 2 && b[i] + k < W) {
					get<2>(*lower_bound(p.begin(), p.end(), P(a[i] + j, b[i] + k, 0)))++;
				}
			}
		}
	}
	long long res[10];
	for (int i = 0; i < 10; i++) {
		res[i] = 0;
	}
	for (vector<P>::iterator ite = p.begin();ite != p.end(); ite++) {
		res[get<2>(*ite)]++;
	}
	res[0] = (H - 2) * (W - 2) - p.size();
	for (int i = 0; i < 10; i++)
		cout << res[i] << endl;
	return 0;
}


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

const int DPSIZE = 100005;
const int MAXN = 11;
const int INF = 1<<28;
int N, M;
int V[MAXN];
int dp[DPSIZE];

int main() {
  while(cin >> N >> M && (N|M)) {
    for(int i = 0; i < N; ++i) {
      cin >> V[i];
    }

    int l, r;
    l = 0;
    r = 100001;
    while(r-l) {
      int m = (l+r)/2;
      fill(dp, dp+DPSIZE, INF);
      dp[0] = 0;
      for(int j = 0; j < N; ++j) {
        for(int i = V[j]; i <= M; ++i) {
          dp[i] = min(dp[i], dp[i-V[j]]+1);
        }
        for(int i = 0; i <= M; ++i) {
          dp[i] = dp[i] <= m ? 0 : INF;
        }
      }
      if(dp[M] == 0) {
        r = m;
      } else {
        l = m+1;
      }
    }
    cout << r << endl;
  }
  return 0;
}

Measured memory_bytes: 1548
n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))
cnt = 0
pre = 1
memo = []
kumi = set([])
if k < n:
    for i in range(2 * (10 ** 5) + 5):
        cur = A[pre]
        cnt += 1
        pre = cur
        if cnt == k:
            print(cur)
            exit()

else:
    for i in range(2 * (10 ** 5) + 5):
        cur = A[pre]
        cnt += 1
        memo.append(cur)
        if cur in kumi:
            break
        kumi.add(cur)
        pre = cur
    # 今までに見た物の数を減らしておく、kは残り回数
    k -= cnt

    for j in range(cnt):
        if memo[j] == cur:
            start = j
            break
    loop = memo[start:-1]

    loop_num = i - start
    print(loop[k % loop_num])


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

using namespace std; 
int N,a[200001];
bool b[200001];
bool check(int x)
{ 	
		for(int i=1;i<=(N<<1)-1;++i)b[i]=(a[i]<=x); 
		for(int i=0;i<N;++i)
		{
			if(b[N-i]==b[N-i-1])
				return b[N-i];
			if(b[N+i]==b[N+i+1])
				return b[N+i];
		} 
		return b[1]; 
} 

int main(){ 
	 scanf("%d",&N);
	 for(int i=1;i<=(N<<1)-1;++i)
	 	scanf("%d",a+i);
		int l=1,r=(N<<1)-1,m;
	while(l<r)
	   if(check(m=l+r>>1))r=m;
	   else 
	   	l=m+1; 
	   	printf("%d",l); 
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,ans = 0;
	string a,b,c;
	cin >> n >> a >> b >> c;
	for(int i = 0;i < n;i++){
		if(a[i] != b[i] && b[i] != c[i] && c[i] != a[i]) ans += 2;
		else if(!(a[i] == b[i] && b[i] == c[i])) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] str = new String[3];
		for (int i=0;i<3;i++) {
			str[i] = sc.next();
		}
		System.out.println(str[0].charAt(0)+""+str[1].charAt(1)+""+str[2].charAt(2));
	}
}

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

struct UnionFind{
    vector<int> par;
    vector<int> sizes;
 
    UnionFind(){}
    UnionFind(int n):par(n),sizes(n,1){ rep(i,n)par[i]=i; }
 
    //find root of x
    int find(int x){
        if(x!=par[x]) par[x] = find(par[x]);
        return par[x];
    }
 
    void unite(int x,int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }
 
    bool same(int x,int y){ return find(x) == find(y); }
    int size(int x){ return sizes[find(x)]; }
};

vector<priority_queue<ll,vector<ll>,greater<ll>>> pq;
priority_queue<pair<int,int>> choose;
UnionFind uf;

void merge(int x,int y){
    x = uf.find(x);
    y = uf.find(y);
    if(pq[x].size() < pq[y].size()){
        swap(x,y);
    }
    while(pq[y].size()){
        pq[x].push(pq[y].top());
        pq[y].pop();
    }
    uf.unite(x,y);
    int z = uf.find(x);
    // ufのルートに合わせる
    if(z != x){
        pq[z].swap(pq[x]);
    }
}

int main(void){
    int n,m;
    cin>>n>>m;
    pq.resize(n);
    uf = UnionFind(n);
    rep(i,n) {
        ll a;
        cin>>a;
        pq[i].push(a);
    }
    rep(_,m){
        int x,y;
        cin>>x>>y;
        merge(x,y);
    }

    rep(i,n){
        if(pq[i].size()){
            choose.push({pq[i].size(), i});
        }
    }

    ll res = 0;
    while(choose.size()>=2){
        int x = choose.top().second; choose.pop();
        int y = choose.top().second; choose.pop();
        if(pq[x].size()==0 || pq[y].size()==0){
            cout<<"Impossible"<<endl;
            return 0;   
        }
        res += pq[x].top() + pq[y].top();
        pq[x].pop(); pq[y].pop();
        merge(x,y);
        int z = uf.find(x);
        choose.push({pq[z].size(), z});
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 9976
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define VI vector<int>
#define PB(x) push_back(x)
#define SZ(x) end(x) - begin(x)
#define DEBUG(x) cerr << __LINE__ << ":" << #x << ": " << x << "\n";
//#define int long long
using namespace std;
using lint = long long;
struct Fast{Fast(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};} fast;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
inline void CO(auto &a) {REP(i, SZ(a)) cout << i << ": " << a[i] << "\n";}
//if (IO > 1e5){lint a;	scanf(%lld, &a);	printf("%lld\n", a);}

signed main(){
	int n;	cin >> n;
	vector<pair<pair<string,int>,int>> in(n);
	REP(i,n){
		cin >> in[i].first.first;
		int t;	cin >> t;
		in[i].first.second = -t;
		in[i].second = i;
	}
	VSORT(in);
	REP(i,n) cout << in[i].second + 1<< endl;
return 0;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	int n, d;
  cin >>  n >> d;
  int arr[15][15];
  REP(i, n){
    REP(j, d){
      cin >> arr[i][j];
    }
  }
  int res = 0;
  REP(i, n - 1){
    FOR(j, i + 1, n){
      int sum = 0;
      REP(k, d){
        sum += (arr[i][k] - arr[j][k]) * (arr[i][k] - arr[j][k]);
      }
      long double tmp = sqrt(sum);
      if (tmp == floor(tmp)){
        res++;
      }
    }
  }
  cout << res << endl;
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}


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

using namespace std;

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

typedef long long ll;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int maxi;
    int tmp = 0;
    rep (i, n + 1) {
        tmp += i;
        if (tmp >= n) {
            maxi = i;
            break;
        }
    }
    rrep (i, maxi + 1) {
        if (n - i >= 0) {
            n -= i;
            cout << i << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
string a[100],d;
int c[100];
int main(){
	int n,m;
	while(true){
	cin>>n>>m;
	if(n==0)break;
	for(int i=0;i<n;i++)cin>>a[i]>>c[i];
	int ans=0;
	for(int u=0;u<m;u++){
		cin>>d;
		for(int i=0;i<n;i++){
			bool ok=true;
			for(int j=0;j<8;j++)if(a[i][j]!='*'&&a[i][j]!=d[j])ok=false;
			if(ok)ans+=c[i];
		}
	}
	cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
// http://abc065.contest.atcoder.jp/tasks/abc065_b

#include <cstdint>
#include <cstdio>
#include <unordered_set>

int main () {

	int n;

	scanf("%d", &n);

	int * a = new int[n];
	int p = 1;
	uint64_t count = 0;

	std::unordered_set<int> visited;
	visited.insert(1);

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

	do {
		p = a[p - 1];
		if (visited.find(p) == visited.end()) {
			visited.insert(p);
			++count;
		} else {
			break;
		}
	} while (p != 2);

	if (p == 2) {
		printf("%llu\n", count);
	} else {
		printf("%d\n", -1);
	}

	delete[] a;

	return 0;

}


Measured memory_bytes: 4772
l, r = map(int,input().split())
ans = 2019
for i in range(l, r) :
    for j in range(i + 1, r + 1) :
        ans = min(ans, (i * j) % 2019)
        if ans == 0 : 
            break
    if ans == 0 :
        break
print(ans)

Measured memory_bytes: 3060
S = gets.chomp
K = gets.to_i

r = [1]
combo = false
S.split("").each_with_index do |c, i|
    next if i == 0
    if S[i] == S[i-1]
        r[-1] += 1
    else
        r.push(1)
    end
end

if r.length == 1
    puts r[0]*K/2
    exit
end

ret = r.map {|e| e /2 }.inject(:+)
ret *= K

if S[0] == S[-1] && r[0].odd? && r[-1].odd?
    ret += (K-1)
end

puts ret

Measured memory_bytes: 1788
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	vector<pair<int,int>> P(N);
	REP(i,N){
		P[i].first=in();
		P[i].second=in();
	}
	sort(ALL(P),[](pair<int,int>& l,pair<int,int>& r){return l.second==r.second?l.first<r.first:l.second>r.second;});
	out(P[0].first,P[0].second);
	return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

    char temp = N[N.size() - 1];
    int one = temp - '0';
    string ans;
    if (one == 3)
    {
        ans = "bon";
    }
    else if (one == 0 || one == 1 || one == 6 || one == 8)
    {
        ans = "pon";
    }
    else
    {
        ans = "hon";
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 3624
# C - 4-adjacent

N = int(input())
a = list(map(int, input().split()))

a_4_multi, a_2_multi, a_odd = [], [], []

for x in a:
    if x%2 == 1:
        a_odd.append(x)
    elif x%4 != 0:
        a_2_multi.append(x)
    else:
        a_4_multi.append(x)
        
sort_a = []
for idx in range(N):
    if idx%2 == 0 and len(a_odd) >= 1:
        sort_a.append(a_odd.pop())
    elif idx%2 == 1 and len(a_4_multi) >= 1:
        sort_a.append(a_4_multi.pop())
    elif len(a_odd) == 0 and len(a_4_multi) >= 1:
        sort_a.append(a_4_multi.pop())
    elif len(a_odd) >= 1 and len(a_4_multi) == 0:
        sort_a.append(a_odd.pop())
    else:
        sort_a.extend(a_2_multi)
        break

for idx in range(N-1):
    if (sort_a[idx] * sort_a[idx+1])%4 != 0:
        print("No")
        exit()

print("Yes")

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a%b) : a;
}
int lcm(int a, int b) {
  return a*b/gcd(a, b);
}

signed main(void)
{
  int a[3], m[3];
  while(cin>>a[0]>>m[0]>>a[1]>>m[1]>>a[2]>>m[2]) {
    if(!a[0] && !a[1] && !a[2] && !m[0] && !m[1] && !m[2]) break;
    int cnt[3] = {0}, x = 1, y = 1, z = 1;
    while(true) {
      x = (a[0]*x) % m[0];
      cnt[0]++;
      if(x == 1) break;
    }
    while(true) {
      y = (a[1]*y) % m[1];
      cnt[1]++;
      if(y == 1) break;
    }
    while(true) {
      z = (a[2]*z) % m[2];
      cnt[2]++;
      if(z == 1) break;
    }
    int tmp = lcm(cnt[0], cnt[1]);
    cout << lcm(tmp, cnt[2]) << endl;
  }

  return 0;
}

Measured memory_bytes: 2964
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <float.h>
using namespace std;

#define N 100

int a[N];

int main()
{
	int n, d, x;
	int ans = 0;
	
	cin >> n >> d >> x;
	for( int i = 0; i < n; i++ ) {
		cin >> a[i];
	}

	for( int i = 0; i < n; i++ ) {
		for ( int j = 0; j < d; j++ ) {
			if( a[i] * j + 1 <= d ) {
				ans++;
			}
		}
	}
	ans += x;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define a(x) x.begin(),x.end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<=(int)n:i>=(int)n;k<n?i++:i--)
#define input(v,n) fo(i,n)cin>>v[i]
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pi;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667
const int inf = numeric_limits<int> :: max();
// ===================== MANASH =================== //

int n,m;

void test() {

    int x,y;
    cin >> n >> x >> y;
    vector<int> len(n+1);
    for( int i = 1; i <= n; i++) {
        for( int j = i+1; j <= n; j++) {
            int dist = min(abs(j-i),abs(i-x) + 1 + abs(y-j));
            len[dist]++;
        }
    }
    Fo(i,1,n-1) cout << len[i] << '\n';
}

signed main() {

    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    #ifdef LOCAL
    freopen("input.txt","r",stdin);
    cout<<"Time Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec.\n";
    #endif

    int T = 1;
    //cin >> T;
    while(T--) {
        test();
        cout << "\n";
    }
    return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int N = S.Length;
		int M = T.Length;
		int min = (int) 1e9;
		for(int i=0;i+M-1<N;i++){
			int cnt = 0;
			for(int j=0;j<M;j++){
				if(S[j + i] != T[j]) cnt++;
			}
			
			min = Math.Min(min, cnt);
			
		}
		
		Console.WriteLine(min);
		
		
	}
	String S,T;
	public Sol(){
		S = rs();
		T = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 25772