akhauriyash/Code-Regression huggingface dataset:
#a
"""
import math
a, b = map(str, input().split())
j = int(a + b)
if math.sqrt(j).is_integer():
    print("Yes")
else:
    print("No")
"""

#b
"""
ans = ["Positive","Negative"]
a, b = map(int, input().split())
if 0 < a:
    print("Positive")
elif b >= 0:
    print("Zero")
else:
    print(ans[(b-a)%2-1])
"""

#C
"""
import itertools
n = int(input())
MARCH = ["M", "A", "R", "C", "H"]
march = [0 for _ in range(5)]
for i in range(n):
    s = input()
    if s[0] in MARCH:
        march[MARCH.index(s[0])] += 1
num = list(range(5))
a = list(itertools.combinations(num, 3))
ans = 0
for i in a:
    bf = 1
    for k in i:
        bf *= march[k]
    ans += bf
print(ans)
"""

#D
"""
n = int(input())
D = [list(map(int, input().split())) for _ in range(n)]
q = int(input())
p = [int(input()) for _ in range(q)]
ans = [[0 for i in range(n)] for _ in range(n)]
for i in range(n):
    for j in range(n):
        break
for _ in p:
    print(ans[p])
"""

#E
"""
s = input()
bf = s[0]
ans = 0
for i in range(1,len(s)):
    if bf != s[i]:
        ans += 1
        bf = s[i]
print(ans)
"""

#F
"""
n = int(input())
ta = [list(map(int, input().split())) for _ in range(n)]
ans = ta[0]
for i in ta:
    if ans[0] <= i[0] and ans[1] <= i[1]:
        ans = i
    else:
        a = ((ans[0] - 1) // i[0]) + 1
        b = ((ans[1] - 1) // i[1]) + 1
        ab = max(a,b)
        ans = [i[0] * ab, i[1] * ab]
print(ans[0]+ans[1])
"""

#G
n, t = map(int, input().split())
a = list(map(int, input().split()))
minv = a[0]
maxv = 0
ans = 0
for i in range(1, n):
    if maxv == a[i] - minv:
        ans += 1
    elif maxv < a[i] - minv:
        maxv = a[i] - minv
        ans = 1
    else:
        minv = min(minv,a[i])
print(ans)

#H
"""
s = input()
ans = 0
for i in range(1,len(s)):
    if i % 2 == 1:
        if s[i] != "p":
            ans += 1
    else:
        if s[i] != "g":
            ans -= 1
print(ans)
"""

Measured memory_bytes: 63088
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}


int main(void){
  ll N, A, B, W, H, C, D, Q;
  string s, t;
  cin >> N;
  ll a[N];
  vector<ll> a_vec, a_vec_origin;
  rep(i, N) {
    cin >> a[i];
    a_vec.push_back(a[i]);
  }
  sort(ALL(a_vec));
  ll max_a = a_vec[N-1]/2;
  ll sabun_min = 1e+10;
  ll a_vec_now;
  rep(i, N-1){
    if (sabun_min >= abs(max_a-a_vec[i])){
      sabun_min = abs(max_a-a_vec[i]);
      a_vec_now = a_vec[i];
    }
  }
  cout << a_vec[N-1] << ' ' << a_vec_now << endl;
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
//#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = (int)s.length();
    for (int i = 1; i < n; i++) {
        if (s[i] == s[i - 1]) {
            cout << i << ' ' << i + 1 << '\n';
            rr;
        }
        if (i > 1 && s[i] == s[i - 2]) {
            cout << i - 1 << ' ' << i + 1 << '\n';
            rr;
        }
    }
    cout << "-1 -1\n";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

class UnionFind{
public:
	vector<ll> par;
	vector<ll> d;
	//0-indexed
	UnionFind(ll n){
		init(n);
	}
	void init(ll n = 1) {
		par.resize(n);
		d.resize(n,0);
		for (ll i = 0; i < n; ++i) par[i] = i;
	}
	ll len1(ll x){
		if(par[x]==x)return 0;
		ll ans = d[x];
		ans += len1(par[x]);
		return ans;
	}
	ll root(ll x = 1){
		if(par[x]==x)return x;
		else{
			d[x] = len1(par[x]) + d[x];
			return par[x] = root(par[x]);
		}
	}
	ll length(ll x,ll y){ // xから右にlengthいったところにy
		return len1(y) - len1(x);
	}
	void unite(ll x,ll y,ll dd){ // xから右にdだけ離れたところにy
		dd += len1(x);x=root(x);
		dd -= len1(y);y=root(y);
		if(x==y)return;
		if(dd>=0){
			d[y] = dd;
			par[y] = x;
		}else{
			d[x] = -dd;
			par[x] = y;
		}
	}
};
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,Q,a,x,y,z;
	cin >> N >> Q;
	UnionFind uf(N);
	FOR(i,0,Q){
		cin >> a;
		if(a==0){
			cin >> x >> y >> z;
			uf.unite(x,y,z);
		}else{
			cin >> x >> y;
			if(uf.root(x)!=uf.root(y)){
				cout << "?" << endl;
			}else{
				cout << uf.length(x,y) << endl;
			}
		}
	}
}


Measured memory_bytes: 4392
[w,h,n]=list(map(int,input().split()))
risuto=[]
xmin=0
xmax=w
ymin=0
ymax=h
for i in range(n):
	risuto.append(list(map(int,input().split())))
for i in range(n):
	if risuto[i][2]==1 and risuto[i][0]>xmin:
		xmin=risuto[i][0]
	elif risuto[i][2]==2 and risuto[i][0]<xmax:
		xmax=risuto[i][0]
	elif risuto[i][2]==3 and risuto[i][1]>ymin:
		ymin=risuto[i][1]
	elif risuto[i][2]==4 and risuto[i][1]<ymax:
		ymax=risuto[i][1]
menseki=int((xmax-xmin)*(ymax-ymin))
if xmax<=xmin or ymax<=ymin:
	menseki=0
if menseki<0:
	menseki=0
print(menseki)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#define pb push_back
#define mp make_pair
using namespace std;

int d[10];



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

    for(int i = 1; i <= 4; i++)
    {
        int x;
        cin >> x;

        d[x]++;
    }

    if(d[1] && d[9] && d[7] && d[4])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;


    return 0;
}


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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;


#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

typedef pair<Weight, int> Result;
Result visit(int p, int v, const Graph &g) {
  Result r(0, v);
  FOR(e, g[v]) if (e->dst != p) {
    Result t = visit(v, e->dst, g);
    t.first += e->weight;
    if (r.first < t.first) r = t;
  }
  return r;
}
Weight diameter(const Graph &g) {
  Result r = visit(-1, 0, g);
  Result t = visit(-1, r.second, g);
  return t.first; // (r.second, t.second) is farthest pair
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  Graph g(n);
  for(int i=0;i<n-1;++i) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a].push_back(Edge(a, b, 1));
    g[b].push_back(Edge(b, a, 1));
  }

  Weight w = diameter(g);

  if(w % 3 == 1) {
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
  }

}


Measured memory_bytes: 29952
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    int A = scanner.nextInt();
		    int B = scanner.nextInt();
		    
		    if( (A + B) % 2 == 0 ) 
		    {
		    	System.out.println((A + B) / 2);
		    }
		    else
		    {
		    	System.out.println( (A + B) / 2 + 1);
		    }
		    
		    scanner.close(); }
		  }

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)

int main(){
    llong n,h,w;
    cin >> n >> h >> w;
    cout << (n+1-h) * (n+1-w) << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>
#include <regex>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define P pair<int, int>

using namespace std;
//using ll = long long;
using ll = int64_t;

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

int sum(int x){
    int y = 0;
    string s = to_string(x);
    rep(i, s.length()){
        y += s[i]-'0';
    }
    return y;
}

void solve(){
    int n, a, b;
    ll ans=0;
    cin >> n >> a >> b;

    for(int i = 1; i <= n; i++){
        int temp = sum(i);
        if(temp >= a && temp <= b){
            ans += i;
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int n;
long long int a[100005];

int main(void) {

	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}

	long long int ans1=0,ans2=0, sum,tmp;

	//====+-+-
	sum = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 2 == 1) {
			if (sum + a[i] >= 1) { sum += a[i]; }
			else {  ans1 += (1 - sum - a[i]); sum = 1; }
		}
		else {
			if (sum + a[i] <= -1) { sum += a[i]; }
			else { ans1 += (sum + a[i] + 1); sum = -1; }
		}
		//cout << "sum= " << sum << "  ans1= " << ans1 << endl;
	}

	//=====
	sum = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 2 == 0) {
			if (sum + a[i] >= 1) { sum += a[i]; }
			else { ans2 += (1 - sum - a[i]); sum = 1; }
		}
		else {
			if (sum + a[i] <= -1) { sum += a[i]; }
			else { ans2 += (sum + a[i] + 1); sum = -1; }
		}
	}

	//cout << "ans1= " << ans1 << endl;
	//cout << "ans2= " << ans2 << endl;
	cout << min(ans1, ans2) << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>

#define reps(i, j, k) for (int i = (j); i < (k); i++)
#define rep(i, j) reps(i, 0, j)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int M;
	std::cin >> M;

	std::cout << 24 + (24 - M);
	return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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


#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
	os << "(" << pair_var.first << ", " << pair_var.second << ")";
	return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	os << "{";
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
	}
	os << "}";
	return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
	os << "{";
	repi(itr, map_var) {
		os << *itr;
		itr++;
		if (itr != map_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
	os << "{";
	repi(itr, set_var) {
		os << *itr;
		itr++;
		if (itr != set_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}

#define DUMPOUT cerr

void dump_func() {
	DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
	DUMPOUT << head;
	if (sizeof...(Tail) > 0) {
		DUMPOUT << ", ";
	}
	dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

	int A, B, C;
	cin >> A >> B >> C;

	cout << max(0LL, C - (A - B)) << endl;


	return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    """最大公約数"""
    if b == 0: return a
    return gcd(b, a % b)
  

def mapt(fn, *args):
    return list(map(fn, *args))
 
 
def Input():
    return mapt(int, input().split(" "))
 
def main():
    N, X = Input()
    x = Input()
 
    if N == 1:
        print(abs(x[0] - X))
        exit()
 
    x.append(X)
    x.sort()
    data = [abs(x[i] - x[i+1]) for i in range(N)]
 
    ans = data[0]
    for i in range(1, N):
        ans = gcd(data[i], ans)
    print(ans)
 
 
 
main()

Measured memory_bytes: 20388
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);
int find(vector<int>& grp, int x) {
    if (grp[x] == x)
        return x;
    return grp[x] = find(grp, grp[x]);
}
int main() {
    int h, w;
    cin >> h >> w;
    vector<string> grid;
    string s;
    for(int i = 0; i < h; i++) {
        cin >> s;
        grid.push_back(s);
    }
    vector<int> dir = {1, 0, -1, 0, 1};
    unordered_map<int, vector<int>> e;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            for(int d = 0; d < 4; d++) {
                int ii = i + dir[d];
                int jj = j + dir[d+1];
                if (ii < 0 || ii >= h || jj < 0 || jj >= w)
                    continue;
                if (grid[i][j] != grid[ii][jj])
                    e[i*w+j].push_back(ii*w+jj);
            }
        }
    }
    vector<int> grp(h*w, 0);
    for(int i = 0; i < h*w; i++) {
        grp[i] = i;
    }
    for(int i = 0; i < h*w; i++) {
        for(int neibor: e[i]) {
            int r1 = find(grp, i);
            int r2 = find(grp, neibor);
            if (r1 != r2) {
                grp[r1] = grp[r2] = min(r1, r2);
            }
        }
    }
    unordered_map<int, vector<int>> cnt;
    for(int i = 0; i < h*w; i++)
        cnt[find(grp, i)].push_back(i);;
    ll ans = 0;
    for(auto p: cnt) {
        ll black = 0, white = 0;
        // cout << "size:" << p.second.size() << endl;
        for(int idx: p.second) {
            if (grid[idx/w][idx%w] == '#')
                black += 1;
            else
                white += 1;
        }
        ans += black * white;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 22472
# B
n, k = map(int, input().split())
d = []
a = []
people = [0] * n
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))
# print(a)
for i in range(k):
    for j in range(d[i]):
        # print(d[i])
        people[a[i][j]-1] += 1
ans = 0
# print(people)
for i in people:
    if i == 0:
        ans += 1
print(ans)


Measured memory_bytes: 9136
import math

def resolve():
    X, K, D = map(int, input().split())
    X = abs(X)

    s = int(X / D)
    if X - D*s >= X - D*(s+1):
        v0 = abs(X - D*s)
        v1 = abs(X - D*(s+1))
    else:
        s = s+1
        v1 = abs(X - D*s)
        v0 = abs(X - D*(s+1))

    ans = 0
    if K < s:
        ans = X - (K * D)
    else:
        if (K - s) % 2 == 0:
            ans = v0
        else:
            ans = v1
    print(ans)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 9212
import math
def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b, a % b)

a, b = [int(i) for i in input().split()]
ma = gcd(a, b)
st = set()
for i in range(1, int(math.sqrt(ma) + 1)):
	if ma % i == 0:
		flg = True
		for j in st:
			if gcd(i, j) != 1:
				if i < j:
					st.remove(j)
					st.add(i)
				flg = False
				break
		if flg:
			st.add(i)
		flg = True
		ii = ma // i
		for j in st:
			if gcd(ii, j) != 1:
				if ii < j:
					st.remove(j)
					st.add(ii)
				flg = False
				break
		if flg:
			st.add(ii)
print (len(st))

Measured memory_bytes: 3064
a, b, c, x, y = map(int, input().split())

min_cost = float("inf")

for ab_pizza in range(0, max(x, y)*2+1, 2):
    cost = a * max(x - ab_pizza // 2, 0) + b * max(y - ab_pizza // 2, 0) + c * ab_pizza
    if cost < min_cost:
        min_cost = cost

print(min_cost)


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

signed main(){
    int N,A,B;
    string S;
    cin>>N>>A>>B>>S;
    int all=0;
    int kai=0;
    REP(i,N){
        if(S[i]=='a'&&all<A+B){
            cout<<"Yes"<<endl;
            all++;
        }
        else{
        if(S[i]=='b'&&all<A+B&&kai<B){
            cout<<"Yes"<<endl;
            all++;
            kai++;
        }
        else cout<<"No"<<endl;
        }
    }
}


Measured memory_bytes: 896
#include <cstdio>
#include <algorithm>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){

int N;
scanf("%d",&N);

int l[3];

LOOP(i,N){

scanf("%d %d %d",&l[0],&l[1],&l[2]);
sort(l,l+3);

if(l[0]*l[0]+l[1]*l[1]==l[2]*l[2])
	printf("YES\n");
else
	printf("NO\n");		

}
return 0;		
}

Measured memory_bytes: 1024
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

al = a1+a2+a3
n =int(input())

for i in range(n):
    b = int(input())
    if b in al:
        al[al.index(b)] = 0
if al[0] + al[1] + al[2] == 0 or al[3] + al[4] + al[5] == 0 or al[6] + al[7] + al[8] == 0 or al[0] + al[3] + al[6] == 0 or al[1] + al[4] + al[7] == 0 or al[2] + al[5] + al[8] == 0 or al[0] + al[4] + al[8] == 0 or al[2] + al[4] + al[6] == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
using namespace std;

int solution(){
    ll n,W; cin>>n>>W;
    vector<ll> w(n), v(n);
    for(ll i = 0;i < n;i++) cin>>w[i]>>v[i];
    
    vector<vector<ll>>dp(n+1, vector<ll>(W+1, 0) );
    
    for(ll i = 1;i <= n;i++){
        for(ll j = 1; j <= W;j++){
            if(j-w[i-1] >= 0)
                dp[i][j] = max( v[i-1]+dp[i-1][j-w[i-1]], dp[i-1][j]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    // for(int i = 0;i <= n;i++){
    //     for(int j = 0;j <= W;j++)
    //         cout<<dp[i][j]<<" ";
    //     cout<<"\n";
    // }
    cout<<dp[n][W]<<"\n";
    return 0; 
}

int main(){
    FAST_IO;
    int T = 1; //cin>>T;
    while(T--)
        solution();
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

std::vector<std::vector<int>> tree;
std::vector<int> ans;
std::vector<int> wa;

void dfs(int now, int parent) {
    int size = SIZE(tree[now]);

    if (size == 0) return;
    REP(i,size) {
        if (tree[now][i] == parent) continue;
        ans[tree[now][i]] += ans[now];
        dfs(tree[now][i], now);
    }
}

int main(int argc, char const *argv[]) {
    int n,q; std::cin >> n >> q;

    tree.resize(n);
    ans.resize(n);
    wa.resize(n);

    REP(i,n-1) {
        int a,b; std::cin >> a >> b;
        tree[a-1].PB(b-1);
        tree[b-1].PB(a-1);
    }

    REP(i,q) {
        int p,x; std::cin >> p >> x;
        ans[p-1]+=x;
    }

    dfs(0, -1);

    REP(i,n) std::cout << ans[i] << " ";
    std::cout  << "\n";
    return 0;
}


Measured memory_bytes: 27392
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            long n = sc.intarr[0];

            if(n <= 9)
            {
                wr.wri(n);
            }else if(n <= 99)
            {
                wr.wri("9");
            }else if(n <= 999)
            {
                wr.wri(n - 99 + 9);
            }else if(n <= 9999)
            {
                wr.wri(9 + 900);
            }
            else if(n <= 99999)
            {
                wr.wri(9 + 900 + n - 9999);
            }
            else
            {
                wr.wri(9 + 900 + 90000);
            }
        }


    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13268
<?php

    fscanf(STDIN,"%s",$N);
        $count=0;
   
    for($i=0;$i<3;$i++){
        if($N[$i]=='7'){
            $count++;
        }
    }

    if($count>0){
        echo "Yes\n";
    }else{
        echo "No\n";
    }

Measured memory_bytes: 16084
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(998244353)
#define INF (2e9)
#define EPS (1e-6)
#ifdef LOCAL_TEST
#define debug(...) do{\
	cerr<<__PRETTY_FUNCTION__<<" - "<<__LINE__<<\
	" : ("#__VA_ARGS__<<") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T>void _OUT(T x){cerr<<x<<endl;}
template<typename T,typename...I>void _OUT(T x,I ...tail){cerr<<x<<", ";_OUT(tail...);}
#else
#define debug(...)
#endif

void INIT(){
#ifdef LOCAL_TEST
	freopen("D:\\input.in","r",stdin);
	freopen("D:\\output.out","w",stdout);
	freopen("D:\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
}

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; }
ll fpow(ll b,ll p){
	b%=MOD;
	ll ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int32_t main() {
	INIT();
	//code...
	ll n; cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++){
		//1 ~ n/i
		ans+=((1+n/i)*(n/i)/2)*i;
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a,const void *b){
    return *(int*)a - *(int*)b;
}

int main(void){
    
    int N,i,L[200],result = 0;

    scanf("%d",&N);
    for(i = 0;i < 2*N;i++){
        scanf("%d",&L[i]);
    }

    qsort(L,2*N,sizeof(int),compare_int);
    for(i = 0;i < 2*N;i += 2){
        (L[i] < L[i + 1]) ? (result += L[i]):(result += L[i+1]);
    }

    printf("%d",result);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int MAXN = 1e5 + 10;

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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    
    int n;
    cin >> n;
    vector<int> a(n);

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

    for (int i = 0; i < n; ) {
        int j = i;
        while (j < n && a[i] == a[j]) {
            ++j;
        }
        res += (j - i) / 2;
        i = j;
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 896
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  int N, M; readf("%d %d\n", &N, &M);
  auto An = readln.split.to!(ulong[]);
  auto discounts = An.map!(a => [a - a/2, a]).array;
  auto discountsHeap = discounts.heapify!"a[0] < b[0]";

  foreach(t; 0..M) {
    auto discounted = discountsHeap.front[1]/2;
    discountsHeap.removeFront();
    discountsHeap.insert([discounted - discounted/2, discounted]);
  }

  discounts.map!(a => a[1]).sum.writeln;
}


Measured memory_bytes: 11048
#include<stdio.h>

int judgeTriangle(int* num);
int judgeRightTriangle(int* num);

int main(){
	int dataSize;
	int num[3];
	int i;
	
	scanf("%d", &dataSize);
	
	for(i = 0; i < dataSize; i++)
	{
		scanf("%d %d %d", num, num+1, num+2);
		if((judgeTriangle(num) == 1) && (judgeRightTriangle(num) == 1))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	
	return 0;
}

int judgeTriangle(int* num)
{
	int i;
	int sam = 0;
	
	for(i = 0; i < 3; i++)
	{
		sam += num[i];
	}
	
	for(i = 0; i < 3; i++)
	{
	/* 0以下の辺がないか */
		if(num[i] <= 0)
		{
			return 0;
		}
	/* 線になっていないか */
		if(num[i] >= (sam-num[i]))
		{
			return 0;
		}
	}
	
	return 1;
}

int judgeRightTriangle(int* num)
{
	int i;
	int dnum[3];
	int dsum = 0;
	
	for(i = 0; i < 3; i++)
	{
		dnum[i] = num[i]*num[i];
		dsum += dnum[i];
	}
	
	for(i = 0; i < 3; i++)
	{
		if(dnum[i] == (dsum-dnum[i]))
		{
			return 1;
		}
	}
	
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;
const int N = 10005;
int sum[N];
int main()
{
	for(int i = 1; i <= 100; ++i)
		for(int j = 1; j <= 100; ++j)
			for (int k = 1; k <= 100; ++k)
			{
				int p = i * i + j * j + k * k + i * j + i * k + j * k;
				if (p <= N)
					++sum[p];
			}

	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		printf("%d\n", sum[i]);

	return 0;
}


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

struct BellmanFord {
  BellmanFord () {}
  BellmanFord (int n) { init(n); }

  struct edge {
    edge () {}
    edge (int to, int cost) : to(to), cost(cost) {}

    int to, cost;
  };

  const long long linf = 1001001001001001001ll;

  bool f;
  vector<vector<edge>> G;
  vector<long long> d;

  void init(int n) {
    f = false;
    G.resize(n);
  }

  void add(int u, int v, int c) {
    G[u].push_back(edge(v, c));
  }

  void bellman_ford(int s) {
    d = vector<long long>(G.size(), linf);
    d[s] = 0;

    for (int i = 0; i < G.size(); ++i) {
      for (int v = 0; v < G.size(); ++v) {
        for (auto &e : G[v]) {
          if (d[v] != linf && d[e.to] > d[v] + e.cost) {
            d[e.to] = d[v] + e.cost;
            if (i == G.size() - 1) f = true;
          }
        }
      }
    }
  }

  void bellman_ford() { bellman_ford(0); }
};

int main() {
  int v, e, r;
  cin >> v >> e >> r;

  BellmanFord bf(v);

  // vector<vector<edge>> G(v);
  for (int i = 0; i < e; ++i) {
    int a, b, c;
    cin >> a >> b >> c;

    bf.add(a, b, c);
    // G[a].push_back(edge(b, c));
  }

  bf.bellman_ford(r);
  // vector<long long> d;
  // if (bellman_ford(r, G, d)) {
  if (bf.f) {
    cout << "NEGATIVE CYCLE" << endl;
  } else {
    for (int i = 0; i < v; ++i) {
      if (bf.d[i] == 1001001001001001001ll) cout << "INF" << endl;
      else cout << bf.d[i] << endl;
    }
  }
}

Measured memory_bytes: 3112
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {

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

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int lli;
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define F first
#define S second
#define forn(i,n) for(int i = 0; i<n; i++)
#define forab(i,a,b) for(int i = a; i<b; i++)
#define forll(i,a,b) for(lli i = a; i<b; i++)
#define mp make_pair
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define debug(x) cout<<#x<<" : "<<x<<endl
#define all(x) x.begin(),x.end()
#define printv(v) for(auto it : v) cout<<it<<" ";cout<<endl;
#define prec(n) fixed<<setprecision(n)
const int mod1 = 1000000007;
const int mod2 = 998244353;
const int N = 1e5;

int main()
{
	optimize

	#ifndef ONLINE_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
	#endif

	string s,t;
	cin>>s>>t;

	int n = s.size();
	int m = t.size();
	int cmn;
	int ans = INT_MAX;

	for(int i = 0; i<n-m+1; i++)
	{
		cmn = 0;
		for(int j = 0; j<m; j++)
		{
			if(s[i+j] == t[j])
			{
				cmn++;
			}
		}
		ans = min(ans, m-cmn);
	}
		
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 3596
//list index out of rangeエラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)


int main(){
  long long h;
  cin >> h;
  long long ans = 0;
  int i = 0;
  while(powl(2, i) <= h){
    ans += pow(2, i);
    i += 1;
  }
  cout << ans;
}

Measured memory_bytes: 4108
#include <bits/stdc++.h>
#define per(i,a,n) for(int i=a;i<=n;i++)
#define ls l+mid>>1

#define rs mid+1+r>>1
using namespace std;
typedef  long long ll;
stack<char>s;
string str;
const int N=1e5+100;
int main()
{
  ios::sync_with_stdio(0);cin.tie(0);
  int A,B,M,a[N],b[N],c[N],ans=3*N,min1=3*N,min2=3*N;
  int x,y,cc;
  cin>>A>>B>>M;
  per(i,1,A){cin>>a[i];min1=min(a[i],min1);}
  per(i,1,B){cin>>b[i];min2=min(b[i],min2);}
  per(i,1,M){cin>>x>>y>>cc;ans=min(ans,a[x]+b[y]-cc);}
  ans=min(ans,min1+min2);
  cout<<ans;
  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() {
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  if (u==s) {
      a--;
  } else {
      b--;
  }
  printf("%d %d\n",a,b);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
#include <cstring>
#include <iomanip>
#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1000000000
typedef long long  ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a /g* b ;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
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;
}
template<typename T>
int  GetDigit(T num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};


int main()
{
    int N;
    cin >> N;
    ll x;
    ll a[N];
    cin >> x;
    REP(i,0,N){
        cin >> a[i];
    }

    ll ans = 0;
    REP(i,0,N-1){
        if(a[i]+a[i+1]>x){
            ans += (a[i] + a[i + 1])-x;
            if(a[i+1]>=(a[i]+a[i+1])-x){
                a[i + 1] -= (a[i] + a[i + 1])-x;
                
            }
            else
            {
                a[i + 1] = 0;
   
            }
        }

    }
    

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>     // pow
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W
// int binary_search(int key) {
//     int ng = -1;
//     int ok = (int)a.size();
//     while(abs(ok - ng) > 1) {
//         int mid = (ok + ng) / 2;
//         if(isOK(mid, key))
//             ok = mid;
//         else
//             ng = mid;
//     }
//     return ok;
// }
vector<long long> pf(vector<long long> v, long long n) {
    if(n == 1)
        return v;
    for(long long i = 2; i <= sqrt(n); i++) {
        if(n % i == 0) {
            if(find(v.begin(), v.end(), i) == v.end()) {
                v.push_back(i);
            }
            v = pf(v, n / i);
            return v;
        }
    }
    if(find(v.begin(), v.end(), n) == v.end()) {
        v.push_back(n);
    }
    return v;
}
int main() {
    long long A, B;
    cin >> A >> B;
    long long GCD = gcd(A, B);
    vector<long long> pfactor = pf({}, GCD);
    cout << endl << pfactor.size() + 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll A;
  int ans = inf;
  int tmpans;
  for(int i=0;i<N;++i) {
    cin>>A;
    tmpans = 0;
    while(A%2==0) {
      tmpans++;
      A /= 2;
    }
    ans = min(ans, tmpans);
  }
  cout<<ans<<endl;
}


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

void solve(){
	string a, b;
	cin >> a >> b;
	if(a.size() != b.size()){
		if(a.size() > b.size()){
			cout << "GREATER" << "\n";
		}
		else{
			cout << "LESS" << "\n";
		}
	}
	else{
		for(int i = 0; i < a.size(); i++){
			if(a[i] > b[i]){
				cout << "GREATER" << "\n";
				return;
			}
			if(a[i] < b[i]){
				cout << "LESS" << "\n";
				return ;
			}
		}
		cout << "EQUAL" << "\n";
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();	
}

Measured memory_bytes: 3632
import math
n = int(input())
name = ""
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

while n >= 1 / 26:
    div = n % 26
    if div == 0:
        div = 26
    name = alphabet[div - 1] + name
    n = int((n - div) / 26)
    #print(div)
    #print(n)
    #print(name)
print(name.lower())

Measured memory_bytes: 9216
// Atcoder122 - B
function main(input) {
  var inputs = input.split('\n');
  var s = inputs[0];

  var sArr = s.split('');
  var acgtArr = ['A', 'C', 'G', 'T'];
  var maxLen = 0;
  var acgtLen = 0;
  for (var i = 0; i < sArr.length; i++) {
    if (acgtArr.indexOf(sArr[i]) >= 0) {
      maxLen = Math.max(maxLen, ++acgtLen);
    } else {
      acgtLen = 0;
    }
  }
  console.log(maxLen);
}

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


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,cost=0,mn;
  string s;
  cin >> n >> s;
  rep(i,n-1){
    if(s[i+1]=='E')cost++;
  }
  mn=cost;
  rep(i,n-1){
    if(s[i+1]=='E')cost--;
    if(s[i]=='W')cost++;
    if(mn>cost)mn=cost;
  }
  cout << mn << endl;
}

Measured memory_bytes: 900
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        PrimeNumberGenerator png = new PrimeNumberGenerator();

        while(true){
            String tmpStr = br.readLine();
            if(tmpStr == null){
                break;
            }

            int n = Integer.parseInt(tmpStr);

            int count = 0;
            for(int i = 2; i <= n; i++){
                if(png.isPrime(i)){
                    count++;
                }
            }

            System.out.println(count);
        }
    }

}

class PrimeNumberGenerator {
	private final int N = 100000000;
    private boolean[] isPrime= new boolean[N + 1];

    public PrimeNumberGenerator() {
        Arrays.fill(isPrime, true);

        isPrime[0] = false;
        isPrime[1] = false;

        int limit = (int)Math.sqrt(N);
        for(int i = 2; i <= limit ; i++){

            if(isPrime[i] == false){
                continue;
            }

            for(int j = i * 2; j <= N; j += i){
                isPrime[j] = false;
            }
        }
    }

    public boolean isPrime(int index){
        return isPrime[index];
    }
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	map<int,bool> ct;
	ct[0]=true;
	int n,s; cin>>n;
	while(n-->0) {
		cin>>s;
		for (auto rit=ct.rbegin(); rit!=ct.rend(); rit++)
			ct[(*rit).first+s]=true;
	}
	int ret=0;
	for (auto it : ct)
		if(it.first%10)
			ret=max(ret,it.first);
	cout<<ret<<"\n";
	return 0;
}

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

int main(){
  string S;
  cin >> S;
  int n = S.size()/sizeof(char);
  S=S+'R';
  int ans[n];
  for (int i=0;i<n;i++) ans[i]=0;
  int r=0;
  int l=0;
  for(int i=0;i<=n;i++){
    if (S[i]=='R'){
      r++;
      if (l!=0){
        if (l%2==1){
          ans[i-l]+=((l+1)/2);
          ans[i-l-1]+=((l-1)/2);
        } else {
          ans[i-l]+=(l/2);
          ans[i-l-1]+=(l/2);
        }
        l=0;
      }
    }else if (S[i]=='L'){
      l++;
      if (r!=0){
        if (r%2==1){
          ans[i-1]+=((r+1)/2);
          ans[i]+=((r-1)/2);
        } else {
          ans[i-1]+=(r/2);
          ans[i]+=(r/2);
        }
        r=0;
      }
    }
  }
  for (int i=0;i<n;i++) cout << ans[i] << " ";
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ll unsigned long long
using namespace std;
int main(){
    int N,M;cin>>N>>M;
    vector< pair<int,char> > S(M);
    REP(i,M){
        int k;
        char q;
        cin>>k>>q;
        S[i] = make_pair(k,q);
    }
    REP(i,1000){
        string tm = to_string(i);
        if(tm.size()==N){
            bool isk = true;
            REP(k,M){
                if(tm[S[k].first-1]!=S[k].second)isk = false;
            }
            if(isk){
                cout<<tm<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;
using ll = long long;

string a, b;

void input(){
  cin >> a >> b;
}

ll editDistance(string s, string t){
  int l1 = s.length();
  int l2 = t.length();
  int dist[l2 + 1][l1 + 1];
  for(int j = 0; j <= l2; ++j){
    dist[j][0] = j;
  }
  for(int i = 0; i <= l1; ++i){
    dist[0][i] = i;
  }
  for(int j = 1; j <= l2; ++j){
    for(int i = 1; i <= l1; ++i){
      int cost;
      if(s[i - 1] == t[j - 1]){
        cost = 0;
      }else{
        cost = 1;
      }
      int tmp = min(dist[j - 1][i] + 1, dist[j][i - 1] + 1);
      dist[j][i] = min(tmp, dist[j - 1][i - 1] + cost);
    }
  }
  return dist[l2][l1];


}

int main(){
  input();
  cout << editDistance(a, b) << endl;
}


Measured memory_bytes: 7076
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d = sc.nextInt();
    int x[][] = new int[n][d];
    int count = 0;
    for(int i=0 ; i<n ; i++){
      for(int j=0 ; j<d ; j++){
        x[i][j] = sc.nextInt();
      }
    }

    for(int i=0 ; i<n ; i++){
      for(int j=i+1 ; j<n ; j++){
        int ans = 0;
        for(int k=0 ; k<d ; k++){
          int a = Math.abs(x[i][k]-x[j][k]);
          ans = ans + a*a;
        }
        for(int k=0 ; k<=ans ; k++){
          if(ans == k*k){
            count++;
          }
        }
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21844