akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;


void solve(long long N, long long A, long long B){
  cout << min(A*N, B) << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(N, A, B);
}


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

int main()
{
    int n, red = 0, ans = 0;
    cin >> n;
    vector<char> c(300000);
    rep(i, n)
    {
        cin >> c[i];
        if (c[i] == 'R')
            red++;
    }

    rep(i, red) if (c[i] == 'W') ans++;

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

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

int main() {
    int n;cin >> n;
    double x=sqrt(2*n);
    int y=x;
    int a;
    for(int i = y-1; i < y+2; i++) {
        if(i*(i+1)/2>=n) {
            a=i;
            break;
        }
    }
    int d=a*(a+1)/2-n;
    for(int i = 1; i <= a; i++) {
        if(i != d){
            cout << i << endl;
        }
    }

    return 0;
}

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

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

  vector<ll> e(N);
  rep(i, N) {
    ll p;
    cin >> p;
    e[i] = (1 + p);
  }

  ll buf = 0;
  rep(i, K) { buf += e[i]; }

  ll ans = buf;
  repi(i, K, N) {
    buf -= e[i - K];
    buf += e[i];
    ans = max(ans, buf);
  }

  string f = ans % 2 == 0 ? ".0" : ".5";
  cout << (ans / 2) << f << endl;
}

Measured memory_bytes: 1792
import java.util.*;

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

        int N = sc.nextInt();

        int ret = 0;

        for (int i = 1; i <= N; i++) {
            if (i % 2 == 0) continue;

            int cnt = 0;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0) cnt++;
                if (cnt > 8) break;
            }

            if (cnt == 8) ret++;
        }

        System.out.println(ret);
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1e18

void solve_abc_a() {
	ll n, m;
	ll x, y;
	//ll a, b, d;
	ll c;
	//char c;
	ll h, w;
	ll k;
	string s, t;
	ll l_ans = 0;
	string s_ans = "NG";
	ll l, r;

	cin >> s;

	if (s[0] == 'R') {
		if (s[1] == 'R') {
			if (s[2] == 'R') {
				l_ans = 3;
			}
			else {
				l_ans = 2;
			}
		}
		else {
			l_ans = 1;
		}
	}
	else {
		if (s[1] == 'R') {
			if (s[2] == 'R') {
				l_ans = 2;
			}
			else {
				l_ans = 1;
			}
		}
		else {
			if (s[2] == 'R') {
				l_ans = 1;
			}
			else {
				l_ans = 0;
			}
		}
	}

	cout << l_ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}


Measured memory_bytes: 3640
using System;
using System.Linq;

namespace ABC152C {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (input[0] <= input[1]) {
                Console.WriteLine("0");
                return;
            }

            var monsters = Console.ReadLine().Split(' ').Select(long.Parse)
                .OrderByDescending(i => i)
                .Skip(input[1])
                .ToArray();

            Console.WriteLine(monsters.Sum());
        }
    }
}

Measured memory_bytes: 41472
#include<iostream>
#include<map>
#include<vector>
#include<set>
 
using namespace std;
 
struct Node {
  int x, y, d;
};
 
bool operator<(const Node &lhs, const Node &rhs) {
  return lhs.d < rhs.d;
}
 
int hx[2] = {1, 0};
int hy[2] = {0, 1};
 
int main() {
  int h, w;
  cin >> h >> w;
  vector<string> mp(h);
  for(int i = 0; i < h; i++) cin >> mp[i];
  vector<vector<bool>> ch(h);
  for(int i = 0; i < h; i++) ch[i].resize(w);
  multiset<Node> q;
  Node start{0, 0, 0};
  q.insert(start);
  vector<bool> route(10000);
  while(q.size() > 0) {
    Node now = *q.begin();
    q.erase(q.begin());
    if(ch[now.y][now.x] || route[now.d]) {
      cout << "Impossible" << endl;
      return 0;
    }
    ch[now.y][now.x] = true;
    route[now.d] = true;
    mp[now.y][now.x] = '.';
    for(int i = 0; i < 2; i++) {
      int x = now.x + hx[i], y = now.y + hy[i];
      if(x < 0 || x >= w || y < 0 || y >= h) continue;
      if(mp[y][x] != '#') continue;
      Node next{x, y, now.d + 1};
      q.insert(next);
    }
  }
  for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) if(mp[i][j] == '#') {
    cout << "Impossible" << endl;
    return 0;
  }
  if(ch[h - 1][w - 1]) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int x, y, w, h, i, j, cat, sum, nekox, nekoy, kai;

  scanf("%d",&kai);


  for(j = 0; j < kai; j++){

    scanf("%d %d %d %d",&x,&y,&w,&h);
    sum = 0;


    scanf("%d",&cat);

    for(i = 0; i < cat; i++){
      scanf("%d %d",&nekox,&nekoy);

      if(nekox >= x && nekox <= x + w && nekoy >= y && nekoy <= y + h){
	sum++;
      }
    }

    printf("%d\n",sum);


  }

  return 0;

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define pi 2*asin(1.0)


//template functions
/////////////////////////
long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}
long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}
/////////////////////////



//Answer


int main() {

long A,B,K;
cin>>A>>B;
K=A;

while(K%B!=0){
    K+=A;
}

cout<<K<<endl;


}


Measured memory_bytes: 3612
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#define MAXN 1000001
using namespace std;
int prime[MAXN];
bool is_prime[MAXN];
int sum_prime[MAXN];
int sieve(int n){
  int p=0;
  for(int i=0;i<=n;i++) is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
    }
  }
  return p;

}
int main(void){
  int i;
  int a,d,n;
  sieve(MAXN);
  while(scanf("%d %d %d",&a,&d,&n),a|d|n){
    i=0;
    while(a>prime[i])i++;
    while(n){
      if(((prime[i]-a)%d)==0) n--;
      i++;
    }
    printf("%d\n",prime[i-1]);
  }
  return 0;
}

Measured memory_bytes: 4468
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef long double            ld;
typedef pair<int, int>         pi;
typedef vector<int>            vi;
typedef vector<pair<int, int>> vpi;

#define pb       push_back
#define all(x)   begin(x), end(x)
#define sz(x)    (int)(x).size()
#define ff       first
#define ss       second
#define mp       make_pair
#define lb       lower_bound
#define ub       upper_bound
#define tcase()  int t; cin >> t; while(t--)

const int MOD = 1e9 + 7; // 998244353;
const int MX  = 2e5 + 5;
const ll  INF = 1e18;
const ld  PI  = acos((ld) -1);

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main(){

    setIO();

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

    if(b * c >= a) cout << "Yes";
    else cout << "No";
}


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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll gcd(ll a, ll b){
    ll tmp;
    if(a%b == 0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}

const ll SIZE = 1e5+10;

ll a,b,c;

int main(){
    cin >> a >> b >> c;
    ll ans = a+b+c;
    if(ans <= 21)   cout << "win" << endl;
    else{
        cout << "bust\n";
    }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main() {
	char w2[102];
	string w;
	cin >> w;
	int len = w.length();

	if (len % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}

	for (int i = 0; i < len;i++) {
		w2[i] = w[i];
	}

	sort(w2, w2 + len);

	/*for (int i = 0; i < len;i++) {
		cout << w2[i];
	}
	cout << endl;*/

	for (int i = 0;i < len - 1;i += 2) {
		if (w2[i] != w2[i + 1]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

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

using namespace std;
const int N=2e5+5;
int a[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    string s;cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <climits>
using namespace std;

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

int N, M;

int main(){
    cin>>N>>M;
    int res = 0;
    res += N *(N-1)/2;
    res += M * (M-1)/2;
    cout<<res<<endl;
    return 0;
}




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

using namespace std;
#define all(a)a.begin(),a.end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<ll>;
using P = pair<int,int>;

int main()
{
    double r;cin >>r;
    double p=3.14159265358979;
    cout <<setprecision(20)<<2*p*r<<endl;
    return 0;
}


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

int main()
{
	string s;
	long long k;
	cin >> s;
	cin >> k;
	for (int i = 0; i < k; i++)
	{
		if (s[i] != '1')
		{
			cout << s[i] << endl;
			return 0;
		}
	}

	cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    

    class Program
    {

        static int[] data;
        

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int cnt4 = 0;
            int cnt2 = 0;
            int cnt_uneven = 0;

            for(int i = 0; i < N; i++)
            {
                if(data[i] % 2 == 0)
                {
                    if(data[i] % 4 == 0)
                    {
                        cnt4++;
                    }
                    else
                    {
                        cnt2++;
                    }
                }
                else
                {
                    cnt_uneven++;
                }
            }            

            if (cnt_uneven <= cnt4)
            {
                Console.WriteLine("Yes");
                return;
            }
            else if (cnt_uneven == cnt4 + 1)
            {
                if (cnt2 > 0)
                {
                    Console.WriteLine("No");                  
                }
                else
                {
                    Console.WriteLine("Yes");                    
                }
                return;
            }

            Console.WriteLine("No");
            return;

        }
    }
}


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

int main(){
    string s;   cin >> s;
    int sum=0;
    for(int i=0; i<s.size(); i++)
        sum += s[i]-'0';
    sum = max(sum, (s[0]-'0'-1)+9*(int)(s.size()-1));
    cout << sum << endl;
}
    


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;

int main()
{
	string s;

	cin >> s;

	if (s == "ABC") {
		cout << "ARC" << endl;
	}
	else if (s == "ARC") {
		cout << "ABC" << endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 3600
module global_variables
end module global_variables
program main
  use global_variables
  implicit none
  integer::i,j,k,n,a,b,res
  read *, n,a,b
  res = 0
  do i=1,n
    j = i
    k = 0
    do while (j > 0)
      k = k + mod(j,10)
      j = j/10
    enddo
    if (a <= k .and. k <= b) then
      res = res + i
    endif
  enddo
  print '(i0)', res
end program main


Measured memory_bytes: 256
def luca(n):
	lst = [2, 1]
	if n == 0: return 2
	elif n == 1: return 1
	else:
		for i in range(1, n):
			tmp = lst[0] + lst[1]
			lst[0] = lst[1]
			lst[1] = tmp
		return lst[1]

print luca(int(raw_input()))

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007

signed main()
{
	init();
	solve();
}

int score;
int l;

void init()
{
	string s;
	cin >> s;
	l = s.length();
	rep(i, l) score += s[i] == 'p';
}

void solve()
{
	cout << l / 2 - score << endl;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define light ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define REP(i,a,b) for(ll i = a; i < b; i++)
#define REPE(i,a,b) for(ll i = a; i <= b; i++)
#define REPR(i,a,b) for(ll i = a; i >= b; i--)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define bins(v, x) binary_search(v.begin(), v.end(), x)
const double pi = 2*acos(0.0);
const int INF = 1e9+1;
const int MOD = 1e9+7;
const int MOD1 = 998244353;

using ll = long long;
using ld = long double;
using vi = vector<int>;

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
 
ll modExp(ll base, ll exp, ll mod) {
   ll res = 1;
   while (exp > 0) {
    	if (exp % 2 == 1) {
        	res= (res * base) % mod;
		}
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

ll inverse(ll base, ll exp, ll mod) {
   return modExp(base, exp - 2, mod);
}

bool compare(const pair<int,int> &i, const pair<int,int> &j) {
   return (i.S > j.S || (i.S == j.S && i.F > j.F));
}

void test() {
	string s, t;
   cin >> s >> t;

   int n = s.size(), m = t.size();
   int ans = INT_MAX;
   for(int i = 0; i < n-m+1; i++) {
      int mrc = 0;
      for(int j = 0; j < m; j++) {
         if(t[j] != s[i+j]) {
            mrc++;
         }
      }
      ans = min(ans, mrc);
   }
   cout << ans;
}

int main() {
   //freopen("input.txt","r",stdin);
   //freopen("output.txt","w",stdout);
   light;
   cout.precision(15);
   cout << fixed;

   int t = 1;
   //cin >> t;
   for(int i = 1; i <= t; i++) {
      //cout << "Case #" << i << ": ";
      test();
   }
   return 0;
}


Measured memory_bytes: 3644
import java.util.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int m=s.nextInt(),b=s.nextInt(),n=s.nextInt();
		int[] a=new int[m];
		for(int i=0;i<n;++i)
			++a[s.nextInt()-1];
		for(int i=0;i<m;++i)
			System.out.println(b-n+a[i]>0?"Yes":"No");
	}
}


Measured memory_bytes: 56544
#include <iostream>
#include <map>
#include <functional>
#include <vector>
#include <algorithm>

using namespace std;

/*
Arguments:
    Search range: [begin, end)
    Target function: f(x)
Requirement:
    f(x) => { false, ..., false, true, ..., true }
Judge:
    true_bound == begin => All f(x) are true
    true_bound == end => All f(x) are false
*/
pair<long long, long long> bsearch(long long begin, long long end, function<bool(long long)> f)
{
    long long false_bound = begin - 1LL; // ( ..., false_bound] => false
    long long true_bound = end; // [true_bound, ... ) => true
    long long x;

    while(true_bound - false_bound > 1LL)
    {
        x = false_bound + (true_bound - false_bound) / 2LL;
        if(f(x))
        {
            true_bound = x;
        }
        else
        {
            false_bound = x;
        }
    }

    return make_pair(false_bound, true_bound);
}

int main()
{
    int n;
    vector<int> abc[3];
    long long ans = 0LL;

    cin >> n;

    for(int i = 0; i < 3; ++i)
    {
        abc[i].resize(n);
        for(int j = 0; j < n; ++j)
        {
            cin >> abc[i][j];
        }
        sort(abc[i].begin(), abc[i].end());
    }

    for(int i = 0; i < n; ++i)
    {
        int b = abc[1][i];

        auto result_a = bsearch(0, n, [&](long long j) {
            return abc[0][j] >= b;
        });

        auto result_c = bsearch(0, n, [&](long long j) {
            return abc[2][j] > b;
        });

        ans += result_a.second * (n - result_c.second);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
object Main{
  object readInput{
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val array = Array.fill(N)(sc.nextInt)
  }
  def main(args:Array[String]) {
    val arr = readInput.array
    val (ans, count) = selectionSort(arr)
    println(ans.mkString(" ") + "\n" + count)
  }
  def selectionSort(array: Array[Int]) : (Array[Int], Int)= {
    val arr = array
    var count = 0
    for (i <- 0 until arr.length){
      var minj = i
      for (j <- i until arr.length){
        if (arr(j) < arr(minj)){
          minj = j
        }
      }
      swap(arr, i, minj)
      if (i != minj) count += 1
    }
    (arr, count)
  }
  def swap(arr: Array[Int], i: Int, j: Int) = {
    val t = arr(i)
    arr(i) = arr(j)
    arr(j) = t
  }
}

Measured memory_bytes: 45344
using System;

namespace AtCoder
{
    static class Solver
    {
        static IO io = new IO();

        public static void Solve()
        {
            io.ReadSplit();
            int A = io.Int();
            int B = io.Int();

            if (A + B >= 10)
            {
                io.WriteLine("error");
            }
            else
            {
                io.WriteLine((A + B).ToString());
            }
        }
    }
}
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Solver.Solve();
        }
    }
    class IO
    {
        private string[] _Inputs;
        private int _Index;
        public void Read()
        {
            _Inputs = new string[1];
            _Inputs[0] = Console.ReadLine();
            _Index = 0;
        }
        public void ReadSplit()
        {
            _Inputs = Console.ReadLine().Split(' ');
            _Index = 0;
        }
        public string String()
        {
            return _Inputs[_Index++];
        }
        public string[] String(int xCount)
        {
            string[] rv = new string[xCount];
            Array.Copy(_Inputs, _Index, rv, 0, xCount);
            _Index += xCount;
            return rv;
        }
        public int Int()
        {
            return int.Parse(_Inputs[_Index++]);
        }
        public int[] Int(int xCount)
        {
            int[] rv = new int[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = int.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public long Long()
        {
            return long.Parse(_Inputs[_Index++]);
        }
        public long[] Long(int xCount)
        {
            long[] rv = new long[xCount];
            for (int i = 0; i < xCount; ++i)
            {
                rv[i] = long.Parse(_Inputs[_Index++]);
            }
            return rv;
        }
        public void Write(string xStr)
        {
            Console.Write(xStr);
        }
        public void WriteLine(string xStr)
        {
            Console.WriteLine(xStr);
        }
    }
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int main() {
	int n = ri(), k = ri();
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	bool dp[k + 1];
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i <= k; i++) if (!dp[i]) 
			for (int j = 0; j < n; j++) if (i + a[j] <= k) dp[i + a[j]] = true;
	std::cout << (dp[k] ? "First" : "Second") << std::endl;
	return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline


def main():
    N, W = map(int, input().split())
    weight = [0]*N
    value = [0]*N
    for i in range(N):
        weight[i], value[i] = map(int, input().split())
    
    dp = [[0]*(W+1) for _ in range(N+1)]
    for i in range(N):
        for j in range(W+1):
            if j - weight[i] >= 0:
                dp[i+1][j] = max(dp[i+1][j], dp[i][j - weight[i]] + value[i])
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

    # for i in range(N+1):
    #     print(dp[i])
    print(dp[N][W])


if __name__ == '__main__':
    main()

Measured memory_bytes: 118768
# coding: utf-8
N, M = map(int, input().split())
if abs(N - M) > 1:
    print(0)
    exit()

mod = 10**9 + 7
ans = 1
for i in range(N):
    ans *= (N - i)
    ans = ans % mod
    
for i in range(M):
    ans *= (M - i)
    ans = ans % mod
print(ans * 2 % mod if (N+M)%2 == 0 else ans % mod)

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

using ll = long long; using vi = vector<int>; using vll = vector<ll>;
using vvi = vector<vi>; using vvll = vector<vll>;
const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll INF_MAX = numeric_limits<ll>::max();

int main() {
  vi arr(3);
  for (int i = 0; i < 3; ++i) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end());
  cout << arr[0] + arr[1] << endl;
}


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

int main()
{
    int h,n,w,x=0;
    cin>>h>>w>>n;int b[h][w];int a[n];
    for(int i=0;i<n;i++)
    {
		cin>>a[i];
		for(int j=0;j<a[i];j++){
			if((x/w)%2==0) b[x/w][x%w]=i+1;
			else b[x/w][w-(x%w)-1]=i+1;
			x++;
		}
	}

    for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(j==w-1) cout<<b[i][j]<<endl;
			else cout<<b[i][j]<<" ";
		}
	}

}


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

N=int(input())
    
def dfs(u):
    for v in range(nv):
        if adj[u][v] and not visited[v]:
            visited[v] = True
            if matches[v] is None or dfs(matches[v]):
                matches[v] = u
                return True
    return False
 
#nu, nv, ne = map(int, input().split(' '))
nu=N
nv=N
adj = [[False] * nv for _ in range(nu)]
matches = [None] * nv
count = 0
 
a = []
b = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    a.append(x1)
    b.append(y1)
c = []
d = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    for j in range(N):
        if (x1-a[j])>0 and (y1-b[j])>0:
            adj[i][j] = True
 
for u in range(nu):
    visited = [False] * nv
    if dfs(u): count += 1
 
print(count)

#print([adj])

Measured memory_bytes: 3188
<?php
$N = trim(fgets(STDIN));

for ($i = 0; $i <= $N - 1; $i++) {
    $c[] = trim(fgets(STDIN));
}

$sum = 0;

for ($i = 0; $i <= $N - 1; $i++) {
    if ($c[$i] % 2 == 0) {
        $sum += $c[$i] / 2;
    } else {
        if ($i == $N - 1 || $c[$i + 1] == 0) {
            $sum += ($c[$i] - 1) / 2;
        } else {
            $c[$i + 1]--;
            $sum += ($c[$i] + 1) / 2;
        }
    }
}

echo $sum;

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

int main()
{
	int n;
	vector<int> m;

	cin >> n;

	for(int i=0;i<n;++i){
		int j;
		cin >> j;
		m.push_back(j);
	}

	for(int j=1;j<m.size();++j){
		for(int k=0;k<m.size();++k){
			cout << m[k];
			if(k != m.size()-1)
				cout << " ";
		}
		cout << endl;

		int key = m[j],
			 i = j-1;

		while(i >= 0 && m[i] > key){
			m[i+1] = m[i];
			--i;
		}

		m[i+1] = key;
	}

	for(int k=0;k<m.size();++k){
		cout << m[k];
		if(k != m.size()-1)
			cout << " ";
	}
	cout << endl;
	

	return 0;
}

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

int main(){
	int n, a, m;
	while( cin >> n , n ){
		map<int,int> p;
		m = 0;
		
		for(int i=0 ; i<n; i++ ){
			cin >> a;
			m = max( m , a );
			p[a] = 1;
		}
		bool flag = false;
		bool flag2 = false;
		for(int i=1 ; i<=m+1 ; i++ ){
			if( flag == false ){
				if( p.count( i ) ){
					cout << i ;
					flag = true;
					flag2 = true;
				}else{}
			}else{
				if( p.count( i ) ){
					if( flag2 ){
						cout << "-";
						flag2 = false;
					}
				}else{
					if( !flag2 )
						cout << (i-1);
					if( i < m )
						cout << " ";
					flag2 = false;
					flag = false;
				}
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mx 1000000

ll vis[1000100];
vector<ll>prime;
void prime_factorization(ll n)
{
    vis[0]=1, vis[1]=1;

    for(int i=2; i<=mx; i++)
    {
        if(vis[i]==0)
        {
            prime.push_back(i);
            for(int j=i*2; j<=mx; j+=i)
                vis[j]=1;
        }
    }
}

int main()
{
    ll n,i,j,k, ans=0;
    cin>>n;
    prime_factorization(n);

    for(int i=0; i<prime.size() && prime[i]*prime[i]<=n; i++)
    {
        ll cnt=0, prev=0;
        if(n%prime[i]==0)
        {
            while(n%prime[i]==0)
            {
               // cout<<cnt<<endl;
                cnt++;
                n/=prime[i];
                if(cnt>prev)
                {
                    ans++; prev=cnt; cnt=0;
                }

            }
        }
    }

    if(n>1) ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 12136
n = int(input())
a = list(map(int, input().split()))

total = 0
for i in range(n):
    if i == 0:
        before = 0
    else:
        before = a[i - 1]
    total += abs(a[i] - before)
total += abs(0 - a[n - 1])

for i in range(n):

    if i == 0:
        before = 0
    else:
        before = a[i - 1]

    if i == n - 1:
        after = 0
    else:
        after = a[i + 1]

    dist_on = abs(a[i] - before) + abs(after - a[i])
    dist_off = abs(after - before)

    print(total - dist_on + dist_off)

Measured memory_bytes: 14168
#include <bits/stdc++.h>
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; }
 
 
int main() {
  int N=0;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  
  bool flg=false;
  
  sort(a.begin(),a.end());
  
  for(int i=0;i<N;i++){
    if(a[i]==a[i+1]){
      flg=true;
    }
    if(flg) break;
  }
  
  if(flg){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
  }
  
}

Measured memory_bytes: 1024
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int n;
int d[N];


int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &d[i]);
    }
    sort(d + 1 , d + n + 1);
    printf("%d\n" , d[n / 2 + 1] - d[n / 2]);
}


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

int main(){
int K, X;
cin >> K >> X;
int left = X - (K - 1);
int right = X + (K - 1);
if (left < -1000000) {
    left = -1000000;
}
if (right > 1000000) {
    right = 1000000;
}
for (int i = left; i < right; i++) {
    cout << i << " ";
}
cout << right << endl;
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define pi 3.141592654

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vi> vvi;

int n, a[2010];
ll ans = 0;

int solve(int l, int r, int x, int y) {
    int lo = x, hi = n - 1, lid = -1, hid = -1, res = 0;
    while (lo <= hi) {
        int mid = (lo + hi) >> 1;
        if (a[mid] > l && a[mid] < r) {
            lid = mid;
            hi = mid - 1;
        }
        else if (a[mid] <= l) lo = mid + 1;
        else hi = mid - 1;
    }
    if (lid == -1) return 0;
    lo = x, hi = n - 1;
    while (lo <= hi) {
        int mid = (lo + hi) >> 1;
        if (a[mid] > l && a[mid] < r) {
            hid = mid;
            lo = mid + 1;
        }
        else if (a[mid] <= l) lo = mid + 1;
        else hi = mid - 1;
    }
    res = hid - lid + 1;
    if (x >= lid && x <= hid) res--;
    if (y >= lid && y <= hid) res--;
    //cout << lid << " " << hid << " " << res << '\n';
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    for (int i = 0; i < n - 2; i++) {
        for (int j = i + 1; j < n; j++) {
            int x = solve(abs(a[i] - a[j]), a[i] + a[j], i, j);
            ans += x;
            //cout << a[i] << " " << a[j] << " ";
            //solve(abs(a[i] - a[j]), a[i] + a[j], i, j);
        }
    }
    cout << ans / 2 << '\n';
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = [0] * n

    for i in range(n):
        ti = int(input())
        t[i] = (ti, ti + k)

    sorted_t = sorted(t, key=lambda x: x[1])
    pos = sorted_t[0][1]
    remain = c - 1
    bus_count = 1

    for i in range(1, n):
        if remain >= 1 and sorted_t[i][0] <= pos:
            remain -= 1
        else:
            bus_count += 1
            pos = sorted_t[i][1]
            remain = c - 1

    print(bus_count)


if __name__ == '__main__':
    main()


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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

int main()
{
    int k, a, b;
    cin >> k >> a >> b;

    for (size_t i = a; i <= b; i++)
    {
        if (i%k==0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }
    
    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const int mod = 1000000007;
struct mint {
ll x;
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 {
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;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
mint f(int n,int m){
    if(n==0) return 1;
    mint x=f(n/2,m);
    x*=x;
    if(n%2!=0) x*=m;
    return x;
}
int main(){
    int m,n;cin >> m >> n;
    mint ans=f(n,m);
    cout << ans.x << endl;
}


Measured memory_bytes: 3116
n,k = map(int,input().split())
a = list(map(int,input().split()))
si = [0 for i in range(n+1)]
p = [1 for i in range(n)]
import copy 
for q in range(min(k,50)):
    v = 0
    s = copy.deepcopy(si)
    for i in range(n):
        if a[i] != 0:
            s[max(i-a[i],0)] += 1
            s[min(i+a[i]+1,n)] -= 1
            a[i] = 0
        else:
            a[i] = 1
    for i in range(n):
        v += s[i]
        a[i] += v
for i in range(n):
    print(a[i], end = ' ')

Measured memory_bytes: 177424
N, M = map(int,input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        tmp = []
        for k in range(M):
            tmp.append(A[i+k][j:j+M])
        if tmp == B:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
const int MAX = 510000;
const int MOD = 1000000007;

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() {
	ll n,k;
	cin>>n>>k;
	ll ans=0;
    COMinit();
    // 計算例
    //cout << COM(100000, 50000) << endl;	
	for(ll i=0;i<=min(n,k);i++){
		ll cnt=0;
		cnt+=COM(n,i);
		cnt*=COM(n-1,i);
		ans+=cnt;
		ans%=inf;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 15516
#include<bits/stdc++.h>
#define N 100005
#define LL long long
using namespace std;
template<class T>inline void Rd(T &x){
	x=0;char c=getchar();bool f=0;
	while(c<'0'||c>'9'){if(c=='-')f^=1;c=getchar();}
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+c-'0',c=getchar();
	if(f)x=-x;
}
int n;
int X[N],Y[N];
int fa[N<<1];
int get(int x){return x==fa[x]?x:fa[x]=get(fa[x]);}
LL cnt[2][N<<1];

int main(){
	Rd(n);
	for(register int i=1;i<=(N<<1);++i)fa[i]=i;
	for(register int i=1,x,y;i<=n;++i){
		Rd(x),Rd(y);
		fa[get(x)]=get(y+N);
	}
	for(register int i=1;i<=N;++i)++cnt[0][get(i)];
	for(register int i=1+N;i<=(N<<1);++i)++cnt[1][get(i)];
	LL sum=0;
	for(register int i=1;i<=(N<<1);++i)
		sum+=cnt[0][i]*cnt[1][i];
	cout<<sum-n<<endl;
	return 0;
}

Measured memory_bytes: 3712
import bisect
n, m, v, p = map(int, input().split())
ls = list(map(int, input().split()))

ls.sort()
total=m*v
for i in range(min(v-1,p-1)):
    ls[-i-1]+=m
    total-=m

ac = [0]*n
for i in range(n-1):
    ac[i+1] = ac[i]+(ls[i+1]-ls[i])*(i+1)

ans=p
for i in range(n-p):
    idx=bisect.bisect_right(ls,ls[i]+m)
    if n-idx>=p:
        continue
    totalnow=total-m*(i+1)
    if totalnow <= 0:
        ans += 1
        continue
    ok=ac[-p]-ac[i]-(ls[-p]-ls[i])*(i+1)+(ls[i]+m-ls[-p])*(n-p-i)
    if ok< totalnow:
        continue
    ans += 1

print(ans)



Measured memory_bytes: 62576
n, m = map(int, input().split())

li_m = list()

for _ in range(m):
    li_m.append(int(input()))


if set(li_m).intersection([l + 1 for l in li_m]):
    print(0)
    exit(0)


answer = 1

def pt(length):

    if length == 0:
        return 1

    li_test = [0] * length
    for i in range(length):
        if i == 0:
            li_test[i] = 1
        elif i == 1:
            li_test[i] = li_test[i - 1] + 1
        elif i == len(li_test):
            li_test[i] = li_test[i - 1] + 1
        else:
            li_test[i] = li_test[i - 1] + li_test[i - 2]

    return li_test[-1]


idx_start = 0
idx_end = 0

if len(li_m) != 0:

    for idx, v in enumerate(li_m):
        if idx == 0:
            idx_end = v - 1
        else:
            idx_start = idx_end + 2
            idx_end = v - 1

        subkaidan = idx_end - idx_start

        answer = answer * pt(subkaidan)

        if idx == len(li_m) - 1:
            idx_start = idx_end + 2
            idx_end = n
            subkaidan = idx_end - idx_start

            answer = answer * pt(subkaidan)
else:
    answer = answer * pt(n)


print(answer % 1000000007)


Measured memory_bytes: 460020
import io
import os
from heapq import merge

input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

MOD = 10 ** 9 + 7


def solve(N, K, A):
    assert 1 <= K <= len(A)
    A.sort()
    neg = [-x for x in A if x < 0][::-1]  # abs value only
    nonneg = [x for x in A if x >= 0]

    # Get product of the K smallest by absolute value
    # If there are no achievable nonneg products, then this will be the smallest negative product
    bestNeg = 1
    for i, x in enumerate(merge(neg, nonneg)):
        bestNeg *= x
        bestNeg %= MOD
        if i >= K - 1:
            break
    bestNeg = -bestNeg % MOD

    def getBestNonNeg(K):
        ans = 1
        if K % 2 == 1:
            # Num neg must be even, so we need an odd number of nonneg. Always take the highest nonneg
            if not nonneg:
                return None
            ans = nonneg.pop() % MOD
            K -= 1
        while K >= 2 and len(nonneg) >= 2 and len(neg) >= 2:
            if nonneg[-1] * nonneg[-2] < neg[-1] * neg[-2]:  # Take larger
                ans = (ans * neg.pop() * neg.pop()) % MOD
            else:
                ans = (ans * nonneg.pop() * nonneg.pop()) % MOD
            K -= 2
        while K >= 2 and len(neg) >= 2:
            ans = (ans * neg.pop() * neg.pop()) % MOD
            K -= 2
        while K >= 2 and len(nonneg) >= 2:
            ans = (ans * nonneg.pop() * nonneg.pop()) % MOD
            K -= 2
        if K == 0:
            return ans
        return None

    # Make largest nonnegative
    ans = getBestNonNeg(K)
    if ans is not None:
        return ans
    # Answer is negative
    return bestNeg


if False:
    from itertools import combinations
    import random

    random.seed(0)
    for t in range(10000000):
        N = random.randint(1, 10)
        A = [random.randint(-N, N) for i in range(N)]
        K = random.randint(1, N)
        ans = solve(N, K, A)
        expected = float("-inf")
        for combo in combinations(A, r=K):
            prod = 1
            for x in combo:
                prod *= x
            expected = max(expected, prod)
        print(N, K, A, ans, expected)
        assert ans == (expected % MOD)

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
print(solve(N, K, A))


Measured memory_bytes: 106388
inpt = []
import math
for i in range(6):
    inpt.append(int(input()))
time = 0
minCarr = inpt[0] 
lastBoarding = 0 
for i in range(5): 
    if inpt[i+1] >= minCarr:
        time += 1
    else: 
        minCarr = inpt[i+1]
        time = i + math.ceil(inpt[0]/inpt[i+1]) 
print(time)


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;

class D
{
	static void Main()
	{
		Func<long[]> read = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
		var h = read();
		var v = new int[3].Select(_ => read().OrderBy(x => -x).ToArray()).ToArray();
		Console.WriteLine(string.Join("\n", comb(comb(v[0], v[1], (int)h[3]), v[2], (int)h[3])));
	}

	static long[] comb(long[] p, long[] q, int count)
	{
		var r = new List<long>();
		for (int i = 0; i < p.Length; i++)
			for (int j = 0; j < q.Length && (i + 1) * (j + 1) <= count; j++)
				r.Add(p[i] + q[j]);
		return r.OrderBy(x => -x).Take(count).ToArray();
	}
}


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

void fin(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
    exit(0);
}

int N, A, B, C, D;
string S;

int ng[200001];

bool reach(int a, int b){
    return (ng[b] - ng[a]) == 0;
}

int main(){
    cin >> N >> A >> B >> C >> D;
    cin >> S;
    S = "#" + S + "#";
    for(int i=1; i<=N; i++){
        ng[i] = ng[i-1];
        if(S[i] == '#' && S[i+1] == '#') ng[i]++;
    }

    if(B < D && D < C){
        bool ok = reach(A, C) && reach(B, D);
        if(!ok) fin(false);
        for(int i=B; i<=D; i++) if(S[i-1] == '.' && S[i] == '.' && S[i+1] == '.') fin(true);
        fin(false);
    }else{
        fin(reach(A, C) && reach(B, D));
    }
    return 0;
}


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

int main(){
    char ch;

    while(1){
        scanf("%c",&ch);
        if(islower(ch)){
            printf("%c",toupper(ch));
        }else if(isupper(ch)){
            printf("%c",tolower(ch));
        }else if( ch == '\n' ){
            printf("\n");
            break;
        }else{
            printf("%c",ch);
        }
    }
    return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

struct WarshallFloyd {
    int N;
    vector<vector<ll>> dis;
    void init(int n, int m) {
        N = n;
        dis.assign(n, vector<ll>(n, 1e18));
        for(int i = 0; i < n; i++) {
            dis[i][i] = 0;
        }
        for(int i = 0; i < m; i++) {
            int u, v, l;
            cin >> u >> v >> l;
            u--, v--;
            dis[u][v] = l;
            dis[v][u] = l;
        }
    }
    void init2(int n) {
        N = n;
        dis.assign(n, vector<ll>(n, 1e18));
        for(int i = 0; i < N; i++) {
            dis[i][i] = 0;
        }
    }
    void build() {
        for(int k = 0; k < N; k++) {
            for(int i = 0; i < N; i++){
                for(int j = 0; j < N; j++) {
                    chmin(dis[i][j], dis[i][k]+dis[k][j]);
                }
            }
        }
    }
};

int main(){
    int n, m; ll l;
    cin >> n >> m >> l;
    WarshallFloyd g;
    g.init(n, m);
    g.build();
    WarshallFloyd w;
    w.init2(n);
    rep(i, n) rep(j, n) {
        if(i != j && g.dis[i][j] <= l) w.dis[i][j] = 1;
    }
    w.build();
    int q;
    cin >> q;
    while(q--) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        cout << (w.dis[s][t] == 1e18? -1 : w.dis[s][t] -1) << endl;
    }
}

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

using namespace std;

const int N = 110;

int n, x;
int a[N];

int main() {
	scanf("%d %d", &n, &x);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	sort(a + 1, a + n + 1);
	int res = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] <= x) {
			x -= a[i];
			res++;
		} else {
			break;
		}
	}
	if (res == n && x > 0) {
		res--;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

a,b=input().split()
a=int(a)
b=int(b.replace('.',''))

print(a*b//100)

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

static class MF
{
   public static double Hypot(double x, double y)
   {
      double x_abs = Math.Abs(x);
      double y_abs = Math.Abs(y);
      double u = Math.Max(x_abs, y_abs);
      double v = Math.Min(x_abs, y_abs);

      return u * Math.Sqrt(1 + Math.Pow(v / u, 2));
   }
}

class MainClass
{
   static void Main(string[] args)
   {
      var stringBuilder = new StringBuilder();

      while (true)
      {
         string[] datas = Console.ReadLine().Split(' ');

         int d = int.Parse(datas[0]);
         int w = int.Parse(datas[1]);
         int h = int.Parse(datas[2]);
         if (d == 0 && w == 0 && h == 0)
         { break; }
         
         double HypotTop = MF.Hypot(d, w);
         double HypotSide = MF.Hypot(d, h);
         double HypotFront = MF.Hypot(w, h);
         
         for (int n = int.Parse(Console.ReadLine()); n > 0; n--)
         {
            int R = 2 * int.Parse(Console.ReadLine());
            bool passable = HypotTop < R || HypotSide < R || HypotFront < R;

            stringBuilder.AppendLine(passable ? "OK" : "NA");
         }
      }

      Console.Write(stringBuilder.ToString());
   }
}


Measured memory_bytes: 9016