akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static int[][][] directedGraph(int n, int[] from, int[] to, int[] cost) {
		int[] cnt = new int[n];
		for (int i : from) cnt[i]++;

		int[][][] g = new int[n][][];
		for (int i=0; i<n; i++) g[i] = new int[cnt[i]][2];
		for (int i=0; i<from.length; i++) {
			int s = from[i];
			int t = to[i];

			g[s][--cnt[s]][0] = t;
			g[s][cnt[s]][1] = cost[i];
		}

		return g;
	}

	static int[] kahn(int[][][] g) {
		int n = g.length, pos = 0;
		int[] res = new int[n];
		int[] in = new int[n];
		for (int cur=0; cur<n; cur++) {
			for (int[] to : g[cur]) {
				in[to[0]]++;
			}
		}

		ArrayDeque<Integer> que = new ArrayDeque<>();
		for (int i=0; i<n; i++) {
			if (in[i] == 0) {
				que.add(i);
			}
		}
		while (!que.isEmpty()) {
			int cur = que.pollFirst();
			res[pos++] = cur;
			for (int[] to : g[cur]) {
				if (--in[to[0]] == 0) {
					que.add(to[0]);
				}
			}
		}

		int max = -1;
		for (int i=0; i<n; i++) {
			max = Math.max(max, in[i]);
		}

		return max == 0 ? res : null;
	}

	static void solve() {
		int v = in.nextInt();
		int e = in.nextInt();
		int[] s = new int[e];
		int[] t = new int[e];
		int[] c = new int[e];
		for (int i=0; i<e; i++) {
			s[i] = in.nextInt();
			t[i] = in.nextInt();
			c[i] = 0;
		}

		int[][][] g = directedGraph(v, s, t, c);
		out.println(kahn(g) == null ? 1 : 0);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 31460
S = sorted(set(list(input())))
ABC = [chr(c) for c in range(ord('a'), ord('a') + 26)]
if S != ABC :
    for i in range(27) :
        try :
            if S[i] != ABC[i] :
                print(ABC[i])
                break
        except :
            print(ABC[i])
            break
else :
    print("None")

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[100001],n,m,i,s=1,s1;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	s1=m;
	while((s1+(m-1))<=n)
	{
		s++;
		s1+=m-1;	
	}
	if(s1<n)
		s++;
	printf("%d",s);
	return 0;
}

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

int main() 
{ 
 int  hs,ms,ss,hb,mb,sb,hc,mc,sc;
 for(int i=1;i<=3;i++){
  cin>>hs>>ms>>ss>>hb>>mb>>sb;
  hc=0;mc=0;sc=0;
  sc=sb-ss;
  if(sc<0){sc=sc+60;mc--;}
  mc=mb-ms+mc;
  if(mc<0){mc=sc+60;hc--;}
  hc=hb-hs+hc;
  cout<<hc<<' '<<mc<<' '<<sc<<'\n';
   }
 return 0; 
}  

Measured memory_bytes: 1160
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int cnt = 0;
		int l = s.length()/2;
		for ( int i = 0; i < l ; i++ ) {
			int r = s.length()- 1 - i ;
			if ( s.charAt(i) != s.charAt(r) ) {
				cnt++ ;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static long findMin(int n, int k, int[] a) {
        long[] dp = new long[n+1];
        dp[1]=0;
        dp[2]=Math.abs(a[2]-a[1]);
        for(int i=3;i<n+1;++i) {
            long minVal=Integer.MAX_VALUE;
            for(int j=1;j<=k&&i-j>=1;++j) {
                minVal = Math.min(dp[i-j] + Math.abs(a[i] - a[i-j]), minVal);
            }
            dp[i]=minVal;
        }
        return dp[n];
    }
    public static void main(String[] args) {
        InputStreamReader r=new InputStreamReader(System.in);
        String[] input=null;
        BufferedReader reader = new BufferedReader(r);
        try {
            input = reader.readLine().split(" ");
            int n= Integer.parseInt(input[0]);
            int k= Integer.parseInt(input[1]);
            int[] a= new int[n+1];
            String nums = reader.readLine();
            String [] nums1 = nums.split(" ");
            for(int i=0;i<nums1.length;++i) {
                a[i+1]=Integer.parseInt(nums1[i]);
            }
            System.out.println(findMin(n,k,a));
        } catch(IOException e) {

        }

    }
}

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

int main()
{
  int n, k, q;
  cin >> n >> k >> q;
  
  int arr[n];
  for (int i = 0; i < n; i ++)
  {
    arr[i] = 0;
  }
  
  int a;
  for (int iq = 0; iq < q; iq ++)
  {
    cin >> a;

    arr[a-1] ++;
  }

  for (int i = 0; i < n; i ++)
  {
    cout << ( 0 < (arr[i] - q + k) ? "Yes" : "No" ) << endl;
  }
}

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

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

	int s,w; cin >> s >> w;
	if(w >= s) cout << "unsafe";
	else cout << "safe";	
	
	

}


Measured memory_bytes: 3624
import numpy as np

MOD=1000000007

n,k=map(int,input().split())
k=min(k,n-1)
fac=np.zeros((n+1)).astype(np.int64)
invfac=np.zeros((n+1)).astype(np.int64)
inv=np.zeros((n+1)).astype(np.int64)

invfac[0]=fac[0]=invfac[1]=fac[1]=inv[1]=1
for i in range(2,n+1):
    fac[i]=(fac[i-1]*i)%MOD
    inv[i]=(-inv[MOD%i]*(MOD//i))%MOD
    invfac[i]=(invfac[i-1]*inv[i])%MOD
def nCr(n,r):
    return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD
def nHr(n,r):
    return nCr(n+r-1,r)

ret = 0
x = nCr(n, np.arange(k+1))
y = nHr(n-np.arange(k+1), np.arange(k+1))
ret = np.sum(x*y%MOD)%MOD

print(ret)

Measured memory_bytes: 28076
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
    a.append(list(map(str,input())))
for i in range(m):
    b.append(list(map(str,input())))
#print(a)
#print(b)
for i in range(0,n-m+1):
    for j in range(0,n-m+1):
        l=[]
        for k in range(m):
            l.append(a[i+k][j:j+m])
        if l==b:
            print('Yes')
            break
    else:
        continue
    break
else:
    print('No')

Measured memory_bytes: 3064
//Warmdust Code
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#define db double
#define ll long long
#define ft float
#define PI acos(-1)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Fro(i,a,b) for(int i=a;i>=b;i--)
#define inf 0x3f3f3f3f
#define Warmdust int main(){ TvT;
#define RETURN return 0;}
#define TvT ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=10005;

Warmdust
	int n;
	cin >> n;
	cout << n*n*n << endl;

RETURN

Measured memory_bytes: 888
#include<stdio.h>
int main(void){

  int n,m,ANS,i,j;
  int A[100][100],b[100];
  scanf("%d%d",&n,&m);

  for(i=0;i<n;i++){
      for(j=0;j<m;j++){
         scanf("%d",&A[i][j]);
       }
   }
  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }

  for(i=0;i<n;i++){
ANS=0;
      for(j=0;j<m;j++) ANS += A[i][j]*b[j];

    printf("%d\n",ANS);
  }
 return 0;
}


Measured memory_bytes: 2148
import java.util.*;

public class Main {
	static int mod = 1_000_000_007;
	static long fact[];
	static long inverse[];

	static long pow(long a,int n) {
	    long res=1;
	    while (n>0) {
	        if ((n-n/2*2)==1) {
	            res=res*a%mod;
	        }
	        a=a*a%mod;
	        n>>=1;
	    }
	    return res;
	}

	static long modinv(long n) {
	    return pow(n, mod-2);
	}

	static long comb(int n,int k){
	    if(n<0 || k<0 || n<k)return 0;
	    return fact[n]*(inverse[k]*inverse[n-k]%mod) %mod;
	}


	public static void main(String[] args) {
		fact=new long[300000];
		fact[0]=1;
		inverse=new long[300000];
		inverse[0]=1;
		for(int i=1;i<300000;i++){
		    fact[i]=(fact[i-1]*(long)i)%mod;
		    inverse[i]=modinv(fact[i]);
		}
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long[] A = new long[N];
		for (int i=0;i<N;i++) {
			A[i] = sc.nextLong();
		}
		Arrays.sort(A);

		long[] nCk_sum = new long[N-1+1];
		for (int i=0;i<N-1;i++) {
			nCk_sum[i+1] = (nCk_sum[i]+comb(i, K-2))%mod;
		}
		// System.out.println(Arrays.toString(nCk_sum));

		long plus = 0L;
		long minus = 0L;
		for (int i=0;i<N-1;i++) {
			// minus = (minus+A[i]*nCk_sum[N-1-i]%mod)%mod;
			// plus = (plus+A[N-1-i]*nCk_sum[N-1-i]%mod)%mod;
		}
		for (int i=0;i<N;i++) {
			minus = (minus + A[N-1-i]*comb(i, K-1)%mod)%mod;
			plus = (plus + A[i]*comb(i, K-1)%mod)%mod;
		}
		System.out.println((plus-minus+mod)%mod);
	}
}


Measured memory_bytes: 56072
#include<iostream>
#include<deque>

using namespace std;
 
int main(void) {
	int n; cin >> n;
	int x;
	deque<int> d;
	int i;
	for (i = 0; i < n; i++) {
		if (i % 2 == 1) { cin >> x; d.push_front(x); }
		else if (i % 2 == 0) { cin >> x; d.push_back(x); }
	}
 
	if (n % 2 == 0) {
		while (!d.empty()) {
			cout << d.front() << " ";
			d.pop_front();
		}
	}
	else if (n % 2 == 1) {
		while (!d.empty()) {
			cout << d.back() << " ";
			d.pop_back();
		}
	}
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>

int n,a;
int N;

int L[70],R[70],V[70],tot;

int main(){
	scanf("%d",&n);
	while ((1<<N)<=n) N++;
	printf("%d ",N);
	for (int i=0;(1<<(i+1))<=n;i++){
		L[++tot]=i+1;R[tot]=i+2;V[tot]=0;
		L[++tot]=i+1;R[tot]=i+2;V[tot]=(1<<i);
	}
	a=(1<<(N-1));
	for (int i=N-1;i;i--){
		if ((1<<(i-1))<=n-a){
			L[++tot]=i;R[tot]=N;V[tot]=a;
			a+=(1<<(i-1));
		}
	}
	printf("%d\n",tot);
	for (int i=1;i<=tot;i++) printf("%d %d %d\n",L[i],R[i],V[i]);
}

Measured memory_bytes: 256
import java.util.*;

class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int month = sc.nextInt();
                while(month != 0){
                        int day = sc.nextInt();
                        System.out.println(whatDay(month, day));
                        month = sc.nextInt();
                }
                sc.close();
        }
        static String whatDay(int month, int day){
                int[] daysOfMonth = {31,29,31,30,31,30,31,31,30,31,30,31};
                String[] days = {"Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday","Sunday"};
                for(int i = 0; i < month-1; i++){
                        day += daysOfMonth[i];
                }
                day += 2;
                return days[day%7];
        }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr auto INF = INT_MAX >> 1;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

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

	map<char, char> mp, pm;
	rep(i, s.size()) {
		mp[s[i]] = t[i];
		pm[t[i]] = s[i];
	}
	bool ok = true;
	rep(i, s.size())if (mp[s[i]] != t[i])ok = false;
	rep(i, t.size())if (pm[t[i]] != s[i])ok = false;
	cout << (ok ? "Yes" : "No") << endl;

}

Measured memory_bytes: 776
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder buf = new StringBuilder();
        String line = reader.readLine();
        int linelen = line.length();
        for (int i = 0; i < linelen; i++) {
            char c = line.charAt(i);
            if (c == '?') {
                if (i > 0 && buf.charAt(buf.length() - 1) == 'P') {
                    // 1つ前がPならDを選択すればPD指数が1増える
                    buf.append('D');
                } else {
                    // 1つ前がP以外（=D）ならDを選択
                    // 連続するDはPD指数を1増やす
                    // ?は変換済み
                    buf.append('D');
                }
                continue;
            }
            // "P2 or "D"
            buf.append(c);
        }
        System.out.println(buf);
    }
}

Measured memory_bytes: 31224
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<deque>
#include<numeric>
#include<algorithm>
#include<unordered_map>
#include<cmath>
#include<string>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);

int A, B, m, am, bm, ret;
vector<int> a, b;


int main(void) {
	cin >> A >> B >> m;
	a = vector<int>(A);
	b = vector<int>(B);
	for (int i = 0; i < A; i++) {
		cin >> a[i];
	}
	am = *min_element(a.begin(), a.end());
	for (int i = 0; i < B; i++) {
		cin >> b[i];
	}
	bm = *min_element(b.begin(), b.end());
	ret = am + bm;

	for (int i = 0; i < m; i++) {
		int xi, yi, ci;
		cin >> xi >> yi >> ci;
		int tmp = a[xi-1] + b[yi-1] - ci;
		if (tmp < ret)
			ret = tmp;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1024
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    t = {}
    m = 0
    for s in S:
        t[s] = t.get(s, 0) + 1
        m = max(m, t[s])
    r = []
    for k, v in t.items():
        if v == m:
            r.append(k)
    r.sort()
    print('\n'.join(r))





main()


Measured memory_bytes: 114824
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1'000'000'007;
// const ll MOD = 998244353;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

template<typename T> 
map<T,int> factorize(T x){
    map<T,int> mp;
    for (T i = 2; i*i <= x; i++){
        while (x%i == 0) {
            x /= i;
            mp[i]++;
        }
        if (x == 1) break;
    }
    if (x != 1) mp[x]++;
    return mp;
}


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

    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N)cin >> A[i];
    ll G = A[0];
    rep(i,N)G = gcd(G, A[i]);
    vector<int> cnt(1010101, 0);
    rep(i,N){
        auto v = factorize(A[i]);
        for(auto p: v){
            cnt[p.first]++;
            if(cnt[p.first] >= 2){
                cout << ((G == 1) ? "setwise coprime" : "not coprime") << endl;
                return 0;
            }
        }
    }
    cout << "pairwise coprime" << endl;
}


Measured memory_bytes: 15052
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int ans = 0;
			for (int i = 0; i < s.Length - 2; i++) {
				if (s.Substring(i, 3) == "ABC") {
					ans++;
				}
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"

const int adx[] = { 1,1,1,0,-1,-1,-1,0 };
const int ady[] = { 1,0,-1,-1,-1,0,1,1 };

int add(const int base, const int plus) {
	if (!plus) {
		return base + 1;
	}
	else {
		return 0;
	}
}

//0 :?????????1:??????2:?????????3:??? 4:?????????5:??? 6:?????? 7:???????????? ???
vector<vector<vector<int>>>get_cumulative_sum(const vector<vector<int>>&field) {
	const int H = field.size();
	const int W = field[0].size();
	vector<vector<vector<int>>>sums(4, vector<vector<int>>(H, vector<int>(W)));
	for (int ny = 0; ny <H; ++ny) {
		for (int nx = 0; nx <W; ++nx) {
			for (int k = 0; k < 2; ++k) {
				int py = ny - ady[k];
				int px = nx - adx[k];
				if (!(px >= 0 && px <W && py >= 0 && py <H))continue;

				sums[k][ny][nx] = add(sums[k][py][px], field[ny][nx]);

			}
		}
	}
	for (int ny = H - 1; ny >= 0; --ny) {
		for (int nx = 0; nx <W; ++nx) {
			for (int k = 2; k < 4; ++k) {
				int py = ny - ady[k];
				int px = nx - adx[k];
				if (!(px >= 0 && px <W && py >= 0 && py <H))continue;

				sums[k][ny][nx] = add(sums[k][py][px], field[ny][nx]);

			}
		}
	}
	
	return sums;
}
int getans( vector<int>hs) {
	hs.emplace_back(0);
	stack<pair<int, int>>que;
	que.emplace(-1, 0);
	int ans = 0;
	for (int x = 0; x < hs.size(); ++x) {
		
		if (que.empty()) {
			que.push(make_pair(x, hs[x]));
		}
		else {
			while (!que.empty()) {
				auto p = que.top();
				if (p.second < hs[x]) {
					que.push(make_pair(x,hs[x]));
					break;
				}
				else if (p.second == hs[x]) {
					break;
				}
				else {
					int n = min(x - p.first, p.second);
					int area =n*n;
					ans = max(ans, area);
					que.pop();
					if (!que.empty()) {
						auto np = que.top();
						if (np.second < hs[x]) {
							que.push(make_pair(p.first, hs[x]));
							break;
						}
					}
				}
			}
		}
		
			
	}
	return ans;
}

int main() {
	int H, W; cin >> H >> W;
	vector<vector<int>>field(H + 2, vector<int>(W + 2,1));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> field[i + 1][j + 1];
		}
	}
	auto vs = get_cumulative_sum(field);
	int ans = 0;
	
	for (int y = 1; y <= H; ++y) {
		vector<int>v;
		for (int x = 1; x <= W; ++x) {
			v.push_back(vs[3][y][x]);
		}
		ans = max(ans, getans(v));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 49360
n = map(int, raw_input().split())
x = map(int, raw_input().split())
sum = n
i = 0
hiro = 0
while i!=n[0]-1:
    if (x[i+1]-x[i])*n[1]<n[2]:
        hiro = hiro + (x[i+1]-x[i])*n[1]
    else:
        hiro = hiro + n[2]
    i=i+1
print hiro


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

int main(void){
  int n;
  cin >> n;
  int cnt = 0;
  vector<int> a(n);
  for(int i=0;i<n;++i) cin >> a[i];
  for(int i=0;i<n-2;++i){
    if(a[i] > a[i+1] && a[i+1] > a[i+2])++cnt;
    else if(a[i] < a[i+1] && a[i+1] < a[i+2]) ++cnt;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.stream.LongStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC081BShiftOnly solver = new ABC081BShiftOnly();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC081BShiftOnly {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long[] a = IntStream.range(0, in.nextInt()).mapToLong(x -> in.nextLong()).toArray();
            for (int i = 0; ; i++) {
                long m = 1 << i;
                if (Arrays.stream(a).anyMatch(x -> (x & m) > 0)) {
                    out.println(i);
                    return;
                }
            }
        }

    }
}



Measured memory_bytes: 26824
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, k;
    cin >> n >> k;

    int r = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;

        r += h >= k;
    }

    cout << r << endl;

    return 0;
}

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.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final int a = sc.nextInt();
		final int b = sc.nextInt();
		
		if(a == b){
			System.out.println("Draw");
		}else if(a == 1){
			System.out.println("Alice");
		}else if(b == 1){
			System.out.println("Bob");
		}else if(a > b){
			System.out.println("Alice");
		}else{
			System.out.println("Bob");
		}
		
	}
	
	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: 21588
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	char w[101][11];
	cin>>n;
	int i,j;
	int flg=0;
	for(i=0;i<n;i++)	cin>>w[i];
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			//cout<<w[i]<<" "<<w[j]<<endl;
			if(strcmp(w[i],w[j])==0){
				//cout<<" cheak"<<endl;
				flg=1;
			}
		}
	}
	for(i=0;i<n-1;i++){
		int x=strlen(w[i]);
		if(w[i][x-1]!=w[i+1][0]){
			flg=1;
			//cout<<" cheak"<<endl;
		}
	}
	cout<<((flg)?"No":"Yes")<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import fractions


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    ans = A[0]
    for a in A:
        ans = fractions.gcd(ans, a)
    print(ans)

    
    

if __name__ == '__main__':
    main()




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

int cnt_succeed(string s, int LengthOfS){
    int cnt=0;
    for(int i=0;i<LengthOfS-2;i++){
        if(s.at(i)=='A'){
            if(s.substr(i,3)=="ABC"){
                cnt+=1;
                //i+=3;
            }
        }
    }
    return cnt;
}

int main(){
    int N; cin >> N;
    string S; cin >> S;
    cout << cnt_succeed(S,N) << endl;
}


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

int main() {
    int x, a, b;
    cin >> x;
    for(int i = -119; i < 121; i++) {
        for(int j = -119; j < 121; j++) {
            if(pow(i, 5) - pow(j, 5) == x) {
                a = i;
                b = j;
                break;
            }
        }
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 4100
#include<stdio.h>
#define MAX 2000000

int size,A[MAX+1];

void maxHeapify(int i){
  int len,r,largest,t;
  len=2*i;
  r=2*i+1;
  if(len<=size && A[len]>A[i])largest=len;
  else largest =i;
  if(r<=size && A[r]>A[largest])largest =r;
  if(largest != i){
    t=A[i];A[i]=A[largest];A[largest]=t;
    maxHeapify(largest);
}
}

int main(){
  scanf("%d",&size);
  int i;
  for(i=1;i<=size;i++)scanf("%d",&A[i]);
  for(i=size/2;i>=1;i--)maxHeapify(i);
  for(i=1;i<=size;i++){
    printf(" %d",A[i]);
}
  printf("\n");
  return 0;
}



Measured memory_bytes: 3808
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll x[N],y[N],h[N];
    ll i,j,k;
    ll nonzero;
    ll tmp;
    for(k=0;k<N;k++){
      cin >> x[k] >> y[k] >> h[k];
      if(h[k]>0)nonzero=k;
    }
    ll H[101][101];
    for(i=0;i<=100;i++){
      for(j=0;j<=100;j++){
        H[i][j]=h[nonzero]+abs(x[nonzero]-i)+abs(y[nonzero]-j);
      }
    }
    for(k=0;k<N;k++){
      for(i=0;i<=100;i++){
        for(j=0;j<=100;j++){
          if(H[i][j]!=-1){
            tmp=H[i][j]-abs(x[k]-i)-abs(y[k]-j);
            if((h[k]==0)&&(tmp>0))H[i][j]=-1;
            if((h[k]>0)&&(tmp!=h[k]))H[i][j]=-1;
          }
        }
      }
    }
    for(i=0;i<=100;i++){
      for(j=0;j<=100;j++){
        if(H[i][j]>0)cout << i <<" "<< j <<" "<< H[i][j] << endl;
      }
    }
    return 0;
}


Measured memory_bytes: 384
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

const ll inf = 5e15;

ll ceil_div(ll a, ll b) { return a / b + !!(a % b); }

int main() {
    ll N, K;
    cin >> N >> K;
    V<ll> A(N), F(N);
    for(auto &&ele : A) cin >> ele;
    for(auto &&ele : F) cin >> ele;
    sort(ALL(A));
    sort(ALLR(F));

    ll ok = 1e18, ng = -1;
    while(ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        for(ll i = 0; i < N; i++) {
            ll over = max<ll>(0, A[i] * F[i] - mid);
            ll need = ceil_div(over, F[i]);
            cnt += need;
        }
        (cnt <= K ? ok : ng) = mid;
    }
    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a;
    int b;
    int c;
    int x;
    scanf("%d %d %d",&a,&b,&c);
    if (a > b) {
        x=a;
        a=b;
        b=x;
        
    }if (b > c) {
        x=b;
        b=c;
        c=x;
    }if (a > b) {
        x=a;
        a=b;
        b=x;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}

Measured memory_bytes: 596
# B - Good Distance

n, d = map(int, input().split())
X = []
for _ in range(n):
    X.append(list(int(x) for x in input().split()))

ans = 0

for i in range(n):
    for j in range(i+1, n):
        tmp = 0
        for k in range(d):
            tmp += (X[i][k]-X[j][k])**2
        if (tmp**0.5)%1==0:
            ans += 1

print(ans)

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

    class Program
    {
        static void Main(string[] args)
        {
            //input
            string[] input = Console.ReadLine().Split(' ');
            int k = int.Parse(input[0]);
            int n = int.Parse(input[1]);
            string[] input2 = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(input2[i]);
            }

            int[] sa = new int[n];
            for (int i = 0; i < n -1 ; i++)
            {
                sa[i + 1] = a[i + 1] - a[i];
            }
            sa[0] = a[n - 1] - a[0];
            sa[0] = sa[0] > k / 2 ? k - sa[0] : sa[0];

            Array.Sort(sa);
            int ans = 0;
            for (int i = 0; i < n - 1; i++)
            {
                ans += sa[i];
            }

            Console.WriteLine(ans);
        }
    }

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

int main(){
  int N,W = 0,ans = 0;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
    if (A.at(i) >= W){
      ans++;
      W = A.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            long resultNum = 0;
            String resultStr = "";

            int x = sc.nextInt();
            int w = 0;
            do {
                w += x;
                resultNum++;
            } while (w % 360 != 0);
            return resultNum;
        }
    }
}

class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
}

class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
}

Measured memory_bytes: 27052
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		TreeSet<String> set = new TreeSet<>();
		String s = sc.next();
		int k = sc.nextInt();
		for(int i=0; i<s.length(); i++) {
			for(int j=i+1; j<=s.length(); j++) {
				if(j-i>5) break;
				set.add(s.substring(i, j));
			}
		}
		int cnt =1;
		for(String str : set) {
			if(cnt<k) {
				cnt++;
			} else {
				System.out.println(str);
				return;
			}
		}
	}

	static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public MyScanner(InputStream s) 
		{
			br=new BufferedReader(new InputStreamReader(s));
		}
		public String nextLine() throws IOException
		{
			return br.readLine();
		}
		public String next() throws IOException
		{
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
			
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}
		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 25428
// Problem : D - Sum of Divisors
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_d
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define Sort(a)	sort(a.begin(),a.end())
#define rev(a)	reverse(a.begin(),a.end())
#define all(a)	(a).begin(),(a).end()
#define vll vector<long long int>
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971
#define INF 1e18

#define MAX 200005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}
lli power(lli a,lli b,lli m){if(b==0)	return 1;if(b==1)	return a%m;lli res=1;a=a%m;while(b){if(b&1){res=(res*a)%m;}a=((a%m)*(a%m))%m;b>>=1;}return res;}
lli Ceil(lli a,lli b){lli res=a/b;if(a%b!=0)	res++;return res;}

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; }

lli dxx[]={1,1,0,-1,-1,-1,0,1};
lli dyy[]={0,1,1,1,0,-1,-1,-1};
lli dx[]={1,0,-1,0};
lli dy[]={0,1,0,-1};

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
void solve(lli the)
{
	char ch;
	db aa,bb,cc,dd,xx;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,d,n,m,l,r,x,y,z,low,high,mid,sum=0,ans=0,temp,t;
    cin >> n;
    lli dp[n+1];
    memset(dp,0,sizeof(dp));
    for(i=1;i<=n;i++){
    	for(j=1;j*i<=n;j++){
    		dp[i*j]++;
    	}
    }
    for(i=1;i<=n;i++){
    	a=i*dp[i];
    	ans+=a;
    }
    cout<<ans;
    
    
}













int main()
{
	long long int t=1,c=1;
	// scanf("%lld",&t);
	while(t--){
		solve(c);
		c++;
	}
	return 0;
}
/* UJJWAL KESHRI */

Measured memory_bytes: 81724
from statistics import median

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

min_sum = 10**9
for location in range(min(p), max(p)+1):
    sum = 0
    for i in range(n):
        sum += (p[i]-location)**2
    if sum < min_sum:
        min_sum = sum

print(min_sum)

Measured memory_bytes: 5276
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list);
        if(list.get(0) + list.get(1) == list.get(2)) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 35724
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <functional>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;


int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    int i;
    vector<int> arr(n);
    int s = 0;
    for(i = 0; i < n; i++) {
		cin >> arr[i];
		s += arr[i];
	}
	sort(arr.begin(), arr.end());
	int prev = 0;
	for(i = 0; i < n && s % 10 == 0; i++) {
		s += prev - arr[i];
		prev = arr[i];
	}
	if(s % 10 == 0) {
		s = 0;
	}
	cout << s;
    return 0;
}



Measured memory_bytes: 256
import numpy as np

N = int(input())
S = input()


s = list(S)


s.reverse()
s = np.array([1 if i == 'E' else 0 for i in s])
#str = S.replace('E','1')
#bit_str = str.replace('W','0')
#bit = int(bit_str, base=2)

cost = [0]*N
cost[0] = (N-1) - sum(s[1:N])
for i in range(1,N):
    now = s[i]
    bef = s[i-1]
    cost[i] = cost[i-1] + bef - (1^now)

print(min(cost))



Measured memory_bytes: 26736
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    const n = chunk.toString().split("\n");
    n.forEach((x, i) => {
        if (x != 0) {
            console.log(`Case ${i + 1}: ${x}`);
        }
    });
});


Measured memory_bytes: 22724
let n, m = Scanf.scanf "%d %d" (fun x y -> x, y)
let graph = Array.init n (fun _ -> [])
let _ = Array.init m (fun _ -> Scanf.scanf " %d %d" (fun a b ->
  graph.(a-1) <- b-1 :: graph.(a-1);
  graph.(b-1) <- a-1 :: graph.(b-1)))
let visited = Array.make n false
let rec dfs i d =
  if d >= n then 1 else
    graph.(i) |> List.map (fun j ->
      if visited.(j) then 0 else (
        visited.(j) <- true;
        let v = dfs j (d+1) in
        visited.(j) <- false;
        v
      )
    ) |> List.fold_left (+) 0

let () =
  visited.(0) <- true;
  dfs 0 1 |> Printf.printf "%d\n"

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
const int maxn = 1<<18, rt = 1<<10;
map<int, int> pos;
int n, m, l, r, d;
vector<pair<int, ll>> g[maxn];
void add(int l, int r, int d) {
	g[l].pb({r, d});
	g[r].pb({l, -d});
}
bool dfs(int v) {
	int ok = 1;
	for(auto &_i : g[v]) {
		int i = _i.first, d = _i.second;
		if(pos.count(i)) ok &= pos[i]-pos[v] == d;
		else pos[i] = pos[v] + d, ok &= dfs(i);
	}
	return ok;
}
bool check() {
	int ok = 1;
	for(int i = 1; i <= n; i++) if(!pos.count(i)) pos[i] = 0, ok &= dfs(i);
	return ok;
}
int solve() {
	cin >> n >> m;
	for(int i = 1; i <= n; i++) g[i].clear();
	pos.clear();
	while(m--) {
		cin >> l >> r >> d;
		add(l, r, d);
	}
	cout << (check()?"Yes":"No") << '\n';
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	solve();
}


Measured memory_bytes: 27392
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# N = LIST()
N = list(input())

if N[0] == N[1] == N[2] or N[3] == N[1] == N[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 5712
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in input().split()]

# print(N, M, A)
A.sort()
if sum(A) % (4*M) == 0:
    b = sum(A)//(4*M)
else:
    b = sum(A)//(4*M)+1
# print(b,A,A[N-1-M+1])
if A[N-1-(M-1)] >= b:
    print("Yes")
else:
    print("No")
# print(A)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int k, x;
    cin >> k >> x;
    if(500*k >= x){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int k,x;
    cin >> k >> x;
    if(k * 500 >= x){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
l1 = len(s)
l2 = len(t)
ans = []
for i in range(l1-l2+1):
    s1 = s[:]
    for j in range(l2):
        if s1[i+j] == "?":
            s1[i+j] = t[j]
        elif s1[i+j] != t[j]:
            break
    else:
        s1 = "".join(s1)
        s1 = s1.replace("?","a")
        ans.append(s1)
if ans:
    ans.sort()
    print(ans[0])
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    
    if (n == 1)cout << "Hello World" << endl;
    else cout << a+b << endl;
    
    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif
    string s;   cin >> s;
    int n = s.length();
    s = "$" + s;
    if(s[1] != '1' || s[n] != '0')
        return cout << -1, 0;
    for(int i = 1; i < n; i++){
        if(s[i] != s[n-i])
            return cout << -1, 0;    
    } 
    cout << 1 << " " << 2 << endl;
    int curp = 1;
    for(int i = 2; i < n; i++){
        if(s[i] == '1'){    
            cout << i+1 << " " << curp << endl;
            curp = i + 1;
        }
        else
            cout << i+1 << " " << curp << endl;

    }
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  int N; cin >> N;
  vector<int> L (N);
  for(int i = 0; i < N; i++) cin >> L[i];
  vector<int> amounts (1001);
  for(int i = 0; i < N; i++){
    amounts[L[i]]++;
  }
  vector<ll> sum (1001);
  sum[0] = 0;
  for(int i = 1; i < 1001; i++){
    sum[i] = sum[i-1] + amounts[i];
  }
  ll res = 0;
  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      int a = L[i];
      int b = L[j];
      int l = 0;
      int r = INT_MAX;
      l = max(l, a+1-b);
      l = max(l, b+1-a);

      r = min(r, a+b-1);

      r = min(r, 1000);
      l = max(l, 0);

      if(l > r) continue;

      //cout << a << " " << b << " " << l << " " << r << endl;
      ll s = 0;
      if(a >= l && a <= r){
        s--;
      }
      if(b >= l && b <= r){
        s--;
      }
      s += (sum[r] - sum[l-1]);
      //cout << s << endl;
      res += s;
    }
  }
  cout << res / 3 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int X[105];
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i=0; i<N; i++) cin >> X[i];
  int ret = 1 << 30;
  for (int i=1; i<=100; i++) {
    int d = 0;
    for (int j=0; j<N; j++) {
      d += (i - X[j]) * (i - X[j]);
    }
    ret = min(ret, d);
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI (acos(-1))
#define ct cout<<
#define cn cin>>
#define spc <<" "<<
#define nl puts("")
#define _fl(x) puts("FLAG " #x);
#define  _(x)  cout<< #x <<" is "<< x <<endl;
#define fs first
#define sc second
#define pb push_back
#define all(v)  (v).begin(), (v).end()
#define _109 (1000000000)
#define _0(arr) memset(arr,0,sizeof ( arr ) )
#define _1(arr) memset(arr,-1,sizeof ( arr ) )
#define _ninp(n,arr) for(int i=0; i<n;i++)cin>>arr[i];
#define _nout(n,arr) for(int i=0; i<n;i++)cout<<arr[i]<<" \n"[i==n-1];
double _eps = 1e-6;
long long gcd(long long a, long long b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main()
{

    ll sum = 0;

    ll n;
    cn n;
    int l = 1000;

    for (int i = 0; i <= l; ++i)
    {
        sum = 0;
        sum = i * 100;
        if(sum == n)
        {
            ct 1;
            return 0;
        }
        for(int j = 0; j <= l && sum + j * 101 <= n; j++)
        {
        	ll sum1=sum+j*101;
            if(sum1 == n)
            {
                ct 1;
                return 0;
            }
            for(int k = 0; k <= l && sum1 + k * 101 <= n; k++)
            {
            	ll sum2=sum1+k*102;
                if(sum2 == n)
                {
                    ct 1;
                    return 0;
                }
                for(int u = 0; u <= l && sum2 + u * 101 <= n; u++)
                {
                	ll sum3=sum2+u*103;
                    if(sum3 == n)
                    {
                        ct 1;
                        return 0;
                    }
                    for(int v = 0; v <= l && sum3 + v * 101 <= n; v++)
                    {
                    	ll sum4=sum3+v*104;
                        if(sum4 == n || (n-sum4)%105==0)
                        {
                            ct 1;
                            return 0;
                        }
                    }
                }
            }
        }
    }



   ct "0";
   nl;



    return 0;
}


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

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<int> A(N);
  for(int i = 0; i < M; i++){
  cin >> a >> b;
    for(int i = 0; i < N; i++){
      int s = i + 1;
      if(a == s){
        A.at(i) += 1;
      }
      if(b == s){
        A.at(i) += 1;
      }
    }
  }
  for(int i = 0; i < N; i++){
  cout << A.at(i) << endl;
  }
}


Measured memory_bytes: 3560