akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

ll dp[303][303][303];

int main(){
	int n,k; cin >> n >> k;
	vector<ll> h(n+1);
	h[0]=0;
	for(int i=0;i<n;i++){
		cin >> h[i+1];
	}
	for(int i=0;i<303;i++){
		for(int j=0;j<303;j++){
			for(int kk=0;kk<303;kk++){
				dp[i][j][kk]=1e15;
			}
		}
	}
	dp[0][0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=k;j++){
			for(int z=0;z<n;z++){
				if(dp[i][j][z]==1e15)continue;
				if(h[i+1]>=h[z]){
					dp[i+1][j][i+1]=min(dp[i+1][j][i+1],dp[i][j][z]+h[i+1]-h[z]);
					if(j<k)dp[i+1][j+1][z]=min(dp[i+1][j+1][z],dp[i][j][z]);
				}
				else{
					dp[i+1][j][i+1]=min(dp[i+1][j][i+1],dp[i][j][z]);
					if(j<k)dp[i+1][j+1][z]=min(dp[i+1][j+1][z],dp[i][j][z]);
				}
			}
		}
	}
	ll mi=1e15;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=n;j++){
			mi=min(mi,dp[n][i][j]);
		}
	}
	cout << mi << endl;
}

Measured memory_bytes: 217728
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO
    int a,b,c,k; cin>>a>>b>>c>>k;
    int ok=0;
    for(int i=0;i<=k;i++){
            int j=k-i;
            int p=b*pow(2,i);
            int q=c*pow(2,j);
            if(p>a && q>p) ok=1;
        
    }
    check(ok);
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

Measured memory_bytes: 15120
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    VP b(n);
    REP(i,0,n) b[i] = MP(a[i],i);
    sort(all(b));
    REP(i,0,n) cout << b[i].second + 1 << " ";
    cout << endl;
}

int main() {
    solve();
    
    return 0;
}

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

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

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

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

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

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

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

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

const int N = 500000;
const int M = 500000;

struct Input {
	int n, m, d;
	int a[N];
	int q[M];
	
	bool read () {
		if (!(cin >> n >> d)) {
			return 0;
		}
		forn (i, n) {
			scanf("%d", &a[i]);
		}
		cin >> m;
		forn (i, m) {
			scanf("%d", &q[i]);
			--q[i];
		}
		return 1;
	}

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

struct Data: Input {
	bool ans[M];
	
	void write () {
		forn (i, m) {
			puts(ans[i] ? "YES" : "NO");
		}
	}
};


namespace Main {
	
	struct Solution: Data {
		int pos[N + 1];
		ll mx[N + 1];
		
		void solve () {
			pos[0] = d;
			forn (i, n) {
				pos[i + 1] = min(pos[i], abs(pos[i] - a[i]));
			}
			mx[n] = 0;
			ford (i, n) {
				mx[i] = (a[i] >= (mx[i + 1] + 1) * 2 ? mx[i + 1] : mx[i + 1] + a[i]);
			}
			forn (i, m) {
				ans[i] = (pos[q[i]] > mx[q[i] + 1]);
			}
		}
		
		void clear () {
			*this = Solution();
		}
	};
}


Main::Solution sol;

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

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


Measured memory_bytes: 12160
#include <algorithm>
#include <iostream>
#include <limits>
#include <vector>

int main() {
	int N, C;
	std::cin >> N >> C;

	std::vector<std::vector<int>> D(C, std::vector<int>(C));
	for(int i = 0; i < C; i++) {
		for(int j = 0; j < C; j++) {
			std::cin >> D[i][j];
		}
	}

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

	// 余りで3つに分ける（rem[i] はあまりiの者たち）
	std::vector<std::vector<int>> rem(3);
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < N; j++) {
			rem[(i + j) % 3].emplace_back(c[i][j] - 1);
		}
	}

	// cost[i][j] あまりiを色jに変えるコスト
	std::vector<std::vector<int>> cost(3, std::vector<int>(C, 0));
	for(int ci = 0; ci < C; ci++) {
		for(int ri = 0; ri < 3; ri++) {
			for(int ori : rem[ri]) {
				cost[ri][ci] += D[ori][ci];
			}
		}
	}

	int min = std::numeric_limits<int>::max();
	for(int c1 = 0; c1 < C; c1++) {
		for(int c2 = 0; c2 < C; c2++) {
			for(int c3 = 0; c3 < C; c3++) {
				if(c1 != c2 && c2 != c3 && c3 != c1) {
					min = std::min(min, cost[0][c1] + cost[1][c2] + cost[2][c3]);
				}
			}
		}
	}

	std::cout << min << std::endl;

	return 0;
}

Measured memory_bytes: 2428
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int x=(n-1)/2;
    int y=x+1;
    cout<<a[y]-a[x];
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include<cstdlib>
#include<map>
#include<math.h>
#include<utility>
#include<vector>
using namespace std ;
typedef long long ll;

// N K
// A_1, ..., A_N
int main(){
  int N, K ;
  cin >> N >> K ;

  vector<int> h ;
  for(int i=0; i!=N; ++i)
  {
    int tmp ;
    cin >> tmp ;
    h.push_back(tmp) ;
  }

  sort(h.begin(),h.end(),greater<int>());

  long long ans = 1000000010;
  for(int i=0; i != N-K+1; ++i){
    long long tmp = h[i] - h[i+K-1] ;
    if(ans>tmp)
      ans = tmp ;
  }
  cout << ans << endl ;
}

Measured memory_bytes: 892
def selectionSort(a,n):
    r = 0
    for i in range(n):
        minj = i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            r += 1
    return r


n = int(input())
a = list(map(int,input().split()))

r = selectionSort(a,n)

print(*a)
print(r)


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

int main(){
	int X;
	cin >> X;
	int pos = 0;
	int ans = 1;
	while (true) {
		pos += ans;
		if (pos >= X) {
			cout << ans << endl;
			return 0;
		}
		ans++;
	}
	return 0;
}

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

int main() {
  // 答えの数と入力を入れる文字列
  int answerCounts = 0;
  string s = "";
  
  // 入力
  cin >> s;
  
  // 1かどうか判定
  if (s[0] == '1') answerCounts ++;
  if (s[1] == '1') answerCounts ++;
  if (s[2] == '1') answerCounts ++;
  
  // 答え
  cout << answerCounts << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <fstream>

using namespace std;

#define M 16777216
#define L 14

char H[M];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else /*if ( ch == 'T')*/ return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 4;
  }
  return sum;
}

int find(char str[])
{
  if(H[getKey(str)] == 'y') return 1;
  else return 0;
}

void insert(char str[])
{
  H[getKey(str)] = 'y';
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
	      cout << "yes" << endl;
	    } else {
	      cout << "no" << endl;;
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 19616
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

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

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

size_t dfs(const size_t N, const size_t A, const size_t B, const size_t C, const size_t *l, const size_t idx, const size_t aCur, const size_t bCur, const size_t cCur)
{
	if (idx == N) {
		if (aCur == 0 || bCur == 0 || cCur == 0) {
			return (size_t)1000000;
		}
		else {
			return ABSS(A, aCur) + ABSS(B, bCur) + ABSS(C, cCur);
		}
	}

	const size_t ret0 = dfs(N, A, B, C, l, idx + 1, aCur, bCur, cCur);
	const size_t ret1 = dfs(N, A, B, C, l, idx + 1, aCur + l[idx], bCur, cCur) + 10;
	const size_t ret2 = dfs(N, A, B, C, l, idx + 1, aCur, bCur + l[idx], cCur) + 10;
	const size_t ret3 = dfs(N, A, B, C, l, idx + 1, aCur, bCur, cCur + l[idx]) + 10;

	return MIN(MIN(ret0, ret1), MIN(ret2, ret3));
}

int main(void) {
	size_t N, A, B, C;
	size_t l[8];

	scanf("%zu %zu %zu %zu\n", &N, &A, &B, &C);
	for (size_t i = 0; i < N; i++) {
		scanf("%zu", &l[i]);
		if (i < N - 1) {
			scanf("\n");
		}
	}

	qsort(l, N, sizeof(size_t), compare_f);

	const size_t mp = dfs(N, A, B, C, l, 0, 0, 0, 0) - 30;

	printf("%zu\n", mp);

	return 0;
}


Measured memory_bytes: 128
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3")
#define rtn return
#define endl '\n'
#define F first
#define S second
#define mt make_tuple
#define pb push_back
#define int long long
#define value_at find_by_order
#define index_of order_of_key
#define fill(a, v) memset(a,v,sizeof(a))
#define copy(a, b) memcpy(b,a,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i, n) for(int i=0;i<(int)n;++i)
#define per(i, n) for(int i=(int)n-1;i>=0;--i)
#define rep1(i, n) for(int i=1;i<=(int)n;++i)
#define per1(i, n) for(int i=(int)n;i>=1;--i)
#define loop(i, begin, end) for(int i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef string str;
typedef long double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pll;
typedef vector<int> vll;
typedef vector<pll> vpll;
typedef vector<db> vdb;

template<class T, class V> void remin(T &a, V b) { a > b ? a = b : a = a; }
template<class T, class V> void remax(T &a, V b) { a < b ? a = b : a = a; }
template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF = 1e18;
const db EPS = 1e-15;
const int MOD = 1e9 + 7;
const int N = 1e5 + 7;

//

int32_t main() {
  FAST_IO;
  str s;
  cin >> s;
  int i = 0, j = s.size() - 1;
  int ans = 0;
  while (i < j) {
    ans += ((s[i++] != s[j--]) ? 1 : 0);
  }
  cout << ans << '\n';
  rtn 0;
}


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

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

    string s;
    cin >> s;
    ll n = s.size();
    ll z = 0, o = 0;

    for (ll i = 0; i < n; i++){
        if (s[i] == '0'){
            z++;
        }
        else{
            o++;
        }
    }

    cout << n - abs(z-o) << endl;
}

Measured memory_bytes: 3764
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
  int A, B;
  scanf("%d %d", &A, &B);
  printf("%d\n", max(A + B, max(A - B, A * B)));
  
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    ans=""
    for i in range(3):
        ans+=input()[i]
    print(ans)
#%%submit!
resolve()

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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    cout << (K <= A ? K : K <= A + B ? A : A - (K - A - B)) << endl;
    return 0;
}


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

int main() {
  std::string s;
  std::cin >> s;
  std::reverse(s.begin(), s.end());

  std::vector<std::string> patters = {"dream", "dreamer", "erase", "eraser"};
  std::vector<std::string> rev_patters;
  for (auto p : patters) {
    std::reverse(p.begin(), p.end());
    rev_patters.push_back(p);
  }

  std::size_t i = 0;
  for (;;) {
    bool found = false;
    for (auto p : rev_patters) {
      if (s.substr(i, p.size()) == p) {
        // 一致
        i += p.size();
        found = true;
      }
    }
    if (not found)
      break;
  }
  if (i == s.size())
    std::cout << "YES" << std::endl;
  else
    std::cout << "NO" << std::endl;

}


Measured memory_bytes: 512
#include <stdio.h>

int main(void){


	int n, i;
	scanf("%d", &n);
	int su[n];
	for(i = 0; n > i; i++){
		scanf("%d", &su[i]);
	}
	for(; n > 0; n--){
		
		printf("%d", su[n-1]);
		if(n == 1){
			break;
		}
		printf(" ");
	}
	printf("\n");

	return 0;

}

Measured memory_bytes: 600
//Only the Creator has given me strength!
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<bitset>
typedef long long ll;
#define pi 3.1415926535897931159979635
#define pb push_back
#define vctr vector < int >
#define vvtr vector < vctr >

using namespace std;
void fastio() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int main() {
    fastio();
    int n, ans=0;
    ll d;
    cin>>n>>d;
    d=d*d;
    ll a,b;
    for(int i=0; i<n; i++) {
        cin >> a >> b;
        if(a*a+b*b<=d) ans++;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3160
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int h,m,h2,m2,k;
    std::cin >> h >> m >> h2 >> m2 >> k ;
    int time;
    time = (60*h2 + m2) - (60*h + m);
    std::cout << time-k << std::endl;
}


Measured memory_bytes: 3672
#include<stdio.h>

int main()
{
  int X,Y,i,j,TURU,KAME;
  scanf("%d %d",&X,&Y);
  for(i=0;i<=X;i++)
  {
   TURU=i;
   KAME=X-i;
  if(TURU+KAME==X&&TURU*2+KAME*4==Y)
  {
    printf("Yes");
    return 0;
  }
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 2100
#include <cstdio>
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a == b) {
    puts("Draw");
  } else if (a == 1) {
    puts("Alice");
  } else if (b == 1) {
    puts("Bob");
  } else if (a > b) {
    puts("Alice");
  } else {
    puts("Bob");
  }
}

Measured memory_bytes: 128
import copy

class suit():
    def __init__(self, card):
        self.s = card
    def value(self):
        return int(self.s[1])

def bubblesort(seq):
    for i in range(len(seq)):
        for j in reversed(range(i + 1, len(seq))):
            if seq[j].value() < seq[j - 1].value() :
                seq[j], seq[j - 1] = seq[j - 1], seq[j]

    return seq

def selectionsort(seq):
    for i in range(len(seq)):
        mini = i
        for j in range(i, len(seq)):
            if seq[j].value() < seq[mini].value():
                mini = j

        seq[i], seq[mini] = seq[mini], seq[i]

    return seq

def is_stable(inp, out):
    for i in range(len(inp)):
        if inp[i] != out[i]:
            return "Not stable"
    return "Stable"

def main():
    cards = list()
    n = int(input())

    for card in input().split():
        cards.append(suit(card))

    seq1 = copy.copy(cards)
    seq2 = copy.copy(cards)

    seq1 = bubblesort(seq1)
    seq2 = selectionsort(seq2)

    print(seq1[0].s, end="")
    for i in range(1, len(seq1)):
        print(" " + seq1[i].s, end = "")
    print("\nStable")

    print(seq2[0].s, end="")
    for i in range(1, len(seq2)):
        print(" " + seq2[i].s, end = "")
    print("\n" + is_stable(seq1, seq2), end="")
    print()

main()


Measured memory_bytes: 6348
#include <iostream>
#include <map>

#define MOD 1000000007

using ll = long long;

void solve(const std::string &s) {
    std::map< char, ll > mp;
    ll ans =  1;
    for (const char &c : s) ++mp[c];
    for (auto m : mp) {
        ans = (ans * (m.second + 1)) % MOD;
    }
    std::cout << ans - 1 << std::endl;
}
int main() {
    ll n;
    std::string s;
    std::cin >> n >> s;
    solve( s );
    return 0;
}


Measured memory_bytes: 512
def minmax(v, rate):
    min_v = v / rate * 100
    max_v = (v + 1) / rate * 100
    return (min_v, max_v)


def valid(v, a, b):
    #    print(int(v * 0.08), int(v * 0.1))
    return int(v * 0.08) == a and int(v * 0.1) == b


def main():
    A, B = map(int, input().split())

    a = minmax(A, 8)
    b = minmax(B, 10)

    #print(a, b)
    i = max(int(a[0]), int(b[0]))
    j = min(int(a[1]), int(b[1]))
    for i in range(i, j + 1):
        if valid(i, A, B):
            print(i)
            exit()
    print(-1)


main()


Measured memory_bytes: 3192
import Control.Applicative
import Control.Monad

qsort :: [Int] -> [Int]
qsort [] = []
qsort (p:xs) = qsort gteq ++ [p] ++ qsort lt
  where gteq = [x | x <- xs, x >= p]
        lt   = [x | x <- xs, x < p ]

solver :: [Int] -> [Int] -> String
solver [] _ = []
solver _ [] = []
solver ws ks =
  let sortedws = qsort ws
      sortedks = qsort ks
      scoreW = sum $ take 3 sortedws
      scoreK = sum $ take 3 sortedks
  in
      show scoreW ++ " " ++ show scoreK


main :: IO()
main = do
  contents <- map (read :: String -> Int) <$> replicateM 20 getLine
  let (w,k) = splitAt 10 contents
  putStrLn $ solver w k

Measured memory_bytes: 3736
import sys


okkiikazu=1000000007

#+++++
		
def main():
	b , c = map(int, input().split())
	al=[int(input()) for _ in range(c)]
	al=set(al)
	rr=[0]*(b+1)
	rr[0]=1
	for i,_ in enumerate(rr):
		cc=rr[i] #i段目に到達する方法の数
		for j in range(2):
			vv=i+1+j
			if (not (vv in al)) and (vv)<=b:
				rr[vv] += cc
		
	print(rr[-1] % okkiikazu)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		


if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 462712
#include<bits/stdc++.h>
using namespace std;
const int N=10005;
int n,q,f[N];
int find(int u){
	return f[u]==u?u:f[u]=find(f[u]);
}
signed main(void){
	cin>>n>>q;
	for(int i=0;i<n;i++) f[i]=i;
	for(int i=0;i<q;i++){
		int x,y,k;
		cin>>k>>x>>y;
		if(k){
			if(find(x)==find(y))
				cout<<1<<endl;
			else
				cout<<0<<endl;
		}
		else
			f[find(x)]=find(y);
	}
}

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

#define ForA(i,b,a) for(int i = a; i >= b; i--)
#define ForB(i,a,b) for(int i = a; i <= b; i++)
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mmset(arr, n) memset(arr, n, sizeof arr)
#define PI 3.1415926535897932384626433832795l
#define deci(n) cout<<fixed<<setprecision(n);
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define ALPHA 27
#define IT(a , b) map <a , b> :: iterator
#define ll long long int
#define ld long double
#define debug(x) cerr << '#' << ' ' << x << '\n'
#define len(s) s.length()
#define maxn 1000010

using namespace std;

const ll INF = (ll)(8e18);
const ll MOD = 1e9 + 7;

class Print{
   public:
   void print(int n){
       cout << n << '\n';
       exit(0);
   }
   void print(ll n){
       cout << n << '\n';
       exit(0);
   }
   void print(string s){
       cout << s << '\n';
       exit(0);
   }
   void print(ld n){
       cout << n << '\n';
       exit(0);
   }
};

vector < pair <ll, ll> > v, p;
bool vis[51];

int main()
{
    IOS;
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //#endif
    Print _p;
    ll n; cin >> n;
    for(int i = 0; i < n; i++){
        ll x,y; cin >> x >> y;
        v.pb(mk(x, y));
    } 
    sort(v.begin(), v.end());
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            p.pb(mk(v[j].F - v[i].F , v[j].S - v[i].S));
        }
    }
    ll ans = INT_MAX;
    for(int i = 0; i < p.size(); i++){
        ll val = 0;
        for(int j = 0; j < n; j++){
            if(vis[j] == true) continue;
            ll pp = p[i].F, qq = p[i].S;
            for(int k = j + 1; k < n; k++){
              if(vis[k] == false){
                 if(v[k].F - v[j].F == pp && v[k].S - v[j].S == qq){
                     vis[k] = true;
                     pp += p[i].F;
                     qq += p[i].S;
                 }
              }
           }
           val++;
        }
        ans = min(ans, val);
        mmset(vis, false);
    }
    cout << (ans == INT_MAX ? 1 : ans) << '\n';
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int h = sc.nextInt();
		int w = sc.nextInt();
		char a[][] = new char[h][w];

		for (int i = 0;i<h ;i++ ) {
				String temp = sc.next();
			for (int j = 0;j<w ;j++ ) {
				a[i][j] = temp.charAt(j);
			}
		}

		for (int j = 0;j<w ;j++ ) {
			int count = 0;
			for (int i = 0;i<h ;i++ ) {
				if (a[i][j]=='#') {
				}else{
					count++;
				}
			}
			if (count==h) {
				for (int k = 0;k<h ;k++ ) {
					a[k][j] = ' ';
				}
			}
	}

	for (int i = 0;i<h ;i++ ) {
		int count = 0;
		for (int j = 0;j<w ;j++ ) {
			if (a[i][j]==' '||a[i][j]=='.') {
				count++;
			}
		}
		if (count==w) {
			for (int k = 0;k<w ;k++ ) {
				a[i][k] = ' ';
			}
		}
}

		for (int i = 0;i<h ;i++ ) {
			int count =0;
			for (int t = 0;t<w ;t++ ) {
				if (a[i][t]==' ') {
				}else{
					System.out.print(a[i][t]);
					count++;
				}
			}
			if (count>0) {
				System.out.println();
			}
		}


	}
}


Measured memory_bytes: 24508
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    n = I()
    command = [LSS() for _ in range(n)]

    que = collections.deque()
    for i in command:
        if i[0]=='insert':
            que.appendleft(i[1])
        elif i[0]=='delete':
            if i[1] in que:
                que.remove(i[1])
        elif i[0]=='deleteFirst':
            que.popleft()
        elif i[0]=='deleteLast':
            que.pop()

    print(*que)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 526820
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
string S;

void solve(){
	int s = S.size();
	rep(i, s - 1){
		if(S[i] == S[i + 1]){
			cout << i + 1 << " " << i + 2 << endl;
			return;
		}
		if(i < s - 2 and S[i] == S[i + 2]){
			cout << i + 1 << " " << i + 3 << endl;
			return;
		}
	}
	cout << "-1 -1" << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> S;
		solve();
	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		boolean isSolved = false;
		outer: for (int x = 0; x <= N; x++) {
			for (int y = 0; y <= N; y++) {
				int z = N - x - y;
				if (z < 0)
					break;
				else if (isSolved = (x * 10000 + y * 5000 + z * 1000 == Y)) {
					System.out.println(x + " " + y + " " + z);
					break outer;
				}
			}
		}

		if(!isSolved) {
			System.out.println("-1 -1 -1");
		}
		sc.close();

	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    cin >> n;

    vector<ll> h(n);
    vector<ll> dp(100010, LL_MAX);

    rep(i,0,n) cin >> h[i];

    dp[0] = 0;

    rep(i,0,n-1)
    {
        ll t1 = abs(h[i] - h[i+1]);
        ll t2 = abs(h[i] - h[i+2]);

        //cout << t1 << ' ' << t2 << endl;
        dp[i+1] = min(dp[i+1], dp[i] + t1);     
        dp[i+2] = min(dp[i+2], dp[i] + t2);     
    }

    //rep(i,0,n) cout << dp[i] << endl;
    cout << dp[n-1] << endl; 

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

    int x; cin >> x;

    ll tempsum = 0;
    int ans = 0;
    for(int i=1; i<=x; i++){
        tempsum += i;
        if(tempsum >= x){
            ans = i;
            break;
        }
    }

    cout << ans;

    return 0;
}

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

using namespace std;
using i64 = std::int_fast64_t;
using u64 = std::uint_fast64_t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<pair<i64, i64>> A(N);
  for (int i = 0; i < N; i++) {
    i64 x, l;
    cin >> x >> l;
    A[i] = make_pair(x - l, x + l);
  }
  sort(A.begin(), A.end(),
       [](pair<i64, i64> a, pair<i64, i64> b) { return a.second < b.second; });
  int res = 0;
  i64 cur = -(static_cast<i64>(1) << 32);
  for (int i = 0; i < N; i++) {
    if (cur <= A[i].first) {
      res++;
      cur = A[i].second;
    }
  }
  cout << res << '\n';
  return 0;
}


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

using namespace std;

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n;

    cin >> n;

    ll res = 0;

    for (ll m = 1; (m + 1) * (m + 1) <= n; m++) {
        if (n % (m + 1)) continue;
        if (n / (m + 1) < m) res += m;
    }

    for (ll r = 1; ld(n / r) * ld(n / r) > n; r++) {
        if (n % r) continue;
        if (r < n / r - 1) res += n / r - 1;
    }

    cout << res << "\n";

    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue;
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> vec){ return (ll)vec.size(); }
ll sz(string s){ return (ll)s.size(); }

ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }

ll imos[30][200002] = {};
int main(){
    ll n,m;
    cin >> n >> m;
   
    
    rep(i,0,n){
        ll a,b,c;
        cin >> a >> b >> c;
        imos[c-1][2*a-1]++;
        imos[c-1][2*b]--;
    }
    rep(i,0,30) rep(j,1,200002) imos[i][j] += imos[i][j-1];
    rep(i,0,30) rep(j,0,200002) imos[i][j] = min(1LL,imos[i][j]);

    ll ans = 0;
    rep(i,0,200002){
        ll cnt = 0;
        rep(j,0,30){
            cnt += imos[j][i];
        }
        ans = max(cnt,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 50496
def m(a,b)
return 1 if b==0
return a*m(a-1,b-1)/b
end
n,a,b=gets.split.map &:to_i
v=gets.split.map &:to_i
v.sort!
v.reverse!
u=v.take(a)
e=u.inject(0.0){|r,i|r+=i}/u.size
x=y=r=0
n.times{|i|(x+=1;y+=1 if i<a) if v[i]==v[a-1]}
y==a ? a.upto(b){|i|r+=m(x,i)} : r+=m(x,y)
puts e,r

Measured memory_bytes: 3836
//
//  main.cpp
//  ALDS1_1-A
//
//  Created by ?????¶??? on 15/8/30.
//  Copyright (c) 2015??´ ?????¶???. All rights reserved.
//

#include <iostream>
#include <vector>

namespace Function {
    
    void showNumbers(std::vector<int> numbers){
        
        for (auto & num : numbers){
            
            if (num == numbers.back()) {
                
                printf("%d", num);
                
            }else{
                printf("%d ", num);
            }
        }
        
        printf("\n");
    }
}

int main() {
    
    int count;
    std::cin >> count;
    
    int num;
    
    std::vector<int> numbers;
    
    for (int i = 0; i < count; ++i) {

        std::cin >> num;
        numbers.push_back(num);
    }
    
    for (int i = 0; i < numbers.size(); ++i) {

        for (int j = i; j > 0; --j) {
            
            if (numbers[j] < numbers[j - 1]) {
                
                int temp = numbers[j];
                numbers[j] = numbers[j - 1];
                numbers[j - 1] = temp;
            }
        }
        
        Function::showNumbers(numbers);
    }
    
    return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#define inf 10e8
#define rep(i,n) for(long i=0;i<n;i++)
using namespace std;

int kiriage(int x){
    if(x%10==0) return x;
    else return (x/10)*10+10;
}

int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >>e;
    int ans=kiriage(a)+kiriage(b)+kiriage(c)+kiriage(d)+kiriage(e);
    int f=inf;
    if(a%10!=0) f=min(f,a%10);
    if(b%10!=0) f=min(f,b%10);
     if(c%10!=0) f=min(f,c%10);
     if(d%10!=0) f=min(f,d%10);
     if(e%10!=0) f=min(f,e%10);
    if(f==inf) f=10;
    cout << ans-10+f << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int a[1000][4];

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    if(!n)break;
    rep(i, n)scanf("%d%d%d%d", &a[i][0], &a[i][1], &a[i][2], &a[i][3]);
    int4(P, Q, R, C);
    bool is = false;
    rep(i, n){
      if(a[i][1] > P || a[i][2] > Q || a[i][3] > R)continue;
      if((a[i][1] + a[i][3]) * 4 + a[i][2] * 9 > C)continue;
      pri(a[i][0]);
      is = true;
    }

    if(!is)puts("NA");

//*/

//*/ break;
  }
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<ll> sum(n + 1, 0);
    for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
    ll ans = 1e18;
    for (int i = 1; i < n; i++) {
        ll x = sum[i];
        ll y = sum[n] - sum[i];
        ans = min(ans, abs(x - y));
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define ll long long int

ll MAX=100000000009;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<pair<ll, ll> > v;
    for(int i=0;i<n;i++){
        ll x, y;
        cin>>x>>y;
        v.push_back(make_pair(x, y));
    } 
    ll mx,my,mx2,my2;
    mx = MAX;my=-1;mx2=mx;my2=-1000000000000009;
    for(int i=0;i<n;i++){
        mx = min(mx, (v[i].first + v[i].second));
        my = max(my, (v[i].first + v[i].second));
        mx2 = min(mx2, v[i].first - v[i].second);
        my2 = max(my2, v[i].first - v[i].second);

    }
    cout<<max(abs(my-mx), abs(mx2-my2))<<endl;


    return 0;
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const int INF = 100100100;
typedef long long ll;
 
int main() {
   string w;
   cin >> w;
   int cnt[30]={};
   string ans="Yes";
   
   rep(i,w.size())
   cnt[w[i]-'a']++;

   rep(i,26){
      if(cnt[i]%2)
      ans="No";
   }
   cout << ans << endl;
}

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

int main(){
  long double a,b,c;
  cin >> a >> b >> c;
  long double e=1.0E-14;
  if(sqrt(a)+sqrt(b)+e<sqrt(c)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3784
n,k = map(int,input().split())
s = input()
next = 0
l = []
ans = 0
if s[0]=='0':
    cnt=1
else:
    cnt = 0
for i in range(1,n):
    if s[i]=='0' and s[i-1]=='1':
        cnt += 1
    if s[i]=='1' and s[i-1]=='0':
        l.insert(0,i)
    if s[i]=='0' and s[i-1]=='1' and cnt==k+1:
        ans = max(ans,i-next)
        next = l.pop()
        cnt -= 1
    if i==n-1 and s[i]=='1':
        ans = max(ans,i+1-next)
    if i==n-1 and s[i]=='0':
        ans = max(ans,i+1-next)
if ans==0:
    print(n)
else:
    print(ans)

Measured memory_bytes: 4328
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
#define X first
#define Y second
typedef long long ll; 
std::vector<int> seq, seq2, vec; 
int arr[1005]; 
int main()
{
	// freopen("ARC092-E.in", "r", stdin); 
	int n; 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i); 
	ll sum = 0; 
	for (int i = 0; i < n; i += 2)
	{
		if (arr[i] > 0)
		{
			seq.pb(i); 
			sum += arr[i]; 
		}
	}
	ll ans = sum; 
	sum = 0; 
	for (int i = 1; i < n; i += 2)
	{
		if (arr[i] > 0)
		{
			seq2.pb(i);
			sum += arr[i]; 
		}
	}
	if (ans < sum)
	{
		seq = seq2; 
		ans = sum;
	}
	if (!seq.size())
	{
		ans = arr[0]; 
		seq.pb(0); 
		for (int i = 1; i < n; i++)
		{
			if (ans < arr[i])
			{
				ans = arr[i]; 
				seq[0] = i; 
			}
		}
	}
	printf("%lld\n", ans);
	for (int i = 0; i < seq[0]; i++)
		vec.pb(0); 
	for (int i = 0; i + 1 < seq.size(); i++)
	{
		for (int j = 3; j <= seq[i + 1] - seq[i]; j += 2)
			vec.pb(2); 
		vec.pb(1); 
	}
	int rem = n - seq[seq.size() - 1] - 1; 
	while (rem)
		vec.pb(rem--); 
	printf("%d\n", (int)vec.size());
	for (int x : vec)
		printf("%d\n", x + 1);
	return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector <int> a(n), b(n);
  REP(i, n) {
	cin >> a[i] >> b[i];
  }
  sort(all(a));
  sort(all(b));
  int ans;
  if (n % 2 == 0) {
	  int meda = a[(n - 1) / 2] + a[(n) / 2];
	  int medb = b[(n - 1) / 2] + b[(n) / 2];
	  ans = medb - meda + 1;
	} else {
	  ans = b[n / 2] - a[n / 2] + 1;
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4816
let i=readLine()!.characters.split(" ").map{Int(String($0))!},x=i[0],y=i[1]
var ans=Int(2e9)
if x <= y {
  ans=min(ans,y-x)
}
if -x <= y {
  ans=min(ans,y+x+1)
}
if x <= -y {
  ans=min(ans,-y-x+1)
}
if -x <= -y {
  ans=min(ans,-y+x+2)
}
print(ans)

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<bool> h(10, 0);
  for (int i = 0; i < k; i++) {
    int a;
    cin >> a;
    h[a] = 1;
  }

  for (n; 1; n++) {
    bool ok = 1;
    for (int x = 1; x < 1000000; x *= 10) {
      if (h[n % (10 * x) / x] == 1 && n >= x) {
        ok = 0;
        break;
      }
    }
    if (ok)
      break;
  }
  cout << n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int N; cin >> N;
    set<string> k;
    for (int i = 0; i < N; i++) {
        string S; cin >> S;
        k.insert(S);
    }

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

    return 0;
}

Measured memory_bytes: 19116
#include<iostream>
#include<cstdio>

int n,m;
const int mod=998244353;
int powM[500050],powN[500050],fact[500050],ifact[500050];

inline int pow(int a,int b){
	int ret=1;
	for (;b;b>>=1,a=static_cast<long long>(a)*a%mod)
		if (b&1) ret=static_cast<long long>(ret)*a%mod;
	return ret;
}

int ans;

int main(){
	scanf("%d%d",&n,&m);
	powM[0]=1,powN[0]=1;
	for (int i=1;i<=n;i++) powM[i]=powM[i-1]*(m+1LL)%mod;
	for (int i=1;i<=m;i++) powN[i]=powN[i-1]*(n+1LL)%mod;
	fact[0]=1;
	for (int i=1;i<=n||i<=m;i++) fact[i]=static_cast<long long>(fact[i-1])*i%mod;
	ifact[std::max(n,m)]=pow(fact[std::max(n,m)],mod-2);
	for (int i=std::max(n,m);i;i--) ifact[i-1]=static_cast<long long>(ifact[i])*i%mod;
	for (int i=0;i<=n&&i<=m;i++){
		if (i&1) ans=(ans-static_cast<long long>(ifact[i])*ifact[n-i]%mod*ifact[m-i]%mod*powM[n-i]%mod*powN[m-i]%mod+mod)%mod;
		else ans=(ans+static_cast<long long>(ifact[i])*ifact[n-i]%mod*ifact[m-i]%mod*powM[n-i]%mod*powN[m-i]%mod+mod)%mod;
	}
	printf("%lld\n",static_cast<long long>(ans)*fact[n]%mod*fact[m]%mod);
}


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

typedef long int32;
typedef unsigned long uint32;
typedef long long int64;
typedef unsigned long long uint64;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rFOR(i,a,b) for(int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x,n) FOR(i,0,n) cout << x[i] << " "; cout << endl

// Custom global variable 

bool check(long n) {
  return long(sqrt(n)) * long(sqrt(n)) == n;
}
 
long dis(vector<int> a, vector<int> b, int n) {
  long res = 0;
  for(int i = 0; i < n; i++) 
    res += (a[i] - b[i]) * (a[i] - b[i]);
  if(check(res)) return res;
  else return -1;
}

// ----------------------
auto main() -> int
{
  #ifdef DEBUG
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
  #endif
  // Fast I/O
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  // Code starts here ---

  int m,n;
  int d = 0;
  cin >> m >> n;
  vector<vector<int>> arr(m);
  for(auto &i:arr) i.resize(n);
  
  for(int i = 0; i < m; i++)
    for(int j = 0; j < n; j++)
      cin >> arr[i][j];
  for(int i = 0; i < m; i++)
    for(int j = i+1; j < m; j++) {
      long x = dis(arr[i], arr[j], n);
      if(x != -1)
        d++;
    }
  cout << d;

  // ---------------------
  #ifdef DEBUG
    cerr << endl << "Time:" << double(clock())/CLOCKS_PER_SEC << " secs" << endl;
  #endif
}


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

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

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

int main(void)
{
    long long A, B;
    cin >> A >> B;

    cout << lcm(A, B) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<climits>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<queue>


int main(){
	int n;
	std::vector<int> aList;
	std::vector<int> box;

	std::cin>>n;
	aList.resize(n+1);
	box.resize(n+1, 0);


	for(int i=1; i<n+1; i++)
		std::cin>>aList[i];

	for(int i=n; i>n/2; i--)
		box[i]= aList[i];

	for(int i=n/2; i>0; i--){
		int numBall=0;
		for(int j=1; j<n+1; j++){
			if(i*j>n)
				break;

			numBall+= box[i*j];
		}
		if(numBall%2 != aList[i])
			box[i]=1;
		else
			box[i]=0;
	}

	int m=0;

	for(int i=0; i<n+1; i++)
		m+= box[i];

	std::cout<<m<<std::endl;
	for(int i=0; i<n+1; i++)
		if(box[i]>0)
			std::cout<<i<<std::endl;

	return 0;
	
}

Measured memory_bytes: 2432