akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
struct dice
{   int f[7],f0[7];
    void r(int a,int b,int c,int d){
        int t;
        t = f[a];
        f[a] = f[d];
        f[d] = f[c];
        f[c] = f[b];
        f[b] = t;
    }
    void roll(char cmd){
        switch (cmd){
        case 'S': r(1,2,6,5); break;
        case 'N': r(1,5,6,2); break;
        case 'W': r(1,4,6,3); break;
        case 'E': r(1,3,6,4); break;    
        case 'R': r(2,3,5,4); break;
        }
    }
    void MvTop(int n){
        switch (n){
        case 2: roll('N'); break;
        case 3: roll('E'); break;
        case 4: roll('W'); break;
        case 5: roll('S'); break;
        case 6: roll('N'); roll('N'); break;
        default: break;
        }
    }
    void copy(){
        for(int i=1;i<=6;i++)
            f0[i] = f[i];
    }
    void back(){
        for(int i=1;i<=6;i++)
            f[i] = f0[i];
    }
    bool e(dice d){
        for(int i=1;i<=6;i++)
            if(f[i]!=d.f[i]) return 0;
        return 1;
    }
    bool equal(dice d){
        copy();
        for(int i=1;i<=6;i++){
            MvTop(i);
            for(int j=1;j<=4;j++){
                roll('R');
                if(e(d)) return 1; 
            }
            back();
        }
        return 0;
    }
} d[101];
bool AllDiff(int a,int n){
    if(a==n) return 1;
    for(int i=a+1;i<=n;i++)
        if( d[a].equal(d[i]) )
            return 0;
    return AllDiff(a+1,n);
}
int main(){
    int n;
    cin>>n;
    for(int k=1;k<=n;k++)
        for(int i=1;i<=6;i++)
            cin>>d[k].f[i];
    cout<<(AllDiff(1,n) ? "Yes\n":"No\n");
    return 0;
}


Measured memory_bytes: 3100
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	long long ret=0;
	long long ks=1;
	for(int i=0;i<a;i++)for(int j=0;j<a;j++){
		printf("? %d %d %d %d\n",i,j,i,j);
		fflush(stdout);
		int t;
		scanf("%d",&t);
		if(t)ret=(ret+ks)%d;
		ks=ks*2%d;
	}
	int sz=ret%200;
	char *p = new char[sz*1000000];
	for(int i=0;i<sz*1000000;i++)p[i]='e';
	printf("! %lld\n",ret);
}

Measured memory_bytes: 176336
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long LLINF = 1LL<<60;
const int INF = 1e9;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;


int main() {
    ll n; cin >> n;
    ll ans = 0;
    if(n%2==0) {
        ll k = 5;
        while(k<=n) {
            ll s = n/k/2;
            ans += s;
            k*=5;
        }
        cout << ans << endl;
    }else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for l in range(N):
    r = l+1
    while r<N:
        j = bisect_left(L, L[l]+L[r])
        ans += j-r-1
        r += 1
print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
  int n, l, max = 0, other = 0;
  cin >> n;
  rep(i, n){
    cin >> l;
    if(l >= max){
      other += max;
      max = l;
    }else{
      other += l;
    }
  }
  if(max < other) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
w, h, n = map(int, input().split())
x1, x2, y1, y2 = [0], [w], [0], [h]
for i in range(n):
  x, y, a = map(int, input().split())
  if a == 1:
    x1.append(x)
  elif a == 2:
    x2.append(x)
  elif a == 3:
    y1.append(y)
  else:
    y2.append(y)
print(max(min(x2) - max(x1), 0) * max((min(y2) - max(y1)), 0))

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

int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    
    std::string s;
    std::vector<char> v;
    
    std::cin >> s;
    
    for(int i = 0; i < (int)s.size(); i++){
        if(s[i] == '0'){
            v.push_back('0');
        }else if(s[i] == '1'){
            v.push_back('1');
        }else if(s[i] == 'B'){
            if((int)v.size() == 0) continue;
            else{
                v.pop_back();
            }
        }
    }
    
    for(auto element : v){
        std::cout << element;
    }
    
    
    return 0;
}

Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    int c;
    cin>>a>>b;
    c=a-b;
    if(c<0){
        cout<<"a"<<" "<<"<"<<" "<<"b"<<endl;
    }
    if(c==0){
        cout<<"a"<<" "<<"=="<<" "<<"b"<<endl;
    }
    if(c>0){
        cout<<"a"<<" "<<">"<<" "<<"b"<<endl;
    }

}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long int
#include<list>
#include<algorithm>
#define ld long double
#define pb push_back
#define FF first
#define SS second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr(a,b,c) for(a=b-1;a>=c;a--)
#define PLL pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define PQ priority_queue
#define rep1 for(i=1;i<=n;i++)
#define VLL vector<ll>
#define EF else if
const double pi  =3.141592653589793238463;
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define UMP unordered_map
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define test4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define test5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define test6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
using namespace std;
/*
    //string with spaces
    std::string str;
    std::getline(std::cin >> std::ws, str);
*/
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);   
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
ll sz;
void dfs(ll node, vector<ll>&vis, vector<ll>adj[]){
    // test1(sz);
    if(vis[node]) return;
    vis[node] = 1;
    sz++;
    for(ll i : adj[node]){
        dfs(i, vis, adj);
    }
}
int main()
{
    fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r, t,u,w,x,y,z;
    string str, ss, str1;
    cin>>n>>m;
    vector<ll>adj[n+10];
    rep(i,0,m){
        ll u, v;
        cin>>u>>v;
        if(find(all(adj[u]), v)==adj[u].end()){
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
    }
    ll res = MIN;
    vector<ll>visited(n+10, 0);
    for(i=1;i<=n;i++){
        if(visited[i]==0){
            sz = 0;
            dfs(i, visited, adj);
            // test1(sz);
            res = max(res, sz);
        }
    }
    cout<<res;
}

Measured memory_bytes: 25076
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] sum = new long[n];
        sum[0] = sc.nextLong();
        for(int i = 1; i < n; i++)
            sum[i] = sum[i-1] + sc.nextInt();
        long ans = Math.abs(2 * sum[0] - sum[n-1]);
        for(int i = 1; i < n-1; i++)
            ans = Math.min(ans, Math.abs(2 * sum[i] - sum[n-1]));
        System.out.println(ans);
    }
}

Measured memory_bytes: 79516
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

int main() {
  int a, b;
  while (cin >> a >> b) {
    cout << (a + b) % 24 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
main(){
  string s ;
  cin >> s ;
  int n = s.size() ;
  int count = n/2 ;
  for(int i=0;i<count;i++){
    if(s[i] != s[n-1-i]){
      cout << "No" ;
      return 0 ;
    }
  }
  count /= 2 ;
  for(int i=0;i<count;i++){
    if(s[i] != s[n-1-i]){
      cout << "No" ;
      return 0 ;
    }
  }
  for(int i=0;i<count;i++){
    if(s[i+(n+1)/2] != s[n-1-i]){
      cout << "No" ;
      return 0 ;
    }
  }
  cout << "Yes" ;
  return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	ll n;
	cin >> n;
	long double p[n + 1];
	long double dp[n + 1][n + 1] = {};
	for (int i = 1;i <= n;i++)
		cin >> p[i];
	dp[0][0] = 1l;
	for (int i = 1;i <= n;i++) {
		dp[i][0] = (1l - p[i]) * dp[i - 1][0];
		for (int j = 1;j <= i;j++) {
			dp[i][j] = p[i] * dp[i - 1][j - 1] + (1l - p[i]) * dp[i - 1][j];
		}
	}
	long double ans = 0l;
	for (int j = n;j > n/2;j--)
		ans += dp[n][j];
	cout << setprecision(10) << ans << '\n';
}


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

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<int> a(n);
  for (size_t i = 0; i < n; i++) cin >> a[i];
  long long int ans = 1 << 30;
  for (int i = -100; i <= 100; i++) {
    long long int sum = 0;
    for (size_t j = 0; j < n; j++) {
      sum += (a[j]-i)*(a[j]-i);
    }
    ans = min(ans,sum);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
         
using namespace std;
 
#define ll  long long
#define mod 1000000007
#define pb push_back
#define pie 3.141592653589



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

    

    ll i,n,n2,m,t,j,l,r,pos,mpos,f=0,k,p,n1,z,q,x,y,x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>n;
    vector<ll>dp(3,0);
    while(n--)
    {
        ll a[3];
        for(i=0;i<3;i++)
            cin>>a[i];
        vector<ll> new_dp(3,0);
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                if(i!=j)
                {
                    new_dp[i]=max(new_dp[i],dp[j]+a[i]);
                }
            }
        }
        dp=new_dp;
    }
    x=max({dp[0],dp[1],dp[2]});
    cout<<x;




  return 0;
}

Measured memory_bytes: 256
import sys
MOD = 10 ** 9 + 7
LI = lambda: [int(x) for x in sys.stdin.readline().split()]
NI = lambda: int(sys.stdin.readline())


def main():
    N = NI()
    a = [LI() for _ in range(N)]
    dp = [[0] * (2**N) for _ in range(N)]

    q = [[] for _ in range(N)]
    b = 1
    for i in range(N):
        if a[0][i]:
            dp[0][b] = 1
            q[0].append(b)
        b <<= 1

    for i in range(1,N):
        for k in q[i-1]:
            v = dp[i-1][k]
            b = 1
            for l in a[i]:
                if l and k & b == 0:
                    m = k | b
                    if dp[i][m] == 0: q[i].append(m)
                    dp[i][m] = (dp[i][m] + v) % MOD
                b <<= 1

    print(dp[-1][2**N-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 433272
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n;
  cin >> n;
  
  vector<int> p(n);
  rep(i,n){
  cin>>p[i];
  }
  
  sort(all(p));
  
  cout << p[n/2]-p[n/2-1] << endl;
  
  
}

Measured memory_bytes: 640
#! /usr/local/bin/python3
# coding: utf-8

def calc(s):
    shape = [ch for ch in s]

    left_x = []
    pool_area = []
    for x, sh in enumerate(shape):
        if sh == "\\":
            left_x.append(x)
        elif left_x and sh == "/":
            lx = left_x.pop()
            area = x - lx
            while pool_area and (pool_area[-1])[0] > lx:
                area += (pool_area.pop())[1]
            pool_area.append((lx, area))
        # print(x, ":", sh, left_x, pool_area)

    return [p[1] for p in pool_area]

def test():
    assert calc(r"\ ".strip()) == []
    assert calc(r"/ ".strip()) == []
    assert calc(r"\/ ".strip()) == [1]
    assert calc(r"\_/ ".strip()) == [2]
    assert calc(r"\// ".strip()) == [1]
    assert calc(r"\\/ ".strip()) == [1]
    assert calc(r"\\// ".strip()) == [4]
    assert calc(r"\\//\\// ".strip()) == [4, 4]
    assert calc(r"\\/\// ".strip()) == [7]
    assert calc(r"\\/_\// ".strip()) == [8]
    assert calc(r"\//\\/ ".strip()) == [1, 1]
    assert calc(r"\//_\\/ ".strip()) == [1, 1]
    assert calc(r"\//\\// ".strip()) == [1, 4]
    assert calc(r"\///\\\// ".strip()) == [1, 4]
    assert calc(r"\///\\\//\ ".strip()) == [1, 4]
    exit()

# test()
# exit()

pool_area = calc(input())
print(sum(pool_area))
print(len(pool_area), *pool_area)


Measured memory_bytes: 6652
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,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 (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;


lint D;
lint decrease[26];
lint satis[365][26];
lint prv[26];

lint downscore(lint passed) {
	lint sum = 0;
	REP(i, 26) {
		sum += decrease[i] * (passed - prv[i]);
	}
	return -sum;
}

int main() {
	cin >> D;
	REP(i, 26) {
		cin >> decrease[i];
	}
	REP(i, D) {
		REP(j, 26) {
			cin >> satis[i][j];
		}
	}

	lint score = 0;
	REP(i, D) {
		lint maxv = -INF, max_idx = -1;
		REP(s, 26) {
			lint inst = 0;
			inst += satis[i][s];
			inst += downscore(i + 1);
			chmax(inst, 0ll);
			if (maxv < inst) {
				maxv = inst;
				max_idx = s;
			}
		}
		prv[max_idx] = i + 1;
		cout << max_idx + 1;
		if (i != D - 1) cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3708
import java.util.Scanner;

// https://atcoder.jp/contests/abc083/tasks/abc083_b
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		int sum = 0;
		for(int j=1;j<=n;j++) {
			int jj = j;
			int digitSum = 0;
			for(int i=0;i<=4;i++) {
				digitSum = digitSum + jj%10;
				jj = (jj-jj%10)/10;
				if(jj==0) break;
			}
			// 各桁の和（digitSum）がa以上b以下かの確認をし、trueだったらsumに足す。
			if((a<=digitSum)&&(digitSum<=b)) {
				sum = sum + j;
			}
		}

		System.out.println(sum);

		scanner.close();
	}
}

Measured memory_bytes: 20692
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> v = new ArrayList<Integer>();

		for(int i = 0 ; i < n ; i++){
			v.add(sc.nextInt());
		}

		Collections.sort(v);

		double ans = v.get(0);
		for(int i = 1 ; i < n ; i++){
			ans = (ans + v.get(i)) / 2;
		}

		System.out.println(ans);
	}
}

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

int main(){
    string s;
    char tmp;
    cin >> s;
    string ans = "";
    int m = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A' || s[i] == 'G' || s[i] == 'T' || s[i] == 'C'){
            ans += s[i];
        }else{
            ans = "";
        }
        if(m < ans.size()){
            m = ans.size();
        }
    }
    cout << m << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    v = [[] for i in range(n)]
    v_ = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v_[b].append(a)
    dp_ = [0]*n
    for y in range(1,n)[::-1]:
        v_[y].sort()
        d = dp_[y]
        for x in v_[y]:
            dp_[x] += (d+1)/len(v[x])
    ans = dp_[0]
    lx = []
    for a in range(n-1):
        lx.append(len(v[a])-1)
        if len(v[a]) == 1:
            lx[-1] += 1
            continue
        m = max([dp_[b] for b in v[a]])
        for b in v[a]:
            if dp_[b] == m:
                break
        for i in range(a+1):
            dp_[i] = 0
        for y in range(1,n)[::-1]:
            d = dp_[y]
            for x in v_[y]:
                if x > a:
                    break
                if (x,y) == (a,b):
                    continue
                dp_[x] += (d+1)/lx[x]
        if 0 < dp_[0] < ans:
            ans = dp_[0]
        lx[-1] += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 68956
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <chrono>
#include <numeric>

using namespace std;

int binary_search(const int x, const vector<int> v, const int s, const int e){
  if (x <= v[s])
    return(s-1);
  if (v[e] < x) {
    return(e);
  }
  int idx = (e - s)/2 + s;
  if (v[idx] < x) {
    if (e == idx+1) {
      return(idx);
    }
    return(binary_search(x, v, idx, e));
  } else {
    if (s == idx-1) {
      return(idx-1);
    }
    return(binary_search(x, v, s, idx));
  }
}

int main(){
  long long result = 0;
  int n;
  vector<int> a, b, c;
  vector<long long> acc;
  cin >> n;
  for (int i=0;i<n;i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(a.begin(), a.end());
  for (int i=0;i<n;i++) {
    int tmp;
    cin >> tmp;
    b.push_back(tmp);
  }
  sort(b.begin(), b.end());
  for (int i=0;i<n;i++) {
    int tmp;
    cin >> tmp;
    c.push_back(tmp);
  }
  sort(c.begin(), c.end());
  long long prev = 0;
  for (int i=0;i<n;i++) {
    //    int tmp1 = binary_search(b[i], a, 0, n-1) + 1;
    vector<int>::iterator tmp_iter = lower_bound(a.begin(), a.end(), b[i]);
    int tmp = tmp_iter - a.begin();
    acc.push_back((long long)tmp + prev);
    prev += (long long)tmp;
  }
  for (int i=0;i<n;i++) {
    //    int tmp1 = binary_search(c[i], b, 0, n-1);
    vector<int>::iterator tmp_iter = lower_bound(b.begin(), b.end(), c[i]);
    int tmp = tmp_iter - b.begin();
    tmp--;
    if (tmp  >= 0)
      result += acc[tmp];
  }
  cout << result << endl;
}


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

#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int x[N];
    int ans = 0;
    rep(i, N){
        cin >> x[i];
        ans += min(x[i], K-x[i]);
    }
    out(ans*2);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;

int n,h[N],ans;

int main(){
	cin>>n;
	for(int i=1,cnt=1;i<=n;++i){
		cin>>h[i];
		if(h[i]<=h[i-1])cnt++;
		else cnt=1;
		ans=max(ans,cnt-1);
	}
	cout<<ans<<endl;
} 

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

class Node
{
    public:
    ll number;
    vector<ll> nexts;
    ll Dis = 0; // 他の頂点との最短距離
    bool seen = false;
};

void ALLIN_NODES(vector<Node>& nodes,ll N, ll X, ll Y)
{
    for(ll i=0;i<N;i++)
    {
        nodes[i].number = i;
    }
    for(ll i=0;i<N;i++)
    {
        if(i==0)
        {
            nodes[i].nexts.push_back(i+1);
        }
        else if(i==N-1)
        {
            nodes[i].nexts.push_back(i-1);
        }
        else
        {
            nodes[i].nexts.push_back(i-1);
            nodes[i].nexts.push_back(i+1);
        }
    }
    nodes[X-1].nexts.push_back(Y-1);
    nodes[Y-1].nexts.push_back(X-1);
}

void ALLOUT_NODES(vector<Node> nodes)
{
    for(auto x : nodes)
    {
        cout << '(' << x.number+1 << ',' << x.Dis << "), ";
    }
    cout << endl;
}

void BFS(vector<Node> nodes, Node root, map<ll,ll>& all_diss)
{
    queue<Node> bfs;
    nodes[root.number].seen = true;
    bfs.push(nodes[root.number]);

    while(!bfs.empty())
    {
        Node front_copy = bfs.front();
        bfs.pop();
        for(auto x : front_copy.nexts)
        {
            if(!nodes[x].seen)
            {
                nodes[x].Dis = front_copy.Dis+1;
                nodes[x].seen = true;
                bfs.push(nodes[x]);
            }
        }
    }

    for(auto x : nodes)
    {
        all_diss[x.Dis]++;
    }
}

int main()
{
    ll N,X,Y;
    cin >> N >> X >> Y;

    vector<Node> nodes(N);
    ALLIN_NODES(nodes,N,X,Y);

    map<ll,ll> all_diss;
    for(auto x : nodes)
    {
        BFS(nodes,x,all_diss);
    }

    for(ll i=1;i<=N-1;i++)
    {
        OUT0(all_diss[i]/2);
    }

    return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec a(N); cin >> a;

    int now = 1;
    REP(i, N){
        if(a[i] == now) now++;
    }
    if(now == 1){
        Out(-1);
    }else{
        Out(N - now + 1);
    }

    return 0;
}


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

int main() {
    string coffee;
    cin >> coffee;
    if(
        coffee.at(2) == coffee.at(3)
        &&
        coffee.at(4) == coffee.at(5)
    )
    {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }


    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<ll,string> Pls;
const ll INF=10000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	ll x,cost;
};
Pls a[200002]={};
int main() {

	ll n;
	string s[200002];

	cin>>n;
	rep(i,n)cin>>s[i];
	sort(s,s+n);
	a[0].first=-1;
	a[0].second=s[0];
	ll t=0;
	for(int i=1; i<n; i++){
		if(s[i]==s[i-1])a[t].first--;
		else{
			t++;
			a[t].first=-1;
			a[t].second=s[i];
		}
	}
	sort(a,a+t+1);
	cout<<a[0].second<<endl;
	for(int i=1; i<t+1; i++){
		if(a[i].first==a[i-1].first)cout<<a[i].second<<endl;
		else return 0;
	}
	return 0;
}


Measured memory_bytes: 17408
#include <bits/stdc++.h>
#define INF 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
int main(){
    int p,q,r;
    cin >> p >> q >> r;
    cout << p+q+r-max({p,q,r}) << endl;
}

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

int main(){
    long long int N,X,a;
    long long int long_length,short_length;
    long long int ans;
    cin >> N >> X;
    if(N/2<X)X=N-X;
    ans=N;long_length=N-X;short_length=X;
    while(1){
        a=long_length%short_length;
        if(a==0){
            ans+=(2*long_length-short_length);
            cout << ans;
            return 0;
        } else {
            ans+=((long_length-a)*2);
            long_length=short_length;
            short_length=a;
        }
    }
}


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

int main() {
	int p[20],n,cnt=0;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> p[i];


	for (int i = 0; i < n - 2; i++) {
		if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) cnt++;
		else if (p[i + 2] < p[i + 1] && p[i + 1] < p[i]) cnt++;
	}

	cout << cnt << endl;



	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    ll n, m;
    cin >> n >> m;
    if (m < n) swap(n, m);

    ll ans;
    if (m == 1){
        ans = 1;
    }else if (n == 1){
        ans = m - 2;
    }else{
        ans = (n - 2) * (m - 2);
    }
    cout << ans << endl;

    return 0;
}


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

signed main()
{
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (x + r > W || x - r < 0){
    cout << "No" << endl;
  }
  else if (y + r > H || y - r < 0){
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
  return (0);
}

Measured memory_bytes: 3112
#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};


int main(){
    int a, b, k;
    cin >> a >> b >> k;
    rep(i, k) {
        cout << a << endl;
        a++;
        if (a>b) break;
    }
    int x = max(b-k+1, a);
    while (x<=b) {
        cout << x << endl;
        x++;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>
#include <cstdlib>
#include <cmath>

using namespace std;
int main()
{
	int n, m,sum=0,p[100],x[100];
	cin >> n;
	int a[100];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	cin >> m;
	for (int i=0; i < m; i++) {
		cin >> p[i]>>x[i];
	}
	for (int i = 0; i < m; i++) {
		cout << sum - a[p[i] - 1] + x[i] << endl;
	}
	return 0;
}

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

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

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

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

  stack<int> L, R;
  int l = 0, r = 0;
  rep(i, N) {
    if (S[i] == '(') {
      L.push(i);
    } else {
      if (L.empty())
        r++;
      else {
        L.pop();
      }
    }
  }
  l = sz(L);

  reverse(all(S));
  rep(i, r) {
    S.pb('(');
  }

  reverse(all(S));
  rep(i, l) {
    S.pb(')');
  }

  cout << S << endl;
}

Measured memory_bytes: 256
s = input()
t = input()
match_index = 51
for i in range(len(s) - len(t) + 1):
    s_tmp = s[i:i + len(t)]
    for j in range(len(t)):
        if s_tmp[j] == t[j] or s_tmp[j] == "?":
            pass
        else:
            break
    else:
        match_index = i

if match_index == 51:
    print("UNRESTORABLE")
else:
    s_replace = ""
    for i in range(match_index):
        s_replace += s[i]
    s_replace += t
    for i in range(match_index + len(t), len(s)):
        s_replace += s[i]

    # s[match_index:match_index + len(t)] = t
    res = ""
    for i in s_replace:
        if i == "?":
            res += "a"
        else:
            res += i
    print(res)


Measured memory_bytes: 9144
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
bool Prime(int num){
    if(num<2)return false;
    else if(num==2)return true;
    else if(num%2==0)return false; 
    double sqrtnum=sqrt(num);
    for (int i = 3; i <= sqrtnum; i += 2){
        if(num%i==0)return false;
    }
    return true;
}
int main(void){
    int X,i;
    cin>>X;
    while(1){
        if(Prime(X))break;
        X++;
    }
    cout<<X<<endl;
}

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

int main()
{
	int N;

	cin >> N;

	for(int x=0;x<=N;x++)
	{
		if((x*108)/100==N)
		{
			cout << x << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <limits>
#include <math.h>
#define ll long long
using namespace std;
int main(){
    double a,b;
    cin >> a >> b;
    cout << ceil((a+b)/2) << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
	static double s;
	
    public static void main(String[] args)   throws Exception, IOException{        
//        long mod=1000000007;
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        char c[]=sc.getCharSet();
        boolean u[]=new boolean[1000];
        boolean a[]=new boolean[10];
        boolean b[][]=new boolean[10][10];
        
        for (int i = 0,v; i < n; i++) {
        	v=c[i]-'0';
			for (int j = 0; j < 10; j++) {
				for (int t = 0; t < b.length; t++) {
					if(b[j][t])u[100*j+10*t+v]=true;					
				}
			}
			for (int j = 0; j < 10; j++) {
				if(a[j])b[j][v]=true;
			}
			a[v]=true;
		}
        int r=0;
        for (int i = 0; i < u.length; i++) {
			if(u[i])r++;
		}
        

        out.println(r);
     	out.flush();
    }


    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//
//class P {
//	int x, y, d;
//	P(int  x, int y, int d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}

class P implements Comparable<P>{
    int a,b;
    P(int a, int b) {
    	this.b=b;
    	this.a=a;
    }

    public int compareTo(P p){
        return -p.a+a;//as
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() throws IOException{
        return this.nextString().toCharArray();
    }    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

int main(){
  int N,K,A,C;
  cin>>N;
  for(int i=0; i<N; i++){
    cin>>K;
    C=0;
    while(!(K%2==1)){
      K/=2;
      C++;
    }
    if(i==0)
      A=C;
    if(A>C)
      A=C;
  }
  cout<<A<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
#include <random>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;
using pis = std::pair<int, std::string>;
using pci = std::pair<char, int>;

const long long INF = 1000000000000000001;
const long long _MOD_ = 1000000000000000009;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n;
	cin >> n;
	int* v = new int[n];
	rep(i, n) cin >> v[i];

	map<int, int> m1, m2;
	rep(i, n) {
		if (i & 1) m1[v[i]] += 1;
		else m2[v[i]] += 1;
	}

	int sum1_1 = n/2, i, sum1_2 = n/2;
	for (auto x : m1) {
		if (sum1_1 > n / 2 - x.second) {
			i = x.first;
			sum1_1 = n / 2 - x.second;
		}
	}
	for (auto x : m1) {
		if (x.first != i) {
			sum1_2 = min(sum1_2, n / 2 - x.second);
		}
	}

	int sum2_1 = n/2, j, sum2_2 = n/2;
	for (auto x : m2) {
		if (sum2_1 > n / 2 - x.second) {
			j = x.first;
			sum2_1 = n / 2 - x.second;
		}
	}
	for (auto x : m2) {
		if (x.first != j) {
			sum2_2 = min(sum2_2, n / 2 - x.second);
		}
	}

	if (i != j) {
		cout << sum1_1 + sum2_1 << "\n";
	}
	else {
		cout << min(sum1_1 + sum2_2, sum1_2 + sum2_1) << "\n";
	}

	return 0;
}


Measured memory_bytes: 8640
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define ld long double
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
int solve(){
        int n,i; cin>>n;
        ll a[n];
        AIN
        sort(a,a+n);
        ll ans=0;
        FIN{
          for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
              if(a[i]+a[j]>a[k]&&a[k]-a[j]<a[i]&&a[k]-a[i]<a[j]&&a[i]!=a[j]&&a[k]!=a[j]&&a[i]!=a[k]){
                ans++;
              }
            }
          }
        }
        cout<<ans<<"\n";
  return 0;
}
int main(){
fast
        int t=1;
        // cin>>t; 
        T(t){
          solve();
        }
        return 0;
}       

Measured memory_bytes: 3620
using System;
using static System.Console;
using System.Linq;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
            Array.Sort(tmp);
            WriteLine(tmp[0] + tmp[1] + tmp[2] * 10);
        }
    }
}

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

int main()
{
    int n,k;
    cin >> n >> k;
    char s[n];
    
    for(int i=0; i < n; i++){
        cin >> s[i];
    }

    s[k-1] += 32;

    for(int j=0; j < n; j++){
        cout << s[j];
    }

    return 0;
}

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

const int maxn = (1 << 15) + 5;
const int mod = 998244353;

inline int power(int x, int p) {
	int res = 1;
	while (p) {
		if (p & 1) 
			res = 1ll * res * x % mod;
		x = 1ll * x * x % mod;
		p >>= 1;
	}
	return res;
}

namespace NTT {
	const int G = 3;
	int g[maxn], R[maxn], a[maxn], b[maxn];
	int n, L, tmp;
	
	void ntt(int a[], int n, int flag) {
		rep (i, 0, n - 1)
			if (i < R[i]) swap(a[i], a[R[i]]);
				
		for (int d = 1, t = n >> 1; d < n; d <<= 1, t >>= 1)
			for (int i = 0; i < n; i += (d << 1))
				for (int j = 0; j < d; j++) {
					tmp = 1ll * g[!flag ? t*j : n - t*j] 
							  * a[i+j+d] % mod;
					a[i+j+d] = a[i+j] - tmp;
					if (a[i+j+d] < 0) a[i+j+d] += mod;
					a[i+j] = a[i+j] + tmp;
					if (a[i+j] >= mod) a[i+j] -= mod;
				}
		
		if (!flag) return;
		
		int rev = power(n, mod - 2);
		rep (i, 0, n - 1)
			a[i] = 1ll * a[i] * rev % mod;
	}
	
	void mul(int n, int N, int A[], int B[], int C[]) {
		rep (i, 0, N - 1) a[i] = A[i];
		rep (i, N, n - 1) a[i] = 0;
		rep (i, 0, N - 1) b[i] = B[i];
		rep (i, N, n - 1) b[i] = 0;
			
		ntt(a, n, 0);
		ntt(b, n, 0);
		
		rep (i, 0, n - 1)
			a[i] = 1ll * a[i] * b[i] % mod;
			
		ntt(a, n, 1);
		
		rep (i, 0, N - 1) C[i] = a[i];
		rep (i, N, n - 1) C[i] = 0;
	}
	
	void solve(int N, int x[], int p, int res[]) {
		for (n = 1; n <= 2 * N + 1; n <<= 1, L++);
		rep (i, 0, n - 1)
			R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
		g[0] = g[n] = 1;
		g[1] = power(G, (mod - 1) / n);
		rep (i, 2, n - 1)
			g[i] = 1ll * g[i-1] * g[1] % mod;
		
		res[0] = 1;
		while (p) {
			if (p & 1) mul(n, N, res, x, res);
			mul(n, N, x, x, x);	p >>= 1;
		}
	}
}

char s[maxn], t[maxn];
int A[maxn], B[maxn], fac[maxn], rev[maxn];
int n, x, y, ans;

int main() {
	scanf("%s%s", s + 1, t + 1);
	n = strlen(s + 1);
	
	fac[0] = 1;
	rep (i, 1, n + 1) 
		fac[i] = 1ll * fac[i-1] * i % mod;
	rev[n+1] = power(fac[n+1], mod - 2);
	per (i, n, 0)
		rev[i] = 1ll * rev[i+1] * (i + 1) % mod;
	
	rep (i, 1, n)
		if (s[i] == '1' && t[i] == '1') x++;
		else if (s[i] == '1' && t[i] == '0') y++;
			
	rep (i, 0, x) A[i] = rev[i+1];
	NTT::solve(x + 1, A, y, B);
	
	rep (i, 0, x) {
		ans = ans + B[i];
		if (ans >= mod) ans -= mod;
	}
	
	ans = 1ll * ans * fac[x] % mod;
	ans = 1ll * ans * fac[y] % mod;
	ans = 1ll * ans * fac[x+y] % mod;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int se = 0, fi = 0;
  if(a==5){
    fi++;
  }
  else if(a==7){
    se++;
  }
  if(b==5){
    fi++;
  }
  else if(b==7){
    se++;
  }
  if(c==5){
    fi++;
  }
  else if(c==7){
    se++;
  }
  if(fi==2 && se ==1){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return(0);
}


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(void){
    int a;
    cin >> a;

    cout << a + a*a + a*a*a << endl;
    return 0;
}


Measured memory_bytes: 3632