akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main()
{
    int P = 998244353;

    int N, K;
//    vector<int> s;
    vector<pair<int, int>> s;
    cin >> N >> K;

    for (int i = 0; i < K; ++i)
    {
        int l, r;
        cin >> l >> r;

        s.push_back(pair<int, int>(l, r));
    }

    vector<int> c(N + 1, 0);   // c[i]  1 から i ますまでのパスの数

    for (size_t j = 0; j < s.size(); ++j)
    {
        for (int k = 0; k < K; ++k)
        {
            for (int ss = s[k].first; ss <= s[k].second; ++ss)
            {
                if (ss + 1 <= N)
                {
                    c[ss + 1] = 1;
                }
                else
                {
                    break;
                }
            }
        }
    }

    vector<int> C(N + 1, 0);   // C[i] = c[0] + .. + c[i];

    for (int i = 1; i <= N; ++i)
    {
        for (int k = 0; k < K; ++k)
        {
            // c[i - s[k].first] + .. + c[i - s[k].second] を加算

            int add; //  = C[s[k].second] - C[s[k].first - 1];
            int upper = max(i - s[k].first, 0);
            int lower = max(i - s[k].second-1, 0);
            if (C[upper] >= C[lower])
            {
                add = (C[upper] - C[lower]) % P;
            }
            else
            {
                add = (P + C[upper] - C[lower]) % P;
            }

            c[i] = (c[i] + add) % P;
        }

        C[i] = (C[i - 1] + c[i]) % P;

    }

    cout << c[N] << endl;


    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

ll dp[10010][2][101];
string s;
int d;
int flag[10010][2][101];

ll ddpp(int i,int sm,int j){
    int n=s.size();
    if (flag[i][sm][j])return dp[i][sm][j];
    flag[i][sm][j]=1;
    if (sm==1){//sより小さい
        if (i==n-1){
            for (int k=0;k<10;k++){
                if (k%d==j)dp[i][sm][j]+=1;
            }
        }
        else{
            for (int k=0;k<10;k++){
                dp[i][sm][j]+=ddpp(i+1,sm,(j-k+100*d)%d);
                dp[i][sm][j]%=MOD;
            }
        }
        return dp[i][sm][j];
    }
    else{
        int num=s[i]-'0';
        if (i==n-1){
            for (int k=0;k<num+1;k++){
                if (k%d==j) {
                    dp[i][sm][j]+=1;
                }
            }
            return dp[i][sm][j];
        }
        for (int k=0;k<num;k++){
            dp[i][sm][j]+=ddpp(i+1,1,(j-k+10*d)%d);
            dp[i][sm][j]%=MOD;
        }
        dp[i][sm][j]+=ddpp(i+1,sm,(j-num+10*d)%d);
        dp[i][sm][j]%=MOD;
        return dp[i][sm][j];
    }
}

int main() {
    cin>>s;
    cin>>d;
    int num=s.size();
    ddpp(0,0,0);
    ll ans1=dp[0][0][0];
    memset(dp,0,sizeof(dp));
    memset(flag,0,sizeof(0));
    ll ans2=ddpp(0,1,0);
    ans2=dp[0][1][0];
    cout<<(ans1-1+MOD)%MOD<<endl;

    

    return 0;
}

Measured memory_bytes: 24960
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N, L;
    cin >> N >> L;
    vector<ll> a(N);
    Rep (i, N) {
        cin >> a[i];
    }

    Rep (i, N-1) {
        if (a[i] + a[i+1] >= L) {
            cout << "Possible\n";
            for (ll j = 1; j <= i; j++) {
                cout << j << "\n";
            }
            for (ll j = N-1; j >= i+1; j--) {
                cout << j << "\n";
            }
            return 0;
        }
    }

    cout << "Impossible\n";
}

Measured memory_bytes: 1664
#include<iostream>
#include<string>
using namespace std;
int main(){
	int x,y;
	while(cin>>x>>y){
		if(x==0&&y==0)
			break;
		if(x>=y)
			cout<<y<<" "<<x<<endl;
		else
			cout<<x<<" "<<y<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
   int i,a,b,s=0;

   scanf("%d%d",&a,&b);

   for(i=a; i<=b; i++){
     if((i/10000==i%10)&&(i/10%10==i/1000%10))
         s++;
   }
      printf("%d\n",s);
return 0;
}


Measured memory_bytes: 128
def solve():
  N, M = map(int, input().split())
  A = [list(map(int, input().split()))+[i] for i in range(M)]

  A.sort(key=lambda x:(x[0],x[1]))
  ans = [0]*M
  before = -1
  for p,y,i in A:
    if p!=before:
      year = 1
    else:
      year += 1
    ans[i] = '0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(year)))+str(year)
    before = p
  return ans
print(*solve(),sep='\n')

Measured memory_bytes: 109116
s=0
A=int(input())
B=int(input())
C=int(input())
X=int(input())
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                s+=1
print(s)

Measured memory_bytes: 2940
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);

		//渡される定数
		int r = sc.nextInt();//行数
		int c = sc.nextInt();//列数

		//配列の用意
		int[][] excel = new int[r + 1][c + 1];//結果分を出さなければいけないので行列を1ずつ増やす

		//要素の入力
		for (int i = 0; i < r; i++) {//行rの何行目かを指定
			for (int j = 0; j < c; j++) {//列cの何列目かを指定
				excel[i][j] = sc.nextInt();//行列番地用意
				excel[r][j] += excel[i][j];//行を固定
				excel[i][c] += excel[i][j];//列を固定

			}

		}

		//行の計算
		for (int i = 0; i < c; i++) {//行rの何行目かを指定
			excel[r][c] += excel[r][i];
		}
		//		//列の計算
		//		for (int j = 0; j < r; j++) {//行rの何行目かを指定
		//			excel[r][c] += excel[j][c];//何列目の合計値
		//		}
		//
		//表として出力
		for (int i = 0; i < excel.length; i++) {//行
			for (int j = 0; j < excel[i].length; j++) {//i行の列
				System.out.print(excel[i][j]);
				if (j != c) {
					System.out.print(" ");//表の数字の間にスペースを挟む
				}
			}
			System.out.println();
		}

	}
}


Measured memory_bytes: 43856
N, K = map(int, input().split())
mod = pow(10, 9) + 7
a = [i for i in range(N+1)]
ls = [0] * (N+1)
rs = [0] * (N+1)
rs[N] = a[N]
for i in range(N):
  ls[i+1] = ls[i] + a[i+1]
for i in range(N, 0, -1):
  rs[i-1] = rs[i] + a[i-1]
ans = 0
for i in range(K, N+1+1):
  ans += (rs[N-i+1] - ls[i-1] + 1) % mod
print(ans % mod)

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

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

	int tmp = 0;
	int maxValue;
	int maxIndex;
	vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; 		
		if (tmp < a[i]) {
			tmp = a[i];
			maxIndex = i;
		}	
	}

	tmp = 0;
	int secondMaxIndex;
	for (int i = 0; i < n; i++) {
		if (i == maxIndex) continue;
		if (tmp < a[i]) {
				tmp = a[i];
				secondMaxIndex = i;
		}
	}
	
	for (int i = 0; i < n; i++) {

		if (i == maxIndex) {
			cout << a[secondMaxIndex] << endl;
		}
		else { // i != maxIndex
			cout << a[maxIndex] << endl;
		}	

	}

	return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>

#define N 100000
#define Q 50000

int main(void){
    int i,j,n,q,S[N],T[Q],cnt=0,m,l,r;
    
    scanf("%d",&n);
    if(n>100000) exit(1);
    for(i=0;i<n;i++){
        scanf("%d",&S[i]); 
    }
    
    scanf("%d",&q);
    if(q>50000) exit(1);
    for(i=0;i<q;i++){
        scanf("%d",&T[i]);
    }
    
    for(i=0;i<q;i++){
        l=0;
        r=n;
        while(l<r){
            m=(l+r)/2;
            if(S[m]==T[i]){
                cnt++;
                break;
            }
            else if(S[m]>T[i]){
                r=m;
            }
            else l=m+1;
        }
    }
    
    printf("%d\n",cnt);
    
    return 0;
}



Measured memory_bytes: 2284
#include<stdio.h>
#include<cmath>
#include<string>
#include<cassert>
#include<iostream>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4]={0,-1,0,1}; 
static const int dy[4]={1,0,-1,0};
static const char dir[4] = {'r','u','l','d'};

int MDT[N2][N2];

struct P {
int f[N2], space, MD;
};

P state;
int limit;
int path[LIMIT];

int getAllMD(P pz) {
    int sum=0;
    for( int i=0;i<N2;i++){
        if(pz.f[i]==N2)continue;
        sum+=MDT[i][pz.f[i]-1];
}
    return sum;
}

bool isSolved() {
    for(int i=0;i<N2;i++)
if(state.f[i]!=i+1){
  return false;
   } 
return true;
}

bool dfs(int depth,int prev){
    if(state.MD==0)
    return true;
    if(depth+state.MD>limit)
    return false;
    
    int sx=state.space/N;
    int sy=state.space%N;
    P tmp;
    
    for(int r=0;r<4;r++) {
        int tx =sx+dx[r];
        int ty=sy+dy[r];
        if(tx<0||ty<0||tx>=N||ty>=N)
                continue;
        if(max(prev,r)-min(prev,r)==2)
                continue;
        tmp=state;
        
        state.MD-=MDT[tx*N+ty][state.f[tx*N+ty]-1];
        state.MD+=MDT[sx*N+sy][state.f[tx*N+ty]-1];
        swap(state.f[tx*N+ty],state.f[sx*N+ sy]);
        state.space=tx*N+ty;
        if(dfs(depth+1,r)){
             path[depth]=r;
             return true;
         }
        state=tmp;
    }
    return false;
}

string iterative_deepening(P in){
    in.MD=getAllMD(in);
    for(limit=in.MD;limit<=LIMIT;limit++){
        state=in;
        if(dfs(0,-100)){
            string ans="";
            for(int i=0;i<limit; i++)
                ans += dir[path[i]];
            return ans;
        }
    }
    return "unsolvable";    
}

int main() {
    for(int i=0;i<N2;i++)
        for(int j=0;j<N2; j++)
            MDT[i][j]=abs(i/N-j/N)+abs(i%N-j%N);
    P in;
    
    for(int i=0;i<N2;i++){
        cin>>in.f[i];
        if(in.f[i]==0){
            in.f[i]=N2;
            in.space=i;
           }
    }
    string ans=iterative_deepening(in);
    cout<<ans.size()<<endl;
    return 0;
}



Measured memory_bytes: 3192
/* Author	: Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define jehian using
#define mau namespace
#define libur std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(NULL);}

jehian mau libur;
/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n");
#define sp printf(" ");

/* MACROS FOR FUNCTION */
#define pb push_back
#define mp make_pair
#define eb emplace_back

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

int main(){
	string a;
	cin >> a;
	for (ll i = 0; i < a.size(); ++i){
		if (i % 2 == 0){
			cout << a[i];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int now=1;
  int N,K;
  cin >> N >> K;
  rep(i,N){
    now = min(now*2,now+K);
  }
  cout << now << endl;
  return 0;
}


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

struct Bitset{
	using ull = unsigned long long;
	vector<ull> b;
	int n;
	Bitset(int x){
		n = x;
		b.resize((n+63)/64,0);
	}
	
	int get(int x){
		return (b[x>>6]>>(x&63))&1;
	}
	
	void set(int x,int y){
		b[x>>6] |= 1ULL<<(x&63);
		if(!y)b[x>>6] ^= 1ULL<<(x&63);
	}
	
	Bitset &operator&=(const Bitset &another){
		rep(i,b.size()){
			b[i] &= another.b[i];
		}
		return (*this);
	}
	
	Bitset operator&(const Bitset &another)const{
		return (Bitset(*this)&=another);
	}
	
	Bitset &operator|=(const Bitset &another){
		rep(i,b.size()){
			b[i] |= another.b[i];
		}
		return (*this);
	}
	
	Bitset operator|(const Bitset &another)const{
		return (Bitset(*this)|=another);
	}
	
	Bitset &operator^=(const Bitset &another){
		rep(i,b.size()){
			b[i] ^= another.b[i];
		}
		return (*this);
	}
	
	Bitset operator^(const Bitset &another)const{
		return (Bitset(*this)^=another);
	}
	
	Bitset &operator>>=(int x){
		if(x&63){
			rep(i,b.size()-1){
				b[i] >>= (x&63);
				b[i] ^= (b[i+1]<<(64-(x&63)));
			}
			b.back() >>= (x&63);
		}
		
		x>>=6;
		rep(i,b.size()){
			if(i+x<b.size())b[i] = b[i+x];
			else b[i]=0;
		}
		return (*this);
	}
	
	Bitset operator>>(int x)const{
		return (Bitset(*this)>>=x);
	}
	
};

int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	int S = 0;
	
	for(int i=0;i<N;i++){
		cin>>A[i];
		S += A[i];
	}
	
	
	Bitset B(4000001);
	B.set(S,1);
	
	for(int i=0;i<N;i++){
		B |= (B>>A[i]);
	}
	
	int k = (S+1)/2;
	for(int i=k;true;i++){
		if(B.get(S-i)){
			cout<<i<<endl;
			return 0;
		}
	}
 
	
	return 0;
}
 


Measured memory_bytes: 4780
import java.text.DecimalFormat;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] x = new int[a];
		for (int i = 0; i < a; i++) {
			x[i] = sc.nextInt();
		}
		int[] y = new int[a];
		for (int i = 0; i < a; i++) {
			y[i] = sc.nextInt();
		}

		double[] p = new double[4];

		for (int i = 0; i < a; i++) {
			double p0 = Math.abs(x[i] - y[i]);
			p[0] += p0;
			p[1] += Math.pow(p0, 2);
			p[2] += Math.pow(p0, 3);
			p[3] = Math.max(p[3], p0);
		}
		p[1] = Math.sqrt(p[1]);
		p[2] = Math.cbrt(p[2]);
		DecimalFormat df = new DecimalFormat("0.000000");
		for (int i = 0; i < p.length; i++) {
			System.out.println(df.format(p[i]));
		}
	}
}



Measured memory_bytes: 26624
#include <iostream>
 
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <random>
#include <chrono>

#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
 
#define itn int
#define fro for
#define lowbit(x) (x & (-x))
#define Fast freopen("in.txt", "r", stdin)

using namespace std;
typedef long long ll;


/*------------------------------------------------------------------------------------*/
template <typename _t>
inline void read(_t &x){
    x = 0; _t fu = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-') fu = - 1; ch = getchar();}
    while(ch >= '0' && ch <= '9'){
        x = (x << 3) + (x << 1) + (ch & 15);
        ch = getchar();
    }
    x *= fu ;
}
/*------------------------------------------------------------------------------------*/
ll gcd(ll x, ll y){return !x? y: gcd(y % x, x);}
void exgcd(ll a, ll b, ll &x, ll &y){
    if(!b){x = 1; y = 0;return;}
    exgcd(b, a % b, y, x);
    y -= a / b * x;
}
/*------------------------------------------------------------------------------------*/
struct Mart{
    int a, b, c, d;
    Mart operator *(Mart &m){
        Mart temp;
        temp.a = a * m.a + b * m.c;
        temp.b = a * m.b + b * m.d;
        temp.c = c * m.a + d * m.c;
        temp.d = c * m.b + d * m.d;
        return temp;
    }
    Mart(){a = b = c = d = 0;}
    Mart(int x[4]){a = x[0]; b = x[1]; c = x[2]; d = x[3];}
    Mart(int u, int v, int w, int x){a = u; b = v; c = w; d = x;}
    int det(){return a * d - b * c;}
};
/*------------------------------------------------------------------------------------*/

const int maxn = 2e5 + 10;
const int M = 1e9 + 7;

ll qp(int x, int p){
    ll ans = 1, res = x;
    while(p){
        if(p & 1){
            ans = ans * res % M;
        }
        p >>= 1;
        res = res * res % M;
    }
    return ans;
}

int main(){
//    Fast;
    ll n, k; scanf("%lld %lld", &n, &k);
    
    ll cnt = 0, left, right;
    for(ll i = k; i <= n + 1; i++){
        left = i * (i - 1) / 2;
        right = i * (2 * n - i + 1) / 2;
        cnt += right - left + 1;
    }
    printf("%lld\n", cnt % M);
    
    
    
    return 0;
}


Measured memory_bytes: 3816
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);
int n,q;
vi adj[mxN];
int val[mxN];
void DFS(int node,int par,int sum){
    val[node]+=sum;
    for(auto child:adj[node]){
        if(child==par)continue;
        DFS(child,node,val[node]);
    }
}
void solve(){
    cin>>n>>q;
    loop(n-1,i,0){
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    while(q--){
        int p,x;
        cin>>p>>x;
        val[p]+=x;
    }
    DFS(1,0,0);
    loop(n+1,i,1)
        cout<<val[i]<<' ';
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 34900
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main(){
  int D,G;
  cin>>D>>G;
  vector<int>P(D),C(D);
  int tmp = 0;
  rep0(i,D)cin>>P[i]>>C[i];
  vector<ll>sum(D);
  rep0(i,D)sum[i] = (P[i] * (i+1) * 100) + C[i];
  ll ans = INF;

  rep0(i,(1<<D)){
    ll temp = 0;
    ll count = 0;
    rep0(j,D){
      if(i & (1<<j)){
        temp += sum[j];
        count += P[j];
      }
    }
    if(temp >= G)ans = min(ans,count);
    else{
      for(int k = D - 1; k >= 0; --k){
        if(i & (1<<k))continue;
        else{
          for(int l = 0; l < P[k]; ++l){
            if(temp >= G)break;
            temp += 100 * (k+1);
            ++count;
          }
        }
      }
      ans = min(ans,count);
    }
  }
  cout << ans << endl;
  return 0;
} 

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, m;
	cin >> n >> m;
	n -= 2;
	m -= 2;
	cout << abs(n * m) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

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

    int a,b,k; cin >> k >> a >> b;

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

    return 0;
}


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

int main() {
	int x, y, s;
	while (scanf("%d%d%d", &x, &y, &s), s) {
		int Max = 0;
		for (int i = 1; i < s; i++) {
			for (int j = 1; j <= i&&j + i <= s; j++) {
				if (i*(100 + x) / 100 + j*(100 + x) / 100 == s) {
					Max = max(Max, i*(100 + y) / 100 + j*(100 + y) / 100);
				}
			}
		}
		printf("%d\n", Max);
	}
}

Measured memory_bytes: 3220
//Grid1
import java.io.*;
import java.util.*;
public class Main{
static int n,m;
static int mod=(int)1e9+7;
static char[][] path;
static int[] b=new int[10005];
public static long solve(){
	long[][] dp=new long[n][m];	
	for(int i=0;i<n;i++){
		if(path[i][0]=='.'){ dp[i][0]=1;}
		else break;
	}
	for(int i=0;i<m;i++){
		if(path[0][i]=='.'){ dp[0][i]=1;}
		else break;
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<m;j++){			
			if(path[i][j]=='#'){
				dp[i][j]=-1;
			}
			else{
				if(dp[i-1][j]!=-1&&dp[i][j-1]!=-1){
					dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
				}
				else if(dp[i-1][j]!=-1){
					dp[i][j]=dp[i-1][j]%mod;
				}
				else if(dp[i][j-1]!=-1){
					dp[i][j]=dp[i][j-1]%mod;
				}
			}
		}
	}
	return dp[n-1][m-1];
}
public static void main(String[] args) throws IOException{
		// BufferedReader br = new BufferedReader(new
  //      FileReader("sampleinp.txt"));
    	BufferedReader br = new BufferedReader( 
                             new InputStreamReader(System.in)); 
	 	StringBuilder ans=new StringBuilder();
	 	String str[]=br.readLine().split(" ");
	 	n=Integer.parseInt(str[0]);
	 	m=Integer.parseInt(str[1]);
	 	path=new char[n][m];
	 	for(int i=0;i<n;i++){
	 		String x=br.readLine();
	 		for(int j=0;j<m;j++){
	 			path[i][j]=x.charAt(j);
	 		}

	 	}	
	 	ans.append(solve()); 	
		// PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("sampleout.txt")));
  //       pw.write(ans.toString());
  //       pw.flush();
	 	System.out.println(ans.toString());

    }
}

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


int main(){
    int N;
    cin >> N;
    long long sum = 0;
    rep(i,N){
        sum += i+1;
        if(sum >= N){
            rep(j,i+1){
                if(sum - N == j+1) continue;
                cout << j+1 << endl;
            }
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

const ll mod = 1000000007;

struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod - a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint ret(*this);
    return ret += a;
  }
  mint operator-(const mint a) const {
    mint ret(*this);
    return ret -= a;
  }
  mint operator*(const mint a) const {
    mint ret(*this);
    return ret *= a;
  }
  mint pow(ll t) const {
    if (t == 0) return mint(1);
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint ret(*this);
    return ret /= a;
  }
};
class modutils {
  vector<mint> fact, invfact;

 public:
  modutils(int n = 200005) : fact(n + 1), invfact(n + 1) {
    fact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i;
    invfact[n] = fact[n].inv();
    for (int i = n; i >= 1; i--) invfact[i - 1] = invfact[i] * i;
  }
  mint pow(mint x, ll n) { return x.pow(n); }
  mint comb(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return fact[n] * invfact[k] * invfact[n - k];
  }
  mint perm(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return fact[n] * invfact[n - k];
  }
  mint fac(ll n) { return fact[n]; }
};

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

  if (k == 1) {
    cout << n * (n - 1) << endl;
    return 0;
  }

  modutils mu;

  mint ans = 0;
  ll m = min(n, k + 1);
  rep(i, m) {
    mint addv = mu.comb(n, i)*mu.comb(n - 1, i);
    ans = ans + addv;
  }

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


Measured memory_bytes: 3328
x, y= map(int, input().split())
if x>y:
    print("a",end=" ")
    print(">",end=" ")
    print("b")
elif x<y:
    print("a",end=" ")
    print("<",end=" ")
    print("b")
else:
    print("a",end=" ")
    print("==",end=" ")
    print("b")
    
    


Measured memory_bytes: 5596
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0181

"""
import sys
from sys import stdin
input = stdin.readline


def Cond(m, n, mid, books):
    if max(books) > mid:
        return False

    rem = mid
    while books:
        while rem >= books[0]:
            rem -= books[0]
            books = books[1:]
            if len(books) == 0:
                break
        rem = mid
        m -= 1

    if m >= 0:
        return True
    else:
        return False


def solve(m, n, books):
    ub = 1500000
    lb = 0
    min_width = float('inf')

    for i in range(100):
        mid = (ub + lb) // 2
        if Cond(m, n, mid, books):
            min_width = min(min_width, mid)
            ub = mid
        else:
            lb = mid

    return min_width



def main(args):
    while True:
        m, n = map(int, input().split())
        if m == 0 and n == 0:
            break
        books = [int(input()) for _ in range(n)]
        result = solve(m, n, books)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7744
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    string s;
    cin>>s;
    bool ok=true;
    int n=s.size();
    for (int i=0;i<n/2;i++)
    {
        if (s[i]!=s[n-1-i])
            ok=false;
    }
    for (int i=0;i<((n-1)/2)/2;i++)
    {
        if (s[i]!=s[(n-1)/2-1-i])
            ok=false;
    }
    string x="";
    for (int i=(n+3)/2-1;i<n;i++)
        x+=s[i];
     n=x.size();
        for (int i=0;i<n/2;i++)
        {
            if (x[i]!=x[n-1-i])
                ok=false;
        }
    if (ok)
        cout<<"Yes";
    else
        cout<<"No";




}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  map<ll,ll> m;
  rep(i,n){
    ll a; cin>>a;
    m[a]++;
  }
  
  priority_queue<ll> q;
  for(auto e: m){
    rep(i,e.second/2){
      q.push(e.first);
    }
  }
  ll ans=0;
  if(!q.empty()){
    ll tmp=q.top(); q.pop();
    if(!q.empty()){
      tmp*=q.top();
      ans=tmp;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6528
#include<iostream>
using namespace std;
int main()
{
  int x,y;
  cin>>x>>y;
  if(x==1){
    if(y==1){
      cout<<"1000000";
    }
    else if(y==2){
      cout<<"500000";
    }
    else if(y==3){
      cout<<"400000";
    }
    else{
      cout<<"300000";
    }
  }
  else if(x==2){
    if(y==1){
      cout<<"500000";
    }
    else if(y==2){
      cout<<"400000";
    }
    else if(y==3){
      cout<<"300000";
    }
    else{
      cout<<"200000";
    }
  }
 else if(x==3){
    if(y==1){
      cout<<"400000";
    }
    else if(y==2){
      cout<<"300000";
    }
    else if(y==3){
      cout<<"200000";
    }
    else{
      cout<<"100000";
    }
  }
 else {
    if(y==1){
      cout<<"300000";
    }
    else if(y==2){
      cout<<"200000";
    }
    else if(y==3){
      cout<<"100000";
    }
    else{
      cout<<"0";
    }
  }
}


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

    string s_1,s_2;
    for(int i=0; i<n/2; i++){
        s_1 += s.at(i);
    }
    for(int i=n/2; i<n; i++){
        s_2 += s.at(i);
    }
    if(s_1 == s_2) cout << "Yes" << endl;
    else    cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n;
		while ((n = in.nextInt()) != 0) {
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int point = 0;
			for (int i = 0; i < n; i++) {
				int judge = in.nextInt();
				max = Math.max(max, judge);
				min = Math.min(min, judge);
				point += judge;
			}
			point -= max + min;
			System.out.println(point / (n - 2));
		}
	}

}

Measured memory_bytes: 20940
from itertools import product

A, B = map(int, input().split())
A -= 1
B -= 1

G = [["#" for _ in range(100)] for _ in range(50)]
for i, j in product(range(0, 50, 2), repeat=2):
    if A <= 0:
        break
    G[i][j] = "."
    A -= 1

H = [["." for _ in range(100)] for _ in range(50)]
for i, j in product(range(1, 51, 2), repeat=2):
    if B <= 0:
        break
    H[i][j] = "#"
    B -= 1

print(100, 100)
for g in G:
    print("".join(g))

for h in H:
    print("".join(h))


Measured memory_bytes: 3188
// Code for D - Sum of Divisors
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

  vector<int> a(N + 1, 1);

  ll total = 0;
  FOR(i, 1, N + 1) {
    total += i * a[i];

    ll j = 2;
    while (i * j <= N) {
      a[i * j] += 1;
      j ++;
    }
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 42324
#include <iostream>

using namespace std;

int main(void) {

	int M1, M2, D1, D2;

	cin >> M1 >> D1 >> M2 >> D2;
	if (D2 == 1) { cout << 1 << endl; }
	else { cout << 0 << endl; }

	return 0;
}

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

#define cp_io ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long int
#define oo 1000000010
#define MAX 1000000
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define nl "\n"

int main()
{
    cp_io;
    #ifndef ONLINE_JUDGE
    freopen("z_input.txt","rt",stdin);
    freopen("z_output.txt","wt",stdout);
    #endif
    ll n;
    cin >> n;
    
    ll a[n];
    ll x = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        x = x^a[i];
    }
        
    for(int i=0; i<n; i++)
        cout << (x^a[i]) << " ";
    return 0;
}

Measured memory_bytes: 5120
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int C = in.i();
        int[] d = new int[200002];
        boolean[][] dup = new boolean[C][d.length];
        for (int i = 0; i < N; i++) {
            int s = in.i();
            int t = in.i();
            int c = in.i() - 1;
            int j = 2 * s - 1;
            if (!dup[c][j]) {
                dup[c][j] = true;
                d[j]++;
            }
            j++;
            while (j < 2 * t - 1) {
                d[j++]++;
            }
            if (!dup[c][j]) {
                dup[c][j] = true;
                d[j]++;
            }
        }
        int ans = 0;
        for (int i = 0; i < d.length; i++) {
            ans = Math.max(ans, d[i]);
        }

        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 44712
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

struct A{
	int p,l,e;
	A(){}
	A(int a,int b,int c):p(a),l(b),e(c){}
	bool operator<(const A &a)const{return e>a.e;}
};
struct Edge{
	int to,d,e;
	Edge(int a,int b,int c):to(a),d(b),e(c){}
};
vector<Edge> edge[100];

int n,m,l;

int cost[100][101];
int dijkstra(){
	priority_queue<A> pq;
	pq.push(A(0,l,0));
	for(int i=0;i<n;i++)for(int j=0;j<=l;j++)cost[i][j]=1<<29;
	cost[0][l]=0;
	while(!pq.empty()){
		A a=pq.top();
		pq.pop();
		if(cost[a.p][a.l]<a.e)continue;
		if(a.p==n-1)return a.e;
		vector<Edge> &e = edge[a.p];
		for(int i=0;i<e.size();i++){
			if(e[i].d <= a.l){
				A b=A(e[i].to,a.l-e[i].d,a.e); 
				if(b.e < cost[b.p][b.l]){
					cost[b.p][b.l]=b.e;
					pq.push(b);
				}
			}
			A b=A(e[i].to,a.l,a.e+e[i].e);
			if(b.e < cost[b.p][b.l]){
				cost[b.p][b.l]=b.e;
				pq.push(b);
			}
		}
	}
	return -1;
}
int main(){
	while(cin>>n>>m>>l,n|m|l){
		for(int i=0;i<n;i++)edge[i].clear();
		for(int i=0;i<m;i++){
			int p,q,r,s;
			cin>>q>>p>>r>>s;
			p--;q--;
			edge[p].push_back(Edge(q,r,s));
			edge[q].push_back(Edge(p,r,s));
		}
		cout<<dijkstra()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1476
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  int n;
  cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];
  int gc=a[0];
  rep(i,1,n) gc=__gcd(gc,a[i]);
  int cnt=0;
  while(gc%2==0) gc/=2,cnt++;
  cout<<cnt<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


Measured memory_bytes: 7004
import java.util.Scanner;

public class Main {
	static int N,K,T,U,V,L;
	static int[] ninjin;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		K=sc.nextInt();
		T=sc.nextInt();
		U=sc.nextInt();
		V=sc.nextInt();
		L=sc.nextInt();
		ninjin=new int[N+1];
		for(int i=0;i<N;i++){
			ninjin[i]=sc.nextInt();
		}
		ninjin[N]=L;
		double now=0.0;
		double cTime=0.0;
		int hasC=0;
		boolean isc=false;
		int ccnt=0;
		double velo=U;
		double ans=0.0;
		while(now!=L){
			double ndist=ninjin[ccnt]-now;
			double ncarotto=cTime*V;
			double dist=0.0;
			// テ、ツコツコテ・ツ渉づ」ツδ妥」ツδッテ」ツδシテ・ツ按?」ツつ?
			if(ndist>ncarotto&&isc){
//				System.out.println(ans);
				dist=ncarotto;
				now += dist;
				ans += dist/velo;
				isc=false;
				cTime=0.0;
				velo=U;
			}
			
			// ninjinテ・ツ慊ーテァツつケ
			else{
//				System.out.println("ninjin"+ans);
				dist=ndist;
				now = ninjin[ccnt];
				ans += dist/velo;
				ccnt++;
				hasC++;
				if(isc){
					cTime -= dist/velo;
				}
			}
			if(!isc&&hasC>0||hasC>K){
				hasC--;
				velo=V;
				isc=true;
				cTime = T;
			}
		}
		System.out.printf("%.10f\n",ans);
	}
}

Measured memory_bytes: 20584
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

ll modpow(ll x, ll n){
	ll r=1;
	while(n){
		if(n&1) r=r*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return r;
}

int main(){
  ll n,m;cin>>n>>m;
  ll ans=1;
  if(n==m){
    ans=2;
    rep(i,0,n){
      ans*=(i+1);
      ans%=MOD;
    }
    rep(i,0,m){
      ans*=(i+1);
      ans%=MOD;
    }
  }
  else if(max(n,m)==min(n,m)+1){
    rep(i,0,max(n,m)){
      ans*=(i+1);
      ans%=MOD;
    }
    rep(i,0,min(m,n)){
      ans*=(i+1);
      ans%=MOD;
    }
  }
  else{
    ans=0;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3596
n=int(input())
z=list(map(int,input().split()))
ans=[0,abs(z[1]-z[0])]

for i in range(2,len(z)):
    ans.append(min(abs(z[i]-z[i-1])+ans[-1],abs(z[i]-z[i-2])+ans[-2]))
print(ans[-1])    


Measured memory_bytes: 13928
import java.util.Scanner

val sc = Scanner(System.`in`)
val n = sc.nextInt()

fun main(args: Array<String>) {
    val plist = mutableListOf<Int>()
    for (i in 0 until n) {
        plist.add(sc.nextInt())
    }
    println(plist.sum() - plist.max()!!/2)
}

Measured memory_bytes: 31388
#include <iostream>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x.at(i); }

int main() {

    CIN(int, H);
    CIN(int, W);
    CIN(int, h);
    CIN(int, w);

    int result = (H-h)*(W-w);

    cout << result;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 101

int n,time;
int color[N],d[N]={},f[N]={};
int G[N][N]={};

void visit(int u){
    int v;
    color[u]=GRAY;
    d[u]=++time;
    for(v=0;v<n;v++){
        if(G[u][v]==0)continue;
        if(color[v]==WHITE)visit(v);
    }
    color[u]=BLACK;
    f[u]=++time;
}

void dfs(void){
    int u;
    for(u=0;u<n;u++)color[u]=WHITE;
    time=0;
    for(u=0;u<n;u++){
        if(color[u]==WHITE)visit(u);
    }
}

int main(){
    int id,num,a,i,j;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d",&id,&num);
        for(j=0;j<num;j++){
            scanf("%d",&a);
            G[i][a-1]=1;
        }
    }
    dfs();
    for(i=0;i<n;i++){
        printf("%d %d %d\n",i+1,d[i],f[i]);
    }
    return 0;
}



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

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

int main() {
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll GCD=gcd( max(c,d),min(c,d));
	ll LCM=c/GCD*d;
	ll BC=b/c,BD=b/d,BCD=b/LCM;
	ll ansb=b-(BC+BD-BCD);
	ll AC=(a-1)/c,AD=(a-1)/d,ACD=(a-1)/LCM;
	ll ansa=(a-1)-(AC+AD-ACD);
	cout << ansb-ansa;
}

Measured memory_bytes: 256
#include<stdio.h>
int max(int a,int b){return a>b?a:b;}
int main()
{
	long long n,k,sum=0;
	scanf("%lld%lld",&n,&k);
	if(k==0)sum=n*n;
	else for(int i=k+1;i<=n;i++)sum+=(n/i)*(i-k)+max(0,(int)n%i-(int)k+1);
	printf("%lld\n",sum);
}

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

#define FASTIO1 ios_base::sync_with_stdio(false)
#define FASTIO2 cin.tie(NULL),cout.tie(NULL)
#define count_1(p) __builtin_popcountll(p)
#define count_0(p) __builtin_ctzll(p)
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll power(ll x,ll y,ll p);
const ll inf=999999999;
const ll mod=1e9+7;
bool tc=false;

void solve()
{
    ll n; cin>>n;
    vector < pair<ll,ll> > vtr(n);
    for(ll i=0;i<n;i++)
        cin>>vtr[i].fi>>vtr[i].se;
    ll ct=0;
    for(ll i=0;i<=n-3;i++)
    {
        if(vtr[i].fi==vtr[i].se)
        if(vtr[i+1].fi==vtr[i+1].se)
        if(vtr[i+2].fi==vtr[i+2].se)
        {
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}

int main() 
{
    FASTIO1;
    FASTIO2;
    clock_t start=clock();
    ll t=1; 
    if(tc) cin>>t;
    while(t--)
        solve();
    cerr<<fixed<<setprecision(6);
    cerr<<(double)(clock()-start)/CLOCKS_PER_SEC<<endl;
    return 0;
}

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


Measured memory_bytes: 3788
def main():
    n=int(input())
    p=list(map(int, input().split()))
    count = 0
    for i in range(1, n-1):
        if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
            count += 1
    print(count)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060