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

int main() {

  int n;
  cin >> n;

  int INF = 10000;
  int graph[n][n];
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      int v;
      cin >> v;
      if (v == -1) {
        graph[i][j] = INF;
      } else {
        graph[i][j] = v;
      }
    }
  }

  int answer = 0;

  vector<bool> visited(n);
  vector<int> cost(n);

  visited[0] = 1;

  for (int i = 0; i < n; i++) {
    cost[i] = graph[0][i];
  }

  while (1) {
    int v = -1;
    for (int i = 0; i < n; i++) {
      if (visited[i] || cost[i] < 0) {
        continue;
      }
      if (v < 0 || cost[i] < cost[v]) {
        v = i;
      }
    }
    if (v < 0) {
      break;
    }
    visited[v] = 1;
    answer += cost[v];
    for (int i = 0; i < n; i++) {
      if (graph[v][i] < 0) {
        continue;
      }
      if (cost[i] < 0 || graph[v][i] < cost[i]) {
        cost[i] = graph[v][i];
      }
    }
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> A(100001, 0);
    int a;
    rep(0, i, N)
    {
        cin >> a;
        A.at(a)++;
    }
    int sum = A.at(0) + A.at(1) + A.at(2);
    int ans = sum;
    rep(2, i, 100000)
    {
        sum += A.at(i + 1);
        sum -= A.at(i - 2);
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

#define fo(i, a, b) for (ll i = (a); i <= (b); ++i)
#define fd(i, b, a) for (ll i = (b); i >= (a); --i)

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    int ans = 0;
    int a[1000020] = {};

    fo(i, 1, n)
    {
        int x;
        cin >> x;
        a[x]++;
        a[x + 1]++;
        a[x + 2]++;
    }
    fo(j, 0, 1000010) if (ans < a[j]) ans = a[j];
    cout << ans;
}

Measured memory_bytes: 7512
import math

Q = int(input())
L = [0]*Q
R = [0]*Q
for i in range(Q):
    L[i], R[i] = map(int, input().split())

# print(Q, L, R)

max_lr = 10**5

def gen_primes():
    primes = [2]
    for i in range(3, max_lr, 2):
        is_prime = True
        limit = int(math.sqrt(i)) + 1
        for p in primes:
            if p > limit:
                break
            if i % p == 0:
                is_prime = False
                break
        if is_prime:
            primes.append(i)
    # print(len(primes))
    return primes

primes = gen_primes()

def is_2017_like(n):
    m = (n + 1) // 2
    return n in primes and m in primes

A = [0]*(max_lr//2 + 1)
a = 0
for i in range(1, max_lr, 2):
    if is_2017_like(i):
        a += 1
    A[i//2 + 1] = a

for i in range(Q):
    ans = A[R[i]//2 + 1] - A[L[i]//2]
    print(ans)


Measured memory_bytes: 53208
#include <iostream>

int s,m,h;
int second;
int t;

void watch(){
    std::cin >> second;
    h = static_cast<int>(second) / 3600;
    m = (static_cast<int>(second) % 3600) / 60;
    s = (static_cast<int>(second) % 3600) % 60;

    std::cout << h << ":" << m << ":" << s << '\n';
}

int main(){
    watch();
}

Measured memory_bytes: 1160
N = int(input())
num_list = [int(item) for item in input().split()]

def insertionSort(A, N):
    print(*A)
    for i in range(1, N):
        v = A[i]
        j = i -1

        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        
        A[j+1] = v

        print(*A)

insertionSort(num_list, N)


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

int main(){
    int W, H;
    while(true){
        cin >> H >> W;
        if(W == 0 && H == 0) break;
        for(int i=0; i < H; i++){
            for(int j=0; j<W; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3060
#include<iostream>
 
using namespace std;
int main()
 
{
 
string s1,s2,s3;
 
cin>>s1>>s2>>s3;
 
if(s1[0]>='a'&&s1[0]<='z'){
    s1[0]-=32;
}
if(s2[0]>='a'&&s2[0]<='z'){
    s2[0]-=32;
}
if(s3[0]>='a'&&s3[0]<='z'){
    s3[0]-=32;
}
cout<<s1[0]<<s2[0]<<s3[0]<<endl;
 
 
 
 
return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N := ReadInt()
	A := ReadInts(N + 1)
	B := ReadInts(N)

	ans := 0
	for i := 0; i < N; i++ {
		c := Min(A[i], B[i])
		ans += c
		A[i] -= c
		B[i] -= c
		c = Min(A[i+1], B[i])
		ans += c
		A[i+1] -= c
		B[i] -= c
	}
	fmt.Println(ans)
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 5992
N = int(input())
T, A = map(int, input().split())
H_li = list(map(int, input().split()))
min_abs = 10 ** 9
num = 2000
for i in range(N) :
    mean_t = T - H_li[i] * 0.006
    abs_ha = abs(mean_t - A)
    if abs_ha < min_abs :
        min_abs = abs_ha
        num = i + 1
print(num)


Measured memory_bytes: 3060
import java.util.Scanner;
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();
   
   if(A==5 && B==5 && C==7){
     System.out.println("YES");
   }else if(A==5 && B==7 && C==5){
     System.out.println("YES");
   }else if(A==7 && B==5 && C==5){
     System.out.println("YES");
   }else{
     System.out.println("NO");
   }
 }
}

Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int[][] table = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                table[i][j] = scanner.nextInt();
            }
        }

        int a1 = 0;
        int a2 = 0;
        int a3 = 0;
        int b1 = 0;
        int b2 = 0;
        int b3 = 0;

        for (a1 = 0; a1 <= table[0][0]; a1++) {
            b1 = table[0][0] - a1;
            a2 = table[1][0] - b1;
            if (a2 < 0) continue;
            a3 = table[2][0] - b1;
            if (a3 < 0) continue;
            b2 = table[0][1] - a1;
            if (b2 < 0) continue;
            b3 = table[0][2] - a1;
            if (b3 < 0) continue;
            if (a2 + b2 != table[1][1]) continue;
            if (a2 + b3 != table[1][2]) continue;
            if (a3 + b2 != table[2][1]) continue;
            if (a3 + b3 != table[2][2]) continue;
            System.out.println("Yes");
            return;
        }

        System.out.println("No");
    }
}


Measured memory_bytes: 23380
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, M, A[309][309], cnt;
bool used[309];

bool solve(int border) {
	for (int i = 1; i <= M; i++) used[i] = false;
	cnt = M;
	while (true) {
		int cntv[309];
		for (int i = 1; i <= M; i++) cntv[i] = 0;
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= M; j++) {
				if (used[A[i][j]] == false) { cntv[A[i][j]]++; break; }
			}
		}
		int r = 0;
		for (int i = 1; i <= M; i++) {
			if (cntv[i] > border) { used[i] = true; cnt--; r = 1; }
		}
		if (r == 0) break;
		if (cnt == 0) return false;
	}
	return true;
}

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= M; j++) cin >> A[i][j];
	}

	int cl = 1, cr = N + 1, cm, minx = (1 << 30);
	for (int i = 0; i < 12; i++) {
		cm = (cl + cr) / 2;
		bool I = solve(cm);
		if (I == true) { minx = min(minx, cm); cr = cm; }
		else { cl = cm; }
	}
	cout << minx << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define MOD 1000000007
ll pow(ll x,ll y,ll mod){
    if(y==0) return 1;
    else if(y&1){
        return x*pow(x,y-1,mod)%mod;
    }
    else{
        ll p=pow(x,y/2,mod);
        return p*p%mod;
    }
}
ll com(ll x,ll y,ll mod){
    ll ans=1;
    for(ll i=x; i>x-y; i--){
        ans*=i; ans%=mod;
    }
    for(ll i=1; i<=y;i++){
        ans*=pow(i,mod-2,mod); ans%=mod;
    }
    return ans;
}
int main(){
    int x,y;
    cin >> x >> y;
    if((2*y-x)%3||(2*x-y)%3){
        cout<<0<<endl;
        return 0;
    }
    int a=(2*y-x)/3,b=(2*x-y)/3;
    if(a<0||b<0){
        cout<<0<<endl;
        return 0;
    }
    cout << com((ll)(a+b),(ll)a,MOD) << endl;
    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int n; cin >> n;
    VI A(n); REP(i,n) cin >> A[i];
    VI can(2001,0);
    REP(i,1<<n){
        int m = 0;
        REP(j,n) if(i>>j & 1) m += A[j];
        can[m] = 1;
    }
    int q; cin >> q;
    REP(i,q){
        int m; cin >> m;
        cout << (can[m] ? "yes" : "no") << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int64_t> A(N);
    vector<int64_t> S(N);
    rep(i, N) {
        cin >> A[i];
        S[i] = A[i];
    }
    map<int64_t, int64_t> freq;
    freq[0]++;
    for(int i=1; i<N; ++i) {
        S[i] += S[i-1];
    }
    for(int i=0; i<N; ++i) {
        freq[S[i]]++;
    }

    uint64_t ret = 0;
    for(auto itr: freq) {
        if(itr.second < 1) 
            continue;
        int64_t add = (itr.second * (itr.second - 1)) / 2;
        ret += add;
    }
    cout << ret << endl;

    return 0;
}



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

const int INF = 1001001001;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> h(n), dp(n + k, INF);
    rep(i, n) cin >> h[i];
    dp[0] = 0;
    rep(i, n){
        for(int j = 1; j <= k; j++){
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 4820
#include<stdio.h>
#include<string.h>
#include<iostream>
#include <fstream>
using namespace std;

#define N	100
#define maxW	10000
int	v[N];
int	w[N];
int C[N + 1][maxW + 1];

int main(){
	std::istream & c_in = cin;
	int	n, W;
	c_in >> n >> W;

	{
		int k = 0;
		for (int i = 0; i < n; i++){
			//c_in >> v[i + 1] >> w[i + 1];
			int vv, ww;
			c_in >> vv >> ww;
			int j;
			for (j = 0; j < i; ++j){
				if (ww == w[j + 1]){
					if (vv > v[j + 1]){
						v[j + 1] = vv;
					}
					break;
				}
			}
			if (j == i){
				v[k + 1] = vv;
				w[k + 1] = ww;
				k++;
			}
		}
		n = k;

		for (int i = 0; i <= n; ++i)
			C[i][0] = 0;
		for (int j = 0; j <= W; ++j)
			C[0][j] = 0;
	}

	for (int i = 1; i <= n; ++i){
		for (int j = 1; j <= W; ++j){
			int maxv = C[i - 1][j];
			for (int s = 1;s <= j/w[i]; ++s){
				int value = s*v[i] + C[i - 1][j - s*w[i]];
				if (value > maxv){
					maxv = value;
				}
			}
			C[i][j] = maxv;
		}
	}
	printf("%d\n", C[n][W]);
	return 0;
}

Measured memory_bytes: 4544
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    vector<int> v(N),cv;
    REP(i,N) cin >> v[i];
    cv=v;

    sort(ALL(v));
    int bef = v[(N/2)-1];
    int aft = v[N/2];
    REP(i,N) {
        // 元の番号を類推
        auto el = cv[i];
        int out;
        if (el<=bef) out = aft;
        else out=bef;
        cout << out << endl;
    }


    return 0;
}


Measured memory_bytes: 3712
// May this submission get accepted
#pragma GCC optimize ("O3")
#pragma GCC target("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    string n = inp1;
    cout << Yes(!(stoll(n) % (accumulate(ALL_OF(n), 0LL) - (ll)n.size() * '0'))) << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
double doINF = 1.0/0.0 ;
ostream_iterator <int> outp(cout," ");
inline ll modadd(ll n,ll m,ll mod){
    ll sum = ((n+m)%mod+mod)%mod;
    return sum;
} 
inline ll modsub(ll n,ll m, ll mod){
    ll diff = ((n-m+mod)%mod+mod)%mod;
    return diff;
}
inline ll modpro(ll n,ll m,ll mod){
    ll pro = ((n*m)%mod+mod)%mod;
    return pro;
}
inline ll pow(int x,int y){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}
inline ll powmod(ll x,ll y,ll mod){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = modpro(res , x,mod);
        y = y >> 1;
        x = modpro(x , x,mod);
    }
    return res;
}
//ll min(ll a, ll b){
//    if(a>b){
//        return b;
//    }
//    return a;
//}
// 
//ll max(ll a, ll b){
//    if(a>b){
//        return a;
//    }
//    return b;
//}
bool pairdec(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 		if(a.fi!=b.fi)
       	return (a.fi> b.fi);
		else return a.se>b.se;  
} 
ll power(ll x, ll y, ll mod) 
{ 
    ll res = 1; 
    x = x%mod; 
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % mod; 
  
        y = y >> 1;
        x = (x * x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll a, ll mod) 
{ 
    return  powmod(a, mod - 2, mod); 
} 
ll modFact(ll n, ll mod) 
{ 
    if (n >=mod) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) %mod; 
  
    return result; 
} 
//cout<<setprecision(9)<<fixed<<sum<<endl; --- precision for double numbers
//copy(v.beg,v.en,outp);
const int pN=1e9 +7;
int main()
{	
	int n,k;
	cin>>n>>k;
	int arr[n];
	forl(i,0,n) cin>>arr[i];
	int dp[n];
	forl(i,0,n) dp[i]=pN;
	dp[0]=0;
	forl(i,1,n)
	{
		forl(j,1,k+1)
		{
			dp[i]=min(dp[i],abs(arr[i]-arr[max(i-j,0)])+dp[max(i-j,0)]);
		}
	}
	cout<<dp[n-1]<<endl;
	
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n,a,d=100;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a;
        int c=0;
        while(a%2==0){
            a/=2;
            c++;
        }
        d=min(d,c);
    }
    cout << d << endl;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import deque

sys.setrecursionlimit(10 ** 6)

n, m = na()
xy = nan(m)

g = [[] for _ in range(n)]
deg = [0] * n
for i in range(m):
    x, y = xy[i]
    x -= 1
    y -= 1
    g[x].append(y)
    deg[y] += 1

dp = [-1] * (n + 1)

def dfs(v):
    if dp[v] != -1:
        return dp[v]
    res = 0
    for nv in g[v]:
        res = max(res, dfs(nv) + 1)
    dp[v] = res
    return dp[v]

def bfs():
    q = deque()
    for i in range(n):
        if deg[i] == 0:
            q.append(i)
    dp = [0] * n
    while len(q):
        p = q.popleft()
        for v in g[p]:
            deg[v] -= 1
            if deg[v] == 0:
                q.append(v)
                dp[v] = max(dp[v], dp[p] + 1)
    return dp

ans = 0
dp = bfs()
for v in range(n):
    ans = max(ans, dp[v])

print(ans)

Measured memory_bytes: 43696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int i,j;
  int x,y,z;
  cin>>x>>y>>z;
  cout<<z<<" "<<x<<" "<<y<<endl;

}

Measured memory_bytes: 256
# include "bits/stdc++.h"
 
using namespace std;
 
#define endl "\n"
typedef long long int ll;
#define f first
#define s second
 
inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}
 
//DEBUG
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
 
ll INF = 1e10;
int MOD = 1e9+7;

int main(){
    fastio();

    //REV AND FLIP

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

    string s;
    cin >> s;

    string t(1, s[0]);
    char stay = s[0];
    int i = 1;
    int mv = 0;
    int len = 0;
    while(i < n && mv < k){
    	if(s[i] == stay){
    		if(len != 0)
    			++ mv;
    		string temp(len + 1, stay);
    		t += temp;
    		len = 0;
    	}
    	else{
    		++ len;
    	}
    	++ i;
    }

    if(mv != k){
    	++ mv;
    	string temp(len + 1, stay);
    	t += temp;
    }

    while(i < n){
    	string temp(1, s[i]);
    	t += temp;
    	++ i;
    }

    dbg(t);

    char prev = t[0];
    len = 1;
    int ans = 0;
    for(i = 1; i < n; ++i){
    	if(t[i] == prev){
    		++ len;
    	}
    	else{
    		ans += (len - 1);
    		prev = t[i];
    		len = 1;
    	}
    }
    ans += (len - 1);
    cout << ans;
    return 0;
}

/*

*/

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

const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

void cominit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll i=2; i<MAX; i++) {
    fac[i] = fac[i-1] * i % mod;
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}

ll com(ll n, ll k)
{
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

ll olcom(ll n, ll k) { return com(n+k-1, k); }

int main()
{
  ll n, k; cin >> n >> k;
  cominit();

  ll ans = 0;

  for (int i=0; i<min(n, k+1); i++) {
    ans = (ans + (olcom(n-i, i) * com(n, i)) % mod) % mod;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N;
  cin >> N;
  bool a = false;
  
  for (int i = 0; i < N; i++) {
    
    string S;
    cin >> S;
    
    if (S == "Y") {
      a = true;
      break;
    }
  }
  
  if (a) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;
const int inf = 2e18;

signed main() {
    int ans = 0;
    int N, K;
    cin >> N >> K;
    while (N != 0) {
        N /= K;
        ++ans;
    }
    cout << ans << endl;
}

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

using ll = long long;

int main() {
    string s;
    ll k;
    cin >> s >> k;

    int ans = 1;
    for (int i = 0; i < s.size(); i++) {
        if (i >= k) break;
        if (s[i] != '1') {
            ans = s[i] - '0';
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
using namespace std;

#define ll long long
#define MP make_pair

int main(void) {
	int a[30]={},num=0;
	string s;
	cin>>s;
	for (int i = 0; i < s.size(); i++) {
		a[s[i]-'A']++;
	}

	for (int i = 0; i < 30; i++) {
		if(a[i]>=2)num++;
	}
	if(num==2)cout<<"Yes\n";
	else cout<<"No\n";


	



	return 0;
}



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

int main(){
    char b, ans;
    cin >> b;

    if (b == 'A') {
        ans = 'T';
    }else if (b == 'T') {
        ans = 'A';
    }else if (b == 'C') {
        ans = 'G';
    }else if (b == 'G') {
        ans = 'C';}

    cout << ans << endl;
}

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

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  int N,count=0;
  scanf("%d",&N);
  int num[N];
  for(int i=0;i<N;i++) scanf("%d ",&num[i]);
  for(int i=0;i<N;i++) count += (num[i]-1);
  printf("%d",count);
  return 0;
}


Measured memory_bytes: 128
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(1000000)
from collections import *
from bisect import *
from copy import deepcopy
mod = 10**9+7

N, K = map(int, input().split())
T = [0 if x == 'L' else 1 for x in input()]
f = 0
cnt = 1
for i in range(N-1):
    if T[i] != T[i+1]:
        cnt += 1
if cnt//2 <= K:
    f = 1
ans1 = ans2 = N-cnt
# print(ans1, ans2, cnt)
S = [x for x in T]
l, r, k = 0, N-1, 0
while l < N and S[l] == 1:
    l += 1
# ans1 += l
while l < N-1 and S[l+1] == 0:
    l += 1
while 0 <= r and S[r] == 1:
    r -= 1
# ans1 += N-r-2
while 0 < r and S[r-1] == 0:
    r -= 1
# print(ans1)
while l < r and k < K:
    k += 1
    ans1 += 2
    l += 1
    r -= 1
    while l < r and S[l] == S[l+1]:
        l += 1
    while l < r and S[r-1] == S[r]:
        r -= 1

S = [x for x in T]
l, r, k = 0, N-1, 0
while l < N and S[l] == 0:
    l += 1
# ans2 += l
while l < N-1 and S[l+1] == 1:
    l += 1
while 0 <= r and S[r] == 0:
    r -= 1
# ans2 += N-r-2
while 0 < r and S[r-1] == 1:
    r -= 1
while l < r and k < K:
    k += 1
    ans2 += 2
    l += 1
    r -= 1
    while l < r and S[l] == S[l+1]:
        l += 1
    while l < r and S[r-1] == S[r]:
        r -= 1
print(max(ans1, ans2, f*N-1))


Measured memory_bytes: 5980
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
const int MAX_N = (int)1e6;
int n;
ll agenda[MAX_N][3];
ll dp[MAX_N][3];
ll dfs(int pos, int flag)
{
    if(pos >= n) return 0;
    if(dp[pos][flag]) return dp[pos][flag];
    ll res = -INF;
    for(int i = 0; i < 3; i++)
    {
        if(i == flag) continue;
        res = max(dfs(pos + 1, i) + agenda[pos][i], res);
    }
    return dp[pos][flag] = res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    memset(dp, 0, sizeof(dp));
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 3; j++) cin >> agenda[i][j];
    }
    cout << dfs(0, -1) << endl;
    return 0;
}



Measured memory_bytes: 33152
main(n){
int a, v;
int mia, mav;
int i;

scanf("%d", &n);
scanf("%d %d", &mia, &mav);
for (i = 1; i < n; i++){
scanf("%d %d", &a, &v);
if (mav < v) mav = v, mia = a;
else if (mav == v) if (mia > a) mia = a;
}
printf("%d %d\n", mia, mav);

return (0);
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n, m;
    cin >> n >> m;
    int64 xSum = 0;
    vector<int64> x(n);
    REP(i,n)cin >> x[i];
    REP(i,n-1){
        xSum += (x[i+1] - x[i]) * (n - i - 1) * (i + 1);
        xSum %= MOD;
    }
    int64 ySum = 0;
    vector<int64> y(m);
    REP(i,m)cin >> y[i];
    REP(i,m-1){
        ySum += (y[i+1] - y[i]) * (m - i - 1) * (i + 1);
        ySum %= MOD;
    }
    ANS(xSum * ySum % MOD);
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<cmath>
 
#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
 
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9
#define MOD 1000000007
 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::pair<ll, ll> P;
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}

typedef std::pair<ll, ll> P;
 
using namespace std;

int main()
{
    ll n;
    string s;
    cin >> n >> s;

    ll cnt = 1;

    rep(i, n-1){
        if(s[i] != s[i+1]){
            cnt ++;
        }
    }

    cout << cnt;


}

Measured memory_bytes: 512
from collections import Counter

n = int(input())

divisors = []
e = int(n ** 0.5) + 1
for a in range(2, e):
    while n % a == 0:
        divisors.append(a)
        n //= a
    if n == 1:
        break
if n != 1:
    divisors.append(n)

if len(divisors) == 0:
    print(0)
    exit(0)

ans = 0
ctr = Counter(divisors)
for d, n in ctr.items():
    x = 1
    while n >= x:
        n -= x
        x += 1
        ans += 1
print(ans)

Measured memory_bytes: 9720
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int a, p;
    cin >> a >> p;
    int ans = (a * 3 + p) / 2;
    std::cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = (a); i < (b); i++)
#define RREP(i, a, b) for(int i = (a); i >= (b); i--)
#define pq priority_queue
#define P pair<int, int>
#define P2 pair<int, P>
#define P3 pair<int, P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF = 1e9, MOD = 1e9+7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
const int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
const ld PI = abs(acos(-1));
const int sqrtN = 512;
const int logN = 32;
const ll LINF=1e18;

int h, w;

int func(int i, int j, bool f){
	return i * w + j + f * h * w;
}

template<typename T>
struct Dinic{
	struct edge{
		int to;
		T cap;
		int rev;
	};
	
	const T INF;
	vector<vector<edge>> g;
	vector<T> min_cost;
	vector<int> itr;
	
	Dinic(int n) : INF(numeric_limits<T>::max()){
		g.resize(n);
	}
	
	void add_edge(int from, int to, T cap){
		g[from].push_back(edge{to, cap, (int)g[to].size()});
		g[to].push_back(edge{from, 0, (int)g[from].size() - 1});
	}
	
	bool bfs(int s, int t){
		min_cost.assign(g.size(), -1);
		queue<int> qu; qu.push(s); min_cost[s] = 0;
		
		while(!qu.empty()){
			auto p = qu.front(); qu.pop();
			
			for(auto e:g[p]){
				if(e.cap <= 0 or min_cost[e.to] != -1) continue;
				min_cost[e.to] = min_cost[p] + 1;
				qu.push(e.to);
			}
		}
		
		return min_cost[t] != -1;
	}
	
	T dfs(int idx, const int t, T flow){
		if(idx == t) return flow;
		for(int &i = itr[idx]; i < g[idx].size(); i++){
			edge &e = g[idx][i];
			
			if(e.cap <= 0 or min_cost[idx] >= min_cost[e.to]) continue;
			T d = dfs(e.to, t, min(flow, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
			
		}
		
		return 0;
	}
	
	T max_flow(int s, int t){
		T flow = 0;
		while(bfs(s, t)){
			itr.assign(g.size(), 0);
			T f = 0;
			while((f = dfs(s, t, INF)) > 0) flow += f;
		}

		return flow;
	}
};

int main(){
	cin >> h >> w; string s[110];
	for(int i = 0; i < h; i++) cin >> s[i];
	Dinic<int> dinic(h * w * 2);
	
	int st, t;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(s[i][j] == 'S') st = func(i, j, false);
			if(s[i][j] == 'T') t = func(i, j, true);
			if(s[i][j] == '.') continue;
			
			dinic.add_edge(func(i, j, true), func(i, j, false), 1);
			for(int k = 0; k < h; k++){
				if(i == k) continue;
				if(s[k][j] == '.') continue;
				dinic.add_edge(func(i, j, false), func(k, j, true), INF);
			}
			
			for(int k = 0; k < w; k++){
				if(j == k)  continue;
				if(s[i][k] == '.') continue;
				dinic.add_edge(func(i, j, false), func(i, k, true), INF);
			}
		}
	}
	
	ll pos = dinic.max_flow(st, t);
	cout << (pos >= INF ? -1 : pos) << endl;
	return 0;
}


Measured memory_bytes: 62464
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var canDivide = false
    for (i:Int in 1..9) {
        if (canDivide) break
        for (j:Int in 1..9) {
            if (i * j == n) {
                canDivide = true
                println("Yes")
                break
            }
        }
    }
    if (!canDivide) {
        println("No")
    }
}

Measured memory_bytes: 31752
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX_N 100001

int N;
long int A[MAX_N];
long int num = 0;
int main(){
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    long int min_value = 10000000000;
    int cnt = 0;
    for (int i = 0; i < N; i++){
        if (A[i] < 0){
            cnt += 1;
        }
        num += abs(A[i]);
        min_value = min(abs(A[i]), min_value);
    }
    if (cnt % 2 == 0){
        
    }else{
        num -= 2 * min_value;
    }
    cout << num << endl;
    return 0;
}

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

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	while (1)
	{
		c -= b;
		if (c <= 0) {
			cout << "Yes";
			break;
		}

		a -= d;
		if (a <= 0) {
			cout << "No";
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, a[214514], b[214514];
vector<P> ta;

signed main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i] >> b[i];
		ta.push_back({ b[i],a[i] });
	}
	int cnt = 0;
	sort(all(ta));
	rep(i, n) {
		if (cnt + ta[i].second > ta[i].first) {
			cout << "No" << endl;
			return 0;
		}
		cnt += ta[i].second;
	}
	cout << "Yes" << endl;
}

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

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;

	if (r <= x && x <= w-r &&
		r <= y && y <= h-r)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3068
#include <iostream>


int main()
{
	int a, b, c=0, es=0;

	std::cin >> a >> b;
	for(int i = 0; ; i++)
	{
		if(es+a>=b)
		{
			c++;
			break;
		}
		es+=(a-1);
		c++;
	}
	if(b == 1)
		std::cout << 0 << std::endl;
	else
		std::cout << c << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

string rotate(string arg, long num) {
  long size = arg.size();
  return arg.substr(num, size-num) + arg.substr(0, num);
}

void solve() {
  string S, T;
  cin >> S >> T;
  rep (i, S.size()) {
    if (S == rotate(T, i)) {
      puts("Yes");
      return;
    }
  }
  puts("No");
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>

int main(void)
{
	int n, m;

	while(scanf("%d%d", &n, &m)==2)
	{
		int u, x;

		u=m*1900+(n-m)*100;
		x=u*(1<<m);

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


Measured memory_bytes: 128
// Mohammad Faisal
#include<bits/stdc++.h>
using namespace std;
int arr[1000030];
int main(){
    
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
        arr[i] = 0;
    
    for(int i=1;i<n;i++){
        int x;
        cin >> x;
        arr[x]++;
    }
    for(int i=1;i<=n;i++){
        cout<<arr[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 4452
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

typedef long long LL;
static const LL MOD = 998244353;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1, mx = 0;
		cin >> n;
		if (n <= 0) return 0;
		vector<int> d(n);
		map<int, int> m;
		for (int i = 0; i < n; ++i) {
			cin >> d[i];
			m[d[i]] += 1;
			mx = max(mx, d[i]);
		}
		LL ans = 0;
		if (d[0] == 0 && m[0] == 1) {
			ans = 1;
			for (int i = 1; i <= mx; ++i) {
				if (!m[i]) {
					ans = 0;
				} else {
					for (int j = 0; j < m[i]; ++j) {
						ans = (ans * m[i - 1]) % MOD;
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 5376
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int l[200005];
int main(){
    int n,x;
    cin >> n>> x;
    set<int> s;
    if(x==1||x==2*n-1){
        cout<<"No"<<endl;
    }else{
        rep(i,2*n-1){
            s.insert(i+1);
        }
        l[n]=x;
        l[n-1]=x-1;
        l[n+1]=x+1;
        s.erase(x);
        s.erase(x-1);
        s.erase(x+1);
        rep2(i,2*n-1){
            if(i!=n-1&&i!=n&&i!=n+1){
                l[i]=*s.begin();
                s.erase(l[i]);
            }
        }
        cout<<"Yes"<<endl;
        rep2(i,2*n-1){
            cout<<l[i]<<endl;
        }
    }
    return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;

    if ((a > 0 && a < 10) && (b > 0 && b < 10)) {
        cout << (a * b) << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    
    int n; cin >> n;
    vector<int> a(n), b(n);
    repeat (i, n) cin >> a[i];
    repeat (i, n) cin >> b[i];
    
    auto psum = [](const vector<int>& v, int m, int n) {
        int ans = 0;
        repeat_from_to (i, m, n) ans += v[i];
        return ans;
    };
    
    int ans = 0;
    repeat (i, n) {
        int tmp = 0;
        tmp += psum(a, 0, i);
        tmp += psum(b, i, n - 1);
        ans = max(tmp, ans);
        //dump(i); dump(psum(a, 0, i)); dump(psum(b, i, n)); dump(tmp); el;
    }
    cout << ans << endl;
    return 0;
    
}

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

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

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

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    vector<int> A = {x2-x1,y2-y1};
    swap(A[0],A[1]);
    A[0]*=-1;
    int x3,y3,x4,y4;
    x3 = x2 + A[0];
    y3 = y2 + A[1];
    swap(A[0],A[1]);
    A[0]*=-1;
    x4 = x3 + A[0];
    y4 = y3 + A[1];
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << "\n";
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int S = input.Sum();

            int S1 = input[0];
            int S2 = S - S1;
            int minS = Math.Abs(S1 - S2);
            for(int i = 1; i < N; i++)
            {
                S1 += input[i];
                S2 -= input[i];
                minS = Math.Min(minS, Math.Abs(S1 - S2));
            }

            Console.WriteLine($"{minS}");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
    using namespace std;
     
    long long memo[86];
    long long luca(int n) {
      if (n == 0) return 2;
      if (n == 1) return 1;
      if (memo[n] != 0) return memo[n];
      return memo[n] = luca(n-1) + luca(n-2);
    }
     
    int main() {
      int N;
      cin >> N;
      cout << luca(N) << endl;
    }

Measured memory_bytes: 256