akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);

    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int res = a[0] + k - a[n - 1];
    for (int i = 0; i < n - 1; i++) {
        res = max(res, a[i + 1] - a[i]);
    }
    cout << k - res << endl;
    return 0;
}

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

int main() {
  int A, B ,C ,D ;
  cin >> A >> B >> C >> D ;
  if ( A+B > C+D) {
    cout << "Left" << endl;
  }else if (A+B == C+D){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;



int main(){
    ll n;
    ll res=0;
    cin >> n;
    ll a[n];
    ll totala=0;
    for(ll i=0;i<n;i++){
        cin >> a[i];
        totala+=a[i];
    }
    ll b[n];
    ll c[n];
    ll totalb=0;
    ll count=0;
    for(ll i=0;i<n;i++){
        cin >> b[i];
        totalb+=b[i];
        c[i]=a[i]-b[i];
        if(a[i]-b[i]<0){
            res++;
            count+=abs(a[i]-b[i]);
        }
    }
    if(totala<totalb){
        cout << -1 << endl;
        return 0;
    }
    sort(c,c+n);
    ll memo=n-1;
    while(1){
        if(count<=0) break;
        count-=c[memo];
        res++;
        memo--;
    }
    cout << res << endl;
    return 0;
}  


Measured memory_bytes: 5920
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = sz(s);
    vector<vector<mint>> dp(n+1, vector<mint>(13));
    dp[0][0] = 1;
    rep(i, n) {
        rep(j, 13) {
            if (isdigit(s[i])) {
                int x = s[i] - '0';
                dp[i+1][(10*j + x) % 13] += dp[i][j];
            } else {
                rep(k, 10) {
                    dp[i+1][(10*j + k) % 13] += dp[i][j];
                }
            }
        }
    }
    cout << dp[n][5] << endl;
}

Measured memory_bytes: 13648
class dice:
    def __init__(self,label):
        self.top, self.front, self.right, self.left, self.rear, self.bottom \
                = label

    def roll(self,op):
        if   op=='N': self.top, self.front, self.bottom, self.rear = \
                                self.front, self.bottom, self.rear , self.top
        elif op=='E': self.top, self.left , self.bottom, self.right = \
                                self.left , self.bottom, self.right, self.top
        elif op=='W': self.top, self.right, self.bottom, self.left = \
                                self.right, self.bottom, self.left , self.top
        elif op=='S': self.top, self.rear , self.bottom, self.front = \
                                self.rear , self.bottom, self.front, self.top

    def print_top(self): print(self.top)
    def print_right(self): print(self.right)

    def get_label(self):
        return [self.top, self.front, self.right, self.left, self.rear, self.bottom]
 
d0 = dice(list(map(int,input().split())))
d1 = list(map(int,input().split()))
for op in 'EEESSSWWWNNNWWWSSWWSESWS':
    if d0.get_label() == d1:
        print('Yes')
        break
    d0.roll(op)
else:
    print('No')

Measured memory_bytes: 7788
#include<bits/stdc++.h>
using namespace std;
vector<int> g[100010];
int vis[100010];
void dfs(int node,int dp[]){
    vis[node] = 1;
    for(int child:g[node]){
        if(!vis[child])
            dfs(child,dp);
        dp[node] = max(dp[node],1 + dp[child]);
    }
}
int main(){
    int n,m,a,b;
    cin>>n>>m;

    while(m--){
        cin>>a>>b;
        g[a].push_back(b);
    }
    int dp[n+1]={0};
    for(int i=1;i<=n;i++)
        if(!vis[i])
            dfs(i,dp);

    int ans = 0;
    for(int i=1;i<=n;i++)
        ans = max(ans,dp[i]);
    cout<<ans;
}


Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<vector<double>> vvd;
typedef vector<double> vd;

#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x_, i_, j_) cerr << #x_ << "------------" << "\n";cerr << "from " << i_ << " to " << j_ << "\n";for(ll k_=i_; k_<=j_; k_++) cerr << x_[k_] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

const ll MOD = 1e9 + 7;
const int INF = 2e9;
const int MAX_LOG = 21;
const int MAX_N = 1000*1001;

#define forn(i, n) for(int i = 0; i < n; i++)
#define forsn(i, s, n) for(int i = s; i < n; i++)
#define all(x) x.begin(), x.end()


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n, d, a;
	cin >> n >> d >> a;
	vpll power(n);
	forn(i, n) cin >> power[i].first >> power[i].second;
	sort(all(power));
	deque<pll> events; //{end_x, curse}
	ll curr_curse = 0;
	ll ans = 0;
	forn(i, n){
		ll x = power[i].first;
		while(!events.empty()){
			pi temp = events.front();
			ll curse_x = temp.first, curse_h = temp.second;
			if(curse_x >= x){
				break;
			}
			else{
				curr_curse -= curse_h;
				events.pop_front();
			}
		}
		if(curr_curse >= power[i].second){
			power[i].second = 0;
		}
		else{
			power[i].second -= curr_curse;
			ll req = (power[i].second + a - 1) / a * a;
			ans += req;
			curr_curse += req;
			events.push_back({x + 2 * d, req});
		}
		// trace1(i);
		// cerr << "events: " << endl;
		// for(auto it = events.begin(); it != events.end(); it++){
		// 	cerr << it->first << " " << it->second << endl;
		// }
	}
	cout << ans / a << endl;
}		


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  if(n==0)
    cout<<0;
  else if(n==1)
    cout<<abs(a[1]-a[0]);
  else{
  int b[n];
  b[0]=0;
  b[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++)
  b[i]=min(b[i-2]+abs(a[i]-a[i-2]),b[i-1]+abs(a[i]-a[i-1]));
  cout<<b[n-1];
  }
  return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

vl p;
int N;

void my_reverse(vl &p,int i,int j){
    while(i<j){
        swap(p[i],p[j]);
        i++;j--;
    }
}

ll LIS(vl a){
    vl dp(N,INF);
    rep(i,N){
        rep(j,N){
            if(dp[j]>a[i]){
                dp[j]=a[i];
                break;
            }
        }
    }
    int i=0;
    while(i!=N&&dp[i]!=INF){
        i++;
    }
    return i;
}

ll LDL(vl a){
    vl dp(N,0);
    per(i,N-1){
        rep(j,N){
            if(dp[j]<a[i]){
                dp[j]=a[i];
                break;
            }
        }
    }
    int i=0;
    while(i!=N&&dp[i]!=0){
        i++;
    }
    return i;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  	ll A,B;
    cin >> N >> A >> B;
    if(A+B-1>N||A*B<N){
        cout << -1 << '\n';
    }
    else{
        ll now_B=(N-1)/A+1;
        p.resize(N);
      	int b=0;
        rep(i,N){
            if(i<N%A){
                p[i]=N-N%A+i+1;
            }
            else{
                p[i]=N-(A-1)-((i-N%A)/A)*A+(i-N%A)%A+b-N%A;
            }
            //cout << p[i] << endl;
        }
        ll D=B-now_B;
      	//cout << D << endl;
        ll k=min(D,max((ll)0,N%A-1));
        my_reverse(p,0,k);
      	D-=k;
        for(int i=N%A;i<N-1;i+=A){
            if(D>=A-1&&i/A==(i+1)/A){
                my_reverse(p,i,i+A-1);
                D-=A-1;
            }
            else if(D>0){
                my_reverse(p,i,i+D);
                D=0;
            }
        }
        rep(i,N){
            cout << p[i] << ( i==N-1 ? '\n' : ' ' );
        }
    }
}

Measured memory_bytes: 5544
n=int(input())
s=[]
for i in range(n):
    s.append(int(input()))
total=sum(s)
s.sort()
if total%10!=0:
    print(total)
else:
    for i in s:
        if i%10!=0:
            total-=i
            if total%10!=0:
                break
    if total%10==0:
        print(0)
    else:
        print(total)

Measured memory_bytes: 3060
import fractions as math


def read_ints():
    return [int(c) for c in input().split()]


def solve(a, b, c, d):
    if a < b:
        return False
    if d < b:
        return False
    if c >= b:
        return True
    e = a % b
    delta = d % b
    if delta == 0:
        return e <= c
    g = math.gcd(b, delta)
    maxv = b - g
    return maxv <= c


def main():
    n = int(input())
    for _ in range(n):
        print("Yes" if solve(*read_ints()) else "No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 65388
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
	string s;
	cin >> s;
	for( int i = 0; i < s.length(); ++i )
	{
		if( i - 1 >= 0 )
		{
			if( s[ i ] == s[ i - 1 ] )
			{
				cout << i << " " << i + 1 << endl;
				return 0;
			}
		}

		if( i - 2 >= 0 )
		{
			if( s[ i ] == s[ i - 2 ] )
			{
				cout << i - 1 << " " << i + 1 << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1" << endl;
	return 0;
}


Measured memory_bytes: 512
N ,Y = map(int,input().split())
for k10 in range(N + 1):
    for k5 in range(N - k10 + 1):
        k1 = (Y - (k10 * 10000 + k5 * 5000)) / 1000
        if k1.is_integer() and k1 + k5 + k10 == N:
            print(k10, k5, int(k1))
            exit()
print("-1 -1 -1")


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toLong() }
    println(lcm(a,b))
}

fun lcm(a: Long, b: Long): Long {
    var a = a
    var b = b
    var c = a
    c *= b
    while (true) {
        val temp = a % b
        if (temp == 0L) {
            break
        }
        a = b
        b = temp
    }
    return (c / b)
}

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

const int N = 5e3 + 10;
const int mod = 1e9 + 7;

int qpow(int a, int b) {
	int ret = 1;
	while (b) {
		if (b & 1) ret = 1ll * ret * a % mod;
		a = 1ll * a * a % mod, b >>= 1;
	}
	return ret;
}

int n, fac[N], ifac[N], f[N], nf[N], siz[N], g[N], mn = 1e9;
vector<int> E[N];

void dfs(int u, int fa) {
	siz[u] = 1;
	for (auto v : E[u])
		if (v ^ fa) {
			dfs(v, u), siz[u] += siz[v];
			g[u] = max(g[u], siz[v]);
		}
	g[u] = max(g[u], n - siz[u]);
	mn = min(mn, g[u]);
}

int main() {
	cin >> n;
	for (int i = 1, u, v; i < n; i++) cin >> u >> v, E[u].push_back(v), E[v].push_back(u);
	fac[0] = 1; for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
	ifac[n] = qpow(fac[n], mod - 2);
	for (int i = n; i; i--) ifac[i - 1] = 1ll * ifac[i] * i % mod;
	dfs(1, 0);
	int x = 0, y = 0;
	for (int i = 1; i <= n; i++)
		if (g[i] == mn) (x ? y : x) = i;
	if (y) cout << 1ll * fac[n / 2] * fac[n / 2] % mod;
	else {
		f[0] = 1; int sum = 0, ans = 0;
		for (auto u : E[x]) {
			dfs(u, x); memset(nf, 0, sizeof(nf));
			for (int i = 0; i <= sum; i++)
				for (int j = 0; j <= siz[u]; j++)
					nf[i + j] = (nf[i + j] + 1ll * f[i] * fac[siz[u]] % mod * fac[siz[u]] % mod * ifac[j] % mod * ifac[siz[u] - j] % mod * ifac[siz[u] - j]) % mod;
			swap(f, nf); sum += siz[u];
		}
		for (int i = 0; i < n; i++) ans = (ans + 1ll * f[i] * ((i & 1) ? mod - 1 : 1) % mod * fac[n - i]) % mod;
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
#define MOD (int)1e9+7
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;

int main(){
    int N;cin>>N;
    vector<ll> A(N,0);
    REP(i,N) cin>>A[i];
    vector<ll> accum(N+1,0);//index iを含む和
    accum[0] = 0;
    FOR(i,0,N){
        accum[i+1] = accum[i] + A[i];
    }
    ll ans = INF;
    //PQRSに分割する
    //ある真ん中の切れ込み位置について，残り二つの切れ込みの位置は自動的に決まる
    //それぞれ切り込みの位置をもとめたあとN通りについて答えを計算する
    REP(i,N){
        //PとQについて
        // 1.P<Qとなる最も右の切れ目
        // 2.P>=Qとなる最も左の切れ目
        int low = 0,high = i;
        while(high - low>1){
            int mid = (low + high) /2 ;
            if(accum[mid] >= accum[i] -accum[mid]) high = mid;//midを左にすすめる
            else low = mid;
        }
        ll P = accum[low],Q = accum[i] - accum[low];//候補1
        ll P2 = accum[high],Q2 = accum[i] - accum[high];//候補2
        ll left_min = min(P,Q),left_max = max(P,Q);
        if(abs(P2-Q2)<abs(P-Q)){
            left_min = min(P2,Q2);
            left_max = max(P2,Q2);
        }
        //R<Sとなる最大の切れ目
        low = i,high = N;
        while(high - low>1){
            int mid = (low+high)/2;
            if(accum[mid]-accum[i]>=accum[N]-accum[mid]) high = mid;
            else low = mid;
        }
        ll R = accum[low] - accum[i],S =accum[N] - accum[low];
        ll R2 = accum[high] - accum[i],S2 = accum[N] - accum[high];
        ll right_min = min(R,S),right_max = max(R,S);
        if(abs(R2-S2)<abs(R-S)){
            right_min =min(R2,S2);
            right_max = max(R2,S2);
        }
        ll tmp = max(left_max,right_max) - min(left_min,right_min);
        ans = min(ans,tmp);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
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; }

int n;
string s, t;

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

    string ans = "";
    rep(i, n) {
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from bisect import bisect_right
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0]*N
b=[0]*M
a[0]=A[0]
b[0]=B[0]
for i in range(N-1):
    a[i+1]=a[i]+A[i+1]
for i in range(M-1):
    b[i+1]=b[i]+B[i+1]
book=bisect_right(b,K)
for i in range(N):
    if a[i]>K:
        break
    j=bisect_right(b,K-a[i])
    book=max(book,(i+1)+j)
print(book)

Measured memory_bytes: 47556
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    998244353;


int main()
{  fast
ll ans=0;
ll k;
cin>>k;
for(ll i=1;i<=k;i++)
{
	for(ll j=1;j<=k;j++)
	{
		ll x=__gcd(i,j);
		for(ll y=1;y<=k;y++)
		ans+=__gcd(x,y);
	}
}
cout<<ans;


}


Measured memory_bytes: 3616
#include<cstdio>
int main(){
  int n;
  long long x;
  scanf("%d %lld", &n, &x);
  
  long long a[100000];
  for(int i=0; i<n; i++)
    scanf("%lld", &a[i]);
  
  long long ans = 0;
  for (int i=1; i<n; i++) {
      long long sum = a[i-1] + a[i];
      if (sum > x) {
         long long diff = sum - x;
         ans += diff;
         if (diff > a[i])  {
            a[i] = 0;
         } else {
            a[i] -= diff;
         }
      }
   }

  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

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

		int H = cin.nextInt();
		int W = cin.nextInt();
		String tmp = "";
		char graph[][] = new char[H+2][W+2];

		for(int i=0;i<H+2;i++){
			if(i!=0&&i!=H+1){
				tmp = cin.next();
			}
			for(int j=0;j<W+2;j++){
				if(i!=0&&i!=H+1){
					if(j!=0&&j!=W+1){
						graph[i][j] = tmp.charAt(j-1);
					}else{
						graph[i][j] = '#';
					}
				}else{
					graph[i][j] = '#';
				}
			}
		}

		for(int k=0;k<H+2;k++){
			for(int l=0;l<W+2;l++){
				System.out.print(graph[k][l]);
			}
			System.out.println("");
		}
	}
}


Measured memory_bytes: 24868
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	ll ar[n+1][2];
	for(i=1;i<=n;i++){
		cin>>ar[i][0]>>ar[i][1];
	}
	
	for(i=1;i<=n-2;i++){
		int flg=1;
		for(j=i;j<=i+2;j++){
			if(ar[j][0]!=ar[j][1]){
				flg=0; break;
			}
		}
		if(flg) break;
	}
	if(i<=n-2) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
bool check(string &str)
{
    ll l = str.size();
    ll i,j;
    for(i = 0; i<l; i++)
    {
        if(str[i] != str[l-i-1])
        {
            return false;
            break;
        }
    }
    return true;
}
int main()
{
    string str;
    getline(cin,str);
    ll l = str.size();
    ll i,j;
    ll n = (l - 1)/2;
    ll k = (l+3)/2;
    string a = "",b="";
    for(i = 0; i<n; i++)
        a+= str[i];
    for(i = k-1; i<l; i++)
        b+= str[i];
    if(l % 2 != 0)
    {
        if(check(str) && check(a) == true && check(b) == true)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    else
        cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 256
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))
VUS = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]

# import random
#
# N, M = 100, 300
#
# VUS = []
# ns = [random.randint(100, 1000) for _ in range(N)]
# for v, u in generate_undirected_graph(N, M):
#     VUS.append((v, u, ns[v] + ns[u] + 2))

# plot_graph(VUS)

# 解説
graph = [[] for _ in range(N)]
for v, u, s in VUS:
    v -= 1
    u -= 1
    graph[v].append((u, s))
    graph[u].append((v, s))


def test():
    mi = 1
    ma = INF
    for _, w in graph[0]:
        ma = min(ma, w - 1)

    ret = 0
    for s in range(mi, ma + 1):
        ns = [None] * N
        ns[0] = s
        stack = [(0, None)]
        ok = True
        while stack:
            v, p = stack.pop()
            for u, w in graph[v]:
                if u == p:
                    continue
                if ns[u] == w - ns[v]:
                    continue
                if ns[u] is not None:
                    ok = False
                    break
                if w - ns[v] <= 0:
                    ok = False
                    break
                ns[u] = w - ns[v]
                stack.append((u, v))
        ret += ok
    print(ret)


def solve():
    odd_diffs = [None] * N
    even_diffs = [None] * N

    s = 0
    even_diffs[0] = s
    stack = [(0, s, None, True)]
    while stack:
        v, d, p, v_even = stack.pop()
        next_diffs = (odd_diffs, even_diffs)[not v_even]
        for u, w in graph[v]:
            if u == p:
                continue
            next_d = w - d
            if next_diffs[u] == next_d:
                continue
            elif next_diffs[u] is None:
                next_diffs[u] = next_d
                stack.append((u, next_d, v, not v_even))
            else:
                # 矛盾
                return 0

    # 頂点0をsとして、sの最大値最小値を求める
    ma = IINF
    mi = 1
    for v in range(N):
        # 隣接する辺の重さの最小値
        w = INF
        for _, dw in graph[v]:
            w = min(w, dw)
        od = odd_diffs[v]
        ed = even_diffs[v]
        if od is not None and ed is not None:
            # 条件が2つある
            # od - s == ed + s
            # s == (od - ed) // 2
            if (od - ed) % 2 != 0:
                return 0
            ma = min(ma, (od - ed) // 2)
            mi = max(mi, (od - ed) // 2)
        if od is not None:
            # vまでの距離が奇数のとき
            # 0 < d - s < w
            # d - w < s < d
            ma = min(ma, od - 1)
            mi = max(mi, od - w + 1)
        if ed is not None:
            # vまでの距離が偶数のとき
            # 0 < d + s < w
            # -d < s < w - d
            ma = min(ma, w - ed - 1)
            mi = max(mi, -ed + 1)
    return max(0, ma - mi + 1)


ans = solve()
print(ans)

# test()
# print(VUS)


Measured memory_bytes: 71124
#include<stdio.h>
long long f[10000007];
int main(){
	long long n;
	long long ans=0;
	scanf("%lld",&n);
	for(long long i=1ll;i<=n;i++)
	for(long long j=1ll;i*j<=n;j++) ++f[i*j];
	for(long long i=1ll;i<=n;i++) ans+=i*f[i];
	printf("%lld",ans);
	return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N,K;
    string S;
    cin >> N >>K;
    vector<int> vec(N);
    REP(i, N)
    cin >> vec.at(i);

    vector<int>
        cost(K);
    vector<int> total_cost(N);

    total_cost.at(0) = 0;
    total_cost.at(1) = abs(vec.at(1) - vec.at(0));

    REP(i, N)
    {
        REPS(j,min(K,i)){
            //cout << "test" << endl;
            int tmp = total_cost.at(i - j) + abs(vec.at(i) - vec.at(i - j));
            //cout << tmp << endl;
            cost.push_back(tmp);
        }
        sort(cost.begin(), cost.end());

        total_cost.at(i) = cost.at(0);

        while(cost.size()>0){
            cost.pop_back();
        }
    }
    cout << total_cost.at(N-1) << endl;
}


Measured memory_bytes: 1024
from collections import defaultdict
from queue import Queue

n, m = list(map(int, input().split()))
MX = int(1e6)
edge = defaultdict(set)
dist = [[MX, MX, MX] for i in range(n)]
reached = [[False, False, False] for i in range(n)]

for loop in range(m):
    a, b = list(map(int, input().split()))
    edge[a-1].add(b-1)

s, t = list(map(int, input().split()))
s = s-1
t = t-1
dist[s][0] = 0

q = Queue()
q.put((s, 0))
while not q.empty():
    node, step = q.get()
    next_step = (step + 1) % 3
    for next_node in edge[node]:
        if reached[next_node][next_step]: continue
        q.put((next_node, next_step))
        reached[next_node][next_step] = True
        if step == 2:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step] + 1)
        else:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step])

if dist[t][0] == MX:
    print(-1)
else:
    print(dist[t][0])



Measured memory_bytes: 111340
#include <iostream>

int main (void) {
	int A, B;
	std::cin >> A >> B;
	int sum = 0;
	
	if (A > B) {
		sum += A--;
	} else {
		sum += B--;
	}
	
	if (A > B) {
		sum += A--;
	} else {
		sum += B--;
	}
	std::cout << sum << std::endl;
	
	return 0;
}

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

#define ll long long

ll read(){
    char c= getchar(); ll f = 1, ret = 0;
    for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
    for(; isdigit(c); c = getchar()) ret = ret*10 + c - '0';
    return ret*f;
}
void write(ll x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) write(x / 10);
    putchar(x%10 + '0');
}
#define nl puts("")
#define bs putchar(' ')
const int maxn = 1e6+5;
ll a[maxn], sum[maxn];
signed main(){
    int n = read();
    for(int i = 1; i <= n; i++) {
        a[i] = read();
        sum[i] = sum[i-1] + a[i];
    }
    ll tot = sum[n];
    ll ans = 1e16;
    for(int i = 1; i < n; i++){
        ans = min(ans, abs(tot - sum[i]*2));
    }
    write(ans), nl;
    return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <ctype.h>
using namespace std;
int main(void){
    
    
    char a;
    cin >> a;
    
    bool oomoji = isupper(a);
    
    if(oomoji){
        cout << "A" << endl;
    }
    else{
        cout << "a" << endl;
    }
    
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
ll x,y;
int main(){	
	cin >> x >> y;
	if(y-x < 2200){
		ll ans = 2019;
		for(ll i=x;i<=y;i++) for(ll j=i+1;j<=y;j++){
			ans = min(ans,(i%2019)*(j%2019)%2019);
		}
		cout << ans << endl;
	}
	else{
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;

int main()
{
  string S; cin >> S;
  if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}

Measured memory_bytes: 764
#include <bits/stdc++.h> 
 using namespace std; 
  int main() { 
       int N, X; 
       cin >> N >> X; 
        vector<int> D(N + 1); 
        D[0] = 0; 
        for (int i = 0; i < N; ++i) { 
             int x; cin >> x; 
              D[i + 1] = D[i] + x; 
              }  int ans = 0; 
               for (int i = 0; i <= N; ++i) { 
                    if (D[i] <= X) { 
                         ans++; 
                         } 
                          } 
                           cout << ans << endl; 
                            return 0; 
                             }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int par[100010], ran[100010], cnt[100010];
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		ran[i] = 0;
		cnt[i] = 1;
	}
}
int find(int x) {
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (ran[x] < ran[y]) {
		par[x] = y;
		cnt[y] += cnt[x];
	}
	else {
		if (ran[x] == ran[y])ran[x]++;
		par[y] = x;
		cnt[x] += cnt[y];
	}
}
bool same(int x, int y) {
	x = find(x);
	y = find(y);
	return x == y;
}

int n, m, k, a[100000], b[100000], c[100000], d[100000];
vector<int> vec[100010], vec2[100010];

signed main() {
	cin >> n >> m >> k;
	init(n);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		vec[a[i]].push_back(b[i]);
		vec[b[i]].push_back(a[i]);
		unite(a[i], b[i]);
	}
	for (int i = 0; i < k; i++) {
		cin >> c[i] >> d[i];
		c[i]--;
		d[i]--;
		vec2[c[i]].push_back(d[i]);
		vec2[d[i]].push_back(c[i]);
	}
	for (int i = 0; i < n; i++) {
		int s = find(i);
		int ans = cnt[s] - 1;
		for (int j = 0; j < (int)vec[i].size(); j++) {
			if (same(i, vec[i][j]))ans--;
		}
		for (int j = 0; j < (int)vec2[i].size(); j++) {
			if (same(i, vec2[i][j]))ans--;
		}
		cout << ans << " ";
	}
	cout << endl;
}

Measured memory_bytes: 18420
#include<stdio.h>
#include<stdlib.h>


int find( int* a , int val , int n){
    int s = 1, t = n+1;
    while( t - s > 1){
	int mid = ( s + t )/2;
	if( a[ mid ] == val ) return 1;
	else if( a[ mid ] > val ){
	    t = mid;
	}else{
	    s = mid;
	}
    }
    if( a[s] == val ) return 1;
    return 0;
}

int main(){
    int a[ 100000 + 1 ];
    int n;
    scanf("%d",&n);
    *a = n;
    int i;
    for(i=1;i<=n;i++) scanf("%d",a+i);
    int q;
    scanf("%d",&q );
    for(i=0;i<q;i++){
	int k;
	scanf("%d",&k);
	if( find( a, k , n ) ) printf("1\n");
	else printf("0\n");
    }

    return 0;
}



Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
int main()
{
 
 
    int n,sum=0;
    cin>>n;
    int arr[n],brr[n],crr[n-1];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    for(int i=0;i<n;i++){
    cin>>brr[i];sum+=brr[i];}
    for(int i=0;i<n-1;i++)
    cin>>crr[i];
    for(int i=0;i<n-1;i++)
    {
        if(arr[i+1]-arr[i]==1)
        {
            sum+=(crr[arr[i]-1]);
        }
    }
    cout<<sum;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vi a(n), b(m);
  re(i, n) cin >> a[i];
  re(j, m) cin >> b[j];

  sort(all(a)); sort(all(b));
  bool war = false;
  if(a.back() >= y || b.front() <= x) war = true;
  else if(a.back() >= b.front()) war = true;

  if(war) cout << "War" << endl;
  else cout << "No War" << endl;

  return 0;
}


Measured memory_bytes: 256
//$g++ main.cpp - compile
//$./a.out - run
#include <iostream>
#include <string>
using namespace std;

int main(){
    int size = 100+1;
    long matrixA[size][size];
    long matrixB[size][size];
    long matrixC[size][size];
    for(int i = 0; i < size; i++){
        for(int j = 0; j < size; j++){
            matrixA[i][j] = 0;
            matrixB[i][j] = 0;
            matrixC[i][j] = 0;
        }
    }
    int n, m, l;
    cin >> n >> m >> l;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> matrixA[i][j];
        }
    }
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            cin >> matrixB[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            for(int k = 0; k < m; k++){
                matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
            }
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            if(j != 0) cout << " ";
            cout << matrixC[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 1400
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int n, i, j;
  int cards[4][13] = { {0} };
  char marks[4] = {'S', 'H', 'C', 'D'};
  char in_mark;
  int in_rank;

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf(" %c %d", &in_mark, &in_rank);
    switch (in_mark) {
      case 'S':
        cards[0][in_rank - 1] = 1;
        break;
      case 'H':
        cards[1][in_rank - 1] = 1;
        break;
      case 'C':
        cards[2][in_rank - 1] = 1;
        break;
      case 'D':
        cards[3][in_rank - 1] = 1;
        break;
    }
  }

  for(i = 0; i < 4; i++) {
    for (j = 0; j < 13; j++) {
      if (cards[i][j] == 0) printf("%c %d\n", marks[i], j + 1);
    }
  }

  return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#define ll long long
#define ull unsigned long long
#define ci const int&
#define cl const long long&
#define cul const unsigned long long&
#define io_f std::ios::sync_with_stdio(false)
using namespace std;

int a1,b1,a2,b2;

int main() {
    cin >> a1 >> b1 >> a2 >> b2;
    int l1 = a1 - a2;
    int l2 = b1 - b2;
    int a3 = a2 + l2, b3 = b2 - l1;
    cout << a3 << ' ' << b3 << ' ';
    cout << a3 + b2 - b3  << ' ' << b3 - a2 + a3;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    /*考察
    BCがAを右に受け流す
    右側のAからいけるとこまで右側に流す
    を繰り返すことで一意な操作で終点までいける。
    が、素直に右からAごとにシミュレートして実装するとO(N^2)
    stack使えないか？
    sを右からみる
    stackにBCをpushpush
    Aが来たら答えに今のstack.size/2を加える
    BCにならないようなのがきたらstackを空にする
    O(n)だろ
    あ、まてstack空にするのってO(1)でいいの？あ、え？やばい？
    stackである必要ないやん1変数でいいわ
     */
    string s;
    cin>>s;
    ll n=s.size();
    ll ind=n-1;
    ll ans=0;
    ll st=0;
    while(ind>=0){
        if(s[ind]=='C'&&s[ind-1]=='B'){
            st++;ind-=2;
        }
        else if(s[ind]=='A'){
            ans+=st;
            ind--;
        }
        else{
            st=0;ind--;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D&lang=jp*/

#include <iostream>
#include <stack>
#include <vector>

using namespace std;

struct area_data{
    int n;
    int area;
};

int main(){
    stack<int> down;
    stack<struct area_data> st;

    for(int n=0;cin.peek()!='\n';n++){
        char s;
        cin>>s;
        if(s=='\\'){
            down.push(n);
        }else if(s=='/' && !down.empty()){
            struct area_data tmp={down.top(),0};
            while (!st.empty() && tmp.n< st.top().n){
                tmp.area+= st.top().area;
                st.pop();
            }
            tmp.area += n - tmp.n;
            st.push(tmp);
            down.pop();
        }
    }
    int areas=0;
    vector<int> output;
    while(!st.empty()){
        output.insert(output.begin(), st.top().area);
        areas+=output[0];
        st.pop();
    }
    cout<< areas <<endl;
    cout<<output.size();
    for(int i:output){
        cout<<" "<<i;
    }
    cout<<endl;
    return 0;
}

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

int n, k;
int a[100000];

int main() {
    cin >> n >> k;
    rep(i,n) cin >> a[i];
    cout << (n-1+k-2)/(k-1) << endl;
}


Measured memory_bytes: 640
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <queue>
#include <limits>
#include <deque>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <map>
#include <iomanip>
#include <ios>
#include <iostream>
#include <vector>
#include <cwchar>
#include <cwctype>
#define mp make_pair
#define fs first
#define se second
#define memset(a,t) memset(a,t,sizeof(a))
#define all(v) v.begin(),v.end()
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define MN 0LL
#define Mx 200000005
#define Mn -Mx
#define MX 20000000000000005
using namespace std;
int readint(){
	char c;
	while(c=getchar(),(c<'0'||c>'9')&&c!='-');
	bool flag=(c=='-');
	if(flag)c=getchar();
	int x=0;
	while(c>='0'&&c<='9'){
		x=x*10+c-48;
		c=getchar();
	}
	return flag?-x:x;
}
inline string tos(int x){
	string s;
	while(x) s=(char)(x%10+'0')+s,x/=10;
	return s;
}
int a[100005],n,k;
inline int gcd(int x,int y){
	return (!y)?x:gcd(y,x%y);
}
set<int> s;
int main(){
	ios_base::sync_with_stdio(false);
	int i,j,mx=-1;
	bool bad=1;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>a[i];
		mx=max(mx,a[i]);
	}
	if(mx<k){
		cout<<"IMPOSSIBLE"<<endl;
		return 0;
	}
	int gd=a[0];
	for(i=1;i<n;i++) gd=gcd(gd,a[i]);
//	cout<<gd<<endl;
	if(k%gd==0) cout<<"POSSIBLE"<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
	return 0;
}



Measured memory_bytes: 640
/*
 * a.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 */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  double x0, y0, x1, y1;
  cin >> x0 >> y0 >> x1 >> y1;

  double dx = x1 - x0, dy = y1 - y0;
  printf("%.8lf\n", sqrt(dx * dx + dy * dy));
  return 0;
}

Measured memory_bytes: 1236
(function(stdin) {
  function mulMatrix(matrix, array) {
    return matrix.map(function(x) {
      return x.map(function(y, i) {
        return y * array[i];
      }).reduce(function(a, b) {
        return a + b;
      });
    }).join('\n');
  }
  var inputs = stdin.toString().trim().split('\n');
  var size = inputs.shift();
  size = size.split(' ').map(Number);
  var bigMatrix = inputs.splice(0, size[0]).map(function(v) {
    return v.split(' ').map(Number);
  });
  var smallMatrix = inputs.splice(0, size[1]).map(Number);
  console.log(mulMatrix(bigMatrix, smallMatrix));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 17404
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power(ll a, ll b, ll m)
{
	if (b == 0)
		return(1);
	ll sol = power(a, b / 2, m);
	sol = (sol * sol) % m;
	if (b % 2 == 1)
		sol = (sol * a) % m;
	return(sol);
}
ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	else
	{
		return gcd(b, a % b);
	}
}
void solve()
{
	ll l, r;
	cin >> l >> r;
	if (r - l + 1 >= 2019)
	{
		cout << "0";
		return;
	}
	ll ans = mod;
	for (ll i = l; i<=r; i++)
	{
		for (ll j = i+1; j<=r; j++)
		{
			ans = min(ans, (i * j) % 2019);
		}
	}
	cout << ans;
}
int main()
{
	int t = 1;
	//cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
D=int(input())
*c,=map(int,input().split())
s=[]
for i in range(D):
    *x,=map(int,input().split())
    s.append(x)

dt=[]
last=[-1]*26
v=0
for d in range(D):
    news=[s[d][i]+c[i]*(d-last[i])*(d-last[i]-1)//2 for i in range(26)]
    maxi=0
    tmp=-float('inf')
    for i in range(26):
        if tmp<news[i]:
            maxi=i
            tmp=news[i]
    last[maxi]=d
    v+=s[d][maxi]
    for i in range(26):
        v-=c[i]*(d-last[i])
    dt.append(maxi+1)

def score(T):
    last=[-1]*26
    v=0
    for d in range(D):
        v+=s[d][T[d]-1]
        last[T[d]-1]=d
        for i in range(26):
            v-=c[i]*(d-last[i])
    return v

v0=max(score(dt)+10**6,0)

for d in range(1,D,2):
    y=-1
    newdt=dt+[]
    for i in range(26):
        if dt[d]!=i+1:
            newdt[d]=i+1
            v1=max(score(newdt)+10**6,0)
            if v0<v1:
                y=i+1
                v0=v1
    if y!=-1:
        dt[d]=y

for i in dt:
    print(i)

Measured memory_bytes: 73892
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        biggest(a, b, c);
        
    }
    public static void biggest(int a, int b, int c){
        if(a < b && b < c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}



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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
	return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void printVec(vector<int> &vec)
{
	for (auto &e : vec)
	{
		cout << e << " ";
	}
	cout << endl;
}

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

	cout << t << s << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  lvector a(3,0);rep(i,3) cin>>a[i];
  sort(a.begin(),a.end());
  ll ans=a[2]*10+a[1]+a[0];
  print(ans);
  return 0;
}


Measured memory_bytes: 256