akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int n;
  int v[100][100]={};
  int u,k,a;
  cin >> n;
  rep(i,n){
    cin >> u >> k;
    u--;
    rep(j,k){
      cin >> a;
      a--;
      v[u][a]=1;
    }
  }
  rep(i,n){
    rep(j,n){
      if(j>0) cout << " " << v[i][j];
      else cout << v[i][j];
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
int main()
{
  unsigned long long int n,k,ans=0,p,i;
  cin>>n>>k;
  vector<long long int > v;
  for(i=0;i<n;i++)
  {
    cin>>p;
    v.push_back(p);
  }
  if(k>=n)
  {
    ans=0;
  }
  else
  {	sort(v.begin(),v.end());
    for(i=0;i<n-k;i++)
    {
      ans+=v[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}
  
    
    


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, x;
    cin >> n >> x;
    vll a(n);
    REP(i, n) cin >> a[i];
    ll res = 0;
    if(a[0] > x){
        res = a[0] - x;
        a[0] = x;
    }
    REP(i, n - 1){
        if(a[i + 1] + a[i] >= x){
            ll tmp = a[i + 1] + a[i] - x;
            res += tmp;
            a[i + 1] -= tmp;
        }
    }
    cout << res << endl;
    return 0;
}

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

const int MOD = 1000000007;
#define p(var) std::cout<<#var" = "<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for (int i = 0; i <  (n); i++)
#define repeq(i, n) for (int i = 1; i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
using ll = long long;
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a;}
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b;}

/*-----8<-----8<-----*/

int main(){
    ll b;
    vector<ll> a(5,0);//
    cin >> b;
    for (int i = 0; i <=4; i++){
        cin >> a[i];
    }
    sort(all(a));

    printf("%.0f\n",ceil((double)b/a[0])+4);
    //printf("%.0f\n",ceil(b/a[0])+5);
    //cout << (b/a[0])+5 <<endl;

    return 0;
    
}






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

const int MAX_N = 1 << 20;
const int INF = (int)1e9;
pair<int, int> V[2*MAX_N - 1];
void add(int a, int v) {
  a += MAX_N - 1; // move to leaf
  V[a].first += v;
  while(a > 0) {
    a = (a - 1) / 2;
    V[a] = max(V[2*a + 1], V[2*a + 2]);
  }
}
pair<int, int> getMax() {
  return V[0];
}

int main() {
  int N, Q; cin >> N >> Q;
  for(int i = 0; i < 2*MAX_N - 1; ++i) {
    V[i] = make_pair(0, -INF);
  }
  for(int i = 0; i < N; ++i) {
    V[i + MAX_N - 1].second = -i;
  }
  while(Q--) {
    int a, v; cin >> a >> v;
    --a;
    add(a, v);
    pair<int, int> p = getMax();
    cout << -p.second + 1 << ' ' << p.first << endl;
  }
}

Measured memory_bytes: 17548
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    l = [0]*n
    left = 0
    for i in range(n-1):
        if h[i] >= h[i+1]:
            left += 1
            l[i] = left
        else:
            left = 0
            l[i] = left
    l = set(sorted(l))
    print(max(l))

resolve()

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

struct UnionFind {
  vector<int> par, siz;
  UnionFind (int n) {
    par.resize(n), siz.resize(n);
    for (int i = 0; i < n; i++) {
      par.at(i) = i, siz.at(i) = 1;
    }
  }
  int root(int x) {
    if (par.at(x) == x) return x;
    return par.at(x) = root(par.at(x));
  }
  int size(int x) {
    return siz.at(root(x));
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unit(int x, int y) {
    x = root(x), y = root(y);
    if (x == y) return false;
    if (siz.at(x) > siz.at(y)) {
      par.at(y) = x, siz.at(x) += siz.at(y);
    } else {
      par.at(x) = y, siz.at(y) += siz.at(x);
    }
    return true;
  }
};

int main() {
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> AB(M);
  for (int i = 0, a, b; cin >> a >> b; i++) AB.at(i) = {--a, --b};
  reverse(AB.begin(), AB.end());

  UnionFind UF(N);
  vector<long> ans;
  long tmp = (long) N * (N - 1) / 2;

  for (int i = 0; i < M; i++) {
    ans.push_back(tmp);
    int A = AB.at(i).first;
    int B = AB.at(i).second;
    if (UF.same(A, B)) continue;
    tmp -= (long) UF.size(A) * UF.size(B);
    UF.unit(A, B);
  }
  reverse(ans.begin(), ans.end());
  for (auto a : ans) cout << a << "\n";
}

Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        if (a <= b) {
            p++;
        }
        System.out.println(a - 1 + p);
        sc.close();
    }
}

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

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
	int h, n;
	scanf("%d%d",&h ,&n);
	int a[n];
	int sum = 0;
	int i;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum += a[i];
	}
	if(sum >= h){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
    return 0; 
}


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

int main()
{
	string abc;
	int h,m,i;
	
	while(1){
		cin >> abc;
		//"-" ?????¨?????????
		if( abc == "-")break;
		
		cin >> m;//?????£??????????????°
		for( i=0; i<m; i++){
			cin >> h;
			//??????????????¨???????????£???
			abc = abc.erase(0,h) + abc.substr(0,h);
		}
		cout << abc << endl;
	}
	return 0;
}
	
	

Measured memory_bytes: 1232
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 100020
using namespace std;

char a[N];

int main(void)
{
    int n, k;
    int i, c;

    scanf("%d %d %s", &n, &k, a);
    for(i = c = 0; i < n - 1; i ++)
        c += a[i] != a[i + 1];

    if(k * 2 >= c)
        printf("%d\n", n - 1);
    else
        printf("%d\n", n - 1 - c + k * 2);

    return 0;
}


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

int main()
{
	long long x, y = 999;

	cin >> x;

	while (x > 100) {
		y = min(y, abs((x % 1000) - 753));
		x = x / 10;
	}
	
	cout << y << endl;
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np
motomoji = input()
nagasa=len(motomoji)
owari=nagasa-2
sabunlist=[]
for i in range(owari):
  moto=motomoji[i:i+3]
  threedigit=int(moto)
  sabun=abs(753-threedigit)
  sabunlist.append(sabun)
kotae=min(sabunlist)

print(kotae)


Measured memory_bytes: 12504
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <vector>

using namespace std;
int main() {
    string s;
    cin >> s;
    if(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" ||
       s == "hihihihihi") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		boolean[] h = new boolean[1000001];
		h[1] = true;
		int[] s = new int[1000001];
		s[1] = 1;
		
		for(int i = 2; i < 1000001; i++){
			if(i % 2 == 0 && h[i / 2])h[i] = true;
			if(i % 3 == 0 && h[i / 3])h[i] = true;
			if(i % 5 == 0 && h[i / 5])h[i] = true;
			s[i] = s[i-1] + (h[i]?1:0);
		}

		while(true){
			int m = scan.nextInt();
			if(m == 0)break;
			int n = scan.nextInt();
			System.out.println(s[n] - s[m-1]);
		}
	}
}

Measured memory_bytes: 31764
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

//Cubes Without Holes
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int X = 501*501;
		int Y = 501;
		while(true){
			int n = sc.nextInt();
			int h = sc.nextInt();
			if((n|h)==0)break;
			Set<Integer> set = new HashSet<Integer>();
			while(h--!=0){
				String s = sc.next();
				int a = sc.nextInt();
				int b = sc.nextInt();
				if("xy".equals(s))for(int z=1;z<=n;z++)set.add(a*X+b*Y+z);
				else if("yz".equals(s))for(int x=1;x<=n;x++)set.add(x*X+a*Y+b);
				else for(int y=1;y<=n;y++)set.add(a*X+y*Y+b);
			}
			System.out.println(n*n*n-set.size());
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())

void print(){cout<<endl;}
template<typename T,typename... Args>
void print(T a, Args... args) {cout<<a<<" ";print(args...);}
lli llipowerp(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
template <typename T>
inline void printvec(vector<T> inp){
    for(auto it:inp) cout<<it<<" ";
    cout << endl;
}
//---------------------------------------------------------------------------------

int main()
{
    lli n,m;
    cin>>n>>m;
    lli x;
    lli sum=0;
    fori(m){
        cin>>x;
        sum+=x;
    }
    if(sum>n) cout<<-1<<endl;
    else cout<<n-sum<<endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int n,k;
int r,s,p;
string t;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n>>k;
    cin>>r>>s>>p;
    cin>>t;

    int ans = 0;
    //int pos=0;
    //"ちょうど"K回前のじゃんけんで出した手と同じ手を出すことはできない
    vector<bool> v(n,false);
    REP(pos,n){
        if(pos<k || !(t[pos-k] == t[pos] && v[pos-k])){
            switch(t[pos]){
                case 's': ans += r; break;
                case 'p': ans += s; break;
                case 'r': ans += p; break;
            }
            v[pos] = true;
        }
    }

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

Measured memory_bytes: 512
#include <iostream>
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define mod 1000000007
ll dp[401][401];
bool vis[401][401];

ll count(ll i,ll j,ll arr[])
{
    if(i==j)
    return 0;
    
    if(vis[i][j])
    return dp[i][j];
    
    vis[i][j]=1;
    ll& x = dp[i][j]; 
    
    x=LONG_MAX;
    ll sum=0;
    for(int k=i;k<=j;k++)
      sum+=arr[k];
      
    for(int k=i+1;k<=j;k++)
    x=min(x,sum+count(i,k-1,arr)+count(k,j,arr));
    return x;
    
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++)
      cin>>arr[i];
    cout<<count(0,n-1,arr);
   
}

Measured memory_bytes: 1664
def d_decayed_bridges(N, M, Bridges):
    class UnionFind(object):
        def __init__(self, n):
            self.p = list(range(n))  # i番の頂点の親(parent)をi番で初期化
            self.rank = [0] * n  # 全頂点はランク0(何もつながってない)
            self.size = [1] * n  # どの頂点も連結成分の大きさ1

        def union(self, x, y):  # x,yを同じ連結成分に属させる
            u = self.find(x)
            v = self.find(y)
            if u == v:  # x,yは既に同じ連結成分に属していた
                return
            if self.rank[u] < self.rank[v]:
                self.p[u] = v  # ランクの大きな方につなげる
                self.size[v] += self.size[u]  # つながっている要素数だけ足す
                self.size[u] = 0  # ランクが小さかった連結成分は「解散」
            else:
                # 上と同様にやる
                self.p[v] = u
                self.size[u] += self.size[v]
                self.size[v] = 0
                if self.rank[u] == self.rank[v]:
                    # 根の分だけ1個「ずれる」
                    self.rank[u] += 1

        def find(self, x):  # 頂点xが属する連結成分の代表(根の番号)を求める
            if self.p[x] != x:  # 頂点xの代表は他の頂点だった
                self.p[x] = self.find(self.p[x])  # 経路圧縮(xを代表につなぐ)
            return self.p[x]

        def is_same(self, x, y):  # 頂点x,yは同じ連結成分に属するか？
            return self.find(x) == self.find(y)

        def get_size(self, x):  # 頂点xが属する連結成分の大きさ
            return self.size[self.find(x)]

    uf = UnionFind(N + 1)
    ans_tmp = [N * (N - 1) // 2]
    for a, b in reversed(Bridges):
        if uf.is_same(a, b):
            ans_tmp.append(ans_tmp[-1])
        else:
            ans_tmp.append(ans_tmp[-1] - (uf.get_size(a) * uf.get_size(b)))
        uf.union(a, b)
    ans_tmp.pop()
    ans = '\n'.join(map(str, ans_tmp[::-1]))
    return ans

N, M = [int(i) for i in input().split()]
Bridges = [[int(i) for i in input().split()] for j in range(M)]
print(d_decayed_bridges(N, M, Bridges))

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

using namespace std;

#define ZFor(i,n) for(int i=0;i<n;i++)
#define WFor(i,n) for(int i=1;i<=n;i++)
#define ZWFor(i,n) for(int i=0;i<=n;i++)
#define WZFor(i,n) for(int i=1;i<n;i++)
#define Max -2100000000
#define Min 2100000000
#define F first
#define S second
#define F1 first.first
#define F2 first.second
#define F3 second

typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;


int main(void){
	
	int n,m,a[1001],b[1001],cant=0,ans=0,c[1001];
	
	scanf("%d %d",&n,&m);
	
	ZFor(i,m) scanf("%d %d",&a[i],&b[i]);
	
	ZFor(i,m) c[i]=a[i]-b[i];
	
	sort(c,c+m,greater<int>());
	//ZFor(i,m) printf("%d\n",c[i]);
	ZFor(i,m-1){
		if(c[i]<0){
			ans+=(c[i]*-1)/2;
		}
	}
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 3272
#include<stdio.h>
#include<stdlib.h>
int gcd(int,int*,int);
int GCD(int,int);
int main(void) {
  int N,X,x[100000],ans,i;
  scanf("%d %d",&N,&X);
  for(i=0;i<N;i++)scanf("%d",&x[i]);
  ans=gcd(N,x,X);
  printf("%d\n",ans);
  return 0;
}
int gcd(int N,int *x,int X) {
  int i,gcd=(int)abs(x[0]-X);
  if(N!=1)for(i=1;i<N;i++)gcd=GCD(gcd,abs(x[i]-X));
  return gcd;
}
int GCD(int A,int B) {
  int gcd;
  if(A==0){
    gcd=B;
  } else {
    if(B==0){
      gcd=A;
    } else {
      if(A<B) {
        B = B%A;
      } else {
        A = A%B;
      }
      gcd=GCD(A,B);
    }
  }
  return gcd;
}


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

typedef long long ll;
int main(){
    
    int n,k;
    cin>>n>>k;
    vector<int> a(n,0);
    vector<int> s(n+1,0);
    for(int i=1; i<=n; ++i){
        cin>>a[i];
    }
    while(k--){
        
        bool br =  true;
        for(int i=1; i<=n; ++i){
            if(a[i]<n){
                br = false;
                break;
            }
        }
        if(br==true) break;

        for(int i=1; i<=n; ++i){
            s[max(1, i-a[i])]++;
            s[min(n+1, i+a[i]+1)]--;
        }
        int sum = 0;
        for(int i=1; i<=n; ++i){
            sum+=s[i]; a[i] = sum; s[i]=0;
        }
    }
    for(int i=1; i<=n; ++i){
        cout<<a[i]<<' ';
    }



    return 0;
}

Measured memory_bytes: 4780
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>

#define R register
#define maxn 60
typedef long double ll;
ll a[maxn], sum[maxn];
ll C(R int aa, R int bb)
{
	R ll ret = 1;
	for (R int i = 1, j = aa; i <= bb; ++i, --j) ret *= j;
	for (R int i = 1; i <= bb; ++i) ret /= i; return ret;
}
int main()
{
	R int n, A, B; scanf("%d%d%d", &n, &A, &B);
	for (R int i = 1; i <= n; ++i) scanf("%Lf", &a[i]);
	std::sort(a + 1, a + n + 1); std::reverse(a + 1, a + n + 1);
	R ll x = a[A];
	R int l = 0, r = 0;
	R long double ans = 0;
	for (R int i = 1; i <= A; ++i) ans += a[i];
	printf("%.10Lf\n", ans /= A);
	for (R int i = 1; i <= n; ++i)
	{
		sum[i] = sum[i - 1] + a[i];
		if (a[i] == x)
		{
			!l ? l = i : 0; r = i;
		}
	}
	R ll ans2 = 0;
//	printf("%lld %lld\n", sum[A], (ll) ans * A);
	for (R int i = A; i <= B; ++i)
		if ((long double) sum[i] / i == ans)
		{
			ans2 += C(r - l + 1, i - l + 1);
		}
	printf("%.0Lf\n", ans2);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#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
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

ll calc(ll n){
    switch(n%4){
        case 0: return n;
        case 1: return 1;
        case 2: return n+1;
        case 3: return 0;
    }
}

int main(void)
{
    ll a,b;
    cin >> a >> b;
    pr(calc(b)^calc(a-1));
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    string s;
    string t;
    cin>>s>>t;
    int ans = 0;
    rep(i,s.size()){
        if(s[i]!=t[i])ans++;
    }
    cout<<ans<<endl;
    
return 0;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int a[200010];
multiset<int> s;

int main() {
    ios_base::sync_with_stdio(0);
    int n; cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a[i];
        s.insert(a[i]);
    }
    for (int i=0;i<n;i++) {
        s.erase(s.find(a[i]));
        cout << *s.rbegin() << endl;
        s.insert(a[i]);
    }
}


Measured memory_bytes: 13812
import qualified Data.Sequence as SQ
import Data.Foldable (toList)
adder::[(Int,Int)]->SQ.Seq Int->SQ.Seq Int
adder []          s = s
adder ((i,x):xs)  s = if mod i 2 == 0 then adder xs ((SQ.<|) x s) else adder xs ((SQ.|>)s x)

solver::[Int]->[Int]
solver xs = let d = adder (zip [1..] xs) (SQ.empty) in
            let n = length xs in
            if mod n 2 == 0 then toList d else toList (SQ.reverse d)

main::IO()
main =do
  n<-getLine
  dat<-getLine
  let d=map read (words dat)
  listPrint (solver d)

listPrint::[Int]->IO()
listPrint [] = putStr "\n"
listPrint (x:xs) = do
  putStr ((show x)++" ")
  listPrint xs


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    vector<vector<bool> > adj(n, vector<bool>(n, false));
    rep(i,m){
        int a,b; cin>>a>>b; a--; b--;
        adj[a][b] = true;
        adj[b][a] = true;
    }
    vi p;
    rep(i,n-1) p.pb(i+1);
    ll ans=0;
    do{
        int now = 0;
        bool ok=true;
        rep(i,n-1){
            if (!adj[now][p[i]]){
                ok = false;
                break;
            }
            now = p[i];
        }
        if (ok) ans++;
    }while(next_permutation(all(p)));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {
        n:usize,
       mut ab:[(i64,i64);n],
    }
    let mut ans = 0i64;
    for &(a, b) in ab.iter().rev() {
        if (a + ans) % b == 0 {
            continue;
        }
        ans += b - (a + ans) % b;
    }
    println!("{}", ans);
}


Measured memory_bytes: 5572
#include<iostream>
using namespace std;
int main() {
	int a, b, c; cin >> a >> b >> c;
	if (a + b <= b + c && a + b <= a + c)cout << a + b << endl;
	else if (b + c <= a + b && b + c <= a + c)cout << b + c << endl;
	else cout << a + c << endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#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 <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, m;
	cin >> n >> m;

	vector<int> v(n);

	for (int i = 0; i < n; ++i) {
		v[i] = -1;
	}

	for (int i = 0; i < m; ++i) {
		int s, c;
		cin >> s >> c;

		if (v[s - 1] == -1) {
			v[s - 1] = c;
		}
		else {
			if (v[s - 1] != c) {
				cout << -1 << endl;
				return 0;
			}
		}
	}

	if (n == 1) {
		if (v[0] == -1) {
			cout << 0 << endl;
		}
		else {
			cout << v[0] << endl;
		}

		return 0;
	}

	if (v[0] == 0) {
		cout << -1 << endl;
		return 0;
	}


	if (v[0] == -1) {
		v[0] = 1;
	}

	int i = 1;

	while (i < n) {
		if (v[i] == -1) {
			v[i] = 0;
		}
		i++;
	}

	

	for (int i = 0; i < n; ++i) {
		cout << v[i];
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    vector<Pll> lr(n);
    // ll min_r, max_l;
    rep(i,n){
        ll l,r;
        cin >> l >> r;
        lr[i] = Pll(l,r);
    }
    auto comp = [](auto const a, auto const b){
        return a.first < b.first || (a.first == b.first && a.second > b.second);
    };
    sort(lr.begin(), lr.end(),comp);
    vector<Pll> down(n), up(n);

    down[0] = lr[0];
    rep(i,n){
        if(!i)continue;
        ll l, r;
        l = max(lr[i].first, down[i-1].first);
        r = min(lr[i].second, down[i-1].second);
        down[i] = Pll(l,r);
    }

    up[n-1] = lr[n-1];
    for(int i = n-2; 0 <= i; --i){
        ll l,r;
        l = max(lr[i].first, up[i+1].first);
        r = min(lr[i].second, up[i+1].second);
        up[i] = Pll(l,r);
    }

    auto cal = [](ll a, ll b){
        if(a <= b)return b-a+1;
        else return ll(0);
    };
    ll ans = 0;
    rep(i,n-1){
        ll temp = 0;
        temp += cal(down[i].first, down[i].second);
        temp += cal(up[i+1].first, up[i+1].second);
        ans = max(ans, temp);
    }
    // 一つだけ別
    rep(i,n){
        if(i == 0 || i == n-1)continue;
        ll temp = 0;
        ll l,r;
        l = max(down[i-1].first, up[i+1].first);
        r = min(down[i-1].second, up[i+1].second);
        temp += cal(l,r);
        temp += cal(lr[i].first, lr[i].second);
        ans = max(ans, temp);
    }

    
   
    cout << ans << endl;
}

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

int main() {
	int N; cin >> N;
	int l = 0;
	int c = 0;

	for (int i = 0 + 1; i <= N; i++) c += i;
	cout << c << endl;

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair <int, int>;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  ll A, V;
  ll B, W;
  ll T;
  cin >> A >> V >> B >> W >> T;
  ll dis = B-A;
  if(dis < 0) dis *= -1;
  ll spe = V - W;

  if(dis > spe * T) cout << "NO" << endl;
  else cout << "YES" << endl;
}


Measured memory_bytes: 3636
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


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


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



sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n, k = MAP()

lis=[]

for x in range(1, n+1):
    tmp=0
    while x < k:
        x *= 2
        tmp+=1

    lis.append(float(1/(2**tmp)))

#print(lis)
print(float(sum(lis)/n))



        





Measured memory_bytes: 7032
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for(long long i = (n-1);i>=0;i--)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  int n,k;
  cin >> n >> k;
  
  vector <int>card(n);

  REP(i,n){
    cin >> card[i];
  }
  
  sort(card.begin(),card.end());

  //card[i]を除くk-card[i]以上の部分和の最小値がk以上のとき，card[i]は不要
  //DPを用いたO(n^2)解を2分探索
  int l = -1, r = n;
  while(r-l > 1){
    int i = (r+l)/2;
    int dp[k+1] = {};
    bool flag = true;
    dp[0] = 1;
    REP(j,n){
      if(j != i){
        RREP(jj,k+1){
          if(jj-card[j] < 0) break;
          if(dp[jj-card[j]] != 0) dp[jj]++;
        }
      }
    }
    
    int check = k - min(card[i],k);
    while(flag && check < k){
      if(dp[check] > 0) flag = false;
      check++;
    }
    if(flag) l = i;
    else r = i;
  }
  
  cout << r << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

        char s[1000];
        scanf("%s",s);

        int judge = 0;


for(int i=0;;i++){
        if(s[i] == '\0'){
                break;
        }   
        for(int j=i+1;;j++){
                if(s[i] == s[j]){
                        judge = 1;
                        break;
                }   
                if(s[j] == '\0'){
                        break;
                }   
        }   
}

        if(judge==1){
                printf("no\n");
        }else{
                printf("yes\n");
        }   

return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int X, Y; cin >> X >> Y;
	if (abs(X - Y) >= 2) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Brown" << endl;
	}
	return 0;
}

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

using namespace std;

const int N = (int) 1e5 + 10;

int n;
char s[N];

int main() {
  scanf("%s", s + 1); n = strlen(s + 1);
  int l = 1, r = n, res = 0;
  while (l <= r) {
    if (s[l] == s[r]) {
      ++l;
      --r;
    } else if (s[l] == 'x') {
      l++;
      ++res;
    } else if (s[r] == 'x') {
      r--;
      ++res;
    } else {
      puts("-1");
      return 0;
    }
  }
  printf("%d", res);
  return 0;
}

Measured memory_bytes: 384
//何を何に変換するかが大事だと思う。(良問)
#include<stdio.h>
#define INF 100000000

char *color[8] = {"black","blue","lime","aqua","red","fuchsia","yellow","white"};
int X[8][3] = { {0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255} };

int main(){
	char c[3];
	int rgb[3];
	int index;
	int mini;
	
	while( scanf("%c",c) ){
		if( c[0] == '\n' || c[0] == '\r' )
			continue;			
		if( c[0] == '0' )
			break;
			
		for( int i = 0;i < 3;i++ ){
			int num = 0;
			scanf("%c%c",c,c+1);
			if( c[0] <= '9' )
				num += (c[0]-'0')*16;
			else
				num += (c[0]-'a'+10)*16;
			if( c[1] <= '9' )
				num += (c[1]-'0');
			else
				num += (c[1]-'a'+10);
			rgb[i] = num;
		}
		
		mini = INF;
		
		for( int i = 0;i < 8;i++ ){
			int num = 0;
			for( int j = 0;j < 3;j++ ){
				num += (X[i][j]-rgb[j])*(X[i][j]-rgb[j]);
			}
			if( mini > num ){
				index = i;
				mini = num;
			}
		}
		printf("%s\n",color[index]);
	}
	return 0;
}

Measured memory_bytes: 940
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("out.o", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	if (s == "RSR") {
		cout << 1;
	}
	else if (s == "SSS") {
		cout << 0;
	}
	else {
		int cnt = 0;
		for (int i = 0; i < 3; i++) {
			if (s[i] == 'R') {
				cnt++;
			}
		} cout << cnt;
	}
}

Measured memory_bytes: 3612
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
       Scanner scanner = new Scanner(System.in);
       
       int N = scanner.nextInt();
       int[] ar1 = new int[N];
       
       for (int i=0;i<N;i++){
        ar1[i] = scanner.nextInt();
       }
       
       int pairCount = 0;       
       
       for (int i=1;i<=N;i++){
           int val = ar1[i-1];
           if (ar1[val-1] == i){
               pairCount++;
           }
       }       
      System.out.print(pairCount/2);
    }
}

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


public class Main {


	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
			// 整数の入力
			long ptn = 0;
			int N = Integer.parseInt(sc.next());
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			
			char flag = c[0];
			long tmp_ptn = 0;
			for(int i=0; i<N; i++){
				if(flag!=c[i]){
					tmp_ptn = ptn;
					flag = c[i];
					ptn = ptn*2 + 1;
				}else{
					ptn = ptn + tmp_ptn + 1;
				}
				ptn = ptn%1000000007;
			}
			
		
			System.out.println(ptn%1000000007);
		
		sc.close();
	}
	

	
}


Measured memory_bytes: 26488
require 'prime'
l = [0]
cnt = 1
Prime.each do |prime|
  while cnt < prime do
    l << l.last
    cnt += 1
  end
  l << l.last+1
  cnt += 1
  break if prime > 1_000_000
end
loop do
  n = gets.to_i
  break if n == 0
  x = -n
  n.times do
    p, m = gets.split.map(&:to_i)
    a = p > m+1 ? p - m - 1: 0
    b = p + m < 1_000_000 ? p + m : 1_000_000 - 1
    x += l[b] - l[a]
  end
  p x
end

Measured memory_bytes: 22652
#include<cstdio>
#include<iostream>
#include <string>
#include<algorithm>
using namespace std;

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    
    int min=1000,min1=1000;
    
    if(a<min)
    {
        min = a;
    }
    if(b<min)
    {
        min = b;
    }
    if(c<min1)
    {
        min1 = c;
    }
    if(d<min1)
    {
        min1 = d;
    }
    
    printf("%d",min+min1);
}




Measured memory_bytes: 3228
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

vector<vector<int>> g;
void dfs(int pos, vector<bool>& use, int k){
	if(k < 0) return;
	use[pos] = false;
	for(auto to : g[pos]){
		if(not use[to]) continue;
		dfs(to, use, k - 1);
	}
}

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

	g = vector<vector<int>>(n);
	vector<pair<int, int>> e(n - 1);
	rep(i,n - 1){
		int a, b;
		cin >> a >> b;
		a--; b--;
		e[i] = make_pair(a,b);
		g[a].emplace_back(b);
		g[b].emplace_back(a);
	}

	int ans = 1e9;
	if(k % 2){
		rep(i,n - 1){
			vector<bool> use(n, 1);
			use[e[i].first] = use[e[i].second] = 0;
			dfs(e[i].first, use, k / 2);
			dfs(e[i].second, use, k / 2);
			ans = min(ans, accumulate(all(use), 0));
		}
	}else{
		rep(i,n){
			vector<bool> use(n, 1);
			dfs(i, use, k / 2);
			ans = min(ans, accumulate(all(use), 0));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,j,n) for((i)=(j) ; (i)<(n) ; (i)++)
#define pl(format,var) p(format "\n",var)
#define p(format,var) printf(format,var)
#define asizeof(array) (sizeof(array)/sizeof(array[0]))

int main(){
	int i,j,k;
	int a[10];
	int b[3];
	char line[80];
	
	rep2(i,10){
		fgets(line, sizeof(line), stdin);
		sscanf(line, "%d", &a[i]);
	}
	
	rep2(i,3){
		b[i] = 0;
		k = 0;
		rep2(j,10){
			if(b[i]<a[j]){
				b[i] = a[j];
				k = j;
			}
		}
		a[k] = 0;
	}
	rep2(i,3){
		pl("%d",b[i]);
	}
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;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--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -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 ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S, T;
    cin >> S >> T;
    ll N = S.size();
    string now = S;
    rep(i, N) {
        char x = now[N - 1];
        string tmp = string(1, x);
        rep(i, N-1) {
            tmp += now[i];
        }
        if (now == T) {
            cout << "Yes" << '\n';
            return;
        }
        now = tmp;
    }
    cout << "No" << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
class UnionFind():
  def __init__(self,n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    
    self.parents[x] = self.find(self.parents[x])
    return self.parents[x]
  
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    
    if x == y :
      return 
    
    self.parents[y] = x
    
  def root_len(self):
    count = 0
    for i in self.parents:
      if i < 0:
        count += 1
    
    return count
    
n,m = map(int,input().split())

uf = UnionFind(n)

for i in range(m):
  x,y,z = map(int,input().split())
  
  uf.union(x-1,y-1)
  
print(uf.root_len())

Measured memory_bytes: 5632
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  string S;
  bool n = false, w = false, s = false, e = false;
  cin >> S;
  REP(i, S.size()) {
    if (S[i] == 'N') n = true;
    if (S[i] == 'W') w = true;
    if (S[i] == 'S') s = true;
    if (S[i] == 'E') e = true;
  }
  if (n == true && s == false) {
    puts("No");
  } else if (n == false && s == true) {
    puts("No");
  } else if (w == true && e == false) {
    puts("No");
  } else if (w == false && e == true) {
    puts("No");
  } else {
    puts("Yes");
  }
  return 0;
}


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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pii pair<int, pi>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 101
#define MAXS 901
#define INF 1000000000
#define mod 1000000007

signed main()
{
  int s, w;
  cin >> s >> w;
  (s <= w) ? cout << "unsafe\n" : cout << "safe\n";
  return 0;
}

Measured memory_bytes: 3620
//Keep working hard.
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);

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

int fun(int n){
	int cnt = 0;
	while(n%2 == 0){
		n /= 2;
		cnt++;
	}
	return cnt;
}

int32_t main(){
	IOS;
	cout.precision(10);
    cout << fixed;
	int n;
	cin >> n ;
	forn(i,n){
		cin >> a[i];
	}
	int m = 2e9;
	forn(i,n){
		m = min(m,fun(a[i]));
	}
	cout << m;	
 	return 0;
 }

Measured memory_bytes: 256
import numpy as np
import math

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X = [A, B, C, D, E]

min_idx = np.argsort(X)[0]

res = 0
res = res + math.ceil(N / X[min_idx])
res = res + 4

print(res)

Measured memory_bytes: 12424
#include <functional>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include<complex>
#include <numeric>
#include <string>
#include<iostream>
#include <fstream>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include<cmath>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
using namespace std;
const double PI = acos(-1.0);
const double  EPS = 1e-11;
typedef long long ll;
//freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
void fast()
{
	std::ios_base::sync_with_stdio(0);
}
int main()
{
	
	int n, m, x;
	cin >> n >> m >> x;
	int p;
	int ucnt = 0;
	int dcnt = 0;
	for (int i = 0; i < m; i++)
	{
		scanf("%d", &p);
		if (p > x)
			ucnt++;
		else
			dcnt++;
	}
	cout << min(ucnt, dcnt) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;


int main(){
    int h, w, k;
    cin >> h >> w >> k;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    vector<string> c(h);
    rep(i, h) cin >> c[i];
    vector<vector<int>> dist(h, vector<int>(w, INF));
    queue<P> q;
    q.emplace(x1, y1);
    dist[x1][y1] = 0;
    while (!q.empty()) {
        P now = q.front();
        q.pop();
        int nx = now.first;
        int ny = now.second;
        int d = dist[nx][ny];
        rep(i, 4) {
            for (int j=1; j<=k; j++) {
                int ix = nx + dx[i]*j;
                int iy = ny + dy[i]*j;
                if (ix<0 || ix>=h || iy<0 || iy>=w) break;
                if (dist[ix][iy]<=d) break;
                if (c[ix][iy]=='@') break;
                if (dist[ix][iy]==d+1) continue;
                dist[ix][iy] = d+1;
                q.emplace(ix, iy);
            }
        }
        /*
        rep(i, h) {
            rep(j, w) {
                cout << dist[i][j];
            }
            cout << endl;
        }
        */
    }

    int ans = dist[x2][y2];
    if (ans==INF) ans = -1;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12152
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		java.util.Scanner sin = new java.util.Scanner(System.in);
		int a = sin.nextInt();
		int b = sin.nextInt();
		int c = sin.nextInt();
		if(0 <= a && a <= 100){
			if(0 <= b && b <= 100){
				if(0 <= c && c <= 100){
					if(a < b && b < c){
						System.out.println("Yes");
					} else {
						System.out.println("No");
					}	
				}	
			}
		}
	}
}


Measured memory_bytes: 26152
//minamoto
#include<bits/stdc++.h>
#define R register
#define ll long long
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
    R int res,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
const int N=2e5+5,P=1e9+7;
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int c[N],sum[N],g[N],n,res,tot;
int main(){
//	freopen("testdata.in","r",stdin);
	n=read();
	fp(i,1,n)c[i]=read();
	for(R int i=1;i<=n;++i)(c[i]!=c[i-1])?c[++tot]=c[i]:0;
	g[0]=1;
	fp(i,1,tot){
		g[i]=add(sum[c[i]],g[i-1]),
		sum[c[i]]=add(sum[c[i]],g[i-1]);
	}
	printf("%d\n",g[tot]);
	return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define N 300005
#define lc (p<<1)
#define rc (p<<1|1)
#define mid (T[p].l+T[p].r>>1)
using namespace std;
int w,h,n,top1,top2,ans;
struct Pot{int x,y;}p[N];
struct Node{int l,r,mx,add;}T[N<<2];
struct node{int id,val;}stk1[N],stk2[N];
inline int max(int a,int b){return a>b?a:b;}
inline void pushnow(int p,int v){T[p].mx+=v,T[p].add+=v;}
inline void build(int p,int l,int r){
	T[p].l=l,T[p].r=r,T[p].mx=T[p].add=0;
	if(l==r)return;
	build(lc,l,mid),build(rc,mid+1,r);
}
inline void update(int p,int ql,int qr,int v){
	if(T[p].l>qr||T[p].r<ql)return;
	if(ql<=T[p].l&&T[p].r<=qr)return pushnow(p,v);
	if(T[p].add)pushnow(lc,T[p].add),pushnow(rc,T[p].add),T[p].add=0;
	if(qr<=mid)update(lc,ql,qr,v);
	else if(ql>mid)update(rc,ql,qr,v);
	else update(lc,ql,mid,v),update(rc,mid+1,qr,v);
	T[p].mx=max(T[lc].mx,T[rc].mx);
}
inline void swap(int&x,int&y){x^=y,y^=x,x^=y;}
inline bool cmp(Pot a,Pot b){return a.x<b.x;}
inline void solve(){
	sort(p+1,p+n+1,cmp),build(1,1,n),top1=top2=0;
	for(int i=1;i<=n;++i){
		int las=i-1;
		if(p[i].y<=h/2){
			while(top1&&stk1[top1].val<p[i].y){
				update(1,stk1[top1].id,las,stk1[top1].val-p[i].y);
				las=stk1[top1--].id-1;
			}
			if(las!=i-1)stk1[++top1]=(node){las+1,p[i].y};
		}
		else{
			while(top2&&stk2[top2].val>p[i].y){
				update(1,stk2[top2].id,las,p[i].y-stk2[top2].val);
				las=stk2[top2--].id-1;
			}
			if(las!=i-1)stk2[++top2]=(node){las+1,p[i].y};
		}
		stk1[++top1]=(node){i,0},stk2[++top2]=(node){i,h};
		update(1,i,i,h-p[i].x),ans=max(ans,T[1].mx+p[i+1].x);
	}
}
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
int main(){
	w=read(),h=read(),n=read();
	for(int i=1;i<=n;++i)p[i].x=read(),p[i].y=read();
	p[++n]=(Pot){0,0},p[++n]=(Pot){w,h};
	solve();
	for(int i=1;i<=n;++i)swap(p[i].x,p[i].y);
	swap(w,h);
	solve();
	cout<<ans*2;
	return 0;
}

Measured memory_bytes: 24960
N = int(input())
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N + 1):
  t[i], x[i], y[i] = map(int, input().split())

ans = "Yes"
for i in range(N):
  dd = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  dt = t[i+1] - t[i]
  if dt < dd:
    ans = "No"
  elif (dd - dt) % 2 != 0:
    ans = "No"
print(ans)


Measured memory_bytes: 11636
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int a, b; cin >> a >> b;
  cout << (a * b & 1 ? "Yes" : "No") << '\n';
}

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

typedef long long lli;

int n;
lli a[10000];

int main() {
  while(cin >> n && n) {
    for(int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a+n);
    lli res = 0;
    for(int i = 0; i < n; ++i) {
      res += a[i] * (n-i-1);
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define len(x)           x.length()
#define pb                push_back
#define mp                make_pair
#define all(x)            (x).begin(),(x).end()
#define M                 1000000007
#define MM                998244353
#define ff                first
#define ss                second
#define pii               pair<int,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define GCD(x,y)          (__gcd((x), (y)))
#define LCM(x,y)          (((x)/__gcd((x), (y)))*(y))
#define mem0(x)           memset(x, 0, sizeof (x))
#define mem1(x)           memset(x, -1, sizeof (x))
#define IOS ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);

//coded by Avijit Mandal 

int main(){
   IOS;
   ll i,j,k,t1,t2,n,m;
   string s;
   cin>>s;
   if(s[2]==s[3] && s[4]==s[5])cout<<"Yes\n";
   else cout <<"No\n";



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	char s[4]={};
	cin>>s;
	if(s[0]=='S'){
		if(s[1]=='U'){
			cout<<7<<endl;
		}else{
			cout<<1<<endl;
		}
	}else if(s[0]=='M'){
		cout<<6<<endl;
	}else if(s[0]=='W'){
		cout<<4<<endl;
	}else if(s[0]=='F'){
		cout<<2<<endl;
	}else if(s[0]=='T'){
		if(s[1]=='U'){
			cout<<5<<endl;
		}else{
			cout<<3<<endl;
		}
	}
}

Measured memory_bytes: 3608