akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
const int MOD = 1000000007;


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(){
    int a,b,c,d; cin >>  a >> b >> c >> d;
    int e= c/b,f = a/d; 
    if(c%b!=0) e++;
    if(a%d) f++;

    if(e>f) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;

void ansYes(bool flag){
    if (flag) cout << "Yes" << endl; else  cout << "No" << endl;
}

void ansYES(bool flag){
    if (flag) cout << "YES" << endl; else  cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

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

int nanko(string s,Int n,Int i){
    Int length = min(n - i - 1,i);
    Int ans = 0;
    for (int k = i-length;k < i;k++){
        if (s.at(k) == 'R' && s.at(i +  (i - k) == 'B')) ans++;
    }
    return ans;
}

int main(){
    while(true) {
        int n;
        cin >> n;
        if (n == 0) break;
        Int ans = -10000000000;
        Int sum = 0;
        REP(n,i) {
            Int a;
            cin >> a;
            sum += a;
            ans = max(ans,sum);
            if (sum < 0) {
//                cout << " reset : ";
                sum = 0;
            }
//            cout << a << " : " << ans << endl;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
//#include <mylib.h>
using namespace std;
//cin.sync_with_stdio(false);

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FOR_RE(i,a,b) for(int i = (a); i > (b); --i)
#define rep(i,n) FOR(i,0,n)
//1個上から時計周り
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//上右下左
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;
int n;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int Y;
    cin >> n >> Y;
    int res1;
    int res2;
    
    for(int x = 0; x <= n; x++){
        res1 = Y - 10000 * x;
        for(int y = 0; y <= n - x; y++){
            res2 = res1 - 5000 * y;
            int z = res2 / 1000;
            //cout << res1 << endl;
            //cout << res2 << endl;
            //cout << x << " " << y << " " << z << endl;
            if(n == x + y + z){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    OPT[node][BLACK] = product(OPT[child[i]][WHITE])
    OPT[node][WHITE] = product(OPT[child[i]][WHITE|BLACK])
    """
    N = read_int()
    G = [[] for _ in range(N)]
    modulo = 10**9+7
    for _ in range(N-1):
        x, y = read_ints()
        G[x-1].append(y-1)
        G[y-1].append(x-1)
    # type, node, parent
    VISIT, CALCULATE = 0, 1
    BLACK, WHITE = 0, 1
    OPT = [
        [1, 1] for _ in range(N)
    ]
    Q = [(VISIT, 0, None)]
    while len(Q) != 0:
        t, node, parent = Q.pop()
        if VISIT == t:
            Q.append((CALCULATE, node, parent))
            for child in G[node]:
                if child != parent:
                    Q.append((VISIT, child, node))
        else:
            for child in G[node]:
                if child != parent:
                    OPT[node][BLACK] = (OPT[node][BLACK]*OPT[child][WHITE])%modulo
                    OPT[node][WHITE] = (OPT[node][WHITE]*(OPT[child][WHITE]+OPT[child][BLACK]))%modulo
    return (OPT[0][BLACK]+OPT[0][WHITE])%modulo


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 87328
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	print(1-II())
	

	

if __name__=="__main__":
	main()


Measured memory_bytes: 9184
/* To Kaise Hain Aaplog*/

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) (x).begin(), (x).end()

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}

const int siz = 2 * 1e5 + 10;
vector<int> v[siz];
bool vis[siz] = {0};
int counter = 0;

void dfs(int s)
{
    vis[s] = true;
    counter++;
    for (int x : v[s])
    {
        if (!vis[x])
        {
            dfs(x);
        }
    }
}
int32_t main()
{
   // shuru_krte_hai_bina_kisi_bakchodi_ke();
    map<pair<int, int>, int> aa_gya;
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        if (aa_gya.find({x, y}) != aa_gya.end() || aa_gya.find({y, x}) != aa_gya.end())
        {
            continue;
        }
        v[x].push_back(y);
        v[y].push_back(x);
        aa_gya[{x, y}]++;
    }
    vector<int> groups;
    for (int i = 1; i <= n; i++)
    {
        if (!vis[i])
        {
            counter = 0;
            dfs(i);
            groups.push_back(counter);
        }
    }
    sort(all(groups));
    reverse(all(groups));
    int ans = groups.back();
    int temp = groups.back();
    groups.pop_back();
    while(groups.size()>0){
        ans+=groups.back()-temp;
        temp = max(groups.back(),temp);
        groups.pop_back();
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 33372
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 10000000

bool mp[10][10000],mp2[10][10000];
int main(){
	long R,C;
	while(cin>>R>>C){
		if(R==0&&C==0)break;
		REP(i,R)REP(j,C){
			cin>>mp[i][j];
		}
		long res=0;
		for(int i=0;i<(1<<10);i++){
			bitset<10>bs(i);
			REP(j,R){
				REP(k,C)mp2[j][k]=(bs[j])?(!mp[j][k]):mp[j][k];
			}
			long sum=0;
			REP(j,C){
				long cnt=0;
				REP(k,R)if(mp2[k][j])cnt++;
				sum+=max(cnt,R-cnt);
			}
			res=max(res,sum);
		}
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1356
#include <iostream>
#include <algorithm>
#include <set>
#define N_MAX 1001

using namespace std;

int N, M;
int P[N_MAX];
int S[1002001];
void solve() {
  int cnt = 0;
  for(int i = 0; i <= N; ++i) {
    for(int j = i; j <= N; ++j) {
      int tmp = P[i] + P[j];
      if(tmp > M) continue;
      S[cnt++] = tmp;
    }
  }

  sort(S, S+cnt);
  int ans = 0;
  for(int i = 0; i < cnt; ++i) {
    int *tmp = upper_bound(S, S+cnt, M - S[i]);
    --tmp;
    ans = max(ans, *tmp + S[i]);
  }
  cout << ans << endl;
}

int main() {
  while((cin >> N >> M) && N && M) {
    P[0] = 0;
    for(int i = 1; i <= N; i++) {
      cin >> P[i];
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 2828
#include <bits/stdc++.h> 
using namespace std;
int n,k,ans,p;
int a,b;
int main() 
{
	cin>>a>>b;
    if(a>0)cout<<"Positive";
    else
    if(b>=0)cout<<"Zero";
    else
    if((a&1)^(b&1))cout<<"Positive";
    else cout<<"Negative";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main()
{
  int n;
  ll ans;
  cin >> n;
  vector<int> a;
  rep(i, n)
  {
    int x;
    cin >> x;
    a.push_back(x);
  }

  sort(a.begin(), a.end());

  bool ok = true;
  if (n % 2 == 1)
  {
    if (a[0] != 0)
      ok = false;

    int tmp = 2;
    int count = 0;
    repi(i, 1, n)
    {
      if (a[i] != tmp)
        ok = false;

      if (count == 0)
      {
        count++;
      }
      else
      {
        count = 0;
        tmp += 2;
      }
    }

    ans = mint(2).pow(n / 2).x;
  }
  else
  {
    int tmp = 1;
    int count = 0;
    rep(i, n)
    {
      if (a[i] != tmp)
        ok = false;

      if (count == 0)
      {
        count++;
      }
      else
      {
        count = 0;
        tmp += 2;
      }
    }

    ans = mint(2).pow(n / 2).x;
  }

  if (ok)
  {
    cout << ans << endl;
  }
  else
  {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 892
N, K = map(int, input().split())
K -= 1
S = list(input())
if S[K] == 'A':
  S[K] = 'a'
elif S[K] == 'B':
  S[K] = 'b'
elif S[K] == 'C':
  S[K] = 'c'

print(*S, sep='')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int n,m,ans,ans2;
const int N=1e5+5;
int x[N];bool f[N];
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		string s;
		int a;
		cin>>a>>s;
		if(s=="WA"&&!f[a])
			x[a]++;
		else
			if(s=="AC"&&!f[a])
			{
				ans+=x[a];
				f[a]=true;
				ans2++;
			}
	}
	cout<<ans2<<' '<<ans<<endl;
	return 0;
}

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

using namespace std;

void a()
{
    int n, a;
    cin >> n >> a;
    cout << ((n * n) - a) << endl;
}

void b()
{
    int n, k;
    cin >> n >> k;
    int result = 0;
    for(int i = 0; i < n; i++)
    {
        int tempa = 0, tempb = 0;
        int x;
        cin >> x;
        if(abs(k - x) < x){
            result += abs(k - x) * 2;
        }else{
            result += x * 2;
        }
    }
    cout << result << endl;
}
int main() {
    b();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;
    int num = 0;
    for (int i = a; i <= b; ++i)
    {
        if (c % i == 0)
            ++num;
    }
    std::cout << num << std::endl;
    return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  int n, m;
  cin >> n >> m;

  vector<vector<char>> A(n, vector<char> (n));
  vector<vector<char>> B(m, vector<char> (m));
  rep(i, 0, n) rep(j, 0, n) cin >> A[i][j];
  rep(i, 0, m) rep(j, 0, m) cin >> B[i][j];

  bool ok = false;
  rep(i, 0, n) rep(j, 0, n) {
    if (i + m <= n && j + m <= n) {
      bool tmp = true;
      rep(k, 0, m) rep(l, 0, m) {
        if (A[i+k][j+l] != B[k][l]) {
          tmp = false;
          break;
        }
      }
      if (tmp) {
        ok = true;
        break;
      }
    }
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
};


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

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

//command
//c++ atcoder.cpp -std=c++14
//./a.out

//fill(score, score+202020, 0);
#define NN 202020

int main(){
  ll n;
  string s;
  cin >> n;
  cin >> s;
  if (n%2 == 1){
    cout << "No" << endl;
    exit(0);
  }
  ll le = n/2;
  for (int i=0;i<le;i++){
    if (s[i] != s[le + i]){
      cout << "No" << endl;
      exit(0);
    }
  }
  
  cout << "Yes" << endl;
}


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

int n, k, c, s = 0;
int x[3000], y[3000];
double a[3000];

int main()
{
	cin >> n >> k;

	for (int i = 0; i < n; i++)
		cin >> x[i] >> y[i];

	for (int i = 0; i < n - k + 1; i++) {
		memset(a, 0, sizeof(a));
		for (int t = 0; t < n - i - 1; t++) {
			if (x[t + i + 1] == x[i])
				a[t] = 10001;
			else
				a[t] = double(y[t + i + 1] - y[i]) / double(x[t + i + 1] - x[i]);
		}
		sort(a, a + n - i - 1);

		c = 0;
		for (int j = 0; j < n - i - 2; j++) {
			if (a[j] == a[j + 1]) {
				c++;
				if (c == k - 2) {
					s = 1;
					break;
				}
			}
			else
				c = 0;
		}
		if (c == k - 2)
			break;
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3220
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
from itertools import permutations
from scipy.sparse.csgraph import dijkstra
t = [[float('inf') for i in range(N)] for j in range(N)]

for i in range(M):
    a,b,c = map(int, input().split())
    t[a-1][b-1] = t[b-1][a-1] = c
t=dijkstra(t).astype(int)
def c(l):
    ret = 0
    for i in range(R-1):
        ret += t[l[i]-1][l[i+1]-1]
    return ret

print(min([c(i) for i in permutations(r)]))

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


int main() {
	//code
	//cout<<"ashish"<<endl;
	string s,t;
	cin>>s;
	cin>>t;
	int count=0;
	for(int i=0;i<s.length();i++){
        if(s[i]!=t[i]) count++;
	}
	cout<<count;
	return 0;
}


Measured memory_bytes: 3832
def solve(n, P):
  min_val = P.pop(0)
  count = 1
  for p in P:
    if min_val >= p:
      count += 1
    if min_val > p:
      min_val = p
  return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))


Measured memory_bytes: 24744
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll  long long
#define INF (ll)1e18 + 50
#define MAXN (int)1e5 + 50
#define fi first
#define se second
#define MOD 1000000007
#define all(v)((v).begin()), ((v).end())
#define A 911382323
#define B 972663749


int main() {
    ll n, aux = 5; cin >> n;
    ll resp = 0;
    
    while(aux * 2 <= n)
    {
		resp += n / (aux * 2); 
		aux *= 5;    	
    }
	
	if(n % 2 == 1) puts("0");
	else cout << resp;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  using tsii = tuple<string, int, int>;
  vector<tsii> list(n);
  string str;
  int p;
  
  for (int i = 0; i < n; i++) {
    cin >> str >> p;
    list[i] = make_tuple(str, -p, i+1);
  }
  
  sort(list.begin(), list.end());
  
  int index;
  for (int i = 0; i < n; i++) {
    tie(ignore, ignore, index) = list[i];
    cout << index << endl;
  }
}


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

int E;

int main(){
  while( cin >> E && E ){
    int res = E;
    for(int z=0;z*z*z<=E;z++){
      for(int y=0;y*y<=E-z*z*z;y++){
        int x = E - z*z*z - y*y;
        if( x < 0 ) break;
        res = min( res, x + y + z );
      }
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		Console.WriteLine("{0}", Math.Min(p[1]*p[0], p[2]));
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 13140
#pragma warning( disable : 6031)

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
//const long long mod = 1000000007;
const long long mod = 998244353;
using std::vector;
using std::pair;
using std::string;
using std::map;
using std::abs;
class Combination {
	int MAX;
	int mod;
	long long* kai;
	long long modpow(long long a, long long n) {
		long long res = 1;
		while (n > 0) {
			if (n & 1) res = res * a % mod;
			a = a * a % mod;
			n >>= 1;
		}
		return res;
	}
	long long modinv(long long a) {
		return modpow(a, mod - 2);
	}
	void Init() {
		for (int i = 1; i < MAX; i++) {
			kai[i] = kai[i - 1] * i;
			kai[i] %= mod;
		}
	}
public:
	Combination(int max, int mod) :mod(mod), MAX(max + 5) {
		kai = new long long[max + 5]{ 1 };
		Init();
	}
	~Combination() {
		delete[] kai;
	}
	long long operator()(int n, int k) {
		if (n < 0 || k < 0 || n < k)return 0;
		long long res = kai[n];
		res *= modinv(kai[k]);
		res %= mod;
		res *= modinv(kai[n - k]);
		res %= mod;
		//printf("%d C %d = %d\n", n, k, res);
		return res;
	}
};

int main() {
	int N, M, K;
	scanf("%d %d %d", &N, &M, &K);
	Combination nck(N, mod);
	auto P = new long long[N];
	long long res = 0;
	P[N - 1] = M;
	for (int i = N - 2; i >= 0; i--) {
		P[i] = (P[i + 1] * (M - 1)) % mod;
	}
	for (int i = K; i >= 0; i--) {
		res += P[i] * nck(N - 1, i);
		res %= mod;
	}
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 5936
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

int main(){
	int n;
	cin>>n;
	vi p(n);
	REP(i,n){
		cin>>p[i];
	}
	queue<int> q;
	vi cost(n,-1);
	q.push(0);
	cost[0]=0;
	while(q.size()){
		int cur=q.front();q.pop();
		FOR(die,1,6+1){
			int pos=cur+die;
			if(pos>=n)continue;
			while(cost[pos]==-1&&p[pos]!=0){
				cost[pos]=cost[cur]+1;
				pos+=p[pos];
			}
			if(p[pos]==0&&cost[pos]==-1){
				cost[pos]=cost[cur]+1;
				q.push(pos);
			}
		}
	}
	cout<<cost[n-1]<<endl;
}

Measured memory_bytes: 1796
#include<bits/stdc++.h>
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 ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
const ll MOD = 1e9+7;
const int MAX = 1000005;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int x,y; cin >> x >> y;
    if((x+y) % 3 != 0 || y > 2*x || 2*y < x){
        cout << "0" << endl;
        return 0;
    }
    int n = (x+y) / 3;
    int r = x - n;
    COMinit();
    cout << COM(n,r) << endl;
}

Measured memory_bytes: 23680
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  dchar[] n; readV(n);

  foreach (ref ni; n)
    if (ni == '1') ni = '9';
    else if (ni == '9') ni = '1';

  writeln(n);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int ABC[3];

int get_target() {
    int maximum = ABC[2];
    int diff = maximum - ABC[0] + maximum - ABC[1];
    if (diff%2 == 0) return maximum;
    else return maximum + 1;
}

int main(int argc, const char * argv[]) {
    inputArray(ABC, 3);
    sort(ABC, ABC+3);
    int target = get_target();
    int ans;
    if (target == ABC[2]) {
        ans = (target - ABC[1]) + (ABC[1] - ABC[0]) / 2;
    } else {
        ans = (target - ABC[1]) + (ABC[1] + 1 - ABC[0]) / 2;
    }

    output(ans);
    return 0;
}

Measured memory_bytes: 256
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <limits>
#include <map>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <istream>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <cwchar>
#include <cwctype>
#include <complex.h>
#include <fenv.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	cout<<(n<1200?"ABC":"ARC");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

int main()
{
  int A, B, T;
  cin >> A >> B >> T;
  cout << (T / A) * B << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  vector <pair<int , int >> v;
  cin>>n;
  for (int i=1;i<=n;i++)
  {
    int a;
    cin>>a;
    v.push_back({a,i});
  }
  sort(v.begin(),v.end());
  for (auto x: v)
  {
    cout<<x.second<<" ";
  }
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int h = n / 3600;
    n -= 3600 * h;
    int m = n / 60;
    int s = n % 60;
    printf("%d:%d:%d\n", h, m, s);
}


Measured memory_bytes: 3204
#include <iostream>

using namespace std;

int main(){
int n;
    cin >> n;
    int impare;

    if(n%2 == 0)

        impare =  n/2 ;

        else

        impare= n/2 +1;

        float rezultat = (float)impare / n;
    cout << rezultat << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9+7;

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n),dp(1e6,-1);
    map<ll,ll> dat;

    rep(i,n){
        cin>>a[i];
        dat[a[i]]++;
    }


    ll sum=0;
    for(auto p:dat){
        sum+=(p.second)*(p.second-1)/2;
    }


    rep(i,n){
        ll t=dat[a[i]];
        ll ans=sum;
        ans-=t*(t-1)/2;
        t--;
        ans+=t*(t-1)/2;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 20652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {
			String[] s = sc.nextLine().split(" ");
			BinaryTree t1 = BinaryTree.valueOf(s[1]);
			BinaryTree t2 = BinaryTree.valueOf(s[2]);
			if (s[0].equals("i")) {
				System.out.println(t1.intersection(t2));
			}else{
				System.out.println(t1.union(t2));
			}
		}
	}

	static class BinaryTree {
		BinaryTree left,right;
		private int strlen = 0;
		public BinaryTree(BinaryTree left,BinaryTree right,int strlen) {
			this.left = left;
			this.right = right;
			this.strlen = strlen;
		}

		public static BinaryTree valueOf(String s) {
			return valueOf(s.toCharArray(), 0);
		}
		public static BinaryTree valueOf(char[] s,int i) {
			int left = i;
			if (s[i] != '(') {
				return null;
			}
			i++;
			BinaryTree t1 = valueOf(s, i);
			if (t1 != null) {
				i += t1.strlen;
			}
			i++;
			BinaryTree t2 = valueOf(s, i);
			if (t2 != null) {
				i += t2.strlen;
			}
			i++;
			return new BinaryTree(t1, t2, i-left);
		}

		BinaryTree intersection(BinaryTree t) {
			BinaryTree l = null, r = null;
			if (this.left != null && t.left != null) {
				l = this.left.intersection(t.left);
			}
			if (this.right != null && t.right != null) {
				r = this.right.intersection(t.right);
			}
			return new BinaryTree(l, r, -1);
		}

		BinaryTree union(BinaryTree t) {
			BinaryTree l = null, r = null;
			if (this.left != null && t.left != null) {
				l = this.left.union(t.left);
			}else if (this.left != null) {
				l = this.left;
			}else{
				l = t.left;
			}
			if (this.right != null && t.right != null) {
				r = this.right.union(t.right);
			}else if (this.right != null) {
				r = this.right;
			}else{
				r = t.right;
			}
			return new BinaryTree(l, r, -1);
		}

		public String toString() {
			StringBuilder sb = new StringBuilder();
			sb.append('(');
			if (left != null) {
				sb.append(left);
			}
			sb.append(',');
			if (right != null) {
				sb.append(right);
			}
			sb.append(')');
			return sb.toString();
		}
	}

}

Measured memory_bytes: 17192
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

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

    int x, a, b;

    cin >> x >> a >> b;

    x -= a;

    cout << x%b;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;

int main(){    
 int a,b;
 scanf("%d%d",&a,&b);
 if(a>b){
     printf("a > b\n");
 }
 else if(a<b){
     printf("a < b\n");
 }
 else {
     printf("a == b\n");
 }


    return 0;
    }




Measured memory_bytes: 2608
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}

ll n, k;
ll a[200001];

bool chk(ll len){
    int cnt = 0;
    FOR0(i, n){
        if (a[i] <= len) continue;
        else {
            cnt += ceil((ld)a[i]/(ld)len);
            cnt--;
            // if (len == 3){
            //     cout << ceil(a[i]/len) sp a[i]/len << endl;
            //     cout << cnt << endl;
            // }
        }
    }
    // cout << len sp cnt << endl;
    return cnt <= k;
}


int main(){
    cin >> n >> k;
    FOR0(i, n) cin >> a[i];
    ll lo = 1, hi = 1e9 + 1;
    ll ans = 1e9;
    while(lo <= hi){
        ll mid = (lo + hi)/2;
        if (chk(mid)){
            ans = min(ans, mid);
            hi = mid - 1;
        }
        else {
            lo = mid + 1;
        }
    }
    cout << ans << endl;

}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

vector<P> edges[2510];

void bellmanford1(int n,vector<ll>& dist) {
    for (int x = 0;x < n-1;++x) {
        for (int i = 0;i < n;++i) if (dist[i] < 1e18) for (P& p : edges[i]) {
            dist[p.first] = min(dist[i]+p.second,dist[p.first]); 
        }
    }
}

void bellmanford2(int n,vector<ll>& dist) {
    for (int x = 0;x < n-1;++x) {
        for (int i = 0;i < n;++i) if (dist[i] < 1e18) for (P& p : edges[i]) {
            if (dist[i]+p.second < dist[p.first]) dist[p.first] = -1e18;
        }
    }
}

int main() {
    int n,m,p;
    cin >> n >> m >> p;
    for (int i = 0;i < m;++i) {
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        u--;v--;
        edges[u].push_back(P(v,p-w));
    }
    vector<ll> dist1(n,1e18),dist2(n);
    dist1[0] = 0;
    bellmanford1(n,dist1);
    dist2 = dist1;
    bellmanford2(n,dist2);
    if (dist1[n-1] > dist2[n-1]) cout << -1 << endl;
    else cout << max(0LL,-dist1[n-1]) << endl;
}

Measured memory_bytes: 512
class Array
  def sum
    reduce(:+)
  end

  def mean
    (sum.to_f / size).round
  end

  def ans
    m = mean
    reduce(0) { |a,b| a + (b - m) ** 2 }
  end
end

n = gets.to_i
a = gets.split(" ").map(&:to_i)
puts a.ans




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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int N;
std::vector<bool> dp;
int main() {
    std::cin >> N;
    dp.resize(100*N+1, false);
    dp[0] = true;
    REP(i, N) {
        int s;
        std::cin >> s;
        for(int j=100*(i+1); j>=0; --j) {
            if(dp[j]) {
                dp[j+s] = true;
            }
        }
    }
    int p = N*100;
    while(p >=0 && (!dp[p] || p%10 == 0)) {
        p--;
    }
    std::cout << std::max(0,p) << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(){
string s;
cin >>s;
for(int i=0; i<s.size();i=i+2){
	cout << s[i];
}
}

Measured memory_bytes: 512
def hp(P, X):
    ans = 0
    for x in X:
        ans += pow(x-P,2)
    return ans

N = int(input())
X = list(map(int, input().split()))
ans = float('inf')
for i in range(1, 101):
    ans = min(hp(i, X), ans)
print(ans)


Measured memory_bytes: 2940
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception{
		PrintWriter pw=new PrintWriter(System.out);
		MScanner sc = new MScanner(System.in);
		int days=sc.nextInt(),n=sc.nextInt();
		int sum=0;
		while(n-->0)sum+=sc.nextInt();
		
		if(sum>days) {
			pw.println(-1);
		}
		else {
			pw.println(days-sum);
		}
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

Measured memory_bytes: 34048
#include <stdio.h>
#include <string.h>
int main(){
	int h, w, k;
	int i, j, p, q, cnt = 0, res = 0, s, t;
	char a[7][7];
	scanf("%d%d%d", &h, &w, &k);
	for(i = 1; i <= h; i++){
		scanf("%s", &a[i][1]);
	}
	p = (1 << h) - 1;
	q = (1 << w) - 1;
	for(i = 0; i <= p; i++)
		for(j = 0; j <= q; j++){
			cnt = 0;
			for(s = 1; s <= h; s++)
				for(t = 1; t <= w; t++){
					if(a[s][t] == '#'){
						if(!(1 << s - 1 & i) && !(1 << t - 1 & j)){
							//printf("%d %d %d %d\n", i, j, s, t);
							cnt++;
						}
						
					}
				}
			if(cnt == k)
				res++;
		}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 1728
// problem-type?
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin >> n;
    set<string> s;
    for(int i=0; i<n; ++i){
        string str;
        cin >> str;
        s.insert(str);
    }
    cout << s.size();
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
        cout << '\n';
    }
}

Measured memory_bytes: 19140
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 500005;

ll fact[MAXN];

ll fastExp(ll a, ll b) {
	ll r = 1;
	a%=MOD;
	while (b) {
		if (b&1) {
			r=(a*r)%MOD;
		}
		b>>=1;
		a=(a*a)%MOD;
	}
	return r;
}

ll inv(ll k){
	return fastExp(k,MOD-2);
}

ll C(int n, int k) {
	if (n == k || k == 0) return 1;
	if (k > n) return 0;
	return (fact[n]*inv(fact[k]*fact[n-k]))%MOD;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k, n;
	cin >> k >> n;
	
	fact[0]=fact[1]=1;
	for(ll i = 2; i <= 500000; i++) {
		fact[i]=(fact[i-1]*i)%MOD;
	}
	
	ll ans = 0;
	for(int i = 1; i <= k; i++){
		ans+= ( (i%2 ? 1 : -1)*((C(k,i)*C(n-i,k-i)%MOD)*fact[k-i])%MOD );
		ans=((ans%MOD)+MOD)%MOD;
	}
	
	ll x = (C(n,k)*fact[k])%MOD;
		
	cout << (((( x * (x - ans ) )%MOD)+MOD)%MOD) << "\n";
}


Measured memory_bytes: 7516
ac = 0
wa = 0
tle = 0
re = 0

n = int(input())
for i in range(n):
    testcase = input()
    if testcase == 'AC':
        ac += 1
    elif testcase == 'WA':
        wa += 1
    elif testcase == 'TLE':
        tle += 1
    elif testcase == 'RE':
        re += 1

print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)

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

int main() {
    int n, ans;
    cin >> n;
    vector<int> si(n);
    vector<int> sj;
    for (int i = 0; i < n; i++) {
        cin >> si.at(i);
        if (si.at(i) % 10 != 0) sj.push_back(si.at(i));
    }
    sort(sj.begin(), sj.end());
    ans = accumulate(si.begin(), si.end(), 0);
    if (ans % 10 == 0) {
        if (sj.size() >= 1) ans -= sj.at(0);
        else ans = 0;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int R, G, B, N, Sum=0;
  cin >> R >> G >> B >> N;
  rep(i, N/R+1){
    if(R*i>N) break;
    rep(j, N/G+1){
      if(R*i+G*j>N) break;
      if((N-(R*i+G*j))%B==0) Sum++;
    }
  }
  cout << Sum << endl;
}

Measured memory_bytes: 256