akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for (int i = s; i < n; i++)
#define repe(i, s, n) for(int i = s;i<=n;i++)

int main() {
	ll n; cin >> n;
	ll a[101] = {};
	repe(i, 1, n) cin >> a[i];

	ll ans = 1 << 29;
	repe(i, -100, 100) {
		ll t = 0;
		repe(j, 1, n) {
			t += (a[j] - i)*(a[j] - i);
		}
		ans = min(ans, t);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
int s_a[1000010] = {0};
int s_b[1000010] = {0};
int t_a[1000010] = {0};
int t_b[1000010] = {0};
signed main(){
    string s,t;
    cin >> s >> t;
    int q;
    cin >> q;
    for(int i = 0;i < s.size();i++){
        s_a[i+1] = s_a[i];
        s_b[i+1] = s_b[i];
        if(s[i] == 'A')s_a[i+1]++;
        else s_b[i+1]++;
    }
    for(int i = 0;i < t.size();i++){
        t_a[i+1] = t_a[i];
        t_b[i+1] = t_b[i];
        if(t[i] == 'A')t_a[i+1]++;
        else t_b[i+1]++;
    }

    rep(i,q){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        int SA = s_a[b] - s_a[a-1];
        int SB = s_b[b] - s_b[a-1];
        int TA = t_a[d] - t_a[c-1];
        int TB = t_b[d] - t_b[c-1];
        if(TA == 0 && TB == 0){
            if((SA + SB*2)%3 == 0)cout << "YES" << endl;
            else cout <<  "NO" << endl;
            continue;
        }
        if(SA == 0 && SB == 0){
            cout <<  "NO" << endl;
            continue;
        }
        while(TA >= 4) TA = TA/4 + TA%4;
        while(TB >= 4) TB = TB/4 + TB%4;
        SA %= 3;
        SB %= 3;
        if(TA == TB || (TA == 3 && TB == 0) || (TA == 0 && TB == 3)){
            if(SA == SB)cout << "YES" << endl;
            else cout << "NO" << endl;
        }else if(TB - TA == 2 || TA - TB == 1){
            if(SA - SB == 1 || SB - SA == 2)cout << "YES" << endl;
            else cout <<  "NO" << endl;
        }else{
            if(SB - SA == 1 || SA - SB == 2)cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }    



    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_d
// rm -r -f test;oj dl http://arc071.contest.atcoder.jp/tasks/arc071_c

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

int solve(int n, int* h)
{
  int dp[n];
  dp[0] = 0;
  dp[1] = abs(h[1]-h[0]);
  for (int i = 2; i < n; i++)
  {
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
  }
  return dp[n-1];
}

int main()
{
  int n;
  cin >> n;
  int h[n];
  for (int i=0; i<n; i++)
  {
    cin >> h[i];
  }
  int r = solve(n, h);
  cout << r << endl;
}


Measured memory_bytes: 3960
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int N;
    string s;
    cin >> N >> s;
    int i;
    int r=0,b=0;
    for(i=0;i<N;i++){
      if(s[i]=='R')r++;else b++;
    }
    if(r>b)cout <<"Yes";else cout << "No";
    return 0;
}


Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections
LI = lambda : [int(x) for x in sys.stdin.readline().split()]

N,M = LI()
data = [LI() for _ in range(N)]
# dp = [0] * (M+1)
# data.sort(key=lambda x:x[1], reverse=True)
#
# N0 = 2 ** M.bit_length()
# seg = [0] * (2*N0)
#
# def seg_set(i,x):
#     i = i + N0- 1
#     seg[i] = x
#     while i > 0:
#         i = (i-1) // 2
#         seg[i] = max(seg[i*2+1],seg[i*2+2])
#
# def seg_query(i):
#     i = i + N0 - 1
#     ret = seg[i]
#     while i ^ (i+1) < i+1:
#         i = (i-2) // 2
#         ret = max(ret,seg[i])
#     return ret
#
# for i in range(M+1):
#     seg_set(i,i)
#
# for a,b in data:
#     if a <= M:
#         i = seg_query(M-a+1)
#         if i > 0:
#             dp[i] = b
#             seg_set(i,0)
# print(sum(dp))
data.sort()
p = 0
q = queue.PriorityQueue()
ans = 0
for i in range(1,M+1):
    while p < N:
        if data[p][0] > i : break
        q.put(-data[p][1])
        p += 1
    if not q.empty():
        ans -= q.get()
print (ans)



Measured memory_bytes: 83032
#include<stdio.h>
int main(){
	int N,i,k,a,b=0;
	scanf("%d",&N);
	for(i=1;i<=N;i+=2){
		a=0;
		for(k=1;k<=i;k++){
			if(i%k==0)a++;
			if(a==9)break;
		}
		if(a==8)b++;
	}
	printf("%d",b);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define sz size()
#define vec vector<int>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, int now) {
	/*if (depth == n)return !now;
	for (int i = 0; i < k; i++) {
		if (dfs(depth + 1, now ^ t[depth][i]))return true;
	}
	/**/
	return false;
}

int main() {
	ll a, b, k; cin >> a >> b >> k;
	if (a >= k) {
		a -= k;
		k = 0;
	}
	else {
		k = k - a;
		a = 0;
	}


	if (b >= k) {
		b -= k;
	}
	else {
		b = 0;
	}
	cout << a << " " << b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007
using namespace std;

int main(){
    int a,b,n;
    string ans="No";
    cin >> n;
    rep(i,1,9){
        if(n%i==0){
            if(n/i<10)ans="Yes";
        }
    }
    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(n):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if A[i] != A[minj]:
        A[i], A[minj] = A[minj], A[i]
        count += 1
print(*A)
print(count)


Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;
int n,w,a[1000],b[1000];
long long f[102][100002];
int main(){
	cin>>n>>w;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=w;j++)
			f[i][j]=-10000000000;
	}
	for(int i=0;i<=n;i++){
		f[i][0]=0;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=w;j++){
			f[i][j]=f[i-1][j];
			if((j>=a[i])&&(f[i-1][j-a[i]]!=-10000000000)){
				f[i][j]=max(f[i][j],f[i-1][j-a[i]]+b[i]);
			}
		}
	}
	long long  ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=w;j++){
			ans=max(ans,f[i][j]);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 78336
#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;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
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; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    char X,Y; cin >> X >> Y;
    if(X < Y) return "<";
    else if(X == Y) return "=";
    else return ">";
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    //solve<ll>(0);
    cout << fixed << setprecision(12) << solve<string>() << endl;
    return 0;
}

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

int findSumOfDigits (int n){
  int  sum = 0;
  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int n;
  cin >> n;
  int res = 10000;
  
  for(int i = 1; i <= n/2; i++){
    int total = findSumOfDigits(i) +findSumOfDigits(n-i);
    if(total < res)
      res = total;
  }
  cout << res << endl;
}

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

int main() {
    int n; cin >> n;
    
    for (int i = 0; i <= n/7; i++) {
        for (int j = 0; j <= n/4; j++) {
            if (7*i + 4*j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

const int NMAX = 500;

int n, m;

bool red[NMAX+5][NMAX+5];
bool blue[NMAX+5][NMAX+5];

bool isRed(int r, int c){
	if(r == 0) return true;
	if(r == n-1) return false;
	return (c%2 == 0);
}

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

	char s[m+5];

	for (int i = 0; i < n; i++){
		scanf("%s", s);
		for (int j = 0; j < m; j++){
			if(s[j] == '#'){
				red[i][j] = true;
				blue[i][j] = true;
			}else if(isRed(i, j)){
				red[i][j] = true;
			}else{
				blue[i][j] = true;
			}
		}
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if(red[i][j]) printf("#");
			else printf(".");
		}
		printf("\n");
	}

	printf("\n");

	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if(blue[i][j]) printf("#");
			else printf(".");
		}
		printf("\n");
	}
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void AGC023B();

int main()
{
	AGC023B();
	fflush(stdout);
	return 0;
}

static void AGC023B()
{
	int N;
	getint(N);

	std::vector<std::string> grid(N);
	for (int i = 0; i < N; i++) {
		std::cin >> grid[i];
	}

	int ans = 0;
	for (int n = 0; n < N; n++) {
		bool allEqu = true;
		for (int r = 0; r < N; r++) {
			for (int c = 0; c < N; c++) {
				if (grid[r][(n + c) % N] != grid[c][(n + r) % N]) {
					allEqu = false;
					break;
				}
			}
		}
		if (allEqu) ans++;
	}
	printf("%d\n", ans * N);
}


Measured memory_bytes: 3836
W, H, x, y, r = map(int, input().split())
if W > 0 and H > 0 and  x > 0 and  y > 0 and  r > 0:
    if x + r <= W:
        if y >= r and y + r <= H:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 5596
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int d, t, s;
    cin >> d >> t >> s;
    if (t * s >= d) cout << "Yes";
    else cout << "No";
    return 0;
}


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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#else
#define db(...) true
#endif
template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c; return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

int n;
string s;
map<vi, int> M;

int main() {
	#ifdef LOCAL
	auto stTime = clock();
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		vi v(26);
		for (auto& c : s)
			++v[int(c - 'a')];
		++M[v];
	}
	ll ans = 0;
	for (auto& pr : M) {
		ans += pr.sc * 1LL * (pr.sc - 1) / 2;
	}
	cout << ans << '\n';
	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms\n";
	#endif
    return 0;
}


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

int main() {
  string s;
  cin>>s;
  vector<char> c(s.size());
  
  for(int i=0; i<s.size(); i++) c[i]=s.at(i);
  
  if(c[2]==c[3] && c[4]==c[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;
using Mat = std::vector<std::vector<i64>>;

i64 mod;

Mat make_mat(int n, int m) {
    return Mat(n, std::vector<i64>(m));
}

Mat unit_mat(int n) {
    auto ret = make_mat(n, n);
    for (int i = 0; i < n; i++) ret[i][i] = 1;
    return ret;
}

Mat operator*(const Mat &lhs, const Mat &rhs) {
    int n = lhs.size();
    auto ret = make_mat(n, n);
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) for (int k = 0; k < n; k++) {
        ret[i][j] = (ret[i][j] + lhs[i][k] * rhs[k][j] % mod) % mod;
    }
    return ret;
}

Mat pow(Mat m, i64 k) {
    const int size = m.size();
    auto ret = unit_mat(size);
    while (k) {
        if ((k & 1) == 1) ret = m * ret;
        m = m * m;
        k >>= 1ll;
    }
    return ret;
}

int main() {
    i64 n, a, b;
    std::cin >> n >> a >> b >> mod;

    std::vector<i64> dcnt(20);
    i64 sum = 0;
    int initial = std::to_string(a).length();
    for (i64 i = initial; i < 20; i++) {
        i64 l = 0, r = n, th = 1;
        for (i64 j = 0; j < i; j++) th *= 10;
        while (r - l > 1) {
            i64 k = (l + r) / 2;
            i64 s = a + b * k;
            if (s < th) l = k;
            else r = k;
        }
        dcnt[i] = l + 1 - sum;
        sum = l + 1;
    }

    i64 dd = 10;
    i64 ret = 0, s = a;
    for (i64 i = 1; i <= 18; i++) {
        Mat m { { dd, 0, 0 }, { 1, 1, 0 }, { 0, b, 1 } };
        m = pow(m, dcnt[i]);
        ret = (ret * m[0][0] % mod + s * m[1][0] % mod + m[2][0]) % mod;
        s = (s * m[1][1] % mod + m[2][1]) % mod;
        dd = dd * 10 % mod;
    }
    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
static const long long int INF = ((1ll<<60)-1);
 
int main()
{
	long long int a, b, m;
	cin >> a >> b >> m;
	long long int A[100001], B[100001];
	long long int mir = INF, mid = INF;
	for (long long int i = 1; i <= a; ++i)
	{
		cin >> A[i];
		mir = min(mir, A[i]);
	}
	for (long long int i = 1; i <= b; ++i)
	{
		cin >> B[i];
		mid = min(mid, B[i]);
	}
	long long int x, y, c;
	long long int ans = INF;
	for (long long int i = 0; i < m; ++i)
	{
		cin >> x >> y >> c;
		ans = min(ans, A[x] + B[y] - c);
	}
	cout << min(mir + mid, ans) << endl;
	return 0;
}

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

namespace abcreftgh
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            if (A + B >= 10)
            {
                Console.WriteLine("error");
            }else
            {
                Console.WriteLine(A + B);
            }
        }
    }
}


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

int mod = 1000000007;
int64_t large = 9223372036854775807;

int main()
{
   string S;
   cin >> S;
   bool x = true;
   for (int i = 0; i < S.size(); i++)
    {
        if (i % 2 == 0 && S[i] == 'L')
            x = false;
        if (i % 2 == 1 && S[i] == 'R')
            x = false;
    }
    cout << (x ? "Yes" : "No");
}

Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <tuple>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007



int main(int argc, char const *argv[]) {
  int N, M;
    cin >> N >> M;

    tuple<int, int, int> data[M];
    // (Y_i, P_i, i)の配列

    for (int i = 0; i < M; ++i) {
        int p, y;
        cin >> p >> y;
        data[i] = make_tuple(y, p, i);
    }

    // tupleをソートするときは第一要素がkeyとなる
    // つまりY_iによって昇順にソートされる
    sort(data, data + M);

    int cnt[N + 1];
    fill(cnt, cnt + N + 1, 0);
    // 各県に今属している市の数

    pair<int, int> id[M];
    // 各市の(属する県、県の中で誕生した順番)

    for (int i = 0; i < M; ++i) {
        int y, p, idx;
        tie(y, p, idx) = data[i];
        ++cnt[p];
        id[idx] = make_pair(p, cnt[p]);
    }

    for (int i = 0; i < M; ++i) {
        // setwで文字数、setfillで埋める文字を指定
        // iomanipをincludeする必要があるので注意
        cout << setw(6) << setfill('0') << id[i].first;
        cout << setw(6) << setfill('0') << id[i].second << endl;
    }
    return 0;
  return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int n, m; cin >> n >> m;
	int lm=0, rm=1000000;
	for (int i = 0; i < m; i++) {
		int l, r;
		cin >> l >> r;
		lm = max(lm, l);
		rm = min(rm, r);
	}
	cout << max(rm - lm + 1, 0) << endl;
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

bool kr(bool a, bool b);

int n;
string s;
bool memo[100000];
pair<bool,bool> p[4] = {{true,true}, {true,false}, {false,true}, {false,false}};


signed main() {
    cin >> n >> s;
    rep(k,4) {
        if (kr(p[k].fi, p[k].se)) {
            rep(i,n) {
                if (memo[i]) cout << 'S';
                else cout << 'W';
            }
            cout << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

bool kr(bool a, bool b) {
    bool rev=true;
    memo[0] = a;
    memo[1] = b;
    rep1(i,n-2) {
        if (memo[i]) {
            if (s[i] == 'o') memo[i+1] = memo[i-1];
            else memo[i+1] = !memo[i-1];
        } else {
            if (s[i] == 'x') memo[i+1] = memo[i-1];
            else memo[i+1] = !memo[i-1];
        }
    }
    if (memo[0]) {
        if (s[0] == 'o' && memo[1] != memo[n-1]) rev = false;
        if (s[0] == 'x' && memo[1] == memo[n-1]) rev = false;
    } else {
        if (s[0] == 'x' && memo[1] != memo[n-1]) rev = false;
        if (s[0] == 'o' && memo[1] == memo[n-1]) rev = false;
    }
    if (memo[n-1]) {
        if (s[n-1] == 'o' && memo[0] != memo[n-2]) rev = false;
        if (s[n-1] == 'x' && memo[0] == memo[n-2]) rev = false;
    } else {
        if (s[n-1] == 'x' && memo[0] != memo[n-2]) rev = false;
        if (s[n-1] == 'o' && memo[0] == memo[n-2]) rev = false;
    }
    return rev;
}

Measured memory_bytes: 640
s=input()
n=int(input())
head=[]
end=[]
rev = False
for i in range(n):
    q = list(map(str,input().split()))
    if q[0]=='1':
        head,end = end, head
        rev = not rev
    elif q[0]=='2':
        if q[1]=='1':
            head.append(q[2])
        else:
            end.append(q[2])

head.reverse()
if rev:
    ans = list(s)
    ans.reverse()
else:
    ans = list(s)
print("".join(head+ans+end))

Measured memory_bytes: 83160
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int H, W, N, X, Y, x, y, cnt, res;
set<int>st[200000];

int main() {
	cin >> H >> W >> N;
	for (int i = 0; i < N; ++i) {
		cin >> X >> Y;
		--X;
		--Y;
		st[Y].insert(X);
	}
	for (int i = 0; i < W; ++i) {
		st[i].insert(H);
	}
	res = intmax;
	while (true) {
		if (st[y].find(x + 1) != st[y].end()) {
			res = min(res, cnt + 1);
			break;
		}
		else {
			res = min(res, cnt + *st[y].lower_bound(x) - x);
			if (y == W - 1)break;
			++x;
			if (st[y + 1].find(x) == st[y + 1].end()) {
				++y;
			}
			++cnt;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 28416
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  cout.precision(12);

  long N;
  cin >> N;
  vector<long> W(N);
  rep (i, N) cin >> W[i];

  vector<long> ruiseki(N);
  ruiseki[0] = W[0];
  for (long i = 1; i < N; i++) {
    ruiseki[i] = ruiseki[i-1] + W[i];
  }

  long result = ruiseki[N-1];

  for (long i = 0; i < N-1; i++) {
    result = min(result, abs(ruiseki[N-1] - ruiseki[i] * 2));
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>

typedef long long llong;
using namespace std;


int main() {
	char s[210];
	char p[210];

	fgets(s, 110, stdin);
	fgets(p, 110, stdin);
	s[strlen(s)-1] = '\0';
	p[strlen(p) - 1] = '\0';
	char dummy[210];
	strcpy(dummy, s);
	strcat(s, dummy);

	for (int i = 0; s[i] != '\0'; i++) {
		if (s[i] == p[0]) {
			for (int j = 0; p[j] != '\0'; j++) {
				if (s[i + j] != p[j])break;
				else if (p[j + 1] == '\0') {
					cout << "Yes\n";
					return 0;
				}
			}
		}
	}
	cout << "No\n";
	return 0;
}



Measured memory_bytes: 3104
#include<stdio.h>
int A[100000],n;
int binarySearch(int key);

int main(){
  int i,q,key,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(binarySearch(key)){
      sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}
int binarySearch(int key){
  int left=0,right=n,mid;
  while(left<right){
    mid=(left+right)/2;
    if(A[mid]==key){
      return 1;
    }
    else if(key<A[mid]){
      right=mid;
    }
    else{
      left=mid+1;
    }
  }
  return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,h,n;cin>>w>>h>>n;
  int x,y,a,xmx=w,xmn=0,ymx=h,ymn=0;
  for(int i=0;i<n;i++){
    cin>>x>>y>>a;
    if(a==1)xmn=max(xmn,x);
    else if(a==2)xmx=min(xmx,x);
    else if(a==3)ymn=max(ymn,y);
    else ymx=min(ymx,y);
  }
  cout<<(xmx<xmn||ymx<ymn?0:(xmx-xmn)*(ymx-ymn));
}

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

using namespace std;
const int maxn = 3e3 + 5, mod = 1e9 + 7;
int n, c[maxn][maxn];
double a[maxn], f[maxn][maxn];

double dp(int i, int cnt)
{
    if (i > n) {
        if (n - cnt >= cnt) return 0;
        else return 1;
    }
    double &res = f[i][cnt];
    if (c[i][cnt]) return res;
    c[i][cnt] = true;
    res = 0;
    res += dp(i + 1, cnt + 1) * a[i];
    res += dp(i + 1, cnt) * (1 - a[i]);
    return res; 
}

int main()
{
    #ifdef NTMA 
        freopen("abc.inp", "r", stdin);
    #endif
    //memset(f, 255, sizeof(f));
    cin >> n;
    for(int i=1; i<=n; ++i) cin >> a[i];
    cout.precision(9);
    cout << fixed << dp(1, 0);
}

Measured memory_bytes: 104448
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double x = sc.nextDouble();
		double h = (2*x)/(b*a);
		double theta = 0;
		if(h < a) { //near empty
			theta = Math.atan((b/h));
		} else {//not near empty
			h = (2*x)/(a*a)-b;
			theta = Math.atan((b-h)/a);
		}
		theta = Math.toDegrees(theta);
		System.out.println(theta);

	}

}


Measured memory_bytes: 25172
import java.util.*;

public class Main{
	void yes(){
		System.out.println("yes");
	}

	void no(){
		System.out.println("no");
	}

	public void run(){
		Scanner scan = new Scanner(System.in);
		while(true){
			String s = scan.nextLine();
			if(s.equals(".")) break;
			Deque<Integer> stack = new ArrayDeque<Integer>();
			String[] sArray = new String[s.length()];
			for (int i = 0; i < s.length(); i++) {
    			// ??????????????????????´???????
    			sArray[i] = String.valueOf(s.charAt(i));
			}
			/*
			for (int i = 0; i < sArray.length; i++) {
    			// "sArray"???1??????????????¨???
    			System.out.println("strArray???????´???????" + i + "?????????" + sArray[i]);
			}
			*/
			//System.out.println("0");
			for (int i=0;i<sArray.length;i++) {
    			if(sArray[i].equals("(")) stack.push(1);
    			if(sArray[i].equals("[")) stack.push(2);
    			//System.out.print("0");
    			if(sArray[i].equals(")")) {
    				Integer a = stack.poll();
    				if(a == null || a == 2) {
    					no();
    					break;
    				}
    			}
    			if(sArray[i].equals("]")){
    				Integer a = stack.poll();
    				if(a == null || a == 1){
						no();
    					break;
    				}
    			}
    			if(sArray[i].equals(".")){
    				if(stack.size() == 0) yes();
    				else no();
    			}
			}
        }
	}

    public static void main(String[] args){
                Main  app = new Main();
		app.run();
    }
}

Measured memory_bytes: 57248
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
int main(void){
    int p,q,r,ans = 100000;
    cin >> p >> q >> r;
    ans = min(ans,p+q);
    ans = min(ans,q+r);
    ans = min(ans,r+p);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

using namespace std;

#define int long long

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



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

int main() {
	int N(0);
	std::cin >> N;

	std::string S("");
	std::string T("");

	std::cin >> S >> T;

	std::string result("");

	for (int i = 0; i < N; ++i) {
		result += S.at(i);
		result += T.at(i);
	}


	std::cout << result;

	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define output(x) cout<<x<<endl;
typedef long long int ll;



int main()
{
	ll  i, j, k, l, m, sum, flag, N, x, y, M, K;
	sum = 0;
	flag = 0;
	cin >> N;
	vector<ll>p(N);
	REP(i, 0, N) {
		cin >> p[i];
	}
	i = 0;
	j = 0;
	ll ans = 0;
	while (i < N) {
		if (p[i] == i + 1) {
			j++;
			i++;
		}
		else {
			if (j != 0) {
				ans += (j - 1) / 2 + 1;
			}
			
			j = 0;
			i++;
		}
	}
	if (j != 0) {
		ans += (j-1) / 2 + 1;
	}
	output(ans);
	
	return 0;
}













Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

class Stack {
    public:
    Stack(): v(100, 0){
        top = 0;
    }
    ~Stack(){}

    void Push(int arg) {
        top++;
        v[top] = arg;
    }

    int Pop() {
        top--;
        return v[top + 1];
    }

    private:
    int top;
    vector<int> v;
};

int main()
{
    int a, b;
    Stack stack;

    string s;
    while (cin >> s) {
        if (cin.eof()) {
            break;
        }
        if (s[0] == '+') {
            int a, b;
            b = stack.Pop();
            a = stack.Pop();
            stack.Push(a + b);
        } else if (s[0] == '-') {
            b = stack.Pop();
            a = stack.Pop();
            stack.Push(a - b);
        } else if (s[0] == '*') {
            b = stack.Pop();
            a = stack.Pop();
            stack.Push(a * b);
        } else {
            stack.Push(atoi(s.c_str()));
        }
    }

    cout << stack.Pop() << endl;

    return 0;
}



Measured memory_bytes: 3208
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count =0;
		int A[] = new int[N];
		boolean b = false;
		for (int i=0;i<N;i++) {
			A[i] = sc.nextInt();
			if (A[i]==1) {
				b=true;
			}
		}
		if (!b) {
			System.out.println(-1);
			return ;
		}
		int now =1;
		for (int i=0;i<N;i++) {
			if (A[i]==now) {
				now++;
			} else {
				count ++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 60480
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
    
        while(true){
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a==0&&b==0) break;
            for(int i=0;i<a;i++){
                for(int j=0;j<b;j++){
                if((i+j)%2==0){
                    System.out.printf("#");
                }else{
                    System.out.printf(".");
                }
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 65076
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
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 long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

	ll n, m,nkai=1,mkai=1;
	cin >> n >> m;
	for (ll i = n; i >= 1; i--) {
		nkai *= i;
		nkai %= MOD;
	}
	for (ll i = m; i >= 1; i--) {
		nkai *= i;
		nkai %= MOD;
	}
	if (n == m)return cout << (2 * (nkai % MOD * mkai % MOD))%MOD << endl, 0;
	else if (abs(n - m) == 1)return cout << (nkai % MOD * mkai % MOD)%MOD << endl, 0;
	else cout << 0 << endl;
}



Measured memory_bytes: 256
import copy

def insertionSort(A,n,g,cnt):

	for i in range(g,n):
		v = A[i]
		j = i - g
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j = j - g
			cnt[0] += 1
		A[j+g] = v

def shellSort(A,n,cnt):

	G = []

	#Creating h array
	h = 1
	while True:
		if h > n:
			break
		G.append(h)
		h = 3*h + 1

	# Calling insertionSort
	for i in range(len(G)-1,-1,-1):
		insertionSort(A,n,G[i],cnt)

	return G

def test():

	A = []
	cnt = []
	n = int(input())

	cnt.append(0)
	for i in range(n):
		tmp = int(input())
		A.append(tmp)

	G = shellSort(A,n,cnt)

	print(len(G))
	for i in range(len(G)-1,0,-1):
		print(f"{G[i]} ",end='')
	print(f"{G[0]}")

	print(cnt[0])
	for i in range(n):
		print(A[i])

if __name__ == "__main__":
	test()



Measured memory_bytes: 46064
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> x(n+1, 0);
    rep(i, m){
        int l, r;
        cin >> l >> r;
        x[l-1]++;
        x[r]--;
    }
    rep(i, n) x[i+1] += x[i];
    int ans = 0;
    rep(i, n)if(x[i] == m) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////





int main() {

	string S;
	cin >> S;

	ll a = 0;

	rep(i, S.size()) {
		if (S[i] == 'A') { a = i; break; }
	}

	ll z = S.size() - 1;

	for (ll i = S.size() - 1; i >= 0; i--) {
		if (S[i] == 'Z') { z = i; break; }
	}

	cout << z - a + 1;
	system("PAUSE");
}


Measured memory_bytes: 764
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long> vl;
typedef vector<vector<long> > vvl;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int N;
    cin >> N;
    vi heights = input<int>(N);    

    int hotels = 1;
    int highest = heights[0];

    for (int i = 1; i < N; ++i) {
        if (highest <= heights[i]) {
            hotels++;
            highest = heights[i];
        }
    }
    cout << hotels << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long x = scan.nextLong();
    long z = 100;
    int sum = 0;
    while (z<x){
      long g = (long) z/100;
      z+=g;
      sum += 1;
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 35640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);


int main() {
  int n;
  cin >> n;
  vector<int> t(n);
  rep(i,n) cin >> t[i];
  vector<int> u(n);
  rep(i,n) u[i]=t[i];
  int m;
  cin >> m;
  rep(i,m){
    int p, x;
    cin >> p >> x;
    t[p-1]=x;
    int sum=0;
    rep(i,n) sum+=t[i];
    cout << sum << endl;
    t[p-1]=u[p-1];
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool used[10];
ll num,maxd=0,ans,len,X,d[10];

void dfs(int x){
  if(x==len){
    ll a=0;
    for(int i=0;i<len;i++)
      a=a*10+d[i];
    if(maxd<=min(abs(num-a),X-abs(num-a))){
      if(maxd==min(abs(num-a),X-abs(num-a)))
	ans=min(ans,a);
      else ans=a;
      maxd=min(abs(num-a),X-abs(num-a));
    }
    return;
  }
  for(int i=0;i<10;i++){
    if(used[i])continue;
    used[i]=true;
    d[x]=i;
    dfs(x+1);
    used[i]=false;
  }
}

ll stoi(string s){
  ll res=0;
  for(int i=0;i<s.size();i++)res=res*10+s[i]-'0';
  return res;
}

int main(){
  string s;
  cin>>s;
  num=stoi(s);
  len=s.size();
  X=1;
  for(int i=0;i<len;i++)X*=10;
  dfs(0);
  if(!(ans-ans%(X/10)))cout<<0;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3184
while True:
    i = input().split()
    result = 0
    if i[1] == '+':
        result = int(i[0]) + int(i[2])
    elif i[1] == '-':
        result = int(i[0]) - int(i[2])
    elif i[1] == '*':
        result = int(i[0]) * int(i[2])
    elif i[1] == '/':
        result = int(i[0]) // int(i[2])
    elif i[1] == '?':
        break

    print(result)

Measured memory_bytes: 6724
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const W = parseInt(arg[0].split(" ")[0]);
    const H = parseInt(arg[0].split(" ")[1]);
    const x = parseInt(arg[0].split(" ")[2]);
    const y = parseInt(arg[0].split(" ")[3]);
    
    if(W / 2 === x && H / 2 === y) {
      console.log((W * H) / 2, 1);
    } else {
      console.log((W * H) / 2, 0);
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7628
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>inp(k);
    for(auto&t:inp)cin>>t;
    inp.push_back(-1);
    int en=n;
    while(1){
        int num=en;
        bool flag=false;
        while(num!=0){
            int tes=num%10;
            if(find(inp.begin(),inp.end(),tes)!=inp.end()){
                flag=true;
                break;
            }
            num/=10;
        }
        if(!flag){cout<<en<<endl;return 0;}
        en++;
    }
    return 0;
}


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

using namespace std;

int main() {
    int a, b; cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    }
    if (a > b) {
        cout << "a > b" << endl;
    }
    if (a == b) {
        cout << "a == b" << endl;
    }
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define at(x,i) get<i>(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
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;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll ans=0;
int main(){
    ll n,m,q;cin >> n >>m >>q;
    vpl t(m);
    rep(i,m){cin >> t[i].fi >>t[i].se;t[i].fi--;t[i].se--;}
    vvl v(n,vl(n,0));
    rep(i,n){
        rep(j,m){
            if(t[j].fi>=i)v[i][t[j].se]++;
        }
    }
    vvl cusum(n,vl(n+1,0));
    rep(i,n){
        rep(j,n){
            cusum[i][j+1]+=cusum[i][j]+v[i][j];
        }
    }
    rep(i,q){
        ll l,r;cin >> l >>r;l--;r--;
        ll ans=cusum[l][r+1];
        cout <<ans <<endl;
    }
}

Measured memory_bytes: 8064
/*
g++ -std=c++11 -o2 -Wall AISing2019A.cpp -o .\out\AISing2019A.out
.\out\AISing2019A.out
*/

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

typedef long long ll;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, h, w;
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << "\n";
}


Measured memory_bytes: 256