akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  string s; std::cin >> s;
  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    std::cout << -1 << "\n";
  } else if (s.size() < 26) {
    vector<bool> exists(26, false);
    rep(i, s.size()) exists[s[i]-'a'] = true;
    rep(i, 26) if (!exists[i]) {
      s += char('a' + i);
      break;
    }
    std::cout << s << "\n";
  } else {
    string ns = s;
    next_permutation(rng(ns));
    rep(i, s.size()) if (ns[i] > s[i]) {
      std::cout << ns.substr(0, i+1) << "\n";
      break;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"
#define all(s) s.begin(),s.end()
#define pb push_back
#define uno unordered_map
#define pi 3.1415926536
#define dig(a) fixed<<setprecision(a)
#define test(zz) int zz; cin>>zz; while(zz--)
#define foreach(var,i) for(auto i = var.begin();i!=var.end();i++)
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
ll power(ll a, ll n) {ll res = 1; while (n) {if (n % 2) {res *= a;} n >>= 1; a *= a;} return res;}
ll powerm(ll a, ll n, ll m) {ll res = 1; while (n) {if (n % 2) {res = (res * a) % m;} n >>= 1; a = (a * a) % m;} return res;}
const int M=1e9+7;
ll mod(ll x){
      return ((x%M + M)%M);
}
ll add(ll a, ll b){
      return mod(mod(a)+mod(b));
}
ll mul(ll a, ll b){
      return mod(mod(a)*mod(b));
}
const int MAX = 1e5+5;
int main(){
	fast();
//	test(t){
//		
//	}
	vector<int> v(6,0);
	int x;
	for(int i=1;i<=5;i++){
		cin>>x;
		v[i] = x;
	}
	for(int i=1;i<=5;i++){
		if(v[i]==0){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int mod = 0;
long long kaijou (int t) {
	long long res = 1;
	for (int i = 1; i < t + 1; ++i)
	{
		res *= i;
        res %= mod;
	}
	return res;
}
int main () {
	mod = pow(10,9) + 7;
	int N,M;
	cin >> N >> M;
	if(N == M){
        //cout <<kaijou(N)<<endl;
		cout << ((kaijou(N)%mod) * (kaijou(M)%mod) * 2)%mod << endl;
	}else if(abs(N - M) == 1){
		cout << ((kaijou(N)%mod) * (kaijou(M)%mod))%mod << endl;
	}else{
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

string S;

int main(){
    cin >> S;

    ll wcnt = 0;
    ll isum = 0;
  
    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == 'W') {
            wcnt++;
            isum += i;
        }
    }

    ll isum_left = wcnt * (wcnt - 1) / 2;
    ll ans = wcnt > 0 ? isum - isum_left : 0;
    cout << ans << endl;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	vector<int> input;
	rep(i, n){
		int a;
		cin >> a;
		input.push_back(a);
	}

	int x = input[0];
	REP(i, 1, n){
		x ^= input[i];
	}

	rep(i, n){
		int a = x xor input[i];
		cout << a << " ";
	}

	return 0;
}

Measured memory_bytes: 4296
program sample
    implicit none  !二分探索
    integer(8) ::c,i,j,m(12),n,k,a1,b1,c1
    character(len=1)::a
    character(len=1),allocatable::s(:)
    character(len=1)::t(1:26)
    t=(/'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'/)
    read(*,*) a

    do i=1,26
        if(a==t(i))then
            write(*,*)'a'
            stop
        end if
    end do
    write(*,*)'A'
    stop

end program sample
  



Measured memory_bytes: 2860
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{
    int n;
    scn(n);

    bool fnd = 0;

    rep(i, 0, n) {
        int val;
        scn(val);
        fnd |= val & 1;
    }

    puts(fnd? "first": "second");
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3760
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

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

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

for i in range(m):
    a,b = map(int,input().split())
    uf.union(a-1,b-1)
    
print(uf.group_count()-1)

Measured memory_bytes: 12756
#include <stdio.h>
int main()
{
    int i, j, n;
    scanf("%d", &n);

    for (i = 1; i <= n; i++) {
        if (i % 3 == 0) {
            printf(" %d", i);
        }
        else {
            j = i;
            while (j > 0) {
                if (j % 10 == 3) {
                    printf(" %d", i);
                    break;
                }
                j = j / 10;
            }
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()


int main() {
	
	ll N, K;
	cin >> N >> K;
	vll x(N);
	rep(i, N) cin >> x[i];

	vll ans;
	ll n = lower_bound(all(x), 0) - x.begin();	// 0以上のうち最も左側
	rep(i, K + 1) {
		ll left = n - K + i, right = n - 1 + i;
		if (0 <= left && right < N) {
			if (i == 0) ans.push_back(-x[left]);
			else if (i == K) ans.push_back(x[right]);
			else ans.push_back(min(-x[left] * 2 + x[right], -x[left] + x[right] * 2));
		}
	}

	cout << *min_element(all(ans)) << endl;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define chmax(x,y) x = max(x, y)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int main()
{
    int x;
    cin >> x;
    if(x) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define INF 2000000000
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int s,i=1;
	cin >> s;
	while (s != 4 && s != 2 && s != 1) {
		if (s % 2 == 0) {
			s /= 2;
		}
		else {
			s = s * 3 + 1;
		}
		i++;
	}
	cout << i + 3 << endl;
}



Measured memory_bytes: 256
a, b = map(int,input().split())
c=a//0.08
d=b/0.1
if a%0.08 != 0:
  c += 1

e=(a+1)//0.08
if (a+1)%0.08 == 0:
  e -= 1
  
f=(b+1)/0.1 - 1

if max(c,d) <= min (e,f):
  print(int(max(c,d)))
else:
  print(-1)
 

Measured memory_bytes: 3064
//xtwakioi! xtwddYnoi(双重含义)!
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200100, Mod=1e9+7;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
int n,m,x[N],y[N],p,q;
signed main()
{
    n=read(), m=read();
    for(ri int i=1;i<=n;i++) x[i]=read();
    for(ri int i=1;i<=m;i++) y[i]=read();
    for(ri int i=1;i<=n;i++) p=(p+(i*2-n-1)*x[i]%Mod)%Mod;
    for(ri int i=1;i<=m;i++) q=(q+(i*2-m-1)*y[i]%Mod)%Mod;
    printf("%lld\n",(p%Mod*q%Mod+Mod)%Mod);
    return 0;
}

Measured memory_bytes: 5244
//c
#include <iostream>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <functional>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>

#define REP(i,b,n) for(int i=b;i<n;i++)
#define REPR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PB push_back
#define MP make_pair

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> pii;

ll d, n, m;

int solve(vector<ll> shop){

	ll res = 0;
	
	for(ll i=0; i<m; ++i){
		
		ll a;
		cin>>a;
		
		vector<ll>::iterator it = upper_bound(shop.begin(), shop.end(), a);
		res += min( *it - a, a - *(it-1));
	}
	
	return res;
}

int main(){
	
	while(cin>>d,d){
		
		vector<ll> shop;
		cin>>n>>m;
		
		shop.push_back(-d);
		shop.push_back(0);
		shop.push_back(d);
		
		for(ll i=0; i<n-1; ++i){
		
			ll a;
			cin>>a;
			shop.push_back(a-d);
			shop.push_back(a);
			shop.push_back(a+d);
		}
		
		sort(shop.begin(), shop.end());
		
		cout << solve(shop) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 5832
#include <iostream>

using namespace std;

int GCD(int a, int b)
{
	int gcd;
	while (a > 0 && b > 0)
	{
		if (a > b)
		{
			a %= b;
		}
		else
		{
			b %= a;
		}
	}
	if (a > 0)
	{
		gcd = a;
	}
	else
	{
		gcd = b;
	}
	return gcd;
}

int LCM(int a, int b)
{
	int init_a = a;
	int init_b = b;
	while (1)
	{
		while (a > b)
		{
			b += init_b;
		}
		if (a == b) break;
		a += init_a;
	}
	return a;
}

int main()
{
	int a, b;
	while (cin >> a >> b, !cin.eof())
	{
		cout <<	GCD(a, b) << " " << LCM(a, b) << endl;
	}
	return 0;
}


Measured memory_bytes: 2992
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,w,m,Q, a[100500], start;
ll hash1[200500], hash2[200500], p2[200500];
string s;
ll get1(ll x, ll y)
{
    return hash1[y+1] - hash1[x]*p2[y+1-x];
}
ll get2(ll x, ll y)
{
    return hash2[x] - hash2[y+1]*p2[y+1-x];
}
int main() {
    //freopen("input.txt", "r", stdin);
    cin >> s;
    n = s.size();
    k = n*(n-1)/2+1;
    for (i = 0; i < n; i++)
    {
        a[s[i]-'a']++;
    }
    for (i = 0; i < 26; i++)
    {
        k -= a[i]*(a[i]-1)/2;
    }
    cout << k << endl;
    /*for (i = 0; i < n; i++)
    {
        hash1[i+1] = hash1[i]*47+s[i]-'a';
    }
    for (i = n-1; i >= 0; i--)
    {
        hash2[i] = hash2[i+1]*47+s[i]-'a';
    }
    p2[0] = 1;
    for (i = 1; i <= 200000; i++)
        p2[i] = p2[i-1]*47;
    for (i = 0; i < n; i++)
    {
        ll l = 0, r = min(n-i-1, i);
        while (l < r)
        {
            ll mid = (l+r+1)/2;
            if (get1(i-mid,i) == get2(i,i+mid))
                l = mid;
            else
                r = mid-1;
        }
        k += l+1;
    }
    for (i = 0; i < n-1; i++)
    if (s[i] == s[i+1])
    {
        ll l = 0, r = min(n-i-2, i);
        while (l < r)
        {
            ll mid = (l+r+1)/2;
            if (get1(i-mid,i) == get2(i+1,i+mid+1))
                l = mid;
            else
                r = mid-1;
        }
        k += l+1;
    }
    cout << n*(n+1)/2-k+1 << endl;*/
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<((ll)n);i++)
#define rep1(i,n) for(ll i=1;i<=((ll)n);i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define meow(a) cout<<a<<" meow\n";
typedef pair<long long,long long> pii;
const ll maxn=200005;
const ll MOD=998244353;
double mypow(ll a,ll b){
	double res=1;
	while(b){
		if(b&1) res=res*a;
		a=a*a;

		b>>=1;
	}
	return res;
}
ll n,k;
string s;
ll a[3];

int main()
{
    //IOS;
    while(cin>>a[0]>>a[1]>>a[2])
    {
        sort(a,a+3);
        cout<<a[0]*a[1]/2<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(S: str, K: int):
    for i,s in enumerate(S):
        if s != "1":
            print(s)
            return
        elif i == (K - 1):
            print(s)
            return
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: int
    K = int(next(tokens))  # type: int
    solve(S, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
xyh = [LI() for _ in range(n)]
lst = []
for cx in range(101):
    for cy in range(101):
        for x,y,h in xyh:
            X,Y = abs(cx-x), abs(cy-y)
            if h == 0:
                lst.append([X+Y,cx,cy,1])
            else:
                lst.append([X+Y+h,cx,cy,0])

max_h = 0
for a,b,c,d in lst:
    if d:
        max_h = max(max_h, a)
    else:
        for x,y,h in xyh:
            if max(a - abs(x-b) - abs(y-c),0) != h:
                break
        else:
            print(b,c,a)
            quit()
for cx in range(101):
    for cy in range(101):
        for H in range(1,max_h+1):
            for x,y,h in xyh:
                if max(H - abs(x-cx) - abs(y-cy),0) != h:
                    break
            else:
                print(cx,cy,H)
                quit()

Measured memory_bytes: 153692
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
  for(;;) {
    int n, m, a, b, c, t;
    cin >> n >> m >> a >> b >> c >> t;
    if(n == 0) break;
    vector<int> ss;
    for(int i = 0; i < n; i++) {
      int s;
      cin >> s;
      ss.push_back(s);
    }
    // 0 < n <= 50
    // 0 < m <= 1000
    // 0 <= t <= 10^9 -> O(log t) is necessary
    // result = X^t A
    //    = [b c 0 ...; a b c 0 ...; ...; ... 0 a b]^T * [a0; a1; ...; an-1]

    vector<vector<int>> y(n, vector<int>(n, 0)); // to be X^(2^k)
    vector<vector<int>> z(n, vector<int>(n, 0)); // to be X^t
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if(i == j) {
          y[i][j] = b;
          z[i][j] = 1;
        } else if(i == j + 1) {
          y[i][j] = a;
        } else if(i == j - 1) {
          y[i][j] = c;
        }
      }
    }
    // z *= y
    auto mul = [](int n, int m, vector<vector<int>> &z, vector<vector<int>> &y) {
      int t[n][n];
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
          int c = 0;
          for(int k = 0; k < n; k++) {
            c = (c + (z[i][k] * y[k][j]) % m) % m;
          }
          t[i][j] = c;
        }
      }
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
          z[i][j] = t[i][j];
        }
      }
    };
    // computing X^t in O(log t) steps
    while(t != 0) {
      if(t & 1) { // z *= y
        mul(n, m, z, y);
      }
      mul(n, m, y, y);
      t >>= 1;
    }
    // compute and print the answer
    for(int i = 0; i < n; i++) {
      int r = 0;
      for(int k = 0; k < n; k++) {
        r = (r + (z[i][k] * ss[k]) % m) % m;
      }
      if(i > 0) cout << " ";
      cout << r;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3172
#include <stdio.h>

int main(){
    int n=0;
    int l[100]={0};
    int i;
    int a=0;
    int sum=0;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&l[i]);
        if(a<l[i]){
            a=l[i]; 
         }
         sum+=l[i];
    }
    sum=sum-a;
    if(a<sum){
        printf("Yes");
    }else if(a>=sum){
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    a, b, t = LI()
    res = 0
    for i in range(a, 21, a):
        if i < t + 0.5:
            res += b

    return res


print(main())


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();


		if (N%2 == 0) {
			if (N/2 >= K) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} else {
			if ((N/2 + 1) >= K) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}
	}
}


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

 
class ModInt{
  static const int default_mod = 1e9 + 7;
public:
  ModInt(long long val, int mod)
    : val(val % mod), mod(mod)
  {
  }
  ModInt(long long val)
    : ModInt(val, default_mod)
  {
  }
  ModInt operator* (const ModInt& another){
    return ModInt(val * another.val);
  }
  ModInt operator+ (const ModInt& another){
    return ModInt(val + another.val);
  }
  ModInt operator- (const ModInt & another){
    return ModInt(val - another.val + mod);
  }
  ModInt& operator*=(const long long rhs){
    this->val *= rhs;
    this->val %= mod;
    return *this;
  }
  
  ModInt pow(long long exponent){
    exponent %= mod;
    if(exponent == 0){
      return ModInt(1, mod);
    }else{
      if(exponent % 2){
        return ((*this) * (*this)).pow(exponent / 2) * (*this);
      }else{
        return ((*this) * (*this)).pow(exponent / 2);
      }
    }
  }
  ModInt inv(){
    return this->pow(mod - 2);
  }
  static ModInt fact(long long n, int mod){
    n %= mod;
    auto ret = ModInt(1, mod);
    while(n > 1){
      ret *= n;
      n--;
    }
    return ret;
  }
  static ModInt fact(long long n){
    return ModInt::fact(n, default_mod);
  }
  static ModInt comb(long long n, long long r, int mod){
    if(r > n){
      return ModInt(0, mod);
    }
    return ModInt::fact(n) * ModInt::fact(r).inv() * ModInt::fact(n - r).inv();
  }
  static ModInt comb(long long n, long long r){
    return ModInt::comb(n, r, default_mod);
  }
 
  friend ostream& operator<< (ostream& os, const ModInt& modint){
    os << modint.val;
    return os;
  }
  friend istream& operator>>(istream& is, ModInt& modint){
    long long val;
    cin >> val;
    modint.val = val % modint.mod;
  }
private:
  long long val;
  int mod;
};

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

  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());

  long long fact[100000] = {};
  fact[0] = 1;
  const long long mod = 1e9 + 7;
  for(int i = 1; i < N; i++){
    fact[i] = fact[i - 1] * i % mod;
    //cout << i << ' ' << fact[i] << endl;
  }

  ModInt ans(0);
  for(int i = K - 1; i < N; i++){
    ans = ans + ModInt(fact[i]) * ModInt(fact[K - 1]).inv() * ModInt(fact[i - K + 1]).inv() * A[i];
  }
  for(int i = 0; i <= N - K; i++){
    ans = ans - ModInt(fact[N - i - 1]) * ModInt(fact[K - 1]).inv() * ModInt(fact[N - i - K]).inv() * A[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    x, a, b = map(int, readline().split())
    if abs(x-a)<=abs(x-b):
        print('A')
    else:
        print('B')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
#include<cstdio>
int main(){
	int a[10];
	char p[10];
	while(scanf("%s",p)!=EOF){
		for(int i=0;i<10;i++)a[i]=p[i]-'0';
		printf("%d\n",(a[0]*1+a[1]*9+a[2]*36+a[3]*84+a[4]*126+a[5]*126+a[6]*84+a[7]*36+a[8]*9+a[9]*1)%10);
	}
	return 0;
}

Measured memory_bytes: 968
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

	private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	}

	private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	}

	private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
 
string s;
 
int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	cout << s.substr(0, (int)s.size()-8);
	return 0;
}

Measured memory_bytes: 256
from math import atan,pi
import sys
def input(): return sys.stdin.readline().strip()

def main():
    a,b,x=map(int,input().split())
    y = 2*x/(a*b)
    if y <= a:
        print(180*atan(b/y)/pi)
    else:
        z=2*b-(2*x)/(a*a)
        print(180*atan(z/a)/pi)
    
main()

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


void solve(long long N, std::vector<long long> A){
    std::vector<long long> B(N);

    rep(i,N-1){
        B[A[i]-1] += 1;
    }
    
    rep(i,N){
        cout << B[i] << endl;
    }

}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, A);
    return 0;
}


Measured memory_bytes: 8020
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;

vector<int> a;
int main (){
    for(int i=0; i<3; i++) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort( a.rbegin(), a.rend());
    cout << a[0] * 10 + a[1] + a[2] << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
	"sort"
)

var N, ans int

func main() {
	fmt.Scan(&N)
	s := make([]int, N)

	for i := 0; i < N; i++ {
		fmt.Scan(&s[i])
		ans += s[i]
	}

	sort.Ints(s)

	if ans%10 == 0 {
		for i := 0; i < N; i++ {
			if s[i]%10 != 0 {
				ans -= s[i]
				break
			}
		}
		if ans%10 == 0 {
			fmt.Println(0)
			return
		}
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type si struct {
	s int
	i int
}

type SortBy []si

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i].s < a[j].s }


Measured memory_bytes: 512
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
long double pi=3.14159265358979323846L;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
void nckinit(ll n,ll md){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=md;
  }
  gya[n]=gyaku(kai[n],md);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=md;
  }
  gya[0]=1;
}
ll nck(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  ret*=gya[k];
  ret%=md;
  return ret;
}
ll npk(ll n,ll k,ll md){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=md;
  return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,k;cin>>n>>k;
    ll a[n];rep(i,0,n)cin>>a[i];
    sort(a,a+n);
    nckinit(n+1,mod);
    ll ans=0;
    rrep(i,n-1,0){
        if(k-1>i)break;
        ans+=(nck(i,k-1,mod)*a[i])%mod;
        ans%=mod;
    }
    rep(i,0,n){
        if(k-1>n-1-i)break;
        ans=ans-(nck(n-1-i,k-1,mod)*a[i])%mod+mod;
        ans%=mod;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 5888
import itertools

N, M = map(int, input().split())
G = [[]  for _ in range(N)]
for i in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    G[a].append(b)
    G[b].append(a)
pattern = [i for i in range(N)]

ans = 0
for i in itertools.permutations(pattern):
    flag = True
    if i[0] != 0:
        continue
    for j in range(len(i) - 1):
        if not i[j+1] in G[i[j]]:
            flag = False
    if flag:
        ans += 1
print(ans)

Measured memory_bytes: 73616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

const ll MOD=1e9+7;

ll ad(ll x,ll y=0){
  return (x+y)%MOD;
}

ll mlt(ll x,ll y=1){
  return (x*y)%MOD;
}

ll pwr(ll x,ll y){
  ll pw[32]={},w=1;
  pw[0]=x;
  fr(i,31) pw[i+1]=mlt(pw[i],pw[i]);
  fr(i,32){
    w=mlt(w,1+(y%2)*(pw[i]-1));
    y/=2;
  }
  return w;
}

ll inv(ll x){
  return pwr(x,MOD-2);
}

int main(){
    int n,a[500010],X=0,sx[500010]={},x[500010]={},t[500010]={};
    cin>>n;
    fr(i,n){
        cin>>a[i];
        X^=a[i];
        t[i+1]=t[i]+(X==0);
        sx[i+1]=X;
    }
    if(X){
        ll ans=0,s=0,b=-1;
        Fr(i,n){
            if(sx[i]==X){
                if(b<0){
                    ans=1;
                    s=1;
                    b=i;
                }
                else{
                    s=ad(s,mlt(t[i]-t[b],ans));
                    ans=ad(ans,s);
                    b=i;
                }
              //cout<<i<<" "<<ans<<endl;
            }
        }
        cout<<s<<endl;
    }
    else{
        ll ans[1<<20]={},s[1<<20],an=0;
        vector<ll> b(1<<20,-1);
        Fr(i,n){
            if(sx[i]==0) continue;
            if(b[sx[i]]<0){
                ans[sx[i]]=1;
                s[sx[i]]=1;
                b[sx[i]]=i;
            }
            else{
                s[sx[i]]=ad(s[sx[i]],mlt(t[i]-t[b[sx[i]]],ans[sx[i]]));
                ans[sx[i]]=ad(ans[sx[i]],s[sx[i]]);
                b[sx[i]]=i;
            }
        }
        Fr(i,(1<<20)-1) an=ad(an,ans[i]);
        an=ad(an,pwr(2,t[n]-1));
        cout<<an<<endl;
    }
}

Measured memory_bytes: 30720
#[allow(unused_macros)]
macro_rules! debug {
  ($($e:expr), *) => {println!(concat!($(stringify!($e), " = {:?}\n"), *), $($e), *)}
}

fn main() {
  let (r1,r2) = get::tuple::<f64,f64>();
  let ans = 1.0 / (1.0/r1 + 1.0/r2);
  println!("{}", ans)
}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}


Measured memory_bytes: 4352
from math import gcd

N = int(input())
A = list(map(int, input().split()))

def isSetwise(A):
    ret = A[0]
    for a in A:
        ret = gcd(ret, a)
    return ret == 1
from collections import Counter

def createPrimeList(N):
    isPrime = [True] * (N + 1)
    isPrime[0] = False
    isPrime[1] = False
    smallestPrime = [1] * (N + 1)
    for i in range(2, N + 1):
        if not isPrime[i]:
            continue
        for p in range(i * 2, N, i):
            if isPrime[p]:
                smallestPrime[p] = i
            isPrime[p] = False
    return smallestPrime

from collections import Counter
smallestPrime = createPrimeList(max(A) + 10)
def primeFactorization(N):
    ret = Counter()
    while N > 1:
        p = smallestPrime[N]
        if p == 1:
            ret[N] += 1
            break
        ret[p] += 1
        N //= p
    return ret

def isPairwise(A):
    P = Counter()
    for a in A:
        for p in primeFactorization(a):
            if P[p] >= 1:
                return False
            P[p] += 1
    return True

if not isSetwise(A):
    print('not coprime')
    exit()

if isPairwise(A):
    print('pairwise coprime')
else:
    print('setwise coprime')


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

int main(){
  int n; cin>>n;
  string s,t; cin>>s>>t;
  long long ans=1;
  if(n==1){
    cout<<3<<endl;
    return 0;
  }
  bool flag =false;
  int i=0;
  while(i<n){
    if(i==0){
      if(s[0]==t[0] && s[1]==t[1]){
        flag=true;
        i+=2;
      }else if(s[0]==t[0]){
        i+=3;
      }else if(s[2]==t[2]){
        i+=3;
        flag=true;
      }
      else{
        i+=4;
        ans=3*2*1*2+3*2*1*1;
        continue;
      }
      ans=6;
      continue;
    }
    if(s[i]==t[i]){
      i++;
      if(flag){
        ans*=2;
      }else{
        flag=true;
      }
    }else{
      i+=2;
      if(flag){
        flag=false;
        ans*=2;
      }else{
        ans*=3;
      }
    }ans%=1000000007;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System.Linq;
using System;
 
namespace Application
{
	class Solution
	{
		static void Main(string[] args)
		{
			var inputLine = Console.ReadLine();
			var numberCount = int.Parse(inputLine);
 
			inputLine = Console.ReadLine();
			var numbers = inputLine.Split(' ')
				.Select(w => decimal.Parse(w))
				.ToList();
 
			decimal result = 0;
			while (true)
			{
				if (numbers.Any(d => d % 2 == 1))
					break;
 
				for(var i = 0; i < numbers.Count; i++)
				{
					numbers[i] = numbers[i] / 2;
				}
				result++;
			}
 
			Console.WriteLine(result);
		}
	}
}

Measured memory_bytes: 13396
#include <cstdio>
#include <cmath>

using namespace std;
using LL=long long;

int n, c, dp[2][200005], f[2], tag[200005], g[200005];
char s[200005];

int main() {
    scanf("%d%s", &n, s + 1);
    for (int i = 1; i <= n; i++)
        g[i] = g[i % __builtin_popcount(i)] + 1;
    for (int i = 1; i <= n; i++)
        if (s[i] == '1')
            c++;
    dp[0][0] = dp[1][0] = 1;
    for (int i = 1; i <= n; i++) {
        dp[0][i] = dp[0][i - 1] * 2 % (c + 1);
        if (c > 1)
            dp[1][i] = dp[1][i - 1] * 2 % (c - 1);
    }
    for (int i = 1; i <= n; i++) {
        f[0] = (f[0] * 2 + s[i] - '0') % (c + 1);
        if (c > 1)
            f[1] = (f[1] * 2 + s[i] - '0') % (c - 1);
    }
    for (int i = 1; i <= n; i++) {
        if (s[i] == '1') {
            if (c > 1)
                tag[i] = (f[1] - dp[1][n - i] + (c - 1)) % (c - 1);
            else
                tag[i] = -1;
        } else
            tag[i] = (f[0] + dp[0][n - i] + (c + 1)) % (c + 1);
    }
    for (int i = 1; i <= n; i++)
        printf("%d\n", tag[i] < 0 ? 0 : g[tag[i]] + 1);
    return 0;
}

Measured memory_bytes: 5112
use io::*;
use std::cmp;

fn main() {
    let input = read_string();
    let mut sc = Scanner::new(&input);
    let d: usize = sc.next();
    let g: usize = sc.next();
    let mut v: Vec<usize> = Vec::new();
    let mut comp: Vec<usize> = Vec::new();
    let mut total = 0;
    for i in 1..d+1 {
        let p: usize = sc.next();
        let c: usize = sc.next();
        v.push(p);
        total += p;
        comp.push(100 * i * p + c);
    }
    let mut ans = total;
    for i in 0..1<<d {
        let mut score = g as i64;
        let mut rest: Vec<usize> = Vec::new();
        let mut num = 0;
        for j in 0..d {
            if (i >> j) % 2 == 1 {
                score -= comp[j] as i64;
                num += v[j];
            } else {
                rest.push(j+1);
            }
        }
        for j in rest.into_iter().rev() {
            if score <= 0 {
                break;
            }
            let t = cmp::min((score - 1) as usize / (100 * j) + 1, v[j-1] - 1);
            score -= (100 * j * t) as i64;
            num += t;
        }
        if score <= 0 {
            ans = cmp::min(ans,num);
        }
    }
    println!("{}", ans);
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }

        pub fn next_mat<T: FromStr>(&mut self, w: usize, h: usize) -> Vec<Vec<T>> {
            (0..h).map(|_| self.next_vec(w)).collect()
        }

        pub fn next_vec_char(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }

        pub fn next_mat_char(&mut self, n: usize) -> Vec<Vec<char>> {
            (0..n).map(|_| self.next_vec_char()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 4352
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    }

    static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    }
}


Measured memory_bytes: 27988
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    long k = sc.nextLong();
    long[] sa = new long[n + 1];
    long[] sb = new long[m + 1];
    for(int i = 1; i <= n; i++) {
      sa[i] = sa[i - 1] + sc.nextLong(); 
    }
    for(int i = 1; i <= m; i++) {
      sb[i] = sb[i - 1] + sc.nextLong();
    }
    int ans = 0;
    for(int i = 0; i <= n; i++) {
      if(sa[i] <= k) {
        long t = k - sa[i];
        int left = 0;
        int right = m + 1;
        int a = 0;
        while(left < right) {
          int med = (left + right) / 2;
          if(sb[med] <= t) {
            a = med;
            left = med + 1;
          } else {
            right = med;
          }
        }
        ans = Math.max(ans, i + a);
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 63168
n = int(input())
A = input()
B = input()
C = input()

ans = 0

for a, b, c in zip(A, B, C):
    if a == b and b == c:
        continue
    if a == b or b == c or a == c:
        ans += 1
        continue
    ans += 2

print(ans)

Measured memory_bytes: 3060
n = int(input())
count = 0
dices = []
for i in range(n):
    a, b = map(int, input().split())
    dices.append([a, b])
for i in dices:
    if count == 3:
        ans = 'Yes'
        break
    if i[0] == i[1]:
        count += 1
    else :
        count = 0
        pass

print('Yes' if count == 3 else 'No')


Measured memory_bytes: 9160
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second



void solve()
{
   ll n,w,i,j,max_val;
   cin >> n >> w;
   ll wt[n+1];
   ll v[n+1];
   for(i=0;i<n;i++)
   {
       cin >> wt[i+1] >> v[i+1];
   }
   max_val = 1e5 + 100;

   ll dp[n+1][max_val];
   for(i=0;i<n+1;i++)
        for(j=0;j<max_val;j++)
            dp[i][j] = 1e15;

   dp[0][0] = 0;
   for(i=1;i<n+1;i++)
   {
       for(j=0;j<1e5+10;j++)
       {
           if(v[i] <= j)
                dp[i][j] = min(dp[i-1][j], wt[i] + dp[i-1][j-v[i]]);
           else
           {
               dp[i][j] = dp[i-1][j];
           }
       }
   }
   ll ans = 0;
   for(i=1;i<n+1;i++)
   {
       for(j=0;j<1e5+10;j++)
       {
           if(dp[i][j] <= w && ans <= j)
           {
               ans = j;
           }
       }
   }
   cout << ans;
}
int main()
{

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
	//cin >> t;
	while(t-- > 0)
	{
		solve();
	}

}

Measured memory_bytes: 82640
from math import factorial

N,M = map(int, input().split())
mod = 10 ** 9 + 7

if abs(N-M) > 1:
    print(0)
    exit()

n_frac = factorial(N) 
m_frac = n_frac
if N-M == 0:
    print((n_frac*m_frac)*2%mod)
else:
    if N > M:
        m_frac //= N
    else:
        m_frac *=  M
    print(n_frac*m_frac%mod)

Measured memory_bytes: 5184