akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

int MEMO[MEM_SIZE];
int DFS(int N)
{
  if(N == 1)
  {
    return 1;
  }
  else if(N == 0)
  {
    return 2;
  }
  if(MEMO[N] != 0)
  return MEMO[N];
  
  
  return MEMO[N] = (DFS(N-1) + DFS(N-2));
}

void solve(void)
{ 
  int N;
  cin>>N;
  cout<<DFS(N)<<endl;
    
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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


int main(){
	int a,b,cnt=0;
	cin>>a>>b;
	for(int i=a; i<=b; ++i){
		int x = i;//12345 x
		int a1=x%10,a2=(x/10)%10,a3=(x/100)%10,a4=(x/1000)%10,a5=x/10000;
		if(a1==a5 && a2==a4){
			cnt++;
		}
	}
	cout<<cnt;
	return 0;	
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

int N, P[8], Q[8], now[8];
int A, B;
int main(){
  for (int i = 0; i < 8; i++) now[i] = i + 1;

  cin >> N;
  for (int i = 0; i < N; i++) cin >> P[i];
  for (int i = 0; i < N; i++) cin >> Q[i];

  int cnt = 0;
  do{
    bool flagA = true, flagB = true;
    for (int i = 0; i < N; i++){
      if (now[i] != P[i]) flagA = false;
      if (now[i] != Q[i]) flagB = false;
    }
    
    if (flagA) A = cnt;
    if (flagB) B = cnt;
    cnt++;
  }while (next_permutation(now, now + N));
  cout << abs(A - B) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
int w,h,x,y,r,f;

scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);

f=0;
if(x+r>w)f=1;
if(y+r>h)f=1;
if(r>x)f=1;
if(r>y)f=1;

if(f==0)printf("Yes\n");
else printf("No\n");

return 0;
}

Measured memory_bytes: 584
#include <math.h> 
#include<iostream>

using namespace std;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    int n,num,y=0;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> num;
        if(IsPrime(num)==1)y++;
    }
    cout << y << endl;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int int64_t

signed main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,a,b,c,d,i;
    cin>>a>>b>>c>>d;

    int ans=max(a*c , b*d);

    if(ans < 0)
    {
        if(a<=0 and b>=0)
            ans=0;
        else if(c<=0 and d>=0)
            ans=0;
        else
            ans=max({a*d,b*d,a*c,b*c});
    }

    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	string s;

	cin>>s;

	int max=0;
	rep(j, s.size()){
		max+=s[j]-'0';
	}

	reprrev(i, 1, s.size()){
		s[i]='0';
		int sum=0;
		string temp=to_string(stoll(s)-1);
		rep(j, temp.size()){
			sum+=temp[j]-'0';
		}
		if(max<sum) max=sum;
	}
	cout<<max<<endl;
}

Measured memory_bytes: 256
class _Node {
  constructor(key, left = null, right = null) {
    this.key = key;
    this.left = left;
    this.right = right;
  }
}

class BinaryTree {
  constructor() {
    this.root = null;
  }

  static get Node() { return _Node; }

  insert(key) {
    this.root = new BinaryTree.Node(key, null, null);
    this.insert = (key) => {
      let x = this.root, y;
      let newNode = new BinaryTree.Node(key, null, null);
      while (x !== null) {
        y = x;
        x = x[key < x.key ? 'left' : 'right'];
      }
      y[key < y.key ? 'left' : 'right'] = newNode;
    }
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.forEach(function(cmd) {
    switch(cmd.charAt(0)) {
    case 'i': tree.insert(Number(cmd.split(' ')[1])); break;
    default: tree.print();
    }
  });
})();



Measured memory_bytes: 197584
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

int main()
{
    int n, k; cin >> n >> k;
    vector<int> h(n);
    ll ans = 0LL;
    for(int i = 0; i < n; ++i) cin >> h[i];

    sort(h.begin(), h.end(), greater<int>());
    for (int i = k; i < n; ++i) ans += (ll)h[i];

    cout << ans << endl;

    return 0;
}



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

int main(){
    ll n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    ll l2,r2;
    vector <ll> l(q),r(q);
    rep(i,q){
        cin >> l2 >> r2;
        l[i]=l2-1;
        r[i]=r2-1;
    }

    int k=0;
    string s2,s3;
    vector <ll> ans(n,0);
    rep(i,n-1){
        s2=s[i];
        s3=s[i+1];
        if(s2=="A" and s3=="C"){
            ++k;
        }
        ans[i+1]=k;
    }

    rep(i,q){
        cout << ans[r[i]]-ans[l[i]] << endl; 
    }

    

    return 0;
}

Measured memory_bytes: 5844
l, r = map(int, input().split())
# 2019 = 3 * 673

rr = min(r, l + 2020)

res = 1000000
for i in range(l, rr+1):
    for j in range(l + 1, rr + 1):
        #print("{0}, {1}".format(i, j))
        if i >= j:
            #print("skip")
            continue

        if res > i*j % 2019:
            #print("{0}, {1}".format(i, j))
            res = i*j % 2019
print(res)

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

int main()
{
	int n;
	cin >> n;
	float a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n-1;i++){
		a[i+1] = (a[i] + a[i+1]) * 1.0 / 2;
	}
	printf("%.6f",a[n-1]);
}

Measured memory_bytes: 256
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int getrev(int x)
{
	if(x==0) return 0;
	int r=1;
	while(x>=r)
	{
		r*=2;
	}
	return (x^(r-1));
}

int solve(vi vec, int mode=0)
{
	if(mode==1)
	{
		if(vec.empty()) return 0;
		map<int,int> ma;
		for(int v:vec) ma[v]++;
		int ans=0;
		while(!ma.empty())
		{
			int x=(*prev(ma.end())).fi;
			ma[x]--;
			if(ma[x]==0) ma.erase(x);
			int r = getrev(x);
			//cerr<<x<<' '<<r<<'\n';
			if(ma.find(r)==ma.end()) continue;
			ma[r]--;
			if(ma[r]==0) ma.erase(r);
			ans++;
		}
		return ans;
	}
	else
	{
		if(vec.size()<2) return 0;
		vi V[2];
		for(int i=0;i<vec.size();i++)
		{
			V[vec[i]%2].pb(vec[i]);
		}
		for(int i=0;i<V[0].size();i++) V[0][i]/=2;
		int ev = solve(V[0],mode);
		vi V2;
		for(int i=0;i<V[1].size();i++)
		{
			V2.pb((V[1][i]-1)/2);
		}
		return ev + solve(V2,mode^1);
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vector<ll> vec;
	for(int i=0;i<n;i++)
	{
		ll x; cin>>x; vec.pb(x);
	}
	cout<<solve(vec)<<'\n';
}


Measured memory_bytes: 98928
#include<bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

signed main(){
    int k, n;
    cin >> n >> k;
    vector<double> kitai(n);
    vector<double> kitaiwa(n+1);

    rep(i, n){
        int tmp;
        cin >> tmp;
        kitai[i] = (1.0+tmp)/2.0;
        kitaiwa[i+1] = kitaiwa[i] + kitai[i];
    }

    double ans = 0;

    rep(i, n + 1 - k){
        int right = i + k;
        double tmp_sum = kitaiwa[right] - kitaiwa[i];
        ans = max(ans, tmp_sum);
    }

    cout << fixed << setprecision(10) << ans << endl;

}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 100000;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, m;
int s[100000+ 5], a[100000 + 5];
int sum[100000 + 5];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, n - 1) cin >> s[i];
    rep(i, m) cin >> a[i];
    rep(i, n) sum[i + 1] = sum[i] + s[i];
    int now = 0;
    int ans = 0;
    rep(i, m) {
        int nx = now + a[i];
        if (now < nx) (ans += sum[nx] - sum[now]) %= mod;
        else (ans += sum[now] - sum[nx]) %= mod;
        now = nx;
    }
    cout << ans % mod << endl;
}

Measured memory_bytes: 5436
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;

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

int main() {

    ll N,M;
    cin >> N >> M;
    vector<ll> v;
    rep(i,sqrt(M)){
        if(M%(i+1)==0){
            v.push_back(i+1);
            v.push_back(M/(i+1));
        }
    }
    sort(v.begin(),v.end());
    ll out = 0;
    rep(i,v.size()){
        if(N<=v[i]){
            out = M/v[i];
            break;
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3724
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
using namespace std;
#define pb emplace_back
#define fi first
#define se second
#define rep(i,n) for(int i=0; i<(n); ++i)
#define err(...) fprintf(stderr, __VA_ARGS__)
#define outl(x) cout << (x) << '\n'
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
inline bool inside(int y, int x, int H, int W){return(y>=0 && x>=0 && y<H && x<W);}
const int dx[] = {1, 0, -1, 0,  1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1,  -1, 1, 1, -1};
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
constexpr int INF = 0x3f3f3f3f;

const double EPS = 1e-10;

bool eq(const double &a, const double &b)
{
    return (fabs(a-b) < EPS);
}

struct Vec
{
    double x, y;

    inline explicit Vec(double x=0, double y=0): x(x), y(y) {};
    inline Vec    operator - (void) const  { return Vec(-x, -y); }

    inline Vec operator + (const Vec &v)       { return Vec(v.x+x, v.y+y); }
    inline Vec operator - (const Vec &v)       { return Vec(v.x-x, v.y-y); }
    inline Vec operator * (const double &a)    { return Vec(x*a, y*a);     }
    inline Vec operator / (const double &a)    { return Vec(x/a, y/a);     }
    inline double operator * (const Vec &v)    { return (x*v.x + y*v.y);   }
    inline double operator % (const Vec &v)    { return (x*v.y - y*v.x);   }

    inline Vec& operator += (const Vec &v)     { x += v.x;  y += v.y; return *this; }
    inline Vec& operator -= (const Vec &v)     { x -= v.x;  y -= v.y; return *this; }
    inline Vec& operator *= (const double &a)  { x *= a;    y *= a;   return *this; }
    inline Vec& operator /= (const double &a)  { x /= a;    y /= a;   return *this; }

    inline bool operator < (const Vec &v) const { return (x == v.x) ? (y < v.y) : (x < v.y); }
    inline bool operator > (const Vec &v) const { return (x == v.x) ? (y > v.y) : (x > v.y); }

    inline double norm(void) const { return x*x + y*y; }
    inline double operator() (void) const  { return sqrt(norm()); } // 絶対値
};

typedef Vec Point;
struct Line
{
    Point a, b;
    explicit Line(Point a=Point(), Point b=Point()) : a(a), b(b) {}

    Vec operator ~ (void) { return Vec(b.x-a.x, b.y-a.y); } // ベクトルを返す
};

istream& operator >> (istream &is, Point &p)
{
    is >> p.x >> p.y;
    return is;
}

istream& operator >> (istream &is, Line &l)
{
    is >> l.a >> l.b;
    return is;
}


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

    int Q;
    cin >> Q;
    while (Q--) {
        Line a, b;
        cin >> a >> b;

        Vec va = ~a;
        Vec vb = ~b;

        if (va % vb == 0) {
            outl(2);
        } else if (va * vb == 0) {
            outl(1);
        } else {
            outl(0);
        }
    }

}




Measured memory_bytes: 3308
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N, M;
    cin >> N >> M;
    int m = 0;
    int l1 = 1, r1 = N/2, l2 = N/2+1, r2 = N;
    if (N % 2 ==0) r1--;
    while(m < M) {
        if (m % 2 == 0) {
            cout << l2 << " " << r2 << endl;
            l2++;
            r2--;
        } else {
            cout << l1 << " " << r1 << endl;
            l1++;
            r1--;
        }
        m++;
    }

    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
  int n,w,w1,ww,vv,tw,tv,t,i,j,k,res=0;
  vector<int> v[4],s[4];
  cin >> n >> w;
  cin >> w1 >> vv;
  v[0].push_back(vv);
  for(i=1;i<n;i++){
    cin >> ww >> vv;
    v[ww-w1].push_back(vv);
  }
  for(i=0;i<4;i++){
    sort(v[i].begin(),v[i].end(),greater<int>());
    s[i].push_back(0);
    for(j=0;j<(int)v[i].size();j++)
      s[i].push_back(s[i][j]+v[i][j]);
  }
  for(i=0;i<=(int)v[0].size();i++){
    tw=w1*i;
    if(tw>w) break;
    for(j=0;j<=(int)v[1].size();j++){
      tw=w1*i+(w1+1)*j;
      if(tw>w) break;
      for(k=0;k<=(int)v[2].size();k++){
        tw=w1*i+(w1+1)*j+(w1+2)*k;
        if(tw>w) break;
        t=min((w-tw)/(w1+3),(int)v[3].size());
        tv=s[0][i]+s[1][j]+s[2][k]+s[3][t];
        res=max(res,tv);
      }
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3636
n,m = map(int, input().split())
x = sorted(list(map(int, input().split())))
d = []

for i in range(len(x)-1):
  d.append(x[i+1] - x[i])
  
d.sort()

ans = 0
for i in range(m-n):
  ans += d[i]
    
    
print(ans)

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

using namespace std;


void solve() {
    int n, m;
    cin >> n >> m;
    if(m == 1) cout << "0" << endl;
    else {
        m -= n;
        int ans = 1;
        while(m > 0) {
            m -= (n-1);
            ans++;
        }
        cout << ans << endl;
    }
}
int main(void) {
	solve();
  return 0;
}

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

#define ll long long
int main() {
    int n;
    cin >> n;

    map<int, int> m;
    m[1] = 0;
    for (int i=2; i<=n; i++) {
        int boss;
        cin >> boss;
        m[boss] += 1;
    }

    for (int i=1; i<=n; i++) {
        if (m.count(i)) {
            cout << m[i] << endl;
        } else {
            cout << 0 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 13004
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  char x,y;cin>>x>>y;
  int xi=x-'a';
  int yi=y-'a';
  if(xi>yi)puts(">");
  else if(xi<yi)puts("<");
  else puts("=");
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int bubbleSort(int*,int);
int main(){
  int A[100],i,j,N,s;
  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);
  s=bubbleSort(A,N);

  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i==N-1)break;
    printf(" ");
  }
  printf("\n");
  
  printf("%d\n",s);
  return 0;
}

int bubbleSort(int A[],int N){
  int s = 0,flag=1,i,j,tmp;
  while(flag==1){
    flag=0;
    for(j=N-1;j>=1;j--){
      if(A[j]<A[j-1]){
	tmp=A[j];
	A[j]=A[j-1];
	A[j-1]=tmp;
	flag=1;
	s++;
      }
    }
  }
  return s;
}



Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

struct Dice{
  int t, r, f;
  int top() { return t; }
  int bottom() { return 7 - t; }
  int right() { return r; }
  int left() { return 7 - r; }
  int front() { return f; }
  int back() { return 7 - f; }
  void toFront() { swap(f, t); t = 7 - t; }
  void toBack() { toFront(); toFront(); toFront(); }
  void toRight() { swap(t, r); t = 7 - t; }
  void toLeft() { toRight(); toRight(); toRight(); }
  void toClock() { swap(f, r); r = 7 - r; }
  void toConter() { toClock(); toClock(); toClock(); }
  int roll(int tt, int ff) {
    REP(i,30) {/*top??¨front???????????¨right????????????*/
      if (i % 10 == 0) toRight();
      else if (i % 10 == 5) toFront();
      else toClock();
      if (tt == t && ff == f) return r;
    }
    return 0;
  }
};

int main(){
	Dice dai1;
	int men[7];
	FOR(i,1,7) cin >> men[i];
	int n;
	cin >> n;
	dai1.t = 1;
	dai1.f = 2;
	dai1.r = 3;
	REP(i,n){
		int to_top,to_front;
		cin >> to_top >> to_front;
		FOR(i,1,7){
			if(to_top == men[i]) to_top = i;
			if(to_front == men[i]) to_front = i;//????????¢????????????????????????????????????
		}
		cout << men[dai1.roll(to_top,to_front)] << endl;
	}
}

Measured memory_bytes: 1160
# https://atcoder.jp/contests/code-festival-2016-qualc/tasks/codefestival_2016_qualC_b

k, t = map(int, input().split())
nums = [int(i) for i in input().split()]
MAX = max(nums)

ans = max(MAX - 1 - (k - MAX), 0)
print(ans)

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n),b(n);
  for(Int i=0;i<n;i++) cin>>a[i]>>b[i];

  if(a==b){
    cout<<0<<endl;
    return 0;
  }
  
  Int ans=0;
  for(Int i=0;i<n;i++) if(a[i]<=b[i]) ans+=a[i],b[i]-=a[i],a[i]=0;
  
  Int mi=0;
  for(Int i=0;i<n;i++) mi+=a[i];
  for(Int i=0;i<n;i++) if(a[i]>b[i]) chmin(mi,b[i]);
  //cout<<mi<<endl;
  
  Int res=0;
  for(Int i=0;i<n;i++) res+=a[i];
  ans+=res-mi;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long int llint;

int main(){
	string S;
	cin >> S;
	if(S[2]==S[3] && S[4]==S[5]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main()
{
    std::string s;
    std::cin >> s;

    int len = (int)s.length();

    if (len == 3){
        std::string b;
        std::string c;
        b += s[0];
        c += s[2];
        s.replace(2, 1, b);
        s.replace(0, 1, c);
    }
    std::cout << s << std::endl;
    return 0;
}

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

using namespace std;

template<typename Weight>
class Dinic {
public:
    Dinic(const int n) : n(n), g(n), INF(numeric_limits<Weight>::max()) {}

    void add_edge(const int src, const int dst, const Weight cap) {
        g[src].emplace_back(Edge(src, dst, cap, g[dst].size()));
        g[dst].emplace_back(Edge(dst, src, 0, g[src].size() - 1));
    }

    Weight MaximumFlow(const int s, const int t) {
        Weight flow = 0;

        while(true) {
            vector<int> level(n, -1), iter(n);
            Bfs(level, s);

            if(level[t] < 0) break;
            Weight f = 0;
            while((f = Dfs(level, iter, s, t, INF)) > 0)
                flow += f;
        }

        return flow;
    }

private:
    struct Edge {
        int src, dst, rev;
        Weight weight;
        Edge(int f, int t, Weight c, int rev = 0) :
            src(f), dst(t), rev(rev), weight(c) {}
    };

    int n;
    vector<vector<Edge>> g;
    const Weight INF;

    void Bfs(vector<int> &level, const int s){
        level[s] = 0;
        queue<int> que;
        que.push(s);
        while(!que.empty()){
            const int v = que.front();
            que.pop();
            for (auto &e : g[v]) {
                if(e.weight > 0 && level[e.dst] < 0){
                    level[e.dst] = level[v] + 1;
                    que.push(e.dst);
                }
            }
        }
    }

    Weight Dfs(vector<int> &level, vector<int> &iter, int v, int t, Weight flow) {
        if(v == t) return flow;
        for (int &i = iter[v], N = g[v].size(); i < N; ++i) {
            Edge &e = g[v][i];

            if(e.weight > 0 && level[v] < level[e.dst]){
                Weight d = Dfs(level, iter, e.dst, t, min(flow, e.weight));
                if(d > 0){
                    e.weight -= d;
                    g[e.dst][e.rev].weight += d;
                    return d;
                }
            }
        }
        return 0;
    }
};

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

    int n, m, u, v, c;

    cin >> n >> m;
    Dinic<int> flow(n);
    for (int i = 0; i < m; ++i) {
        cin >> u >> v >> c;
        flow.add_edge(u, v, c);
    }

    cout << flow.MaximumFlow(0, n - 1) << endl;

    return 0;
}



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


int main(){
  int n,i;
  cin >> n;
  int mi=1000000;
  int ans=0;
  vector<int> p(n);
  for(i=0;i<n;++i){
    cin >> p[i];
  }
  for(i=0;i<n;++i){
    if(mi>p[i]){
      mi=p[i];
    }
    if(mi>=p[i]){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
// Seiranchan!
    int X,N;
    cin >> X;
    N=1;
    for(int i=2;i*i<=X;i++){
        for(int j=i*i;j<=X;j*=i){
           N= max(N,j);
        }
    }
    cout << N <<endl;
}

Measured memory_bytes: 256
use proconio::input;

const LOGN:usize = 60;
fn main() {
    input! {
        n:usize,
        k:i64,
        a:[usize;n],
    };
    let a:Vec<usize> = a.into_iter().map(|x|x-1).collect();

    let dp = {
        let mut dp = vec![vec![0;n];LOGN];
        dp[0].iter_mut().enumerate().for_each(|(id,x)|*x=a[id]);
        for i in 0..(LOGN-1) {
            for j in 0..n {
                dp[i+1][j] = dp[i][dp[i][j]];
            }
        }
        dp
    };

    let mut pos = 0;
    for i in 0..LOGN {
        if (k>>i)&1==1 {
            pos = dp[i][pos];
        }
    }
    println!("{}",pos+1);
    
}


Measured memory_bytes: 98628
import java.util.Scanner;

public class Main {

    static int[] prime = {2,3,5,7,11,13,
            17,19,23,29,31,
            37,41,43,47,53,
            59,61,67,71,73,
            79,83,89,97};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        long ans = 0;
        for(int a=0;a<k;a++){
            for(int b=0;b<k;b++){
                for(int c=0;c<k;c++){
                    if(a == b && a == c){
                        ans += a+1;
                        continue;
                    }
                    int A = a+1, B = b+1, C = c+1, gcd = 1;
                    for(int x=0,y=prime.length;x<y;x++){
                        if(A%prime[x] != 0 || B%prime[x] != 0 || C%prime[x] != 0){  //割り切れないなら次の素数へ
                            continue;
                        }else{
                            gcd *= prime[x];
                            A /= prime[x];
                            B /= prime[x];
                            C /= prime[x];
                            x--;    //同じ素数でもう一度試す
                        }
                    }
                    ans += gcd;
                }
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std;

#define pb push_back
#define ll long long
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define bug cout << "ok" << endl

const ll INF = 1e9 + 5, N = 500 + 5, mod = 1e9 + 7, M = 1e5 + 5;

int main(){
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans1 = b * d;
	ll ans2 = a * c;
	ll ans3 = d * a;
	ll ans4 = b * c;
	cout << max({ans1, ans2, ans3, ans4}) << endl;
}

Measured memory_bytes: 3620
import math
def gcd(a, b):
    #aとbの最大公約数を求める
    #math.gcdもしくはnp.gcdを使えばいいのだが、AtCoder上のpythonでは使えない
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    else:
        c = a % b
        return gcd(b, c)

def lcm(a, b):
    return (a * b // gcd(a, b))

n, m = map(int, input().split())

s = input()
t = input()

d = gcd(n, m)
l = lcm(n, m)

for i in range(d):
    if s[i * (n // d)] != t[i * (m // d)]:
        print(-1)
        exit()
print(l)

Measured memory_bytes: 3316
n = gets.to_i
arr = []

1.upto(n) do |i|
  1.upto(n) do |j|
    arr << i.gcd(j)
  end
end

sum = 0

arr.each do |ab|
  1.upto(n) do |c|
    sum += ab.gcd(c)
  end
end

puts sum

Measured memory_bytes: 14916
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
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);
    }
}
#pragma endregion

int main()
{
    int n = 1, x = 1;
    cin >> n >> x;
    while (n != 0 || x != 0)
    {
        int ans = 0;
        for (int i = 1; i < n - 1; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                for (int k = j + 1; k <= n; k++)
                {
                    if (i + j + k == x)
                    {
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
        cin >> n >> x;
    }
    return 0;
}


Measured memory_bytes: 3088
using System;
using System.Linq;

public class Program{
    public static void Main(){
        int[] numbers = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int[] prices = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        
        Console.WriteLine(prices.OrderBy(a => a).Take(numbers[1]).Sum());
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int w,h,n,a;
	cin >> w >> h >> n;
	int x[n],y[n],lx,mx,ly,my;
	tie(lx,mx,ly,my)=make_tuple(0,w,0,h);
	FOR(i,n){
		cin >> x[i];
		cin >> y[i];
		cin >> a;
		if(a==1) lx=max(lx,x[i]);
		if(a==2) mx=min(mx,x[i]);
		if(a==3) ly=max(ly,y[i]);
		if(a==4) my=min(my,y[i]);
	}
	//cout << lx <<"," << ly <<",- ," <<mx <<"," << my; 
	cout << max(0,(mx-lx))*max(0,(my-ly));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	vector<pair<ll,ll>>a;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push_back(make_pair(x,i+1));
	}
	sort(a.begin(),a.end());
	for(ll i=0;i<n;i++){
		cout << a[i].second <<" ";
	}
	// your code goes here
	return 0;
}

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

const double EPS=1e-6;
double dist(int x0,int y0,int x1,int y1){
    int x=x0-x1;
    int y=y0-y1;
    return sqrt(x*x+y*y)+EPS;
}

int dfs(int s,vector<int>& x,vector<int>& y,vector<int>& r,vector<int> &c,vector<int> &dp){
    if(dp[s]!=-1) return dp[s];
    vector<vector<int>> rem(4);
    for(int i=0;i<n;i++){
        if(s&(1<<i)){
            bool isok=true;
            for(int j=0;j<i;j++){
                isok&=!(s&(1<<j) && dist(x[i],y[i],x[j],y[j])<r[i]+r[j]);
            }
            if(isok){
                rem[c[i]].push_back(i);
            }
        }
    }
    int res=0;
    for(int i=0;i<4;i++){
        for(int j=0;j<rem[i].size();j++){
            for(int k=0;k<j;k++){
                int tos=s-(1<<rem[i][j])-(1<<rem[i][k]);
                res=max(res,dfs(tos,x,y,r,c,dp)+2);
            }
        }
    }    
    return dp[s]=res;
}
int main(){
    while(cin>>n,n){
        vector<int> x(n),y(n),r(n),c(n);
        for(int i=0;i<n;i++){
            cin>>x[i]>>y[i]>>r[i]>>c[i];
            c[i]--;
        }
        vector<int> dp(1<<n,-1);
        cout<<dfs((1<<n)-1,x,y,r,c,dp)<<endl;
    }
    return 0;
}


Measured memory_bytes: 68456
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n,m = MI()
x = RI()

x.sort()
# print(x)

sa = []
for i in range(m-1):
    sa.append( x[i+1] - x[i] )
# print(sa)

sa.sort(reverse=True)
# print(sa)

ans = sum(sa[n-1:])
print(ans)

Measured memory_bytes: 96196
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 100005, MAXM = 1003, mod = 1000000007 , MAXLog = 20;

int n, k;
vector<int> adj[MAXN];
int memo[MAXN];

int fact[MAXN];
int invfact[MAXN];
int mul(int a , int b , int m){
    return (1LL * (a % m) * (b % m)) % m;
}

int powMOD(int x , int n , int m = mod){
    if(!n)return 1;
    int ret = 1;
    if(n & 1)ret = mul(x , powMOD(x , n - 1 , m) , m);
    else{
        int y = powMOD(x , n / 2 , m);
        ret = mul(y , y , m);
    }
    return ret;
}


int nPr(int n , int r){
    if(r < 0 || r > n)return 0;
    return mul(fact[n] , invfact[n - r] , mod);
}


void pre() {
    fact[0] = invfact[0] = 1;
    for (int i = 1; i < MAXN; ++i)
        fact[i] = mul(i, fact[i - 1], mod);

    invfact[MAXN - 1] = powMOD(fact[MAXN - 1], mod - 2, mod);
    for (int i = MAXN - 2; ~i; --i)
        invfact[i] = mul(invfact[i + 1], i + 1, mod);
}


int solve(int u, int par) {
    if (u != 1 && adj[u].size() == 1) {
        return 1;
    }
    int &ret = memo[u];
    if (~ret)
        return ret;
    if (u == 1) {
        ret = nPr(k, adj[u].size() + 1);
        for (int v : adj[u]) {
            if (v == par)
                continue;
            ret = 1LL * ret * solve(v, u) % mod;
        }
    } else {
        ret = nPr(k - 2, adj[u].size() - 1);
        for (int v : adj[u]) {
            if (v == par)
                continue;
            ret = 1LL * ret * solve(v, u) % mod;
        }
    }
    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;


    int n, a, b;
    cin >> n >> a  >> b;
    cout << min(a * n, b) << '\n';


    return 0;
}

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

static const int N = 100;

int main() {
  int n, p[N+1], m[N+1][N+1];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>p[i-1]>>p[i];
  }

  for(int i=1;i<=n;i++) m[i][i]=0;
  for(int l=2;l<=n;l++) {
    for(int i=1;i<=n-l+1;i++){
      int j=i+l-1;
      m[i][j]=(1<<21);
      for(int k=i;k<=j-1;k++) {
	m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }

  cout<<m[1][n]<<endl;

  return 0;
}



Measured memory_bytes: 3128
N, W = map(int, input().split())
wv = [[int(i) for i in input().split()] for _ in range(N)]
V = max([wv[i][1] for i in range(N)]) * N

dp = [[float('inf')] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N) :
    for j in range(V+1) :
        if j >= wv[i][1] :
            dp[i+1][j] = min(dp[i][j-wv[i][1]] + wv[i][0], dp[i][j])
        else :
            dp[i+1][j] = dp[i][j]

for i in range(V, -1, -1) :
    if dp[N][i] <= W :
        print(i)
        break

Measured memory_bytes: 310680
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <set>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;

ll n, m, a[100010];

ll gcd(ll a,ll b) {return b==0 ? a : gcd(b, a%b);}
ll lcm(ll a,ll b) {return a / gcd(a,b) * b;}

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> m;
  REP(i, n) cin >> a[i];

  // a[i] / 2 * (p * 2 + 1)
  ll l = 1;
  REP(i, n) {
    l = lcm(l, a[i] >> 1);
    if (l > m) {
      cout << 0 << endl;
      return 0;
    }
  }

  REP(i, n) {
    if (l / (a[i]>>1) % 2 == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  cout << (m / l + 1) / 2 << endl;
  return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define DEBUG

#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define REPR(i, n) for(ll i = n; i >= 1; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define INF 1e9+123
#define VEC(type,A,N) vector<type> A(N+10)
#define VECi(type,A,N,i) vector<type> A(N+10,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N+10,vector<type>(M+10))
#define ALL(v) v.begin()+1, v.end()-9

int main(){
    int N,K,Q;
    cin>>N>>K>>Q;
    VEC(int,A,Q);
    VECi(int,hito,N,0);
    REP(i,Q){
        cin>>A[i];
        hito[A[i]]++;
    }
    REP(i,N){
        if(K-Q+hito[i]>0)cout<<"Yes"<<endl;else cout<<"No"<<endl;
    }
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    vector<ll> C(9);
    REP(i,9)cin >> C[i];
    bool ok = 0;
    for(int i = -101;i < 101;i++){
        for(int l = -101;l < 101;l++){
            for(int k = -101; k < 101;k++){
                if(C[0]-i == C[1]-l&&C[0]-i == C[2]-k){
                    if(C[3]-i == C[4]-l&&C[3]-i == C[5]-k){
                        if(C[6]-i == C[7]-l&&C[6]-i == C[8]-k){
                            ok = 1;
                        }
                    }
                }
            }
        }
    }
    cout << (ok ? "Yes" : "No") << "\n";
}

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

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

    int n;
    cin >> n;

    map<string, bool> mp;
    REP(i, n){
        string s, w;
        cin >> s >> w;
        if(s == "find"){
            if(mp[w]) cout << "yes" << endl;
            else cout << "no" << endl; 
        }else{
            mp[w] = true;
        }
    }


    return 0;
}


Measured memory_bytes: 47428
#include <stdio.h>
#define MAX 500000
#define INFTY 1000000000

void Merge(int*, int, int, int);
void MergeSort(int*, int, int);

int count=0;
int main(){
  int i,n;
  int S[MAX];

  // printf("%d",INFTY);
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  /* 
  for(i=0;i<n-1;i++){
    printf("%d ",S[i]);
  }
  printf("%d\n",S[n-1]);
  */
  MergeSort(S, 0, n);

  for(i=0;i<n-1;i++){
    printf("%d ",S[i]);
  }
  printf("%d\n",S[n-1]);
  printf("%d\n",count);

  return 0;
}

void MergeSort(int *A, int left, int right){
  int mid;

  // printf("left: %d, right: %d\n",left,right);
  
  if(left+1 < right){
    mid = (left + right)/2;
    
    // printf("%d\n\n",mid);
    
    //printf("L-M\n");
    MergeSort(A, left, mid);

    //printf("M-R\n");
    MergeSort(A, mid, right);

    //printf("Merge\n");
    Merge(A, left, mid, right);
  }
}

void Merge(int *A, int left, int mid, int right){
  int i,j,k;
  int n1, n2;
  int L[MAX];
  int R[MAX];
  n1 = mid - left;
  n2 = right - mid;

  for(i=0;i<n1;i++){
    L[i] = A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[mid+i];
  }

  L[n1] = INFTY;
  R[n2] = INFTY;

  i=0;
  j=0;
  
  for(k = left ; k < right ; k++){
    
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }
}

Measured memory_bytes: 5488
let n, a, b, s = Scanf.scanf " %d %d %d %s" @@ fun a b c d -> a, b, c, d
let p, r = ref 0, ref 0
let f c = print_endline @@
  if !p >= a + b then "No" else match c with 'a' -> incr p; "Yes" | 'b' -> incr r; if !r <= b then (incr p; "Yes") else "No" | _ -> "No"
let _ = String.iter f s

Measured memory_bytes: 3072
public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);

		var ac = 0;
		var wa = 0;
		var tle = 0;
		var re = 0;
		var n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			var s = sc.next().charAt(0);
			switch (s) {
			case 'A':
				ac++;
				break;
			case 'W':
				wa++;
				break;
			case 'T':
				tle++;
				break;
			case 'R':
				re++;
				break;
			}
		}
		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + re);
	}
}

Measured memory_bytes: 59196
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        var NY = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
        int N = NY[0];
        int Y = NY[1] / 1000;
        for (int i = 0; i <= N; i++)
        {
            for (int j = 0; j <= N - i; j++)
            {
                int k = N - i - j;
                if (i * 10 + j * 5 + k * 1 == Y)
                {
                    Console.WriteLine("{0} {1} {2}",i,j,k);
                    return;
                }
            }
        }

        Console.WriteLine("{0} {1} {2}", -1,-1,-1);
    }
}

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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;

  int a;
  int sum;

  cin >> a;
  
  sum = a + a*a + a*a*a;

  cout << sum << endl;

  return 0;
}


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

int main()
{
	int a, b;
	char op;
	cin >> a >> op >> b;
	if (op == '+')
	{
		cout << a + b << endl;
	}
	else
	{
		cout << a - b << endl;
	}
	return 0;
}

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

int main() 
{
    int q; cin >> q;
    while (q--) {
        ll a, b; cin >> a >> b;
        if (a > b) swap(a,b);
        if (a == b || a == b-1) {
            cout << (2*a-2) << '\n';
        }
        else {
            ll c = (ll)sqrt(a*b)-3;
            while ((c+1)*(c+1) < a*b) c++;
            if (c*(c+1) >= a*b) {
                cout << 2*c-2 << '\n';
            }
            else {
                cout << 2*c-1 << '\n';
            }
        }
    }
}



Measured memory_bytes: 256