akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long LL;
int main(){
	LL n,m;
	while(~scanf("%lld%lld",&n,&m)){
		LL t = n*m;
		if(m == 0 || n == 0) printf("0\n");
		else if(m == 1 || n == 1) printf("%lld\n",t-2>0?t-2:1);
		else{
			LL x = n*2+m*2;
			printf("%lld\n",t-x+4);
		}
	}
	return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N; cin >> N;
	cout << N*(N-1)/2-N/2 << endl;
	int z = (N%2==1?N:N+1);
	repp(i,1,N+1) repp(j,i+1,N+1) if(i+j != z) cout << i << ' ' << j << endl;
	return 0;
}


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

constexpr int maxn = 1e5 + 100;

int root = 0;
set<int> vec[maxn] = {};
bool is_linear[maxn] = {};

void dfs1(int cur, int prev){
    vec[cur].erase(prev);
    is_linear[cur] = (vec[cur].size() <= 1);
    for(auto& next : vec[cur]) dfs1(next, cur), is_linear[cur] = (is_linear[cur] && is_linear[next]); }

int dfs2(int cur, int prev){
    int nr_linear = 0, sol = 0;
    for(auto& next : vec[cur]){
        if(is_linear[next]) ++nr_linear;
        else sol += dfs2(next, cur); }
    sol += max(nr_linear-1, 0);
    return sol; }

int main(){
    int n;
    cin >> n;
    for(int i = 0, a, b; i < n-1; ++i){
        cin >> a >> b;
        vec[a].insert(b);
        vec[b].insert(a); }

    while(root < n && vec[root].size() < 3) ++ root;
    if(root == n){
        cout << 1;
        return 0; }
    dfs1(root, -1);
    cout << dfs2(root, -1) << endl;
    return 0;
}

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


int main(){

  int N,K;
  string S;
  cin >> N >> K;
  cin >> S;

  for(int i=0; i<N; i++){
     if(i==K-1){
         S[i] = S[i] + 0x20;
     }
  }
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		int a, b, c;
		a= stdin.nextInt();
		b= stdin.nextInt();
		c= stdin.nextInt();
		if(a+b>=c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


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

int main() {
    ll r=0;
    string S;
    cin >> S;
    int l=S.size();

    rep(i,1<<(l-1)) {
        ll p=S.at(0)-'0', t=0;
        rep(j,l-1)
            if(i & 1<<j)
                p = p*10+S.at(j+1)-'0';
            else {
                t += p;
                p = S.at(j+1)-'0';
            }
        r += t+p;
    }

    cout << r << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, W[SIZE];
  int sum = 0;

  cin >> N;

  for (int i=0; i<N; i++) {
    cin >> W[i];
    sum += W[i];
  }

  int cur = 0;
  int ans = INF;

  for (int i=0; i<N-1; i++) {
    cur += W[i];
    ans = min(ans, abs((sum - cur) - cur));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0

for i in range(n):
  if b[i] <= a[i]:
    count = count + b[i]
  elif a[i] < b[i]:
    count = count + a[i]
    b[i] = b[i] - a[i]
    if a[i+1] <= b[i]:
      count = count + a[i+1]
      a[i+1] = 0
    elif b[i] < a[i+1]:
      count = count + b[i]
      a[i+1] = a[i+1] - b[i]
      
print(count)

Measured memory_bytes: 82020
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>

using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
int const inf = 1 << 29;

int main(){
    int w, h;
    while (cin >> w >> h && w | h){
        vector<string> grid(h);
        vector<pair<int,int>> node;
        rep(i, h){
            cin >> grid[i];
            rep(j, grid[i].size())if (grid[i][j] == 'o')node.emplace_back(i, j);
        }
        rep(i, h)rep(j, w){
            if (grid[i][j] == '*')node.emplace_back(i, j);
        }

        static int d[20][20];
        rep(i, 20)rep(j, 20)d[i][j] = inf;

        rep(i, node.size()){
            int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, 1, 0, -1 };
            queue<pair<int, int>> q;
            static int dist[25][25];
            rep(j, h)rep(k, w)dist[j][k] = inf;
            dist[node[i].first][node[i].second] = 0;
            q.emplace(node[i]);

            while (q.size()){
                auto p = q.front(); q.pop();
                int cx = p.second, cy = p.first;
                rep(j, 4){
                    int nx = cx + dx[j], ny = cy + dy[j];
                    if (nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
                    if (grid[ny][nx] == 'x') continue;
                    if (dist[ny][nx] > dist[cy][cx] + 1){
                        dist[ny][nx] = dist[cy][cx] + 1;
                        q.emplace(ny, nx);
                    }
                }
            }

            rep(j, node.size()){
                d[i][j] = dist[node[j].first][node[j].second];
            }
        }

        int idx[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
        long long ans = inf;
        do{
            long long t = 0;
            rep(i, node.size() - 1){
                t += d[idx[i]][idx[i + 1]];
            }
            ans = min(t, ans);
        } while (next_permutation(idx + 1, idx + node.size()));
        if (ans >= inf)ans = -1;
        cout << ans << endl;
    }
}

Measured memory_bytes: 1232
#include <bits/stdc++.h> 
using namespace std;
 
typedef signed long long ll;
const int MX = 1e6 + 5;

int main() {
	ll a, b, g, l;
	cin >> a >> b;
	g = __gcd(a, b);
	l = a / g * b;
	cout << l << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
t = [0 for i in range(M+1)]
for i in range(N):
  A = list(map(int, input().split()))
  for j in range(1, A[0]+1):
    t[ A[j] ] += 1
ans = 0
for i in t:
  if i == N:
    ans += 1
print(ans)


Measured memory_bytes: 9188
program main
 implicit none
 integer*8 p,q,r
 read(*,*) p,q,r
 if (p>=q .and. p>=r) then
  write(*,*) q+r
 else if(q>=p .and. q>=r) then
  write(*,*) p+r
 else
  write(*,*) p+q
 end if
end program main

Measured memory_bytes: 768
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int sum = 0;
    if(a < b){
      sum += a;
    }else{
      sum += b;
    }
    if(c < d){
      sum += c;
    }else{
      sum += d;
    }
    System.out.println(sum);
  }
}

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

int main() {
    const int S=0;
    const int H=1;
    const int C=2;
    const int D=3;
    int N;
    cin >>N;
    vector<vector<bool>> A(4, vector<bool> (14, true));
    const vector<char> M={'S', 'H', 'C', 'D'};
    for (int i=0; i<N; i++) {
        char c;
        int n;
        cin >>c >>n;
        for (int j=0; j<4; j++)
            if (c==M.at(j))
                A.at(j).at(n)=false;
    }
    for (int i=0; i<=3; i++)
        for (int j=1; j<=13; j++)
            if (A.at(i).at(j))
                cout <<M.at(i) <<' ' <<j <<endl;
    return 0;
}


Measured memory_bytes: 3100
a, b, c = map(int, input().split())  # 複数数値入力

d = min(a, b)
for i in reversed(range(d)):
    if a % (i + 1) == 0 and b % (i + 1) == 0:
        c -= 1

    if c == 0:
        print(i + 1)
        break


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

int main() {
    int x;
    cin >> x;
    int c500 = x / 500;
    int r500 = x % 500;
    int c5 = r500/5;
    cout << c500*1000 + c5 * 5 << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void A_task();

int main()
{
	A_task();
	
	fflush(stdout);
	return 0;
}

static void A_task()
{
	char szS[5] = { 0 };

	scanf(" %s", szS);

	std::map<char, int> list;
	for (int i = 0; i < 4; i++) {
		list[szS[i]]++;
	}

	const char* ans = "No\n";
	if ((list.size() == 2) && (list[szS[0]] == 2)) {
		ans = "Yes\n";
	}
	printf(ans);
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final char[] chs = sc.next().toCharArray();
			
			for(int i = 0; i < chs.length; i++) {
				if(i % 2 == 0) {
					if(chs[i] == 'L') {
						System.out.println("No");
						return;
					}
				}else {
					if(chs[i] == 'R') {
						System.out.println("No");
						return;
					}
				}
			}
			
			System.out.println("Yes");
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

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


vector<ll> v[210005];
vector<ll> cnt(2);
vector<ll> used(210005,0);



int dfs(ll x){
  if(x>=100005)cnt[1]++;
  if(x<100005)cnt[0]++;
  used[x]=1;
  for(ll t:v[x]){
    if (used[t])continue;
    dfs(t);
  }
  return 0;
}
int main() {
  ll n;
  cin>>n;
  vector<P> p;
  rep(i,n){
    ll x1,y1;
    cin>>x1>>y1;
    x1--; y1+=100005;
    v[x1].emplace_back(y1);
    v[y1].emplace_back(x1);
    p.push_back(make_pair(x1,y1));
  }
  ll ans=0;
  rep(i,n){
    dfs(p[i].first);
    ans+=cnt[0]*cnt[1];
    cnt[0]=0;cnt[1]=0;
  }
  ans-=n;
  cout<<ans;
}


Measured memory_bytes: 14576
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k,mi = 999999999;
  cin >> n >> k;
  int h[n],a[n];
  for(int i=0; i<n; i++){
    cin >> h[i];
  }
  a[0] = 0;
  a[1] = abs(h[1]-h[0]);
  for(int i=2; i<n; i++){
    for(int j=1; j<=min(k,i); j++){
      mi = min(mi,abs(h[i-j]-h[i])+a[i-j]);
    }
    a[i] = mi;
    mi = 999999999;
  }
  /*for(int i=0; i<n; i++){
    cout << a[i] << " ";
  }*/
  cout << a[n-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>

int main(void)
{
	uint32_t week;
	std::cin >> week;

	uint32_t base = 100000;

	for (int i = 0; i < week; i++)
	{
		uint32_t rishi = base * 0.05;
		if (rishi % 1000 > 0)
		{
			rishi = rishi / 1000 * 1000;
			rishi += 1000;
		}
		base += rishi;
	}
	
	std::cout << base << std::endl;

	return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;cin>>N;
  int m=0,cnt=0;
  int hz;
  cin>>hz;
  for(int i=1;i<N;i++){
    int h;cin>>h;
    if(hz>=h)cnt++;
    else cnt=0;
    m=max(m,cnt);
    hz=h;
  }
  cout<<m<<endl;
}

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

int main() {
  
 int X,Y;
  cin >>X>>Y;
  int sum=0;
  if(X==1){sum+=300000;}
  else if(X==2){sum+=200000;}
  else if(X==3){sum+=100000;}
  
  if(Y==1){sum+=300000;}
  else if(Y==2){sum+=200000;}
  else if(Y==3){sum+=100000;}
  
  if(X==1&&Y==1){sum+=400000;}
  
  cout << sum <<endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
//MAX

int main() {

	int N, a[105], al = 0, bo = 0;

	cin >> N;
	for (int i; i < N; i++) {

		cin >> a[i];

	}
	sort(a, a + N);

	for (int i = N - 1; i >= 0; i -= 2)al += a[i];
	for (int i = N - 2; i >= 0; i -= 2)bo += a[i];

	cout << al - bo << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int as;
int main()
{
	string k;
	cin>>k;
	for(int i=0;i<4;i++)
	{
		if(k[i]=='2')
		{
			as++;
		}
	}
	cout<<as;
}


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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    ll x, ans=0, t=100;
    cin >> x;
    while(t<x) {
        t += t/100;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count))%MOD;
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int x= c-a;
  int y= d-b;
  cout<<c-y<<" "<<d+x<<" "<<a-y<<" "<<b+x<<endl;
}

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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 55;

int n, a[N], b[N];
LL ans, adj[N];
bool v[N];

inline bool Check() {
  for (int i = 0; i <= 50; ++i) {
    adj[i] = 1LL << i;
    for (int j = 1; j <= i; ++j) {
      if (v[j]) {
        adj[i] |= adj[i % j];
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (!(adj[a[i]] >> b[i] & 1)) {
      return false;
    }
  }
  return true;
}

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n);
  for (int i = 1; i <= n; ++i) {
    Read(a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    Read(b[i]);
  }
  for (int i = 1; i <= 50; ++i) {
    v[i] = true;
  }
  if (!Check()) {
    puts("-1");
    return 0;
  }
  for (int i = 50; i; --i) {
    v[i] = false;
    if (!Check()) {
      v[i] = true, ans += 1LL << i;
    }
  }
  printf("%lld\n", ans);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const ll MOD = 1e9 + 7;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")



ll modpow(ll a, ll n) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ret;
}
ll modinv(ll a) { return modpow(a, MOD - 2); }
ll comb(ll n, ll r) {
    ll ret = 1;
    for (ll i = 0; i < r; i++) ret = ret * (n - i) % MOD;
    for (ll i = 1; i <= r; i++) ret = ret * modinv(i) % MOD;
    return ret;
}


int main() {
    ll n,p9,p8,p10,ans = 0; cin >> n;
    ll c1;
    if(n == 1) cout << 0;
    else {
        p10 = modpow(10,n);
        p8 = modpow(8,n);
        p9 = modpow(9,n);

        if(p10-p9 <= 0) p10 += MOD;
        c1 = ((2*(p10-p9))%MOD+p8)%MOD;
        p10  = modpow(10,n);
        if(c1-p10 <= 0) c1 += MOD;
        cout << (c1-p10)%MOD;

    }

}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long int
#define INF 0x3f3f3f3f
#define pb push_back
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	string s; cin>>s;
	int i,n=s.length();
	int f=1;
	for(i=0;i<n;i++)
	{
	    if(i<n-1)
	    {
	        if(s[i]==s[i+1])
	        {
	            cout<<i+1<<" "<<i+2;
	            f=0;
	            break;
	        }
	    }
	    if(i<n-2)
	    {
	        if(s[i]==s[i+2])
	        {
	            cout<<i+1<<" "<<i+3;
	            f=0;
	            break;
	        }
	    }
	}
	if(f) cout<<-1<<" "<<-1;
	return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	vector<vector<int>> ad(n);
	for(int i=1;i<n;i++){
		int a,b;
		cin >> a >> b;
		a--,b--;
		ad[a].push_back(b);
		ad[b].push_back(a);
	}
	
	vector<int> res(n);
	vector<vector<int>> ta(2);
	function<void(int,int,int)> dfs=[&](int cur,int par,int dep){
		ta[dep&1].push_back(cur);
		for(int ch:ad[cur]){
			if(ch==par) continue;
			dfs(ch,cur,dep+1);
		}
	};
	dfs(0,-1,0);
	
	if(ta[0].size()<ta[1].size()) ta[0].swap(ta[1]);
	
	for(int i=1;i<=n;i+=3){
		int v=ta[0].back();
		res[v]=i;
		ta[0].pop_back();
	}
	
	if(ta[0].size()<ta[1].size()) ta[0].swap(ta[1]);
	
	for(int i=2;i<=n;i+=3){
		int v=ta[0].back();
		res[v]=i;
		ta[0].pop_back();
	}
	
	for(int i=3;i<=n;i+=3){
		if(ta[0].size()){
			int v=ta[0].back();
			res[v]=i;
			ta[0].pop_back();
		}else{
			int v=ta[1].back();
			res[v]=i;
			ta[1].pop_back();
		}
	}
	
	for(int i=0;i<n;i++){
		cout << res[i] << " ";
	}
	cout << "\n";
	return 0;
}

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

int gcd(int a, int b) {
  if (a == 0 || b == 0) return a + b;
  return (a >= b) ? gcd(b, a % b) : gcd(a, b % a);
}

int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> a(n), l(n + 1, 0), r(n + 2, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    l[i + 1] = gcd(l[i], a[i]);
    r[n - i] = gcd(r[n - i + 1], a[n - i - 1]);
  }
  for (int i = 0; i <= n; i++) ans = max(ans, gcd(l[i], r[i + 2]));
  cout << ans << "\n";
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int d ,t , s;
  cin>> d>> t>> s;
  if(t*s>=d)
    cout<<"Yes";
  else 
    cout<<"No";
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
const int n = 1e5+5;
int N, M;
vector<int> G[n];
bool vis[n];
bool col[n];

void DFS(int v, int pr, bool c){
	col[v] = c;
	vis[v] = true;
	for(int j : G[v]){
		//int j = p.first;
		//bool cg = p.second;
		if(!vis[j] && j != pr){
			DFS(j, v, c);
		}
	}
}

int main(){
	cin >> N >> M;
	for(int i = 0; i < M; ++i){
		int u,v,w;
		cin >> u >> v >> w;
		u--;v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	int C = 0;
	for(int i =0; i < N; ++i){
		if(!vis[i]){
			C++;
			DFS(i, -1, true);
		}
	}
	cout << C << endl;
	return 0;
}

Measured memory_bytes: 10624
/*input
13
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	int k, i, c=0;
	cin >> k;
	queue<ll> q;
	for(i=1; i<10; i++) {
		q.push(i);
	}
	while(!q.empty()) {
		c++;
		ll cur = q.front(); q.pop();
		if(c == k) {
			cout << cur << endl;
			return;
		}
		for(i=0; i<=9; i++) {
			int last = cur % 10;
			if(abs(i - last) <= 1) {
				q.push(cur*10 + i);
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 1792
#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(){
	int n,x;
	cin >> n >> x;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	int counts = 1;
	int wa = 0;
	rep(i,n){
		wa += l[i];
		if(wa <= x) counts++;
	}
	cout << counts << endl;
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int a = 0;
    int b = 0;
    int c = 0;
    int num = 0;

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

    num = b / a;

    if (num <= c)
    {
        printf("%d\n", num);
    }
    else
    {
        printf("%d\n", c);
    }

    return 0;
}

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

namespace AtCoder
{
    class Abc169F
    {
        static long mod = 998244353;

        public static void Main()
        {
            var ns = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var n = ns[0];
            var s = ns[1];
            var a = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var dp = new long[n + 1, s + 1];
            dp[0, 0] = 1;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j <= s; j++)
                {
                    dp[i + 1, j] = (dp[i + 1, j] + 2 * dp[i, j]) % mod;
                    int k = a[i] + j;
                    if (k <= s)
                        dp[i + 1, k] = (dp[i + 1, k] + dp[i, j]) % mod;
                }
            }
            Console.WriteLine(dp[n, s]);
        }
    }
}


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


int card[50];
struct CUT{
  int p;
  int c;
};

CUT cut[51];
int swap_p[50];
int swap_c[50];
int n,r;
void solve(){
  for(int i = 0; i < n; i++){
    card[i] = n - i;
  }

  for(int i = 0; i < r ; i++){
   /* for(int x = 0; x < n; x++){
      cout << card[x] << " ";
    }
    cout << endl;
    */
    for(int j = 0; j < cut[i].p; j++) swap_p[j] = card[j];
    for(int k = 0; k < cut[i].c; k++) swap_c[k] = card[cut[i].p + k - 1];
    for(int l = 0; l < cut[i].p + cut[i].c - 1;l++){
      if(cut[i].c > l)  card[l] = swap_c[l] ;
      else              card[l] = swap_p[ l - cut[i].c ];
    }
  }
  cout << card[0] << endl;
  return ;
}



int main(){
  while(true){
    cin >> n >> r;
    if(n == 0 && r == 0) break;
    for(int input = 0; input < r; input++){
      cin >> cut[input].p >> cut[input].c ;
    }
    solve();
  }
  return 0;
}



Measured memory_bytes: 3052
#include<iostream>
#include<string>
using namespace std;
int main(){
  int cnt=0,flag;
  string s,scan;

  while(cin >>s){
    flag=false;
  for(int i=0;i<s.size();i++) scan[i]=s[s.size()-1-i];
  for(int i=0;i<s.size();i++)   if(scan[i]==s[i])flag++;
  if(flag==s.size())cnt++;
  }
  cout<<cnt<<endl;
  return 0;}
				

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


//library mod int
template <int mod>
struct modint{
    ll x;

    //constructor
    modint(ll x=0): x((x%mod+mod)%mod){}

    //unary operator
    modint operator-() const { return modint(mod-x);}
    modint inv() const { return this->pow(mod-2);}
    

    //compound assignment
    modint& operator+=(const modint& a){
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator-=(const modint& a){
        if((x-=a.x)<0) x+=mod;
        return *this;
    }
    modint& operator*=(const modint& a){
        (x*=a.x)%=mod;
        return *this;
    }
    modint& operator/=(const modint& a){
        return *this *= a.inv();
    }

    //arithmetic
    // なぜmodintの後ろに＆を書いたり書かなかったりしてるかの理解ができていない
    //おそらく＆をつけるとポインタで参照しているのでもとの値を書き換えることができる
    //＆をつけないとコピーを作ってからそれに対して計算するので、もとの値は変更されない
    modint operator-(const modint& a) const {return modint (*this) -= a ; }
    modint operator+(const modint& a) const {return modint (*this) += a ; }
    modint operator*(const modint& a) const {return modint (*this) *= a ; }
    modint operator/(const modint& a) const {return modint (*this) /= a ; }
    //n should not be smaller than 0.
    modint pow(ll n) const{
        auto x=modint(1);
        auto m=*this;
        while(n>0){
            if(n&1) x*=m;
            n>>=1;
            m*=m;
        }
        return x;
    }

    //compare
    bool operator==(const modint& a) const {return x==a.x ; }
    bool operator!=(const modint& a) const {return x!=a.x ; }

    //I/O
    friend istream& operator>>(istream& is, modint& a ) noexcept {return is >> a.x ; }
    friend ostream& operator<<(ostream& os, const modint& a ) noexcept {return os << a.x ; }

};

//modの調整
constexpr int mod = 1e9 + 7;
using mint = modint<mod>;





int main(){
    int n;
    cin>>n;
    vector<ll> p(n);
    rep(i,n) cin>>p[i];
    mint ans=0;
    rep(i,60){
        ll cnt=0;
        rep(j,n){
            if(p[j]>>i&1) cnt++;
        }
        ll a=cnt*(n-cnt);
        rep(j,i) a=a*2%mod;
        ans+=a;
    }
    cout<<ans<<endl;
    return 0;
}

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

int64_t n,p,even=0,odd=0,res=0,mul[55],c[55][55];

int main()
{
    cin>>n>>p;
    c[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        c[i][0]=1;
        c[i][i]=1;
        for(int j=1;j<i;j++)
            c[i][j]=c[i-1][j]+c[i-1][j-1];
    }
    mul[0]=1;
    for(int i=1;i<=n;i++)
        mul[i]=mul[i-1]*2;
    int64_t x;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        if(x%2==0)
            even++;
        else
            odd++;
    }
    if(p==0)
        for(int i=0;i<=odd;i+=2)
            res+=c[odd][i]*mul[even];
    else
        for(int i=1;i<=odd;i+=2)
            res+=c[odd][i]*mul[even];
    cout<<res;
}


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

int main() {
  int r,g,b,n,ans = 0;
  cin >> r >> g >> b >> n;
  for(int i = 0;i <= n/r;i++){
    for(int j = 0;j <= n/g;j++){
      if((n-i*r-j*g)%b == 0 && n-i*r-j*g >= 0) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
/*
 * Author: Utkal Sinha
 * Created on: 2020-08-29, Sat, 17:50
 * Problem:
 * Platfrom: General
 * */
#if USE_BOOST2
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>
namespace bst = boost::multiprecision;
typedef bst::int1024_t vll; //int512_t or //int128_t
typedef bst::cpp_bin_float_100 vdouble;
#endif

#include <bits/stdc++.h>
using namespace std;
#define GETTIME std::chrono::system_clock::now()
#define DURATION std::chrono::duration<double>
#ifdef MY_DEV_ENV2
#define LOCALDEV
#endif
typedef long long ll;
typedef std::chrono::system_clock::time_point TPT;
static TPT starttime, endtime, timelimit;
static double problem_tle = 1.5;
static inline void calc_problem_end_time() {timelimit = starttime + std::chrono::milliseconds(int (problem_tle * 1000));}
// template end



void love() {
    string s, t;
    cin >> s >> t;
    int sn = s.length();
    int tn = t.length();
    int ans = INT_MAX;
    for(int i= 0; i<=sn-tn; i++) {
        int tmp = 0;
        for(int j = 0; j<tn; j++) {
            if(s[i+j] != t[j]) tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    srand(time(0));
#ifdef LOCALDEV
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
#ifdef LOCALDEV
    starttime = GETTIME;
    calc_problem_end_time();
#endif
    while(t--) love();
#ifdef LOCALDEV
    endtime = GETTIME;
    DURATION elapsed_seconds = endtime - starttime;
    DURATION time_limit_seconds = timelimit - starttime;
    clog << "Elapsed time: " << elapsed_seconds.count() << "s\n";
    clog << "Time limit: " << time_limit_seconds.count() << "s\n";
#endif
    return 0;
}

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

int main() {
    string S,T;
    cin>>S>>T;

    int ans = T.size();

    for(int i=0;i<=S.size() - T.size();i++){
        int dif = 0;
        for(int j = 0; j < T.size(); j++){

            if(S[i + j] != T[j])    dif++;
        }
        if(dif < ans)   ans = dif;

    }

    cout<<ans;

    return 0;
}

Measured memory_bytes: 3624
# 12:03
import itertools
import math
n = int(input())

cities = [list(map(int, input().split())) for _ in range(n)]
a=[]
for i in range(n):
    a.append(i)
a = list(itertools.permutations(a))
sum = 0
for city in a:
    for i in range(n-1):
        sum += ((cities[city[i+1]][0]-cities[city[i]][0])**2 +
                (cities[city[i+1]][1]-cities[city[i]][1])**2)**0.5
print(sum/math.factorial(n))


Measured memory_bytes: 8100
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int P[100000];
int inv[100000];
int main(){
  int KL2GvlyY, Q5VJL1cS;
  int i;
  int k;
  int lef1;
  int lef2;
  int rig1;
  int rig2;
  multiset<int> s;
  multiset<int>::iterator it1;
  multiset<int>::iterator it2;
  long long res = 0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(P[Lj4PdHRW]);P[Lj4PdHRW] += (-1);
    }
  }
  for(i=0;i<(N);i++){
    inv[P[i]] = i;
  }
  for(KL2GvlyY=0;KL2GvlyY<(2);KL2GvlyY++){
    s.insert(-1);
  }
  for(Q5VJL1cS=0;Q5VJL1cS<(2);Q5VJL1cS++){
    s.insert(N);
  }
  for(k=N-1;k>=0;k--){
    i = inv[k];
    it1 = it2 = s.insert(i);
    lef1 = *(--it1);
    lef2 = *(--it1);
    rig1 = *(++it2);
    rig2 = *(++it2);
    res += (long long) (k+1) * (lef1-lef2) * (rig1 - i);
    res += (long long) (k+1) * (rig2-rig1) * (i - lef1);
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190914-1

// --- original code ---
// int N, P[1d5];
// int inv[1d5];
// {
//   int i, k, lef1, lef2, rig1, rig2;
//   multiset<int> s;
//   multiset<int>::iterator it1, it2;
//   ll res = 0;
//   
//   rd(N,(P--)(N));
//   rep(i,N) inv[P[i]] = i;
// 
//   rep(2) s.insert(-1);
//   rep(2) s.insert(N);
// 
//   for(k=N-1;k>=0;k--){
//     i = inv[k];
//     it1 = it2 = s.insert(i);
//     lef1 = *(--it1);
//     lef2 = *(--it1);
//     rig1 = *(++it2);
//     rig2 = *(++it2);
// 
//     res += (ll) (k+1) * (lef1-lef2) * (rig1 - i);
//     res += (ll) (k+1) * (rig2-rig1) * (i - lef1);
//   }
// 
//   wt(res);
// }


Measured memory_bytes: 5760
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(){
  int i;
  int count = 0;
  int n;
  int low_i;
  int low;
  long long int ans = 0;
  long long int a[100000];
  long long int b[100000];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%lld", &a[i]);
  }

  low = llabs(a[0]);
  low_i = 0;

  for(i = 0; i < n; i++){
    if(a[i] < 0){
      b[i] = - a[i];
      count++;
    }
    else{
      b[i] = a[i];
    }

    if(low > b[i]){
      low = b[i];
      low_i = i;
    }
  }

  for(i = 0; i < n; i++){
    if(i == low_i &&  (count = count % 2) != 0){
      ans +=  - b[i];
    }
    else {
      ans += b[i];
    }
  }

  printf("%lld\n", ans);


  return 0;
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl

typedef pair<int, int> P;
typedef long long ll;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    int a, b; cin>>a>>b;
    vector<int> p(n);
    REP(i,n) cin>>p[i];
    int one = 0;
    int two = 0;
    int three = 0;
    REP(i,n){
        if(p[i]<=a) one++;
        else if(p[i]>=a+1 && p[i]<=b) two++;
        else if(p[i] >= b+1) three++;
    }
    int ans = min({one, two, three});
    print((int)ans);
    return 0;
}

Measured memory_bytes: 256
n, x = [int(i) for i in input().split()]

cnt=0

short = min(x,n-x)
long  = max(x, n-x)
cnt += n
#cnt += x*(2*(n//x)-1) + (n-x)

while(1):
    c = long % short
    a = long //short
    if c==0:
        break
    else:
        cnt += short * 2 * a
        long = short
        short = c

cnt += short * (2 * a -1)
print(cnt)


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
#-------------------------------------

n = int(input())
a = list(map(int,input().split()))

count = 0
for i,v in enumerate(a):
     # print(i+1,v)
     if (i+1)%2 == 1 and v%2 == 1:
          count += 1

print(count)

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

int main() {
  int N;
  cin >> N;
  for (int i=0; i<N; i++) {
    string col;
    cin >> col;
    if (col=="Y") {
      cout << "Four" << endl;
      break;
    }
    if (i==N-1) {
      cout << "Three" <<endl;
    }
  }
}

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

int main()
{
  int n, i, cnt=0;
  scanf("%d", &n);
  for (i = 0; i <= n / 4; i++) {
    if ((n - 4*i)%7 == 0) {
      cnt = 1;
      puts("Yes");
      break;
    }
  }
  if (cnt == 0)
    puts("No");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, min = 1000000000;
  cin >> N;
  for(int i = 0;i < N;i++){
    int a,cnt = 0;
    cin >> a;
    while(true){
      if(a%2 == 0){
        cnt++;
        a = a/2;
      }else{
        break;
      }
    }
    if(cnt < min)
      min = cnt;
  }
  cout << min <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  string o,e;
  cin >> o >> e;
  string s = "";
  int j = 0,k = 0;
  REP(i,o.size()+e.size()){
    if(i%2 == 0){
      s += o[j];
      j++;
    }
    else{
      s += e[k];
      k++;
    }
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<long> H(N);
  long B=0;
  for(int i = 0; i < N; i++){
    cin >> H[i];
  }
  sort(H.begin(), H.end()); 
  reverse(H.begin(), H.end());
  for(int j=K; j<N;j++){
    B += H[j];
  }
  cout << B << endl;
}
  


Measured memory_bytes: 1792
<?php
fscanf(STDIN,"%d",$n);
fscanf(STDIN,"%d",$min);
$max = -2000000000;
for($i = 1; $i < $n; ++$i){
    fscanf(STDIN,"%d",$R);
    $max = $max > $R-$min ? $max : $R-$min;
    $min = $min < $R ? $min : $R;
}
echo $max."\n";

Measured memory_bytes: 15344
#include <bits/stdc++.h>
    using namespace std;
    typedef long long llong;
     
    int a[200005];
     
    int main()
    {
        int n;
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &a[i]);
        }
        llong last = a[0], sum = 0;
        for (int i = 1; i < n; i++)
        {
            if (a[i] < last)
            {
                sum += last - a[i];
                a[i] = last;
            }
            else 
            {
                last = a[i];
            }
        }
        printf("%lld\n", sum);
        return 0;
    }

Measured memory_bytes: 4472
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
const int N = 1e5 + 10;

using namespace std;

ll n, m, ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> m;
	ans = min(n, m / 2);
	if (m > n * 2) {
		m -= n * 2;
		ans += m / 4;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
// Problem : C - One-stroke Path
// Contest : AtCoder Beginner Contest 054
// URL : https://atcoder.jp/contests/abc054/tasks/abc054_c
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb emplace_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inf LLONG_MAX
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
vi v[8];int count1=0;int n;
void DFS(int x,int p,vi vis)
{
	if(vis[x]==1)return;
	vis[x]=1;
	int k=0;
	for(int i=0;i<n;i++)
	if(vis[i]==0)
	{
		k=1;break;
	}
	if(k!=1)
	{count1++;return;}
	for(int j=0;j<v[x].size();j++)
	if(v[x][j]!=p)
	DFS(v[x][j],x,vis);
}
void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int m;cin>>n>>m;
while(m--)
{
	int x,y;cin>>x>>y;
	x--;y--;
	v[x].pb(y);
	v[y].pb(x);
}
vi vis(n);
DFS(0,-1,vis);
cout<<count1;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <memory>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int x[200100],b;
int n,r;
int main(){
	cin>>n;
	memset(x,0x3f,sizeof(x));
	for(int i=1;i<n;i++){
		cin>>b;
		x[i]=min(x[i],b);
		x[i+1]=min(x[i+1],b);
	}
	r=0;
	for(int i=1;i<=n;i++)r+=x[i];
	cout<<r<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define fi first
#define se second
#define re return
#define pb emplace_back
#define em emplace
#define er erase
#define all(x) (x).begin(), (x).end()
#define in(v); { for (auto &i : v) cin >> i; }
#define out(v); { for (auto &i : v) cout << i << ' '; cout << endl; }

///#define int long long

using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;

const long long INFll = 1e18;



void solve() {
    int h, n; cin >> h >> n;
    vector <int> v(n); in(v);
    if (accumulate(all(v), 0) >= h)
        cout << "Yes\n";
    else
        cout << "No\n";
}

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

    solve();
}


Measured memory_bytes: 640
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	double a, b, x;
	std::cin >> a >> b >> x;
	auto const pi = 3.14159265358979323846264;
	if (x <= a * a * b / 2)
	{
		auto v = a * b * b / (2 * x);
		std::cout << 180 * std::atan(v) / pi << std::endl;
	}
	else
	{
		auto v = 2 * (a * a * b - x) / (a * a * a);
		std::cout << 180 * std::atan(v) / pi << std::endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val in = new java.util.Scanner(System.in)
    val height = in.nextInt()
    val width = in.nextInt()
    val array = Array.ofDim[Int](height,width)
    for(i <- 0 to height-1){
      for(j <- 0 to width -1){
        array(i)(j) = in.nextInt()
      }
    }
    val vec = Array.ofDim[Int](width)
    for(i <- 0 to width-1){
      vec(i) = in.nextInt()
    }
    val result =mul(array,vec,height,width)
    for(r <- result){
       println(r)
    }
  }
  def mul(array:Array[Array[Int]],vec:Array[Int],height:Int,width:Int):Array[Int]={
    val res = new Array[Int](height)
    for(i <- 0 to height-1){
      var temp = 0
      for(j <- 0 to width -1){
        temp += array(i)(j) *vec(j)
      }
      res(i) = temp
    }
    return res
  }
}

Measured memory_bytes: 58676