akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double w,h,x,y;
    cin >> w >> h >> x >> y;
    printf("%.9lf %d\n",(double)w*h/2,w==x*2 && h==y*2);
}


Measured memory_bytes: 256
#include<stdio.h>

int A[500000];

void maxHeapify(int i,int H)
{
  int l,r,largest,x = 0;

  l = 2 * i;
  r = 2 * i + 1;

  if( l <= H && A[l] > A[i]) largest = l;
  else largest = i;

  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i)
    {
      x = A[i];
      A[i] = A[largest];
      A[largest] = x;
      maxHeapify(largest,H);
    }
}

int main()
{
  int H,i = 0;

  scanf("%d",&H);

  for(i = 1;i <= H;i++)
    {
      scanf("%d",&A[i]);
    }

  for(i = H / 2;i >= 1;i--){
    maxHeapify(i,H);
  }

  for(i = 1;i <= H;i++)
    {
      printf(" %d",A[i]);
    }
  printf("\n");

  return 0;
}



Measured memory_bytes: 3672
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 200005
#define mod 1000000000
using namespace std;

typedef pair<int, int> P;

int a, b, c, k;

int main()
{
    cin >> a >> b >> c >> k;
    int ans = 0;
    if (k <= a)
    {
        printf("%d\n", k);
        return 0;
    }
    if (k <= a + b)
    {
        printf("%d\n", a);
        return 0;
    }
    printf("%d\n", a - (k - a - b));

    return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int x;
  cin >> x;
  
  int ans = x;
  for(int i = x; i < 2*x; i++){
    bool flag = true;
    for(int j = 2; j < x; j++){
      if(0 == i%j){
        flag = false;
        break;
      }
    }
    if(flag){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

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


int main(){
  int x,y;
  while( cin >> x >> y && (x||y) ){
    unordered_map<int,int> mp;
    int cnt = 0;
    while( !mp.count( x%y ) ){
      if( x%y == 0 ) break;
      mp[ x%y ] = cnt++;
      x%=y;
      x*=10;
    }
    if( x % y == 0 ){
      cout << cnt << " " << 0 << endl;
    } else {
      cout << mp[ x%y ] << " " << cnt - mp[ x%y ] << endl;
    }
  }
}

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

#ifdef SG
	#include <debug.h>
#else
	template<typename T> struct outputer;
	struct outputable {};
	#define PRINT(...)
	#define OUTPUT(...)
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
	#define fbegin(...)
	#define fend
	#define pbegin(...)
	#define pend
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb emplace_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef int64_t ll;
typedef uint64_t ull;
typedef uint32_t ui;
typedef uint16_t us;
typedef uint8_t uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 100000;

struct Input {
	int n;
	vi e[N];
	
	bool read () {
		if (!(cin >> n)) {
			return 0;
		}
		forn (i, n - 1) {
			int x, y;
			scanf("%d%d", &x, &y);
			--x;
			--y;
			e[x].pb(y);
			e[y].pb(x);
		}
		return 1;
	}

	void init (const Input &input) {
		*this = input;
	}
};

struct Data: Input {
	bool ans;
	
	void write () {
		puts(ans ? "First" : "Second");
	}
};


namespace Main {
	
	struct Solution: Data {
		int dfs (int v, int pr) {
			int cnt = 0;
			forn (i, sz(e[v])) {
				if (e[v][i] == pr) {
					continue;
				}
				int res = dfs(e[v][i], v);
				if (res == 2) {
					debug(mt(v, pr));
					return 2;
				}
				cnt += res;
			}
			debug(mt(v, pr, cnt));
			if (cnt > 1) {
				return 2;
			}
			return !cnt;
		}
		
		void solve () {
			ans = dfs(0, -1) != 0;
		}
		
		void clear () {
			*this = Solution();
		}
	};
}


Main::Solution sol;

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);

	#ifdef SG
		freopen((problemname + ".in").c_str(), "r", stdin);
//		freopen((problemname + ".out").c_str(), "w", stdout);
		while (sol.read()) {
			sol.solve();
			sol.write();
			sol.clear();
		}
	#else
		sol.read();
		sol.solve();
		sol.write();
	#endif
	
	/*
	int t;
	cin >> t;
	forn (i, t) {
		sol.read();
		sol.solve();
		sol.write();
		sol.clear();
	}
	*/
	
	return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<string> s(N, "");
  REP(i, N){
    string S; cin >> S;
    sort(S.begin(), S.end());
    s[i] = S;
  }
  sort(s.begin(), s.end());
  ll ans = 0, cnt = 0;
  REP(i,N){
    if(i){
      if(s[i-1] == s[i]){
        cnt++;
      }else if(cnt != 0){
        ans += (cnt+1)*cnt/2;
        cnt = 0;
      }
    }
  }
  if(cnt != 0) ans += (cnt+1)*cnt/2;
  cout << ans << endl;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define inf 1000000000
#define eps (1e-11)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

Point median_Point(Point a,Point b){
  Vector v=a-b;
  return b+(v/2);
}

Point Convexcut(Polygon p){
  Point res(inf,inf),tmp;
  int n=p.size();
  for(int i=0;i<n/2;i++){
    if(res.x==inf){
      res=median_Point(p[i],p[i+n/2]);
    }
    else {
      tmp=median_Point(p[i],p[i+n/2]);
      if((res.x-tmp.x)>eps || (res.y-tmp.y)>eps)return Point(inf,inf);
    }
  }
  return res;
}

int main()
{
  int n;
  Polygon p;

  cin>>n;
  p.resize(n);
  for(int i=0;i<n;i++)cin>>p[i].x>>p[i].y;

  if(n%2==1){
    cout<<"NA"<<endl;
  }else {
    Point ans=Convexcut(p);
    if(ans.x==inf)cout<<"NA"<<endl;
    else printf("%.10f %.10f\n",ans.x,ans.y);
  }
  return 0;
}

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

int main() {
  int i;
  int counter = 0;
  int ng_flag = 0;
  string str;
  /* 取り込み */
  cin >> str;
  if(str[0] == str[1]) counter++;
  if(str[0] == str[2]) counter++;
  if(str[0] == str[3]) counter++;
  if(counter != 1) ng_flag = 1;
  
  counter = 0;
  if(str[1] == str[0]) counter++;
  if(str[1] == str[2]) counter++;
  if(str[1] == str[3]) counter++;
  if(counter != 1) ng_flag = 1;
  
  counter = 0;
  if(str[2] == str[0]) counter++;
  if(str[2] == str[1]) counter++;
  if(str[2] == str[3]) counter++;
  if(counter != 1) ng_flag = 1;
  
  counter = 0;
  if(str[3] == str[0]) counter++;
  if(str[3] == str[1]) counter++;
  if(str[3] == str[2]) counter++;
  if(counter != 1) ng_flag = 1;

  if(ng_flag == 1){
    cout << "No" << endl;
  }
  else
  {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



/* TEMPLATE ENDS HERE */

#define MAXN (1 << 11)

mod dp[MAXN][MAXN];

int main() {
	cout << fixed << setprecision(12);	
	int s;
	cin >> s;
	dp[0][0] = 1;
	mod ret = 0;
	for (int i = 1; i <= s / 3; i++) {
		for (int j = 3 * i; j <= s; j++) {
			if (j == 3 * i) {
				for (int k = 3; k <= j; k++) {
					dp[i][j] += dp[i - 1][j - k];
				}
			} else {
				dp[i][j] = dp[i][j - 1] + dp[i - 1][j - 3];
			}
		}
		ret += dp[i][s];
	}
	cout << ret << endl;
	return 0;
}



Measured memory_bytes: 36364
#include <bits/stdc++.h>
using namespace std;
char s[15];
int main(){
    scanf("%s", s);   
    int k = strlen(s);
    int ans = 0;
    for(int i=0;i<k;i++) if(s[i] == 'o') ans++;
    if(ans + 15-k >= 8) printf("YES\n");
    else printf("NO\n");
}

Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}


const int dm = 1400000;
char dn[dm], * di = dn;
const int MAX = 20000;
class unko {
public:
	char C[MAX * 7 + 10], *K[MAX + 10];
	constexpr unko() : C(), K() {
		auto di = C + 3;
		C[0] = '0';
		C[0] = ' ';
		C[0] = '\n';
		K[0] = C;
		K[1] = di;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			*di++ = ' ';
			*di++ = '\n';
			K[i + 1] = di;
		}
	}
};
constexpr unko f;
inline void putint(int X) {
	if (X > 20000) {
		int ue = X / 10;
		for (auto i = f.K[ue]; *i != ' '; i++) *di++ = *i;
		*di++ = '0' + X % 10;
		*di++ = ' ';
	}
	else for (auto i = f.K[X]; *i != '\n'; i++)* di++ = *i;
}

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


	int N = getint(), K = getint();

	int A[200001];
	rep(i, N) A[i] = getint();
	ll owa = ll(N) * N;

	rep(p, K) {
		int B[200001] = {};
		rep(i, N) {
			B[max(0, i - A[i])]++;
			B[min(N, i + A[i] + 1)]--;
		}
		ll kei = B[0];
		A[0] = B[0];
		rep1(i, N - 1) {
			kei += (A[i] = A[i - 1] + B[i]);
		}
		if (kei == owa) break;
	}

	rep(i, N) putint(A[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 7288
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
//-std=c++11
#define print(x) printf("%.12f",x);
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define repr(i, n) for(int i=n-1;i>=0;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Repr(i,a,b) for(int i=a;i>=b;i--)
#define pii pair < int, int >
#define iter ::iterator
#define forit(a) for(it=a.begin();it!=a.end();it++)
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod = inf + 7;
const int N = (int)2e5 + 5;



void solve(){
		int n;
		cin>>n;
		int a[n];
		int sum=0,maxx=-1e8;
		rep(i,n){
			cin>>a[i];
			sum+=a[i];
			maxx=max(maxx,a[i]);
		}
		sum-=maxx;
		sum-=maxx;
		//cout<<sum<<endl;
		cout<<(sum>0?"Yes":"No");

}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    vector<int> list(5);
    for (int i = 0; i < 5; i++)
        cin >> list[i];
    for (int i = 0; i < 5; i++)
        if (list[i] == 0)
            cout << i + 1;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

int main(){
	ll a, b, c; cin >> a >> b >> c;
	if (a == b) cout << c << endl;
	else if (a == c) cout << b << endl;
	else if (b == c) cout << a << endl;
	return 0;
}

Measured memory_bytes: 384
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
	
	var n = parseInt(tmp[0], 10);
	var x = parseInt(tmp[1], 10);
	var t = parseInt(tmp[2], 10);
	
	//console.log("n:" + n);
	//console.log("x:" + x);
	//console.log("t:" + t);
	
	var a = Math.ceil(n / x);
	var result = a * t;
	
	console.log(result);
	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29636
n, m = map(int, input().split())
alist = list(map(int, input().split()))

blist = [0]
for a in alist:
  blist.append(blist[-1] + a)

bdic = {}
for b in blist:
  rb = b % m
  if rb in bdic:
    bdic[rb] += 1
  else:
    bdic[rb] = 1

ans = 0
for v in bdic.values():
  if v >= 2:
    ans += ((v-1)*v) // 2
print(ans)


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

using namespace std;

int main()
{
    vector<int> H, W;
    for(;;){
        int h, w;
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        H.push_back(h);
        W.push_back(w);
    }
    
    for(int i = 0; i < H.size(); i++){
        for(int h = 0; h < H.at(i); h++){
            for(int w = 0; w < W.at(i); w++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }

}


Measured memory_bytes: 3128
ai = lambda: list(map(int, input().split()))

n = int(input())
a = ai()
b = ai()
d = [b[i] - a[i] for i in range(n)]
s,t = 0,0
for i in d:
    if i > 0:
        s += -(-i//2)
        t += i%2
    else:
        t += -i
if s<t:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    /*
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    */
    
    
    int a, b;
    cin >> a >> b;
    if (10 <= a) cout << -1 << endl;
    else if (10 <= b) cout << -1 << endl;
    else cout << a * b << endl;

}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static long X;

	public static void main(String[] args) {
		int N = sc.nextInt();
		X = sc.nextInt();
		Exam[] exs = new Exam[N];
		for (int i = 0; i < N; i++) {
			long B = Long.parseLong(sc.next());
			long L = Long.parseLong(sc.next());
			long U = Long.parseLong(sc.next());
			exs[i] = new Exam(B, L, U);
		}
		Arrays.sort(exs);
		long point = 0;
		for (int i = 0; i < N; i++) {
			point += exs[i].b * exs[i].l;
		}
		int t = N;
		while (point > 0) {
			t--;
			point -= exs[t].value();
		}
		if (t < N) {
			point += exs[t].value();
			t++;
		}
		long base = (N - t) * X;
		long ans = Long.MAX_VALUE;
		for (int i = 0; i < t; i++) {
			long use = (point + exs[i].l - 1) / exs[i].l;
			ans = Math.min(ans, base + use);
			use = (point + exs[i].b * (exs[i].u - exs[i].l) + exs[i].u - 1) / exs[i].u;
			ans = Math.min(ans, base + use);
		}
		for (int i = t; i < N; i++) {
			long cp = point + exs[i].value() - exs[t - 1].value();
			long use = (cp + exs[i].l - 1) / exs[i].l;
			ans = Math.min(ans, base + use);
			use = (cp + exs[i].b * (exs[i].u - exs[i].l) + exs[i].u - 1) / exs[i].u;
			ans = Math.min(ans, base + use);
		}
		System.out.println(ans);
	}

	static class Exam implements Comparable<Exam> {
		long b, l, u;

		public Exam(long b, long l, long u) {
			this.b = b;
			this.l = l;
			this.u = u;
		}

		@Override
		public int compareTo(Exam o) {
			return Long.compare(this.value(), o.value());
		}

		long value() {
			return this.u * X - (this.u - this.l) * this.b;
		}
	}

}


Measured memory_bytes: 67900
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
      	
      	int ans = a - b * 2;
      	if (ans <= 0) {
          ans = 0;
        } 
      
      	System.out.print(ans);
          
          
            

    }
}

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

using namespace std;

int main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int L[2 * n];
    for(auto &it: L)
        cin >> it;
    sort(L, L + 2 * n);
    int ans = 0;
    for(int i = 0; i < 2 * n; i += 2)
        ans += L[i];
    cout << ans << "\n";
    return 0;
}


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

static const int INF = (1<<29);
int N;
int a[109];

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

  int sum=0;
  for(int i=0;i<N;i++) sum += a[i];

  int ans = INF;
  for(int i=(-100);i<=100;i++){
    int cost = 0;
    for(int j=0;j<N;j++){
      cost += (a[j]-i) * (a[j]-i);
    }
    ans = min(ans,cost);
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;


class island{
public:
	int jewel;
	int limit;
	bool operator<(island const &il)const{
		return il.limit>this->limit;
	}

};

int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<island> vi;
		for(int i = 0; i < n; i++){
			island il;
			cin >> il.jewel >> il.limit;
			vi.push_back(il);
		}
		sort(vi.begin(),vi.end());
		int have=0;
		bool f = true;
		for(int i = 0; i < n; i++){
			have+=vi[i].jewel;
			if(have > vi[i].limit){
				f=false;
				break;
			}
		}
		if(f){
			cout << "Yes" << endl;
		}
		else
			cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int n, q, a[2000], M;

void getint(int s[], int x){
    for(int i=0 ; i<x ; i++)
        scanf("%d", &s[i]);
}

int solve(int i, int m){ //i番目以降の要素でmを作れるかの判定
    if(m == 0)      return 1;
    else if(i >= n) return 0;
    int res = solve(i+1, m) || solve(i+1, m-a[i]);
    return res;
}

int main(){
    scanf("%d", &n);
    getint(a, n);
    scanf("%d", &q);
    for(int i=0 ; i<q ; i++){
        scanf("%d", &M);
        if(solve(0, M)) printf("yes\n");
        else            printf("no\n");
    }
    return 0;
}


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

int main() {
  int a, b, c, d;
  std::cin >> a >> b >> c >> d;

  const auto dif = std::min(b, d) - std::max(a, c);
  std::cout << std::max(dif, 0) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}



int main(){

    int a[3][3];
    rep(i,3) {
        rep(j, 3) cin >> a[i][j];
    }
    int n;
    cin >> n;
    int b[n];
    rep(i,n) cin >> b[i];

    bool flag[3][3];
    rep(i,3){
        rep(j,3) {
            flag[i][j] = false;
            rep(k,n) {
                if (a[i][j] == b[k]) {
                    flag[i][j] = true;
                }
            }
        }
    }

    bool ans = false;
    rep(i,3) {
        if (flag[i][0] && flag[i][1] && flag[i][2]) ans = true;
        else if (flag[0][i] && flag[1][i] && flag[2][i]) ans = true;
    }
    if (flag[0][0] && flag[1][1] && flag[2][2]) ans = true;
    else if (flag[0][2] && flag[1][1] && flag[2][0]) ans = true;



    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;



    





}



//              g++ -std=c++1z


Measured memory_bytes: 1016
n=gets.to_i
a=gets.split.map &:to_i
b=(gets.split.map &:to_i).reverse
c=[a[0]];d=[b[0]]
for k in 1...n
c<<c[-1]+a[k]
d<<d[-1]+b[k]
end
m=0
for k in 0...n
s=c[k]+d[n-k-1]
m=s if m<s
end
p m

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

const long long N=1000;

const long long MOD=1000*1000*1000+7;

vector<long long >Primes((N+1),1);

void sieve()
 {
         Primes[0]=0;
         Primes[1]=0;

					for(long long i=2;i<=sqrt(N);i++)
					{
							if(Primes[i]==1)
							{
							 	for(long long j=i;i*j<=N;j++)
							 	{
									 Primes[i*j]=0;
								}
							 }
					}
 }

 long long ans(long long n)
 {
     long long a=1;
     for(long long i=2;i<=n;i++)
     {
         if(Primes[i])
         {
             long long sum=0,x=i;
             while(x<=n)
             {
                 sum+=(n/x);
                 x*=i;
             }
             a*=(sum+1);
             a%=MOD;
         }
     }
    return a;
 }

int main()
{
  	sieve();
  	long long n;
  	cin>>n;
  	cout<<ans(n)<<endl;
}


Measured memory_bytes: 256
def main():
    from sys import stdin
    s = str(stdin.readline().rstrip())
    n = len(s)
    dp = [0]*(n+1)
    g = set({"A","T","C","G"})
    l ="0"+s
    for i in range(1,n+1):
        if l[i] in g:
            dp[i]=dp[i-1]+1
        else:
            dp[i]=0
    
    print(max(dp))
main()

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
 
const int inf = (int)1e18 + 10;


signed main(){
  fast;
  

  int a ;
  string s;
  cin >> a;
  cin >> s;
  if(a < 3200){
    cout << "red\n";
    return 0;
  }
  else{
    cout << s << endl;
  }

 
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int i, n, a=0, b=0;
  for(i=0; i<4; i++){
    scanf("%d", &n);
    a += n;
  }
  for(i=0; i<4; i++){
    scanf("%d", &n);
    b += n;
  }
  printf("%d\n", (a>b) ? a : b);
  return 0;
}

Measured memory_bytes: 592
MOD = 1000000007
H,W,K=map(int,input().split())
##Precalculation            
num = [[0 for _ in range(W)] for _ in range(W)]
for value in range(2**(W-1)):
    bit = [False for _ in range(W-1)]
    for d in range(W-1):
        bit[d] = (2**d & value) > 0
    duplicate = False
    for d in range(1,W-1):
        if bit[d] and bit[d-1]:
            duplicate = True
            break
    if duplicate:
        continue
    ##No Duplicate Assured
    for x in range(W):
        num[x][x] += 1
    for d in range(W-1):
        if bit[d]:
            num[d][d+1] += 1
            num[d+1][d] += 1
            num[d][d] -= 1
            num[d+1][d+1] -= 1
##Time to Dynamic Programming YEAHHHHHH##
dp = [[0 for _ in range(W)] for _ in range(H+1)]
dp[0][0] = 1
for h in range(1,H+1):
    for k in range(W):
        for j in range(W):
            dp[h][k] += (dp[h-1][j]*num[j][k])%MOD
            dp[h][k] %= MOD
print(dp[H][K-1])

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  string A, B; cin >> A >> B;
  int a, b; cin >> a >> b;
  string C; cin >> C;
  if (A == C) a--;
  if (B == C) b--;
  cout << a << " " << b << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        x: usize
    }
    if x == 0 {
        println!("1");
    } else {
        println!("0");
    }
    
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


Measured memory_bytes: 2148
#include <iostream>
using namespace std;
int n;
long a[100010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n;

    long ans = 0, neg = 0;
    bool zero = false;
    for(int i=0; i < n; ++i) {
        cin >> a[i];
        ans += abs(a[i]);
        if(a[i] == 0) zero = true;
        if(a[i] <  0) ++neg;
    }

    if(neg % 2 == 0 || zero) {
        cout << ans << endl;
        return 0;
    }

    long minus = abs(a[0]);
    for(int i = 1; i < n; ++i) minus = min(minus, abs(a[i]));

    cout << ans - minus * 2 << '\n';
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    ll N;
	cin >> N;
	
	vector<ll>X(N), Y(N);
	map<P, ll>cnt;
	rep(i, N){
		cin >> X[i] >> Y[i];
		ll w;
		cin >> w;
		cnt[P(X[i], Y[i])] = w;		
	}
	ll ans = 0;

	rep(i, N){
		ll x = X[i];
		ll y = Y[i];
		chmax(ans, cnt[P(x, y)] + cnt[P(x + 1, y)] + cnt[P(x, y + 1)] + cnt[P(x + 1, y + 1)]);
		chmax(ans, cnt[P(x, y)] + cnt[P(x + 1, y)] + cnt[P(x, y - 1)] + cnt[P(x + 1, y - 1)]);
	}
	cout << ans << " / 1" << endl;

    return 0;
}


Measured memory_bytes: 41852
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main(){
	ll N,C;
	cin>>N>>C;
	ll ans=0;
	vll X,V;
	for(int i=0;i<N;i++){
		ll x,v;
		cin>>x>>v;
		X.pb(x);
		V.pb(v);
	}
	//Wに、その番号の寿司まで取ったときの摂取カロリーの累積和を入れる
	vll W={V[0]};
	for(int i=1;i<N;i++)
		W.pb(W.back()+V[i]);
	//Uに、その番号の寿司まで逆から取ったときの摂取カロリーの累積和を入れる
	vll U(N);
	U[N-1]=V[N-1];
	for(int i=N-2;i>=0;i--)
		U[i]=U[i+1]+V[i];

	//Yに、その番号の寿司までの間で、行って帰ってくるのが最も得になる場合のスコアを入れる
	vll Y={max(0LL,W[0]-2*X[0])};
	for(int i=1;i<N;i++)
		Y.pb(max(Y.back(),W[i]-2*X[i]));
	//Zに、その番号の寿司までの間で、逆から行って帰ってくるのが最も特になる場合のスコアを入れる
	vll Z(N);
	Z[N-1]={max(0LL,U[N-1]-2*(C-X[N-1]))};
	for(int i=N-2;i>=0;i--)
		Z[i]=max(Z[i+1],U[i]-2*(C-X[i]));
	ans=max(ans,U[0]-C+X[0]);
	for(int i=N-1;i>=1;i--)
		ans=max(ans,Y[i-1]+U[i]-C+X[i]);
	ans=max(ans,W[N-1]-X[N-1]);
	for(int i=0;i<N-1;i++)
		ans=max(ans,Z[i+1]+W[i]-X[i]);

	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5100
n=int(input())
x=[]
for i in range(n):
    a,b=input().split()
    x.append((float(a),b))
s=0
for i in range(n):
    if x[i][1]=='JPY':
        s+=x[i][0]
    else:
        s+=x[i][0]*38e4
print(s)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
#define ld long double
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactive problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

ll power(ll x, ll y, ll p){
    ll res=1;
    while(y>0){
        if(y%2==1){
            res = (res*x)%mod;
        }
        x = (x*x)%mod;
        y=y/2;
    }
    return res;
}

int main(){ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll n;
    cin>>n;
    
    ll p1 = power(10, n, mod);
    ll p2 = 2*power(9, n, mod);
    ll p3 = power(8, n, mod);
    ll ans = (((((p1-p2)%mod) + mod)%mod) + p3)%mod;
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,K;
  cin>>N>>K;
  ll A[N+2];
  RREP(i,N) cin>>A[i];
  ll SUM[N+2];
  
  REP(k,K){
    bool CAN=true;
    REP(i,N+2) SUM[i]=0;
    RREP(i,N){
      SUM[max(i-A[i],0LL)]+=1;
      SUM[min(i+A[i]+1,N+1)]-=1;
    }
    RREP(i,N) SUM[i]+=SUM[i-1];
    RREP(i,N){
      A[i]=SUM[i];
      if(A[i]!=N) CAN=false;
    }
    
    if(CAN){
      RREP(i,N) cout<<A[i]<<" ";
      cout<<endl;
      return 0;
    }
  }
  
  RREP(i,N) cout<<A[i]<<" ";
  cout<<endl;
  return 0;
}

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

N, A, B, C = [int(x) for x in input().split()]

L = [int(input()) for _ in range(N)]
INF = 10 ** 12

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + L[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + L[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))


Measured memory_bytes: 43996
#include <iostream>

#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)

int main() {

  int m, n, t;
  cin >> m >> n >> t;
  int p;
  cin >> p;
  vector<vector<int>> sum(n, vector<int>(m));
  REP(i, p) {
    int x, y;
    cin >> x >> y;
    sum[y][x]++;
    int t;
    cin >> t;
  }
  vector<vector<int>> a(n, vector<int>(m));
  REP(i, n) REP(j, m) cin >> a[i][j];
  int ans = 0;
  REP(i, n) REP(j, m) if (a[i][j]) ans += sum[i][j];
  cout << ans << endl;
}


Measured memory_bytes: 3184
calc a op b = case op of
	"+" -> a + b
	"-" -> a - b
	"*" -> a * b
	"/" -> a `div` b

main = do
	[sa, op, sb] <- fmap words getLine
	if op == "?" then
		return ()
	else do
		let [a, b] = map read [sa, sb] :: [Int]
		print $ calc a op b
		main

Measured memory_bytes: 4068
/*https://atcoder.jp/contests/abc052/tasks/abc052_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int n, count = 0, max_count = 0;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'I')
			count++;
		else if (s[i] == 'D')
			count--;
		max_count = max(max_count, count);
	}
	cout << max_count;
}

Measured memory_bytes: 3576
import bisect
import sys
sys.setrecursionlimit(10**9)

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

Edge = [[] for _ in range(N)]
for _ in range(N-1):
    u,v = map(int,input().split())
    Edge[u-1].append(v-1)
    Edge[v-1].append(u-1)

visited = [False]*N
visited[0] = True
answer = [1]*N

def dfs(v, dp):
    for nv in Edge[v]:
        if visited[nv]:
            continue
        
        visited[nv] = True
        if len(dp)==0 or A[nv]>dp[-1]:
            dp.append(A[nv])
            answer[nv] = len(dp)
            dfs(nv, dp)
            dp.pop()
        else:
            idx = bisect.bisect_left(dp, A[nv])
            temp = dp[idx]
            dp[idx] = A[nv]
            answer[nv] = len(dp)
            dfs(nv, dp)
            dp[idx] = temp
        
    return 

dfs(0, [A[0]])
answer[0] = 1
for a in answer:
    print(a)




Measured memory_bytes: 224644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000000007

ll seg[2097152];

void eval(int x) {
	if (x > 1048575)return;
	seg[x * 2] += seg[x];seg[x * 2] %= MOD;
	seg[x * 2 + 1] += seg[x];seg[x * 2 + 1] %= MOD;
	seg[x] = 0;
	return;
}

void upd(int s, int t, ll v, int k = 1, int l = 0, int r = 1048575) {
	if (t < l || r < s)return;
	if (s <= l && r <= t) {
		seg[k] += v;
		seg[k] %= MOD;
		return;
	}
	eval(k);
	//cout << s << " " << t << " " << v << " " << k << " " << l << " " << r << endl;
	upd(s, t, v, k * 2, l, (l + r) / 2);
	upd(s, t, v, k * 2 + 1, (l + r) / 2 + 1, r);
}

ll get(ll X) {
	X += 1048576;
	ll ans = seg[X];
	while (X) {
		X /= 2;
		ans += seg[X];
		ans %= MOD;
		eval(X);
	}
	return ans;
}

int main() {
	for (int i = 0;i < (1 << 21);i++)seg[i] = 0;
	ll N;
	cin >> N;
	upd(1, 1, 1);
	//Nまで更新したい

	//1~Nまで…[1…N]を選べる。それぞれ選んだ時、i+1,[i+3…i+N+1]が次に選択可能なマス→セグ木で1加算
	//ただし更新されるはずのN+1からi+N+1までは選択が不可能→この分はセグ木ではなくansに保存 i+1個

	//N-2,N-1…1を選ぶと次を選べる それ以外はセグ木に達してしまうのでアウト Nをかける
	//N…単純に(そこの数)×Nをansに加算

	ll ans = 0;
	for (ll i = 1;i <= N;i++) {
		if (i > N - 3) {
			if (i == N)ans += N * get(i);//1からNのどれかを選ぶので
			else {
				//そこに1を入れる時
				upd(i + 1, i + 1, get(i));
				//1を入れない時
				//1以外を入れる…N-1通り、次のマスに何かを入れる…N通り
				ans += ((N - 1) * N % MOD) * get(i) % MOD;
				ans %= MOD;
			}
		}
		else {
			//そこに1を入れるとき
			upd(i + 1, i + 1, get(i));
			//1を入れない時
			//次のマスに1を入れる時
			upd(i + 3, N, get(i));
			ans += (i + 1) * get(i) % MOD;
			//1を入れない時
			ans += ((N - 1) * (N - 1) % MOD) * get(i) % MOD;
		}
		ans %= MOD;
	}
	cout << ans << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)

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

int s[101][101], ss[101][101];

signed main() {
  int n, m;
  cin >> n >> m;
  rep(i, 0, m) {
    int a, b, c;
    cin >> a >> b >> c;
    s[--a][--b] = c;
    s[b][a] = c;
  }
  rep(i, 0, n) rep(j, 0, n) {
    if(!s[i][j]) s[i][j] = 114514191;
    ss[i][j] = s[i][j];
  }
  rep(i, 0, n) rep(j, 0, n) rep(k, 0, n) {
    s[j][k] = min(s[j][k], s[j][i] + s[i][k]);
  }
  int ans = 0;
  rep(i, 0, n) rep(j, 0, n) {
    if(ss[i][j] != 114514191 && s[i][j] != ss[i][j]) ans++;
  }
  cout << ans / 2 << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int x, y;
  cin >> x >> y;
  cout << x + y/2 << endl;
  return 0;
}

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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= 0; i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll a,b;
int main(){
	cin >> a >> b;
	if(1 <= a && a<= 9 && 1<= b && b <= 9){
		p(a * b);
	}else{
		p(-1);
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
bool dp[8050][32005] = {};
bool can(vector<int> in, int target) {
  memset(dp, false, sizeof(dp));
  dp[0][16000] = true;
  int n = (int) in.size();
  for (int i = 0; i < n; i++) {
    int x = in[i];
    for (int j = 0; j < 32001; j++) {
      if (j - x >= 0) dp[i + 1][j - x] |= dp[i][j];
      if (j + x < 32001) dp[i + 1][j + x] |= dp[i][j];
    }
  }
  return dp[n][16000 + target];
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string in;
  cin >> in;
  int x, y;
  cin >> x >> y;
  if (in.back() == 'F') in += 'T';
  int pre = -1, it = 0;
  vector<vector<int>> v(2);
  for (int i = 0; i < (int) in.size(); i++) {
    if (in[i] == 'T') {
      v[it++ % 2].push_back(i - pre - 1);
      pre = i;
    }
  }
  x -= v[0][0];
  if (can(vector<int>(v[0].begin() + 1, v[0].end()), x) && can(v[1], y)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;	
}

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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long
#define lson node<<1
#define rson (node<<1)+1

const int maxn=1e6+10;
const ll mod=1e9+7;
const double pi=acos(-1);


int main()
{
    ll a,b;
    ll v,w;
    cin>>a>>v;
    cin>>b>>w;
    ll t;
    cin>>t;
    int ok=1;
    if(a>b)
    {
        if(b-w*t<a-v*t)
            ok=0;
        else
            ok=1;
    }
    else
    {
        if(b+w*t<=a+v*t)
            ok=1;
        else
            ok=0;
    }
    if(ok)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	int N;
	int M = 256;
	cin >> N;
	while ( N != 0 ) {
		std::vector<int> I(N);
		for (int i = 0; i < N; i++) {
			cin >> I[i];
		}

		bool find = false;
		int R,O;
		int S,A,C;
		int now;
		double ret = 0;
		for (int s = 0; s < 16 && !(find); s++) {
			for (int a = 0; a < 16 && !(find); a++) {
				for (int c = 0; c < 16 && !(find); c++) {
					std::vector<int> counter(M, 0);
					R = s;

					for (int i = 0; i < N; i++) {
						R = ( (a*R) + c ) % M;
						O = ( I[i] + R ) % M;
						counter[O]++;
					}

					now = 0;
					for (int i = 0; i < M; i++) {
						if ( counter[i] != 0 ) {
							now += -( (double)counter[i]/N ) * std::log((double)counter[i]/N) * pow(10,5);
						}
					}
					if ( now == 0 ) {
						S = s;
						A = a;
						C = c;
						find = true;
					}
					else {
						if ( ret == 0 ) {
							S = s;
							A = a;
							C = c;
							ret = now;
						}
						else {
							if ( now < ret ) {
								S = s;
								A = a;
								C = c;
								ret = now;
							}
						}
					}
				}
			}
		}
		cout << S << " " << A << " " << C << endl;
		cin >> N;
	}
	return 0;
}

Measured memory_bytes: 3284