akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, x ] <- readInts
	ms <- replicateM n readInt
	let
		rest = x - sum ms
	print $ n + rest `div` minimum ms

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

const ll MOD = 1e+9+7;
const int INF = 1e+9+7;


void prime_fac(int num,vector<int> &ans){
	for(int i=2;i<=num;i++){
        while(num%i==0){
            ans[i]++;
            num/=i;
        }
    }
}

int main(){
    int N;
    cin >> N;
    vector<int> v(N+1,0); //素因数分解結果の格納先
    rep2(i,1,N+1){
        prime_fac(i,v);
    }
    
    int a=0;
    int b=0;
    int c=0;
    int d=0;
    int e=0;
    
    rep2(i,1,N+1){
        if(v[i]>=2) a++;
        if(v[i]>=4) b++;
        if(v[i]>=14) c++;
        if(v[i]>=24) d++;
        if(v[i]>=74) e++;
    }

    int ans=0;
    ans+=((a-2)*b*(b-1))/2;
    ans+=d*(a-1);
    ans+=c*(b-1);
    ans+=e;
    cout << ans <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#define all(x) (x).begin(),(x).end()
typedef long long ll;

using namespace std;

int main()
{
    int N;  cin >> N;
    vector<ll> A(N);
    for(int i=0; i<N; i++)  cin >> A[i];
    sort(all(A));

    ll mass = A[0];
  	int j = 0;
    for(int i=1; i<N; i++){
        if(A[i] > 2*mass){
            j = i;
        }
        mass += A[i];
    }
    cout << N - j << endl;
    return 0;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

int main() {
  int N;
  cin >> N;
  int i;
  cin >> i;
  cout << N + 1 - i << endl;
}

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

int main() {
	int n,m;
	cin>>m;
	n=m%10;
	if(n==3){
		cout<<"bon"<<endl;
	}else if(n==0||n==1||n==6||n==8){
		cout<<"pon"<<endl;
	}else{
		cout<<"hon"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int n;
    cin>>n;
    int max=0;
    int sa=0;
    for(int i=0;i<n+2;i++){
        if((i*(i+1))/2>=n){
            max=i;
            sa=(i*(i+1))/2-n;
            break;
        }
    }
    for(int i=1;i<max+1;i++){
        if(i!=sa){
            cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
 
int main()
{
  int n,cnt=0;
  string s;
  cin >> n >> s;
  for(int i=0;i<=n-3;i++)
  {
    if(s.substr(i,3) == "ABC")
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
	int a,b;
	cin >> a >> b;
	if((a+b)%2==1){
		cout <<"IMPOSSIBLE" << endl;
		return 0;
	}
	else{
		cout << (a+b)/2 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using P = pair<int, int>;

bool sortbysec(const P &p, const P &q){
  return p.second > q.second;
}

int main(){
  int n;
  cin >> n;
  vector<P> A;
  for(int i = 0; i < n; ++i){
    int a, b;
    cin >> a >> b;
    A.push_back(P(a, b));
  }

  vector<P> B;
  for(int i = 0; i < n; ++i){
    int c, d;
    cin >> c >> d;
    B.push_back(P(c, d));
  }

  sort(B.begin(), B.end()); 
  sort(A.begin(), A.end(), sortbysec); 

  vector<bool> used(n, false);
  for(int i = 0; i < n; ++i){
    int c = B[i].first;
    int d = B[i].second;
    for(int j = 0; j < n; ++j){
      int a = A[j].first;
      int b = A[j].second;
      if(!used[j] && a < c && b < d){
        used[j] = true;
        break;
      }
    }
  }

  int count = 0;
  for(int i = 0; i < n; ++i){
    if(used[i])++count;
  }

  cout << count << endl;
}


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

Measured memory_bytes: 1008
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,m;
int a[200010];
ll S[200010];

void solve(){
  cin >> n >> m;
  ll k=0;
  rep(i,n){
    cin >> a[i];
    if(i>=1)if(a[i]<a[i-1])k+=m;
  }
  //cout << a[0] << " " << a[n-1]+k << endl;
  rep(i,n-1){
    if(a[i]+1<a[i+1]){
      S[a[i]+1]+=1;
      S[a[i+1]]-=1;
    }
    else if(a[i]>a[i+1] && a[i]+1<a[i+1]+m){
      S[a[i]+1]+=1;
      S[a[i+1]+m]-=1;
    }
  }
  // rep(i,2*m){
  //   cout << S[i] << " ";
  // }
  // cout << "" << endl;
  rep(i,2*m-1){
    S[i+1]+=S[i];
  }
  rep(i,n-1){
    if(a[i]+1<a[i+1]){
      S[a[i+1]]-=a[i+1]-a[i]-1;
    }
    else if(a[i]>a[i+1] && a[i]+1<a[i+1]+m){
      S[a[i+1]+m]-=a[i+1]-a[i]+m-1;
    }
  }
  // rep(i,2*m){
  //   cout << S[i] << " ";
  // }
  // cout << "" << endl;
  rep(i,2*m-1){
    S[i+1]+=S[i];
  }
  // rep(i,2*m){
  //   cout << S[i] << " ";
  // }
  // cout << "" << endl;
  ll ans=0;
  rep(i,m){
    ans=max(S[i]+S[i+m],ans);
  }
  cout << (ll)a[n-1]+k-(ll)a[0]-ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 2176
/****************************************************************
*	Author: huhao
*	Email: 826538400@qq.com
*	Create time: 2020-02-18 10:36:40
****************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
#define Int __int128
#define i64 long long
#include<map>
const int mod=998244353,N=110;
std::map<Int,i64> f[N];
char s[N];
int n;
Int a;
i64 solve(Int a,int n)
{
	i64 g[N]; memset(g,0,sizeof(g));
	g[0]=1;
	fr(i,1,n)
	{
		g[i]=g[i-1]*(((a>>(i-1))&1)+1);
		fr(j,1,i/2)
		{
			int k=i-j; Int B=((Int)1<<j)-1,A=(a>>k)&B;
			while(k>=j)
			{
				k-=j; A&=(a>>k)&B;
				g[i]=(g[i]+g[k]*solve(A,j))%mod;
			}
		}
	}
//	printf("%d ",n);
//	fr(i,0,n-1) putchar(((a>>i)&1)+48); putchar(10); putchar(' ');
//	fr(i,0,n) printf("%d%c",int(g[i]),i==n?'\n':' ');
	return g[n];
}
int main()
{
	scanf("%s",s); n=strlen(s);
	fr(i,0,n-1) a|=(Int)(s[i]-48)<<i;
	printf("%d\n",int(solve(a,n)));
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  string s;
  int k;
  cin >> s >> k;

  bool same = true;
  int n = sz(s);
  rep(i,n-1) {
    if (s[i]!=s[i+1]) {
      same = false;
      break;
    }
    
  }
  if (same) {
    cout << (ll)n*k/2 << endl;
    return 0;
  }

  int cnt = 1;
  ll ans_s = 0;
  int a = -1, b;
  rep(i,n-1) {
    if (s[i]==s[i+1]) {
      cnt++;
      if (i == n-2) {
        b = cnt;
        ans_s += cnt/2;
      }
    }
    else {
      if (a==-1) a = cnt;
      if (i == n-2) b = cnt;
      ans_s += cnt/2;
      cnt = 1;
    }
  }

  ll ans;
  if (s[0]!=s[n-1]) {
    ans = (ll)ans_s*k;
  }
  else {
    ans = (ll)ans_s*k - (ll)(a/2+b/2-(a+b)/2)*(k-1);
  }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//      std macros
typedef long long ll;
typedef pair<int ,int> pii;
typedef pair<ll ,ll> pll;
//      dereference
#define F first
#define S second
#define pb push_back
#define mp make_pair
//      loops
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,a,b) for(int i=a;i<=b;++i)
#define PER(i,b,a) for(int i=b;i>=a;--i)
#define all(X) (X).begin(), (X).end()
//      I/O
#define sd(n) scanf("%d",&n)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sll(n) scanf("%lld",&n)
#define sll2(x,y) scanf("%lld%lld",&x,&y)
#define sll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define ss(s) scanf("%s",s)
//      debug
#define debug(x) cerr<<"debug->"<<#x<<"::"<<x<<endl
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<"\n"
//      set values
#define mset(n,k) memset(n,k,sizeof(n))
//modular expo
ll power(ll a,ll b, ll c){
    ll x=1,y=a;
    while(b>0){
        if(b&1)
            x=(x*y)%c;
        y=(y*y)%c;
        b/=2;
    }
    return x%c;
}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};//clockwise from left
int dr[]={1,1,0,-1,-1,-1, 0, 1};
int dc[]={0,1,1, 1, 0,-1,-1,-1};//anticlockwise from down
const int N = 1e5+5;
int prime[N],DP[N];
void seive() {
	prime[1] = 1;
	for(int i=2;i<N;++i) {
		if(!prime[i]) {
			for(int j=2*i;j<N;j+=i) 
				prime[j] = 1;
		}
	}
}
int main() {

	seive();
	REP(i,1,N-1) {
		DP[i] = DP[i-1];
		if(!prime[i] && !prime[(i+1)/2])
			DP[i]++;
	}
	int q;
	sd(q);
	while(q--) {
		int l,r;
		sd2(l,r);
		printf("%d\n",DP[r]-DP[l-1]);
	}
	
	
	return 0;
}

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

typedef long long ll;
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 < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()

int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    int N;
    cin >> N;
    double sum = 0;
    REP(i,N){
        double tmp;
        cin >> tmp;
        sum += 1/tmp;
    }

    cout << 1/sum << endl;
}



Measured memory_bytes: 256
// AtCoder NOMURA Programming Contest
// A - Study Scheduling

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	//steady_clock::time_point start = steady_clock::now();
	int H1, M1, H2, M2, K;

    cin >> H1 >> M1 >> H2 >> M2 >> K;

	// 制約確認
	if (H1 < 0 || 23 < H1)  {
        cout << "H1は条件を満たしていません!\n";
        return 0;
    }

	if (H2 < 0 || 23 < H2)  {
        cout << "H2は条件を満たしていません!\n";
        return 0;
    }

	if (M1 < 0 || 59 < M1)  {
        cout << "M1は条件を満たしていません!\n";
        return 0;
    }

	if (M2 < 0 || 59 < M2)  {
        cout << "M2は条件を満たしていません!\n";
        return 0;
    }
	if (K < 1)  {
        cout << "Kは条件を満たしていません!\n";
        return 0;
    }

	int delta;
	delta = (H2*60 + M2) - (H1*60 + M1 + K);
	cout << delta << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

using Graph = vector<vector<int>>;
Graph G;
int main(void){
    // Your code here!
    int n,m;cin >> n >> m;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    G.resize(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ll ans = 0;
    rep(i,n) {
        bool cur = true;
        for(int j =0;j<G[i].size();j++){
            if(h[i]<=h[G[i][j]]) cur = false;
        }
        if(cur) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 9068
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);
        DDivRemNumber solver = new DDivRemNumber();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDivRemNumber {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();

            long ans = 0;
            for (long k = 1; k * k < n; k++) {
                if (n % k == 0) {
                    long m = n / k - 1;
                    if (n / m == n % m) {
                        ans += m;
                    }
                }
            }

            out.println(ans);
        }

    }

    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 long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 22996
main :: IO ()
main = do
  [a,b,k] <- map (read :: String -> Int) . words <$> getLine
  print $ ans a b k

ans :: Int -> Int -> Int -> Int
ans a b k = (!! (k-1)) $ foldl (\acc k -> if mod g k == 0 then (div g k) : acc else acc) [] [g,g-1..1] where
  g = gcd a b

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s; cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s;
	cin >> s;
	REP(i, 4) cout << s[i];
	cout << " ";
	REP(i, 8) cout << s[i + 4];
	cout << endl;
	return 0;
}

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

#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)
#define speed ios::sync_with_stdio(0); cin.tie(0);

int const N = 2 * 1e5 + 2;
int a[6], aa[6];

int main(){
    speed
    f(i, 0, 5)cin >> a[i];
    int mx = -1, value;
    f(i, 0, 5){
        for (int j = 0; j <= 130; j += 10){
            if (a[i] <= j){
                if (mx <= j - a[i]){
                    mx = j - a[i];
                    value = a[i];
                }
                aa[i] = a[i] + (j - a[i]);
                break;
            }
        }
    }
    int sum = 0;
    bool f = 0;
    f(i, 0, 5){
        if (a[i] == value && !f){
            sum += value;
            f = 1;
        } else sum += aa[i];
    }
    cout << sum << endl;
} 

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[]
from math import ceil 
maxia=0 
for i in range(n):
    a,b=map(int,input().split())
    l.append([a,b])
    if a>=maxia:
        maxia=a 
        ind=i 
have=[] 
for i in range(n): 
    if l[i][1]>maxia :
        have.append(l[i][1])
have.sort(reverse=1)
for i in range(len(have)): 
    m=m-have[i]
    if m<=0: 
        print(i+1)
        exit()
ans=len(have)
print(ans+ceil(m/maxia))

Measured memory_bytes: 69976
//PLUS ULTRA

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define mp make_pair
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first

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

const int N = 1e5 + 10 , mod =  1000000007;

int gcd(int x , int y){
	if(y == 0)return x;
	else return gcd(y , x % y);
}

void solve(){

	int k ; cin >> k;

	ll sum = 0;

	forn(a,1,k+1){
		forn(b,1,k+1){
			int x = gcd(a , b);
			forn(c, 1 , k+1){
				sum += gcd(x , c);

			}
		}
	}
    
    cout << sum << endl;



}

int main(){
    SPEED;

    solve();

    return 0;
}
      
       


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

int main() {
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++) {
  	if (s[i] == '1') cout << "9";
    else cout << "1";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int x,t;
    cin >> x >> t;
    put(max(x-t,0));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <math.h>
using namespace std;

int main() {
    int a = 0;
    char str[4];
    
    cin >> str;

    for (int i = 0; i < 4; i++) {
        if (str[i] == '+') {
            a++;
        }
        else {
            a--;
        }
    }

    cout << a << endl;
    

    return 0;
}


Measured memory_bytes: 256
use std::vec::Vec;

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 main() {
    let n: usize = read();
    let p: Vec<usize> = read_vec();
    let mut q: Vec<usize> = Vec::new();

    for &e in &p {
      q.push(e);
    }
    q.sort();

    let mut count = 0;
    for i in 0..n {
      if p[i] != q[i] {
        count += 1;
      }

      if count > 2 {
        println!("NO");
        return
      }
    }

    println!("YES");
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(){
  int N;
  scanf("%d",&N);
  if(N==100000){
    printf("90909");
  }else if(10000<=N && N<100000){
    printf("%d",909+N-9999);
  }else if(1000<=N && N<10000){
    printf("909");
  }else if(100<=N && N<1000){
    printf("%d",9+N-99);
  }else if(10<=N && N<100){
    printf("9");
  }else if(1<=N && N<10){
    printf("%d",N);
  }
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(){
    int a, b, c;

    cin >> a >> b >> c;

    int a_mod_b = a%b;

    int res;
    int i=1;
    while(true){
        res = (i*a_mod_b)%b;
        if(res==c){
            cout << "YES" << "\n";
            break;
        }
        if((res==a_mod_b)&(i>1)){
            cout << "NO" << "\n";
            break;
        }
        i += 1;
    }

}


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

int main() {
	int n, k; cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h.at(i);
	}
	if (n <= k) {
		cout << 0 << endl;
		return 0;
	}
	sort(h.begin(), h.end());
	long long ans = 0;
	for (int i = 0; i < n - k; i++) {
		ans += h.at(i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int a,b,c;
    cin >>a>>b>>c;
    int ans;
    if(b>=c){//解毒入りおいしいがいっぱい
        ans = b+c;
    }
    else if(a+b>=c){//解毒しきれる
        ans = c+b;
    }
    else{
        ans = 2*b;
        c -= b;
        ans += a+1;
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 1000000007

vector<int> G[200010];
stack<ll> col[200010];
int C[200010];
ll ans[200010];

ll seg[524288];
ll app[200010];

void raq(int s = 0, int t = 262143, ll v = 1, int k = 1, int l = 0, int r = 262143) {
	if (t < l || r < s)return;
	if (s <= l && r <= t) {
		seg[k] += v;
		return;
	}
	raq(s, t, v, k * 2, l, (l + r) / 2);
	raq(s, t, v, k * 2 + 1, (l + r) / 2 + 1, r);
}

ll gets(int x) {
	x += 262144;
	ll ans = 0;
	while (x) {
		ans += seg[x];
		x /= 2;
	}
	return ans;
}

void pini(int x, ll v) {
	raq(x, x, v - gets(x));
}

ll alc = 0;

void euler(int c, int p) {

	for (int i : G[c]) {
		if (i == p)continue;
		col[C[c]].top() = gets(C[c]);
		col[C[c]].push(0);
		pini(C[c], 0);
		raq();
		raq(C[i], C[i], -1);
		euler(i, c);
	}

	if (p == 0)return;
	ll gc = gets(C[p]);
	ans[C[p]] += gc * (gc - 1LL) / 2LL;
	col[C[p]].pop();
	pini(C[p], col[C[p]].top());
	return;
}

int main() {
	for (int i = 0;i < 200010;i++)ans[i] = app[i] = C[i] = 0;
	for (int i = 0;i < 524288;i++)seg[i] = 0;
	ll N, a, b;
	cin >> N;
	for (int i = 1;i <= N;i++) {
		cin >> C[i];
		app[C[i]]++;
	}
	for (int i = 1;i < N;i++) {
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for (int i = 1;i <= N;i++) {
		if (i == C[1])col[i].push(0);
		col[i].push(1);
	}
	raq();
	raq(C[1], C[1], -1);
	euler(1, 0);
	for (int i = 1;i <= N;i++) {
		ll gc = gets(i);
		ans[i] += gc * (gc - 1LL) / 2LL;
	}
	for (int i = 1;i <= N;i++) {
		if (app[i] == 0)cout << 0 << endl;
		else
			cout << N * (N - 1) / 2 - ans[i] + app[i] << endl;
	}
}


Measured memory_bytes: 180368
x, y = map(int, input().split())
mod = 10**9 + 7
if (x + y) % 3:
    print(0)
    exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
    print(0)
    exit()
if a == 0 or b == 0:
    print(1)
    exit()


def neko(n, r):
    p, q = 1, 1
    for i in range(r):
        p = p * (n - i) % mod
        q = q * (i + 1) % mod
    return p * pow(q, mod - 2, mod) % mod


r = min(a, b)
print(neko(n, r))


Measured memory_bytes: 3064
X = int(input())

flag = False
for i in range(X, 0, -1):
  for j in range(2, i):
    t = i
    while True:
      if t % j != 0:
        break
      t //= j
      if t == 1:
        print(i)
        flag = True
        break
    if flag:
      break
  if flag:
    break

if flag == False:
  print(1)

Measured memory_bytes: 38640
#include <vector>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

ll dp[105][100005];

int main() {
  int n;
  ll W;
  scanf("%d %lld", &n, &W);

  ll w[n];
  ll v[n];
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &w[i]);
    scanf("%lld", &v[i]);
  }

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= W; ++j) {
      if (j - w[i] >= 0) {
	dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
      }
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
    }
  }
  printf("%lld\n", dp[n][W]);
  return 0;
}


Measured memory_bytes: 79360
# C - Energy Drink Collector
# https://atcoder.jp/contests/abc121/tasks/abc121_c

import operator

N, M = map(int, raw_input().split())

stores = list()
for _ in range(N):
    stores.append( tuple(map(int, raw_input().split())) )

stores.sort(key=lambda x : x[0])

money = 0
cans_cnt = 0
for cost_i, cans_i in stores:
    buy_i = min(M - cans_cnt, cans_i)
    money += (cost_i * buy_i)
    cans_cnt += buy_i
    if (cans_cnt == M):
        break

print '{}'.format(money)


Measured memory_bytes: 21236
N,M,X,Y = map(int,input().split())
x_lis = list(map(int,input().split()))
y_lis = list(map(int,input().split()))

x_max = max(x_lis)
y_min = min(y_lis)

ans = "War"
for Z in range(X+1,Y+1):
  if x_max < Z <= y_min:
    ans = "No War"
    
print(ans)

Measured memory_bytes: 9196
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int k, x;
    cin >> k >> x;
    cout << (500 * k >= x? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
A = input().split()
for i in range(n):
    A[i] = int(A[i])
count = 0
sum = sum(A)
for i in range(n):
    if A[i] < sum/(4*m):
        pass
    else:
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A[] = new long[87];
		A[0]=2;
		A[1]=1;
		for (int i=2;i<87;i++) {
			A[i] = A[i-1]+A[i-2];
		}
		int N = sc.nextInt();
		System.out.println(A[N]);
	}
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    char a;
    cin>>a;
    if('A'<=a&&a<='Z')cout<<"A"<<endl;
    else cout<<"a"<<endl;
    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#define pb push_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define upmin(ans,ansx) (ans)=min((ans),(ansx))
#define upmax(ans,ansx) (ans)=max((ans),(ansx))
#define INF (1100000099)
#define INFLL (1100000000000000099ll)
#define MOD (1000000009)
#define MAXN (105)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
inline void fuk() { puts("Impossible"); exit(0); }

int Cnt[MAXN];
int A[MAXN];
int N, L;

int main() {
    scanf("%d", &N); for(int i = 1; i <= N; i++) scanf("%d", &A[i]);
    L = *max_element(A+1, A+N+1);
    for(int i = 1; i <= N; i++) Cnt[A[i]]++;
    if(Cnt[L] < 2) fuk();
    for(int i = (L+1)/2; i <= L; i++) {
        if(i*2 == L) Cnt[i]--;
        else Cnt[i] -= 2;
        if(Cnt[i] < 0) fuk();
    }
    for(int i = 1; i <= (L+1)/2; i++) if(Cnt[i]) fuk();
    puts("Possible");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n, m, l;
	cin >> n >> m >> l;
	int A[100][100] = {};
	int B[100][100] = {};
	long long C[100][100] = {};

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> A[i][j];
		}
	}

	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			cin >> B[i][j];
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			for(int k = 0; k < m; k++){
				C[i][j] += A[i][k] * B[k][j];
			}
			cout << C[i][j];
			if(j != l-1) cout << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1320
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
int main(){
  ll N;
  cin >> N;
  ll ans = 0;
  for(ll i = 1;i * i <= N;i++){
    if(N % i == 0){
      ans = to_string(N/i).size();
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
l = [0 for i in range(n)]
for i in range(n):
    l[a[i]-1] += 1
l.sort()
cnt = 0
for i in range(n-k):
    cnt += l[i]
print(cnt)


Measured memory_bytes: 24852
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    ll a, b, n;
    cin >> a >> b >> n;
    ll x;
    x = min(b - 1, n);
    cout << (a * x / b) - a * (x / b);
    return 0;
}

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

int main() {
	int x, y;
	cin >> x >> y;
	if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) {
	    if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) cout << "Yes";
	    else cout << "No";
	}
	else if (x == 4 || x == 6 || x == 9 || x == 11) {
	    if (y == 4 || y == 6 || y == 9 || y == 11) cout << "Yes";
	    else cout << "No";
	}
	else cout << "No";
	return 0;
}


Measured memory_bytes: 256
from math import gcd

n = int(input())
ans = 0
for i in range(1, n + 1):
    for j in range(i, n + 1):
        for k in range(j, n + 1):
            if i == j == k:
                ans += gcd(gcd(i, j), k)
            elif i == j or i == k or j == k:
                ans += gcd(gcd(i, j), k) * 3
            else:
                ans += gcd(gcd(i, j), k) * 6
print(ans)


Measured memory_bytes: 68152
package main

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

var sc = bufio.NewScanner(os.Stdin)

const initBufSize, maxBufSize = 10000, 1000000

func nextStr() 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 nextInts(n int) []int {
	res := make([]int, n)
	for i := range res {
		res[i] = nextInt()
	}
	return res
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(r, n int) int {
	return int(math.Pow(float64(r), float64(n)))
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initBufSize), maxBufSize)
	a := nextInt()
	b := nextInt()
	var _ = nextInt() //avoid "declared and not used"
	k := nextInt()
	if k < a {
		fmt.Println(k)
	} else if a <= k && k <= a+b {
		fmt.Println(a)
	} else {
		fmt.Println(a - (k-a-b))
	}
}


Measured memory_bytes: 1756
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define allr(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
// #define pi 3.1415926535897932384626433832
#define mod 1000000007
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pans1(a,b)cout << a <<  " " <<b<< endl
#define pans2(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

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

vector<int> preficnt_function(string s) {
    int n = (int)s.length();
    vector<int> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        //we will try to shorten the match string length until we revert to the beginning of match (indecnt 1)
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}

const int MAX = 200005;
int perm1[MAX],perm2[MAX];

void solve(){

    int n;
    cin >> n;
    string s;
    cin >> s;
    
    int cnt = 0;
    int ans1 = 0, ans2 = 0;

    for(int i=0;i<n;i++){
        if(s[i]=='1')cnt++;
    }
    cnt--;
    if(cnt!=0){
        perm1[0]=1;
        for(int i=1;i<=n;i++){
            perm1[i] = perm1[i-1]*2%cnt;
        }
    }
    cnt+=2;

    perm2[0]=1;
    for(int i=1;i<=n;i++){
        perm2[i] = perm2[i-1]*2%cnt;
    }
    cnt--;
    
    for(int i=0;i<n;i++){
        if(s[i]=='1'){
        if(cnt!=1)
        ans1 = (ans1+perm1[n-i-1])%(cnt-1);
        ans2 = (ans2+perm2[n-i-1])%(cnt+1);
        }
    }
    for(int i=0;i<n;i++){
        if(s[i]=='1'){
        if(cnt!=1){
            int cur = (ans1-perm1[n-i-1]+cnt-1)%(cnt-1);
            int ans = 1;
        // cout << cur << endl;
            while(cur){
                int cnt = __builtin_popcount(cur);
                cur = cur%cnt;
                ans++;

            } 
            cout << ans << endl;
        }
        else {
            cout<<0<<endl;
        }
        }
        else {
        int cur = (ans2+perm2[n-i-1])%(cnt+1);
      
        int ans = 1;
        // cout << cur << endl;
        while(cur){
            int cnt = __builtin_popcount(cur);
            cur = cur%cnt;
            ans++;

        } 
        cout << ans << endl;
    }
  }
    
}



signed main() 
{   
    IOS;
    int t = 1;
    // cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 6892
#include <bits/stdc++.h>
#define int long long

using namespace std;
int32_t main(){

	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
	int s = 0;
	int n ; cin >>n;
	vector<int> c(100001);
	for(int i = 0 ; i < n ; i++) {
		int t ;
		cin >> t;	s+=t;
		c[t]++;
	}
	int q ;
	cin >> q;
	for(int i =0 ; i< q; i++){
		int a, b;
		cin >> a >> b;
		cout << s - c[a] * a + c[a] * b << "\n";
		s += c[a] * b;
		s -= c[a] * a;
		c[b] += c[a];
		c[a] = 0;
  }

  return 0;
}


Measured memory_bytes: 3964
loop {
	str = gets.chomp
	break if str == ?0

	a = str.each_char.map.with_index {|c, i|
		i.even? ? c.to_i : - c.to_i % 11
	}

	count = Hash.new(0)
	a.inject(0){|s, x|
		s = (s + x) % 11
		count[s] += 1
		s
	}

	total = 0
	a.each{|x|
		total += count[0] if x > 0
		count[x] -= 1
		new_count = {}
		count.each{|y, k|
			new_count[(y - x) % 11] = k
		}
		count = new_count
	}
	p total
}

Measured memory_bytes: 9400
import numpy as np
X = []

N, D = map(int, input().split())
for i in range(N):
    X = np.append(X, np.array(list(map(int, input().split()))))
X = np.reshape(X, (N, D))
ans = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        if np.sqrt(np.sum((X[i] - X[j]) ** 2)).is_integer() == True:
            ans += 1

print(ans)

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

const int maxn = 10010;
const int maxq = 600;

int n, q;
int nums[maxn], numt[maxq];
int ans;

int main(void) {
    cin >> n;
    for (int i = 0; i < n; i ++) {
        cin >> nums[i];
    }
    cin >> q;
    for (int i = 0; i < q; i ++) {
        cin >> numt[i];
    }
    for (int i = 0; i < q; i ++) {
        for (int j = 0; j < n; j ++) {
            if (nums[j] == numt[i]) {
                ans ++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3144
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	double a, b;
	cin >> a >> b;
	double ans = (a*b) / (a + b);
	cout << fixed << setprecision(20) << ans << endl;
	return 0;
}


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

typedef long long LL;
typedef vector<int> VI;
const int M=1e5+5;

vector<VI> node,edges;
int n;

int uf[M];
int find(int x)
{
	return x==uf[x]?x:uf[x]=find(uf[x]);
}

LL kruskal()
{
	sort(edges.begin(),edges.end(),
		[](const VI &a,const VI &b){ return a[2]<b[2]; });
	for(int i=0;i<n;i++)
		uf[i]=i;
	LL ans=0;
	for(const auto &e:edges)
	{
		int u=find(e[0]),v=find(e[1]);
		if(u==v) continue;
		ans+=e[2];
		uf[u]=v;
	}
	return ans;
}

int main()
{
	scanf("%d",&n);
	int x,y;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		node.push_back({x,y,i});
	}
	sort(node.begin(),node.end(),
		[](const VI &a,const VI &b){ return a[0]<b[0]; });
	for(int i=0;i<n-1;i++)
		edges.push_back({node[i][2],node[i+1][2],node[i+1][0]-node[i][0]});
	sort(node.begin(),node.end(),
		[](const VI &a,const VI &b){ return a[1]<b[1]; });
	for(int i=0;i<n-1;i++)
		edges.push_back({node[i][2],node[i+1][2],node[i+1][1]-node[i][1]});
	printf("%lld\n",kruskal());
	return 0;
}

Measured memory_bytes: 20012
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	int x;
	cin >> x;
	if(x >= 400 && x < 600) cout << 8;
	else if(x >= 600 && x < 800) cout << 7;
	else if(x >= 800 && x < 1000) cout << 6;
	else if(x >= 1000 && x < 1200) cout << 5;
	else if(x >= 1200 && x < 1400) cout << 4;
	else if(x >= 1400 && x < 1600) cout << 3;
	else if(x >= 1600 && x < 1800) cout << 2;
	else cout << 1;
}


Measured memory_bytes: 3648
/* Written in FCP - alpha version */
#ifdef false
/* Original code */
$i
K:int
$p
set<int> seen
int ans=1
int c=7%K
if c == 0 {
    <<1
    $stop
}
seen.insert(c)
while true {
    ans += 1
    c = (c*10+7)%K
    if c == 0 {
        <<ans
        $stop
    }
    if seen.count(c) {
        <<-1
        $stop
    }
    seen.insert(c)
}
#endif
/* Transpiled code */

#include <bits/stdc++.h>

#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define fi first
#define se second

using namespace std;

using str = string;
using uint = unsigned int;
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<str>;
using vvs = vector<vector<str>>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;

template<typename T>
std::ostream& operator<<(std::ostream& s, std::vector<T> t) {
    for (int i = 0; i < sz(t); i++) {
        s << t[i] << (i == sz(t) - 1 ? "" : " ");
    }
    return s;
}



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

    
        int K;
cin >> K;
set<int> seen;
int ans=1;
int c=7%K;
if (c == 0) {
    cout <<1;
goto end_tc_label;
};
seen.insert(c);
while (true) {
    ans += 1;
    c = (c*10+7)%K;
    if (c == 0) {
        cout <<ans;
goto end_tc_label;
    };
    if (seen.count(c)) {
        cout <<-1;
goto end_tc_label;
    };
    seen.insert(c);
};
        goto end_tc_label;
        end_tc_label:;
    
}


Measured memory_bytes: 50524
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define do(x) for(int i = 1; i <= x; i++){ solve(); }
#define sz(x) (int)x.size()
#define pii pair < int, int >
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const ll MAXN = 1e18;
const ll SIZE = 1e5+2; //are u sure?
const ll mod = 1e9+7;
ll line[3][SIZE];

void solve(){
	ll a, b;
	cin >> a >> b;
	cout << (a * b) / (__gcd(a, b));
}


int main(){
	speedhack()
	// int it; cin >> it;
	int it = 1;
	do(it);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n; long long a[100009];
long long solve(int l, int r) {
	long long ret = 0;
	for(int i = 0; i < 1 << (r - l); i++) {
		if(__builtin_popcount(i) != 3) continue;
		vector<long long> x1, x2;
		for(int j = 0; j < 6; j++) {
			if(i & (1 << j)) x1.push_back(a[l + j]);
			else x2.push_back(a[l + j]);
		}
		if(x1[0] + x1[1] > x1[2] && x2[0] + x2[1] > x2[2]) {
			ret = max(ret, x1[0] + x1[1] + x1[2] + x2[0] + x2[1] + x2[2]);
		}
	}
	return ret;
}
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	int pos = -1;
	for(int i = n - 3; i >= 0; i--) {
		if(a[i] + a[i + 1] > a[i + 2]) {
			pos = i; break;
		}
	}
	int pos2 = -1;
	for(int i = pos - 3; i >= 0; i--) {
		if(a[i] + a[i + 1] > a[i + 2]) {
			pos2 = i; break;
		}
	}
	long long ret = (pos2 != -1 ? a[pos2] + a[pos2 + 1] + a[pos2 + 2] + a[pos] + a[pos + 1] + a[pos + 2] : 0);
	for(int i = 0; i < n - 6; i++) {
		ret = max(ret, solve(i, i + 6));
	}
	cout << ret << endl;
	return 0;
}

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

using namespace std;

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))

template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
}

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



void solve()
{

  int n;
  cin>>n;
  vector<int> items(n);

  for(int i=0;i<n;i++){
    cin>>items[i];
  }
  int i=0;
  int j=+1;

  int mx=0;

  while(i<n){

    int cnt=0;
    while(items[j-1]>=items[j]&&j<n){
        cnt++;
        j++;
    }

    i=j;
    j=i+1;

    mx=max(mx,cnt);

  }

  cout<<mx<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    cout.tie(nullptr);
    cin.tie(nullptr);

    int t = 1;

    while (t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 640