akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <string>
#include <map>
#include <queue>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  int ans = 35;
  for (int i = 0; i < n; i++)
  {
    cin >> x; 
    int sum = 0;
    while ( x % 2 == 0) {
      sum ++;
      x /= 2;
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;

}


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

using namespace std;
using lli = int_fast64_t;
using ulli = unsigned long long;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;

constexpr lli plusScore = (lli)1e6;

constexpr size_t asize = 26;
int main() {
	size_t D;
	cin >> D;
	vector<lli> C(asize);
	for (lli& i : C)cin >> i;
	vector<vector<lli>> S(D, vector<lli>(asize));
	for (auto& arr : S) {
		for (lli& i : arr) {
			cin >> i;
		}
	}

	vector<lli> T(D);
	for (lli& i : T)cin >> i;

	vector<int> lastOpen(asize, -1);


	auto calcScore = [&](const vector<lli>& t) {
		vector<lli> last_open(asize, -1);
		lli score = 0;
		for (int i = 0; i < D; i++) {
			score += S[i][t[i] - 1];
			last_open[t[i] - 1] = i;
			for (int j = 0; j < asize; j++) {
				score -= C[j] * (i - last_open[j]);
			}
			//cout << score << endl;
		}
		return score;
	};
	int M;
	cin >> M;
	while (M--) {
		int d, q;
		cin >> d >> q;
		T[d-1] = q;
		cout << calcScore(T) << endl;
	}
	return 0;
}



Measured memory_bytes: 3688
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
      	int cnt0 =0;
      	int cnt1 =0;
		String S = sc.next();
		for(int i=0;i<S.length();i++){
        	if(S.charAt(i)=='0'){
        		cnt0++;
        	}else{
        		cnt1++;
        	}
        }
      	if(cnt0>cnt1){
        	System.out.println(cnt1*2);	
        }else{
        	System.out.println(cnt0*2);
        }
      
      
    }
}

Measured memory_bytes: 25812
#include <stdio.h>
#include <math.h>

void InputNumber(double* number, double limitLow, double limitHigh);
double GetArea(double number);
double GetCirLen(double number);

int main(void) {
    double r;

    InputNumber(&r, 0.0, 10000.0);
    printf("%.6lf %.6lf\n", GetArea(r), GetCirLen(r));
}


void InputNumber(double* number, double limitLow, double limitHigh) {

    double x;
    do {
        scanf("%lf", &x);
    } while (x <= limitLow || x >= limitHigh);
    *number = x;
}

double GetArea(double number) {
    return M_PI * number * number;
}

double GetCirLen(double number) {
    return 2 * M_PI * number;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

struct Edge{
  int to;
  long long cost;
};

vector<Edge> g[100001];
int prenum[100001],parent[100001],lowest[100001],visited[100001],cnt = 1,child[100001];

void Articulation_Points(int k,int p){
  visited[k] = true;
  prenum[k] = cnt;
  lowest[k] = cnt;
  ++cnt;
  for (auto&& n : g[k]) {
    if(!visited[n.to]){
      parent[n.to] = k;
      Articulation_Points(n.to,k);
      child[k]++;
      lowest[k] = min(lowest[k],lowest[n.to]);
    }
    else if(n.to != p){
      lowest[k] = min(lowest[k],prenum[n.to]);
    }
  }
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ,a,b,e;
  cin >> n >> e;
  rep(i,e){
    cin >> a >> b;
    g[a].push_back({b,0LL});
    g[b].push_back({a,0LL});
  }
  Articulation_Points(0,-1);
  set<int> ans;
  int np = 0;
  for (int i = 1; i < n; i++) {
    int p = parent[i];
    if(p == 0){
      ++np;
    }
    else{
      if(prenum[p] <= lowest[i]){
        ans.insert(p);
      }
    }
  }
  if(np > 1) ans.insert(0);
  for (auto&& k : ans) {
    std::cout << k << std::endl;
  }
  return 0;
}

Measured memory_bytes: 8448
// C - Alchemist
#include <stdio.h>

int main(){
    int i, j, n, temp;
    double v[51];
    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%lf", &v[i]);
    
    for(i=0; i<n; i++){
        for(j=n-1; j>i; j--){
            if(v[j]<v[j-1]){
                temp=v[j-1];
                v[j-1]=v[j];
                v[j]=temp;
            }
        }
    }
    for(i=0; i<n-1; i++){
        v[i+1] = (v[i]+v[i+1])/2;
    }
    printf("%.5f\n", v[n-1]);
    return 0;
}

Measured memory_bytes: 128
import sys
n = int(sys.stdin.readline())
hl = list(map(int, sys.stdin.readline().split()))

cnt = 0
maxv = 0
for i in range(n-1):
    if hl[i] >= hl[i+1]:
        cnt +=1
    else:
        cnt = 0
    if maxv <cnt:
        maxv = cnt
print(maxv)

Measured memory_bytes: 14168
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

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

    for (int h=1; h<=3500; h++) {
        for (int n=1; n<=3500; n++) {
            long long a = N * h * n, b = 4 * h * n - N * n - N * h;
            if (b > 0 and a % b == 0) return cout << h << " " << n <<  " " << a/b << " " << endl, 0; 
        }
    }

    return 0;
}


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

int sum(int beg, int end) {
	int ans = 0;
	for (int i=beg; i<end;i++) {
		ans += V[i];
	}
	return ans;
}

int main(){

	int n,k;
	string s;

	cin>>n>>k>>s;

	int cnt = 1;
	rep(i, (int)s.size()-1) {
		if (s[i]==s[i+1]) {
			cnt++;
		} else {
			V.push_back(cnt);
			cnt = 1;
		}
	}
	// どうせ最後のやつが挿入されていないので
	V.push_back(cnt);

	// rep(i, (int)V.size()) {
	// 	cout << V[i] << " ";
	// }

	int ma = 0;
	if (s[0]=='0') {
		ma = sum(0, min((int)V.size(), 2*k));
		for (int beg = 1; beg < (int)V.size(); beg+=2) {
			ma = max (ma, sum(beg, 
							  min(beg+2*k+1, (int)V.size())));
		}
	} else {
		for (int beg = 0; beg < (int)V.size(); beg+=2) {
			ma = max (ma, sum(beg, 
							  min(beg+2*k+1, (int)V.size())));
		}
	}

	cout << ma << endl;
}

Measured memory_bytes: 1020
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <climits>

int main()
{
  int n;
  std::string s;
  std::cin >> n >> s;
  std::vector<int> nblack;
  std::vector<int> nwhite(n);
  int black_cnt = 0;
  int white_cnt = 0;
  for (char ch : s) {
    if (ch == '#') {
      black_cnt++;
    }
    nblack.push_back(black_cnt);
  }
  for (int i = (int)s.size()-1; 0 <= i; i--) {
    if (s.at(i) == '.') {
      white_cnt++;
    }
    nwhite.at(i) = white_cnt;
  }
  int ans = INT_MAX;
  ans = std::min(ans, nwhite.at(0));
  for (int i = 1; i < n; i++) {
    ans = std::min(ans, nblack.at(i-1) + nwhite.at(i));
  }
  ans = std::min(ans, nblack.at(n-1));
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;

int main(){
int p,q,r;
  cin>>p>>q>>r;
  
 int a1,a2,a3; a1=p+q;
  a2=q+r;
  a3=p+r;
  cout<<min(a1,min(a2,a3));
}


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

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rreb(i,b,n) for(int i = b-1; i >= n; i--)
#define rrep(i,n) reb(i,n,0)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v) for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;

using namespace std;
using std::stringstream;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;}
template<class T> inline T sqr(T x) {return x*x;}

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
/* -------------------------------------------------------------------------- */

int main(int argc, char *argv[])
{
#define NUM (5)
    int in[NUM];
    rep(i, NUM) { cin >> in[i]; }
    int k;
    cin >> k;

    bool ret = true;
    rep(i, NUM-1) {
        reb(j, i+1, NUM) {
            if (in[j] - in[i] > k) ret = false;
        }
    }

    if (ret) cout << "Yay!" << endl;
    else cout << ":(" << endl;

    return 0;
}


Measured memory_bytes: 256
//E
//by Cydiater
//2017.6.3
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define up(i,j,n)	for(ll i=j;i<=n;i++)
#define down(i,j,n)	for(ll i=j;i>=n;i--)
#define cmax(a,b)	a=max(a,b)
#define cmin(a,b)	a=min(a,b)
#define pii		pair<ll,ll>
#define fi		first
#define se		second

const ll MAXN=305;
const ll oo=0x3f3f3f3f;
const ll mod=1e9+7;

ll f[MAXN][MAXN][MAXN],N,M,ans=0;
vector<pii>pre[MAXN];

namespace solution{
	bool ok(ll r,ll g,ll b){
		ll p=max(r,max(g,b));
		up(i,0,(int)pre[p].size()-1){
			ll l=pre[p][i].fi,c=pre[p][i].se;
			if(r>=l)c--;
			if(g>=l)c--;
			if(b>=l)c--;
			if(c!=0)return 0;
		}
		return 1;
	}
	void Prepare(){
		scanf("%lld%lld",&N,&M);
		up(i,1,M){
			ll l,r,c;
			scanf("%lld%lld%lld",&l,&r,&c);
			pre[r].push_back(make_pair(l,c));
		}
	}
	void Solve(){
		f[1][0][0]=f[0][1][0]=f[0][0][1]=1;
		up(i,1,N){
			up(x,0,i)up(y,0,i){
				if(!ok(x,y,i))f[x][y][i]=0;
				(f[x][y][i+1]+=f[x][y][i])%=mod;
				(f[x][i+1][i]+=f[x][y][i])%=mod;
				(f[i+1][y][i]+=f[x][y][i])%=mod;
				if(!ok(x,i,y))f[x][i][y]=0;
				(f[x][i][i+1]+=f[x][i][y])%=mod;
				(f[x][i+1][y]+=f[x][i][y])%=mod;
				(f[i+1][i][y]+=f[x][i][y])%=mod;
				if(!ok(i,x,y))f[i][x][y]=0;
				(f[i][x][i+1]+=f[i][x][y])%=mod;
				(f[i][i+1][y]+=f[i][x][y])%=mod;
				(f[i+1][x][y]+=f[i][x][y])%=mod;
			}
		}
		up(i,0,N-1)up(j,0,N-1)(ans+=f[N][i][j]+f[i][N][j]+f[i][j][N])%=mod;
		cout<<ans<<endl;
	}
}

int main(){
	using namespace solution;
	Prepare();
	Solve();
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  int n = N;
  int fX = 0;
  while (0 < n)
  {
    fX += n%10;
    n = (n - n%10)/10;
  }
  cout << ((0 == N%fX) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

bool pcomp(pair<int,int>& f, pair<int, int>& s){
  return double(f.second)/double(f.first) > double(s.second)/double(s.first);
}

int main(){
  int n,t;
  cin >> n >> t;
  vector<pair<int, int>> ab(n);
  for(int i = 0; i < n; i++){
    int a,b; cin>> a >> b;
    ab[i] = {a,b};
  }
  // sort(ab.begin(), ab.end(), pcomp);
  vector<vector<int>> dpa(n+1, vector<int>(t, 0));
  vector<vector<int>> dpb(n+1, vector<int>(t, 0));

  for(int i = 0; i < n; i++){
    int a = ab[i].first;
    int b = ab[i].second;
    for(int cur = t-1; cur >= 0; cur--){
      if(cur+a >= t) continue;
      dpa[i+1][cur+a] = max(dpa[i][cur]+b, dpa[i+1][cur+a]);
    }
    for(int cur = 1; cur < t; cur++){
      dpa[i+1][cur] = max(dpa[i+1][cur], dpa[i+1][cur-1]);
      dpa[i+1][cur] = max(dpa[i][cur], dpa[i+1][cur]);
      // cout << dpa[i+1][cur] << " ";
    }
    // cout << endl;
  }
  for(int i = 0; i < n; i++){
    int a = ab[n-1-i].first;
    int b = ab[n-1-i].second;
    for(int cur = t-1; cur >= 0; cur--){
      if(cur+a >= t) continue;
      dpb[i+1][cur+a] = max(dpb[i][cur]+b, dpb[i+1][cur+a]);
    }
    for(int cur = 1; cur < t; cur++){
      dpb[i+1][cur] = max(dpb[i+1][cur], dpb[i+1][cur-1]);
      dpb[i+1][cur] = max(dpb[i][cur], dpb[i+1][cur]);
      // cout << dpb[i+1][cur] << " ";
    }
    // cout << endl;
  }

  int maxi = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < t; j++){
      if(maxi < dpa[i][j] + dpb[n-1-i][t-1-j] + ab[i].second){
        maxi = dpa[i][j] + dpb[n-1-i][t-1-j] + ab[i].second;
      }
    }
  }
  cout << maxi << endl;
}


Measured memory_bytes: 70912
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a;
    cin >> a;
    cout << (a/2) * ((a+1)/2) ;
    cout << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int Alice = 0;
  int Bob = 0;
  
  for (int i = 0; i < N; i++) {
    if (i%2 == 0) {
      Alice += vec.at(i);
    }
    else {
      Bob += vec.at(i);
    }
  }
  int answer;
  answer = Alice - Bob;
  cout << answer << endl;
    
}


Measured memory_bytes: 256
import std.stdio : write, writeln, writefln, stdin;
import std.array;
import std.range;
import std.typecons;
import std.algorithm : max, min;

void main(){
	while(true){
		int n = next!int();
		if(n==0){ break; }
		
		int[] buf = repeat(0).take(n).array;
		int max_;
		for(int y=0; y<n; ++y){
			string s = next!string();
			int[] d = repeat(0).take(n).array;
			if(s[0]=='.') d[0]=1;
			for(int x=1; x<n; ++x){
				if(s[x]=='.'){
					int min_ = 1<<28;
					min_ = min(min_, d[x-1]);
					min_ = min(min_, buf[x-1]);
					min_ = min(min_, buf[x]);
					d[x] = min_+1;
					
					max_ = max(max_, d[x]);
				}
			}
			buf = d.dup;
		}
		
		writeln = max_;
	}
}


import std.stdio : readln, chomp;
import std.conv : to;
import std.string : split;
shared string[] input;
shared string delim = " ";
T next(T)()
in
{
	assert(hasNext());
}
out
{
	input.popFront;
}
body
{
	return input.front.to!T;
}

void next(T)(ref T v){
	v = next!T();
}

bool hasNext(){
	if(input.length > 0){
		return true;
	}
	
	string str = readln;
	if(str.length > 0){
		input ~= str.chomp.split(delim);
		return true;
	}else{
		return false;
	}
}


void dbg(T...)(T vs)
{
	import std.stdio : stderr;
	foreach(v; vs)
		stderr.write(v.to!string ~ " ");
	stderr.write("\n");
}

T clone(T)(T v){
	T v_;
	static if(isInputRange!(T)){
		foreach(ite; v){
			v_ ~= ite.clone;
		}
	}else{
		v_ = v;
	}
	
	return v_;
}

Measured memory_bytes: 2072
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int T = sc.nextInt();
        int A = sc.nextInt();
        
        double nearest = Double.MAX_VALUE;
        int ans = 0;
        for(int i = 1; i <= N; i++){
            int H = sc.nextInt();
            double avg = T - H * 0.006;
            
            if( nearest > Math.abs(A - avg) ){
                nearest = Math.abs(A - avg);
                ans = i;
            }
        }
        
        System.out.println(ans);
        
    }
}


Measured memory_bytes: 22480
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

int main() {

    LL n;
    cin >> n;

    LL ans = 0;

    for (LL r = 1; r * r <= n; r++) {
        if ((n - r) % r == 0
            and (n - r) / r > r) {
            ans += (n - r) / r;
            }
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
int main(){
    cin>>a>>b>>c;
    if(c>a+b&&(a+b-c)*(a+b-c)>4*a*b) cout<<"Yes";
    else cout <<"No";
}
//a+b+2sqrt(ab)<c
//a+b-c<2sqrt(ab)
//(a+b-c)^2<4ab
//同时,a+b-c<0,才使a+b-c<2sqrt(ab)

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
  int a[1200], b[1200], n, i, j, k;
  for(i = 0; i < 1200; ++i) a[i] = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    int d;
    scanf("%d", &d);
    for(j = 0; j < 1200; ++j) b[j] = 0;
    for(j = 2; j <= sqrt(d); ) {
      if(!(d % j)) ++b[j], d /= j;
      else ++j;
    }
    b[d]++;
    for(j = 2; j <= 1000; ++j) if(b[j] > a[j]) a[j] = b[j];
  }
  long long ans = 1;
  for(j = 2; j <= 1000; ++j) if(a[j]) ans *= (long long)pow(j, a[j]);
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 2856
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, i] = [int(input_raw[0]), int(input_raw[1])]
    print N - i + 1
if __name__ == '__main__':
    main()

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

int main(){
	int H, W;
	
	while(true){
		cin >> H >> W;

		if(H == 0 && W == 0) break;

		for(int i = 0; i < H; i++){
			for(int ii = 0; ii < W; ii++){
				if(0 < i && i < H - 1 && 0 < ii && ii < W -1){
					cout << ".";
				}else{
					cout << "#";
				}
			}
			cout << endl;
			
		}

		cout << endl;
	}
	
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  
  int d;
  for (int i = 0; i < N; i++) {
    cin >> d;
    vec.at(i) = d;
  }
  
  sort(vec.begin(), vec.end());
  
  int x = 1;
  
  for (int i = 0; i < N; i++) {
    if (!i == 0) {
      if (vec.at(i) > vec.at(i - 1)) {
        x++;
      }
    }
  }
  
  cout << x << endl;
}


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

const int MAXN = 55;

int n, m;
string a[MAXN], b[MAXN];

bool check(int x, int y) {
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < m; j++) {
			if (a[x + i][y + j] != b[i][j])
				return 0;
		}
	}
	return 1;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++)
		cin >> b[i];
	for (int i = 0; i <= n - m; i++) {
		for (int j = 0; j <= n - m; j++) {
			if (check(i, j)) {
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}


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

int main(int, char**) {
  int N;
  cin >> N;

  int sum = 0;
  int div = N;
  while (div) {
    sum += div % 10;
    div /= 10;
  }

  if (N % sum)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a, b, i, c;
  char op;
  while(1){
    scanf("%d %c %d",&a,&op,&b);
    if(op=='?') break;
    
    else if(op=='+'){
      c=a+b;
    }else if(op=='-'){
      c=a-b;
    }else if(op=='*'){
      c=a*b;
    }else if(op=='/'){
      c=a/b;
    }
    
    printf("%d\n",c);
  }

return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int mmax = 0;
    int c = 0;
    rep(i, n) {
        int h; cin >> h;
        if (h >= mmax) {
            mmax = h;
            c++;
        }
    }
    cout << c << endl;
}


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

double i,j,a,b,c,d,e,f;
double x,y;

int main(){
	/*while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
		x=(c*e-f*b)/(a*e-d*b);
		y=(c-a*x)/b;
		printf("%.3lf %.3lf\n",x,y);
	}*/
	while (scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF) {
		y = (c * d - a * f) / (b * d - e * a);
		x = (c - (b * y)) / a;
		
		printf("%.3lf %.3lf\n",x,y);
	}	
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#define llint long long

using namespace std;

llint n, m;
llint cnt[100005];
bool flag[100005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	llint p; string s;
	llint pena = 0, ac = 0;
	for(int i = 1; i <= m; i++){
		cin >> p >> s;
		if(flag[p]) continue;
		if(s == "AC") pena += cnt[p], ac++, flag[p] = true;
		else cnt[p]++;
	}
	cout << ac << " " << pena << endl;
	
	return 0;
}

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

int main()
{
  int a, b;
   std::string c;
  cin >> a >> b;
    if (a >= b) {
      for (int i = 0; i < a; i++) {
        cout<< b;
      }
    } else {
      for (int i = 0; i < b; i++) {
        cout<<a;
      }
    }
    cout << endl;
}


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

int main(void){
    string s;
    cin >> s;
    int count = 0;
    if(s[0] == '1')count += 1;
    if(s[1] == '1')count += 1;
    if(s[2] == '1')count += 1;
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<vector>
using namespace std;
const long long INF=20000000000;
typedef pair<long long,int> Pa;
int main(){
	int N;
	long long ans=3;
	char S[2][52];
	cin>>N;
	for(int i=0;i<2;++i){
		for(int j=0;j<N;++j){
			cin>>S[i][j];
		}
	}
	if(S[0][0]!=S[1][0])ans*=2;
	for(int i=1;i<N;++i){
		if(S[0][i]==S[1][i]&&S[0][i-1]==S[1][i-1])ans=(ans*2)%1000000007;
		if(S[0][i]!=S[1][i]&&S[0][i-1]==S[1][i-1])ans=(ans*2)%1000000007;
		if(S[0][i]!=S[1][i]&&S[0][i-1]!=S[1][i-1]&&S[0][i]!=S[0][i-1])ans=(ans*3)%1000000007;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		ArrayList<Town> towns = new ArrayList<Town>();
		for(int i = 0;i < n;i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			Town town = new Town(i, x, y);
			towns.add(town);
		}
		
	ArrayList<Double> ans = new ArrayList<Double>();
	for(int i = 0;i < n;i++){
		Town town = towns.get(i);
		HashSet<Integer> set = new HashSet<>();
		set.add(i);
		dfs(ans, towns, i, town.x, town.y, set, n, (double)0);
	}
	
	
	double num = 0;
	
	
	for(int i = 0;i < ans.size();i++){
		num += ans.get(i);
	}
//	System.out.println(num);
	System.out.println(num/ans.size());

		


		




	}
	
	
	static void dfs(ArrayList<Double> ans,ArrayList<Town> towns,int index,int cx,int cy,HashSet<Integer> used,int n,double score){
		if(used.size() == n){
			ans.add(score);
			return;
		}
//		System.out.println(score);
		for(int i = 0;i < n;i++){
			if(!used.contains(i)){
				used.add(i);
				Town town = towns.get(i);
				
				dfs(ans, towns,i, town.x, town.y, used, n, score+Math.sqrt(Math.abs(cx-town.x)*Math.abs(cx-town.x) + Math.abs(cy-town.y)*Math.abs(cy-town.y)));
				used.remove(i);
			}
		}
		
		
		
	}

	static void sieve(ArrayList<Long> list){
		int n = 50000000;
		boolean[] is_prime = new boolean[n+1];
		int[] prime = new int[n];
		for(int i= 0;i <=n;i++){
			is_prime[i] = true;
		}
		list.add((long) 1);
		for(int i = 2;i <= n;i++){
			if(is_prime[i]){
				list.add((long)i);
				for(int j = 2*i;j <= n;j+=i){
					is_prime[j] = false;
				}
			}
		}



	}




	static int upperbond(int k,int min,int[] data){		//kより小さい最大の値をdataの中から探し、返す二分探索
		int max = data.length;
		//		if(min == data.length-1){
		//			if(data[min] > k){
		//				return min;
		//			}
		//		}

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;
	}

	static int lowerbond(int k,int min,int[] data){		//kより大きい最小の値をdataの中から探し、返す二分探索
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return min;
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}

class Town{
	int index;
	int x ;
	int y;
	public Town(int index,int x,int y) {
		this.index = index;
		this.x = x;
		this.y = y;
		// TODO 自動生成されたコンストラクター・スタブ
	}
	
	
}


class Edge extends ArrayList<P>{

}

class P{
	int to;
	long cost;
	P(int to,long cost){
		this.to = to;
		this.cost = cost;
	}
}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   from- otherpair.from;
	}








}






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

using namespace std;

static const int MAX = 15;
int N;
int judge(int num, vector<int>& T);
vector< vector<int> > M(MAX, vector<int>(MAX, -1));


int main() {

    cin >> N;

    int iter;
    for (int i =0; i < N; i++) {
        cin >> iter;
        for (int j = 0; j < iter; j++) {
            int a, b;
            cin >> a >> b;
            a--;
            M[i][a] = b;
        }
    }

    int ans = 0;
    for (int bit = 0; bit < (1 << N); bit++) {

        vector<int> T(N, -1);  // judge vec

        for (int i = 0; i < N; i++) {
            if (bit & (1 << i)) {
                T[i] = 1;
            }
            else {
                T[i] = 0;
            }
        }
        int can = 1;  // Flag
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if (T[i] == 1) {
                cnt++;
                can *= judge(i, T);
            }
        }
        if (can) {
                ans = max(ans, cnt);
        }
    }

    cout << ans << '\n';

}

int judge(int num, vector<int>& T) {

    int can = 1;
    for (int i = 0; i < N; i++) {

        if (M[num][i] == -1) {
            continue;
        }
        else if (T[i] != M[num][i]) {
            can = 0;
            break;
        }
    }
    return can;

}


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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int maxn = 100+10;
const int maxk = 100000+10;
const ll mod = 1000000000+7;
int N,K,A[maxn];
ll dp[maxn][maxk];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> K;
	forn(i,1,N+1)cin >> A[i];
	dp[0][0] = 1;
	forn(i,1,N+1){
		forn(j,0,K+1){
			int r = j;
			int l = r-min(A[i],j); l--;
			dp[i][j] = dp[i-1][r];
			if(l >= 0){
				dp[i][j] -= dp[i-1][l];
				dp[i][j] %= mod;
			}
		}
		forn(j,1,K+1){
			dp[i][j] += dp[i][j-1];
			dp[i][j] %= mod;
		}
	}
	ll res = dp[N][K];
	while(res < 0)res += mod;
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 79360
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>

using namespace std;


int main()
{
	long long int n, m, a[2000000];
	cin >> n>>m;
	cout <<n-m+1 ;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
   int n,i,j,a[1000][1000],d,p[1000],u[1000],f;
 
   scanf("%d",&n);
   for (i=0;i<n;i++) {
      for (j=0;j<n-1;j++) {
         scanf("%d",&a[i][j]);
         a[i][j]--;
      }
      p[i]=0;
   }

   for (d=0;;d++) {
       for (f=i=0;i<n;i++) 
          if (p[i]<n-1) u[i]=f=1;
          else          u[i]=0;
       if (!f) break;
       for (f=i=0;i<n;i++) {
          if (!u[i]) continue;
          j=a[i][p[i]];
          if (u[j] && a[j][p[j]]==i) {
             u[i]=u[j]=0;
             p[i]++;p[j]++;
             f=1;
          }
       }
       if (!f) {
         d=-1;
         break;
       }
   }
   printf("%d\n",d);
   return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <functional>

using namespace std;

int N;
int F[100][14];
int P[100][15];

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

    int N,K;
    int balls[200020];
    int ballsCount[200020];
    int rewriteCount=0;
    std::set<int> kinds;


    scanf("%d %d",&N,&K);
    for(int i=0;i<200020;i++){
        ballsCount[i]=0;
    }
    for(int i=0;i<N;i++){
        scanf("%d",&balls[i]);
        ballsCount[balls[i]-1]+=1;
        kinds.insert(balls[i]);
    }

    std::vector<int> x;
    if(kinds.size()>K) {
        int count = 0;
        sort(ballsCount, ballsCount + 200020, greater<int>());


        for (int i = 0; i < 200020; i++) {
            if (ballsCount[i] != 0) {
                x.emplace_back(ballsCount[i]);
            } else {
                break;
            }
        }

        std::sort(x.begin(), x.end());

        int index = 0;
        while (true) {
            if (kinds.size() - index <= K) {
                break;
            }
            rewriteCount += x[index];
            index++;
        }

    }
    printf("%d\n",rewriteCount);

    return 0;
}


Measured memory_bytes: 12408
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    int n;
    cin>>n;

    int ans = 0;

    for (int i=1; i<=n; i++){
        int curr;
        cin>>curr;
        if (i%2 && curr%2) ans++;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3648
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    int h,w;cin>>h>>w;
    vector<string> s(h),r(h),b(h);
    string tmp="";
    for(int i=0;i<w;++i)tmp = tmp+'.';
    for(int i=0;i<h;++i){
        cin>>s[i];
        r[i] = tmp;
        b[i] = tmp;
    }
    for(int i=0;i<w;++i){
        r[0][i] = '#';
        b[h-1][i] = '#';
    }
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            if(j%2==0&&i!=0&&i!=h-1){
                r[i][j] = '#';
            }
            if(j%2==1&&i!=0&&i!=h-1){
                b[i][j] = '#';
            }
            if(s[i][j]=='#'){
                r[i][j] = s[i][j];
                b[i][j] = s[i][j];
            }
        }
    }
    for(int i=0;i<h;++i){
        cout<<r[i]<<endl;
    }
    cout<<endl;
    for(int i=0;i<h;++i){
        cout<<b[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	for (int n = 1;n<10;++n) {
		if (111*n>=N) {
			cout << 111*n<<endl;
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

int main() {
    int n,s;
    cin>>n>>s;
    if(n*500>=s)cout<<"Yes";
    else cout<<"No";
//	cout<<sum<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

void z_alg(string s, vll &v) {
	ll n = s.size();
	v[0] = n;
	ll cnt = 0;
	for (ll i = 1; i < n; i++) {
		for (ll j = i + cnt; j < n; j++) {
			if (s[j] != s[j - i]) {
				cnt = j - i;
				break;
			}
			if (j == n - 1) cnt = n - i;
		}
		v[i] = cnt;
		if (cnt == 0) continue;
		for (ll j = i + 1; j < n; j++) {
			if (j - i + v[j - i] < cnt) {
				v[j] = v[j - i];
				if (j == n - 1) return;
			}
			else {
				cnt -= j - i;
				i = j - 1;
				break;
			}
		}
	}
}

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

	ll n;
	string s;
	cin >> n >> s;

	vector<vll> v(n);
	for (ll i = 0; i < n; i++) {
		v[i].resize(n - i);
		string t = s.substr(i);
		z_alg(t, v[i]);
	}

	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < n - i; j++) {
			ll x = min(j, v[i][j]);
			ans = max(ans, x);
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 98048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x,y;cin >> x >> y;
	ll ans=1,k=x;
	while(true){
		if(k*2<=y){
			ans++;
			k*=2;
		}
		else break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
function fact()
    n,m=map(x->parse(Int,x),split(readline()))
    h=map(x->parse(Int,x),split(readline()))
    ma=zeros(Int,n)
    for i=1:m
        a,b=map(x->parse(Int,x),split(readline()))
        ma[a]=max(ma[a],h[b])
        ma[b]=max(ma[b],h[a])
    end
    ans=0
    for i=1:n
        ans += h[i]>ma[i]
    end
    print(ans)
end
fact()


Measured memory_bytes: 201344
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________
template <typename T = long long, const int sz = 5 * 10000000> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline string read_str() {
        string res;
        while(*now and *now != '\n' and *now != ' ') res += *now++;
        now++;
        return res;
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
    inline void write_str(string s, char margin = ' ') {
        for(auto c : s) putchar(c);
        putchar(margin);
    }
};
IO<int> io;
int n, m, k;
constexpr int MAX = 1e9 + 1;
constexpr int N = 200010;
int a[N], b[N];
main() {
    n = io.read(), m = io.read(), k = io.read();
    rep(i, n) a[i+1] = io.read();
    rep(i, m) b[i+1] = io.read();
    rep(i, n) {
        a[i + 1] = a[i + 1] + a[i];
        if(a[i + 1] > k) {
            n = i;
            break;
        }
    }
    rep(i, m) {
        b[i + 1] = b[i + 1] + b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    int now = n;
    int ans = now;
    for(int i = 1; i <= m; i++) {
        while(b[i] + a[now] > k) now--;
        ans = max(ans, i + now);
    }
    io.write(ans);
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;


const ll mod=1e9+7;
const ll inf=1e16; 

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

ll n,m;
vll a;


int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  cin >> n >> m;
  a.resize(n);
  map<ll,ll> mp;
  rep(i,0,n) {
    cin >> a[i];
    ll x=a[i],c=0;
    while(x%2==0) x/=2,c++;
    mp[c]++;
  }
  for(auto p:mp){ 
  if(p.second!=n){
    cout << 0 << endl;
    return 0;
  }
  }
  ll lcm=1;
  rep(i,0,n) lcm = (a[i]/2)/__gcd(lcm,(a[i]/2))*lcm;
    
  
  cout << (m/lcm+1)/2 << endl;
  
  
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

def parent(i):
    return i // 2

def left(i):
    return 2*i

def right(i):
    return 2*i + 1

def maxHeapify(A, i):
    global H
    l = left(i)
    r = right(i)
    if l <= H and A[l] > A[i]:
        largest = l
    else:
        largest = i
    if r <= H and A[r] > A[largest]:
        largest = r

    if largest != i:
        A[i], A[largest] = A[largest], A[i]
        maxHeapify(A, largest)

def buildMaxHeap(A):
    for i in range(H//2, 0, -1):
        maxHeapify(A, i)


if __name__ == '__main__':

    H = int(input())
    A = [None] + [int(i) for i in input().split(" ")]

    buildMaxHeap(A)

    print(" " + " ".join(map(str, A[1:])))


Measured memory_bytes: 64184
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int c = 1000000001;
  int a;
  for(int i = 0; i < N; i++){
    cin >> a;
    int j = 0;
    while(a % 2==0){
      a /= 2;
      j++;
    }
    if(j < c)
      c = j;
  }
  cout << c << endl;
}
      
          
      


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

string to_string(string s){
    string t = "";
    for(auto c: s)
        t += tolower(c);
    return t;
}

int main(){
    string w; cin >> w;
    string t;
    
    w = to_string(w);
    
    int ans = 0;
    while(cin >> t, t != "END_OF_TEXT"){
        t = to_string(t);
        ans += t == w;
    }
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3212
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y, int md = MOD){x += y; if(x >= md) x -= md;}
void sub_self(int &x, int y, int md = MOD){x -= y; if(x < 0) x += md;}
void mul_self(int &x, int y, int md = MOD){x = x * 1LL * y % md;}
inline int mul(int x, int y, int md = MOD){return x * 1LL * y % md;}
inline int add(int x, int y, int md = MOD){x += y; if(x >= md) x -= md; return x;}
inline int sub(int x, int y, int md = MOD){x -= y; if(x < 0) x += md; return x;}

const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};

vector<int> read(int n, int k){
	vector<int> vec(n);
	for(int i = 0; i < k; ++i) cin >> vec[i];
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	for(int i = k; i < n; ++i)
		vec[i] = (a * 1ll * vec[i - 2] + b * 1ll * vec[i - 1] + c) % d;
	return vec;
}

void solve(){

	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll res = max({a * c, a * d, b * c, b * d});
	cout << res << "\n";
	return;
}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	// freopen("input.in", "r", stdin);
	// freopen("output.out", "w", stdout);

	int t;
	t = 1;
	// cin >> t;
	// pre();
	for(int i = 1; i <= t; ++i){
		// cout << "Case #" << i << ": ";
		solve();
		// cout << '\n';
		// cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3652
L,R = map(int,input().split())
if R-L+1>=2019:
    print(0)
else:
    R = R%2019
    L = L%2019
    if R<L:
        print(0)
    else:
        cmin = 2019
        for i in range(L,R):
            for j in range(L+1,R+1):
                cmin = min(cmin,(i*j)%2019)
        print(cmin)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
    cin>>str;
    if(str.find("E")!=string::npos&&str.find("W")==string::npos)puts("No");
    else if(str.find("E")==string::npos&&str.find("W")!=string::npos)puts("No");
    else if(str.find("N")==string::npos&&str.find("S")!=string::npos)puts("No");
    else if(str.find("N")!=string::npos&&str.find("S")==string::npos)puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>P;
vector<P>vec;
vector<int>b;
long long sum[100009],s[100009];

int main(){
  int n,q;
  int a[100009];
  cin>>n>>q;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b.push_back(a[i]);
  }
  for(int i=1;i<=n;i++){
    int idx=n-i;
    if(idx-i+1>=0){
      int mid=(a[idx]+a[idx-i+1])/2;
      vec.push_back(P(mid,i));
    }
  }
  sort(vec.begin(),vec.end());
  reverse(b.begin(),b.end());
  for(int i=0;i<n;i++){
    if(i>0){
      sum[i]=sum[i-1];
      s[i]=s[i-1];
    }
    sum[i]+=b[i];
    if(i%2==0)s[i]+=b[i];
  }

  for(int i=0;i<vec.size();i++){
    //cout<<vec[i].first<<' '<<vec[i].second<<endl;
  }

  for(int i=0;i<q;i++){
    int x;
    cin>>x;
    int idx=upper_bound(vec.begin(),vec.end(),P(x,0))-vec.begin();
    //cout<<idx<<endl;
    int t=vec[idx].second;
    //cout<<t<<endl;
    long long ans=sum[t-1];
    //if(t*2<n)ans+=s[t*2];
    if(t*2<n&&t*2-1>=0)ans+=s[n-1]-s[t*2-1];
    if(t*2<n&&t*2==0)ans+=s[n-1];
    cout<<ans<<endl;
  }

  return(0);
}


Measured memory_bytes: 4600
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>

using namespace std;


int main()
{
	string str;
    int n,k, i;

    cin >> n;
	cin >> str;
	cin >> k;

	for( i = 0; i < n; i++ ){
		if( str[i] != str[k-1] ){
			str[i] = '*';
		}
	}

	cout << str << endl;

    return 0;
}

Measured memory_bytes: 256
N =int(input())
x=0
y=0
while N//10**(y+1)>0:
    y=y+1
if N==10**y:
    print(10)
else:
    while y>=0:
        x=x+N//10**y
        N=N-(10**y)*(N//10**y)
        y=y-1
    print(x)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;

	int ans = max({ A + B, A - B, A * B });
	cout << ans << endl;
}







Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N, M, Q;
int a[50], b[50], c[50], d[50];

int ans = 0;
int tmp[10];
void solve(int n, int bef){
    if(n == N){
        int x = 0;
        rep(i, Q){
            if(tmp[b[i]] - tmp[a[i]] == c[i]){
                x += d[i];
            }
        }
        ans = max(ans, x);
        return;
    }
    for(int i=bef; i<=M; i++){
        tmp[n] = i;
        solve(n+1, i);
    }
}

signed main(){
    cin >> N >> M >> Q;
    rep(i, Q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }
    solve(0, 1);
    cout << ans << endl;
}

Measured memory_bytes: 3640