akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {
 
 public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int n, ma, mb;
        String[] ss = s.split(" ");
        n = Integer.parseInt(ss[0]);
        ma = Integer.parseInt(ss[1]);
        mb = Integer.parseInt(ss[2]);
        
        int dp[][] = new int[500][500];
     
        for(int i = 0;i<500;i++){
            for(int j = 0;j<500;j++){
                dp[i][j] = Integer.MAX_VALUE;
            }
        }
        int suma = 0;
        int sumb = 0;
        dp[0][0] = 0;
        for(int i = 0;i<n;i++){
            s = br.readLine();
            ss = s.split(" ");
            int a = Integer.parseInt(ss[0]);
            int b = Integer.parseInt(ss[1]);
            int c = Integer.parseInt(ss[2]);
            suma += a;
            sumb += b;
            for(int j = 499;j>=0;j--){
                for(int k = 499;k>=0;k--){
                    if(dp[j][k] == Integer.MAX_VALUE) continue;
                    int x = j+a;
                    int y = k+b;
                    if(x<500 && y<500) dp[x][y] = Math.min(dp[j][k] + c, dp[x][y]);
                }
            }
        }
        int p = ma + mb;
        int min = Integer.MAX_VALUE;
        for(int i = ma;i<=suma;i+=ma){
            int x = i;
            int y = (int)((i*mb)/ma);
            if(y<=sumb){
                min = Math.min(dp[x][y], min);
            }
        }
     if(min == Integer.MAX_VALUE) min = -1;
        System.out.println(min);
   }
}


Measured memory_bytes: 24020
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''
40
ferelibenterhominesidquodvoluntcredunt
'''

def solve(l,k):
	n = len(l)
	if(n <= k):
		return l
	else:
		return l[:k] + '...'

N = int(stdin.readline())
l = input()
ans = solve(l,N)
print(ans)



Measured memory_bytes: 76484
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, 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_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

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

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      k: usize,
      q: usize,
      aa: [usize; n],
    }
    let mut a2 = aa.clone();
    a2.sort();
    let mut ans = a2[a2.len()-1] - a2[0];

    for l in 0..n {
        if l+q-1 >= n {
            break;
        }
        let lower = a2[l];
        let mut blocks = vec![];
        let mut current = vec![];
        for &a in aa.iter() {
            if a >= lower {
                current.push(a);
            } else {
                if current.len() > 0 {
                    blocks.push(current);
                    current = vec![];
                }
            }
        }
        if current.len() > 0 {
            blocks.push(current);
        }

        let mut possbiles = vec![];
        for block in blocks.iter_mut() {
            block.sort();
            if block.len() >= k {
                for i in 0..(block.len()-k+1) {
                    possbiles.push(block[i]);
                }
            }
        }
        possbiles.sort();
        if possbiles.len() >= q {
            let value = possbiles[q-1] - possbiles[0];
            ans = min(value, ans);
        }
    }
    println!("{}", ans);
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef array<int, 2> duo;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int n, k; cin >> n >> k;
        int ans = 0;
        while (n--) {
                int x; cin >> x;
                ans += x >= k;
        }

        cout << ans;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3568
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int64 n, m;
  scanf("%lld%lld", &n, &m);
  int64 ret = 0;
  for (int64 k = m; k <= n + 1; ++k) {
    int64 L = k * (k - 1) / 2;
    int64 R = (2 * n - k + 1) * k / 2;
    ret += R - L + 1;
    ret %= MOD;
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 3792
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#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, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define MOD 998244353
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
#define ar array
#define ld long double
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
char c[4]={'D' , 'R' , 'U' , 'L'};
const ll maxN=2e5+5;

void solve(){
	ll n;
	cin>>n;
	if(n>=30)cout<<"Yes"<<endl;
	else if(n<30) cout<<"No"<<endl;
}

int main(){
	//mahakal();
	fast;
	ll t =1 ;
	//cin>> t ; 
	while(t--)solve();
	//cerr << "\ntime taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
	return 0;
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

ll tableF[200010];
ll tableI[200010];


ll char_to_int(char a){
    for(ll i = 0;i < 10;i++){
        if(a == '0' + i){
            return i;
        }
    }
    return -1;
}

ll dfs(ll n,vector<ll>& mod){
  if(n == 1){
    mod[n] = 1;
    return 1;
  }
  mod[n] = dfs(n-1,mod) * (ll)10;
  mod[n] %= 13;
  return mod[n];
}

int main(){
    string S;cin >> S;
    ll N = S.size();
    reverse(S.begin(),S.end());
    vector<ll> mod(100010);
    ll I = dfs(100010,mod);
    vector<vector<ll>> dp(N+1,vector<ll>(13));
    dp[0][0] = 1;
    for(int i = 0;i < N;i++){
      if(S[i] != '?'){
        ll n = char_to_int(S[i]);
        for(int j = 0;j < 13;j++){
          dp[i+1][(n * mod[i+1] + j) % 13] += dp[i][j];
          dp[i+1][(n * mod[i+1] + j) % 13] %= MOD;
        }
      }else{
        for(int j = 0;j < 10;j++){
          for(int k = 0;k < 13;k++){
            dp[i+1][(j * mod[i+1] + k) % 13] += dp[i][k];
            dp[i+1][(j * mod[i+1] + k) % 13] %= MOD;
          }
        }
      }
    }
    cout << dp[N][5] << endl;
}


Measured memory_bytes: 17536
#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;

#define INF 1111111111
#define F first
#define S second

struct edge {
  int to, cost;
  edge(int _to, int _cost) {to = _to; cost=_cost;}
};
typedef pair<int, pair<int, int> > P;

vector<edge> G[512];
int d[16][512];
int c, n, m, s, g;

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d[0], d[0] + 16 * 512, INF);
  d[c][s] = 0;
  que.push(P(0, pair<int, int>(s, c)));
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.S.F; int w = p.S.S;
    if(d[w][v] < p.F) continue;
    for(int i = 0;i < G[v].size(); i++){
      edge e = G[v][i];
      if(d[w][e.to] > d[w][v] + e.cost){
        d[w][e.to] = d[w][v] + e.cost;
        que.push(P(d[w][e.to], pair<int, int>(e.to, w)));
      }
      if(w > 0 && d[w - 1][e.to] > d[w][v] + e.cost / 2){
	d[w - 1][e.to] = d[w][v] + e.cost / 2;
	que.push(P(d[w - 1][e.to], pair<int, int>(e.to, w - 1)));
      }
    }
  }
}

int main(void){
  int a, b, f;
  for( ; ; ){
    for(int i = 0;i < 512; i++) G[i].clear();
    scanf("%d %d %d %d %d", &c, &n, &m, &s, &g);
    if(!(c + n + m + s + g)) break;
    for(int i = 0;i < m; i++){
      scanf("%d %d %d", &a, &b, &f);
      G[a].push_back(edge(b,f));
      G[b].push_back(edge(a,f));
    }
    
    dijkstra(s);
    int ans = INF;
    for(int i = 0;i <= c; i++) ans = min(ans, d[i][g]);
    printf("%d\n", ans);
  }
}


Measured memory_bytes: 1116
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cerrno>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    string S;
    cin >> S;

    long long mod = 1e9 + 7;

    vector<vector<ll> > dp(100002,vector<ll>(13,0));

    dp[0][0] = 1;

    long long tmp;
    
    for(int i=0;i<S.size();i++){

        tmp = 0;
        if(S[i] == '?'){
            tmp = -1;
        }
        else{
            tmp = S[i] - '0';
        }

        for(int j = 0;j<10;j++){

            if(tmp != -1 && tmp != j) continue;

            for(int l = 0;l < 13;l++){
                dp[i+1][(l*10+j)%13] += dp[i][l];
            }

            for(int l = 0;l < 13;l++){
                dp[i+1][l] = (dp[i+1][l]+mod) % mod;
            }
        }
    }

    cout << dp[S.size()][5] << endl;

    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

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

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

  int c, t;
  vector<int> path;

  rep(i, 0, N) {
    cin >> c >> t;
    if (t <= T) {
      path.pb(c);
    }
  }

  if (path.empty()) {
    cout << "TLE" << endl;
  } else {
    sort(All(path));
    cout << path[0] << endl;
  }
};


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC optimize(2)
#define sc(x) scanf("%d",&x)
#define pr(p) printf("%lld\n",p)
#define van(i,a,b) for(register int i=a;i<=b;++i)
#define bil(i,a,b) for(register int i=b;i>=a;--i)
#define re return 0 
#define rnt register int
#define ll long long
#define mm(x,n) memset(x,n,sizeof(x))
#define st(a,x,y) sort(a+x,a+y) 
#define ge getchar()
#define Re read()
using namespace std;
inline int read() 
{
	int x=0,ch;
	while(!isdigit(ch=ge));
	while(isdigit(ch))
		x=x*10+(ch^48),ch=ge;
	return x;
}

int n;
int a[100100][5];
int v[2];
struct BIT
{
	int T[100100];
	inline void Add(int p) { while(p <= n) ++T[p], p += p & -p; }
	inline int Query(int p) { int x = 0; while(p) x += T[p], p ^= p & -p; return x; }
}t[2];
int main() 
{ n = Re;
	van(j,1,3)
		van(i,1,n)
			a[i][j] = Re;
	van(i,1,n) 
	{
		int x = a[i][1];
		v[i & 1] ^= (a[i][1] % 3) ^ 1;
		if((i & 1) != (x & 1)) { puts("No"); return 0; }
		if(x % 3 == 1 && a[i][2] == x + 1 && a[i][3] == x + 2) continue;
		else if(x % 3 == 0 && a[i][2] == x - 1 && a[i][3] == x - 2) continue;
		else { puts("No"); return 0; }
	}
	van(i,1,n)
	{
		int p = (a[i][1] - 1) / 3 + 1; t[i & 1].Add(n - p + 1);
		if(i - 2 * t[i & 1].Query(n - p) < p) {
			v[(i & 1) ^ 1] ^= ((p - i + 2 * t[i & 1].Query(n - p)) >> 1) & 1;
		}
	}
	puts(!v[0] && !v[1] ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
#define INFINITY 1000000000
 
typedef struct {
  int a;
  char c;
}kouzou;
 
int partition(kouzou A[],int p,int r){
  int x,i,j;
  kouzou v;
  x=A[r].a;
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j].a<=x){
      i++;
      v=A[i];
      A[i]=A[j];
      A[j]=v;
    }
  }
  v=A[i+1];
  A[i+1]=A[r];
  A[r]=v;
  return i+1;
}
 
 
void quicksort(kouzou A[],int p,int r){
  int q;
  if(p<r){
    q=partition(A,p,r);
    quicksort(A,p,q-1);
    quicksort(A,q+1,r);
  }
}
 
 
void merge(kouzou A[],int left,int mid,int right){
  int n1,n2,i,k,j;
  n1=mid-left;
  n2=right-mid;
 
  kouzou l[n1+1],r[n2+1];
  for(i=0;i<n1;i++)l[i]=A[left+i];
  for(i=0;i<n2;i++)r[i]=A[mid+i];
  l[n1].a=INFINITY;
  r[n2].a=INFINITY;
  i=j=0;
  for(k=left;k<right;k++){
    if(l[i].a<=r[j].a){
      A[k]=l[i];
      i+=1;
    }
    else {
      A[k]=r[j];
      j+=1;
    }
 
  }
}
 
void mergesort(kouzou A[],int left,int right){
 
  int mid,i=0;
  if(left+1<right){
    mid=(left+right)/2;
    mergesort(A,left,mid);
    mergesort(A,mid,right);
    merge(A,left,mid,right);
  }
}
int main(){
  int n,i;
  kouzou A[100000],B[100000];
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf(" %c %d",&A[i].c,&A[i].a);
    for(i=0;i<n;i++)B[i]=A[i];
    quicksort(A,0,n-1);
    mergesort(B,0,n);
    for(i=0;i<n;i++){
      if(A[i].c!=B[i].c){
        printf("Not stable\n");
        break;
      }
      if(i==n-1)printf("Stable\n");
    }
    for(i=0;i<n;i++)printf("%c %d\n",A[i].c,A[i].a);
    return 0;
}


Measured memory_bytes: 4124
/* ~ Programmer >> Tushar Mahajan */
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
#define ld long double
#define MOD 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL); 

int main() {
	ios;
	ll n,wa=0,tle=0,re=0,ac=0;
	cin>>n;
	string s;
	for(int i=0;i<n;i++)
	{
	    cin>>s;
	    if(s=="AC")
	    {
	        ac++;
	    }
	    else if(s=="TLE")
	    {
	        tle++;
	    }
	    else if(s== "WA")
	    {
	        wa++;
	    }
	    else if(s=="RE")
	    {
	        re++;
	    }
	}
	cout<<"AC"<<" "<<"x"<<" "<<ac<<endl;
	cout<<"WA"<<" "<<"x"<<" "<<wa<<endl;
	cout<<"TLE"<<" "<<"x"<<" "<<tle<<endl;
	cout<<"RE"<<" "<<"x"<<" "<<re<<endl;
	return 0;
}


Measured memory_bytes: 3656
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int[] input = new int[1000000];

            int i;
            for ( i = 1; i < input.Length; i++)
            {
                input[i] = int.Parse(Console.ReadLine());
                if (input[i] == 0) break;
            }
            for (int t = 1; t < i; t++)
            {
                Console.WriteLine("Case "+t+": "+input[t]);
            }
        }
    }
}

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

int digit_sum(int N){
  if (N<10){
    return N;
  }else{
    return N%10+digit_sum(N/10);
  }
}

int main(){
  int N;
  cin>>N;
  if (N%digit_sum(N)==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

inline map<ll,int> sieve(ll n){
  map<ll,int> PrimeNumber;
  for(ll i = 2; i*i <= n; i++){
    while(n % i == 0){
      PrimeNumber[i]++;
      n /= i;
    }
  }
  if(n != 1) PrimeNumber[n] = 1;
  return PrimeNumber;
}

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  ll n,p; cin >> n >> p;
  auto res = sieve(p);
  ll ans = 1;
  for(auto x : res){
    if(0 < x.second/n) ans *= pow(x.first,x.second/n);
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 4004
n, m, x, y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
c = []
for i in range(x + 1, y + 1):
    count = 0
    for j in range(len(xs)):
        if xs[j] >= i:
            count += 1
    for k in range(len(ys)):
        if ys[k] < i:
            count += 1
    c.append(count)
if c.count(0) >= 1:
    print('No War')
else:
    print('War')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	std::vector<std::vector<int>> g(n);
	for(int i = 0; i < n - 1; i++) {
		int a, b; scanf("%d%d", &a, &b);

		g[a - 1].push_back(b - 1);
		g[b - 1].push_back(a - 1);
	}

	using value = double;
	std::vector<std::map<int, value>> dp(n);
	auto solve = [&](auto&& solve, int v, int par, bool flag) -> double {
		if(dp[v].count(par)) return dp[v][par];

		int deg = 0;
		value val = 0.;
		if(flag or par == -1) {
			deg = g[v].size() - (par != -1);
			for(auto e: g[v]) {
				if(e == par) continue;
				val += solve(solve, e, v, flag);
			}
		} else {
			deg = g[v].size() - !!g[v].size();
			value parent_val = solve(solve, par, v, 0);
			value around_val = (solve(solve, v, -1, 0) - 1.) * g[v].size();
			val = around_val - parent_val;
		}
		if(deg) val = val / deg + 1;

		return dp[v][par] = val;
	};
	solve(solve, 0, -1, 1);

	for(int v = 0; v < n; v++) printf("%.12lf\n", solve(solve, v, -1, 0));
	return 0;
}


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

using namespace std;

const int N_MAX = 1e5 + 5;

vector< int > graph[N_MAX];
bool is_checked[N_MAX];
int ans = 0;

void dfs(int node, bool flag) {
    if (is_checked[node]) return;
    if (flag) ans++;
    is_checked[node] = true;
    for (auto x : graph[node]) {
        dfs(x, false);
    }
}

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

    for (int i = 0; i < M; i++) {
        int x, y, z;
        cin >> x >> y >> z;

        graph[x].push_back(y);
        graph[y].push_back(x);
    }

    for (int i = 1; i <= N; i++) {
        dfs(i, true);
    }

    cout << ans << endl;
}

Measured memory_bytes: 8960
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
#include <random>
using namespace std;

/////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
    ll n, k; cin >> n >> k;
    ll c = n / k;
    ll ans = n - c * k;

    cout << min(ans,abs(ans-k)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

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

	float L; cin >> L;
	cout << setprecision(15) << (L / 3.0) * (L / 3.0) * (L / 3.0) << endl;

	return 0;
}

Measured memory_bytes: 3756
#include<cstdio>
#include<algorithm>
using namespace std;
int n,t,MIN,k;
int main()
{
	scanf("%d%d",&n,&t);
	MIN=1000000000;
	k=1000000000;
	for (int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if (y<=t)
		{
			MIN=y;
			k=min(k,x);
		}
	}
	if (MIN==1000000000) puts("TLE");
	else printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

int sum = 0;
bool used[10010] = {};
vector<int> V[10010];
vector<int> ans(10010);
int k = 0;
vector<int> C;
void DFS(int X){
    used[X] = 1;
    REP(i,V[X].size()){
        if(used[V[X][i]]) continue;
        ans[V[X][i]] = C[k];k++;
        DFS(V[X][i]);
    }
}

void dfs(int X){
    used[X] = 1;
    REP(i,V[X].size()){
        if(used[V[X][i]]) continue;
        sum += min(ans[V[X][i]],ans[X]);
        dfs(V[X][i]);
    }
}

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;cin >> N;
    int A[N],B[N];
    REP(i,N-1){
        cin >> A[i] >> B[i];--A[i];--B[i];
        V[A[i]].pb(B[i]);
        V[B[i]].pb(A[i]);
    }int tmp;
    REP(i,N){cin >> tmp;C.pb(tmp);}
    sort ALL(C);reverse ALL(C);
    int maxv = 0,val;
    REP(i,N){
        if(V[i].size() > maxv){
            maxv = V[i].size();
            val = i;
        }
    }ans[val] = C[k];k++;
    DFS(val);
    REP(i,N) used[i] = 0;
    dfs(0);
    cout << sum << endl;
    REP(i,N){
        cout << ans[i] << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 1536
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
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)*}
    };
}

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, 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")
    };
}

fn main() {
    input! {
        N: usize,
        abc: [(usize1, usize1, i64); N-1],
        Q: usize,
        K: usize1,
        xy: [(usize1, usize1); Q],
    }

    let mut neighbors = Vec::with_capacity(N);
    for i in 0..N {
        neighbors.push(vec![]);
    }
    for i in 0..(N-1) {
        let (from, to, dist) = abc[i];
        neighbors[from].push((to, dist));
        neighbors[to].push((from, dist));
    }

    use std::collections::{VecDeque, HashSet};
    let mut queue = VecDeque::new();
    let mut visited = HashSet::new();
    queue.push_back((K, 0));

    let mut d_from_k = vec![0; N];

    while let Some((v, dist)) = queue.pop_front() {
        visited.insert(v);        
        d_from_k[v] = dist;

        for &(child, d) in neighbors[v].iter() {
            if !visited.contains(&child) {
                queue.push_back((child, dist + d));
            }
        }
    }
    
    let mut ans = Vec::with_capacity(Q);
    for i in 0..Q {
        let (x, y) = xy[i];
        ans.push((d_from_k[x] + d_from_k[y]).to_string());
    }

    println!("{}", ans.join("\n"));
}


Measured memory_bytes: 35236
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		long ans = 0;
		for(int i = 1 ; i <=N ; i++) {
			if(i%3==0 && i%5 ==0) {
				//none
			}else if(i%3==0) {
				//none
			}else if(i%5==0) {
				//none
			}else {
				ans = ans + i;
			}
		}
		System.out.println(ans);
		scan.close();
	}
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
#define INT long long int
using namespace std;
INT n, m, ans;

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    if( n == 1 ) return cout<<"Hello World\n", 0;
    else
    {
        INT a, b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }

}


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

int main()
{
    int n;
    cin>>n;
    int ar[2*n];
    for(int i=0; i<2*n; i++)
        cin>>ar[i];

    int s=sizeof(ar)/sizeof(ar[0]);

    sort(ar, ar+s);

    int add=0;
    for(int i=0; i<n; i++)
        add+=ar[2*i];

     cout<<add;
    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    
    sort(RALL(a));

    ll ans;
    int flag = 0;
    for(int i = 0; i < n-1; i++) {
        if (flag == 0 && a[i] == a[i+1]) {
            ans = a[i];
            i += 2;
            flag = 1;
        }
        if (flag == 1 && a[i] == a[i+1]) {
            ans *= a[i];
            i += 2;
            flag = 2;
        }
        if (flag == 2) break;
    }

    cout << (flag == 2 ? ans : 0) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;


int main(){
    int N; cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];

    ll total = 0;
    rep(i,N){
        total ^= a[i];
    }

    rep(i,N){
        cout << (total ^ a[i]) << endl;
    }
}

Measured memory_bytes: 4656
import sys
n, m, d = [int(i) for i in sys.stdin.readline().split()]
if d >= n:
    print(0)
elif d == 0:
    print(1 / n * (m - 1))
else:
    _mean = max(0, n - d*2) * 2 / n**2
    _mean += (d * 2 - max(0, d * 2 - n))/ n**2
    print(_mean * (m - 1))

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

int main(){
    int a,b;
    cin >> a >> b;
    int diff = b-a;
    int am=0;
    for(int i=1;i<=diff;i++){
        am+=i;
    }
  cout << am-b <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int c = 0;
  for(int i = 0; i < 4; i++) {
    for(int j = 0; j < 4; j++) {
      if ( S.at(i) == S.at(j) )
        c++;
    }
  }
  if ( c == 8 )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
struct dice{
    int a[6];
    void b(char c){
        int d;
        if(c=='N'){
            d=a[0];
            a[0]=a[1];
            a[1]=a[5];
            a[5]=a[4];
            a[4]=d;
        }
        if(c=='W'){
            d=a[0];
            a[0]=a[2];
            a[2]=a[5];
            a[5]=a[3];
            a[3]=d;
        }
        if(c=='E'){
            d=a[0];
            a[0]=a[3];
            a[3]=a[5];
            a[5]=a[2];
            a[2]=d;
        }
        if(c=='S'){
            d=a[0];
            a[0]=a[4];
            a[4]=a[5];
            a[5]=a[1];
            a[1]=d;
        }
        if(c=='R'){
            d=a[1];
            a[1]=a[2];
            a[2]=a[4];
            a[4]=a[3];
            a[3]=d;
        }
    }
    int top(){
        return a[0];
    }
    int right(){
        return a[2];
    }
    int left(){
        return a[3];
    }
    int front(){
        return a[1];
    }
};
int main(){
    dice e;
    for(int i=0;i<6;i++) cin >> e.a[i];
    int n;
    cin >> n;
    while(n--){
        int m,l;
        cin >>m >>l;
        if(e.left()==m) e.b('E');
        if(e.right()==m) e.b('W');
        while(e.top()!=m) e.b('N');
        while(e.front()!=l) e.b('R');
        cout << e.right() << endl;
    }
    return 0;
}


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

int main() {
    int n;
    cin>>n;
    long m[5]={0,0,0,0,0};
    for (int i = 0; i < n; ++i) {
        string name;
        cin>>name;
        if(name[0]=='M')m[0]++;
        if(name[0]=='A')m[1]++;
        if(name[0]=='R')m[2]++;
        if(name[0]=='C')m[3]++;
        if(name[0]=='H')m[4]++;
    }
    long count=0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                count+=m[i]*m[j]*m[k];
            }
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x): # 根を探す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    N,M=MAP()
    
    edges = []
    for _ in range(M):
        a,b = MAP()
        edges.append((a-1,b-1))

    answer = 0
    for i in range(M): # i番目の辺を使わない
        uf = UnionFind(N)

        for j in range(M):
            if i == j:
                continue

            a,b = edges[j]
            uf.union(a,b)
        if uf.group_count() > 1:
            answer += 1
    print(answer)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3192
#include <stdio.h>
#include <string.h>

int main(void) {
  char S[101], T[101];
  char c;
  int i = 0, j;
  int r;
  scanf("%s%s", S, T);
  int s = strlen(S);
  for(; i < s; i++) {
    r = 1;
    for(j = 0; j < s; j++) if(S[j] != T[j]) r = 0;
    if(r == 1) {
      printf("Yes\n");
      return 0;
    }
    c = S[s - 1];
    for(j -= 1; j >= 0; j--) S[j] = S[j - 1];
    S[0] = c;
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

#define N 101

int main() {
	static char s[N + 1], t[N + 1];
	int n, m, x;

	scanf("%s%s", s, t);
	n = strlen(s);
	m = strlen(t);
	if (n != m) {
		printf(n < m ? "LESS\n" : "GREATER\n");
		return 0;
	}
	x = strcmp(s, t);
	printf(x < 0 ? "LESS\n" : x == 0 ? "EQUAL\n" : "GREATER\n");
	return 0;
}


Measured memory_bytes: 128
"use strict";

const App8 = (arg: any) => {
  const value: string = arg.trim().split("\n");
  const A: number = parseInt(value[0].split(" ")[0], 10);
  const B: number = parseInt(value[0].split(" ")[1], 10);
  if (A > B) {
    console.log(`${B}`.repeat(A));
  } else if(B > A) {
    console.log(`${A}`.repeat(B));
  }else {
    console.log(`${A}`.repeat(A));
  }
}

App8(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
    int x,y,z;
    cin >> x >> y >> z;

    swap(x,y);
    swap(x,z);

    printf("%d %d %d\n", x, y, z);
    return 0;
}

Measured memory_bytes: 3716
#include <stdio.h>

int main(void) {
    int n, i, j, l, r, v, maximum;
    int a[101] = {};
    int acc[101][101] = {};

    maximum = -999999999;

    scanf("%d", &n);

    for (i = 1; i <= n; i++) {
        for (j = 1; j <= n; j++) {
            scanf("%d", &v);
            a[j] = a[j-1] + v;
        }
        for (l = 1; l <= n; l++) {
            for (r = l; r <= n; r++) {
                acc[l][r] += a[r] - a[l-1];
                if (maximum < acc[l][r]) maximum = acc[l][r];
                if (acc[l][r] < 0) acc[l][r] = 0;
            }
        }
    }
    printf("%d\n", maximum);

    return 0;
}

Measured memory_bytes: 648
#include<stdio.h>
int main(){
  int x,y;
  while(scanf("%d %d",&x,&y)){
    if(x==0 && y==0)break;
    else if(x<y)printf("%d %d\n",x,y);
    else printf("%d %d\n",y,x);
  }   
  return(0);
}

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

ll dp[101][(uint)1e5 + 1];
int main() {
  int n, W;
  cin >> n >> W;
  int w[100];
  ll v[100];
  for (int i = 0; i < n; i++)
    cin >> w[i] >> v[i];
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= W; j++) {
      dp[i + 1][j] = dp[i][j];
      if (j - w[i] < 0) continue;
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
    }
  }

  cout << dp[n][W] << endl;
  return 0;
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
  #define FASTIO std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  using namespace std;
  #define endl '\n'
  #define deb cout<<"sab_badhiya"<<endl;
  typedef long long int ll;
  // const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
  const long INF = 1000 * 1000 * 1000 + 7;
  int main() {
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }

Measured memory_bytes: 256
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define REP(i, x) for(int i = 0; i < (int)(x); i++)
#define REPS(i,x) for(int i = 1; i <= (int)(x); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define debug(x) cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  int A[210];

  cin >> N;
  REP(i, N){
    cin >> A[i];
  }

  int res = 0;
  while (true){
    bool f=false;
    REP(i,N){
      if (A[i]%2==0){
        A[i]  /= 2;
      }
      else{
        f=true;
      }
    }
    if (f){
      break;
    }
    ++res;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
/**
 *    Creator :  bizarre
 *    Date : 3/2020
 *    Problem Number : 390
**/
#include <bits/stdc++.h>
using namespace std;
#define bizarre     ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );
/*
const int inf = 2e9, mod = 1e9 + 7,N=1e6+5;
long long fact[N], inv[N];

void move1step(long long& a, long long& b, long long q)
{
    long long c= a-q*b;
    a=b;
    b=c;
}
long long egcd(long long r0,long long r1,long long& x0,long long& y0)
{
    long long x1=0,y1=1;
    x0=1;
    y0=0;
    while(r1)
    {
        long long q=r0/r1;
        move1step(r0,r1,q);
        move1step(x0,x1,q);
        move1step(y0,y1,q);
    }
    return r0;
}
bool  solve (long long a, long long b, long long c,long long&x, long long& y)
{
    long long g=egcd(a,b,x,y);
    int m=c/g;
    x*=m;
    y*=m;
    return c%g==0;
}
int npr(long long n, long long r)
{
    return (fact[n] * inv[n - r]) % mod;
}

int gcd(int a, int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int ncr(long long n, long long r)
{
    return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;
}
void pre(long long n)
{
    fact[0] = 1;
    inv[0] = 1;
    for (long long i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}
long long fp(long long base, long long exp)
{
    if (exp == 0)
        return 1;
    long long ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}
void PrimeFactorization(int n)
{
    for(int i=2; i*i<=n; i++)
    {
        int c=0;
        if(n%i==0)
        {
            while(n%i==0)
            {
                n/=i;
                c++;
            }

        }
    }

}
*/

int main()
{

   long long n,m;
   cin>>n>>m;
   cout << (n*(n-1))/2+(m*(m-1))/2;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#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
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout <<(H*W)-(H*w+h*W-h*w) << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef __int128 lll;
const ll mod=1e9+7;
const int mn=6e5+10;
int p[mn],lst[mn],np[mn],nl[mn];
int sw;
int at[mn];
int eval(int x){
    if(sw^at[x]){
        at[x]=sw;
        if(np[x]>=1)np[x]=3-np[x];
    }
    return np[x];
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin>>n>>s;

    for(int i=1,po=1;i<=n;i++,po*=3){
        sw=0;
        memset(at,0,sizeof(at));
        for(int j=0;j<po*3;j++)np[j]=j/po;
        for(int j=0;j<s.size();j++){
            if(s[j]=='S'){
                sw^=1;
            }
            else{
                int lo=j?(lst[j-1]):(po-1);
                np[lo]=(eval(lo)+1)%3;
                np[lo+po]=(eval(lo+po)+1)%3;
                np[lo+po*2]=(eval(lo+po*2)+1)%3;
            }
            if(eval(lst[j])==2)nl[j]=0;
            else if(eval(lst[j]+po)==2)nl[j]=1;
            else nl[j]=2;
        }
        for(int j=po*3-1;j>=0;j--)p[j]=p[j%po]+eval(j)*po;
        for(int j=0;j<s.size();j++)lst[j]+=nl[j]*po;
        if(i==n)for(int j=0;j<po*3;j++)printf("%d ",p[j]);
    }
}

Measured memory_bytes: 12404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

int main(void){
    ll a, b, k;
    cin >> a >> b >> k;
    if(k < a){
        cout << a-k << " " << b;
    }
    else if(a <= k && (k-a) < b){
        cout << 0 << " " << b-(k-a);
    }
    else{
        cout << 0 << " " << 0;
    }
    return 0;
}

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

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

    int ans = 2;
    while (S.size() > 2) {
        S = S.substr(0, S.size() - 1);
        if (S.size() % 2 == 0) {  // 文字列が偶数個
            string prevS = S.substr(0, S.size() / 2);
            string latterS = S.substr(S.size() / 2, S.size() / 2);
            if (prevS == latterS) {  // 偶文字列の場合
                ans = S.size();
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    long K = sc.nextLong();
    long X, Y, Z;
    if(A == B && B == C) {
      System.out.println(0);
    } else {
      if(K % 2 == 0) {
        System.out.println(A-B);
      } else {
        System.out.println(B-A);
      }
    }
  }
}

Measured memory_bytes: 23764