akhauriyash/Code-Regression huggingface dataset:
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

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

    V<ll> cnt;
    for(ll e : cnt_a) if(e) cnt.push_back(e);
    sort(ALL(cnt));
    V<ll> sum(cnt.size() + 1);
    for(ll i = 0; i < cnt.size(); i++) sum[i + 1] = sum[i] + cnt[i];

    for(ll k = 1; k <= N; k++) {
        ll ok = 0, ng = N + 1;
        while(ng - ok > 1) {
            ll mid = (ok + ng) / 2;
            auto ite = lower_bound(ALL(cnt), mid);
            ll num = distance(ite, cnt.end());
            ll idx = distance(cnt.begin(), ite);
            ll s = sum[idx];
            ll need = mid * k - num * mid;
            if(need <= s) ok = mid;
            else ng = mid;
        }
        cout << ok << endl;
    }
    return 0;
}


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

void dfs(vector<vector<int>> &G, vector<int> &V, int v) {
  V.at(v) = 0;
  queue<int> Q;
  Q.push(v);
  while (Q.size()) {
    int nv = Q.front(); Q.pop();
    for (auto i : G.at(nv)) {
      if (V.at(i) > V.at(nv) + 1) {
        V.at(i) = V.at(nv) + 1;
        Q.push(i);
      }
    }
  }
  return;
}

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  vector<vector<int>> G(N);
  for (int i = 0; i < N - 1; i++) {
    G.at(i).push_back(i + 1);
    G.at(i + 1).push_back(i);
  }
  G.at(--X).push_back(--Y);
  G.at(Y).push_back(X);

  vector<int> ans(N - 1);
  for (int i = 0; i < N; i++) {
    vector<int> V(N, 1e9);
    dfs(G, V, i);
    for (int j = i + 1; j < N; j++) {
      ans.at(V.at(j) - 1)++;
    }
  }

  for (auto i : ans) cout << i << "\n";
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long int LL;
const int Max_N(300050);
const LL INF(0X3F3F3F3F3F3F3F3FLL);

template<typename Type>
void Get_Val(Type &Ret)
{
	Ret = 0;
	char ch;
	while (ch = getchar(), ch > '9' || ch < '0')
		;
	do
	{
		(Ret *= 10) += ch - '0';
	}
	while (ch = getchar(), ch >= '0' && ch <= '9');
}

int N;
LL T[Max_N], Pre[Max_N], L[Max_N], R[Max_N], G[Max_N];

struct node
{
	node(const LL &_x = 0LL, const LL &_y = 0LL) : x(_x), y(_y) {}
	LL x, y;
};
int FT, ED;
node Q[Max_N];

inline bool check(const node &a, const node &b, const node &c)
{
	return (a.y - b.y) * (b.x - c.x) > (b.y - c.y) * (a.x - b.x);
}

inline LL get(LL F[Max_N], LL j)
{
	return F[j] - Pre[j] + (j * j - j) / 2LL;
}

void getPre()
{
	for (int i = 1;i <= N;++i)
		Pre[i] = Pre[i - 1] - T[i];
}

void dp(LL F[Max_N])
{
	getPre();
	Q[FT = ED = 1] = node(0LL, get(F, 0LL));
	for (int i = 1, l, r, mid;i <= N;++i)
	{
		l = FT, r = ED;
		while (l < r)
		{
			mid = l + ((r - l) >> 1);
			if (mid + 1 > ED || Q[mid].y - i * Q[mid].x > Q[mid + 1].y - i * Q[mid + 1].x)
				r = mid;
			else
				l = mid + 1;
		}
		F[i] = max(F[i - 1], Q[l].y - i * Q[l].x + Pre[i] + (i * 1LL * i + i) / 2LL);
		while (FT + 1 <= ED && check(Q[ED - 1], Q[ED], node(i * 1LL, get(F, i * 1LL))) == false)
			--ED;
		Q[++ED] = node(i * 1LL, get(F, i * 1LL));
	}
}

inline LL get(LL i)
{
	return R[i + 1] + Pre[i] + (i * i + i) / 2LL;
}

LL Val[Max_N];
void cdq(int l, int r)
{
	if (l == r)
		return;
	int mid = l + ((r - l) >> 1);
	Q[FT = ED = 1] = node(l * 1LL, get(L, l * 1LL));
	for (int i = l + 1;i <= mid;++i)
	{
		while (FT + 1 <= ED && check(Q[ED - 1], Q[ED], node(i * 1LL, get(L, i * 1LL))) == false)
			--ED;
		Q[++ED] = node(i * 1LL, get(L, i * 1LL));
	}
	Val[r + 1] = -INF;
	for (int i = mid + 1;i <= r;++i)
	{
		while (FT + 1 <= ED && Q[ED].y - i * Q[ED].x < Q[ED - 1].y - i * Q[ED - 1].x)
			--ED;
		Val[i] = Q[ED].y - i * Q[ED].x + Pre[i] + (i * 1LL * i + i) / 2LL + R[i + 1];
	}
	for (int i = r;i >= mid + 1;--i)
		G[i] = max(G[i], Val[i] = max(Val[i], Val[i + 1]));
	Q[FT = ED = 1] = node(mid + 1LL, get(mid + 1LL));
	for (int i = mid + 2;i <= r;++i)
	{
		while (FT + 1 <= ED && check(Q[ED - 1], Q[ED], node(i * 1LL, get(i * 1LL))) == false)
			--ED;
		Q[++ED] = node(i * 1LL, get(i * 1LL));
	}
	Val[0] = -INF;
	for (int i = l;i <= mid;++i)
	{
		G[i] = max(G[i], Val[0]);
		while (FT + 1 <= ED && Q[ED].y - i * Q[ED].x < Q[ED - 1].y - i * Q[ED - 1].x)
			--ED;
		Val[0] = max(Val[0], Q[ED].y - i * Q[ED].x - Pre[i] + (i * 1LL * i - i) / 2LL + L[i]);
	}
	cdq(l, mid), cdq(mid + 1, r);
}

int main()
{
	Get_Val(N);
	for (int i = 1;i <= N;++i)
		Get_Val(T[i]);
	dp(L);
	reverse(T + 1, T + 1 + N), dp(R), reverse(R + 1, R + 1 + N);
	reverse(T + 1, T + 1 + N), getPre(), memset(G, -0X3F, sizeof(G)), cdq(0, N);
	int M;
	Get_Val(M);
	for (int p, x;M--;)
		Get_Val(p), Get_Val(x), printf("%lld\n", max(L[p - 1] + R[p + 1], G[p] + T[p] - x));
	return 0;
}

Measured memory_bytes: 21248
#include<iostream>
#include<string.h>
using namespace std;
int a[15],dp[15];
int main()
{
	int T;
	cin>>T;
	while(T--)
	{
		memset(dp,0,sizeof(dp));
		for(int i=1;i<=10;i++)
		 cin>>a[i];
		int ans=0;
		for(int i=10;i>=1;i--)
		{
			dp[i]++;
		 for(int j=i+1;j<=10;j++)
		  {
		  	if(a[i]>a[j])
		  	 dp[i]=max(dp[i],dp[j]+1);
		  	
		  }
		  ans=max(ans,dp[i]);
	}
		  if(ans>2)
		  cout<<"NO"<<endl;
		  else
		  cout<<"YES"<<endl;
	}
}

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

bool grid[64][64];
bool col[64][64];
int main(){
	int H,W;cin>>H>>W;
	for(int i=0;i<H;i++){
		string s;cin>>s;
		for(int j=0;j<s.size();j++) grid[i][j] = (s[j] == '#'?1:0);
	}
	for(int i=0;i<H-1;i++) for(int j=0;j<W;j++) if(grid[i][j] && grid[i+1][j]) col[i][j] = col[i+1][j] = true;
	for(int i=0;i<H;i++) for(int j=0;j<W-1;j++) if(grid[i][j] && grid[i][j+1]) col[i][j] = col[i][j+1] = true;
	
	for(int i=0;i<H;i++) for(int j=0;j<W;j++) if(grid[i][j] != col[i][j]){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	return 0;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ans= c - a + b;
    if(ans<0) ans=0;
    cout << ans << endl; 
}

Measured memory_bytes: 3616
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const c = input[0][0];

  return "aiueo".includes(c) ? "vowel" : "consonant";
};

console.log(main(read()));


Measured memory_bytes: 29640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll arr[n][3];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	ll ans[n][3];
	ans[0][0]=arr[0][0],ans[0][1]=arr[0][1],ans[0][2]=arr[0][2];
	for(int i=1;i<n;i++)
	{
		ans[i][0]=max(ans[i-1][1],ans[i-1][2])+arr[i][0];
		ans[i][1]=max(ans[i-1][0],ans[i-1][2])+arr[i][1];
		ans[i][2]=max(ans[i-1][0],ans[i-1][1])+arr[i][2];
	}
	cout<<max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]))<<endl;
	return 0;
}

Measured memory_bytes: 4992
S = input()
S = list(S)
S_ = []
for s in S:
    S_.append(int(s))

if len(S_) == 0: 
    ans = 0
    
elif S_[0] == 1:
    r, l = 0, 1 # 右端と左端のインデックス
    ans = 0
    while l < len(S_):
        #print(l)
        if S_[r] > S_[l]:
            r += 1
            l += 1
        elif S_[r] == S_[l]:
            if S_[l-1] == 1:
                S_[l] = 0
                r += 1
                l += 1
                ans += 1
            else:
                S_[l] = 1
                r += 1
                l += 1
                ans += 1
        else:
            r += 1
            l += 1

elif S_[0] == 0:
    r, l = 0, 1 # 右端と左端のインデックス
    ans = 0
    while l < len(S_):
        if S_[r] < S_[l]:
            r += 1
            l += 1
        elif S_[r] == S_[l]:
            if S_[l-1] == 0:
                S_[l] = 1
                r += 1
                l += 1
                ans += 1
            else:
                S_[l] = 0
                r += 1
                l += 1
                ans += 1
        else:
            r += 1
            l += 1
            
print(ans)

Measured memory_bytes: 4780
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e9+7;
const int MOD=1000000007;

signed main(){
  int n,m;cin>>n>>m;
  vector<int> x(m);
  vector<int> sub(m-1);
  rep(i,m)cin>>x[i];
  sort(x.begin(),x.end());
  rep(i,m-1)sub[i]=x[i+1]-x[i];
  sort(sub.begin(),sub.end());
  int res=0;
  rep(i,m-n){
      res+=sub[i];
      //cout<<res<<"\n";
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 4748
#include<stdio.h>
int main(){
    int a, b, i, j;
    for(;;){
        scanf("%d %d",&b,&a);
        if(a+b==0) break;
        for(i=0;i<b;i++){
            for(j=0;j<a;j++)
                 if(i*j==0 || i+1==b || j+1==a)
                    printf("#");
                else
                    printf(".");
            printf("\n");
            }
        printf("\n");
        }
    return 0;
}


Measured memory_bytes: 2048
#include<stdio.h>
int main(){
  int n;
  double a,b=0;
  char s[10];
  scanf("%d",&n);
  while(n--){
    scanf("%lf %s",&a,s);
    b+=(s[0]=='J')?a:a*380000.0;
  }
  printf("%lf\n",b);
  return 0;
}


Measured memory_bytes: 128
S = input()
a = S[0] == "A"
f = 0
for _ in S[2:len(S)-1]:
    if _ == "C":
        f+=1
if f == 1:
    b = True
else:
    b = False

if S.replace("A", "").replace("C","").islower():
    c = True
else:
    c = False

if a and b and c:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 3060
#include <stdio.h>
int main(void){

    int x, y, tmp;

    while(1) {
        scanf("%d", &x);
        scanf("%d", &y); 
        if(x == 0 && y == 0) {
            break;
        }
        if(x>y){
            tmp = y; 
            y = x; 
            x = tmp; 
        }
        printf("%d %d\n", x, y); 
    }

    return 0; 
}



Measured memory_bytes: 2032
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

int n, m, aux;
char x[55][55];

int main(){
    ios::sync_with_stdio(0);
    cin >> n >> m;
    n++; m++;

    forn(i,53){
        forn(j,53){
            x[i][j] = '.';
        }
    }

    forr(i,1,n){
        forr(j,1,m){
            cin >> x[i][j];
        }
    }
    
    forr(i,1,n){
        forr(j,1,m){
            if(x[i][j] == '#') continue;
            aux = 0;
            if(x[i-1][j-1] == '#') aux++;
            if(x[i-1][j]   == '#') aux++;
            if(x[i-1][j+1] == '#') aux++;
            if(x[i][j-1]   == '#') aux++;
            if(x[i][j]     == '#') aux++;
            if(x[i][j+1]   == '#') aux++;
            if(x[i+1][j-1] == '#') aux++;
            if(x[i+1][j]   == '#') aux++;
            if(x[i+1][j+1] == '#') aux++;
            x[i][j] = aux+'0';
        }
    }

    forr(i,1,n){
        forr(j,1,m){
            cout << x[i][j];
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " " << p.second << "}";
	return os;
}

template <typename T>
void say(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}


/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	int x, y;
	cin >> x >> y;
	map<int, int> m;
	m[1] = 1;
	m[2] = 3;
	m[3] = 1;
	m[4] = 2;
	m[5] = 1;
	m[6] = 2;
	m[7] = 1;
	m[8] = 1;
	m[9] = 2;
	m[10] = 1;
	m[11] = 2;
	m[12] = 1;

	yn(m[x] == m[y]);

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int k,n;
  scanf("%d",&k);
  scanf("%d",&n);
  int a[n],i,max;
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  max=a[0]+(k-a[n-1]);
  for(i=1;i<n;i++)
    if(a[i]-a[i-1]>max)
      max=a[i]-a[i-1];
  printf("%d",k-max);
  
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));


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

    int n;
    cin >> n;
    vector<int> d(n);
    rep(i,n){
        cin >> d[i];
    }
    int ans = 0;
    rep(i,n-1)for(int j = i+1;j < n;++j){
        ans += d[i]*d[j];
    }
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
const int maxn = 55;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long a,b,n;
	cin >> a >> b >> n;
	long long x;
	x = min(b-1,n);
	long long ans = (a*x)/b - a*(x/b);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

ll gcd(ll m, ll n ){//最大公約数
	if(n==0) return m;
	return gcd(n, m%n);
}

ll lcm(ll m, ll n ){//最少公倍数
	ll g=gcd(m,n);
	return m/g*n;
}

int main() {
	int N;
	cin >> N;
	ll T[110]={};
	REP(i,N) cin >> T[i];
	ll a;
	if(T[1]!=0) a=lcm(T[0], T[1]);
	else a=T[0];
	FOR(i,2,N) a=lcm(a, T[i]);
	cout << a << endl;
	
	return 0;
}

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

for x in range(n + 1):
    for y in range(n + 1):
        if n-x-y < 0:
            break
        if x * 10000 + y * 5000 + (n - x - y) * 1000 == s:
            print('%d %d %d' % (x, y, n - x - y))
            exit()
print('-1 -1 -1')


Measured memory_bytes: 40812
import java.util.*;

class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      long A = sc.nextLong();
      long B = sc.nextLong();
      long lcm, x, y, tmp;

      if(A < B) {
        x = B;
        y = A;
      } else {
        x = A;
        y = B;
      }
      while ((tmp = x % y) != 0) {
          x = y;
          y = tmp;
      }
      lcm = (A * B) / y;
      System.out.println(lcm);
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>

#define ll long long

using namespace std;

inline int read() {
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int N=1e6+5;

ll a[N];

int main() {
	int n=read();
	ll tot=0;
	for (int i=1;i<=n;i++) {
		a[i]=read();
		tot^=a[i];
	}
	for (int i=1;i<=n;i++) {
		printf("%lld ",a[i]^tot);
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 5196
#include <bits/stdc++.h>
#define MODNum 1000000007
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    int N, K, ans;
    cin >> N >> K;
    vector<int> A(N);
    int Pos;
    REP(int,i,0,N){
        cin >> A.at(i);
    }
    ans = ceil((double)( N - 1 ) / ( K - 1 ));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    char x, y; cin >> x >> y;
    if(x < y) cout << '<' << endl;
    else if(x > y) cout << '>' << endl;
    else cout << '=' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl
#define first(v) get<0>(v)
#define second(v) get<1>(v)
#define third(v) get<2>(v)
template <typename T> bool chmax(T &a, T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    for(ll i=0;i<N;i++){
        cin>>A[i]
    ;}
    vector<ll> sumuntil(N,0);
    vector<ll> sumikou(N,0);
    ll sum=0;
    for(ll i=0;i<N;i++){
        sum+=A[i];
        sumuntil[i]=sum;
    ;}
    sum=0;
    for(ll i=N-1;i>=0;i--){
        sum+=A[i];
        sumikou[i]=sum;
    ;}
    vector<P> izen(N),ikou(N);
    //尺取り法
    ll mark=0;
    for(ll i=1;i<N;i++){
        ll h=sumuntil[i];
        izen[i]=P(max(h-sumuntil[mark],sumuntil[mark]),min(h-sumuntil[mark],sumuntil[mark]));
        while(mark<i-1&&abs(h-2*sumuntil[mark+1])<abs(h-2*sumuntil[mark])){
            mark++;
            izen[i]=P(max(h-sumuntil[mark],sumuntil[mark]),min(h-sumuntil[mark],sumuntil[mark]));
        }
    ;}
    mark=N-1;
    for(ll i=N-2;i>=0;i--){
        ll h=sumikou[i];
        ikou[i]=P(max(h-sumikou[mark],sumikou[mark]),min(h-sumikou[mark],sumikou[mark]));
        while(mark>i+1&&abs(h-2*sumikou[mark-1])<abs(h-2*sumikou[mark])){
            mark--;
            ikou[i]=P(max(h-sumikou[mark],sumikou[mark]),min(h-sumikou[mark],sumikou[mark]));
        }
    }
    ll ans=INF;
    for(ll i=1;i<=N-3;i++){
        ll h=max(izen[i].first,ikou[i+1].first)-min(izen[i].second,ikou[i+1].second);
        chmin(ans,h);
    ;}
    print(ans);

    return 0;
}


Measured memory_bytes: 11136
import sys
from math import sin, cos, radians, hypot

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

a, b, h, m = MAP()

hm = h*60 + m

heach = hm / 720
meach = m / 60
hdig = heach * 360
mdig = meach * 360

hx = a * cos(radians(hdig))
hy = a * sin(radians(hdig))
mx = b * cos(radians(mdig))
my = b * sin(radians(mdig))

ans = hypot(hx-mx, hy-my)
print(ans)


Measured memory_bytes: 9636
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	
	// ある日までにやらなければならないアルバイトのグループとして格納していく
	// 最大でM日まで
	vector<vector<int>> jobs(M);

	for(int i = 0; i < N; i++)
	{
		int A, B;
		cin >> A >> B;

		// AがMを超えている場合はそのアルバイトは絶対にできない
		if(A > M) continue;
		
		// M-A日までにやらなければならないアルバイト
		jobs[M - A].push_back(B);
	}

	// 優先度付きキュー
	// 追加と最大値を取り出す機能を持っている
	priority_queue<int> q;

	long long int ans = 0;
	// 後ろから見ていく（この日までにやらなければいけないアルバイトグループを見ていく）
	// 例：M-1日目には、一日後に報酬がもらえるアルバイトの中で一番報酬が大きいアルバイトを選ぶ
	// また、一日後に報酬がもらえるアルバイトはM-2日目にも行えるのでそのままqueueに残しておく
	for(int i = M-1; i >= 0; i--)
	{
		// jobsのi番目の報酬の配列をpriority_queueに突っ込んでいく
		for(int b : jobs[i])
		{
			q.push(b);
		}
		if(!q.empty())
		{
			// qの最大値を取り出す
			// 現在行うことができるアルバイトの中で報酬が最大のものを選択
			ans += q.top();
			// 取り出した値を削除、一度選択したアルバイトは二度と請けられない
			q.pop();
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5632
N = int(input())
a = list(map(int,input().split()))


count = 0
c = 1

for i in range(N):
    #print(a)
    if c != a[i]:
       # del a[i]
        count += 1
    else:
        c+=1

#print(c-1)
#print(count)
#print(len(a)-count)
if c-1==0 and count > 1:
    print(-1)
else:
    print(count)

Measured memory_bytes: 26524
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  li a; cin >>a;
  double x; cin >>x;
  li b=x*100+0.01;
  print(a*b/100);
}


Measured memory_bytes: 3724
package main

import (
	"fmt"
)

// 以下の問題
// https://atcoder.jp/contests/abc137/tasks/abc137_b

func main() {
	var K, X int
	fmt.Scan(&K, &X)

	for i := X - K + 1; i <= X+K-1; i++ {
		fmt.Printf("%d ",i)
	}
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int K = int.Parse(s[1]);

            int ans = 0;
            s = Console.ReadLine().Split(' ');
            for (int i = 0; i < N; i++)
            {
                if(int.Parse(s[i]) >= K)
                {
                    ans++;
                }

            }

            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 17504
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    a = LI()
    a.sort(key = lambda x:-abs(x))
    p = 0
    m = 0
    for i in a:
        if i >= 0:
            p += 1
        else:
            m += 1
    f = 1
    for x in range(min(p,k)+1):
        y = k-x
        if y < 0 or y > m:
            continue
        if not y&1:
            f = 0
            break
    if f:
        a.sort(key = lambda x:abs(x))
        ans = 1
        for i in a[:k]:
            ans *= i
            ans %= mod
        print(ans)
        return
    minus = []
    s = 1
    s2 = 1
    k1 = 0
    k2 = 0
    ans = 1
    if k&1:
        m = max(a)
        for i in range(n):
            if a[i] == m:
                break
        a = a[:i]+a[i+1:]
        ans *= m
        k -= 1
    for i in a:
        if i < 0:
            k1 ^= 1
            s *= -i
            if not k1:
                minus.append(s)
                s = 1
        else:
            k2 ^= 1
            s2 *= i
            if not k2:
                minus.append(s2)
                s2 = 1
    x = k>>1
    minus.sort(reverse = True)
    for m in minus[:x]:
        ans *= m
        ans %= mod
    print(ans%mod)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 118456
#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <sstream>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int N, M;
std::string output[100000];
std::map<int, int> sorted[100000];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N >> M;
	for (size_t i = 0; i < M; i++)
	{
		int p, y;
		in >> p >> y; --p;
		sorted[p].insert(std::pair<int,int>(y,i));
	}

	for (int p = 0;p < N; ++p)
	{
		std::stringstream ss;
		ss << std::setfill('0') << std::right << std::setw(6) << p+1;
		std::string prefix = ss.str();
		int count = 1;
		for (auto& i : sorted[p])
		{
			ss.str("");
			ss << std::setfill('0') << std::right << std::setw(6) << count;
			++count;
			output[i.second] = prefix + ss.str();
		}
	}

	for (size_t i = 0; i < M; i++)
	{
		out << output[i] << '\n';
	}

	return 0;
}
#endif


#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N, T, A;
int32_t H[1000];
constexpr uint64_t MOD = 1000000007;
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N >> T >> A;
	for (size_t i = 0; i < N; i++)
	{
		in >> H[i];
	}
	T *= 1000;
	A *= 1000;

	int32_t diff = std::abs((T - 6 * H[0]) - A);
	int32_t index = 0;

	for (size_t i = 0; i < N; i++)
	{
		int32_t tmpdiff = std::abs((T - 6 * H[i]) - A);
		if (tmpdiff < diff) {
			diff = tmpdiff;
			index = i;
		}
	}
	out << index + 1 << endl;

	return 0;
}
#endif


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

int main(){

  int time = 0;

  for(int i = 0; i < 4; i++){
    int a;
    cin >> a;
    time+=a;
  }

  int mini = time/60;
  time -= mini * 60;

  cout << mini << endl << time << endl;



}

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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define mp(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

const int N = 3e5 + 5;
vi gr[N], gc[N];
int cntr[N], cntc[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h, w, m;
    cin >> h >> w >> m;
    for (int i = 0; i < m; i++) {
        int th, tw;
        cin >> th >> tw;
        gr[th].pb(tw);
        gc[tw].pb(th);
        cntr[th]++;
        cntc[tw]++;
    }
    set<pii> sr, sc;
    for (int i = 0; i < N - 4; i++) {
        if (cntr[i] > 0) sr.insert(mp(cntr[i], i));
        if (cntc[i] > 0) sc.insert(mp(cntc[i], i));
    }
    int ans = 0;
    for (auto r: sr) {
        for (auto c: gr[r.se]) {
            sc.erase(mp(cntc[c], c));
            cntc[c]--;
            sc.insert(mp(cntc[c], c));
        }
        ans = max(ans, r.fi + (*(sc.rbegin())).fi);
        for (auto c: gr[r.se]) {
            sc.erase(mp(cntc[c], c));
            cntc[c]++;
            sc.insert(mp(cntc[c], c));
        }
    }
    for (auto c: sc) {
        for (auto r: gc[c.se]) {
            sr.erase(mp(cntr[r], r));
            cntr[r]--;
            sr.insert(mp(cntr[r], r));
        }
        ans = max(ans, c.fi + (*(sr.rbegin())).fi);
        for (auto r: gc[c.se]) {
            sr.erase(mp(cntr[r], r));
            cntr[r]++;
            sr.insert(mp(cntr[r], r));
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 66936
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int a[50], b[50];
    for (int i = 0; i < m; ++i) cin >> a[i] >> b[i];
    int r[50] = { 0 };

    for (int i = 0; i < m; ++i) {
        ++r[a[i] - 1];
        ++r[b[i] - 1];
    }

    for (int i = 0; i < n; ++i) {
        cout << r[i] << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
  int age, a, b;
  scanf("%d", &age);
  if(age == 1) {
    printf("Hello World");
  }
  else {
    scanf("%d", &a);
    scanf("%d", &b);
    printf("%d", a+b);
  }
  return(0);
}


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

long long int min_ans(vector<long long int>v , long long int n)
{
	long long int height[n];
	
	height[0]=0;
	if(n>1)
	{
		height[1]=abs(v[0]-v[1]);
	}
	
	for(long long int i=2;i<n;i++)
	{
		height[i]=min(abs(v[i]-v[i-1])+height[i-1],abs(v[i]-v[i-2])+height[i-2]);
	}
	
	return height[n-1];
}

int main()
{
	long long int n;
	cin>>n;
	
	vector<long long int>v(n);
	
	for(long long int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	
	cout<<min_ans(v,n);
	
	return 0;
}

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

//関数
long como(long a,long b){
    if(a%b==0){
        return 0;
    }else{
        return b-(a%b);
    }
}
    
//main関数
int main() {
    
    
    //入力
    long N;
    cin>>N;
    vector<long> A(N);
    vector<long> B(N);
    
    for(int i=0;i<N;i++){
        cin>>A.at(i)>>B.at(i);
    }
    
    //計算
    long ans=0;
    for(int i=N-1;i>=0;i--){
        ans=ans+como(A.at(i)+ans,B.at(i));
    }
    
    //出力
    cout <<ans<<endl;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

int main() {
    double r;
    cin >> r;

    cout << (double)r * 2 * 3.141592 << endl;

    return 0;
}

Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    int mx = X, mn = Y;
    REP(i, 0, N) {
        int a;
        cin >> a;
        mx = max(a, mx);
    }
    REP(i, 0, M) {
        int b;
        cin >> b;
        mn = min(b, mn);
    }
    cout << (mx < mn ? "No War" : "War") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
const int INF = 1000000005;

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> dp(h + 1, INF);
  dp[0] = 0;

  rep(i, n) {
    int a, b;
    cin >> a >> b;
    rep(j, h) {
      int now = min(h, j + a);
      dp[now] = min(dp[now], dp[j] + b);
    }
  }
  cout << dp[h] << endl;
  return 0;
}

Measured memory_bytes: 256
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[0]+1):
    for n in range(1,hw[1]+1):
        if s[i][n]=='#':
            if s[i+1][n]==s[i][n+1]==s[i-1][n]==s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<=n;i++)
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;


/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最大公約数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
    vector<int> a(5);
    REP(i,5){
        cin >> a[i];
    }
    int nokori = 10 ;
    REP(i,5){

         if(a[i] % 10 != 0)nokori = min(nokori,a[i]%10);
        a[i] = ((a[i] + (10 - 1))/ 10)*10 ;
    }
    if(nokori != 10){
        cout << accumulate(a.begin(),a.end(),0) -(10- nokori) << endl;
    }
    else{
        cout << accumulate(a.begin(),a.end(),0) << endl;
    }
}

Measured memory_bytes: 256
using System;

namespace _177_b_2
{
    internal class Substring
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if (s == null) return;
            var t = Console.ReadLine();
            if (t == null) return;

            var change = t.Length;
            var changeableLength = s.Length - t.Length + 1;
            for (var i = 0; i < changeableLength; i++)
            {
                var currentPosInS = i;
                var eachChange = t.Length;

                for (var j = 0; j < t.Length; j++, currentPosInS++)
                {
                    if (s[currentPosInS] == t[j])
                    {
                        eachChange--;
                    }
                }

                change = Math.Min(change, eachChange);
            }

            Console.WriteLine(change);
        }
    }
}


Measured memory_bytes: 25972
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

void solve_79B(){
    ll n;
    cin >> n;

    ll a = 2, b = 1, c;
    if(n == 1) cout << 1 << endl;
    else{
        for(int i = 2; i <= n; i++){
            c = a + b;
            a = b;
            b = c;
        }
        cout << c << endl;
    }
}

int main(void){
    solve_79B();
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
    
#define PutChar(c) ; *p = (char)(c); ++p;
    
#define MAX_N (2000001)
#define MAX_Ai (10001)
#define STR_SIZE (10000010)
    
int getNum(void);
void putNum(int n);
void CountingSort(int A[], int B[], int k, int len);
    
int A[MAX_N];
int B[MAX_N];
char str[STR_SIZE];
char *p = str;
    
int main(void) {
    register int i;
    int n;
    
    fread(str, 1, STR_SIZE, stdin);
        
    n = getNum();
    for (i = 1; i <= n; ++i) {
        A[i] = getNum();
    }
        
    CountingSort(A, B, MAX_Ai, n);
        
    p = str;
    --n;
    for (i = 1; i <= n; ++i) {
        putNum(B[i]);
        PutChar(' ');
    }
    putNum(B[i]);
    PutChar('\0');
        
    puts(str);
        
    return 0;
}
    
int getNum(void) {
    int n = 0;
    while ((*p >= '0') && (*p <= '9')) {
        n = n * 10 + (int)(*p - '0');
        ++p;
    }
    ++p;
    return n;
}
    
void putNum(int n) {
    int d;
    if (n < 10) {
        PutChar('0' + n);
        return;
    }
    d = n / 10;
    if (d) putNum(d);
    PutChar('0' + (n - (d * 10)));
}
    
void CountingSort(int A[], int B[], int k, int len) {
    int C[MAX_Ai] = { 0 };
    int i, j;
    for (j = 1; j <= len; ++j) {
        ++C[A[j]];
    }
    for (i = 1; i <= k; ++i) {
        C[i] += C[i - 1];
    }
    for (j = len; j > 0; --j) {
        B[C[A[j]]] = A[j];
        --C[A[j]];
    }
}

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

typedef long long ll;


int main() {
    string S;
    cin >> S;
    bool easy = true;
    for (int i=0;i<S.length();i++){
        if (i%2 == 1){
            if(S[i] != 'L' && S[i] != 'U' && S[i] != 'D'){
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (S[i] != 'R' && S[i] != 'U' && S[i] != 'D'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
hs = list(map(int, input().split()))
hs.append(0)
ans = 0
for i in range(len(hs)):
    if len(set(hs))==1 and 0 in hs:
        break
    elif hs[i]==0:
        continue
    else:
        while True:
            if hs[i]==0:
                break
            for j in range(i,len(hs)):
                if hs[j] ==0:
                    for k in range(i,j):
                        hs[k]-=1
                    ans+=1
                    break
print(ans)

Measured memory_bytes: 3064
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <random>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

const Int alp = 26;

Int compute_score(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out) {
    Int score = 0;
    vector<Int> last(alp, 0);

    for (Int d = 0; d < out.size(); d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    return score;
}

vector<Int> solve(Int &D, vector<vector<Int>> &s, vector<Int> &c) {
    vector<Int> out;

    for (Int _ = 0; _ < D; _++) {
        Int max_score = -INF;
        Int best_i = 0;

        for (Int i = 0; i < alp; i++) {
            out.push_back(i);

            Int score = compute_score(D, s, c, out);
            if (max_score < score) {
                max_score = score;
                best_i = i;
            }

            out.pop_back();
        }

        out.push_back(best_i);
    }

    return out;
}

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

    Int D;
    cin >> D;
    vector<Int> c(alp);
    vector<vector<Int>> s(D, vector<Int>(alp));
    for (Int i = 0; i < alp; i++) {
        cin >> c[i];
    }
    for (Int i = 0; i < D; i++) {
        for (Int j = 0; j < alp; j++) {
            cin >> s[i][j];
        }
    }

    auto ans = solve(D, s, c);
    for (auto e : ans) {
        cout << e + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3740
/*---------------------------*\
____________Mari000____________         
________Mostafa  Shehab________    
\*---------------------------*/

#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
typedef long long ll;
typedef long double ld;
//template <class Type>

ll power(ll x,ll y,ll p);
int Bit(ll x);
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}

const int N=1e5 + 5;
unordered_map<int,int> mp;
int n,m,cnt;


int main(){
	n=D();
	while(n--)
		++mp[D()];
	for(auto i:mp)
		cnt+=(i.second&1);
	printf("%d",cnt);

}










ll power(ll x,ll y,ll p){ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
    while (y > 0){ 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;
    }
    return res; 
}


int Bit(ll x){
	if(!x)
		return 0;
	return 1+Bit(x>>1);
}


















Measured memory_bytes: 4388
import java.util.Scanner;


public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String input;
		String output = null;
		char[] t, s;
		char[] al = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
				'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
				'x', 'y', 'z' };
		while (scan.hasNext()) {
			input = scan.nextLine();
			for (int d = 0; d < al.length; d++) {
				t = input.toCharArray();
				s=t.clone();
				for (int i = 0; i < t.length; i++) {
					for (int j = 0; j < al.length; j++) {
						if (t[i] == al[j]) {
							s[i] = al[(j + d) % al.length];
						}
					}
				}
				output = String.valueOf(s);
				if (output.contains("the") || output.contains("this")
						|| output.contains("that")) {
					break;
				}
			}
			System.out.println(output);
		}
	}
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    set<int> ns;

    for (int i = 0; i < N; i++) {
        int s;
        cin >> s;
        if (!ns.count(s)) {
            ns.insert(s);
        } else {
            ns.erase(s);
        }
    }

    cout << ns.size() << endl;

    return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> vec(N);

    for (int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        vec.at(a-1) += 1;
        vec.at(b-1) += 1;
    }

    for (int i = 0; i < N; i++){
        cout << vec.at(i) << endl;
    }

}

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

static const int MAX = 100000+10;

int main(){
    int N;
    cin>>N;
    vector<int> V(N);
    vector<int> even(MAX,0);
    vector<int> odd(MAX,0);

    for(int i=0; i<N; i++){
        cin>>V[i];
        if(i%2 == 0) even[V[i]]++;
        else odd[V[i]]++;
    }

    int me,mo;
    int me_cnt,mo_cnt,ne_cnt,no_cnt;
    me_cnt = mo_cnt = ne_cnt = no_cnt = 0;

    for(int i=0; i<MAX; i++){
        if(even[i] > me_cnt){
            me = i;
            me_cnt = even[i];
        }
    }

    for(int i=0; i<MAX; i++){
        if(even[i] > ne_cnt && i != me){
            ne_cnt = even[i];
        }
    }

    for(int i=0; i<MAX; i++){
        if(odd[i] > mo_cnt){
            mo = i;
            mo_cnt = odd[i];
        }
    }

    for(int i=0; i<MAX; i++){
        if(odd[i] > no_cnt &&  i != mo){
            no_cnt = odd[i];
        }
    }

    if(mo != me){
        cout<<(N-me_cnt-mo_cnt)<<endl;
    }else{
        cout<<min(N-me_cnt-no_cnt,N-ne_cnt-mo_cnt)<<endl;
    }

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int main (void) {
    int H, W;
    string S[50];
    cin >> H >> W;
    for ( int i=0; i<H; i++ )
        cin >> S[i];

    for ( int i=0; i<H; i++ ) {
        for ( int j=0; j<W; j++ ) {
            if ( S[i].at(j) == '.' ) {
                int num_bomb = 0;
                for ( int k=max(i-1, 0); k<=min(i+1, H-1); k++ ) {
                    for ( int l=max(j-1, 0); l<=min(j+1, W-1); l++ ) {
                        if ( S[k].at(l) == '#' )
                            num_bomb++;
                    }
                }
                cout << num_bomb;
            }
            else
                cout << '#';
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[19]:


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


# In[22]:


a0 = [0]+A+[0]
cost_all = sum([abs(a0[i+1]-a0[i]) for i in range(N+1)])
for i in range(N):
    diff = abs(a0[i+2]-a0[i])-(abs(a0[i+1]-a0[i])+abs(a0[i+2]-a0[i+1]))
    ans = cost_all + diff
    print(ans)


# In[ ]:






Measured memory_bytes: 20420
/*
* @Author: AsilenceBTF
* @Buff: ︿(￣︶￣)︿  芜湖塔台 起飞
* @Date: 2019-06-20 09:22:24
* @LastEditTime: 2020-09-16 16:23:36
*/

#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define ALL(x) x.begin(), x.end()
#define INF 0x3f3f3f3f
#define debug(x) cout << "##### " << x << endl; 
typedef long long ll;

// #define cin in
// #define cout out
// ifstream in("in.txt");
// ofstream out("out.txt");

const int N = 2e5 + 105;
int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = a * c;
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);
    cout << ans << endl;
}

Measured memory_bytes: 3588