akhauriyash/Code-Regression huggingface dataset:
// Maximum Difference
#include <iostream>
using namespace std;
int N,max_int,min_int;
int main(){
    cin >> N;
    int a[N];
    for(int i=0;i<N;++i){
        cin >> a[i];
    }
    max_int=min_int=a[0];
    for (int i=0;i<N;++i){
        if(a[i]>max_int) max_int = a[i];
        if(a[i]<min_int) min_int = a[i];
    }
    cout << max_int - min_int << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

class P{
public:
  int a;
  int b;
  int c;
  ll d;
};

int main(){
  int n = in();
  int m = in();
  int q = in();
  vector<int> lines(1,1);
  vector<P> points(q);
  foreach(i,points){
    i.a = in();
    i.b = in();
    i.c = in();
    i.d = in();
  }


  function<ll(void)> culc =
    [&](){
      ll res = 0;
      foreach(i,points){
        if(lines[i.b]-lines[i.a]==i.c){
          res += i.d;
        }
      }
      return res;
    };
  function<ll(void)> func =
    [&]()->ll{
      if(lines.size()==n+1){
        return culc();
      }
      ll ans = 0;
      rep(i,lines.back(),m+1){
        lines.push_back(i);
        chmax(ans,func());
        lines.pop_back();
      }
      return ans;
    };
  cout << func() << endl;
  return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>

int main () {
	
	int a ,b, c, d;
	
	scanf("%d %d",&a,&b);
	
	c = a * b;
	
	d = ( 2 * a ) + ( 2 * b );
	
	printf("%d %d\n",c,d);
	
	return 0;
}
	

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int sum[4][110], sz[4];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, W, v[110];
	ll w[110];
	cin>>n>>W;
	REP(i, n){
		cin>>w[i]>>v[i];
	}
	vi cnt[4];
	cnt[0].push_back(v[0]);
	sz[0]=1;
	REP(i, n-1){
		cnt[w[i+1]-w[0]].push_back(v[i+1]);
		++sz[w[i+1]-w[0]];
	}
	REP(i, 4){
		sort(ALL(cnt[i]), greater<int>());
	}
	REP(i, 4){
		REP(j, sz[i]){
			sum[i][j+1]=sum[i][j]+cnt[i][j];
		}
	}
	int ans=0;
	REP(i, sz[0]+1){
		REP(j, sz[1]+1){
			REP(k, sz[2]+1){
				REP(l, sz[3]+1){
					ll tmp=(i+j+k+l)*w[0]+j+k*2+l*3;
					if(tmp<=W){
						CHMAX(ans, sum[0][i]+sum[1][j]+sum[2][k]+sum[3][l]);
					}
				}
			}
		}
	}
	cout<<ans<<'\n';
	return 0;
}


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

int main(){

  int n,m;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> m;
    int a = 0,b = 0,x,y;

    cin >> x;
    for(int j=1;j<m;j++){
      y = x;
      cin >> x;
      a = max(a,y-x);
      b = min(b,y-x);
    }

    cout << -1*b << " " << a << endl;
  }
}

Measured memory_bytes: 1160
import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
max_a = max(a)
min_a = min(a)

if max(a) <= 0:
    count = max_a
    for i in range(n - 1):
        count += abs(a[i])
    print(count)
    for i in range(n - 1):
        print(max_a, a[i])
        max_a -= a[i]
elif min(a) >= 0:
    count = -min_a
    for i in range(n - 1):
        count += a[i + 1]
    print(count)
    for i in range(n - 2):
        print(min_a, a[i + 1])
        min_a -= a[i + 1]
    print(max_a, min_a)
else:
    count = 0
    for i in range(n):
        count += abs(a[i])
    print(count)
    num = bisect.bisect(a, 0)
    for i in range(num + 1, n):
        print(min_a, a[i])
        min_a -= a[i]
    a_num = a[num]
    a[0] = min_a
    for i in range(num):
        print(a_num, a[i])
        a_num -= a[i]

Measured memory_bytes: 14060
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = 3.141592653589;
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,k;
    cin >> n >> k;
    intl cnt = 0;
    repi(i,k,n+2){
        intl large =  0.5 * n * (n + 1) - 0.5 * (n - i) * (n + 1 - i);
        intl small = 0.5 * i * (i + 1) - i;
        cnt += large - small + 1;
        cnt %= MOD;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>

#define N 100000
int count=0;

void change(int *n, int *m){
  int x;
  x = *n;
  *n = *m;
  *m = x;
}

int partition(int A[], int p, int r){
  int i, j, x, n;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++){
    if(A[j] <= x){
      i++;
      change(&A[i], &A[j]);
    }
  }
  change(&A[i+1], &A[r]);
  return i+1;
}

int main(){
  int n,i,x;
  int A[N],p,r;
  scanf("%d",&n);
  for(i=1; i<=n; i++){
    scanf("%d",&A[i]);
  }
  x=partition(A, 1, n);
  for(i=1; i<n; i++) {
    if(i==x) printf("[%d] ",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  return 0;
}

Measured memory_bytes: 988
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using bl = bool;
using vll = V<ll>;
using vbl = V<bl>;
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  int q;
    cin>>q;
  vector<bool> A(100100,true);
  for(int i=2;i<=100010;i++){
    int up=sqrt(i)+1;
    for(int j=2;j<up;j++){
      if(i%j==0){
         A[i]=false;
        break;
      }
    }
  }

  vector<int> B(100100);
  for(int i=3;i<=100010;i+=2){
    B[i]=B[i-2];
    if(A[i]&&A[(i+1)/2]){
      B[i]++;
    }
  }
  for(int i=0;i<q;i++){
    int l,r;
      scanf("%d%d",&l,&r);
    if(l==1){
      l+=2;
    }
    printf("%d\n",B[r]-B[l-2]);
  }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n,k;
	cin>>n>>k;
	ll arr[n+1];
	for(int a=1;a<=n;a++)
	cin>>arr[a];
	ll dp[n+1];
	dp[1]=0;
	for(int a=2;a<=min(n,k+1);a++)
	{
		dp[a]=abs(arr[a]-arr[1]);
	}
	for(int a=k+2;a<=n;a++)
	{
		ll x,y,z;
		ll mini=1000000000000000;
		for(int b=1;b<=k;b++)
		{
			x=dp[a-b]+abs(arr[a]-arr[a-b]);
			mini=min(mini,x);
		}
		dp[a]=mini;
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int n;  cin >> n;
  string s; cin >> s;
  int now = 0, ans = 0;
  for (int i = 0; i < s.size(); ++i){
    if(s[i]=='I') now++;
    else if(s[i]=='D')  now--;
    ans = max(ans, now);
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3524
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

ll N, ans = 0;
int sqrtN;

int main(){
	getint(N), sqrtN = (int)sqrt((double)N);
	for(register int i = 2; i <= sqrtN; i++) if(N % i == 0){
		const ll j = N / i;
		if(N / (i - 1) == j) ans += i - 1;
		if(N / (j - 1) == i) ans += j - 1;
	}
	if(N > 1 && N / (N - 1) == 1) ans += N - 1;
	return printf("%lld\n", ans), 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <utility>

template <template <class> class Container> class union_find {
protected:
	class node_type;

public:
	using container_type = Container<node_type>;
	using size_type = typename container_type::size_type;

protected:
	class node_type {
	public:
		size_type parent;
		size_type size;
	};

	container_type tree;

public:
	union_find() : tree() {}
	explicit union_find(const size_type size) : tree(size, { 0, 1 }) {
		for (size_type i = 0; i < size; ++i)
			tree[i].parent = i;
	}

	bool empty() const { return tree.empty(); }
	size_type size() const { return tree.size(); }

	size_type find(size_type x) {
		assert(x < size());
		while (tree[x].parent != x)
			x = tree[x].parent = tree[tree[x].parent].parent;
		return x;
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return tree[find(x)].size;
	}

	::std::pair<size_type, size_type> unite(size_type x, size_type y) {
		assert(x < size());
		assert(y < size());
		x = find(x);
		y = find(y);
		if (x != y) {
			if (tree[x].size < tree[y].size)
				::std::swap(x, y);
			tree[x].size += tree[y].size;
			tree[y].parent = x;
		}
		return { x, y };
	}
};

#include<iostream>
#include<cstdint>
#include<vector>
template<class T>
using vec_alias = ::std::vector<T>;

int main() {
	using u32 = ::std::uint_fast32_t;
	using u64 = ::std::uint_fast64_t;
	u32 n, m;
	::std::cin >> n >> m;
	union_find<vec_alias> uf(n * 2);

	for (u32 i = 0;i < m;++i) {
		u32 a, b;
		::std::cin >> a >> b;
		--a;
		--b;
		uf.unite(a, b + n);
		uf.unite(a + n, b);
	}

	if (uf.same(0, n)) {
		::std::cout << static_cast<u64>(n)*(n - 1) / 2 - m << ::std::endl;
		return 0;
	}

	u64 cnt = 0;
	for (u32 i = 0;i < n;++i)
		if (uf.same(0, i))
			++cnt;

	::std::cout << (static_cast<u64>(n) - cnt) * cnt - m << ::std::endl;

	return 0;
}


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

long long a, b, c, d;
int main()
{
	scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
	printf("%lld", max(max(a * c, a * d), max(b * c, b * d)));
	return 0;
}

Measured memory_bytes: 3860
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)          std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define all(v) v.begin(),v.end()
#define PI 3.14159265
#define co cout<<"fuck"<<endl
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e5;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
ll power(ll x,ll y)
{
    ll ans=1;
    while(y>0){
        if(y&1)
            ans=(ans*x)%M;
        x=(x*x)%M;
        y/=2;
    } 
    return ans;
}
ll po(ll j)
{
   ll t =j;
   rep(i,4)
   j*=t;
   return j;
}
int main()
{
     fast;
     ll x;
     cin>>x;
     repp(i,-130,130)
     {
       repp(j,-130,130)
       {
         
          if( po(i) - po(j) == x)
          {
             cout<<i<<" "<<j;
             return 0;
		  }
	   }
	 }
}   

Measured memory_bytes: 3652
/**
 *   created: 28 April 2019  23:46:46
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
// #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
	optimizeIO();
	int tc=1;
	// cin>>tc;
	for(int tt=0;tt<tc;tt++){
		int n;
		cin>>n;
		vi v(n);
		rep(i,0,n)
			cin>>v[i];
		if(n==1){
			cout<<1000000000;
			return 0;
		}
		vi fr(n),bc(n);
		fr[0] = v[0];
		bc[n-1] = v[n-1];
		rep(i,1,n)
			fr[i] = __gcd(v[i],fr[i-1]);
		for(int i=n-2; i>=0 ;i--)
			bc[i] = __gcd(bc[i+1],v[i]);
		int res=max(bc[1],fr[n-2]);
		rep(i,1,n-1){
			res = max(res,__gcd(bc[i+1],fr[i-1]));
		}
		cout<<res;

	}
	return 0;
}




Measured memory_bytes: 1408
n=int(input())
x=list(map(int,input().split()))
    
x=sorted(x)
m=999999999999
for j in range(x[0],x[n-1]+1):
    s=0
    for i in range(n):
        s+=(x[i]-j)**2
    m=min(m,s)
    
print(m)


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func contains(target string, list []string) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextInt64() int64 {
	sc.Scan()

	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}
func abs(i int64) int64 {
	if i < 0 {
		return -i
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer([]byte{}, math.MaxInt64)
	// a := make([][]int, 3)
	// for i := 0; i < 3; i++ {
	// 	a[i] = make([]int, 3)
	// }
	// for i := 0; i < 3; i++ {
	// 	for j := 0; j < 3; j++ {
	// 		a[i][j] = nextInt()
	// 	}
	// }

	n := nextInt()
	m := nextInt()
	x := nextInt()
	var a []int
	var cntb int
	var cntf int
	for i := 0; i < m; i++ {
		a = append(a, nextInt())
	}
	n = n
	for _, val := range a {
		if val < x {
			cntb++
		} else {
			cntf++
		}
	}

	if cntb < cntf {
		fmt.Println(cntb)
	} else {
		fmt.Println(cntf)
	}

}


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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;

int main() {
    ll a, b, n, ans = 0, rem;
    cin >> n >> a >> b;
    ans = n / (a + b) * a;
    rem = n % (a + b);
    ans += min(rem, a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
vector<int>yakusu;
void dfs(vector<pair<int,int>>&p,int n,int x,int y){
    if(x==y)yakusu.push_back(n);
    else{
        int po=1;
        for(int i=0;i<=p[x].second;i++){
            dfs(p,n*po,x+1,y);
            po*=p[x].first;
        }
    }
}
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    vector<int>furui(1000001,0);
    furui[1]=1;
    for(int i=2;i<=1000001;i++){
        if(furui[i]==0){
            for(int j=i;j<=1000001;j+=i)if(furui[j]==0)furui[j]=i;
        }
    }
    int x=n;
    for(int i=0;i<n;i++){
        yakusu.resize(0);
        vector<int>v;
        int I=a[i];
        while(furui[I]!=I){//prime
            v.push_back(furui[I]);
            I/=furui[I];
        }
        v.push_back(I);
        vector<pair<int,int>>p;
        int s=1,y=1;
        for(int j=0;j<v.size()-1;j++){
            if(v[j]==v[j+1])s++;
            else{
                p.push_back({v[j],s});
                s=1;
                y++;
            }
        }
        p.push_back({v.back(),s});
        dfs(p,1,0,y);
        for(int j=0;j<yakusu.size();j++){
            if(binary_search(a,a+i,yakusu[j]) || binary_search(a+i+1,a+n,yakusu[j])){
                x--;
                break;
            }
        }
    }
    cout<<x<<endl;
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

const ll N_MAX = 1000005;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];
void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll) i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

ll combination(ll C, ll D){
    if(C<D||C<1) return 0;
    return fac[C]*(finv[D]*finv[C-D]%mod)%mod;
}

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

    ll X, Y;
    cin >> X >> Y;
    ll A = X + Y;
    ll B = abs(X - Y);

    if(A%3!=0){
    	cout << 0 << endl;
    	return 0;
    }

    ll T = A/3;

    //dump(T)

    if((B+T)%2!=0){
    	cout << 0 << endl;
    	return 0;
    }

    ll p = (B+T)/2;

    cout << combination(T, p) << endl;
    return 0;
}

Measured memory_bytes: 23680
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> G[10005];
int C[10005];
int V[10005];
int arrived[10005];
int dfs(int idx, int& n) {
  arrived[idx] = 1;
  V[idx] = C[n--];
  int ret = 0;
  for (int i : G[idx]) {
    if (!arrived[i]) {
      ret += dfs(i, n);
      ret += V[i];
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  int N, a, b;
  cin >> N;
  for (int i=0; i<N-1; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i=0; i<N; i++) {
    cin >> C[i];
  }
  sort(C, C+N);
  int n = N-1;
  int ret = dfs(1, n);
  cout << ret << endl;
  cout << V[1];
  for (int i=2; i<=N; i++) {
    cout << ' ' << V[i];
  }
  cout << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

string dir = "RLUD";
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};

int main() {
    int n;
    cin >> n;
    VL x(n), y(n);
    REP(i,n){
        cin >> x[i] >> y[i];
    }

    int p = abs(x[0] + y[0]) % 2;
    REP(i,n){
        if (abs(x[i] + y[i]) % 2 != p){
            cout << -1 << endl;
            return 0;
        }
    }

    int m = 40 ;
    VL d(m, 1);
    FOR(i,2-p,m-1){
        d[i] = 2 * d[i - 1];
    }
    cout << m << endl;
    REP(i,m) cout << d[i] << " ";
    cout << endl;
    REP(i,n){
        string s(m, 'R');
        ll xp = 0, yp = 0;
        FORR(j,m-1,0){
            ll mi = 1e18, w;
            REP(k,4){
                ll dist = abs(xp + dx[k] * d[j] - x[i]) + abs(yp + dy[k] * d[j] - y[i]);
                if (dist < mi){
                    mi = dist;
                    s[j] = dir[k];
                    w = k;
                }
            }
            xp += dx[w] * d[j];
            yp += dy[w] * d[j];
        }
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define ld long double

const ll maxs = 1e5+3;


ll vis[maxs];
vector<ll>graph[maxs];


ll dist[maxs];

void bfs(ll s)
{
  queue<ll>q;
  q.push(s);
  dist[s]=0;
  while(!q.empty())
  {
    ll s =q.front();
    q.pop();
    if(!vis[s])
      vis[s]=1;
    else
      continue;
    for(auto it:graph[s])
    {
      if(!vis[it])
      {
        dist[it]=dist[s]+1;
        q.push(it);
      }
    }
  }
}

//
int main()
{
 
    ll h,w,n;
    cin >> h >> w >> n;
    ll maxx = max(h,w);
    
    cout << ceil((ld)n/(ld)(maxx));
 }
 


Measured memory_bytes: 2560
import math
L = input().split()

l = [ int(n) for n in L ]

a = l[0]
b = l[1]
c = l[2]


# ans = math.sqrt(a) +math.sqrt(b) - math.sqrt(c)
# ans = a + b -c +2*math.sqrt(a*b)
# ans = a**2 + b **2 + c **2 -2*a*b -2*b*c-2*a*c 

ans = (a-b)*(a-b) + (b-c)*(b-c) + (c-a)*(c-a) - b*b -c*c -a*a 

if (c-a-b)**2 >4*a*b and c-a-b>0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
from sys import stdin
from collections import deque
def search(A,B):
    N_A,N_B=len(A),len(B)
    BB=[0]*N_B
    # matrix=[[0 for j in range(N_B)] for i in range(N_A)]
    for i in range(1,N_A):
        AA=BB[:]
        for j in range(1,N_B):
            if A[i]==B[j]:
                BB[j]=AA[j-1]+1
            elif BB[j-1]>BB[j]:
                # BB[j]=BB[j-1]
                BB[j] = max(BB[j - 1], AA[j])
            # else:
            #     BB[j]=max(BB[j-1],AA[j])
    return (BB[-1])
N=int(input())
for i in range(N):

    A=deque(list(stdin.readline().strip()))
    B=deque(list(stdin.readline().strip()))
    A.appendleft(0)
    B.appendleft(0)
    print(search(A,B))


Measured memory_bytes: 6036
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define in              insert
#define pb              push_back
#define mp              make_pair
#define lb              lower_bound
#define ub              upper_bound
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#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 mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n]
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int n, w; cin >> n >> w;
	int wt[n + 1], val[n + 1];
	for (int i = 1; i <= n; i++)
		cin >> wt[i] >> val[i];

	int dp[n + 1][w + 1];
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= w; j++) {
			if (i == 0 || j == 0)
				dp[i][j] = 0;
			else if (wt[i] > j)
				dp[i][j] = dp[i - 1][j];
			else if (wt[i] <= j)
				dp[i][j] = max(dp[i - 1][j], val[i] + dp[i - 1][j - wt[i]]);
		}
	}

	cout << dp[n][w] << endl;

	return 0;
}

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

//void B_99()
int main()
{
  int a, b;
  cin >> a >> b;

  int c = b - a;
  int sum = 0;
  for (int i = 1; i < c; ++i)
  {
    sum += i;
  }

  cout << sum-a << endl;
}

Measured memory_bytes: 256
N=int(input())
T=list(map(int,input().split()))
M=int(input())
p_x=[list(map(int,input().split())) for _ in range(M)]
for i in range(M):
    tmp=T[p_x[i][0]-1]
    T[p_x[i][0]-1]=p_x[i][1]
    print(sum(T))
    T[p_x[i][0]-1]=tmp

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdint>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    if(S == "hi" || S == "hihi" || S == "hihihi" || S == "hihihihi" ||
       S == "hihihihihi") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);



    int n;
    cin >> n;
    pair<int, int> a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }

    sort(a, a + n);
    for (auto e : a) cout << e.second + 1 << ' ';

}

Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int h,w;
    cin >> h >> w;
    vs s(h);
    rep(i,h)cin >> s[i];
    vvi dp(h,vi(w));
    dp[0][0] = 1;
    rep(i,h)rep(j,w)if(s[i][j] != '#'){
        if(i < h-1)(dp[i+1][j] += dp[i][j]) %= MOD;
        if(j < w-1)(dp[i][j+1] += dp[i][j]) %= MOD;
    }
    cout << dp[h-1][w-1] << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int suki = 753;
int main() {
  string s;
  cin >> s;
  int ans = INF;
  for (int i = 0; i + 2 < s.length(); ++i) {
    int num = atoi(s.substr(i, 3).c_str());
    ans = min(ans, abs(num - suki));
  }

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


Measured memory_bytes: 256
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

R = INT()
print(R*2*math.pi)


Measured memory_bytes: 72836
#include<stdio.h>
int main(void){
	int H,W,k,i;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0&&W==0){
			break;
		}
		else if((H+W)==1||(H==1&&W==1)){
			printf("#\n");
		}
		else{
			if(H==0){
				H++;
			}
			if(W==0){
				W++;
			}
			for(k=1;k<=H;k++){
				for(i=1;i<=W;i++){
					if(W==1||W==i){
						printf("#\n");
					}
					else{
						printf("#");
					}
				}
			}
		}
	printf("\n");
	}
return 0;
}

Measured memory_bytes: 588
#include <iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(){
    long int K=0;
    long int N=0;
    long int D=0;
    long int A0=0;
    long int Apre=0;
    long int A=0;
    cin >> K >> N;
    cin >> A0;
    Apre = A0;
    N-=1;
    for(N;N>0;N--){
        cin >> A;
        D = max(D, A-Apre);
        Apre = A;
    }
    D = max(D, K - Apre + A0);
    cout << (K-D);
    return 0;
}


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

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

	int a, b, c;
	long long k;
	cin >> a >> b >> c >> k;

	if (k & 1) cout << b - a << endl;
	else cout << a - b << endl;
}

Measured memory_bytes: 256
n,x,m = map(int,input().split())
set_ = set()
l = []
cnt =0
dic = {}
while x not in set_ and cnt<n:
    set_.add(x)
    l.append(x)
    dic[x]= cnt
    cnt += 1
    x = (x**2)%m
    if x==0:
        l.append(0)
        break
if l[-1]==0:
    print(sum(l));exit()
if cnt==n:
    print(sum(l));exit()

ans = sum(l[:dic[x]])
l = l[dic[x]:]

L = l+ l
cnt  = len(l)
n-=dic[x]
s = sum(l)
ans += (n//cnt)*s + sum(l[:n%cnt])

print(ans)

Measured memory_bytes: 86328
#include<stdio.h>

int gdc(int a, int b){
    if(a==0 || b==0){
        return (a+b); 
    }
    if(a>b){
        return gdc(a%b, b);
    }else{
        return gdc(a, b%a);
    }
}

int main(){
    int N;
    int A[100000];
    int i, j;
    int a,b;

    scanf("%d", &N);

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

    a=A[0];
    for(i=1; i<N; i++){
        b= A[i];
        a=gdc(a, b);
    }
    printf("%d", a);
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> P(N),Q(N),F(N);
    for(int i=0;i<N;i++){
        cin >> P[i];
        Q[i] = P[i];
    }
    sort(Q.begin(),Q.end());
    for(int i=0;i<N;i++) cin >> F[i];
    sort(F.begin(),F.end());
    vector<int> ans(N);
    auto calc = [](vector<int>& A, vector<int>& B){
        int n = A.size(),m = B.size();
        assert(n==m);
        vector<int> cnt(n);
        int id = m-1;
        for(int i=n-1;i>=0;i--){
            while(id>=0 && B[id]>A[i]) id--;
            cnt[i] = m-1-id;
        }
/*         for(int i=0;i<n;i++){
            if(i>=2) cnt[i] += cnt[i-1];
            cerr << cnt[i] << (i!=n-1? " ":"\n");
        }
*/        int res = 0,add = 0;
        for(int i=n-1;i>=0;i--){
            res += (cnt[i]>=1);
            add += (cnt[i]>=1);
            if(i!=0) cnt[i-1] -= add;
        }
        return res;
    };
    int value = calc(Q,F);
//    cerr << value << endl;
      for(int i=0;i<N;i++){
        if(i==N-1){
            ans[i] = F[0];
            break;
        }
        int l = 0,r = F.size();
        while(l<F.size() && F[l]<=P[i]) l++;
        int id = 0;
        while(Q[id]!=P[i]) id++;
        Q.erase(Q.begin()+id);
        if(l!=(int)F.size()){
            while(l+1<r){
                int m = (l+r)/2;
                vector<int> a = Q,b = F;
                b.erase(b.begin()+m);
                if(value==calc(a,b)+1) l = m;
                else r = m;
            }
            vector<int> a = Q,b = F;
            b.erase(b.begin()+l); 
            if(calc(a,b)+1==value){
                ans[i] = F[l];
                value--;
            }else{
                if(l>0) l--;
                ans[i] = F[l];
            }
            F.erase(F.begin()+l);
        }else{
            l = 0,r = F.size();
            while(l+1<r){
                int m = (l+r)/2;
                vector<int> a = Q,b = F;
                b.erase(b.begin()+m);
                if(value==calc(a,b)) l = m;
                else r = m;
            }
            ans[i] = F[l];
            F.erase(F.begin()+l);
        }
    }
    for(int i=0;i<N;i++) cout << ans[i] << (i!=N-1? " ":"\n");
}


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

int main() {
  while (true) {
    char ch;
    scanf("%c", &ch);
    if (ch == '\n') {
      break;
    }
    if (islower(ch)) {
      printf("%c", toupper(ch));
    }
    else if (isupper(ch)) {
      printf("%c", tolower(ch));
    }
    else {
      printf("%c", ch);
    }
  }
  printf("\n");
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define local
//if you find any bug in my code, please tell me.
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int n,d,x,t,ans=0;
    cin>>n>>d>>x;
    while(n--)
    {
        scanf("%d",&t);
        ans+=1+(d-1)/t;
    }
    cout<<ans+x<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
 
typedef long long ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
const double PI=3.14159265358979323846;
 
using namespace std;
 
int main() {

	int n, q;
	cin >> n >> q;

	stack<int> s[n];

	int a, b, c;

	rep(i, q) {
		cin >> a >> b;

		switch(a) {

			case 0:
				cin >> c;
				s[b].push(c);
				break;

			case 1:
				if (!s[b].empty())
					cout << s[b].top() << endl;
				break;
			
			case 2:
				if (!s[b].empty())
					s[b].pop();
				break;
		}
	}


}


Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vd vector<double>
#define vc vector<char>
#define vs vector<string>
#define vpi vector<pii>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvb vector<vector<bool>>
#define vvd vector<vector<double>>
#define vvc vector<vector<char>>
#define vvs vector<vector<string>>
#define vvpi vector<vector<pii>>
#define vvpl vector<vector<pll>>

const int INF = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
const long double PI = 3.141592653589793238462643383279502884197;

int main() {
	cin.tie(NULL); cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	int a; cin >> a;

	cout << a + a * a + a * a * a;

	return 0;
}

Measured memory_bytes: 3644
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let nk = read_vec::<i32>();
    let an = read_vec::<i32>();
    let ans = if (nk[0] - nk[1]) % (nk[1]-1) == 0{
         (nk[0] - nk[1]) / (nk[1]-1)+1
    }else{
        (nk[0] - nk[1]) / (nk[1]-1)  +2
    };
    println!("{}",ans );
}

Measured memory_bytes: 4352
K = int(input())

q = [1,2,3,4,5,6,7,8,9]
i = 0
n = 9
while n < K:
    x = q[i]
    m = x % 10
    if m > 0:
        q.append(x * 10 + m - 1)
        n += 1
    q.append(x * 10 + m)
    n += 1
    if m < 9:
        q.append(x * 10 + m + 1)
        n += 1
    i += 1
print(q[K-1])

Measured memory_bytes: 7264
import numpy as np

H, W, K = map(int, input().split())

c = [[1 if s=="#" else 0 for s in input()] for _ in range(H)]
#print(c)
def func(mats, ans, h, hmax, w, wmax):
  buf = []
  if h<hmax:
    for mat in mats:
      m = mat.copy()
      m[h,:] = 0
      s = m.sum()
      if s>K:
        buf.append(m)
      if s==K:
        ans.append(m)
        buf.append(m)
      buf.append(mat)
    func(buf, ans, h+1, hmax, w, wmax)
  elif w < wmax:
    for mat in mats:
      m = mat.copy()
      m[:,w] = 0
      s = m.sum()
      if s>K:
        buf.append(m)
      if s==K:
        ans.append(m)
        buf.append(m)
      buf.append(mat)
    func(buf, ans, h, hmax, w+1, wmax)
  else:
    return

ans = []
if np.array(c).sum()==K:
  ans.append(np.array(c))
func([np.array(c)], ans, 0, H, 0, W)
print(len(ans))

      
      
      

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

int main(){
    int n ;
    cin >> n ;
    vector<int> A(n) ;
    rep(i,n) cin >> A.at(i) ;
    for(int i = 1 ; i < n ; i++ ){
        if( A.at(i)== 0 ){
            cout << 0 << endl;
            return 0 ;
        }
    }
    int maxA = 0 ;
    ll ans = 1 ;
    rep(i,n) maxA = max(maxA,A.at(i)) ;
    vector<int> B(maxA+1) ;
    rep(i,n) B.at( A.at(i) )++ ;
    rep(i,maxA+1){
        if( B.at(i) == 0 ){
        cout << 0 << endl;
        return 0 ;
        } 
    }
    for(int i = 0 ; i < maxA ; i++ ){
        rep(j,B.at(i+1)){
            ans *= B.at(i) ;
            ans %= 998244353 ;
        }
    }
    cout  << ans%998244353  <<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;i++)
#define rep1(i,n)  for(int i=1;i<=n;i++)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
typedef long long ll;

ll solve(){
    ll n, k;
    cin >> n >> k;
    if(n % k == 0) return 0;
    
    if(n > k){
        ll t = n / k;
        ll l = t * k;
        ll p = n - l;
        return min(p, abs(p - k));
    }
    if(n < k)
        return min(n,abs(n - k));
    
    return 0;
}


int main() {

    cout << solve();
    
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  string s;
  cin >> s;
  vll ans(3, 0);
  REP(i, 3)
    ans[s[i]-'a']++;

  ll sum = 1;
  REP(i, 3)
    sum *= ans[i];

  if(sum == 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  
}


Measured memory_bytes: 764
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
 
typedef long long ll;

#define rep(i,n) for(ll i = 0; i < n; i++)
 
using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  ll N;
  cin >> N;
  vector<ll> A(N), B(N), C(N);
  rep(i,3) rep(j,N){
    if(i==0) cin >> A[j];
    else if(i==1) cin >> B[j];
    else cin >> C[j];
  }
  sort(A.begin(), A.end());
  sort(C.begin(), C.end());

  ll ans = 0;
  rep(i,N){
    auto ita = lower_bound(A.begin(), A.end(), B[i]);
    auto itc = upper_bound(C.begin(), C.end(), B[i]);    
    ans += ll(ita-A.begin()) * ll(C.end()-itc);
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
# coding: utf-8
# Your code here!

A, B, C = map(int, input().split())

# print(A)
# print(B)
# print(C)

# オモチャを買えるならば Yes，買えないならば No を出力せよ。

if A + B >= C:
    print('Yes')
else:
    print('No')

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

bool condition(int64_t x, int64_t n){
  bool state = false;
  if(x%n == 0){
    if((x/n)%5==0 || (x/n)%5==1){
      state = true;
    }
  }
  return state;
}

bool check(int64_t x, int64_t n, int64_t b){
  int64_t a = b+n;
  if(a*a*a*a*a - b*b*b*b*b == x){
    return true;
  }else{
    return false;
  }
}

int main(){
  int64_t X;
  cin >> X;
  int64_t range = (int64_t)sqrt(sqrt(X));
  int64_t n;
  bool flag = false;
  for(n=1;n<=X;n++){
    if(condition(X, n)){
      for(int64_t b=0;b<=range;b++){
        if(check(X, n, b)){
          cout << b+n << " " << b << endl;
          flag = true;
          break;
        }
        if(check(X, n, -b)){
          cout << -b+n << " " << -b << endl;
          flag = true;
          break;
        }
      }
    }
    if(flag) break;
  }

  return 0;
}


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

//A-B Problem
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), K = sc.nextInt(), res = 0;
		int[] a = new int[10], b = new int[10], w = new int[11], c = new int[10];
		for(int i=0;i<10;i++){
			a[i] = A%10; A/=10;
			b[i] = B%10; B/=10;
		}
		for(int S=0;S<1<<10;S++){
			int k = 0, C = 0;
			for(int i=0;i<10;i++)if(((S>>i)&1)>0)k++;
			if(K<k)continue;
			Arrays.fill(w, 0);
			Arrays.fill(c, 0);
			for(int i=0;i<10;i++){
				if(b[i]<=a[i]-w[i]){
					c[i] = a[i]-w[i]-b[i]; w[i+1] = 0;
				}
				else {
					c[i] = a[i]-w[i]+10-b[i];
					if(((S>>i)&1)==0)w[i+1] = 1;
					else w[i+1] = 0;
				}
			}
			for(int i=9;i>=0;i--)C=C*10+c[i];
			res = Math.max(res, C);
		}
		System.out.println(res);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

public class Main {
	static final int N = 123456;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int answer;
		int[] table = new int[N * 2 + 1];
		table[0] = 0;
		table[1] = 0;
		for (int i = 2; i <= N*2; i++) {
			table[i] = 1;
		}
		for (int i = 2; i <= Math.sqrt(N*2) + 1; i++)
			if (table[i] == 1)
				for (int j = i * 2; j <= N*2; j += i)
					table[j] = 0;
		while (true) {
			int n = sc.nextInt();
			answer = 0;
			if (n == 0)
				break;
			for (int i = n + 1; i <= 2 * n; i++)
				if (table[i] == 1)
					answer++;
			System.out.println(answer);
		}
		sc.close();
	}
}

Measured memory_bytes: 23056