akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;

const int LMAX=22,NMAX=3*1e6,MOD=1e9+7;
int nb,dp[LMAX][NMAX],n,matching[LMAX][LMAX];
vector<int> elements[LMAX];

int fast_exp(int n,int x){
	if(n==0) return 1;
	if(n%2==0) return fast_exp(n/2,(x*x));
	return fast_exp(n/2,(x*x))*x;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin >> matching[i][j];
		}
	}
	
	nb=fast_exp(n,2);
	
	for(int element=0;element<nb;element++){
		
		int compteur=0;
		for(int bit=0;bit<n;bit++){
			if( (element&(1<<bit))>0 ) compteur++;
		}
		
		elements[compteur].push_back(element);
	}
	
	dp[0][0]=1;
	
	for(int col=1;col<=n;col++){
		//cout << id << '\n';
		int sz=elements[col].size();
		
		for(int id=0;id<sz;id++){
			//int compteur=0,compteur2=0,compteur3=0;
			//bool considerer=true;
			int element=elements[col][id];
			/*for(int bit=0;bit<n;bit++){
				bool isSet= (element&(1<<bit));
				if( isSet) compteur++;
				if(matching[id-1][bit]) compteur2++;
				
				if( isSet && matching[id-1][bit]) compteur3++;
			}*/
			
			for(int bit=0;bit<n;bit++){
				bool isSet=(element&(1<<bit))>0;
				if( isSet && matching[bit][col-1] ){
					//cout << bit << ' ' << element << ' ' << col << endl;
					dp[col][element]+=dp[col-1][element-(1<<bit)];
					dp[col][element]%=MOD;
				}
			}

		}
	}
	cout << dp[n][ nb-1 ] << '\n';
    return 0;
}


Measured memory_bytes: 202172
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]
vm = float('inf')

for bit in range(1<<N):
    r = [0] * M
    v = 0
    for i in range(N):
        if (bit>>i) & 1 == 1:
            for j in range(M):
                r[j] += CA[i][j+1]
            v += CA[i][0]
    if all([X <= ri for ri in r]):
        vm = min(vm, v)
if vm == float('inf'):
    print(-1)
else:
    print(vm)


Measured memory_bytes: 74272
##N T
#t1 t2 ... tN
N, T = map(int,input().split())
a = list(map(int, input().split()))
b = []
zo  = [0, T]
leng = T
"""
d = set()
for i in range(N):
    d = d | set(range(a[i], a[i] + T))
"""
for i in range(N):
    if  a[i] + T <= zo[1]:
        pass
    elif a[i] <= zo[1] and zo[1] <= a[i] + T:
        leng += a[i] + T - zo[1]
        zo[1] = a[i] + T
    elif zo[1] <= a[i]:
        zo[0] = a[i]
        zo[1] = a[i] + T
        leng += T






print(leng)

Measured memory_bytes: 25240
#include <stdio.h>
int main()
{
	int a,b,c,s=0,m1,m2,m3;
	scanf("%d%d%d",&a,&b,&c);

	if(a>=b&&a>=c){
		if(b>=c) m1=a, m2=b ,m3=c;
		else m1=a, m2=c ,m3=b;
	}
	else if(b>=a&&b>=c) {
		if(a>=c) m1=b ,m2=a,m3=c;
		else m1=b ,m2=c,m3=a;
	}
	else if(c>a&&c>=b) {
		if(a>=b) m1=c ,m2=a,m3=b;
		else m1=c ,m2=b,m3=a;
	}
	//printf("%d %d %d\n",m1,m2,m3);
	s=m1-m3;
	printf("%d",s);
	return 0;
}


Measured memory_bytes: 128
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];

  vsort(a);

  cout << a[n-1] - a[0] << endl;
  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

int x;

inline void solve(int T) {

    cin >> x;
    puts(x == 1? "0" : "1");
    
}
int main()
{
    // ios_base::sync_with_stdio(0);
    // cin.tie(0);
    // cout.tie(0);

    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
 
    int T = 1;
    rep(i, 1, T) solve(i);
    
    // system("pause");
}

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

int n, m, q;
vector <int> a, b, c, d;
int ans;

template <typename T>
void printVec(vector<T> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}

int main() {
  ll x;
  cin >> x;
  int max_data = sqrt(x);
  // cout << max_data << endl;
  for(ll i = -max_data; i < max_data;i++) {
    for(ll j = -max_data; j < max_data; j++) {
      if (x == i*i*i*i*i - j*j*j*j*j) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
	return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  int a, b, c;
  cin >> a >> b >> c;
  if ((a == b && a != c)
  ||(a == c && a != b)
  ||(b == c && a != b)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
  int A,B; cin>>A>>B;
  cout<<6-A-B<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
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; }

const int MOD=1000000007;
int INF=100100100100100;
int add(int a,int b){
  return (a+b)%MOD;
}
int prod(int a,int b){
  return (a*b)%MOD;
}

int beki(int a,int b)
{
	if(b==0)return 1;
	int x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

int inv(int a)
{
	return beki(a,MOD-2);
}

int kaijou(int a)
{
	int ans=1;
	for(int i=1;i<=a;i++)
	{
		ans=(ans*i)%MOD;
	}			
	return ans;
}

/*int combi(int a,int b)
{
	int ret=1;
	for(int i=1;i<=b;i++)
	{
		ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
	}
	return ret;
}*/
/*
const int MAX_a=200010;
int cb[MAX_a+1]
void combi(int a,int b)
{
    int ret=1;
    cb[0]=1;
    for(int i=1;i<=b;i++)
    {
	ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
        cb[i]=ret;
    }
	
}*/

vector<P> prime_factorize(int N)
{
	vector<P> res;
	for(int a=2;a*a<=N;a++)
	{
		if(N%a!=0)continue;
		int ex=0;
		while(N%a==0)
		{
			ex++;N/=a;
		}
		res.push_back(P(a,ex));
	}
	if(N!=1)res.push_back(P(N,1));
	return res;
}

//ここから書く
int s[200020];
signed main(){
  int n;cin>>n;
  rep(i,n){
    int x;cin>>x;
    s[i+1]=s[i]+x;
  }
  int ans=INF;
  rep(i,n+1){
    chmin(ans,abs(s[n]-2*s[i]));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5188
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }


// 最小全域有向木 O(EV)
const int MAXV = 10010;
const int MAXE = 10010;
const int MAXW = 2147483647;
struct Edge {
    int u, v, c;
    Edge(int x = -1, int y = -1, int z = -1) : u(x), v(y), c(z) {}
};
int V, E, root;
Edge edges[MAXE];
inline void addEdge(int u, int v, int c){ edges[++E] = Edge(u, v, c);}
bool con[MAXV];
int mnInW[MAXV], prv[MAXV], cyc[MAXV], vis[MAXV];
inline int DMST() {
    fill(con, con + V, 0);
    int r1 = 0, r2 = 0;
    while (true) {
        fill(mnInW, mnInW + V, MAXW);
        fill(prv, prv + V, -1);
        for (int i = 1; i <= E; i++) {
            int u = edges[i].u, v = edges[i].v, c = edges[i].c;
            if (u != v && v != root && c < mnInW[v]){mnInW[v] = c; prv[v] = u;}
        }
        fill(vis, vis + V, -1);
        fill(cyc, cyc + V, -1);
        r1 = 0;
        bool jf = false;
        for (int i = 0; i < V; i++) {
            if (con[i]) continue;
            if (prv[i] == -1 && i != root) {
                return -1;
            }
            if (prv[i] >= 0) r1 += mnInW[i];
            int s;
            for (s = i; s != -1 && vis[s] == -1; s = prv[s]) vis[s] = i;
            if (s >= 0 && vis[s] == i) {
                // get a cycle
                jf = true; int v = s;
                do { cyc[v] = s; con[v] = true; r2 += mnInW[v]; v = prv[v];
                } while (v != s);
                con[s] = false;
            }
        }
        if (!jf) break;
        for (int i = 1; i <= E; i++) {
            int &u = edges[i].u;
            int &v = edges[i].v;
            if (cyc[v] >= 0) edges[i].c -= mnInW[edges[i].v];
            if (cyc[u] >= 0) edges[i].u = cyc[edges[i].u];
            if (cyc[v] >= 0) edges[i].v = cyc[edges[i].v];
            if (u == v) edges[i--] = edges[E--];
        }
    }
    return r1 + r2;
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int e;
    cin >> V >> e >> root;
    for(int i = 0; i < e;i++) {
        int a, b, c;
        cin >> a >> b >> c;
        addEdge(a, b, c);
    }
    cout << DMST() << endl;
    
    return 0;
}



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

ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b){
        ll t = a / b;
        a -= t * b; swap(a,b);
        u -= t * v; swap(u,v);
    }
    u %= m;
    if(u < 0) u += m;
    return u;
}

ll c(ll n, ll m, ll mod){
    if(m == 0) return 1;
    ll ans = 1, cnt = m;
    while(cnt > 0){
        ans *= n-cnt+1;
        ans %= mod;
        cnt--;
    }
    while(m > 0){
        ans *= modinv(m, mod);
        ans %= mod;
        m--;
    }
    return ans;
}

int main(){
    int N,K;
    cin >> N >> K;
    int R = N-K;
    ll mod = 1e9+7;
    ll sum = 0;
    
    /*
    sum += c(K-1+1-1,1-1,mod) * c(R-1+1-1,1-1,mod) * 2;
    sum %= mod;
    sum += c(K-1+1-1,1-1,mod) * c(R-(1+1)+1,1,mod);
    sum %= mod; */
    
    sum += c(K-1,0,mod) * c(R-1,0,mod) * 2;
    sum %= mod;
    sum += c(K-1,0,mod) * c(R-1,1,mod);
    sum %= mod;
    cout << sum << endl;
    ll cur = min((N+1)/2-1, K-1);
    if(R == 0) cur = K;
    for(int i = 2; i <= cur; i++){
        sum = 0;
        /*
        sum += c(K-i+i-1,i-1,mod) * c(R-(i-1)+i-2,i-2,mod);
        sum %= mod;
        sum += c(K-i+i-1,i-1,mod) * c(R-i+i-1,i-1,mod) * 2;
        sum %= mod;
        sum += c(K-i+i-1,i-1,mod) * c(R-(i+1)+i,i,mod);
        sum %= mod;*/
        
        sum += c(K-1,i-1,mod) * c(R-1,i-2,mod);
        sum %= mod;
        sum += c(K-1,i-1,mod) * c(R-1,i-1,mod) * 2;
        sum %= mod;
        sum += c(K-1,i-1,mod) * c(R-1,i,mod);
        sum %= mod;
        cout << sum << endl;
    }
    if(R > K-2 && R != 0){
        /*
        sum += c(K-(N/2+1)+N/2,N/2,mod) * c(R-N/2+N/2-1,N/2-1,mod);
        sum %= mod;
        if(cur >= K){
            sum += c(K-N/2+N/2-1,N/2-1,mod) * c(R-N/2+N/2-1,N/2-1,mod) * 2;
            sum %= mod;
        }
        if(cur >= K+1){
            sum +=
            sum %= mod;
        } */
        sum = 0; cur++;
        sum += c(K-1,cur-1,mod) * c(R-1,cur-2,mod);
        sum %= mod;
        if(R >= K){
            sum += c(K-1,cur-1,mod) * c(R-1,cur-1,mod) * 2;
            sum %= mod;
        }
        if(R >= K+1){
            sum += c(K-1,cur-1,mod) * c(R-1,cur,mod);
            sum %= mod;
        }
        cout << sum << endl;
    }
    while(cur < K){
        cout << 0 << endl;
        cur++;
    }
    return 0;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	string O, E;
	cin >> O >> E;

	FOR(i, 0, O.length()) {
		cout << O[i];
		if (i + 1 <= E.length())
			cout << E[i];

	}
	cout << endl;


	return 0;
}

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


int main(){
  int n,m;
  cin >> n >> m;
  vector<tuple<int,int,int>> cal(m);
  for(int i=0;i<m;++i){
    int p,y;
    cin >> p >> y;
    cal.emplace_back(p,y,i);
  }
  sort(cal.begin(),cal.end());
  vector<string> ans(m);
  int pre=-1;
  int num=0;
  for(auto v : cal){
    if(pre==-1){
      pre=get<0>(v);
    }
    if(pre==get<0>(v)){
      num++;
    }else{
      num=1;
      pre=get<0>(v);
    }
    string tmp1,tmp2,tmp;
    tmp1=to_string(get<0>(v));
    while(tmp1.size()<6){
      tmp1="0"+tmp1;
    }
    tmp2=to_string(num);
    while(tmp2.size()<6){
      tmp2="0"+tmp2;
    }
    tmp=tmp1+tmp2;
    ans[get<2>(v)]=tmp;
  }
  for(int i=0;i<m;++i) cout << ans[i] << endl;

  return 0;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define MAXN 111111

const int INF = 1 << 29 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int t[MAXN] , x[MAXN] , y[MAXN] ;

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

    for(int i =0 ;i<n ; i++) 
        scanf("%d %d %d" , &t[i] , &x[i] ,&y[i]) ;
    for(int i =0 ;i<n ; i++) {
        if(t[i] < x[i]+y[i] || ((t[i]-(x[i]+y[i]))&1)) {
            printf("No\n") ;
            return 0 ;
        }
    }
    printf("Yes\n") ; 
    return 0 ;
}

Measured memory_bytes: 1408
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		List<int> input = IO.GetIntList();
		int h = input[0];
		int a = input[1];
		
		Console.WriteLine(Math.Ceiling((double)h/a));
	}

}

static class IO
{
    static public string GetString() { return Console.ReadLine(); }
    static public int GetInt() { return int.Parse(Console.ReadLine()); }
    static public long GetLong() { return long.Parse(Console.ReadLine()); }
    static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
    static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
    static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
    static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
}

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

const int MOD = 1000000007;
int n, m;
ll ans;

int main() {
    cin >> n >> m;
    if (abs(n - m) <= 1) {
        ans = 1;
        // ((a % MOD) * (b % MOD)) % MOD
        for (int i = 1; i <= n; i++) ans = ans * i % MOD;
        for (int i = 1; i <= m; i++) ans = ans * i % MOD;
        if (n == m) ans = ans * 2 % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int[] h = sc.nextIntArray(n);
    int count = 1;
    int max = h[0];
    for (int i = 1; i < n; i++) {
      if (h[i] >= max) {
        count++;
        max = h[i];
      }
    }
    System.out.println(count);
  }
}


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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define  endl 			"\n"
#define  FOR(i, a, n)   for (ll i = a; i < n; i++)
#define  ROF(i, a, n)   for (ll i = a; i >= n; i--)
#define  all(x)         (x).begin(), (x).end()
#define  mset(x, val)   memset(x,val,sizeof(x))
#define  dline          cout<<"///REACHED///\n";

typedef long long ll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  4e+5+7;




void solve()
{
	ll num = 1;
	ll num1;
	ll n;
	cin>>n;
	vector<ll>arr(n);
	FOR(i,0,n){
		cin>>arr[i];
		if(arr[i]==0){
			cout<<0<<endl;
			return;
		}
	}
	FOR(i,0,n){
		num1=num;
		num*=arr[i];
		// debug(num,num>1e18);
		if(num>ll(1e18)){
			cout<<-1<<endl;
			return;
		}
		if(num1>num){cout<<-1<<endl;return;}
	}
	cout<<num<<endl;
}

int main()
{
   solve();
}



Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

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

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<pi,int>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N=1e6+3;
int n,dp[N][2];
string s;
int Solve(int i,int j)
{
    if(i==n)
        return j;
    int &ret=dp[i][j];
    if(ret+1) return ret;
    int x=s[i]-'0'+j;
    ret=x+Solve(i+1,0);
    ret=min(ret,10-x+Solve(i+1,1));
    return ret;
}
int main()
{
    go;
    memset(dp,-1,sizeof dp);
    cin>>s;
    reverse(s.begin(),s.end());
    n=s.size();
    cout<<Solve(0,0);
    return 0;
}


Measured memory_bytes: 56092
n = int(input())
h = list(map(int, input().split()))

h.reverse()
ans = 0
flag = 0
for i in range(n):
    flag = 1
    for j in range(i, n):
        if h[i] < h[j]:
            flag = 0
            break

    if flag == 1:
        ans += 1

print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
	int H, A, B, i, ans;

	scanf("%d%d%d", &H, &A, &B);
	for (ans = 0, i = A; i <= B; i++){
		if (H % i == 0) ans++;}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
using namespace std;
int main(void){
    
    int x, y;
    cin >> x >> y;
    
    // 判定：ユークリッドの互除法を使用を使用するために大きい順に並べ替える
    if(x < y) swap(x, y);
    
    // ユークリッドの互除法を使用  URL： https://mathtrain.jp/euclid
    while(true){
        if(x % y == 0){
            cout << y << endl;
            break;
        }
        int amari = x % y;
        x = y;
        y = amari;
    }
    
}


/**********************************************************************************

#include <iostream>
#include <numeric>
using namespace std;

int main()
{
    int x = gcd(12, 18);	 // 最大公約数 x = 6
    int y = lcm(3, 5);		// 最小公倍数y＝15　

 　cout << x << endl;
 　cout << y << endl;
}


/**********************************************************************************/



Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>

using namespace std;

int main(){
    int N;
    cin >> N;
    map<string, int> mp;

    for(int j = 0; j < N; j++){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    long long ans = 0;

    for(auto &p : mp){
     int s = p.second;
     ans += (long long)s*(s-1)/2;   
    }
    cout << ans << endl;

}

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

cnt = [0] * 3
for i in range(N):
    if P[i] <= A:
        cnt[0] += 1
    elif P[i] <= B:
        cnt[1] += 1
    else:
        cnt[2] += 1
print(min(cnt))


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int n = Integer.parseInt(line);
        int[] a = new int[n];
        String line2 = br.readLine();
        String[] str = line2.split(" ");
        for(int i=0;i<n;i++)a[i]=Integer.parseInt(str[i]);
        boolean flag=true;
        int cnt=0;
        while(flag){
        	flag=false;
        	for(int j=n-1;j>0;j--){
        		if(a[j]<a[j-1]){
        			int tmp = a[j];
        			a[j] = a[j-1];
        			a[j-1]=tmp;
        			flag=true;
        			cnt++;
        		}
        	}
        }
    	for(int i=0;i<n;i++){
    		if(i!=n-1)System.out.print(a[i]+" ");
    		else System.out.println(a[i]);
    	}
    	System.out.println(cnt);
	}
}

Measured memory_bytes: 24292
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int a, b;
	cin >> a >> b;
	if (a <= 8 && b <= 8)cout << "Yay!";
	else cout << ":(";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
    int k;
    string s;
    cin >> k;
    cin >> s;
    if(s.size() <= k){
        cout << s << endl;
    }else if(s.size() > k){
        cout << s.substr(0,k) + "..." << endl;
    } 
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
#include <string>
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define beg begin()
#define end end()


void _main(){
    ll a,b,c,k; cin >> a >> b >> c >> k;
    if(k <= a) cout << k << endl;
    else if(k <= a + b) cout << a << endl;
    else cout << a-(k-a-b) << endl;
    return;
}
int main() {
    cout << fixed << setprecision(10);
    _main();
    return 0;
}
    

Measured memory_bytes: 3148
import java.util.Scanner;

public class Main{
	
	static int[][] nums;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		nums = new int[N][10];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 10; j++) {
				nums[i][j] = sc.nextInt();
			}
		}
		
		for (int i = 0; i < N; i++) {
			int top1 = 0,top2=0;
			boolean flag=true;
			for (int j = 0; j < 10; j++) {
				if(nums[i][j]>=top1) top1=nums[i][j];
				else if(nums[i][j]>=top2) top2=nums[i][j];
				else {
					flag=false;
					break;
				}
			}
			if(flag) System.out.println("YES");
			else System.out.println("NO");
			
		}
		
		
		
	}
	
	
	

}



Measured memory_bytes: 26052
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;

int w, h;
int s[35][35];
int c[4];
int vx[4][4] = {{1, 0, -1, 0}, {0, 1, 0, -1}, {-1, 0, 1, 0}, {0, -1, 0, 1}};
int vy[4][4] = {{0, 1, 0, -1}, {-1, 0, 1, 0}, {0, -1, 0, 1}, {1, 0, -1, 0}};
int vv[4][4] = {{0, 3, 2, 1}, {1, 0, 3, 2}, {2, 1, 0, 3}, {3, 2, 1, 0}};

class robot {
	public :
		int x;
		int y;
		int v; // 向き
		int c;

		robot() {
			x = 0; y = 0; v = 0; c = 0;
		}

		bool operator<(const robot& other) const{
			return c > other.c;
		}

		bool operator>(const robot& other) const{
			return c < other.c;
		}

		bool next(int o) {
			if(o != s[y][x])
				c += ::c[o];
			x += vx[v][o];
			y += vy[v][o];
			v = vv[v][o];

			if(x < 0 || y < 0 || x >= w || y >= h)
				return false;

			return true;
		}
}; 

bool input() {
	cin >> w >> h;
	if(w == 0 && h == 0)
		return 0;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			cin >> s[i][j];
		}
	}

	for(int i = 0; i < 4; i++)
		cin >> c[i];

	return 1;
}

int solve(void) {
	priority_queue<robot> q;
	int use[35][35][4];
	memset(use, -1, 35 * 35 * 4 * sizeof(int));

	q.push(robot());
	while(!q.empty()) {
		robot now = q.top();
		q.pop();

		if(use[now.x][now.y][now.v] == -1) {
			use[now.x][now.y][now.v] = now.c;
		}

		else
			continue;

		if(now.x == w - 1 && now.y == h - 1){
			return now.c;
		}

		for(int i = 0; i < 4; i++) {
			robot temp = now;
			if(temp.next(i)){
					q.push(temp);
			}
		}
	}
	return -1;
}

int main(void) {
	while(input()){
		cout << solve() << endl;
	}
	return 0;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll A,V,B,W,T;
  cin >> A >> V >> B >> W >> T;
  if((B>=A&&V>W&&(B-A)<=T*(V-W))||(B<=A&&V>W&&(A-B)<=T*(V-W))){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

int main(){
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  int N_Origin = N;
  int R_max = N/R;
  int G_max;
  int B_max;
  int result = 0;
  for(int i=0;i <= R_max;i++){
    N = N_Origin;    
    N = N -R*i;
    G_max = N/G;
    for(int j=0;j <=G_max;j++){
    	
      N = N - G * j;
  	  if(N % B == 0){
//        cout << "i " << i << " j " << j << endl;
//        cout << N << endl;
        result++;
      }
	  N = N+ G*j;
    }
  }
  cout << result << endl;
  return 0;
}

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

# dp[i][j][k]: 寿司が残り1個の皿がi枚, 残り2個の皿がj枚, 残り3個の皿がk枚から寿司をすべてなくす操作回数の期待値
dp = [[[0.0 for _ in range(n+1)] for _ in range(n+1)] for _ in range(n+1)]

one = A.count(1)
two = A.count(2)
three = A.count(3)

# i, j, kを全通り回す
for k in range(three + 1):
    # 3個の皿がk個のとき
    for j in range(two + three - k + 1):
        # 2枚の皿は
        # 初期のtwo
        # 3個の皿がk枚のとき、three-k枚が2枚になっている
        for i in range(one + two + three - k - j + 1):
            # 1枚の皿は
            # 初期のone
            # 3枚の皿がk枚、2枚の皿がj枚のとき、two+three-k-j枚が1枚になっている
            if i == 0 and j == 0 and k == 0:
                continue
            tmp = 1.0*n
            if i > 0:
                tmp += i * dp[i - 1][j][k]
            if j > 0:
                tmp += j * dp[i + 1][j - 1][k]
            if k > 0:
                tmp += k * dp[i][j + 1][k - 1]
            
            dp[i][j][k] = tmp / (i + j + k)

print(dp[one][two][three])

Measured memory_bytes: 258824
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;

int main () {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		ll answer = 0;
		vector <pair <ll, ll>> a(n);
		for (int i = 0; i < n; i++) {
			ll K, L, R;
			cin >> K >> L >> R;
			answer += R;
			a[i].first = K;
			a[i].second = L - R;
		}
		sort(a.begin(), a.end());
		multiset <ll> values;
		vector <ll> pre(n);
		ll sum = 0;
		for (int i = 0; i < n; i++) {
			if (a[i].second < 0) {
				pre[i] = sum;
				continue;
			}
			values.insert(a[i].second);
			sum += a[i].second;
			while (values.size() > a[i].first) {
				ll x = *values.begin();
				sum -= x;
				values.erase(values.begin());
			}
			pre[i] = sum;
		}
		vector <ll> suf(n);
		sum = 0;
		while (!values.empty())
			values.erase(values.begin());
		for (int i = n - 1; i >= 0; i--) {
			if (a[i].second >= 0) {
				suf[i] = sum;
				continue;
			}
			values.insert(a[i].second);
			while (values.size() > n - a[i].first) {
				ll x = *values.rbegin();
				sum += x;
				values.erase(values.find(x));
			}
			suf[i] = sum;
		}
		cout << answer + suf[0] + pre[n - 1] << '\n';
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    cout << "Christmas";
    rep(i, 25 - d)
    {
        cout << " Eve";
    }
    cout << '\n';

    return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n; cin >> n;
    map<int, int> mp;
    REP(i, n){
        int a; cin >> a;
        ++mp[a];
    }
    int ans = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        if(itr->second >= itr->first) ans += itr->second - itr->first;
        else ans += itr->second;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[3];
    rep(i,3) cin >> a[i];
    sort(a,a+3);
    PRINT(a[2]-a[0]);
}


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

int main(){
  int N,M,count=0,sum=0;
  cin >> N >> M;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    sum+=A.at(i);
  }
  for(int i=0;i<N;i++){
    if(A.at(i)>=(double)sum/(4*M)){
      count++;
     }
  }
  if(count>=M){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
} 

Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
using namespace std;
char fie[1002][1002];
int J[1002][1002];
int O[1002][1002];
int I[1002][1002];
main(){
  int n,m,k;
  int i;

  cin >> n >> m;
  cin >> k;
  for(int i=0;i<n;i++){
      cin >> fie[i];
  }

  for(int j=0;j<m;j++){
    int Jc=0;
    int Oc=0;
    int Ic=0;
    for(int i=0;i<n;i++){
      if(fie[i][j]=='J') Jc++;
      else if(fie[i][j]=='O') Oc++;
      else if(fie[i][j]=='I') Ic++;
      J[i][j]=Jc;
      O[i][j]=Oc;
      I[i][j]=Ic;
    }
  }

  for(int i=0;i<n;i++){
    for(int j=1;j<m;j++){
      J[i][j]+=J[i][j-1];
      O[i][j]+=O[i][j-1];
      I[i][j]+=I[i][j-1];
    }
  }

  /* for(int i=0;i<n;i++){
    for(int j=0;j<m;j++) cout << J[i][j];
    cout << endl;
    }*/

  for(int i=0;i<k;i++){
    int x1,x2,y1,y2;
    cin >> y1 >> x1 >> y2 >> x2;
    x1--;
    y1--;
    x2--;
    y2--;
    cout << J[y2][x2]-J[y2][x1-1]-J[y1-1][x2]+J[y1-1][x1-1] << ' ';
    cout << O[y2][x2]-O[y2][x1-1]-O[y1-1][x2]+O[y1-1][x1-1] << ' ';
    cout << I[y2][x2]-I[y2][x1-1]-I[y1-1][x2]+I[y1-1][x1-1] << endl;
  }
  
  return 0;
}

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

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

        return -1;
}


int main()
{
        long long K, sum = 0;
        long long tmp = 0;
        cin >> K;

        for(long long i = 1; i <= K; ++i)
        {
                for(long long j = 1; j <= K; ++j)
                {
                        for(long long k = 1; k <= K; ++k)
                        {
                                tmp = gcd(i, j);
                                sum += gcd(k, tmp);
                        }
                }
        }

        cout << sum << endl;



        return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int64_t get_gcd(int64_t a, int64_t b) {
  if (a < b) std::swap(a, b);
  int64_t r;
  while (1) {
    r = a % b;
    if (r == 0) {
      cerr << "GCD is " << b << endl;
      return b;
    } else {
      a = b;
      b = r;
    }
  }
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int64_t n, m;
  cin >> n >> m;
  std::string s, t;
  cin >> s >> t;
  int64_t l = n * m / get_gcd(n, m);
  cerr << " l is " << l << endl;
  for (int64_t b = 0; b <= (m - 1); b++) {
    if ((n * b) % m == 0) {
      int64_t a = n * b / m;
      if (a <= n - 1) {
        if (s[a] != t[b]) {
          cout << "-1" << endl;
          exit(0);
        }
      }
    }
  }
  cout << l << endl;

  return 0;
}


Measured memory_bytes: 512
n = int(input())
a_l1 = list(map(int, input().split()))
a_l2 = list(map(int, input().split()))
c = 0
m_a_l1 = []
for i in a_l1:
    c += i
    m_a_l1.append(c)
c = 0
m_a_l2 = [0] * n
for i,j in enumerate(reversed(a_l2)):
    c += j
    m_a_l2[-1-i] = c

ans = 0
for i,j in zip(m_a_l1, m_a_l2):
    ans = max(i+j, ans)
print(ans)

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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N, K;
  cin >> N >> K;

  vll V(N);
  for (int i=0; i<N; i++) {
    cin >> V[i];
  }

  vll ret;
  ret.emplace_back(0);

  for (int a=0; a<=min({K,N}); a++) {
    vll va;
    va.reserve(K);
    va.assign(begin(V), begin(V)+a);

    for (int b=0; b<=min({K-a,N-a}); b++) {
      vll vb;
      vb.reserve(K);
      vb.assign(end(V)-b, end(V));

      vll hand;
      hand.reserve(K);
      hand.insert(end(hand), begin(va), end(va));
      hand.insert(end(hand), begin(vb), end(vb));

      Sort(hand);
      int remains = max({K-(a+b), 0});
      ll sum = 0;
      for (auto x : hand) {
        if (x < 0 && remains > 0) {
          remains--;
	  continue;
	}

	sum += x;
      }

//cerr << "a " << a << ", b " << b << " : sum " << sum << endl;
//for (auto h : hand) {
//	cerr << h << " ";
//}
//cerr << endl;

      ret.emplace_back(sum);
    }
  }

  Sort(ret);
  cout << ret.back() << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N;
  cin >> N;
  vector<pair<int, int>> edge(N - 1);
  vector<int> edge_count(N), d(N), c(N);
  vector<set<int>> edges(N);
  rep(i, N - 1)
  {
    int a, b;
    cin >> a >> b;
    edge_count[--a]++;
    edge_count[--b]++;
    edges[a].insert(b);
    edges[b].insert(a);
    edge[i] = make_pair(a, b);
  }

  vector<set<int>> node(N + 10);
  rep(i, N)
  {
    node[edge_count[i]].insert(i);
    cin >> c[i];
  }
  SORT(c);

  int count = 0;
  while (node[1].size())
  {
    for (int edge_node : node[1])
    {
      int next_node = *edges[edge_node].begin();

      edges[next_node].erase(edge_node);
      edges[edge_node].erase(next_node);

      node[edge_count[next_node]].erase(next_node);
      node[edge_count[next_node] - 1].insert(next_node);

      edge_count[next_node]--;
      edge_count[edge_node]--;

      node[1].erase(edge_node);

      d[edge_node] = c[count++];
    }
  }
  rep(i, N)
  {
    if (d[i] == 0)
      d[i] = c.back();
  }

  long long M = 0;
  rep(i, N - 1)
  {
    M += min(d[edge[i].first], d[edge[i].second]);
  }
  cout << M << endl;
  printVector(d);
  return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
  
int main(){
  int K;
  cin >> K;
  vector<int> A(K);
  A.at(0)=7%K;
  for(int i=0;i<K-1;i++){
    A.at(i+1)=(10*A.at(i)+7)%K;
  }
  for(int i=0;i<K;i++){
    if(A.at(i)==0){
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 7104
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M);
    rep(i,M) cin >> L.at(i) >> R.at(i);
    int begin = L[0];
    int end   = R[0];
    rep(i,M) {
       begin = max(begin, L[i]);
       end   = min(end, R[i]);
    }    
    if (begin > end) {
        cout << 0 << endl;
    } else
    cout << end - begin + 1 << endl;
}


Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(len(str(i)))
            divisors.append(len(str(n // i)))
    return divisors[-1]


n = int(read())
print(make_divisors(n))


Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
	int N,D,A[11][11],ans=0,sum=0;
	scanf("%d%d",&N,&D);
	for(int i=0; i<N; i++){
		for(int j=0; j<D; j++){
			scanf("%d",&A[i][j]);
		}
	}
	for(int i=0; i<N-1; i++){
		for(int j=i+1; j<N; j++){
			for(int k=0; k<D; k++){
				sum += (A[i][k] - A[j][k])*(A[i][k] - A[j][k]);
			}
			for(int k=0; k*k<=sum; k++){
				if(k*k == sum){
					ans++;
					break;
				}
			}
			sum = 0;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128