akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
using namespace std;

string s, t;
vector<int> alp[26];

signed main(){
  
  cin>>s>>t;
  
  for(int i=0;i<s.size();i++){
    int idx = s[i] - 'a';
    alp[idx].push_back( i );
  }
  
  int ans = -1;
  
  for(char c : t){
    
    int idx = c - 'a';
    
    if( alp[idx].size() == 0 ){
      cout<<-1<<endl;
      return 0;
    }
    
    int base = ans;
    
    if( base >= s.size() ) base %= (int)s.size();

    int k = upper_bound( alp[idx].begin(), alp[idx].end(), base ) - alp[idx].begin();
    
    if( k == alp[idx].size() ) ans += (int)s.size() - base + alp[idx][0];
    else ans += alp[idx][k] - base;
    
  }
  
  cout<<ans+1<<endl;
    
  return 0;
}


Measured memory_bytes: 1724
def keisan(A,i):
	if i*(i+1)//2>=X:
		if i*(i-1)//2<X:
			return i
		else:
			return -2
	else:
		return -1

X=int(input())
ans=0
max=(10**9)
min=1
while(1):
	i=(max+min)//2
	if keisan(X,i)==i:
		print(i)
		exit()
	elif keisan(X,i)==-1:
		min=i
	elif keisan(X,i)==-2:
		max=i
		

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int N, K; cin >> N >> K;
VI h(N); rep(i, 0, N) cin >> h[i];

// 全探索．ジャンプ距離が +1 or +2 で O(2^N)．
// dp[i] = i に行くための最小コスト
VI dp(N, INF);
dp[0] = 0;
// dp[1] = abs(h[1] - h[0]);

// int minNK = min(N, K);
rep(i, 1, N){
    rep(j, 1, min(i, K) + 1){
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    }
}

cout << dp[N-1] << endl;
}

// 境界，出力文字列 チェック



Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include <map>  

using namespace std;

map <int, int> D;

int main()
{

	int N, M;
	int T[200001] = {};
	map<int, int>::iterator it;

	cin >> N;
	for (int i = 0; i < N; i++) {
		int d;
		cin >> d;
		it = D.find(d);
		if (it == D.end())
		{
			D.insert(pair<int, int>(d, 1));
		}
		else
		{
			it->second++;
		}
		
	}
	cin >> M;
	for (int i = 0; i < M; i++) {
		int m;
		cin >> m;
		it = D.find(m);
		if (it == D.end())
		{
			cout << "NO" << endl;
			return 0;
		}
		else
		{
			it->second--;
			if (it->second < 0) {
				cout << "NO" << endl;
				return 0;
			}

		}
	}

	cout << "YES" << endl;

	return 0;
}




Measured memory_bytes: 9600
from collections import Counter
N = int( input())
A = list( map( int, input().split()))
CA = Counter(A)
V = []
for x in CA:
    if CA[x] >= 2:
        V.append(CA[x]-1)
V.sort(key = None, reverse = True)
now = 0
ans = 0
for v in V:
    ans += v
    if now <= 0:
        now += v
    else:
        now -= v
b = abs(now)
if b%2 == 1:
    ans += 1
else:
    pass
print( N-ans)

Measured memory_bytes: 18656
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

    vector<bool> ac(n, false);
    vector<int> wact(n, 0);

    for(int i = 0; i < m; i++){
        int p;
        string s;
        cin >>p >>s;
        p--;
        if(ac[p]){
            continue;
        }else{
            if(s == "AC"){
                ac[p] = true;
            }else{
                wact[p]++;
            }
        }
    }
    int acct = 0;
    long long wacts = 0;
    for(int i = 0; i < n; i++){
        if(ac[i]){
            acct++;
            wacts += wact[i];
        }
    }

    printf("%d %lld\n", acct, wacts);
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
typedef vector<lint> poly;
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(a>b){a=b; return true;} return false;}

const lint mod = 1e9+7;
const lint INF = mod;
const int MAX = 30010;

int n, nxt[MAX][10];
string s;

bool check(int a, int b, int c){
    int idx=0;
    if((idx=nxt[idx][a])==n+1) return false;
    if((idx=nxt[idx][b])==n+1) return false;
    return nxt[idx][c]<n+1;
}

int main(){
    cin >> n >> s;
    rep(j, 10) nxt[n][j]=n+1;
    rrep(i, n)rep(j, 10){
        if(s[i]-'0'==j) nxt[i][j]=i+1;
        else nxt[i][j]=nxt[i+1][j];
    }
    int ans=0;
    rep(i, 10)rep(j, 10)rep(k, 10){
        ans+=check(i, j, k);
    }
    printf("%d\n", ans);
    /*rep(i, n+1){
        rep(j, 10) printf("%d ", nxt[i][j]);
        printf("\n");
    }*/
}

Measured memory_bytes: 1536
N,K=map(int,input().split())
D=list(map(int,input().split()))
for i in range(N,10*N+1):
    I=list(map(int,str(i)))
    match=list(set(I)&set(D))
    if len(match)==0:
        print(i)
        break
    else:
        pass

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

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

Measured memory_bytes: 256
// ###### Sat Mar 28 14:19:29 IST 2020
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long    
#define MOD                998244353
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"  
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             (x).begin(),(x).end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5+7;
int tests(){ 
  ll i ;
  ll x,y ;
  cin >> x >> y ;
  ll a,b,c ; 
  cin >> a >> b >> c ; 
  vector <ll> p(a),q(b),r(c);
  vector <ll> t ; 
  map <ll,ll> m;
  for(auto &x :p)
    cin >> x ; 
  for(auto &x :q)
    cin >> x;
  for(auto &x :r)
    cin >> x,m[x]++ ;
  sort(all(p));
  sort(all(q)); 
  sort(all(r));
  reverse(all(p));
  reverse(all(q)); 
  
  forn(i,0,x)
    t.pb(p[i]);

  forn(i,0,y)
    t.pb(q[i]);
  sort(all(t));
  // reverse(all(t));  
  forn(i,0,x+y)
    if(!r.empty() && t[i] < r.back()){
      t[i] = r.back();
      r.pop_back() ;
    }  
    ll sum  = 0 ; 
  forn(i,0,x+y)
    sum += (ll)t[i];  
  cout << sum << '\n' ; 
  return 0 ;
} 
int32_t main(){
    I__O ;            
    int cases = 1 ; 
    // cin >> cases ;  
    while(cases--){   
    // cout << "Case #" << cases << ": ";
      tests(); 
    }
    return 0 ; 
}

// -Wall -Wextra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

Measured memory_bytes: 11000
MODULE gcdMod
! 最小公倍数GCDを求めるモジュール
! ユークリッドの互除法を使用する．
      IMPLICIT NONE
      
      interface gcd
        module procedure :: intGcd
      end interface
      
      integer(16),parameter,public :: precision = 16
      
      contains
      function intGcd( a,b ) result( gcd )
        implicit none
        integer(precision),intent(in) :: a,b
        integer(precision) :: gcd, smaller, bigger, remain
        
        bigger  = max( a,b )
        smaller = min( a,b )
        
        do while(.true.)
          remain = mod( bigger,smaller )
          if( remain==0 )then
            gcd = smaller; return
          else
            bigger  = smaller
            smaller = remain
          end if
        end do
      end function
      end MODULE gcdMod

      MODULE lcmMod
! 最小公倍数LCMを求めるモジュール
! ユークリッドの互除法によるGCDを使用する．
      
      use gcdMod
      implicit none
      
      interface lcm
        module procedure :: intLcm
      end interface
      
      contains
      function intLCM( a,b ) result( lcm )
        implicit none
        integer(precision),intent(in) :: a,b
        integer(precision) :: lcm
        
        lcm = a*b/gcd(a,b)
      end function
      end MODULE lcmMod
      


      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      PROGRAM AntiDivision
      use lcmMod
      IMPLICIT NONE
      integer(16) :: a,b,c,d
      integer(16) :: ac,ad,acd,bc,bd,bcd
      integer(16) :: ansA,ansB
      
      read*,a,b,c,d
      
      a = a-1
      
      ac = a/c
      ad = a/d
      acd = a / lcm(c,d)
      
      ansA = a - (ac+ad-acd)
      
      bc = b/c
      bd = b/d
      bcd = b / lcm(c,d)
      
      ansB = b - (bc+bd-bcd)
      
      print*,ansB - ansA
      
      
      
      END PROGRAM

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

const int maxn = 200009;
int n, K, cnt[maxn], a, tot, res;

int main() {
	scanf("%d%d", &n, &K);
	for (int i=1; i<=n; i++) {
		scanf("%d", &a);
		if (!cnt[a]) tot++;
		cnt[a]++;
	}
	sort(cnt+1, cnt+n+1);
	for (int i=1; i<=n&&tot>K; i++)
		if (cnt[i]) {
			res += cnt[i];
			tot--;
		}
	printf("%d\n", res);
	return 0;
}

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

typedef long long ll;

const ll maxn = 20;
ll power[maxn];
std::map<ll, ll> ma, mb;
const ll mod = 1e15 + 37;
ll res = 0LL;

int main(){
	ll n;
	std::cin >> n;

	power[0] = 1;
	for(ll i = 1; i <= n; i++){
		power[i] = power[i - 1] * 31LL;
		power[i] %= mod;
	}

	std::string s;
	std::cin >> s;

	for(ll i = 0; i < (1 << n); i++){
		ll ahash = 0;
		ll apow = 0;
		ll bpow = n - 1;
		for(ll j = 0, bit = 1; j < n; j++, bit *= 2){
			if(i & bit){
				ahash += (s[j] - 'a' + 1) * power[apow];
				apow++;
				ahash %= mod;
			} else {
				ahash -= (s[j] - 'a' + 1) * power[bpow];
				bpow--;
				ahash = ((ahash % mod) + mod) % mod;
			}
		}

		ma[ahash]++;
	}

	for(ll i = 0; i < (1 << n); i++){
		ll ahash = 0;
		ll apow = n - 1;
		ll bpow = 0;
		for(ll j = 2 * n - 1, bit = 1; j >= n; j--, bit *= 2){
			if(i & bit){
				ahash += (s[j] - 'a' + 1) * power[apow];
				apow--;
				ahash %= mod;
			} else {
				ahash -= (s[j] - 'a' + 1) * power[bpow];
				bpow++;
				ahash = ((ahash % mod) + mod) % mod;
			}
		}

		res += ma[mod - ahash];
	}

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


Measured memory_bytes: 33024
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535;

int main()
{
    int n;
    cin >> n;
    string s;

    set<string> st;
    int ans = 0;
    rep(i, n) {
        cin >> s;
        if (st.count(s)) continue;
        st.insert(s);
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 19260
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

ll n,a,b;
ll h[100001];

bool f(ll x)
{
    ll cnt=0;
    for(int i=0;i<n;i++)
    {
        ll val=(ceil)(((ld)h[i]-b*x)/(a-b));
        if(val>0) cnt+=val;
    }
    if(cnt<=x) return true;
    return false;
}

int main()
{
    IOS
    cin>>n>>a>>b;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    ll st=1,en=1e9,mid,ans=en;
    while(st<=en)
    {
        mid=st+(en-st)/2;
        if(f(mid))
        {
            ans=min(ans,mid);
            en=mid-1;
        }
        else st=mid+1;
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 1024
loop {
    n = gets.to_i
    break if n == 0
    a = gets.split.map &:to_i
    c = 0
    loop {
        hash = Hash.new(0)
        a.each{|x| hash[x] += 1}
        b = a.map{|x| hash[x]}
        break if a == b
        a = b
        c += 1
    }
    p c
    puts a * ' '
}

Measured memory_bytes: 8904
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <map>

#define M 2001

using namespace std;

int main()
{
	int x;
	cin >> x;
	for (int i = 1; i <= 9; i++)
	{
		if (x%i != 0)
			continue;
		int y = x / i;
		if (y >= 1 && y <= 9)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
a,b,c,d = (int(i) for i in input().split())

near = False
if abs(c-a) <= d:
    near = True
elif (abs(c-b) <= d) and (abs(b-a) <= d):
    near = True
    
    
if near == True:
    print("Yes")
else:
    print("No")

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

typedef long long ll;

int main(){
  ll N; cin >> N;
  ll ans = 0;
  if(N % 2 == 0){
    ll cnt = 10;
    while(cnt <= N){
      ans += N / cnt;
      cnt *= 5;
    }
  }  
  cout << ans << endl;
}

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

int main(){
    int N, X;
    cin >> N >> X;
    vector<int> x(N);
    rep(i, N) cin >> x[i];
    vector<int> dist;
    rep(i, N){
        dist.push_back(abs(x[i] - X));
    }
    int ans = dist[0];
    rep(i, dist.size()){
        ans = __gcd(ans, dist[i]);
    }
    cout << ans << endl;
}   

Measured memory_bytes: 4244
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#pragma GCC optimize ("-O3")
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
#define tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define ll long long int
ll max(ll a, ll b) {  return a > b ? a : b; }
ll gcd(ll a, ll b) { if (a == 0) return b; return b == 0 ? a : gcd(b, a % b);}
#define case(i) cout<<"Case #"<<i<<": ";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
#define debug2(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
void err(istream_iterator<string> it, T a, Args... args) { cerr << "[ " << *it << " = " << a << " ]"; err(++it, args...);}
#define time__(d) for (auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second; debug2("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
#define pii pair <ll , ll >
#define pb push_back
#define PRECISION 10
const ll inf = 9223372036854775800;
const int MAXN = 100001;
const int LOGN = 22;
const int MAXBIT = 62;
const long double PI = 3.141592653589793;
const int DIGITSIZE = 18;
ll mod = 1e9 + 7;
ll MOD = 998244353;
int x4[] = {1, -1, 0, 0};
int y4[] = {0, 0, 1, -1};
int x8[] = {1, 1, 1, -1, -1, -1, 0, 0};
int y8[] = {1, 0, -1, 1, 0, -1, 1, -1};
bool takeTestCases = 0;
bool printCaseNo = 0;
/*
function numToSSColumn(num){
  var s = '', t;

  while (num > 0) {
    t = (num - 1) % 26;
    s = String.fromCharCode(65 + t) + s;
    num = (num - t)/26 | 0;
  }
  return s || undefined;
}*/

void getac(int T) {
    ll n;
    cin>>n;
    string ans="";
    while(n>0){
        ll t = (n-1)%26;
        ans+=(t+'a');
        n = (n-t)/26;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<'\n';
}
int  main()
{
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
//     freopen("error.txt", "w", stderr);
// #endif
    fastio;
    int t = 1;
    if (takeTestCases) cin >> t;
    int t_t = 1;
    while (t--) {
        if (printCaseNo)
        case (t_t);
        getac(t_t);
        t_t++;
    }
    cerr << "Total time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 3852
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  std::vector<ll> a(n);
  rep(i,n){
    cin>>m;
    ll cnt = 0;
    while(m%2==0) {
      m/=2;
      cnt++;
    }
    a[i] = cnt;
  }
  ll ans = INF;
  rep(i,n) minch(ans,a[i]);
  cout<<ans<<endl;

}

int main(){
  solve();
  return 0;
}


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

int main(void)
{
    int n[3] = {0};
    for(int i = 0; i < 3 ; i++) cin >> n[i];
    sort(n,n+3);
    for(int i = 0; i < 3; i++)
    {
        if(i) cout << " ";
        cout << n[i];
    }
    cout << endl;
}


Measured memory_bytes: 3116
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>

using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
constexpr int INF = 1145141919810;

#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}

#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;


void proc();

signed main() {
	ios::sync_with_stdio(false);
	proc();
	return 0;
}

/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/

struct Edge {
	int v0, v1;
};

bool isConected(int N, int i, int j) {
	if (N % 2 == 0) {
		if (i + j == N + 1)return false;
	}
	else {
		if (i + j == N)return false;
	}
	return true;
}

void proc() {
	LOAD(int, N);
	std::vector<Edge> edges;
	edges.reserve(10000);
	for (int i = 1; i <= N; ++i) {
		for (int j = i + 1; j <= N; ++j) {
			if (isConected(N, i, j)) {
				edges.push_back({ i,j });
			}
		}
	}
	cout << edges.size() << endl;
	for (int i = 0; i < edges.size(); ++i) {
		cout << edges[i].v0 << ' ' << edges[i].v1 << endl;
	}
}


#endif


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int N=1e5+10;
typedef long long ll;
const ll inf=1e18;
int n,a[N],b[N];
ll dp[N][2];//0-fu,1-zheng
int main(){
	//freopen("a.in","r",stdin);
	scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]),b[i]=abs(a[i]);
	dp[1][0]=dp[1][1]=-inf;
	dp[1][(a[1]>0)]=a[1];
	for(int i=2;i<=n;i++)
		if(a[i]>0){
			dp[i][1]=max(dp[i-1][0],dp[i-1][1])+a[i];
			dp[i][0]=max(dp[i-1][0]+2*b[i-1]-a[i],dp[i-1][1]-2*b[i-1]-a[i]);
		}else{
			dp[i][0]=max(dp[i-1][0],dp[i-1][1])+a[i];
			dp[i][1]=max(dp[i-1][0]+2*b[i-1]-a[i],dp[i-1][1]-2*b[i-1]-a[i]);
		}
	cout<<max(dp[n][0],dp[n][1]);
}

Measured memory_bytes: 2560
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b >> c;
  if (c - a - b <= 0) {
    //このケースいる？
    //要らないね ok
    // Cout("kasu");
    Cout("No");
  } else {
    if (4 * a * b < (c - a - b) * (c - a - b))
      Cout("Yes");
    else
      Cout("No");
  }
  return 0;
}

Measured memory_bytes: 256
# include"stdio.h"
int main(){
    int n;
    scanf("%d",&n);
    int c[n][2],sum=0;
    for(int i=0;i<n;i++){
        scanf("%d %d",&c[i][0],&c[i][1]);
        sum+=(c[i][1]-c[i][0]+1);
    }
    printf("%d\n",sum);
}


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int A,B;
    cin>>A>>B;
    if ((A+B)%3 == 0 || A%3 == 0 || B%3 == 0) {
        cout<<"Possible"<<endl;
    }
    else {
        cout<<"Impossible"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>

#define _max(_a_,_b_) ((_a_)>(_b_)?(_a_):(_b_))

inline int getnum()
{
	register char c=0;
	while(!(c>='0' && c<='9'))
		c=getchar();
	register int a=0;
	while(c>='0' && c<='9')
		a=a*10+c-'0',c=getchar();
	return a;
}

int a[205050],b[205050];
#define GetLen(_arr,_l,_r) (std::lower_bound(&(_arr)[1],&(_arr)[N+1],_r)-std::lower_bound(&(_arr)[1],&(_arr)[N+1],_l))
int ta[205050],tb[205050];

int main()
{
	register int N=getnum(),mxv=0;
	for(register int i=1;i<=N;i++)
		a[i]=getnum(),mxv=_max(mxv,a[i]);
	for(register int i=1;i<=N;i++)
		b[i]=getnum(),mxv=_max(mxv,b[i]);
	register unsigned dig=1;
	while(mxv)
		dig++,mxv>>=1;
	
	int ans=0,pw2=1;
	while(dig--)
	{
		for(register int i=1;i<=N;i++)
			ta[i]=a[i]&((pw2<<1)-1),tb[i]=b[i]&((pw2<<1)-1);
		std::sort(&tb[1],&tb[N+1]);
		register bool sum=0;
		for(register int i=1;i<=N;i++)
			sum^=GetLen(tb,pw2-ta[i],(pw2<<1)-ta[i])&1,
			sum^=GetLen(tb,pw2+(pw2<<1)-ta[i],(pw2<<2)-ta[i])&1;
		ans|=pw2*sum,pw2<<=1;
	}
	printf("%d\n",ans);
	
	return 0;
}

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




int main(void) {
   int N;
   cin>>N;
   long long A,B;
   multimap<long long,long long> vC;
   for (int i = 0; i <N;i++) {
      cin>>A>>B;
      vC.insert(make_pair(B,A));
   }
   auto itr = vC.begin();
   long long now = 0;

   while (vC.size()) {
      itr = vC.begin();
      // cout<<now<<" "<<itr->first<<" "<<itr->second<<endl;
      if (itr->first >= now + itr->second) {
         now += itr->second;
         vC.erase(itr);
      } else {
         break;
      }
   }
   if (vC.size()) cout<<"No"<<endl;
   else cout<<"Yes"<<endl;

   return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n], w = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }
        int zeroMin = Integer.MAX_VALUE;
        int oneMin = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
            zeroMin = Math.min(zeroMin, w[i]);
        } else {
            oneMin = Math.min(oneMin, w[i]);
        }
    }
        if (Arrays.stream(a).allMatch(value -> value == 0)
                ||
                Arrays.stream(a).allMatch(value -> value == 1)
        ) {
            System.out.println(0);
        } else {
            System.out.println(oneMin + zeroMin);
        }
    }
}



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

class Team
{
  public:
    Team(char name, const vector<int>& scores, int index);

    bool operator<(const Team& right) const;
    char Name() const;

  private:
    char m_name;
    int m_win;
    int m_lose;
    int m_index;
};

Team::Team(char name, const vector<int>& scores, int index) :
  m_name(name), m_win(0), m_lose(0), m_index(index)
{
  for (auto score : scores)
  {
    switch(score)
    {
      case 0:
        m_win++;
        break;
      case 1:
        m_lose++;
        break;
    }
  }
}

bool Team::operator<(const Team& right) const
{
  return m_win == right.m_win ? ( m_lose == right.m_lose ? m_index > right.m_index : m_lose > right.m_lose ) : m_win < right.m_win;
}

char Team::Name() const
{
  return m_name;
}

int main(void)
{
  while (true)
  {
    int n;
    cin >> n;
    if (n == 0) break;

    vector<Team> teams;
    for (int i = 0; i < n; ++i)
    {
      char name;
      cin >> name;
      vector<int> scores;
      for (int j = 0, buf; j < n - 1; ++j)
      {
        cin >> buf;
        scores.push_back(buf);
      }
      teams.push_back(Team(name, scores, i) );
    }

    sort(teams.rbegin(), teams.rend() );
    for (auto t : teams)
    {
      cout << t.Name() << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1204
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        a: i64,
        b: i64,
        c: i64,
        d: i64
    }
    let ni = n as i64 - 1;
    let t = (a - b).abs();
    let r = (d - c) * ni;
    for i in 0..ni / 2 + 1 {
        if ni % 2 == 0 && (c + d) * i - r / 2 <= t && t <= (c + d) * i + r / 2 {
            println!("YES");
            return;
        }
        if ni % 2 == 1 && ((c + d) * (2 * i + 1) - r) / 2 <= t && t <= ((c + d) * (2 * i + 1) + r) / 2 {
            println!("YES");
            return;
        }
    }
    println!("NO");
}


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

namespace {
  ll read() {
    ll x;
    cin >> x;
    return x;
  }

  string reads() {
    string s;
    cin >> s;
    return s;
  }

  template<class T>
  void write(T x) {
    cout << x << ' ';
  }

  void newline() {
    cout << '\n';
  }
}

bool solve() {
  int N = read();
  int A = read() - 1;
  int B = read() - 1;
  int C = read() - 1;
  int D = read() - 1;
  string S = reads();
  if (C < D) {
    string x = S.substr(A, C - A + 1);
    string y = S.substr(B, D - B + 1);
    return x.find("##") == string::npos && y.find("##") == string::npos;
  } else {
    string x = S.substr(A, C - A + 1);
    if (x.find("##") != string::npos) return false;
    string y = S.substr(B - 1, D - B + 3);
    return y.find("...") != string::npos;
  }
}

int main() {
  write(solve() ? "Yes" : "No");
  newline();
}

struct init {
  init() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} init_;




Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
 
long long b[2020];
long long a[2020];
int main()
{
    long long n, x;
    scanf("%lld%lld", &n, &x);
    for(long long i = 0; i < n; ++i)
    {
        scanf("%lld", &a[i]);
        b[i] = a[i];
    }
    long long ans = -1;
    for(long long k = 0; k < n; ++k)
    {
        long long t = k * x;
        for(long long j = 0; j < n; ++j)
            b[j] = min(b[j], a[(j - k + n) % n]);
        for(long long j = 0; j < n; ++j)
            t += b[j];
        if(ans == -1)
            ans = t;
        else
            ans = min(ans, t);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
package main
import . "fmt"
func main() {
  var n int
  var lucas []int
  Scan(&n)
  lucas = make([]int,n+1)
  lucas[0] = 2
  if n > 0 {
    lucas[1] = 1
    for i:=2;i<n+1;i++ {
      lucas[i] = lucas[i-1] + lucas[i-2]
    }
  }
  Println(lucas[n])
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        long[] nx = Read.longs();
        long n = long.Parse(Console.ReadLine());
        long[,] ans = new long[nx[0], nx[1]];
        long[] s = Read.longs();
        long whoseturn=1;
        int doneyet = 0;
        for (int i = 0; i < nx[1]; i++)
        {
            if (i % 2 == 0)
            {
                for (int k = 0; k < nx[0]; k++)
                {
                   
                    {
                        ans[k,i] = whoseturn;
                        doneyet++;
                    }
                    if (doneyet == s[whoseturn-1]) { whoseturn++; doneyet = 0; }
                }
            }
            else
            {
                for (long k = nx[0]-1; k >=0; k--)
                {
                   // if (whoseturn == 1)
                    {
                        ans[ k,i] = whoseturn;
                        doneyet++;
                    }
                    if (doneyet == s[whoseturn-1]) { whoseturn++; doneyet = 0; }
                }
            }
        }
        for(int i = 0; i < nx[0]; i++)
        {
            for(int k = 0; k < nx[1]; k++)
            {
                if (k != 0) { Console.Write(" "); }
                Console.Write(ans[i,k]);
            }
            Console.WriteLine();
        }
        Console.ReadLine();
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a * b / gcd(a, b);
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 13396
import java.util.*;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int Q = sc.nextInt();

        int[][] table = new int[N+1][N+1];

        for (int i = 0; i < M; i++) {
            table[sc.nextInt()][sc.nextInt()]++;
        }

        for (int i = 1; i <= N; i++) {
            for (int j = 0; j < N; j++) {
                table[i][j+1] += table[i][j];
            }
        }

        for (int i = 0; i < Q; i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();

            int sum = 0;

            for (int j = p; j <= q; j++) {
                sum += table[j][q] - table[j][p-1];
            }

            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 156240
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main() {
      int N, x;
      cin >> N >> x;
      int a[N];
      for(int i=0; i<N; i++) {
            cin >> a[i];
      }
      
      sort(a, a+N);
      int count = 0;
      for(int i=0; i<N; i++) {
            if(a[i] <= x) {
                  if(i == N-1 && (x-a[i])!=0) break;
                  else {
                        x -= a[i];
                        count++;
                  }
            }
      }
      cout << count << endl;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(X: int, A: int):
    return  0 if X < A else 10


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    result = solve(X, A)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5232
#include<iostream>
using namespace std;
main(){
    int A, B, mi, a;
    cin >> A >> B;
    a = A;
    mi = 0;
    if(B == 1){
        cout << mi << endl;
    }
    else{
    for(int i = 0; i < 100; i++){
        mi++;
        if(a >= B){break;}
        a += A - 1;
    }
    cout << mi <<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 2e3+7;
const int maxV = 90010;
//const int INF = 1e9+9;
//const ll INF = (1ll)<<60;
const int INF = 2e9+9;
const int MOD = 1e9+7;

int n,m;
int a[maxN][maxN];

char s[maxN];
set<int> H[maxN];
set<int> T[maxN];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)
		{
			if(s[j] == '#')
				a[i][j] = 1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		H[i].insert(0);
		for(int j=1;j<=m;j++)
		{
			if(a[i][j] == 1)
				H[i].insert(j);
		}
		H[i].insert(m+1);
	}
	for(int j=1;j<=m;j++)
	{
		T[j].insert(0);
		for(int i=1;i<=n;i++)
		{
			if(a[i][j] == 1)
				T[j].insert(i);
		}
		T[j].insert(n+1);
	}
	int ans = 0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j] != 1)
			{
				auto it = H[i].lower_bound(j);
				int r = *it;
				it--;
				int l = *it;
				
				it = T[j].lower_bound(i);
				int d = *it;
				it--;
				int u = *it;
				
				int tmp = (d-u-1) + (r-l-1) -1;
				ans = max(ans,tmp);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 391552
n=int(input())
A = [[0 for i in range(2)] for j in range(n)]
for i in range(n):
  A[i][0],A[i][1]=map(int,input().split())
  

A = sorted(A, key=lambda x: x[1])
sum=0
for i in range(n):
  sum+=A[i][0]
  if sum>A[i][1]:
    print('No')
    break
  if i==n-1:
    print('Yes')

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


 int main () {
   int n,k;
   cin >> n >> k;
   int nn=0;
   while(true){
     int i = n/k;
     if(!i) break;
     n = i;
     nn++;
   }
   nn++;
   cout << nn << endl;
  
   return 0;
 }




Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

#define INF 0x7fffffff

using namespace std;


int gcd(int x,int y){
  int mi,ma;
  ma = max(x,y);
  mi = min(x,y);
  if(ma % mi == 0){
    return mi;
  }
  else{
    return gcd(mi,ma % mi);
  }
}

int cnt;

void merge(vector<int>* a,int left ,int mid,int right){
  int n1,n2;
  int ii,jj,kk;
  vector<int> l,r;

  n1 = mid -left;
  n2 = right - mid;
  
  l.resize(n1+1);
  r.resize(n2+1);

  for(ii=0;ii<=n1-1;ii++){
    l[ii] = a->at(left+ii);
  }

  for(ii=0;ii<=n2-1;ii++){
    r[ii] = a->at(mid+ii);
  }

  l[n1] = INF;
  r[n2] = INF;

  ii = 0;
  jj = 0;

  for(kk = left; kk<= right -1; kk++){
    if(l[ii] <= r[jj]){
      a->at(kk) = l[ii];
      ii++;
      cnt++;
    }
    else{
      a->at(kk) = r[jj];
      jj++;
      cnt++;
    }
  }
  
}

void mergeSort(vector<int>* a,int left,int right){

  if(left+1 < right){
    int mid = (left+right)/2;
    mergeSort(a,left,mid);
    mergeSort(a,mid,right);
    merge(a,left,mid,right);
  }
}


int main(){
  long ii,jj,kk;
  vector<int> a;
  int n;

  cin >> n;

  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }

  cnt = 0;
  mergeSort(&a,0,n);

  for(ii=0;ii<n;ii++){
    cout << a[ii];
    if(ii!= n-1){
      cout << " ";
    }
  }
  
  cout << endl;

  cout << cnt << endl;
  
  return 0;
}



Measured memory_bytes: 6816
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
main()
{
    int n,i,t=1;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2!=0)
        {
            continue;
        }
        if(a[i]%3!=0 && a[i]%5!=0)
        {
            t=0;
            break;
        }
    }
    if(t==1)
    {
        cout<<"APPROVED"<<endl;
    }
    else
    {
        cout<<"DENIED"<<endl;
    }

}


Measured memory_bytes: 256
// ALDS1_5_C: Koch Curve

use std::f32;

struct Point {
    x: f32,
    y: f32,
}

fn koch(n: usize, a: &Point, b: &Point) {
    if n == 0 {
        return;
    }
    let s = Point{
        x: (2.0 * a.x + 1.0 * b.x) / 3.0, 
        y: (2.0 * a.y + 1.0 * b.y) / 3.0,
    };
    let t = Point{
        x: (1.0 * a.x + 2.0 * b.x) / 3.0,
        y: (1.0 * a.y + 2.0 * b.y) / 3.0,
    };
    let th = f32::consts::PI * 60.0 / 180.0;
    let u = Point{
        x: (t.x - s.x) * th.cos() - (t.y - s.y) * th.sin() + s.x,
        y: (t.x - s.x) * th.sin() + (t.y - s.y) * th.cos() + s.y,
    };

    koch(n - 1, a, &s);
    println!("{:12.8} {:12.8}", s.x, s.y);
    koch(n - 1, &s, &u);
    println!("{:12.8} {:12.8}", u.x, u.y);
    koch(n - 1, &u, &t);
    println!("{:12.8} {:12.8}", t.x, t.y);
    koch(n - 1, &t, b);
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().ok().unwrap();

    let a = Point{ x:   0.0, y: 0.0 };
    let b = Point{ x: 100.0, y: 0.0 };

    println!("{:12.8} {:12.8}", a.x, a.y);
    koch(n, &a, &b);
    println!("{:12.8} {:12.8}", b.x, b.y);
}


Measured memory_bytes: 5060
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i carry acc =
        if i = n then acc else
            if a.(i) = 0 then loop (i + 1) 0 acc else
                let t = (carry + a.(i)) / 2 in
                let carry = (carry + a.(i)) mod 2 in
                loop (i + 1) carry (acc + t)
    in
    loop 0 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 5248
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B, C = map(int, readline().split())

if (A % 2 == 0) or (B % 2 == 0) or (C % 2 == 0):
    print(0)
else:
    tmp = [A, B, C]
    tmp = sorted(tmp)
    print(tmp[0] * tmp[1])


Measured memory_bytes: 12504
#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define endl "\n"
	#define ll long long int
	#define vi vector<ll>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<ll,ll>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define pi 3.1415926535897932384626433
	#define inf 1000000000000000001;
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y) 
	#define mem(a,val) memset(a,val,sizeof(a))
	#define pb push_back
	#define f first
	#define s second
	
	void solve()
	{
		ll a,b,c,d,k; cin>>a>>b>>c>>d>>k;
		a=(a*60)+b;
		c=(c*60)+d;
		a=c-a;
		if(k>=a)
			cout<<0;
		else
			cout<<a-k;
	}

	signed main()
	{

	fast;
	#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
     #endif

	ll T=1;
	// cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
	}


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

int P[1003][1003];
int visit[1000006], dp[1000006];

vector<int> X[1000006];

int dfs(int i)
{
    if(visit[i])
    {
        if(visit[i] == -1)
            return dp[i];
        
        return -1;
    }

    visit[i] = 1;
    int ans = 0;

    for(auto x : X[i])
    {
        int y = dfs(x);

        if(y == -1)
            return -1;
        
        ans = max(ans, y);
    }

    visit[i] = -1;
    return dp[i] = ans + 1;
}

int main() {
    
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int N;
    cin >> N;

    int k = 0;

    for(int i=1; i<=N; i++)
        for(int j=i+1; j<=N; j++)
        {
            if(i == j)
                continue;
            
            P[i][j] = P[j][i] = ++k;
        }

    for(int i=1; i<=N; i++)
    {
        int prev = -1;

        for(int j=1; j<=N-1; j++)
        {
            int x;
            cin >> x;

            int z = P[i][x];

            if(prev != -1)
                X[prev].push_back(z);
            
            prev = z;
        }
    }

    int ans = 0;

    for(int i=1; i<=k; i++)
    {
        if(visit[i])
            continue;
        
        int x = dfs(i);

        if(x == -1)
        {
            cout << -1 << "\n";
            return 0;
        }

        ans = max(ans, x);
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 51072
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> a;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(a/100 == a%10) anss = "Yes";
  else anss = "No";
  
  cout << anss << endl;

}

Measured memory_bytes: 384