akhauriyash/Code-Regression huggingface dataset:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

N, M, L = [int(_) for _ in readline().split()]
ABCQST = np.array(read().split(), dtype=np.int64)
ABC = ABCQST[:3 * M]
ST = ABCQST[3 * M + 1:]
A, B, C = ABC[::3], ABC[1::3], ABC[2::3]
S, T = ST[::2], ST[1::2]
G = csr_matrix((C, (A, B)), shape=(N + 1, N + 1))
G2 = floyd_warshall(G, directed=0)
G3 = np.full((N + 1, N + 1), np.inf)
np.fill_diagonal(G3, 0)
G3[G2 <= L] = 1
G4 = floyd_warshall(G3, directed=0)
G4[G4 == np.inf] = 0
#print(*(G4.astype(int)[S, T] - 1), sep='\n')
print('\n'.join((G4.astype(int)[S, T] - 1).astype(str)))


Measured memory_bytes: 37276
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;


int main() {
    int N;
    cin >> N;
    vector<double> A(N);
    for (int i = 0; i < N; i++) { 
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        A[i] = 1.0 / A[i];
    }
    double _ans = 0.0;
    for (int i = 0; i < N; i++) {
        _ans += A[i];
    }
    double ans;
    ans = 1.0 / _ans;
    
    cout << setprecision(16) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(x) for x in input().split()]
c = 1
b = 0
for i in range(n):
  if a[i] == c:
    c += 1
  else:
    b += 1
if c == 1:
  res = -1
else:
  res = b
print(res)

Measured memory_bytes: 32324
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
check = Array.new(8,0)
cnt = 0
as.each do |a|
  if a < 400
    check[0] = 1
  elsif a < 800
    check[1] = 1
  elsif a < 1200
    check[2] = 1
  elsif a < 1600
    check[3] = 1
  elsif a < 2000
    check[4] = 1
  elsif a < 2400
    check[5] = 1
  elsif a < 2800
    check[6] = 1
  elsif a < 3200
    check[7] = 1
  else
    cnt += 1
  end
end

min_num = check.count(1)
if min_num == 0
  min_num = 1
  cnt -= 1
end

max_num = min_num + cnt
puts "#{min_num} #{max_num}"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

template<typename T>
class rArray {
	int N;
	vector<int> pos, pre, data;
public:
	rArray(int N) : N(N), data(N) {}
	rArray(int N, T val) : N(N), data(N, val) {}
	rArray(const vector<T>& v) : N(v.size()), data(v) {}
	rArray(vector<T>&& v) : N(v.size()), data(move(v)) {}
	T change(int k, T val) {
		pos.push_back(k);
		pre.push_back(data[k]);
		return data[k] = val;
	}
	void undo() {
		data[pos.back()] = pre.back();
		pos.pop_back(), pre.pop_back();
	}
	T operator[](int k) const {
		return data[k];
	}
	int getversion() const {
		return pos.size();
	}
};

class rUnionFind {
	rArray<int> data;
	vector<int> pre;
	int find(int a) {
		return data[a] < 0 ? a : data.change(a, find(data[a]));
	}
public:
	rUnionFind(int n) : data(n, -1) {}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		pre.push_back(data.getversion());
		if (data[a] < data[b]) swap(a, b);
		data.change(b, data[a] + data[b]);
		data.change(a, b);
	}
	void undo() {
		int cnt = data.getversion() - pre.back();
		while (cnt--) data.undo();
		pre.pop_back();
	}
	int size(int a) {
		return -data[find(a)];
	}
	int getversion() {
		return pre.size();
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	const int B = 200;
	int n, k;
	cin >> n >> k;
	vector<int> t(k), u(k), v(k);
	for (int i = 0; i < k; i++) {
		cin >> t[i] >> u[i] >> v[i];
	}
	set<P> es;
	vector<bool> res;
	for (int i = 0; i < k; i += B) {
		vector<int> used(n);
		for (int j = i; j < min(i + B, k); j++) {
			used[u[j]] = used[v[j]] = 1;
		}
		rUnionFind uf(n);
		set<P> unf;
		for (auto e : es) {
			if (used[e.first] && used[e.second]) {
				unf.insert(e);
			}
			else {
				uf.unite(e.first, e.second);
			}
		}
		for (int j = i; j < min(i + B, k); j++) {
			if (t[j] == 1) {
				unf.emplace(u[j], v[j]);
				es.emplace(u[j], v[j]);
			}
			else if (t[j] == 2) {
				unf.erase(P(u[j], v[j]));
				es.erase(P(u[j], v[j]));
			}
			else {
				int ver = uf.getversion();
				for (auto e : unf) {
					uf.unite(e.first, e.second);
				}
				puts(uf.same(u[j], v[j]) ? "YES" : "NO");
				while (uf.getversion() > ver) uf.undo();
			}
		}
	}
	return 0;
}

Measured memory_bytes: 6696
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int n, k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	cin>>arr[i];
	sort(arr, arr+n);
	if(k >= n)
	cout<<"0\n";
	else
	{
		ll sx = 0;
		for(int i=0;i<n-k;i++)
		sx += arr[i];
		cout<<sx<<"\n";	
	}	
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 1792
class SWAG():
    __slots__='unit','f','fold_r','fold_l','data_r','data_l'
    def __init__(self,unit,f,data):
        self.unit=unit
        self.f=f
        self.construct(data)
    def construct(self,data):
        self.fold_r=[self.unit]
        self.fold_l=[self.unit]
        self.data_r=[]
        self.data_l=[]
        sep=0--len(data)//2
        for t in data[sep:]:
            self.append(t)
        for t in data[sep-1::-1]:
            self.appendleft(t)
    def append(self,x):
        self.fold_r.append(self.f(self.fold_r[-1],x))
        self.data_r.append(x)
    def appendleft(self,x):
        self.fold_l.append(self.f(self.fold_l[-1],x))
        self.data_l.append(x)
    def pop(self):
        if not self.data_r:
            self.construct(self.data_l[::-1])
        if not self.data_r:
            return self.popleft()
        self.fold_r.pop()
        return self.data_r.pop()
    def popleft(self):
        if not self.data_l:
            self.construct(self.data_r)
        if not self.data_l:
            return False
        self.fold_l.pop()
        return self.data_l.pop()
    def fold_all(self):
        return self.f(self.fold_r[-1],self.fold_l[-1])
def main():
    from fractions import gcd
    n,*a=map(int,open(0).read().split())
    l,r=SWAG(0,gcd,[]),SWAG(0,gcd,a[1:])
    m=r.fold_all()
    for i in range(n-1):
        l.append(a[i])
        r.popleft()
        m=max(m,gcd(l.fold_all(),r.fold_all()))
    print(m)
main()

Measured memory_bytes: 16144
N = int(input())
 
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
if N == 1:
  print(0)
  exit()
 
f = factorization(N)

if len(f) == 1 and f[0][1] == 1:
  print(1) 
  exit()

count = 0
num = 1
for p,q in f:
  for e in range(1,q+1):
    if N%p**e == 0:
      N //= p**e
      count += 1
print(count)

Measured memory_bytes: 9492
#include<bits/stdc++.h>
using namespace std;
int n,A,B,a[5010],mn[5010],nx[5010],dep[5010];
long long f[5010][5010];
int main(){
	scanf("%d %d %d",&n,&A,&B);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	for(int i=1;i<=n+1;++i)for(int j=1;j<=n+1;++j)f[i][j]=8e18;
	f[1][1]=0;
	for(int i=1;i<=n;++i){
		int t=0;mn[n+1]=a[n+1]=nx[n]=n+1;
		for(int j=n;j;--j)if(a[j]>=i)
			mn[j]=a[mn[j+1]]<a[j]?mn[j+1]:j,nx[j-1]=j;
		else mn[j]=mn[j+1],nx[j-1]=nx[j];
		for(int j=n;j;--j)dep[j]=dep[nx[j]]+1;
		for(int j=1;j<=n;++j)if(a[j]>=i&&f[i][j]<1e18){
			int x=mn[j];
			if(j==x)f[a[x]+1][nx[j]]=min(f[a[x]+1][nx[j]],f[i][j]);
			else f[a[x]+1][j]=min(f[a[x]+1][j],f[i][j]+B);
			f[a[mn[nx[x]]]][nx[x]]=min(f[a[mn[nx[x]]]][nx[x]],f[i][j]+1ll*A*(dep[j]-dep[x]));
		}
	}long long ans=8e18;
	for(int i=1;i<=n+1;++i)ans=min(ans,min(f[i][n+1],f[n+1][i]));
	printf("%lld",ans);
}

Measured memory_bytes: 196096
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string S, R;

    cin >> S >> R;

    int sum = 0;

    if(S[0] == R[0]) sum++;
    if(S[1] == R[1]) sum++;
    if(S[2] == R[2]) sum++;

    cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;}
ll lcm(ll x, ll y) {return x/gcd(x,y)*y;}


int main() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i];

    bool ok=false;
    rep(i,n){
        if(k==a[i]){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
        if(k<a[i]) ok=true;
    }

    if(!ok){
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }

    int g=a[0];
    for(int i=1;i<n;i++){
        g=gcd(g,a[i]);
    }

    if(k%g==0) cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
}



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

int main() {
	// your code goes here
	string a, b; cin >> a >> b;
	int length = b.length();
	int max = 0;
	for (int i = 0; i < a.length() - length + 1; i++) {
	    int cur_max = 0;
	    string str = "";
	    for (int x = 0; x < length; x++) {
	        str += a[i + x];
	    }
	    for (int x = 0; x < length; x++) {
	        if (b[x] == str[x]) {
	            cur_max++;
	        }
	    }
	    if (cur_max > max) {
	        max = cur_max;
	    }
	    
	}
	cout << length - max;
	
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define s(a) long (a.size())
#define f(i,a,b) for(long long int i=a;i<b;i++)
#define r(i,a,b) for(long long int i=a;i>b;i--) 
#define pb push_back
#define mkp make_pair
#define mod 1000000007;
#define negmod(X,Y) X % Y + (X % Y < 0 ? Y : 0)
#define debug(x) cout<< #x << ':' << x << endl;
using namespace std;
typedef long long int ll;
#define INF 0x3f3f3f3f;
ll n,m,k;
// vector<string> str;
int solve(ll m, vector<ll> v)
{
	return 0;
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif//freopen("error.txt", "w", stderr);
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	char n;cin>>n;
	int r=n;
	if(r>=97){
		cout<<"a";
	}
	else{
		cout<<"A";
	}
	return 0;
}
// cout.flush();
// fflush(stdout);

Measured memory_bytes: 3560
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
struct edge { int to; int to2; int cost; };
int a[100006], x[100006];
int rwa[100006], ro[100005], re[100005];
signed main() {
	int n, q; cin >> n >> q;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		rwa[i + 1] += a[i];
		if (i & 1)ro[i + 1] += a[i];
		else re[i + 1] += a[i];
	}
	rep(i, n) {
		rwa[i + 1] += rwa[i];
		ro[i + 1] += ro[i];
		re[i + 1] += re[i];
	}
	rep(i, n)a[i] = a[i] * 3 + 1;
	rep(i, q) {
		cin >> x[i];
		x[i] *= 3;

		int lb = -1, ub = mod*4;
		while (ub - lb > 1) {
			int mi = (ub + lb) / 2;
			int i1 = lower_bound(a, a + n, x[i]- mi)-a;
			int i2 = upper_bound(a, a + n, x[i] + mi)-a-1;
			int tkhs = n-i2-1;
			int aok = i2 - i1 + 1;
			if (tkhs - aok > 1)lb = mi;
			else ub = mi;
		}
		//cout << ub << endl;
		int T = 0;
		int i1 = lower_bound(a, a + n, x[i] - ub)-a;
		int i2 = upper_bound(a, a + n, x[i] + ub)-a-1;
		T += rwa[n] - rwa[i2+ 1];
		int A1 = ro[i1], A2 = re[i1];
		if (i2 - i1 + 1 == n - i2-1) {
			if (i1 & 1) {
				T += A2;
			}
			else {
				T += A1;
			}
		}
		else {
			if (i1 & 1) {
				T += A1;
			}
			else {
				T += A2;
			}
		}
		cout << T << endl;
	}
}

Measured memory_bytes: 5632
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint& operator+=(const mint a)
  {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
};

ll N, K;
mint dp[55][55][2605];

int main(void)
{
  cin >> N >> K;
  dp[0][0][0] = 1;
  REP(i, N)
  {
    REP(j, i + 1)
    {
      REP(k, K + 1)
      {
        {
          int nj = j;
          dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
        }
        {
          int nj = j + 1;
          dp[i + 1][nj][k + nj * 2] += dp[i][j][k];
        }
        {
          int nj = j;
          mint x = j * 2;
          dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * x;
        }
        if (j >= 1) {
          int nj = j - 1;
          mint x = j * j;
          dp[i + 1][nj][k + nj * 2] += dp[i][j][k] * x;
        }
      }
    }
  }
  mint ans = dp[N][0][K];
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 61952
#include <iostream>
using namespace std; 
int main()
{
  char n[3]; 
  int set = 0;
  for(int i = 0; i<3; i++)
  {
    cin >> n[i];
    if (n[i] == '7')
    {
      set = 1;
    }
  }
  if (set == 1)
  {
    cout << "Yes" << "\n";
  }
  else 
  {
    cout << "No" << "\n";
  }
}

Measured memory_bytes: 3620
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long

int main()
{
    stack<int> S1;
    stack<pair<int, int> > S2;
    int i;
    char ch;

    for(i = 0; cin >> ch; i++)
    {
        if(ch == '\\')
        {
            S1.push(i);
        }
        else if(ch == '/' && S1.size() > 0)
        {
            int x = S1.top();
            S1.pop();
            
            int s = i - x;
            while(S2.size() > 0 && x < S2.top().first)
            {
                s += S2.top().second;
                S2.pop();
            }

            S2.push(make_pair(x, s));
        }
    }

    int sum = 0;
    vector<int> ans;
    while(S2.size() > 0)
    {
        sum += S2.top().second;
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    REP(i, ans.size())
    {
        cout << " " << ans[i];
    }
    cout << endl;

}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<int>> r(N);
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        r[a].push_back(b);
        r[b].push_back(a);
    }
    for(int i=0; i<N; i++){
        int size=r[i].size();
        cout << size << endl;
    }

    return 0;
}

Measured memory_bytes: 256
open Printf
open Scanf

let () =
  let h, w = scanf "%d %d " (fun x y -> (x, y)) in
  let ct = Array.make 26 0 in
  let rec loop x =
    if x = 0 then ()
    else
      let s = scanf "%s " (fun y -> y) in
      String.iter (fun c -> let i = Char.code c - 97 in ct.(i) <- ct.(i) + 1) s;
      loop (x - 1)
  in
  let rec check g c =
    if c = 0 then true
    else
      let rec iter i =
        if i = 26 then false
        else if ct.(i) >= g then (ct.(i) <- ct.(i) - g; true)
        else iter (i + 1) in
      if iter 0 then check g (c - 1)
      else false
  in
  loop h;
  (if h mod 2 = 0 && w mod 2 = 0 then
    if check 4 ((h / 2) * (w / 2)) then "Yes"
    else "No"
  else if h mod 2 = 0 then
    if check 4 ((h / 2) * (w / 2)) && check 2 (h / 2) then "Yes"
    else "No"
  else if w mod 2 = 0 then
    if check 4 ((h / 2) * (w / 2)) && check 2 (w / 2) then "Yes"
    else "No"
  else
    if check 4 ((h / 2) * (w / 2)) && check 2 (h / 2) && check 2 (w / 2) then "Yes"
    else "No")
  |> printf "%s\n"


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

int main() {
  int N;
  cin >> N;
  vector<int> num(N);
  rep(i,N-1){
    int A;
    cin >> A;
    num.at(A-1)++;
  }
  rep(i,N){
    cout << num.at(i) << endl;
  }
}


Measured memory_bytes: 4048
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <queue>
using namespace std;


int main(){
	int prime[25] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
	int prime_cnt[25] = {};
	int N;
	cin>>N;
	for(int i=1;i<=N;i++){
		int k = i;
		for(int j=0;j<25;j++){
			if(k==1)break;
			if(k%prime[j]==0){
				prime_cnt[j]++;
				k/=prime[j];
				j--;
				continue;
			}
		}
	}
	int over_75=0;
	int over_25=0;
	int over_15=0;
	int over_5=0;
	int over_3=0;
	for(int i=0;i<25;i++){
		if(prime_cnt[i]>=2)over_3++;
		if(prime_cnt[i]>=4)over_5++;
		if(prime_cnt[i]>=14)over_15++;
		if(prime_cnt[i]>=24)over_25++;
		if(prime_cnt[i]>=74)over_75++;
	}
	int ans = 0;
	ans += over_75;
	if(over_3>=2){
		ans += over_25*(over_3-1);
	}
	if(over_5>=2){
		ans += over_15*(over_5-1);
		if(over_3>=3){
			ans+=over_5*(over_5-1)/2*(over_3-2);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Numerics;

namespace competitive
{
    class Program
    {
        static void Main(string[] args)
        {
            var scanner = new Scanner();
            var a = scanner.NextInt();
            var b = scanner.NextInt();
            if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
            {
                Console.WriteLine("Possible");
            }
            else
            {
                Console.WriteLine("Impossible");
            }
        }
    }

    public static class Extensions
    {
        public static int ToInt(this string str) => int.Parse(str);
        public static double ToDouble(this string str) => double.Parse(str);
        public static long ToLong(this string str) => long.Parse(str);
        public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    }

    public class Scanner
    {
        private TextReader reader;
        public Scanner()
        {
            reader = Console.In;
        }
        public Scanner(TextReader reader)
        {
            this.reader = reader;
        }
        private string NextWord()
        {
            var sb = new StringBuilder();
            while (true)
            {
                var c = reader.Read();
                if (c == -1 || c == 13 || c == 10 || c == 32)
                {
                    break;
                }
                sb.Append((char)c);
            }
            return sb.ToString();
        }
        public int NextInt()
        {
            return NextWord().ToInt();
        }
        public string Next()
        {
            return NextWord();
        }
        public double NextDouble()
        {
            return NextWord().ToDouble();
        }
        public long NextLong()
        {
            return NextWord().ToLong();
        }
        public BigInteger NextBigInteger()
        {
            return NextWord().ToBigInteger();
        }
        public string NextLine()
        {
            return reader.ReadLine();
        }
    }
}


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

int main(){
   int N, M;
   std::cin >> N >> M;
   int k[M];
   std::vector<int> s[M];
   int n = 1;
   for(int i=0; i<N; ++i)
      n *= 2;
   for(int i=0; i<M; ++i){
      std::cin >> k[i];
      for(int j=0; j<k[i]; ++j){
	 int tmp = 0;
	 std::cin >> tmp;
	 s[i].push_back(tmp-1);
      }
   }
   int p[M];
   for(int i=0; i<M; ++i)
      std::cin >> p[i];

   int ans = 0;
   for(int i=0; i<n; ++i){
      bool flag = true;
      for(int j=0; j<M; ++j){
	 int count = 0;
	 for(int l=0; l<k[j]; ++l){
	    if(i & (1<<s[j][l])){
	       count++;
	    }
	 }
	 if(count%2!=p[j]){
	    flag = false;
	    break;
	 }
      }
      if(flag) ++ans;
   }
   std::cout << ans << std::endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int A, B, C, D, E;
 
    cin >> A >> B >> C >> D >> E;
 
    vector<int> v = {A, B, C, D , E};
 
    for (int i = 0; i < 5; i++)
    {
        if (v[i] == 0)
        {
            cout << i + 1;
            break;
        }
    }
}

Measured memory_bytes: 3604
#include<stdio.h>
int main(){
    int a, b, i;
    char op;
    
    for(i=1;i>0;i++){
        scanf("%d %c %d", &a, &op, &b);
        if(op=='+'){
            printf("%d\n", a+b);
        }
        else if(op=='-'){
            printf("%d\n", a-b);
        }
        else if(op=='*'){
            printf("%d\n", a*b);
        }
        else if(op=='/'){
            printf("%d\n", a/b);
        }
        else if(op=='?'){
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2104
#include <utility>
#include <vector>
#include <iostream>
#include <cstdlib>
#include<bits/stdc++.h>
#include <limits>
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <stdio.h>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef unsigned long long ull;
ull gcd(ull a, ull b){return b? gcd(b, a%b):a;}
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
	int A[3][3];
	bool check[3][3];
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			cin >> A[i][j];
			check[i][j] = false;
		}
	}
	int N;
	cin >> N;
	int b[N];
	for(int i = 0; i < N; i++){
		cin >> b[i];
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				if(A[j][k] == b[i]){
					check[j][k] = true;
				}
			}
		}
	}

	string ans = "No";
	for(int i = 0; i < 3; i++){
		bool bingo = true;
		for(int j = 0; j < 3; j++){
			if(!check[i][j]){
				bingo = false;
			}
		}
		if(bingo){
			ans = "Yes";
		}
	}

	for(int j = 0; j < 3; j++){
		bool bingo =true;
		for(int i = 0; i < 3; i++){
			if(!check[i][j]){
				bingo = false;
			}
		}
		if(bingo){
			ans = "Yes";
		}
	}

	if((check[0][0] && check[1][1] && check[2][2])|| (check[2][0] && check[1][1] && check[0][2])){
		ans = "Yes";
	}

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


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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

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

using namespace std;
using ll = int64_t;

ll calc (ll n, ll N) {
    return (n + N / n * n) * (N / n) / 2;
}

int main() {
    ll N;
    cin >> N;
    cout << calc (1L, N) - calc (3L, N) - calc (5L, N) + calc (15L, N) << endl;
    return 0;
}


Measured memory_bytes: 3592
/*In the name of Allah*/
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000111
#define MAX 200005
#define mod 1000000007
#define ll long long
vector<int> g[MAX];
set<int> temp;
bool see[MAX];
int x[MAX],y[MAX];
vector<int> m[MAX],mm[MAX],yy;
set<int> xx;
int cnt = 0;
void dfs(int u){
	see[u] = 1;
	cnt++;
	for(auto i : m[u])temp.insert(i);
	for(auto v : g[u])
		if(!see[v])
			dfs(v);
}


int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0; i < n ; i++)cin>>x[i]>>y[i],m[x[i]].push_back(y[i]),mm[y[i]].push_back(x[i]),yy.push_back(y[i]),xx.insert(x[i]);
	for(auto v : yy){
		for(int i = 1; i < mm[v].size() ; i++){
			g[mm[v][i]].push_back(mm[v][i-1]);
			g[mm[v][i-1]].push_back(mm[v][i]);
		}
	}	
	ll ans = 0;
	for(auto i : xx)
		if(!see[i])cnt = 0,temp.clear(),dfs(i),ans += 1LL * temp.size() * cnt;
	cout<<ans - n;
	return 0;
}


Measured memory_bytes: 232564
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

struct combination {
    vector<ll> frac;
    combination(int n):frac(n+1) {
        frac[0] = 1;
        rep(i, n) {
            frac[i+1] = (n-i) * frac[i];
            frac[i+1] /= i+1;
        }
    }
} ;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    rep(i, n) {
        cin >> v[i];
    }

    sort(rall(v));
    ld ave = 0;
    vi x;
    for(int i = a; i <= b; ++i) {
        ll sum = 0;
        rep(j, i) {
            sum += v[j];
        }
        ld now = (ld)sum/i;
        if(now > ave+1e-10) {
            x.clear();
            x.push_back(i);
            ave = now;
        } else if(abs(now-ave) < 1e-10) {
            x.push_back(i);
        }
    }

    cout << fixed << setprecision(10);
    cout << ave << endl;

    ll ans = 0;
    reverse(all(v));
    rep(i, x.size()) {
        ll now = x[i];
        ll num = v[n-now];
        vector<ll>::iterator itr, itu;
        itr = lower_bound(all(v), num);
        itu = upper_bound(all(v), num);
        ll hh = now - (v.end()-itu);
        ans += combination(itu-itr).frac[hh];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int n[4];
    REP(i, 4) cin >> n[i];
    sort(n, n + 4);
    cout << (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
a = 1
flag = True
for i in range(n):
  a *= x[i]
  if a > 10**18:
    if 0 in x:
      print(0)
    else:
      print('-1')
    flag = False
    break
if flag:
  print(a)

Measured memory_bytes: 21480
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll ans = -1;
    for(ll i = 0; i < 5; i++) {
        ll x;
        cin >> x;
        if(x == 0) ans = i + 1;
    }
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N; cin >> N;
  vector<ll> A(N);
  for(ui i = 0; i < N; ++i)
  {
    ll a; cin >> a;
    a -= ((ll)i + 1);
    A[i] = a;
  }
  boost::sort(A, std::less<ll>());

  vector<ll> b{};
  if(N % 2)
  {
    b.push_back(A[(N - 1) / 2]);
  }
  else
  {
    auto i = N / 2;
    b.push_back(A[i]);
    b.push_back(A[i - 1]);
  }

  vector<ll> ans{};
  for(const auto& bi : b)
  {
    ll res = boost::accumulate(A, (ll)0, [&bi](auto r, auto a){
      return r + std::abs(a - bi);
    });
    ans.push_back(res);
  }

  cout << *boost::min_element(ans) << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
#define maxn 200005
#define mod 1000000007
///(a/b)%mod=(a*pow(b,(mod-2)))%mod;
ll fac[maxn];
ll pow_mod(ll n,ll k)
{
    ll res=1;
    while(k>0)
    {
        if(k&1)
            res=res*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return res;
}

void init_fac()
{
    fac[0]=fac[1]=1;
    for(int i=2;i<maxn;++i)
    {
        fac[i]=(i*fac[i-1])%mod;
    }
}
ll C(ll A,ll B)
{
    //cout<<A<<" "<<fac[A]<<" "<<pow_mod(fac[B],mod-2)<<" "<<pow_mod(fac[A-B],mod-2)<<"!!!"<<endl;
    return (((fac[A]*pow_mod(fac[B],mod-2))%mod)*pow_mod(fac[A-B],mod-2)%mod)%mod;
}
ll H,W,A,B;
ll ans;
int main()
{
    init_fac();
    scanf("%lld%lld%lld%lld",&H,&W,&A,&B);
    ans=0;
    A=H-A+1;H--;W--;
    A--;B--;
    for(int i=1+B;i<=min(A+B,W);i++)
    {
        ans+=(C(A+B,i)*C(H+W-A-B,W-i))%mod;
        ans%=mod;
        //cout<<i<<" "<<ans<<" "<<C(A+B,i)<<" "<<C(H+W-A-B,W-i)<<endl;

    }
    cout<<ans%mod<<endl;
}



Measured memory_bytes: 1792
// 高校生一人旅.cpp : Defines the entry point for the console application.
//
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <queue>
using namespace std;
queue<int> que;

int data[10000], suffix = 0;

int main(void)
{

	while (1) {
		int line, station;
		int cost[2][101][101] = { 0 };

		scanf("%d %d", &line, &station);
		if (line == 0 && station == 0) {
			break;
		}
		int a, b, value1, value2;
		for (int i = 1; i <= line; i++) {
			scanf("%d %d %d %d", &a, &b, &value1, &value2);
			cost[0][a][b] = value1;
			cost[0][b][a] = value1;
			cost[1][a][b] = value2;
			cost[1][b][a] = value2;
		}

		int question;
		scanf("%d", &question);

		for (int q = 0; q < question; q++) {
			int start, goal, type, min[101];
			bool visit = { false };
			scanf("%d %d %d", &start, &goal, &type);

			while (que.empty() == false) {
				que.pop();
			}

			que.push(start);
			for (int i = 0; i < 101; i++) {
				min[i] = 999999;
			}
			min[start] = 0;

			bool success = false;
			while (que.empty() == false) {
				int size = que.size();
				for (int n = 0; n < size; n++) {
					int front = que.front();
					for (int i = 1; i <= station; i++) {
						if (cost[type][front][i] != 0) {

							if (min[i] > min[front] + cost[type][front][i]) {
								min[i] = min[front] + cost[type][front][i];
								que.push(i);
							}
						}
					}
					if (success == true) {
						break;
					}
					que.pop();
				}
				if (success == true) {
					break;
				}
			}

			data[suffix++] = min[goal];
		}
	}

	for (int i = 0; i < suffix; i++) {
		printf("%d\n", data[i]);
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip; 
const int INF = (1<<30);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  int n;
  string s;
  cin >> n >> s;
  int l1 = s.size();
  int ans = 0;
  while( n-- ) {
    string ss;
    cin >> ss;
    int l2 = ss.size();
    int a = ss.size();
    int cnt = 1;
    while( cnt <= a ) {
      for(int i=0; i<ss.size(); i++) {
	if( s[0] == ss[i] ) {
	  int cnt2 = 0;
	  int cnt3 = 0;
	  for(int j=i; j<ss.size(); j+=cnt) {
	    if( j >= ss.size() ) break;
	    if( cnt3 >= s.size() ) break;
	    if( ss[j] == s[cnt3] ) {
	      cnt2++;
	    }
	    cnt3++;
	  }
	  if( cnt2 == s.size() ) {
	    ans++; i = ss.size(); cnt = a;
	 
	  }
	}
      }
      cnt++;
    }
  }

  cout << ans << endl;
}

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

int main()
{
    int N = 0;
    std::cin >> N;
    int flag[N];
    int list[N];
    int count = 0;

    for(int i = 0; i < N; i++)
    {
        std::cin >> list[i];
        flag[i] = 0;
    }
    int index = 0;
    for(int i = 0; i < N; i++)
    {
        if (flag[i] == 0){
            index = list[i] - 1;
            if(flag[index] == 0 && list[index] == i+1)
            {
                count = count + 1;
                flag[index] = 1;
            }
        }
    }

    std::cout << count << '\n';
}

Measured memory_bytes: 1024
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;


template <typename T>
using TABLE = vector<vector<T>>;

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


int main(){
    string S;
    cin >> S;

    int count_p = 0;
    for(int i = 0; i < S.size(); ++i){
        if(S[i] == 'p'){
            ++count_p;
        }
    }

    cout <<  S.size() / 2 - count_p;
}



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

#define MAXINF 1000000005
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define repc(it, x) for(auto it = (x).begin(); it != (x).end(); ++it)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rrepc(it, x) for(auto it = (x).rbegin(); it != (x).rend(); ++it)
#define all(x) (x).begin(), (x).end()
#define P pair<int, int>

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool isStrong = true;
    for(int i = 0; i < (s.size()+1)/4; i++){
        if(s[i] == s[(s.size()-1)/2-i-1] && s[i+(s.size()+1)/2] == s[s.size()-1-i] && s[i] == s[s.size()-1-i]) {
            isStrong = true;
        } else {
            isStrong = false;
        }
        if(!isStrong) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" <<endl;
    return 0;
}

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

int main()
{
    int h,w,k; cin >> h >> w >> k;
    vector<vector<char>> c(h,vector<char>(w));
    rep(i,h) rep(j,w) cin >> c[i][j];
    int ans = 0;
    for(int a = 0; a < 1<<h ; a++) {
        for(int b = 0; b < 1<<w ; b++) {
            int cnt = 0;
            rep(i,h) rep(j, w) {
                if(a>>i & 1) continue;
                if(b>>j & 1) continue;
                if(c[i][j] == '#') cnt++;
            }
            if(cnt == k) ans++;
        }
    }

    cout << ans << endl;
}

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

int n, k, num;

void number(int x)
{
	num++;
	if (x >= k)	number(x / k);
	else	return ;
}

int main()
{
	cin >> n >> k;
	number(n);
	cout << num;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = [0]*(N-1)

for i in range(N-1):
    B[i] = A[i+1] -  A[i]

#print(*B)

yen = 1000
i = 0
while i < N - 1:
    if B[i] > 0:
        j = i
        while j < N - 1 and B[j] >= 0:
            j += 1
        j -= 1
        #print("increase",i,j+1)
        kabu = yen // A[i]
        yen += kabu * (A[j+1] - A[i])
        i = j + 1
        continue
    if B[i] < 0:
        j = i
        while j < N - 1 and B[j] <= 0:
            j += 1
        j -= 1
        #print("decrease",i,j+1)
        i = j + 1
        continue
    i += 1

print(yen)

Measured memory_bytes: 61780
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
//#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N;
    cin >> N;
    if (N % 1000 == 0) cout << 0 << endl;
    else cout << 1000 - N % 1000 << endl;
}

Measured memory_bytes: 3632
//AnkitCode99 here....
#include<bits/stdc++.h>
#define endl "\n"
typedef long long int ll;
#define MOD 1000000007
#define mp make_pair
#define pll pair<ll,ll>
#define pb push_back
//max xor btw range of two numbers..
#define max_XOR(a,b) (1 << int(log2(a ^ b) + 1)) - 1
#define vl vector<ll>
#define inf ll(1e18)
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define nrep(i,a,b) for(long long int i=a;i>=b;i--)
#define ceil(a,b) a/b+((a%b ==0 )?0:1)
using namespace std;

const ll sz=100005;
const ll szz=1000006;

int main()
{
    fast;
   
    ll n;
    cin>>n;
    //ll ar[n];
    map<ll,ll> mp;
    mp[1]=0;
    rep(i,2,n+1)
    {
        ll ele;
        cin>>ele;
        // cin>>ar[i];
        mp[ele]++;
    }
    rep(i,1,n+1)
    {
        cout<<mp[i]<<endl;
    }
}//Goodbye...

Measured memory_bytes: 16168
from collections import defaultdict
h,w,m = map(int,input().split())
dh = defaultdict(int)
dw = defaultdict(int)
l=defaultdict(tuple)
for _ in range(m):
    x,y = map(int,input().split())
    dh[x]+=1
    dw[y]+=1
    l[(x,y)]=1
m = 0
for i in range(1,h+1):
    if dh[i]>m:
        m = dh[i]
        hi=i
c=m
m = 0
for i in range(1,w+1):
    d = dw[i]
    if l[(hi,i)]==1:
        d-=1
    m = max(m,d)
c+=m
m = 0
wi=0
for i in range(1,w+1):
    if dw[i]>m:
        m = dw[i]
        wi=i
c2=m
m = 0
for i in range(1,h+1):
    d = dh[i]
    if l[(i,wi)]==1:
        d-=1
    m = max(m,d)
c2+=m
print(max(c,c2))

Measured memory_bytes: 252528
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
		cout<<"OK";
		return 0;
		}
	}
	cout<<"NG";
	return 0; 
}

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

int main(void){
    int N;
    cin >> N;
    vector<int> num(N);
    for(int i = 0; i < N; i++){
        cin >> num[i];
    }

    bool res = true;
    for(int i = 0; i < N; i++){
        if(!(num[i]%2)){
            if(!(num[i]%3) || !(num[i]%5));
            else {
                res = false;
                break;
            }
        }
    }

    cout << (res ? "APPROVED" : "DENIED") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int N;
	cin >> N;
	
	vector<string> s(N);
	for (int i = 0; i < N; i++) cin >> s[i];

	vector<int> count(4, 0);

	for (int i = 0; i < N; i++) {
		if (s[i] == "AC") count[0]++;
		if (s[i] == "WA") count[1]++;
		if (s[i] == "TLE") count[2]++;
		if (s[i] == "RE") count[3]++;
	}

	cout << "AC x " << count[0] << endl;
	cout << "WA x " << count[1] << endl;
	cout << "TLE x " << count[2] << endl;
	cout << "RE x " << count[3] << endl;

	return 0;
}


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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(ll size) {
        size = max((int) sqrt(size) + 1, 101010);
        prime.resize(size, 1);
        prime[0] = 0;
        prime[1] = 0;
        for (size_t i = 2; i * i <= size; ++i)
            if (prime[i]) {
                for (size_t j = 2; i * j <= size; ++j)prime[i * j] = false;
            }
    }
};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

string s;
ll N, K;

int main() {
    cin >> N >> K;

    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<>());
    ll res = 0;
    FOR(i, K, N - 1) {
        res += A[i];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
//
//  Created by Henry Cafaro
//  Copyright © 2020 Henry Cafaro. All rights reserved.
//

# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <bitset>
# include <queue>
# include <cstring>


#define ll long long

using namespace std;

ll int a;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
        
    cin >> a;
    
    cout << a + a*a + a*a*a << endl;
   
    
    
    
    
    
    
    
    
    
    
}


Measured memory_bytes: 3656