akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int N,A,B;
    cin >> N >> A >> B;
    cout << min(A,B) << " " << max(0LL,A+B-N)  <<endl;
    return 0;
}

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

int left(int i){ return (i+1)*2 -1; }
int right(int i){ return (i+1)*2+1 -1; }
int parent(int i){ return (i+1)/2 -1; }

int n;

void maxHeapify(int *a, int i){
        int l = left(i);
        int r = right(i);
        int largest;
        if(l<n && a[l]>a[i]) largest = l;
        else largest = i;
        if(r<n && a[r]>a[largest]) largest = r;

        if(largest!=i){
                swap(a[i],a[largest]);
                maxHeapify(a,largest);
        }
}

void buildMaxHeap(int *a){
        for(int i=(n-1)/2;i>=0;i--)
                maxHeapify(a,i);
}

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

        buildMaxHeap(a);

        for(int i=0;i<n;i++) cout<<" "<<a[i];
        cout<<endl;
        return 0;
}


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

int main() {
    int n,m,x,a,r[101]={};
    cin>>n>>m>>x;
    while(m--) {
        cin >> a;
        r[a]=1;
    }
    int cost1=0,cost2=0;
    for(int i=x; i<=n; i++) {
        cost1 += r[i];
    }

    for(int i=x-1; i>=0; i--) {
        cost2 += r[i];
    }
    cout << min(cost1, cost2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
using boost::adaptors::reversed;
namespace rng { using namespace boost; using namespace boost::range; }
struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    ll a, b;
    cin >> a >> b;
    int prime_factors = 0;
    ll n = boost::integer::gcd(a, b);
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            prime_factors++;
            TRACE(prime_factors, i, n);
            while (n % i == 0) n /= i;
        }
    }
    if (n != 1) {
        prime_factors++;
        TRACE(prime_factors, n);
    }
    cout << (prime_factors + 1) << nl;
}


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


int main()
{
  long double a, b;
  cin >> a >> b;
  //cout << floor(a * b) << endl;
  cout << setprecision(30) << floor(a * b) << endl;
  
  return 0;
}

Measured memory_bytes: 3812
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		sc.close();
		out.println((int)ceil(n/3));
	}
}


Measured memory_bytes: 21844
# after listening explanation
n = gets.to_i
c = Array.new
10.times{ c << Array.new(10, 0) }
def h(k)
  ((k+1).to_s)[0].to_i
end
def t(k)
  (k+1)%10
end
n.times{|k|
  c[h(k)][t(k)] += 1
}
ans = 0
n.times{|k|
  ans += c[t(k)][h(k)]
}
p ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
   string s;
   cin>>s;
   for (int i=0;i<s.size();i++){
    if (s[i]=='?')
        cout<<"D";
    else
        cout<<s[i];
   }
    return 0;
}


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

using namespace std;

int qr(){int ret=0,f=1;char ch=getchar();while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();while(isdigit(ch))ret=ret*10+ch-'0',ch=getchar();return ret*f;}
#define Rint register int
#define il inline

int main(){
    int a,b;
    a = qr(),b = qr();
    cout << max(max(a+b,a-b),a*b) << endl;
    return 0;
}

Measured memory_bytes: 384
n,m=map(int, input().split())
H=list(map(int, input().split()))

S = []
for i in range(m):
    a,b=map(int, input().split())
    S.append([a,b])
road = [[] for i in range(n)]
for i,(a,b) in enumerate(S):
    road[b-1].append(a-1)
    road[a-1].append(b-1)

ans = 0
for i,r_l in enumerate(road):
    cnt = 0
    if not r_l:
        ans+=1
        continue
    for r in r_l:

        if H[i] > H[r]:
            cnt +=1
    if cnt == len(r_l):
        ans+=1
print(ans)

Measured memory_bytes: 44472
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;



int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int a;
	cin >> a;
	cout << a + a * a + a * a * a<< endl;

	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector<int> p(n);
  vector<int> q(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> q[i];

  vector<long long> factorial(n + 1); factorial[0] = 1;
  for (int i = 1; i < n + 1; i++) {
    factorial[i] = factorial[i-1] * i;
  }
  
  bitset<100> a(0), b(0);
  long long d = 0;
  for (int i = 0; i < n - 1; i++) {
    a.set(p[i]); b.set(q[i]);
    int c1 = 0, c2 = 0;
    for (int j = 0; j < p[i]; j++) {
      c1 += a[j];
    }
    for (int j = 0; j < q[i]; j++) {
      c2 += b[j];
    }
    d += ((q[i] - c2) - (p[i] - c1)) * factorial[n - (i + 1)];
  }
  cout << abs(d) << '\n';
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (x, y) = readStringList().map { it.toInt(16) }
    val ans = if (x == y) {
        "="
    } else if (x < y) {
        "<"
    } else {
        ">"
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 36456
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int A,P;
int main(){
  cin>>A>>P;
  prin((3*A+P)/2);
  return 0;
}


Measured memory_bytes: 256
def tami(a):
  global cnt
  if a in cnt:
    if cnt[a]==3:
      four.append(a)
    elif cnt[a]==1:
      two.append(a)
    cnt[a] += 1
  else:
    cnt[a] = 1
  
  
N = int(input())
l = list(map(int,input().split()))

cnt = {}
two = []
four = []

for i in l:
  tami(i)

two.sort(reverse=True)
four.sort(reverse=True)

if len(two)<2:
  print(0)
elif len(four)<1:
  print(two[0]*two[1])
else:
  print(max(two[0]*two[1],four[0]**2))

Measured memory_bytes: 18060
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,s[200100],res;
map<int,int>mp;
signed main(){
	scanf("%lld%lld",&n,&m),mp[0]++;
	for(int i=1;i<=n;i++){
		if(i>=m)mp[s[i-m]]--;
		scanf("%lld",&s[i]),s[i]--,s[i]=(s[i]+s[i-1])%m,res+=mp[s[i]],mp[s[i]]++;
	}
	printf("%lld\n",res);
	return 0;
} 

Measured memory_bytes: 14336
N = int(input())
A = [int(a) for a in input().split(" ")]

A.sort(reverse=True)
l1 = 0
c1 = 0
l2 = 0
c2 = 0

L1 = 0
L2 = 0

for i in range(len(A)):
  if L1 and L2:
    break
  elif L1:
    if l2 == A[i]:
      c2 += 1
    elif l2 != A[i]:
      l2 = A[i]
      c2 = 1
    if c2 == 2:
      L2 = l2
  else:
    if l1 == A[i]:
      c1 += 1
    elif l1 != A[i]:
      l1 = A[i]
      c1 = 1
    if c1 == 2:
      L1 = l1

print(L1 * L2)

Measured memory_bytes: 20048
#include<iostream>
#include<vector>
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)

using namespace std;

typedef long long int lli;

int main(){
  lli N;
  cin >> N;
  vector<lli> A(N);
  lli sum = 0;
  REP (i, 0, N) {
    cin >> A[i];
    sum += A[i];
  }
  
  if (sum % (N * (N + 1) / 2) != 0) {
    cout << "NO" << endl;
    return 0;
  }

  int k = sum / (N * (N + 1) / 2);

  vector<lli> dis(N);
  REP (i, 0, N) dis[i] = A[(i + 1) % N] - A[i];
  
  REP (i, 0, N) {
    if ((dis[i] - k > 0) || (dis[i] - k) % N != 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  
  cout << "YES" << endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  int n, q; cin >> n >> q;
  string str; cin >> str;
  vector<int> l(n), r(n);
  for (int i = 0; i < q; ++i) cin >> l[i] >> r[i];

  vector<int> points(n + 1, 0);
  for (int i = 0; i < n - 1; ++i) {
    points[i + 1] = points[i];
    if (str[i] == 'A' && str[i + 1] == 'C') ++points[i + 1];
  }

  vector<int> ans;
  for (int i = 0; i < q; ++i) {
    int ans = points[r[i] - 1] - points[l[i] - 1];
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
/*
                                                  
  _|_|                              _|  _|    _|  
_|    _|  _|  _|_|  _|_|_|_|        _|  _|  _|    
_|    _|  _|_|          _|          _|  _|_|      
_|    _|  _|          _|      _|    _|  _|  _|    
  _|_|    _|        _|_|_|_|    _|_|    _|    _|  
                                                                                                    
*/ 
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
//#define ls (rt<<1)
//#define rs (rt<<1|1)
#define vi vector<int>
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define fi first
#define se second
typedef long long ll;
using namespace std;
const int maxn=186;
int sum[maxn][maxn],n,m,dp[2][maxn][maxn][maxn];
char s[maxn];
int que(int xl,int xr,int yl,int yr){
	int siz=(xr-xl+1)*(yr-yl+1),tot=sum[xr][yr]-sum[xl-1][yr]-sum[xr][yl-1]+sum[xl-1][yl-1];
	if(!tot||tot==siz)return 1;
	return 0;
}
void init(){
	rep(i,1,n)rep(j,i,n)for(int r=1,l=1;l<=m;l=r+1){
		r=l;
		if(!que(i,j,l,r)){
			dp[0][i][j][l]=l-1;continue;
		}
		while(r<m&&que(i,j,l,r+1))r++;
		rep(k,l,r)dp[0][i][j][k]=r;
	}
	/* for(int i=1;i<=n;++i)
        for(int j=i;j<=n;++j)
            for(int l=1,r;l<=m;l=r)
            {
                r=l;
                while(que(i,j,l,r)&&r<=m)r++;
                for(int p=l;p<r;++p)dp[0][i][j][p]=r-1;
                if(l==r)dp[0][i][j][l]=l-1,r++;
            }*/
}
int find(int c,int i,int j,int st){
	int l=i,r=j;
	int ans=0;
	while(l<r){
		int mid=(l+r)>>1;
	//	cout<<mid<<endl;
		ans=max(ans,min(dp[c][i][mid][st],dp[c][mid+1][j][st]));
		if(dp[c][i][mid][st]<dp[c][mid+1][j][st])r=mid;
		else l=mid+1;
	}
	return ans;
}
/*int find(int c,int u,int d,int L){
    int l=u,r=d-1,mid;
    int res=0;
    int v1,v2;
    while(l<=r)
    {
        mid=(l+r)/2;
        v1=dp[c][u][mid][L];
        v2=dp[c][mid+1][d][L];
        res=max(res,min(v1,v2));
        if(v1<v2)r=mid-1;
        else l=mid+1;
    }
    return res;
}*/
void go(int c){
	rep(i,1,n)rep(j,i,n)rep(l,1,m){
		//cout<<c<<' '<<i<<' '<<j<<' '<<l<<endl;
		int r=dp[c^1][i][j][l],tar;
		if(r!=m){
			tar=dp[c^1][i][j][r+1];tar=max(tar,find(c^1,i,j,l));
		}
		else tar=m;
		dp[c][i][j][l]=tar;
	}
}
int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n){
		scanf("%s",s+1);
		rep(j,1,m){
			sum[i][j]=(s[j]=='#');
		}
	}
	rep(i,1,n)rep(j,1,m)sum[i][j]+=sum[i][j-1];
	rep(i,1,n)rep(j,1,m)sum[i][j]+=sum[i-1][j];
	init();
	int ans=0;
	for(int i=1;dp[(i&1)^1][1][n][1]<m;i++)go(i&1),ans=i;
	printf("%d",ans);
	return 0; 
}


Measured memory_bytes: 30428
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <string>
#include  <vector>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define lrep(i, n, m) for(int i = n; i < m; i++)

typedef long long ll;
const int MAX = INT_MAX;
const ll mod = 1e9 + 7;
int main()
{	
	int n, k;
	cin >> n >> k;

	if (k == n + 1) {
		cout << 1 << endl;
		return 0;
	}

	vector<ll> A(n + 1);
	rep(i, n + 1) A[i] = i;
	lrep(i, 1, n + 1)  A[i] += A[i - 1];

	ll ans = 0;
	lrep(i, k, n + 1) {
		ll min = A[i - 1] - A[0];
		ll max = A[n] - A[n - i];
		ans += (max - min + 1);
		ans %= mod;
	} 
	ans++;
	cout << ans % mod << endl;
}

Measured memory_bytes: 4772
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

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

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    vector<ll> rg;
    int rMax = N / R;
    int gMax = N / G;
    int bMax = N / B;

    repto(r, rMax) {
        repto(g, gMax) {
            int tmpRG = R * r + G * g;
            if (tmpRG <= N) rg.pb(tmpRG);
        }
    }

    sort(all(rg));
    ll result = 0;


    repto(b, bMax) {
        int target = N - b * B;
        decltype(rg)::iterator it = lower_bound(rg.begin(), rg.end(), target);
        if (it != rg.end()) {
            int pos = std::distance(rg.begin(), it);
            while (target == rg[pos]) {
                result++;
                pos++;
            }

        }
    }

    cout << result << endl;
}

Measured memory_bytes: 66784
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

long long N, M;
vector<long long> A;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N >> M;
	long long S = 0;
	for(int i=0; i<N; i++){
		long long a;
		cin >> a;
		A.push_back(a);
		S += a;
	}

	long long select = 0;
	for(int i=0; i<N; i++){
		if((A[i] * 4 * M) >= S){
			select++;
		}
	}
	if(select >=M){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	ll n,k;
	cin>>n>>k;
	ll ng=k+1, ok=0;
	while(ng-ok>1){
		ll mid=(ok+ng)/2;
		ll cur = mid, sum = 0;
		for(ll i=0;i < n;++i){
			if(cur==0)break;
			sum += cur;
			cur/=2;
			if(sum>k)break;
		}
		if(sum>k)ng=mid;
		else ok=mid;
	}
	cout<<ok<<endl;
	return 0;
}


Measured memory_bytes: 3100
'use strict'
const main = (input: string) => {
    const std: string[] = input.trim().split('\n')
    const [n ,d] = std.shift().split(' ').map(Number)
    const coordinates: number[][] = std.map(v => v.split(' ').map(Number))
    let r = [];
    for (let i = 0; i < n; i++) {
        for (let j = i+1; j < n; j++) {
            let tmp = 0;
            for (let k = 0; k < d; k++) {
                tmp += (coordinates[i][k] - coordinates[j][k])**2
            }
            r.push(Math.sqrt(tmp))        
        }
    }
    console.log(r.filter(v => Number.isInteger(v)).length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pp;
typedef tree<pp,null_type,less_equal<pp>,rb_tree_tag,tree_order_statistics_node_update> super_set;

#define x1 dfds
#define y1 dsfdsfe
#define pb push_back
#define forn(i,n) for(ll i = 1;i<=n;++i)
#define fi first
#define sc second
#define endl '\n'
#define po(x) (1ll<<x)
#define log sdfdsfdsf

const ll DIM = 2E5+7;
const ll MOD = 1e9+123;
const ll M1 = 1e9+7;
const ll INF = 1E17;
const ld eps = 0.0000000001;
const ld PI = 3.14159265358979323846;
int getInt(int a = 0, int b = INT_MAX){
	static mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	return uniform_int_distribution <int> (a, b)(rng);
}
const ll MAXN = 1E9;
ll A[DIM],dp[DIM];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n,k;
    cin>>n;

    k = 2;
    forn(i,n)cin>>A[i];

    for(ll i = 2;i<=n;++i){
        dp[i] = INF;
        for(ll j = max(1ll,i-k);j<i;++j)dp[i] = min(dp[i],dp[j]+abs(A[i]-A[j]));
    }

    cout<<dp[n]<<endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 1;
int n, k, q, t;
int a[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> q;
  for (int i = 1; i <= n; ++i) {
    a[i] = k - q;
  }
  for (int i = 0; i < q; ++i) {
    cin >> t;
    a[t]++;
  }
  for (int i = 1; i <= n; ++i) {
    if (a[i] <= 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int64_t X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<int64_t> reds(A);
  vector<int64_t> greens(B);
  vector<int64_t> nons(C);
  for (auto& r : reds) {
    cin >> r;
  }
  sort(reds.begin(), reds.end(), greater<int64_t>() );
  for (auto& g : greens) {
    cin >> g;
  }
  sort(greens.begin(), greens.end(), greater<int64_t>() );
  for (auto& n : nons) {
    cin >> n;
  }
  sort(nons.begin(), nons.end(), greater<int64_t>() );
  vector<int64_t> merged(X+Y);
  for (int i = 0; i < X; i++) {
    merged[i] = reds[i];
  }
  for (int i = 0; i < Y; i++) {
    merged[X+i] = greens[i];
  }
  sort(merged.begin(), merged.end());
  for (int i = 0; i < C && i < X+Y; i++) {
    if (merged[i] <= nons[i]) {
      merged[i] = nons[i];
    } else {
      break;
    }
  }
  int64_t res = 0;
  for (auto m : merged) {
    res += m;
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3968
s=input()
numr=0
numl=0
ans=[0 for _ in range(len(s))]
for i in range(len(s)):
    if s[i]=="R" and numl>0:
        ans[k]+=(numr+1)//2+numl//2
        ans[k+1]+=(numl+1)//2+numr//2
        numr=1
        numl=0
        k=i
    elif s[i]=="R":
        numr+=1
        k=i
    elif s[i]=="L":
        numl+=1
ans[k]+=(numr+1)//2+numl//2
ans[k+1]+=(numl+1)//2+numr//2
for an in ans:
    print("{}".format(an),end=" ")

Measured memory_bytes: 4864
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    float x;
    cin>>a>>b;
    x=((float)a+b)/2;
    if(x-(a+b)/2>=0.5){
        x=(a+b)/2+1;
    }
    cout<<x<<endl;
    return 0;
}


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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    ll sum = 0;
    for (int i=0; i<N; ++i) {
        cin >> A[i];
        sum += A[i];
    }
    cout << (sum >= H ? "Yes" : "No") << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1e10)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


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

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N, M; cin >> N>>M;

  vector<ll> a(N), b(N); rep(i, N) cin >> a[i] >> b[i];
  vector<ll> c(M), d(M); rep(i, M) cin >> c[i] >> d[i];

  rep(i, N) {
    
    ll dist = -1;
    ll ans = -1;
    rep(j, M) {
      ll ld = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if(dist < 0 || ld < dist)  {
		ans = j+1;	
		dist = ld;
      } 
    }
    cout << ans << endl;
  }
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    for (;;) {
        int n, m, t[100], h[100];
        int st = 0, sh = 0;
        int at = 101, ah = 101;

        scanf("%d %d", &n, &m);
        if (n == 0 && m == 0)
            break;

        for (int i = 0; i < n; ++i) {
            scanf("%d", &t[i]);
            st += t[i];
        }
        for (int i = 0; i < m; ++i) {
            scanf("%d", &h[i]);
            sh += h[i];
        }

        sort(t, t + n);
        sort(h, h + m);

        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                if (st - t[i] + h[j] == sh - h[j] + t[i]) {
                    if (t[i] + h[j] < at + ah) {
                        at = t[i];
                        ah = h[j];
                    }
                }
            }
        }

        if (at == 101 && ah == 101)
            printf("-1\n");
        else
            printf("%d %d\n", at, ah);
    }

    return 0;
}

Measured memory_bytes: 1056
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc119
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split('/');
            int n = int.Parse(s[0]);
            int t = int.Parse(s[1]);
            int h = int.Parse(s[2]);

            bool heisei = false;

            if(n < 2019)
            {
                heisei = true;
            }

            if(t < 5)
            {
                heisei = true;
            }

            if (heisei)
            {
                Console.WriteLine("Heisei");
            }
            else
            {
                Console.WriteLine("TBD");
            }

        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,a,b;
    cin>>n>>a>>b;
     if(n>1&&b>=a||n==1&&a==b)
        cout<<(n-2)*(b-a)+1<<endl;
    else
        cout<<0<<endl; 
    return 0;
} 


Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define NumberOfOnes __builtin_popcount
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twoll pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int h,w,n,c;
int main(){FAST;xRand;
cin>>h>>w>>n;
if(h<w) swap(h,w);
while(n>0){
	n-=h;
	c++;
}
cout<<c<<endl;
	// you should actually read the stuff at the bottom
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?), slow multiset operations
	* do smth instead of nothing and stay organized
	* unordered_map, hash_map, scanf, calculate answer instead of ans*K
*/
/*


                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/




Measured memory_bytes: 256
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        ArrayList<Integer> array = new ArrayList();
        ArrayList<Integer> iniArray = new ArrayList();
        for(int i=0; i<num; i++){
            array.add(sc.nextInt());
            iniArray.add(0);
        }

        int count = 0;

        for(int i=0; i<num-1; i++){

            while(iniArray.get(i) < array.get(i)){
                count++;
                int start = i;
                int end = num-1;
                for(int j=i+1; j<num; j++){
                    if(iniArray.get(j) >= array.get(j)) {
                        end = j-1;
                        break;
                    }
                }

                for(int k=start; k<=end; k++){
                    iniArray.set(k, iniArray.get(k) + 1);
                }
            }
        }

        if (iniArray.get(num-1) < array.get(num-1)) {
            count = count + (array.get(num-1) - iniArray.get(num-1));
            iniArray.set(num-1, array.get(num-1));
        }

//        System.out.println(iniArray);
        System.out.println(count);
    }
}


Measured memory_bytes: 22996
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p,l,r;
};
struct Node T[MAX];
int n;

//先行順巡回
void preParse(int u){
  if(u==NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

//中間順巡回
void inParse(int u){
  if(u==NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

//後行順巡回
void postParse(int u){
  if(u==NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d", u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL) T[l].p=v;
    if(r!=NIL) T[r].p=v;
  }

  for(i=0;i<n;i++)
    if(T[i].p==NIL) root=i;
  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2036
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p=mod)
{
    return power(n, p-2, p);
}
int main()
{
fast;
ll n,k;
cin>>n>>k;
vector<ll>v;
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    v.pb(a);
}
ll g=modInverse(2);
ll hh=((k*(k-1))%mod*g)%mod;
vector<ll>x,y;
for(ll i=0;i<n;i++)
{
    ll cntx=0,cnty=0;
    for(ll j=i+1;j<n;j++)
    {
        if(v[i]>v[j])
        {
            cntx++;
        }
    }
    for(ll j=0;j<n;j++)
    {
        if(v[i]>v[j])
        {
            cnty++;
        }
    }
    x.pb(cntx);
    y.pb(cnty);
}
ll ans=0;
for(ll i=0;i<n;i++)
{
    ll f=((k*x[i])%mod+(hh*y[i])%mod)%mod;
    ans=(ans+f)%mod;
}
cout<<ans<<endl;
return 0;
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long[] ab = new long[2];
        ab[0] = sc.nextLong();
        ab[1] = sc.nextLong();
        Arrays.sort(ab);
        if (ab[0] >= 2) {
            System.out.println((ab[0] - 2) * (ab[1] - 2));
            return;
        }
        if (ab[1] == 1) {
            System.out.println(1);
        } else {
            System.out.println(ab[1] - ab[0] - 1);
        }
    }

}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct data
{
    ll pos;
    ll l,r;
}a[100005];
int cmp(struct data a,struct data b)
{
    if(a.l==b.l)
        return a.r<b.r;
    return a.l<b.l;
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        ll aa,b;
        scanf("%lld %lld",&aa,&b);
        a[i].pos=aa;
        a[i].l=max(aa-b,(ll)0);
        a[i].r=aa+b;
    }
    sort(a,a+n,cmp);
    ll ans=0;
    ll p=0;
    for(int i=1;i<n;i++)
    {
        if(a[i].l>=a[p].r)
            p=i;
        else
        {
            ans++;
            if(a[i].r<=a[p].r)
            {
                p=i;
            }
        }
    }
    cout<<n-ans;
    return 0;
}


Measured memory_bytes: 2560
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AThumbnail solver = new AThumbnail();
        solver.solve(1, in, out);
        out.close();
    }

    static class AThumbnail {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            int sum = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                sum += a[i];
            }

            int answer = -1, min = Integer.MAX_VALUE;
            for (int i = n - 1; i >= 0; i--) {
                int dist = Math.abs(a[i] * n - sum);
                if (dist <= min) {
                    min = dist;
                    answer = i;
                }
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21332
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    while(true){
      String s = sc.nextLine();
      if(s.equals("END OF INPUT")) break;

      String[] ss = s.split(" ",-1);
      for(String tmp : ss){
        System.out.print(tmp.length());
      }
      System.out.println();
    }
  }
}

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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 100000; i++) {
        int x = i * 0.08;
        int y = i * 0.1;
        if (x == a && y == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1;
}


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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define MOD 1000000000000000001
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000

ll mulmod(ll a, ll b)
{
    ll res = 0; 
    a = a % MOD;
    while(b > 0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
 
        a = (a * 2) % MOD; 
        b /= 2;
    } 
    return res % MOD; 
}
ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a=(a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    prime[0] = false;
    prime[1] = false;
    
    for(ll i = 2;i <= MAX; i++)
    {
        if(prime[i])
        {
            for(ll j = i*i; j <= MAX; j += i)
                prime[j] = false;
        }
    }
}

void getfact(vector<ll>&fact, vector<ll>&factinv)
{
    fact[0] = 1;
    factinv[0] = 1;
    
    for(ll i = 1; i <= MAX; i++)
        fact[i] = (fact[i-1] * i)%MOD;
    
    for(ll i = 1; i <= MAX; i++)
        factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,n,m,k,q;
    cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++) cin>>a[i];
    ll res = 1;
    bool f = false;
    for(ll i=0;i<n;i++)
    {
        if(a[i] == 0)
        {
            f = true;
            break;
        }
    }
    if(f)
        cout<<"0";
    else
    {
        for(ll i=0;i<n;i++)
        {
            if(res * a[i] != mulmod(res, a[i]))
            {
                res = -1;
                break;
            }
            else
                res *= a[i];
        }
        cout<<res;
    }
    return 0;
}


Measured memory_bytes: 3952
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int n = 0;
        for(int i=a; i<=b; i++) if(c%i==0) n++;
        System.out.println(n);
    }
}


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

using namespace std;

int main(void) {
  int e;
  while (cin >> e, e) {
    int ans = (int)1e9;
    for (int z = 0; z * z * z <= e; z++) {
      for (int y = 0; y * y <= e - z * z * z; y++) {
        int x = e - z * z * z - y * y;
        if (x < 0) continue;
        ans = min(ans, x + y + z);
      }
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3028
#include<iostream>
#include<cmath>
using namespace std;

int main() {
    string S, T;
    cin >> S;
    cin >> T;
    //cout << S << endl;
    //cout << T << endl;
    bool flag = false;
    for (int i = 0; i < S.length(); i++) {
        char c = S[0];
        S.erase(S.begin(), S.begin() + 1);
        S.push_back(c);
        if(S == T) {
            flag = true;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
/******************************************
* AUTHOR : AMAN SAXENA *
* Nick : blue-meth *
* "There's some good in this world, and it's worth fighting for." *
* INSTITUTION : KIET Group of Institutions *
******************************************/
#include <bits/stdc++.h>

const long long MODULO=1000000007;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FOR1(i,a,n) for(int i=a;i<=n;i++)
#define FOR2(i,a,n) for(int i=a;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pi 3.14159265359

using namespace std;

ll amanpower(ll a, ll b) {
    ll r = 1;
    while (b > 0) 
    {
        if (b & 1) r = r * a;
        a = a * a;
        b >>= 1;
    }
    return r;
}


ll amanlcm(ll a, ll b)
{
     return a*(b/__gcd(a,b));
}


//********* CODE START *********

void solve()
{
  ll n, x;
  cin >> n >> x;
  ll c = x*x, ans = 0;
  while(n--)
  {
    ll a, b;
    cin >> a >> b;
    if(a*a + b*b <= c)
   		ans++;
  }
  cout << ans;
}

void test()
{
    int t;
    cin>>t;
    while(t--) //for(int j=1;j<=t;j++) cout << "Case #" << j << ": ";
    {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif
    
    // test();
    solve();

    
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define int long long
#define ll long long
#define moder 1000000007
#define INF LLONG_MAX/3
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int func(int a,int b){
	int ans=0;
	while(a){
		ans+=a/b;
		a/=b;
	}
	return ans;
}
int prime(int n){
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0)return false;
	}
	return true;
}
signed main(){
	int n;
	cin>>n;
	int ans=0;
	int cnt1=0;
	int cnt2=0;
	for(int i=2;i<=n;i++){
		if(prime(i)){
			if(func(n,i)>=24)cnt1++;
			if(func(n,i)>=2)cnt2++;
		}
	}
	ans+=cnt1*(cnt2-1);
	int x=cnt2;
	cnt1=0;
	cnt2=0;
	for(int i=2;i<=n;i++){
		if(prime(i)){
			if(func(n,i)>=14)cnt1++;
			if(func(n,i)>=4)cnt2++;
		}
	}
	int y=cnt2;
	ans+=cnt1*(cnt2-1);
	ans+=y*(y-1)*(x-2)/2;
	cnt1=0;
	for(int i=2;i<=n;i++){
		if(prime(i)){
			if(func(n,i)>=74)cnt1++;
		}
	}
	ans+=cnt1;
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  
  int N, K;
  int num = 1;
  cin >> N >> K;

  for(int i = 0; i<N; i++){
        
       if( num+K < num*2 )
         num += K;
       else
         num *= 2;    

  }

  cout << num << endl;

}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	string a, b;
	cin >> a >> b;
	if(a == "A" && b == "B"){
		cout << "<" << endl;
	}else if(a == "A" && b == "C"){
		cout << "<" << endl;
 	}else if(a == "A" && b == "D"){
 		cout << "<" << endl;
 	}else if(a == "A" && b == "E"){
 		cout << "<" << endl;
 	}else if(a == "A" && b == "F"){
 		cout << "<" << endl;
 	}else if(a == "A" && b == "A"){
 		cout << "=" << endl;
 	}else if(a == "B" && b == "A"){
 		cout << ">" << endl;
 	}else if(a == "B" && b == "B"){
 		cout << "=" << endl;
 	}else if(a == "B" && b == "C"){
 		cout << "<" << endl;
 	}else if(a == "B" && b == "D"){
 		cout << "<" << endl;
	}else if(a == "B" && b == "E"){
 		cout << "<" << endl;
 	}else if(a == "B" && b == "F"){
 		cout << "<" << endl;
 	}else if(a == "C" && b == "A"){
 		cout << ">" << endl;
 	}else if(a == "C" && b == "B"){
 		cout << ">" << endl;
 	}else if(a == "C" && b == "C"){
 		cout << "=" << endl;
 	}else if(a == "C" && b == "D"){
 		cout << "<" << endl;
 	}else if(a == "C" && b == "E"){
 		cout << "<" << endl;
 	}else if(a == "C" && b == "F"){
 		cout << "<" << endl;
 	}else if(a == "D" && b == "A"){
 		cout << ">" << endl;
 	}else if(a == "D" && b == "B"){
 		cout << ">" << endl;	
 	}else if(a == "D" && b == "C"){
 		cout << ">" << endl;
 	}else if(a == "D" && b == "D"){
 		cout << "=" << endl;	
 	}else if(a == "D" && b == "E"){
 		cout << "<" << endl;
 	}else if(a == "D" && b == "F"){
 		cout << "<" << endl;
 	}else if(a == "E" && b == "A"){
 		cout << ">" << endl;
 	}else if(a == "E" && b == "B"){
 		cout << ">" << endl;
 	}else if(a == "E" && b == "C"){
 		cout << ">" << endl;
 	}else if(a == "E" && b == "D"){
 		cout << ">" << endl;
 	}else if(a == "E" && b == "E"){
 		cout << "=" << endl;
 	}else if(a == "E" && b == "F"){
 		cout << "<" << endl;
 	}else if(a == "F" && b == "A"){
 		cout << ">" << endl;
 	}else if(a == "F" && b == "B"){
 		cout << ">" << endl;
 	}else if(a == "F" && b == "C"){
 		cout << ">" << endl;
 	}else if(a == "F" && b == "D"){
 		cout << ">" << endl;
 	}else if(a == "F" && b == "E"){
 		cout << ">" << endl;
 	}else if(a == "F" && b == "F"){
 		cout << "=" << endl;
 	}
	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 repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    string s;
    cin >> s;
    vector<int> cnts;
    bool isS = true;
    int cnt = 0;
    rep(i,s.size()){
        if (isS && s[i] == 'T'){
            cnts.push_back(cnt);
            isS = !isS;
            cnt = 0;
        }else if (!isS && s[i] == 'S'){
            cnts.push_back(cnt);
            isS = !isS;
            cnt = 0;
        }
        cnt++;
    }
    cnts.push_back(cnt);
    if (s[s.size()-1] != 'S') cnts.push_back(0);

    int tot = cnts[1] - cnts[0];
    int ans = 0, sz = cnts.size();
    for(int i = 3; i < sz; i+=2){
        tot += cnts[i] - cnts[i-1];
        ans = max(ans, tot);
    }
    tot = cnts[sz-1];
    ans = max(ans, tot);
    for(int i = sz-3; i >= 0; i -= 2){
        tot += cnts[i] - cnts[i+1];
        ans = max(ans, tot);
    }
    cout << ans * 2 << endl;
    return 0;
}

Measured memory_bytes: 4004
#include <iostream>
#include <cstring>
using namespace std;

int main() {
	char S[110]; cin >> S;
	char S1, S2;
	int n = strlen(S);
	int cnt = 0;

	for (int i = 0; i < n / 2; ++i) {
		S1 = S[i];
		S2 = S[n - i - 1];
		if (S1 != S2) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
a = [int(input()), int(input()), int(input()), int(input()), int(input())]
k = int(input())

ok = True
for i in range(5):
    for j in range(5):
        if abs(a[i] - a[j]) > k:
            ok = False

print('Yay!' if ok else ':(')


Measured memory_bytes: 3060