akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  using S = tuple<int, int, int>;
  vector<S> vseg, hseg;
  vector<int> x, y;
  rep(i, n) {
    int a, b, c;
    cin >> a >> b >> c;

    vseg.push_back(S(a, b, c));
    x.push_back(a);
    x.push_back(b);
    y.push_back(c);
  }

  rep(i, m) {
    int d, e, f;
    cin >> d >> e >> f;

    hseg.push_back(S(d, e, f));
    x.push_back(d);
    y.push_back(e);
    y.push_back(f);
  }

  const int MIN = -1e9 - 1, MAX = 1e9 + 1;
  x.push_back(0);
  x.push_back(MIN);
  x.push_back(MAX);
  y.push_back(0);
  y.push_back(MIN);
  y.push_back(MAX);

  sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  sort(y.begin(), y.end());
  y.erase(unique(y.begin(), y.end()), y.end());

  const int H = x.size(), W = y.size();
  vector<vector<bool>> accessible(H * 2, vector<bool>(W * 2, true));
  for (auto s : vseg) {
    int a, b, c;
    tie(a, b, c) = s;

    int lidx = lower_bound(x.begin(), x.end(), a) - x.begin();
    int ridx = lower_bound(x.begin(), x.end(), b) - x.begin();
    int cidx = lower_bound(y.begin(), y.end(), c) - y.begin();
    for (int i = lidx; i < ridx; i++) {
      accessible[2 * i][2 * cidx - 1] = false;
    }
  }
  for (auto s : hseg) {
    int d, e, f;
    tie(d, e, f) = s;

    int cidx = lower_bound(x.begin(), x.end(), d) - x.begin();
    int lidx = lower_bound(y.begin(), y.end(), e) - y.begin();
    int ridx = lower_bound(y.begin(), y.end(), f) - y.begin();
    for (int i = lidx; i < ridx; i++) {
      accessible[2 * cidx - 1][2 * i] = false;
    }
  }

  vector<vector<bool>> isVisited(H, vector<bool>(W, false));
  int64_t result = 0;

  using P = pair<int, int>;
  queue<P> q;
  int si = lower_bound(x.begin(), x.end(), 0) - x.begin();
  int sj = lower_bound(y.begin(), y.end(), 0) - y.begin();

  q.push(P(si, sj));
  isVisited[si][sj] = true;
  while (!q.empty()) {
    int i, j;
    tie(i, j) = q.front();
    q.pop();

    if (i + 1 < H && j + 1 < W) {
      result += ((int64_t)x[i + 1] - x[i]) * (y[j + 1] - y[j]);
    }

    for (int di = -1; di <= 1; di++) {
      for (int dj = -1; dj <= 1; dj++) {
        if (abs(di) + abs(dj) == 1) {
          int ni = i + di, nj = j + dj;
          if (ni >= 0 && ni < H && nj >= 0 && nj < W && !isVisited[ni][nj]) {
            if (accessible[(2 * ni + 2 * i) / 2][(2 * nj + 2 * j) / 2]) {
              isVisited[ni][nj] = true;
              q.push(P(ni, nj));
            }
          }
        }
      }
    }
  }

  if (isVisited[0][0]) {
    cout << "INF" << endl;
  } else {
    cout << result << endl;
  }

  return 0;
}

Measured memory_bytes: 9452
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

int N, A, B, rings[100], G[100][100]; bool used[100];

int rec(int pos)
{
	int ret = 1; used[pos] = true;

	for(int i = 0; i < rings[pos]; i++)
	{
		int r = G[pos][i];
		
		if(!used[r])
		{
			ret = max(ret, rec(r) + 1);
		}
	}

	used[pos] = false;

	return ret;
}

int main()
{
	int N, A, B;

	while(true)
	{
		scanf("%d", &N);
 
		if(N == 0) { break; }

		for(int i = 0; i < 100; i++)
		{
			used[i] = false;
			rings[i] = 0;
		}

		for(int i = 0; i < N; i++)
		{
			scanf("%d", &A); A--;
			scanf("%d", &B); B--;

			G[A][rings[A]] = B; rings[A]++;
			G[B][rings[B]] = A; rings[B]++;
		}

		int nodes = 0;

		for(int i = 0; i < 100; i++)
		{
			if(rings[i])
			{
				nodes++;
			}
		}

		int ret = 0;

		for(int i = 0; i < 100; i++)
		{
			ret = max(ret, rec(i));

 			if(ret == nodes) break;
		}
 
		printf("%d\n", ret);
	}

	return 0;
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

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

	int n, m, k;
	cin >> n >> m >> k;
	char mat[n][m];
	int total = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> mat[i][j];
			if (mat[i][j] == '#') {
				total++;
			}
		}
	}
	int n1 = pow(2, n), m1 = pow(2, m), ans = 0;
	for (int i = 0; i < n1; i++) {
		for (int j = 0; j < m1; j++) {
			bitset<6> b1(i);
			bitset<6> b2(j);

			int count = 0;
			for (int k = 0; k < n; k++) {
				for (int l = 0; l < m; l++) {
					if (b1[k] == 1 || b2[l] == 1)
						continue;
					if (mat[k][l] == '#')
						count++;
				}
			}
			if (count == k)
				ans++;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 4112
#include<stdio.h>
int main(){
  double x,y,a,b,c,d,e,f;
   
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
     
    y=(a*f-d*c)/(a*e-d*b);
    x=(c-b*y)/a;
     
    printf("%.3f %.3f\n",x,y);
     
  }
   
  return 0;
}

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

int main(){
  string s;
  cin >> s;
  bool flag = false;
  if(s[0] == s[1] && s[2] == s[3]){
    if(s[0] != s[2]){
      flag = true; 
    }
  }
  if(s[0] == s[2] && s[1] == s[3]){
    if(s[0] != s[1]){
      flag = true; 
    }
  }
  if(s[0] == s[3] && s[2] == s[1]){
    if(s[0] != s[2]){
      flag = true; 
    }
  }
  if(flag) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 256
N, Y = map(int, input().split())

for i in range(N+1):
    for j in range(N-i+1):
        a = i
        b = j
        c = N - i - j
        if a*10000 + b*5000 + c*1000 == Y:
            print(a, b, c)
            exit()

print(-1, -1, -1)

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

using namespace std;

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


Measured memory_bytes: 3596
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


        




n=l()[0]
a=l()[0]
b=l()[0]
c=l()[0]
d=l()[0]
e=l()[0]
x=min(a,b,c,d,e)
if(x>=n):
    print(5)
else:
    if(n%x!=0):
        n=n+(x-n%x)
    ans=n//x+4
    print(ans) 


        

Measured memory_bytes: 5124
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
  int n, m ;
  cin >> n >> m;
  int dp[100010];
  for(int i = 0; i <= n; i++){
    dp[i] = 1;
  }
  for(int i = 0; i < m; i++){
    int a;
    cin >> a;
    dp[a] = 0;
  }
  for(int i = n-2; i >= 0; i--){
    if(dp[i] > 0){
      dp[i] = (dp[i+1] + dp[i+2]) % 1000000007;
    }
  }
  cout << dp[0] << endl;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  R n;
  int a[n];
  rep(i,n) R a[i];
  ll ans=1,d=1;
  rep(i,n) {
    ans*=3;
    if(a[i]%2==0) d*=2;
  }
  pr(ans-d);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

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

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

public class Main {


	public static void main(String[] args) throws Exception {
		BufferedReader aInput = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tk = new StringTokenizer(aInput.readLine());
		int a = Integer.parseInt(tk.nextToken());
		int b = Integer.parseInt(tk.nextToken());
		calcComparison calc = new calcComparison(a,b);
	}
}

class calcComparison{
	public calcComparison(int Num1,int Num2){
		if( Num1 < Num2 ){
			System.out.println("a < b");
		}
		else if( Num1 > Num2 ){
			System.out.println("a > b");
		}
		else{
			System.out.println("a == b");
		}
	}
}



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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n,m,x; cin >> n >> m >> x;
  vector<int> a(m); rep(i,m) cin >> a[i];
  int l=0,r=0;

  for(int i = 0;i<x;i++)
    rep(j,m)
      if(i==a[j]) l++;

  for(int i = x+1;i<=n;i++)
    rep(j,m)
      if(i==a[j]) r++;

  int cost;
  if(l>=r) cost = r;
  else cost = l;

  cout << cost << endl;
  
  return 0;
}


Measured memory_bytes: 3580
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int h,w;
	cin>>h>>w;
	int need[5]={};
	if(h%2==0&&w%2==0){
		need[4]=h*w;
	}else if(h%2==1&&w%2==0){
		need[4]=(h-1)*w;
		need[2]=w;
	}else if(h%2==0&&w%2==1){
		need[4]=(w-1)*h;
		need[2]=h;
	}else{
		need[4]=(h-1)*(w-1);
		need[1]=1;
		need[2]=h*w-need[4]-need[1];
	}
	int cnt[30]={};
	FOR(i,0,h){
		FOR(j,0,w){
			char c;
			cin>>c;
			cnt[c-'a']++;
		}
	}

	FOR(i,0,30){
		if(cnt[i]>=4){
			int tmp=min(need[4],cnt[i]/4*4);
			need[4]-=tmp;
			cnt[i]-=tmp;
		}
	}
	FOR(i,0,30){
		if(cnt[i]>=2){
			cerr<<i<<endl;
			int tmp=need[2];
			need[2]-=min(need[2],cnt[i]/2*2);
			cnt[i]-=tmp-need[2];
		}
	}
	FOR(i,0,30){
		if(cnt[i]>=1){
			int tmp=need[1];
			need[1]-=min(need[1],cnt[i]);
			cnt[i]-=tmp-need[1];
		}
	}
	if(need[4]>0||need[2]>0||need[1]>0){
		cout<<"No";
	}else{
		cout<<"Yes";
	}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

using namespace std;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}
 
const int mod = (int)1e9 + 7;
 
int a[101];

int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();
	int n;
	cin >> n;
	for(int i = 1; i <= n + n; i++) cin >> a[i];
	sort(a + 1, a + n + 1 + n);
	long long ans = 0;
	for(int i = 1; i <= n + n; i += 2) ans += a[i];
	cout << ans;
}


Measured memory_bytes: 256
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

a, b, k = list(map(int, sys.stdin.buffer.readline().split()))

if a < k:
    k -= a
    a = 0
    b -= k
    print(a, max(0, b))
else:
    a -= k
    print(a, max(0, b))


Measured memory_bytes: 14020
#include <stdio.h>
#include <math.h>
int main(){
 
  int n,x[100],y[100],i,pp[100];
  double p,p1=0,p2=0,p3=0,sub=0,sub2=0;
   
  scanf("%d",&n);
 
  //scan
  for(i = 0; i < n; i++){
 
    scanf("%d",&x[i]);
 
  }
 
  for(i = 0; i < n; i++){
     
    scanf("%d",&y[i]);
     
  }
   
  //p1
  for(i = 0; i < n; i++){
 
    p=x[i]-y[i];
 
    if(p < 0) p *= -1;
 
    p1 += p;
 
  }
 
  printf("%.5lf\n",p1);
 
  //p2
  for(i = 0; i < n; i++){
     
    p=x[i]-y[i];
     
    sub += pow(p,2);
 
  }
   
  printf("%.5lf\n",pow(sub,0.5));
 
  //p3
 
  for(i = 0; i < n; i++){
     
    p=x[i]-y[i];
 
    if(p < 0) p *= -1;
     
    sub2 += pow(p,3);
     
  }
 
  printf("%.5lf\n",pow(sub2,1.0/3.0));
 
  //pMAX
  for(i = 0; i < n; i++){
 
    pp[i]=x[i]-y[i];
 
    if(pp[i] < 0) pp[i] *= -1;
     
  }
 
  for(i = 1; i < n; i++){
 
    if(pp[i-1] > pp[i]){
 
      pp[i]=pp[i-1];
 
    }
 
  }
 
  printf("%d\n",pp[n-1]);
 
  return 0;
 
}


Measured memory_bytes: 2116
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) begin(V), end(V)
#define ALLR(V) rbegin(V), rend(V)
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
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 std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::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 std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
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) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

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

const ssize_t MAX_N = 16;
const ssize_t MAX_S = 1 << MAX_N;
double dp[MAX_S][MAX_N + 1];
double adv_p[MAX_N][MAX_N + 1][MAX_N + 1];
bool calced[MAX_S];
using BS = bitset<MAX_N>;
VV<double> cats;
ll N, M, MS;

void rec(ll S) {
    if (calced[S]) return;
    calced[S] = true;
    if (S == (1ll << N) - 1) return;
    for (ll i = 0; i < N; i++) {
        ll mask = (1ll << i);
        if (S & mask) continue;
        rec(S ^ mask);
        for (ll cur = 0; cur <= M; cur++) {
            double p = 0;
            for (ll adv = cur; adv <= M; adv++) p += adv_p[i][cur][adv] * dp[S ^ mask][adv];
            chmax(dp[S][cur], p);
        }
    }
    return;
}

int main() {
    cin >> N >> M;
    MS = (1ll << N) - 1;
    cats = make_v<double>(0., N, M);
    for (auto &&v : cats) for (auto &&e : v) cin >> e;
    for (auto &&v : dp) v[M] = 1.;
    for (ll i = 0; i < N; i++) {
        auto &cat = cats[i];
        for (ll cur = 0; cur <= M; cur++) for (ll adv = cur; adv <= M; adv++) {
            double p = 1.;
            for (ll j = cur; j < adv; j++) p *= cat[j];
            if (adv < M) p *= 1. - cat[adv];
            adv_p[i][cur][adv] = p;
        }
    }

    rec(0);
    cout << dp[0][0] << endl;
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  
  int i;
  vector<int> h(n);
  for(i = 0; i < n; i++){
    cin >> h.at(i);
  }
  
  int ans = 0, keep;
  for(i = 0; i < n - 1; i++){
    ans += h.at(i);
    keep = h.at(i);
    h.at(i) = 0;
    int j;
    for(j = i + 1; j < n; j++){
      if(h.at(j) <= keep){
        keep = h.at(j);
        h.at(j) = 0;
      }
      else{
        h.at(j) -= keep;
      }
    }
  }
  
  ans += h.at(h.size() - 1);
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  string s,t; cin>>s>>t;
	int a,b; cin>>a>>b;
	string u; cin>>u;
	if(s==u) a--;
	if(t==u) b--;
	cout << a SP b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long x,long y){
    if(y==0)return x;

    return gcd(y,x%y);
}
long long lcm(long x,long y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main()
{
    int N,A[100010]={},B[100010]={},ans=0,o[100010]={},ocnt=0;
    long long Asum=0,Bsum=0,r=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
        Asum+=A[i];
    }
    for(int i=0;i<N;i++){
        cin>>B[i];
        Bsum+=B[i];

        if(A[i]>=B[i]){
            o[ocnt]=A[i]-B[i];
            ocnt++;
        }else{
            ans++;
            r+=B[i]-A[i];
        }
    }

    if(Bsum>Asum){
        ans=-1;
    }else{

        sort(o,o+ocnt);

        while(r>0){
            ans++;
            r-=o[ocnt-1];
            ocnt--;
        }
    }

    cout<<ans<<endl;

    return 0;
}

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

int main(){
	int n;
	while(cin>>n,n){
		int data[114];
		for(int i=0;i<n;i++)cin>>data[i];
		int ans=0;
		while(1){
			int flg=1;
			for(int i=0;i<n-1;i++){
				if(data[i]>data[i+1])flg=0;
				}
			if(flg)break;
			
			for(int i=0;i<n-1;i++){
				if(data[i]>data[i+1]){
					swap(data[i],data[i+1]);
					ans++;
					}
				}	
			}
			cout<<ans<<endl;
		}
		return 0;
	}

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

using namespace std;

int main() {
	long long n; cin >> n;
	long long dig = 1;
	string ans;
	while (n) {
		--n;
		int t = n % 26;
		n /= 26;
		ans = (char)('a' + t) + ans;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> A(H, vector<char>(W));

    for (int count = 0; count < H; count++)
    {
        for (int index = 0; index < W; index++)
        {
            cin >> A.at(count).at(index);
        }
    }

    bool flag = true, whiteFlag = false;
    while (flag)
    {
        flag = false;
        for (int count = 0; count < H; count++)
        {
            if (A.at(count).at(0) != '#')
            {
                whiteFlag = true;
                for (int index = 0; index < W; index++)
                {
                    if (A.at(count).at(index) == '#')
                    {
                        whiteFlag = false;
                        break;
                    }
                }
                if (whiteFlag)
                {
                    for (int index = 0; index < W; index++)
                    {
                        if (A.at(count).at(index) == '.')
                        {
                            A.at(count).at(index) = ' ';
                            flag = true;
                        }
                    }
                }
            }
        }
        for (int count = 0; count < W; count++)
        {
            if (A.at(0).at(count) != '#')
            {
                whiteFlag = true;
                for (int index = 0; index < H; index++)
                {
                    if (A.at(index).at(count) == '#')
                    {
                        whiteFlag = false;
                        break;
                    }
                }
                if (whiteFlag)
                {
                    flag = false;
                    for (int index = 0; index < H; index++)
                    {
                        if (A.at(index).at(count) == '.')
                        {
                            A.at(index).at(count) = ' ';
                            flag = true;
                        }
                    }
                }
            }
        }
    }

    bool displayFlag = false;
    for (int count = 0; count < H; count++)
    {
        for (int index = 0; index < W; index++)
        {
            if (A.at(count).at(index) != ' ')
            {
                displayFlag = true;
                cout << A.at(count).at(index);
            }
            if (displayFlag && index == W - 1)
            {
                cout << endl;
            }
        }
        displayFlag = false;
    }
}

Measured memory_bytes: 256
n = int(input())
al = []

for _ in range(n):
    a = int(input())
    al.append(a)

ans = 0
idx = 0
for _ in range(n):
    idx = al[idx] - 1
    ans += 1
    if idx == 1:
        print(ans)
        import sys
        sys.exit()

print(-1)

Measured memory_bytes: 7084
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int a,b,c,d; cin>>a>>b>>c>>d;
    if (d==1) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

T RD(T = long)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n)
	{
		par = new long[](n);
		foreach (i; 0..n) par[i] = i;
		cnt = new long[](n);
		fill(cnt, 1);
	}
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	long unite(long i, long j)
	{ 
		i = root(i); j = root(j);
		if (i == j) return 0;
		par[j] = i;
		auto cnt_i = ((cnt[i] ^^ 2) - cnt[i]) / 2;
		auto cnt_j = ((cnt[j] ^^ 2) - cnt[j]) / 2;
		cnt[i] += cnt[j];
		auto diff = ((cnt[i] ^^ 2) - cnt[i]) / 2 - (cnt_i + cnt_j);
		//stderr.writeln(i, ":", j, " ", cnt_i, " ", cnt_j, " ", diff);
		return diff;
	}

	long[] par;
	long[] cnt;
}

void main()
{
	auto N = RD;
	auto M = RD;
	auto ab = new long[2][](M);

	foreach (i; 0..M)
	{
		auto a = RD-1;
		auto b = RD-1;
		ab[i] = [a, b];
	}

	auto ans = new long[](M);
	UnionFind uf;
	uf.init(N);
	long cnt;
	long full = ((N ^^ 2) - N) / 2;
	foreach_reverse (i, e; ab)
	{
		ans[i] = full - cnt;
		cnt += uf.unite(e[0], e[1]);
	}

	foreach (e; ans)
		writeln(e);
	
	stdout.flush();
}

Measured memory_bytes: 6780
#include <stdio.h>
#include <stdlib.h>

int main(){
	int H, W, i, j;
	scanf("%d%d", &H, &W);
	char **a = (char **)malloc(sizeof(char *) * H);
	char **R = (char **)malloc(sizeof(char *) * H);
	char **B = (char **)malloc(sizeof(char *) * H);
	for(i = 0; i < H; i++){
		a[i] = (char *)malloc(sizeof(char) * (W + 1));
		R[i] = (char *)malloc(sizeof(char) * (W + 1));
		B[i] = (char *)malloc(sizeof(char) * (W + 1));
		scanf("%s", a[i]);
		for(j = 0; j < W; j++){
			R[i][j] = a[i][j];
			B[i][j] = a[i][j];
			if(i == 0 || (i < H - 1 && j % 2 == 0)){
				R[i][j] = '#';
			}
			else{
				B[i][j] = '#';
			}
		}
		R[i][W] = '\0';
		B[i][W] = '\0';
	}
	for(i = 0; i < H; i++){
		printf("%s\n", R[i]);
	}
	printf("\n");
	for(i = 0; i < H; i++){
		printf("%s\n", B[i]);
	}
	return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  int sum_a = 0, sum_b = 0;
  vector<Pi> vec;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    sum_a += a;
    sum_b += b;
    vec.emplace_back(a, i);
    vec.emplace_back(b, i);
  }
  sort(all(vec));
  int ans = min(sum_a, sum_b);
  int sum = 0;
  bool flag = false;
  vint cnt(n, 0);
  rep(i, n) {
    sum += vec[i].first;
    flag |= (++cnt[vec[i].second] == 2);
  }
  if(flag) {
    cout << min(ans, sum) << endl;
    return 0;
  }
  rep(i, n) {
    sum -= vec[i].first;
    sum += vec[n + (vec[i].second==vec[n].second)].first;
    chmin(ans, sum);
    sum -= vec[n + (vec[i].second==vec[n].second)].first;
    sum += vec[i].first;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6512
import sys
from itertools import product

sys.setrecursionlimit(10 ** 9)


def dfs(c, x, y):
    c[x][y] = 0
    for dx, dy in product((-1, 0, 1), repeat=2):
        if dx == dy == 0:
            continue
        if c[x + dx][y + dy] == 1:
            dfs(c, x + dx, y + dy)


def main():
    input = sys.stdin.buffer.readline
    while True:
        w, h = map(int, input().split())
        if w == h == 0:
            break
        c = [
            [0] + list(map(int, input().split())) + [0]
            if 1 <= i <= h
            else [0] * (w + 2)
            for i in range(h + 2)
        ]
        cnt = 0
        for i in range(h + 2):
            for j in range(w + 2):
                if c[i][j]:
                    cnt += 1
                    dfs(c, i, j)
        print(cnt)


if __name__ == "__main__":
    main()



Measured memory_bytes: 8156
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  20005
ll n;
struct node
{
    ll w,s,v;
    void read()
    {
        cin>>w>>s>>v;
    }
};
bool cmp(node a,node b)
{
    return a.w+a.s<b.w+b.s;
}
vector<node>v(N);
void solve()
{
    cin>>n;
    rep(i,0,n)
    v[i].read();
    sort(all(v),cmp);
    vector<ll>dp(N);
    for(auto un:v)
    {
        for(int i=un.s;i>=0;i--)
        {
            dp[i+un.w]=max(dp[i+un.w],dp[i]+un.v);
        }
    }
    ll ans=0;
    for(auto u:dp)
        ans=max(ans,u);
    cout<<ans<<endl;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 3952
def choco(d,ai):
    day = 1
    ans = 0
    while day<=d:
        ans += 1
        day += ai
    return ans

n = int(input())
d,x = map(int,input().split())
ans = 0
for i in range(n):
    a = int(input())
    ans += choco(d,a)
print(ans + x)

Measured memory_bytes: 9056
a=int(input())
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=1000
f=0
for i in range(a):
    if d>=abs(b[0]-c[i]*0.006-b[1]):
        d=abs(b[0]-c[i]*0.006-b[1])
        f=i
print(f+1)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//----------------------------------------------------------------

int main()
{
    ll n;
    cin >> n;
    string s;
    map<string, ll> g;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        sort(s.begin(), s.end());
        g[s]++;
    }
    ll sum = 0;
    for (auto f : g)
    {
        if (f.second > 1)
        {
            sum += nCr(f.second, 2);
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 11136
#include <iostream>
#include <cstdio>
#define Max 500000
#define inf 2000000000
using namespace std;

int n;
int S[Max];
int R[Max/2+2],L[Max/2+2];
//合并
long long merge(int S[],int n,int left,int mid ,int right)
{
    long long cnt = 0;
    int n1 = mid-left;
    int n2 = right-mid;
    for(int i=0;i<n1;i++)
        L[i] = S[left+i];
    for(int j=0;j<n2;j++)
        R[j] = S[mid+j];
    L[n1] = R[n2] = inf;
    int i=0;
    int j=0;
    for(int k=left;k<right;k++)   //把左右?部分合并
    {
        if(L[i] <= R[j])   //判断??元素?的大小排序
        {
           S[k] = L[i++];
        }
        else
        {
            S[k] = R[j++];
            cnt = cnt + n1 - i;
         }
    }
    return cnt;
}
//??分割排序
long long MergeSort(int S[],int n,int left,int right)
{
    long long u,v,w;
    if(left + 1 < right)
    {
        int mid = (left+right)/2;
        u = MergeSort(S,n,left,mid);   //分割（左?）
        v = MergeSort(S,n,mid,right);   //分割（右?）
        w = merge(S,n,left,mid,right);   //?果合并
        return u+v+w;
    }
    else
        return 0;

}
int main()
{
    int i;
    while(scanf("%d",&n)!=EOF)
    {
        for(i=0;i<n;i++)
            scanf("%d",&S[i]);
        long long p = MergeSort(S,n,0,n);
        printf("%lld\n",p);
    }

    return 0;
}

Measured memory_bytes: 4772
class Edge:
    def __init__(self, u, v, cost):
        self.u = u
        self.v = v
        self.cost = cost
    
    def __str__(self):
        return "u: " + str(self.u) + " v: " + str(self.v) + " cost: " + str(self.cost)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
    
    def isSame(self, x, y):
        return self.find(x) == self.find(y)

def solve():
    V, E = map(int,input().split())
    edges = []
    for i in range(E):
        s,t,w = map(int,input().split())
        e = Edge(s,t,w)
        edges.append(e)
    
    edges.sort(key=lambda e: e.cost)

    uf = UnionFind(V+1)

    ans = 0
    for edge in edges:
        if not uf.isSame(edge.u, edge.v):
            uf.unite(edge.u, edge.v)
            ans += edge.cost

    print(ans)

if __name__ == '__main__':
    solve()


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

using namespace std;

int main() {
  ios::sync_with_stdio(false); cin.tie(NULL);
  int n; cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> dp(n, 0);
  int ans = 0;
  for (int i = n - 2; i >= 0; i--) {
    if (a[i] >= a[i + 1]) dp[i] = 1 + dp[i + 1];
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
}



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

out = []
while True:
    W, H = map(int,input().split())
    if W == 0 and H == 0:
        break
    G = [list(map(int,input().split())) for _ in range(H)]
    visited = [[False]*W for _ in range(H)]
    ans = 0
    def dfs(h, w):
        visited[h][w] = True
        for dx in [-1, 0, 1]:
            for dy in [-1, 0, 1]:
                ww, hh = w+dx, h+dy
                if not 0 <= ww < W: continue
                if not 0 <= hh < H: continue
                if G[hh][ww] == 0 or visited[hh][ww]: continue
                dfs(hh, ww)
    for h in range(H):
        for w in range(W):
            if G[h][w] == 0 or visited[h][w]: continue
            ans += 1
            dfs(h, w)
    out.append(ans)
print(*out, sep="\n")



Measured memory_bytes: 8040
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    int n;cin>>n;
    int k = 1;
    for(int i = 0;i<10;i++){
        if(k*2>n) break;
        else k *=2;
    }
    cout<<k;
    return 0;
}

Measured memory_bytes: 3136
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,m,ans;
signed main(){
	cin>>n>>m;
	if((n+m)%2==0)cout<<(n+m)/2<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }

void func(long long N, long long K, std::vector<long long> A){

    REP(i,0,K){
        
        vector<lli> sum(2*N+10,0);
        REP(i,0,N){
            lli s = max(0LL,2*i-2*A[i]-1);
            lli e = min(2*N+5,2*i+2*A[i]+1);
            sum[s]++;
            sum[e]--;
            LOG4(i,A[i],s,e);
        }
        REP(i,0,2*N+5){
            sum[i+1]+=sum[i];
        }
        bool all = true;
        REP(i,0,N){
            A[i]=sum[2*i];
            if(A[i]!=N)all=false;
        }
        if(all)break;
    }

    REP(i,0,N){
        cout<<A[i];
        if(i!=N-1)cout<<" ";
    }
    cout<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, K, std::move(A));
    return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, D;
	cin >> N >> D;
	D = 2 * D + 1;
	cout << (N + D - 1) / D << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define PB push_back
#define MP make_pair
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>())

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
using ll = long long;

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();}


void Main() {
  int N;
  cin >> N;
  FOR(i, 1, 10){
    int j= i;
    while(j<10){
      if(i*j == N){
        OUT("Yes");
        goto endend;
      }
      ++j;
    }
  }
  OUT("No");
  endend:
  OUT("");
}

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

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    long long n,k;
    cin>>n>>k;
    vector<pair<long long,long long>> a(n);
    for(long long i=0;i<n;i++)cin>>a[i].first>>a[i].second;
    sort(All(a));
    for(long long i=0;i<n;i++){
        k -= a[i].second;
        if(k<=0LL){
            cout << a[i].first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1792