akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) std::cerr<< #x <<": "<<x<<"\n"
#define debug2(x,y) std::cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<"\n"
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}


int per(ll x, int y) {
  int ret = x % y;
  if (ret < 0) {
    ret += y;
  }
  return ret;
}

int n, l, t;

int main() {
  scanf("%d %d %d", &n, &l, &t);
  vi x(n), w(n);
  vi vel(n);
  ll vel_sum = 0;
  rep (i, n) {
    scanf("%d %d", &x[i], &w[i]);
    if (w[i] == 1) {
      vel[i] = 1;
    } else {
      vel[i] = -1;
    }
    vel_sum += vel[i];
  }
  vi pos(n);
  rep (i, n) {
    pos[i] = x[i] + t * vel[i];
    pos[i] = per(pos[i], l);
  }
  sort(all(pos));
  ll diff = 0;
  rep (i, n) {
    diff += pos[i] - x[i];
  }
  assert ((vel_sum * t - diff) % l == 0);
  ll adj = (vel_sum * t - diff) / l;
  adj = per(adj, n);
  rep (i, n) {
    printf("%d\n", pos[(i+adj) % n]);
  }

  return 0;
}


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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;



int func(int* x, int n){
	int ans = 0;
	rep(i, n){
		(ans += x[i] * (i + 1) * (n - i))%=mod;
	}
	return ans;
}

signed main(){

	int N, M;
	int x[123456], y[123456];
	cin >> N >> M;
	rep(i, N) cin >> x[i];
	rep(i, M) cin >> y[i];

	sort(x, x + N); sort(y, y + M);

	rep(i, N - 1) x[i] = x[i + 1] - x[i];
	rep(i, M - 1) y[i] = y[i + 1] - y[i];

	cout << func(x, N-1)*func(y, M-1) % mod << endl;


	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD1 1000000007
#define MOD2 998244353
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ll t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<ll,ll> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m,ll MOD){if(m==0)return 1;ll t=mpowe(n,m/2,MOD);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;if(n==0) return -1;return logtwo(n/2)+1;}
#define maxn 2000005
ll fact[maxn]={0};
ll ifact[maxn]={0};
void precompute(ll mod)
{
    fact[0]=1;
    ifact[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fact[i]=fact[i-1]*i;
        fact[i] = fact[i]%mod;
        ifact[i] = mpowe(fact[i],mod-2,mod);
    }
}
ll ncr(ll n,ll r,ll mod)
{
    if(r>n)
        return 0;
    ll ans = fact[n]*ifact[n-r];
    ans = ans%mod;
    ans = ans*ifact[r];
    ans = ans%mod;
    return ans;
}

int main()
{
    fastio();
    
    int t=1;
    precompute(MOD1);
    ll p[maxn]={0};
    p[0]=1;
    for(int i=1;i<maxn;i++)
        p[i] = (p[i-1]*25)%MOD1;
    while(t--)
    {
        ll k;
        cin>>k;
        string s;
        cin>>s;
        ll n = s.size();
        ll ans=mpowe(26,k+n,MOD1);
        for(ll i=0;i<n;i++)
        {
            ll d = ncr(n+k,i,MOD1);
           // cout<<n+k<<" "<<i<<" "<<d<<endl;
            d = d*p[n+k-i];
            d = d%MOD1;
            ans = ans-d;
            ans= (ans+MOD1)%MOD1;
           // cout<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    
}

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

int main() {
    int N; cin >> N;
    map<char, ll> m;
    for (int i = 0; i < N; i++)
    {
        string s; cin >> s;
        if(s[0]=='M' || s[0]=='A' || s[0]=='R' || s[0]=='C' || s[0]=='H') m[s[0]]++;
    }
    ll ans = 0;
    ans += m['M'] * m['A'] * m['R'];
    ans += m['M'] * m['A'] * m['C'];
    ans += m['M'] * m['A'] * m['H'];
    ans += m['M'] * m['R'] * m['C'];
    ans += m['M'] * m['R'] * m['H'];
    ans += m['M'] * m['C'] * m['H'];
    ans += m['A'] * m['R'] * m['C'];
    ans += m['A'] * m['R'] * m['H'];
    ans += m['A'] * m['C'] * m['H'];
    ans += m['R'] * m['C'] * m['H'];
    cout << ans << endl;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc095/tasks/arc096_b
# 写真参考


import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations, accumulate
from bisect import bisect_left, bisect_right  # , insort_left, insort_right


N, C = read_ints()
X, V = read_col(N)


def solve_max_a_plas_b(A: list, B: list):
    '''max_{i<j}(a_i + b_j)をO(n)で解く'''
    assert len(A) == len(B)
    A_accum = list(accumulate(A, func=max))
    B_accum = list(accumulate(reversed(B), func=max))[::-1]
    ret = 0
    for i in range(len(A_accum) - 1):
        ret = max(A_accum[i] + B_accum[i + 1], ret)
    return ret


def ret_candi(X, V):
    V_accum = list(accumulate(V))
    V_accum_r = list(accumulate(reversed(V)))[::-1]
    A, B = [], []
    katamiti_max = 0  # 必ず折れ曲がるとも限らないので
    for i in range(N):
        katamiti_max = max(katamiti_max, V_accum[i] - X[i])
        A.append(V_accum[i] - 2 * X[i])
        B.append((V_accum_r[i]) - (C - X[i]))
    # print(A, B)
    return A, B, katamiti_max


def solve(X, V):
    A, B, katamiti_max = ret_candi(X, V)
    return max(solve_max_a_plas_b(A, B), katamiti_max)


V_r = V[::-1]
X_r = []
for x in reversed(X):
    X_r.append(C - x)
print(max(solve(X, V), solve(X_r, V_r)))


Measured memory_bytes: 39588
/*{{{*/
#include<bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPR(I, N) for (int I = (N)-1; I >= 0; --I)
#define REPPR(I, A, B) for (int I = (A); I >= (B); --I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
#define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
void ADD(LL& x, LL v) {x = (x + v) % MOD; if (x < 0)x += MOD;}
/*}}}*/
void solve() {
	int n;
	R(n);
	VI v(n);
	REP(i, n) {
		R(v[i]);
	}
	int L = *min_element(ALL(v));
	int R = *max_element(ALL(v));
	int ans = INT_MAX;
	REPP(i, L, R + 1) {
		int cost = 0;
		REP(j, n) cost += (v[j] - i) * (v[j] - i);
		ans = min(ans, cost);
	}
	W(ans);
}

int main() {

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

#define MULTITEST 0
#if MULTITEST
	CASET {
		solve();
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll>A(100006);
    rep(i,N){
        ll a;
        cin>>a;
        a++;
        A[a]++;
        A[a-1]++;
        A[a+1]++;
    }
    ll mx=-INF;
    ll inx;
    rep(i,A.size()){
        if(A[i]>mx){
            mx=A[i];
            inx=i-1;
        }
    }
    cout << mx << endl;


    return 0;
    

}

Measured memory_bytes: 4028
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std; 
typedef long long ll; typedef string str;


int main ()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
	
	int x;
	cin >> x;
	
	//cout << fixed << setprecision(10);
	//cout << (double)360/(180-x);
	if(x == 120) cout << 3;
	else
	{
		//for(int test = 1; test <= 179; test++)
		//{
			for(int i = 1;  ; i++)
			{
				if((180*i)%(180-x)==0)
				{
					cout << (180*i)/(180-x)*2 << "\n";
					break;
				}
			}
		//}
	}
	
	//cout << "\n-----------TEST2------------\n\n";
	
	//for(int test = 1; test <= 179; test++)
	//{
		//for(int i = 1;  ; i++)
		//{
			//if((180*i)%(test)==0)
			//{
				//cout << test << " " << (180*i)/(180-test)*2 << "\n";
				//break;
			//}
		//}
	//}
	
}


Measured memory_bytes: 3192
import sys
input = sys.stdin.readline
A, B, C, X, Y = [int(x) for x in input().split()]
ans_notAB = A * X + B * Y
temp = min(X,Y)
ans_AB = 2 * temp * C
if X > Y:
    X -= Y
    ans_AB += min([X * A, 2 * X * C])
elif Y > X:
    Y -= X
    ans_AB += min([Y * B, 2 * Y * C])
print(min(ans_AB,ans_notAB))

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

int main(){
    int N;
    cin>>N;
    double vector[N];
    double sum=0,gravity=0;
    double ans=0;
    for(int i=0;i<N;i++)cin>>vector[i];
    for(int i=0;i<N;i++)sum+=vector[i];
    gravity = sum/N;
    if(gravity-floor(gravity)>0.5)gravity=floor(gravity)+1;
    else gravity=floor(gravity);
    for(int i=0;i<N;i++){
        ans=ans+(vector[i]-gravity)*(vector[i]-gravity);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int N, M;
vector<int> g[112345];
int d[112345];
int a[112345], b[112345];

int color[112345];

// 彩色
bool binary_color(int u, int c) {
	color[u] = c;
	
	REP(i, g[u].size()) {
		int v = g[u][i];
		
		if (c == 0) {
			if (color[v] != 0) binary_color(v, c);
		}
		else {
			if (color[v] == -c) continue;
			
			if (color[v] == c) return false;
			if (!binary_color(v, -c)) return false;
		}
	}
	return true;
}

bool solve(int v) {
	fill(color, color + N, 0);
	return binary_color(v, 1);
}

int main() {
	cin >> N >> M;
	
	REP(i, M) {
		scanf("%d %d", a + i, b + i);
		a[i]--; b[i]--;
		g[a[i]].push_back(b[i]);
		g[b[i]].push_back(a[i]);
		
	}
	
	ll ans = 0;
	
	if (!solve(0)) {
		ans = (ll)N * (N - 1) / 2 - M;
	}
	else if (N <= 3) {
		ans = 0;
	}
	else {
		ll ecnt = 0;
		REP(i, N) if (color[i] == -1) ecnt++;
		REP(i, N) {
			if (color[i] == -1) continue;
			ans += ecnt - g[i].size();
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

N, M = map(int, input().split())
A = list(map(int, input().split()))

total = sum(A)
count = 0

for a in A:
  if a >= total / (4*M):
    count += 1
if count >= M:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 61896
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, 0, n) cin >> v[i];
    sort(v.begin(), v.end());
    double ans = v[0];
    rep(i, 1, n){
        ans = (ans + v[i]) / 2.0;
    }
    printf("%.10f\n", ans);
}

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

typedef long double ll;

int main(){
    ll M, rD, rR, cD, cR;
    cin >> M >> rD >> rR >> cD >> cR;
    
    ll j1, j2;
    
    j1 = ceil( (100*cD) / rD);
    j2 = ceil( (100*cR) / rR);
    
    long long ans = M-j1-j2;
    if(j1 + j2 > M) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1228
#include<map>
#include<list>
#include<queue>
#include<iostream>
#include<unordered_set>
#include<set>
#include<vector>
#include<cmath>
#include<algorithm>

#define ull unsigned long long
#define ll long long
#define mp make_pair
#define imei(...)   "[ "<< #__VA_ARGS__ <<" = "<< __VA_ARGS__ <<" ] "

using namespace std;

vector<int> price;

void solve(int k) {
    int sum = 0;
    sort(price.begin(), price.end());

    for (int i = 0; i< k; i++)
        sum += price[i];

    cout << sum <<endl;
}
int main(int argc, char *argv[])
{
    int n, k;
    cin >>n >> k;
    for (int i = 0; i < n; i++) {
        int p;
        cin >>p;
        price.push_back(p);
    }

    solve(k);

    return 0;
}


Measured memory_bytes: 3640
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9 + 7

cnt = [0]*60
for i in range(n):
    for j in range(60):
        if (a[i] >> j) & 1:
            cnt[j] += 1

ans = 0
for j in range(60):
    ans += cnt[j] * (n - cnt[j]) * (2**j)
    ans %= MOD
print(ans)

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

int main(){
    long long n, k;
    cin >> n >> k;

    long long ans = 1;
    for(long long i = 0; i < n; i++){
        if(ans <= k) ans *= 2;
        else ans += k;
    }
    cout << ans << endl;
    return 0;
}

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


int gcd(int x, int y) {
    if(x < y) swap(x, y);

    while (y > 0) {
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}

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

  vector<int> a(n,0);
  vector<int> c(1000005,0);
  rep(i,n) {
    cin >> a[i];
    c[a[i]]++;
  }

  bool par = true;
  for(int i = 2; i <= 1000000; i++){
    int cnt = 0;
    for(int j = i; j <= 1000000; j += i){
      cnt += c[j];
    }
    if(cnt > 1) par = 0;
  }
  if(par){
       cout << "pairwise coprime" << endl;
       return 0;
    }

  int g = 0;
  rep(i,n) g = gcd(g,a[i]);
  if(g == 1){
    cout << "setwise coprime" << endl;
    return 0;
  }
 
  cout << "not coprime" << endl;
  
 }


Measured memory_bytes: 11088
#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define REP(i, k, n) for (signed long long int i = (signed long long int)(k); i < (signed long long int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (signed long long int i = (signed long long int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) std::sort(all(x))
#define REV(x) std::reverse(all(x))
#define UNIQUE(x) x.erase(std::unique(all(x)), x.end());
#define MAX(x) *std::max_element(all(x))
#define MIN(x) *std::min_element(all(x))
#define LOWitr(x, n) std::lower_bound(all(x), n)
#define UPRitr(x, n) std::upper_bound(all(x), n)
#define cii(x) int x; std::cin >> x
#define cill(x) signed long long int x; std::cin >> x
#define cis(x) std::string x; std::cin >> x
#define co(x) std::cout << x << "\n"
#define pb push_back
#define mp std::make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) if(DEBUG) std::cout<<#x<<" : "<<(x)<<"\n"
template<class T>using V = std::vector<T>;
template<class T>using VV = std::vector<std::vector<T>>;
template<class T>using Q = std::queue<T>;
template<class T>using PQ = std::priority_queue<T>;
template<class T,class U>using P = std::pair<T, U>;
template<class T,class U>using M = std::map<T, U>;
template<class T,class U>using UM = std::unordered_map<T, U>;
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T>inline void vcin(T &v){for(auto&& i : v) std::cin >> i;}
template<class T>inline void dumpv(const T& v, std::ostream& os = std::cout){
    if(DEBUG){
        os<<"{";
        std::for_each(all(v),[&os](typename T::value_type p){os<<p<<',';});
        os<<"}\n";
    }
}
using std::cin;
using std::cout;
using std::string;
using std::min;
using std::max;
using std::abs;
using std::next_permutation;
using LL = signed long long int;
using VL = V<LL>;
using VVL = V<VL>;
const int INF = INT_MAX, MOD = 1e9 + 7;
const LL LLINF = LLONG_MAX;
const double PI = M_PI;

void Main(){
    cill(n);
    cill(k);
    VL v(n);
    vcin(v);
    rep(i, min(k, (LL)45)){
        VL nt(n+1);
        rep(j, n){
            LL l = max((LL)0, j-v[j]);
            LL r = min((LL)n-1, j+v[j]);
            nt[l]++;
            nt[r+1]--;
        }
        rep1(j, n){
            nt[j]+=nt[j-1];
        }
        v = nt;
    }
    rep(i, n-1){
        cout << v[i] << " ";
    }
    cout << v[n-1] << std::endl;
}

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

Measured memory_bytes: 7916
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <math.h>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int N = 1e5 + 10;
const int mod = 998244353;
const double eps = 1e-8;

LL n, k;
LL len[55], p[55];

LL f(LL ce, LL k) {
    // B + f(ce - 1) + P + f(ce - 1) + B
    if(k == 1) {
        if(ce == 0) return 1;
        else return 0;
    }
    LL ans = 0;
    if(k >= len[ce - 1] + 1) {
        ans = p[ce - 1];
        k -= len[ce - 1] + 1;
        if(k > 0) {
            k --; ans ++;
        }
        if(k >= len[ce - 1]) {
            ans += p[ce - 1];
        } else if (k > 0){
            ans += f(ce - 1, k);
        }
    } else if (k > 1) {
        ans = f(ce - 1, k - 1);
    }
    return ans;
}

int main()
{
    len[0] = p[0] = 1;
    for(int i=1;i<=50;i++) {
        len[i] = len[i - 1] * 2 + 3;
        p[i] = p[i-1] * 2 + 1;
    }
    cin>>n>>k;
    printf("%lld", f(n, k));
    return 0;
}

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

const int maxN = 1e5 + 10;
vector<int>a(maxN, 0);


int main(){
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    map<string, int>mp;
    map<string, int>::iterator it;
    string x;
    mp.insert({"AC", 0});
    mp.insert({"TLE", 0});
    mp.insert({"WA", 0});
    mp.insert({"RE", 0});
    for(int i = 0; i < n; i++){
        cin >> x;
        mp[x]++;
    }
    cout << "AC x " << mp.at("AC") << endl;
    cout << "WA x " << mp.at("WA") << endl;
    cout << "TLE x " << mp.at("TLE") << endl;
    cout << "RE x " << mp.at("RE") << endl;    
}

Measured memory_bytes: 3752
/*
memo for solution
*/
#include <cstdlib> 
#include <numeric>
#include <cstring>
#include <cstdio> 
#include <cfloat> 
#include <map> 
#include <cassert>
#include <cmath> 
#include <climits> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <iomanip>
#include<sys/time.h>
using namespace std; 
double e_time(void){static struct timeval now;gettimeofday(&now, NULL);return (double)(now.tv_sec  + now.tv_usec/1000000.0);}
#define REP(i,b,n) for(int i=b;i<n;i++) 
#define rep(i,n)      REP(i,0,n) 
#define pb push_back  
#define mp make_pair 
#define ALL(C)   (C).begin(),(C).end() 
#define fe(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr != (c).end();itr++)
#define BITSHIFT(X)     ( (1<<(X)) )
#define CONTAIN(S,X) ( ((S)&BITSHIFT(X)) != 0)
typedef complex<double>P; 
typedef long long ll; 
typedef unsigned long long ull; 
typedef pair<int,int> pii; 
typedef vector<int> vint;
template<class T> void vp(T &a,int p){rep(i,p)cout << a[i]<<" ";cout << endl;}  
template<class T> T ceilUp(const T& a,const T& b){return (a+b-1)/b;}
const ll mod =   1000000009;
inline ll modadd(ll a,ll b){a %= mod;b %= mod;return (a+b)%mod;}
inline ll modsub(ll a,ll b){a %= mod;b %= mod;a-=b;a%=mod;if (a<0)a+=mod;return a;}
inline ll modmul(ll a,ll b){a %= mod;b %= mod;return (a*b)%mod;}
inline ll modeq(ll a,ll b,ll m){a = (a%m+m)%m; b = (b%m+m)%m;return a == b;}
//ll modpow(ll n,ll p){if (p == 0)return 1;if (p == 1)return n;ll ret=mypow(n,p/2);ret=ret*ret%mod;if (p&1)ret=ret*n%mod;return ret;}
//ll getinv(ll a){return mypow(a,mod-2);}
ll mypow(ll n,ll p){
  if (p == 0)return 1;
  if (p == 1)return n;
  ll ret=mypow(n,p/2);
  ret=ret*ret;
  if (p&1)ret=ret*n;
  return ret;
}
 
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c)cout << "Yes" <<endl;
  else cout <<"No" <<  endl;
  return 0;
}
 
 


Measured memory_bytes: 256
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

ll gethash(ll l, ll r, ll po[], ll hsh[]){
    //cout<<hsh[l+1]<<" "<<hsh[]
    return (hsh[r+1]-((hsh[l]*po[r-l+1])%md) +md)%md;
}

int main()
{
    fastt;

    ll n, m, k, i, j, x, y, p=31, h, f=0;
    string s;
    cin>>s;
    k=s.size();
    ll po[k+1], hsh[k+1];
    po[0]=1;
    for(i=1; i<=k; i++){
        po[i]=(po[i-1]*p)%md;
    }
    hsh[0]=0;
    for(i=0; i<k; i++){
        hsh[i+1]=(hsh[i]*p+s[i]-'0'+1)%md;
    }
    for(i=k-3; i>=1; i-=2){
        if(gethash(0, i/2, po, hsh)==gethash(i/2+1, i, po, hsh)){
            cout<<i+1<<endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3628
from itertools import groupby
S=input()
n=len(S)
L=[0]*n
i=0
for k,v in groupby(S):
	c=len(list(v))
	i+=c
	if k=='R':
		L[i-1]=L[i]=c//2
		if c%2==1:
			L[i-1]+=1
	else:
		L[i-c-1]+=c//2
		L[i-c]+=c//2
		if c%2==1:
			L[i-c]+=1
print(*L)

Measured memory_bytes: 6424
H, W, K = map(int, input().split())
S = []
for _ in range(H):
  S.append(input())
hsummation = [[int(S[0][k])]for k in range(W)]
for k in range(W):
  for j in range(1, H):
    hsummation[k].append(hsummation[k][j-1] + int(S[j][k]))

ans = float('inf')
anskouho = 0
h = -1
binhh = []
for j in range(2**(H-1)):
  h += 1
  binh = "0"*(H-len(str(bin(h)))+1)+str(bin(h))[2:]
  c = 0
  for k in range(len(binh)):
    if binh[k] == '1':
      c += 1
  binhh.append([binh, c])
binhh.sort(key = lambda x:x[1] , reverse= True)
#print(binhh)
#h = 2**(H-1)
for j in range(2**(H-1)):
  #h -= 1
  #binh = "0"*(H-len(str(bin(h)))+1)+str(bin(h))[2:]
  hlist=[]
  for k in range(H-1):
    if binhh[j][0][k] == '1':
      hlist.append(k)
  hlist.append(-1)
  anskouho = len(hlist)-1
  now = 0
  while now < W:
    counter = [0 for _ in range(len(hlist))]
    while now < W:
      for l in range(len(hlist)):
        if l == 0:
          counter[l] += hsummation[now][int(hlist[l])]
          continue
        else:
          counter[l] += - hsummation[now][hlist[l-1]] + hsummation[now][hlist[l]]
      if max(counter) > K:
        anskouho += 1
        break
      else:
        now += 1
    if anskouho > ans:
      break
  else:
    ans = min(ans, anskouho)
print(ans)

Measured memory_bytes: 74776
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

using namespace std;

int Count(int n) {
	int c = 2;
	for (int i = 3; i < n; i += 2) {
		if (n%i == 0)c++;
	}
	return c;
}

int main() {
	string S;
	long long N;
	cin >> S >> N;
	int EndOne;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] != '1') {
			EndOne = i;
			break;
		}
	}
	if (N <= EndOne) {
		cout << 1 << endl;
	} else {
		cout << S[EndOne] << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define max_len 100010
#define Min(a, b) a < b ? a : b
void initArray(char a[], int len);
int main(void)
{
    char s[max_len];
    initArray(s, max_len);
    fgets(s, max_len, stdin);
    int len = strlen(s) - 1;
    int sum = 0;
    for (int i = 0; i < len; i++)
    {
        sum += s[i] - '0';
    }
    int min = Min(sum, len - sum);
    printf("%d\n", min * 2);
    return 0;
}

void initArray(char a[], int len)
{
    for (int i = 0; i < len; i++)
    {
        a[i] = 0;
    }
}

Measured memory_bytes: 256
/*
ID:liuhund2
LANG:C++
TASK:a
*/
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int n,m;
char a[105][105];
int dp[105][105];
int main()
{
    n=read(),m=read();
    reg int i,j;
    for(i=1;i<=n;++i)
        for(j=1;j<=m;++j)
            cin>>a[i][j];
    reg int tmp;
    for(i=1;i<=n;++i)
    {
        for(j=1;j<=m;++j)
        {
            if(a[i][j]=='.')
            {
                tmp=1000000000;
                if(i>1)tmp=min(tmp,dp[i-1][j]);
                if(j>1)tmp=min(tmp,dp[i][j-1]);
                if(tmp==1e9)tmp=0;
                dp[i][j]=tmp;
            }
            else
            {
                tmp=1e9;
                if(i>1){if(a[i-1][j]=='#')tmp=min(tmp,dp[i-1][j]);else tmp=min(tmp,dp[i-1][j]+1);}
                if(j>1){if(a[i][j-1]=='#')tmp=min(tmp,dp[i][j-1]);else tmp=min(tmp,dp[i][j-1]+1);}
                if(tmp==1000000000)tmp=1;
                dp[i][j]=tmp;
            }
        }
    }
    cout<<dp[n][m]<<"\n";
	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
taro = 0
hanako = 0
while line = gets
  t, h = line.chomp.split(' ')
  if t > h
    taro += 3
  elsif t < h
    hanako += 3
  elsif t == h
    taro += 1
    hanako += 1
  end
end
print "#{taro} #{hanako}\n"

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

int main() {

	long long  h;
	scanf("%lld", &h);
	long long ans = 0;
	long long time = 1;
	while(h > 1) {
		h = h / 2;
		ans += time;
		time *= 2;
	}
	ans += time;
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,x,y,i,j,p,s=0;
	cin>>x>>y;
	if(x==1 && y==1)
	{
		cout<<1000000;

	}
	else {
		if(x==1)
		{s=s+300000;
		}
		else if(x==2)
		{s=s+200000;
		}
		else if(x==3)
		{
			s=s+100000;
		}
		if(y==1)
		{s=s+300000;
		}
		else if(y==2)
		{s=s+200000;
		}
		else if(y==3)
		{
			s=s+100000;
		}
		cout<<s;
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int w, h, d[12][12], ans;

void solve(int x, int y, int c){
	if(ans <= c) return;
	if(17 < ans && ans < INF) return;
	if(x == w && y == h-1){
		chmin(ans, c);
		return ;
	}
	if(x == w){
		y ++;
		x = 0;
	}
	if(d[y][x] != 1) solve(x+1, y, c);
	if(ans <= c) return;
	if(17 < ans && ans < INF) return;
	if(d[y][x] != 0){
		int r = 1;
		for(;;r++){
			int f = 1;
			REP(i, r)REP(j, r) if(d[y+i][x+j] == 0) f = 0;
			if(!f) break;
		}
		r --;
		
		// check pruning
		int pos[3][2] = {{y-1,x-1},{y-1,x},{y,x-1}};
		REP(k, 3){
			if(pos[k][0] < 0 || pos[k][1] < 0) continue;
			int f = 1;
			REP(i, r+1)REP(j, r+1) if(d[pos[k][0]+i][pos[k][1]+j] == 0) f = 0;
			if(f) return;
		}
		vector<pii> ch;
		REP(i, r)REP(j, r){
			if(d[y+i][x+j] == 1) ch.push_back(pii(y+i, x+j));
			d[y+i][x+j] = -1;
		}
		if(ch.empty()) return ;
		solve(x+1, y, c+1);
		REP(i, ch.size()) d[ch[i].first][ch[i].second] = 1;
	}
	
}
int main(){
	ios::sync_with_stdio(false);
	while(cin >> w >> h, w){
		memset(d, 0, sizeof(d));
		REP(i, h)REP(j, w) cin >> d[i][j];
		ans = INF;
		solve(0, 0, 0);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n, m; cin >> n >> m;
    vector<vector<ll>> nbr(n);
    REP(i, m) {
        ll a, b; cin >> a >> b;
        --a; --b; // 0-indexed
        nbr[a].push_back(b);
        nbr[b].push_back(a);
    }

    deque<ll> ans = {0, nbr[0][0]};
    vector<bool> visited(n, false);
    visited[ans[0]] = visited[ans[1]] = true;
    for (;;) {
        ll v = ans.back();
        bool yet = false;
        for (ll nb : nbr[v]) {
            if (!visited[nb]) {
                ans.push_back(nb);
                visited[nb] = true;
                yet = true;
                break;
            }
        }
        if (!yet) break;
    }
    for (;;) {
        ll v = ans.front();
        bool yet = false;
        for (ll nb : nbr[v]) {
            if (!visited[nb]) {
                ans.push_front(nb);
                visited[nb] = true;
                yet = true;
                break;
            }
        }
        if (!yet) break;
    }

    cout << ans.size() << endl;
    for (ll &v : ans)
        cout << -~v << " \n"[&v == &ans.back()];
    
}

Measured memory_bytes: 7168
import java.util.*;

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

    int t1 = (int) Math.sqrt(k);

    if (t1*t1 == k){
      String t = t1+"";
      int g = t.length();
      System.out.println(g);
      return;
    }

    for (int i=t1;i>=1;i--){
      if (k % i == 0){
        long q = (long) k/i;
        String a1 = q+"";
        System.out.println(a1.length());
        return;
      }
    }

  }

}


Measured memory_bytes: 38512
S=input()
N=len(S)

if S!=S[::-1]:
    print("No")
elif S[:(N-1)//2]!=S[(N-1)//2-1::-1]:
    print("No")
elif S[(N+3)//2-1:]!=S[:(N-1)//2:-1]:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]

dp = [10**10] * (H + 1)
dp[H] = 0

for a, b in AB:
    for h in range(H + 1)[:: -1]:
        dp[h] = min(dp[h], dp[min(H, h + a)] + b)

print(dp[0])

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

using namespace std;

int main(void) {
	string s, t;
	bool flag = false;

	cin >> s >> t;

	if (s == t) {
		flag = true;
	}

	for (int i = 0; i < s.size()-1; i++) {
		s += s.front();
		s.erase(s.begin());
		if (s == t) {
			flag = true;
		}
	}

	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

N = int(input())

"""
4xyz = N(xy+xz+yz)
(4xy-Nx-Ny)z = Nxy
"""

U = 3500
for x in range(1,U+1):
    y = np.arange(1,U+1,dtype=np.int64)
    den = 4*x*y - N*x - N*y
    num = N*x*y
    y = y[(num % den == 0) & (den > 0)]
    if len(y) > 0:
        y = y[0]
        z = (N*x*y) // (4*x*y - N*x - N*y)
        break
print(x,y,z)



Measured memory_bytes: 19200
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_N = 200000;

int n, a[MAX_N], m, b[MAX_N];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	cin >> m;
	for(int i = 0; i < m; i++) cin >> b[i];
	bool flag = true;
	for(int i = 0; i < m; i++){
		if((upper_bound(a, a + n, b[i])) - a == lower_bound(a, a + n, b[i]) - a) flag = false;
	}
	if(flag) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}



Measured memory_bytes: 4656
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n, m; cin>>n>>m;
    vector<int> a(m), b(m);
    vector<vector<int>> G(m);
    for(int i=0; i<m; i++){
        cin>>a[i]>>b[i];
        for(int j=0; j<b[i]; j++){
            int c; cin>>c;
            c--;
            G[i].emplace_back(c);
        }
    }

    vector<ll> dp(1<<n, INF);
    dp[0] = 0;

    for(int bit=0; bit<(1<<n); bit++){
        for(int i=0; i<m; i++){
            int nbit = bit;
            for(int j=0; j<b[i]; j++){
                nbit |= (1LL << G[i][j]);
            }
            chmin(dp[nbit], dp[bit] + a[i]);
        }
    }

    cout << (dp[(1LL<<n)-1] == INF ? -1 : dp[(1LL<<n)-1]) << endl;

    return 0;
}

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

int main() {
  int N , R ;
  cin >> N ;
  cin >> R ; 
  
  if (N >=10){
    cout << R << endl ; 
    
    
    
  }
  
  else {
    cout << R + 100*(10 - N) << endl ;
    
    
  }
  
  
  
  
  
  
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define fo(i,a) for(i = 0;i < a;i++)
using namespace std;
int cnt(int a,int c);
int main(void)
{
	int l,a,b,c,d,i=0,jp=0,mt=0,p=0;
	
	cin >> l >> a >> b >> c >> d ;
	jp = cnt(a,c) ;
	mt = cnt(b,d) ;
	i = max(jp,mt) ;
	p = l - i ;
	cout << p << endl ;
	
	return 0 ;
}

int cnt(int a,int c){
	int x=0;
	
	x = a / c ;
	if(a % c != 0){
		x ++ ;
	}
	
	return x ;
}

Measured memory_bytes: 3108
object Main {
  def main (args: Array[String]) {
    val input:Int = scala.io.StdIn.readInt();

    val hour:Int = input/(60*60) 
    val min:Int  = ( input % (60 * 60) ) / 60
    val sec:Int  = input % 60
    println( hour + ":" + min + ":" + sec );
  }
}

Measured memory_bytes: 43784
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <set>
#include <cmath>
#include <algorithm>
#include <locale>

#define int long long
#define pb(n) push_back(n)
#define For(n,i) for(int (i)=0;(i)<(n);(i)++)
//#define ForJ(n) for(int j=0;j<n;j++)
//#define ForK(n) for(int k=0;k<n;k++)
#define Pr(n) cout<<n<<endl;
#define INS(v,n) for(int i=0;i<n;i++){cin >>v.at(i);}//vector 代入
#define ELM 100001 //問題によっては1000000001に変更
using namespace std;

int Product_set_min(int la,int ra,int lb,int rb){//A<B
    int r=0;;
    if (la<ra&&ra<lb&&lb<rb) {
        r= 0;
    }else if(la<=lb&&lb<=ra&&ra<=rb){
        r= lb;
    }else if(lb<=la&&la<=ra&&ra<=rb){
        r= la;
    }else if(lb<=la&&la<=rb&&rb<=ra){
        r= la;
    }else if(lb<rb&&rb<la&&la<ra){
        r= 0;
    }
    return r;
}
int Product_set_max(int la,int ra,int lb,int rb){//A<B
    int r=0;;
    if (la<ra&&ra<lb&&lb<rb) {
        r= 0;
    }else if(la<=lb&&lb<=ra&&ra<=rb){
        r= ra;
    }else if(lb<=la&&la<=ra&&ra<=rb){
        r= ra;
    }else if(lb<=la&&la<=rb&&rb<=ra){
        r= rb;
    }else if(lb<rb&&rb<la&&la<ra){
        r= 0;
    }
    return r;
}
string min (string m){
    transform(m.begin(), m.end(), m.begin(),towlower);
    return m;
}
signed  main(){
    int h,w;
    cin >> h>>w;
    vector<string> a;
    For(h, i){
        string s;
        cin>> s;
        a.push_back(s);
    }
    string p;
    For(w+2, i){
        p+='#';
    }
    
    cout<<p<<endl;
    For(h, i){
        cout<<'#'<<a[i]<<'#'<<endl;
    }
    cout<<p<<endl;
    return 0;
}



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

namespace AOJALDS14A
{
    class Program
    {
        static void Main(string[] args)
        {
            var Snum = int.Parse(Console.ReadLine());
            var S = Console.ReadLine().Split(' ').Select(a => int.Parse(a));
            var Tnum = int.Parse(Console.ReadLine());
            var T = Console.ReadLine().Split(' ').Select(a => int.Parse(a));
            var C = 0;
            foreach (var Ti in T)
            {
                var flag = false;
                foreach (var Si in S)
                {
                    if (Ti == Si)
                    {
                        flag = true;
                    }
                }

                if (flag)
                {
                    ++C;
                }
            }

            Console.WriteLine(C);
            Console.ReadLine();
        }
    }
}



Measured memory_bytes: 16244
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include<iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int n;cin >> n;
	vector<int> v(n,0);
	REP(i,n-1)
	{
		int a,b,c;cin >> a >> b >> c;
		v[a] ^= c;
		v[b] ^= c;
	}
	vector<int> cou(16,0);
	ll ans = 0;
	
	REP(i,n)
	{
		cou[v[i]]++;
	}
	
	for(int i = 1;i < 16;i++)
	{
		ans += cou[i] / 2;
		cou[i] %= 2;
	}
	
	int mask = 0;
	REP(i,16)
	{
		if(cou[i] == 1)
		{
			mask += (1<<i);
			ans++;
		}
	}
	
	vector<int> dat(1<<16,0);
	
	REP(i,1<<16)
	{
		REP(j,16)
		{
			if(i & 1 << j)dat[i] ^= j;
		}
	}
	
	vector<int> dp(1<<16,0);
	
	REP(i,1<<16)
	{
		int u = i;
		while(u > 0)
		{
			if(dat[u] == 0)
			{
				dp[i] = max(dp[i],dp[i^u]+1);
			}
			u = (u-1) & i;
		}
	}
	
	cout << ans - dp[mask] << endl;
		
	
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {
  string S;
  cin >> S;
  if(S[S.size() - 1] == 's') {
    S = S + "es";
  }
  else S = S + "s";
  
  cout << S << endl;
      
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

struct piii {
    int c, s, f;
};

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, c, s, f;
    cin >> n;
    piii v[n];
    fore(i,0,n-1) {
        cin >> c >> s >> f;
        v[i] = {c, s, f};
    }
    v[n-1] = {0, 0, 1};
    fore(i,0,n) {
        int cur = 0;
        fore(j,i,n) {
            cur = max(cur, v[j].s);
            cur += (v[j].f - cur%v[j].f) % v[j].f;
            cur += v[j].c;
        }
        cout << cur << endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <set>
using namespace std;
int main(void){
    int n,x; cin>>n>>x;
  	int m[n],ans=0; 
  	for(int i=0;i<n;i++){
      cin>>m[i]; x-=m[i]; ans++;
    }
  	sort(m,m+n);
  	while(x>=m[0]){
      x-=m[0]; ans++;
    }
  	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,t,f=0;
	cin>>x>>y;
	t=x;
	while(t>=0)
	{
		if(t*2+f*4==y)
		{
			cout<<"Yes";
			return 0;
		}
		t--;
		f++;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3636