akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iostream>

using namespace std;

#define MAX 100000
#define NIL -1


/*
 * ??¨?????¨???????????????????????????????????????
 * parent ???
 * left ???????????????
 * right ??????????????????
 */
struct Node {
    int parent; 
    int left; 
    int right;
};

struct Node T[MAX];
int depthList[MAX];
//node 0: parent = -1, depth = 0, root, [1, 4, 10]
void printTree(int id) {
    cout << "node " << id << ": " << "parent = " << T[id].parent << ", " << "depth = " << depthList[id] << ", ";
    if(T[id].parent == NIL) {
        cout << "root, ";
    }
    else if(T[id].left != NIL) {
        cout << "internal node, ";
    }
    else {
        cout << "leaf, ";
    }
    
    cout << "[";
    
    for(int i = 0, c = T[id].left; c != NIL; i++, c = T[c].right) {
        if(i) {
            cout << ", ";
        }
        cout << c;
    }
    cout << "]" << endl;
}


/**
 * ?????°????????±???????¨????????????????
 * ????????§??¨????????????????????????????????¨???????????§???
 * ????????¨????????????????????°??????????????????????????°????????????
 * @param id
 * @param depth
 */
void rec(int id, int depth) {
    depthList[id] = depth;
    if(T[id].left != NIL) {
        rec(T[id].left, depth + 1);
    }
    
    if(T[id].right != NIL) {
        rec(T[id].right, depth);
    }
}

int main(void) {
    
    int num;
    cin >> num;
    
    //all node is initialized to NIL
    for(int i = 0; i < num; i++) {
        T[i].parent = T[i].left = T[i].right = NIL;
    }
    
    int id, degree, child, preChild;
    for(int i = 0; i < num; i++) {
        cin >> id >> degree;
        for(int j = 0; j < degree; j++) {
            cin >> child;
            if(j == 0) {
                T[id].left = child;
            }
            else {
                T[preChild].right = child;
            }
            preChild = child;
            T[child].parent = id;
        }
    }
    
    int rootId;
    for(int i = 0; i < num; i++) {
        if(T[i].parent == NIL) {
            rootId = i;
        }
    }
    
    rec(rootId, 0);
    
    for(int i = 0; i < num; i++) {
        printTree(i);
    }
    return 0;
}

Measured memory_bytes: 2720
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define size 200000
#define NUM 998244353
#define ll long long int



int main()
{				std::cout.precision(11);
        		double n;
                cin>>n;
              	double x=(double)(n)/3;
              	cout<<x*x*x<<endl;
            

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		String[] s = str.split("");
		boolean f = false;
		for(String a: s){
			if(a.equals("7")) f =true;
		}
		if(f){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 27008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; 

int main(){
  int a,b;
  cin >> a >> b;
  if(a<b){
    for(int i=0; i<b; i++){
      cout << a;
    }
  cout << endl;
  return 0;
  }
  else{
    for(int i=0; i<a; i++){
      cout << b;
    }
    cout << endl;
    return 0;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    k--;
    map<string, bool> mp;
    vector<string> v;
    rep(i, s.size())
    {
        rep(j, 1, k + 1 + 1)
        {
            if (i + j > s.size())
                break;

            string t = s.substr(i, j);
            if (mp[t] == true)
            {
                continue;
            }
            mp[t] = true;
            v.push_back(t);
        }
    }
    sort(ALL(v));
    cout << v[k] << endl;
    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr ll mod998=998244353;

string T;
int cnt;
int main(){
	cin>>T;
	for(int i=T.size()-1;i>=0;i--){
		if(T[i]=='?'){
			T[i]='D';
		}
	}
	cout<<T<<endl;
}


Measured memory_bytes: 3720
#include <iostream>
 
int main() {
	int x, y;
  
  	scanf("%d", &x);
  	scanf("%d", &y);
  	
  	if (x == y) {
    	std::cout << "Yes" << std::endl;
      	return 0;
    }
  
  	std::cout << "No" << std::endl;
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include<cstring>
using namespace std;
//long long int n,W;
//long long int dp[n+1][W+1];


            
        
     
int main() {
    long long int n,W;
    cin>>n>>W;
    long long int dp[n+1][W+1];
    memset(dp,0,sizeof(dp));

    
   long long int arr[n+1],val[n+1];
    for(long long int i=1;i<=n;i++){
        cin>>arr[i]>>val[i];

    }
   // cout<<knapsack(arr,val,n,W);
   for(long long int i=1;i<=n;i++){
                for(long long int j=0;j<=W;j++){

            
        
             if(arr[i]<=j){
                dp[i][j]=max(val[i]+dp[i-1][j-arr[i]],dp[i-1][j]);
            }
             else {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<< dp[n][W];


}


Measured memory_bytes: 82300
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;


/* range: ± 3.27 * 10^4 */
using i16 = short int;
/* range: 0 to 65535 */
using u16 = short unsigned int;
/* range: ± 2.14 * 10^9 */
using i32 = int;
/* range: 0 to 4.29 * 10^9 */
using u32 = unsigned int;
/* range: ± 9.22 * 10^18 */
using i64 = long long int;
/* range: 0 to 1.84 * 10^19 */
using u64 = long long unsigned int;


static constexpr i32 MAX = 1e9 + 7;

// array<array<i32, 101>, 100007> memo;
// i32 knapsackRecur(const vector<i32>& w, const vector<i32>& v, i32 val,
//                   i32 idx = 0) {
//     if (val <= 0) {
//         return 0;
//     }

//     if (idx == w.size()) {
//         return MAX;
//     }

//     if (memo[val][idx] != -1) {
//         return memo[val][idx];
//     }

//     memo[val][idx] = min(knapsackRecur(w, v, val, idx + 1),
//                          w[idx] + knapsackRecur(w, v, val - v[idx], idx +
//                          1));

//     return memo[val][idx];
// }

i32 knapsack2(const vector<i32>& w, const vector<i32>& v, i32 capacity,
              i32 max_val) {
    vector<i32> dp(max_val + 1, MAX);
    dp[0] = 0;

    for (i32 i = 0; i < w.size(); i++) {
        for (auto val = max_val; val >= v[i]; val--) {
            dp[val] = min(dp[val], dp[val - v[i]] + w[i]);
        }
    }

    // for (; max_val > 0; max_val--) {
    //     if (knapsackRecur(w, v, max_val) <= capacity) {
    //         return max_val;
    //     }
    // }
    for (auto val = max_val; val > 0; val--) {
        if (dp[val] <= capacity) {
            return val;
        }
    }
    return 0;
}

i32 main() {
    i32 items = 0, capacity = 0;

    cin >> items >> capacity;

    i32 max_val = 0;
    vector<i32> w(items), v(items);
    for (i32 i = 0; i < items; i++) {
        cin >> w[i] >> v[i];
        max_val += v[i];
    }

    // memo[0].fill(-1);
    // memo.fill(memo[0]);

    cout << knapsack2(w, v, capacity, max_val) << '\n';
}

Measured memory_bytes: 3736
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <map>
#include <utility>

using namespace std;

#define ll long long

bool cmp(const pair<int, int> &a, const pair<int, int> &b)
{
    return a.second < b.second;
}

void solve()
{
    // 入力の処理
    ll N;
    cin >> N;
    vector<pair<int, int>> A(N);
    int a;
    for (int i = 0; i < N; i++)
    {
        cin >> a;
        A.at(i) = make_pair(i, a);
    }

    sort(A.begin(), A.end(), cmp);
    cout << A.at(0).first + 1;
    for (int i = 1; i < N; i++)
    {
        cout << " " << A.at(i).first + 1;
    }
    cout << endl;
    return;
}

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

Measured memory_bytes: 1536
// RWWW
// WW[WR]RR WRを削除、RRR|WWWにする。
// WRWRWR
// WWWWRWWWW => WWW[W]WWWW
// WWWRRRWWW => [RRR]RRRWWW
// WRWWWWWWW => W[W]WWWWWW / [R]RWWWWWWW
// 全部のRの個数をかぞえる AR
// 全部のWの個数をかぞれる AW
// RR[WR]WW => RR[RW]WW
// RR[WR]WWW ==>

// W[WR]R R[WR]W 
#include <iostream>
#include <vector>
#include <deque>
#include <tuple>
#include <algorithm>
#include <iterator> // std::back_inserter
#include <climits>
#include <sstream>

#define swap(x,y) do {auto tmp = x; x = y; y = tmp;} while(0)
using namespace std;

typedef unsigned long ll;

ll n;
char a[200001];

int main()
{
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    ll counter = 0;
    int rp = n-1;
    int lp = 0;
    while(1) {
//        cout << "lp=" << lp << " rp=" << rp << " "; for (int i=0; i<n; i++) { cout << a[i]; } cout << endl;
        // WR
        //    WRRRRR WWWWWWWWR
        // => RRRRRR WWWWWWWWR
        // => WRRRRR WWWWWWWWW
        // => RRRRRR WWWWWWWWW

        if (a[lp] == 'W' && a[rp] == 'R') {
            swap(a[lp],a[rp]);
            counter++;
            lp++; rp--;
            if (lp >= rp) {
               break;
            }
            continue;
        }
        if (a[lp] == 'R' && a[rp] == 'R') {
            lp++;
            if (lp >= rp) {
               break;
            }
            continue;
        }
        if (a[lp] == 'W' && a[rp] == 'W') {
            rp--;
            if (lp >= rp) {
               break;
            }
            continue;
        }
        if (a[lp] == 'R' && a[rp] == 'W') {
            lp++; rp--;
            if (lp >= rp) {
                break;
            }
        }
    }
//    cout << "-- lp=" << lp << " rp=" << rp << " ";    for (int i=0; i<n; i++) { cout << a[i]; } cout << endl;
    cout << counter << endl;
}


Measured memory_bytes: 3820
#include <iostream>
#include <bits/stdc++.h>
#define W_MAX 1000000001
using namespace std;

int main(){
	int n,c;
	cin >> n >> c;
	 int v[n],w[n];
  int maxi = 0;
	for(int i=0;i<n;i++){
	    cin >> w[i] >> v[i];
      maxi+=v[i];                   
     }
     
    int dp[n+1][maxi+1];
  	for(int i=0;i<=n;i++)
  	dp[i][0]=0;
  	for(int i=1;i<=maxi;i++){
  	    dp[0][i]=W_MAX;
  	}
       for(int j=1;j<=n;j++){
           for(int k=0;k<=maxi;k++){
               if(v[j-1]<=k)
               dp[j][k]=min(dp[j-1][k],w[j-1]+dp[j-1][k-v[j-1]]);
               else
               dp[j][k]=dp[j-1][k];
           }
       }
      
           int ans = 0;
           for(int i=0;i<=maxi;i++){
               if(dp[n][i]<=c){
                   ans = i;
               }
               
           }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 42892
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    ll a, b;
    cin >> a >> b;
    ll gcd_ = gcd(a, b);
    map<ll, ll> m;
    prime_map(m, gcd_);
    cout << m.size() + 1 << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


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

using namespace std;

int main(){
	long long n;
  	long long max_a = 0;
  	long long tot = 0;
  	cin >> n;
  	for (int i=0;i<n;i++) {
    	long long a;
      	cin >> a;
      	if (max_a > a) {
			tot += max_a - a;
        } else {
        	max_a = a;
        }
    }
  cout << tot << endl;
  return(0);
}

Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	n := nextInt()
	ana := map[string]int{}
	ans := 0
	for i := 0; i < n; i++ {
		s := nextString()
		s = SortString(s)
		ans += ana[s]
		ana[s]++
	}
	fmt.Println(ans)
}

func factorial(n int) int {
	var x int
	if n > 0 {
		x = n * factorial(n-1)
	} else {
		x = 1
	}
	return x
}

type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

int h, w;
char arr[10][10] = {};

bool dfs(int y, int x)
{
    if (y == h && x == w)
    {
        // cout << "aaa" << endl;
        return true;
    }
    else
    {
        bool f = false;
        if (x + 1 <= w && arr[y][x + 1] == '#')
            f |= dfs(y, x + 1);
        if (y + 1 <= h && arr[y + 1][x] == '#')
            f |= dfs(y + 1, x);
        return f;
    }
}

signed main()
{
    cin >> h >> w;
    for (int i = 0; i < h; i++)
    {
        string tmp;
        cin >> tmp;
        for (int j = 0; j < w; j++)
            arr[i + 1][j + 1] = tmp[j];
    }
    bool f = true;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (i - 1 >= 1 && j + 1 <= w)
            {
                if (arr[i][j] == '#' && arr[i - 1][j + 1] == '#')
                    f = false;
            }
        }
    }
    // if (dfs(1, 1) && f)
    if (f)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
}

Measured memory_bytes: 256
(defvar *a* (read))
(defvar *b* (read))
(defvar *c* (read))

(defun main ()
  (let ((lst (list *a* *b* *c*)))
    (setq lst (sort lst #'>))
    (let ((left (concatenate 'string (write-to-string (nth 0 lst)) (write-to-string (nth 1 lst)))))
      (princ (+ (parse-integer left) (nth 2 lst))))))

(main)

Measured memory_bytes: 11360
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define lu unsigned long long int
#define pi pair<ll, ll>
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for (ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define be begin
#define sz(a) (ll)(a.size())
#define INF 1e18
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

// ll gcd(ll a, ll b){
// 	return b == 0 ? a : gcd(b, a % b);
// }

// ll mod = 1e9+7;

// ll mult(ll x, ll y){
//     ll rem=1;
//     while(y){
//         if(y&1){
//             rem=(rem*x)%mod;
//         }
//         x=(x*x)%mod;
//         y>>=1;
//     }
//     return rem;
// }

ve<string>s(1001);
ll h,w,c1,c2,d1,d2;
ll dp[1002][1002];

bool vi[1002][1002];

void dijk(ll x, ll y){
	priority_queue<pair<ll,pi>, ve<pair<ll,pi>>, greater<pair<ll,pi>>>pq;
	pq.push({0, {x,y}});
	dp[x][y]=0;
	while(!pq.empty()){
		auto p=pq.top(); pq.pop();
		x=p.se.fi, y=p.se.se;
		if(vi[x][y]==1) continue;
		vi[x][y]=1;
		for(ll i=x-2;i<=x+2;i++){
			for(ll j=y-2;j<=y+2;j++){
				if(i>=0 && j>=0 && i<h && j<w && s[i][j] == '.'){
					if(vi[i][j]==1) continue;
					ll z=0;
					if((abs(x-i)+abs(y-j)) > 1) z=1;
					if(dp[i][j]>dp[x][y]+z){
						dp[i][j] = dp[x][y]+z;
						pq.push({dp[i][j], {i, j}});
					}
				}
			}
		}
	}
}

void solve(ll T){
	cin>>h>>w>>c1>>c2>>d1>>d2;
	c1--;c2--;d1--;d2--;
	for(ll i=0;i<h;i++){
		cin>>s[i];
	}
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			dp[i][j] = INF;
		}
	}
	dijk(c1,c2);
	if(dp[d1][d2]==INF){
		cout << "-1\n";
	}
	else{
		cout << dp[d1][d2] << "\n";
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// std::cout << std::unitbuf;
	ll T=1;
	// cin>>T;
	for(ll t=1;t<=T;t++){
		solve(t);
	}
	return 0;
}


Measured memory_bytes: 13556
n,k,s=map(int,input().split())
ans=[s]*k
if n-k>0:
  ans1=[]
  if s==10**9:
    ans1=[1]*(n-k)
  else:
    ans1=[s+1]*(n-k)
  ans[len(ans):len(ans)]=ans1
print(' '.join(map(str,ans)))

Measured memory_bytes: 12708
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt();
		int m= sc.nextInt();
		int[] h=new int[n];
		boolean[] an=new boolean[n];
		int a;
		int b;
		for(int i=0;i<n;i++){
			h[i]=sc.nextInt();
			an[i]=true;
		}
		for(int i=0;i<m;i++){
			a=sc.nextInt();
			b=sc.nextInt();
			if(h[a-1]>=h[b-1]){
				an[b-1]=false;
			}
			if(h[a-1]<=h[b-1]){
				an[a-1]=false;
			}
		}
		int ans=0;
		for(int i=0;i<n;i++){
			if(an[i]){
				ans++;
			}
		}
		System.out.println(ans);
	}
}


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

int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    
    bool flg = true;
    if ( N % 2 == 0 ){
        flg = true;
    } else {
        flg = false;
    }
    
    for ( int i = 0; i < N / 2; ++i){
        if ( S[i] != S[i+N/2] ){
            flg = false;
        }
    }
    
    if ( flg ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a1=list(map(lambda x: int(x), input().split()))
a2=list(map(lambda x: int(x), input().split()))

tmp=a1[0]+sum(a2)
ans=tmp
for i in range(n-1):
    tmp=tmp+a1[i+1]-a2[i]
    ans=max(ans,tmp)
print(ans)

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

cnt = 0
if abs(x) < abs(y):
    if x < 0:
        x *= -1
        cnt += 1
    cnt += abs(y) - abs(x)
    x += abs(y) - abs(x)
    if x != y:
        cnt += 1
elif abs(x) == abs(y):
    cnt += 1
else:
    if x > y:
        x *= -1
        cnt += 1
    cnt += abs(x) - abs(y)
    x += abs(x) - abs(y)
    if x != y:
        cnt += 1
print(cnt)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    int n;
    cin>>n;
    vi a(n);
    cin>>a;
    sort(ALL(a));
    cout<<a[n-1]-a[0]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> // STL
#include <string> 
#include <vector>
#include <queue>
#include <stack>
#define mpr make_pair
#define debug() puts("okkkkkkkk")

using namespace std;

typedef long long LL;

const int inf = 1 << 26;

int n;
int a[1005];
int mx=0,mn=1;

int main(){
	int fg=1;
	a[0]=-inf;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(i>1&&a[i]<a[i-1])fg=0;
		if(a[i]>a[mx])mx=i;
		if(a[i]<a[mn])mn=i;
	}
	if(fg)return puts("0"),0;
	if(a[mn]>0){
		printf("%d\n",n+n-1);
		for(int i=1;i<=n;i++){printf("%d %d\n",mx,i);a[i]+=a[mx];}
		for(int i=2;i<=n;i++)printf("%d %d\n",i-1,i),a[i]+=a[i-1];
//		for(int i=1;i<=n;i++)printf("%d ",a[i]);puts("");
	}else if(a[mx]<0){
		printf("%d\n",n-1);
		for(int i=n-1;i>=1;i--)printf("%d %d\n",i+1,i),a[i]+=a[i+1];
//		for(int i=1;i<=n;i++)printf("%d ",a[i]);puts("");
	}else{
		if(abs(a[mx])>abs(a[mn])){
			printf("%d\n",n+n-1);
			for(int i=1;i<=n;i++){printf("%d %d\n",mx,i);a[i]+=a[mx];}
			for(int i=2;i<=n;i++)printf("%d %d\n",i-1,i),a[i]+=a[i-1];
//			for(int i=1;i<=n;i++)printf("%d ",a[i]);puts("");
		}else{
			printf("%d\n",n+n-1);
			for(int i=1;i<=n;i++){printf("%d %d\n",mn,i);a[i]+=a[mn];}
			for(int i=n-1;i>=1;i--)printf("%d %d\n",i+1,i),a[i]+=a[i+1];
//			for(int i=1;i<=n;i++)printf("%d ",a[i]);puts("");
		}
	}

	return 0;
}


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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.1415926535897932384626

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, s[100005];

bool ok(int pos){
	LL cs = 0;
	FI(i, 1, pos) cs += s[i];
	FI(i, pos + 1, n){
		if(cs + cs >= s[i]) cs += s[i];
		else return false;
	}
	return true;
}
int main(){
	scanf("%d", &n);
	FI(i, 1, n) scanf("%d", &s[i]);
	
	sort(s + 1, s + n + 1);
	
	int l = 0, r = n + 1;
	while(r - l > 1){
		int m = (l + r) >> 1;
		if(!ok(m)) l = m;
		else r = m;
	}
	printf("%d\n", n - l);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define RFOR(i, begin, end) for(int i=(end)-1, i##_begin_=(begin);i>=i##_begin_;i--)
#define rep(i, N) FOR(i, 0, N)
#define rrep(i, N) RFOR(i, 0, N)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long int;
using V = vector<ll>;
using P = pair<ll, ll>;
using VP = vector<P>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
constexpr int mod = 1e9+7;
ll gcd(ll a, ll b) { return b? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}


int main() {
    ll y, m, d;
    char s1, s2;
    cin >> y >> s1 >> m >> s2 >> d;
    cout << (m <= 4 ? "Heisei" : "TBD") << endl;
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
VL dx={1,0,-1,0};
VL dy={0,1,0,-1};
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({b*d,b*c,a*c,a*d})<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1,pp;
    //cin>>t;
    pp=t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<": ";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3652
#include<stdio.h>

int main(){
  int i, j;
  int h, w;

  while(1){
    scanf("%d %d", &h, &w);

    if(h == 0 && w == 0) break;
  
    for(i = 0; i < h; i++){
      for(j = 0; j < w; j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2032
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
    int i,j,arr[11];

    for(i=0;i<10;++i)
        scanf("%d",&arr[i]);

    sort(arr,arr+10);

    for(i=9;i>=7;--i)
        printf("%d\n",arr[i]);
    return 0;
}

Measured memory_bytes: 1204
#pragma region header
#include <bits/stdc++.h>
#define int long long
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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n,k;cin >> n >> k;
    vi a(n);rep(i, n)cin >> a[i];
    int mi=inf;
    rep(i, n-k+1) chmin(mi,a[i+k-1]-a[i]+(min(abs(a[i+k-1]),abs(a[i]))));
    if(mi==inf) mi=a[n-1]-a[0]+(min(abs(a[n-1]),abs(a[0])));
    cout << mi << endl;
    return 0;
}
/*
3 3
1 2 3
*/

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

int a, b, c, x, res = 0;

int main(){
  cin >> a >> b >> c >> x;
  for(int i = 0; i <= a; i++){
    for(int j = 0; j <= b; j++){
      for(int k = 0; k <= c; k++){
        if(x == i*500 + j*100 + k*50) res++;
      }
    }
  }
  cout << res << endl;
  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <bitset>
#include <regex>
#include <cassert>
#include <set>
#include <map>
using namespace std;
#define inf 2000000000
#define mod 1000000007

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int s,w;
	cin >> s >> w;
	if(s <= w) cout << "unsafe";
	else cout << "safe";
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs           v.size()
#define sot(v)       sort(v.begin(),v.end())
#define rev(v)       reverse(v.begin(),v.end())
#define yes          cout<<"Yes"<<endl
#define no           cout<<"No"<<endl
#define ii           pair<int, int>
#define int          long long
#define ull          unsigned long long
#define pb           push_back
#define mpp          make_pair
#define Okay         0
#define pi           3.14159

const int inf = 1e6;
const int cont = 1e18;
const int mod = 1e9+7;
using namespace std;

void solve(){
   int n;
   cin>>n;
   int sum = 1;
   for(int i=1; i<=n; i++){
        sum =((sum%mod)*(i%mod))%mod;
   }
   cout<<sum<<endl;
}

int32_t main() {
    Fast;
    solve();
    return Okay;
}


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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  int N, M, Q;
  // 入力: H × W のグリッド
  cin >> N >> M >> Q;
  int H, W; 
  H = N;
  W = N;
  vector<vector<ll> > a(H, vector<ll>(W,0));

  while(M--){
    int tmp1,tmp2;
    cin >> tmp1 >> tmp2;
    tmp1--;
    tmp2--;
    a[tmp1][tmp2]++;
  }

  // 二次元累積和
  vector<vector<ll> > s(H+1, vector<ll>(W+1, 0));
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + a[i][j];

  // クエリ [x1, x2) × [y1, y2) の長方形区域の和
  while(Q--){
    int x1, x2, y1, y2;
    cin >> x1 >> x2;
    x1--;
    y1 = x1;
    y2 = x2; 
    
    cout << s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1] << endl;
  }
}


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


def solve(A: int, B: int, T: int):
    print((T // A) * B)
    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<stdio.h>


int m,f,r;
int n;
int x,y,z,zz;
int total,ans;
int cnt;
int hoge[256];
int i,s,t;

main(){
	
	for(z=0;;z++){
	scanf("%d%d",&x,&y);
	for(i=1;i<=x;i++){
		for(s=1;s<=x;s++){
			for(t=1;t<=x;t++){
				total=(i+s+t);
				if((total==y)&&i<s&&s<t){cnt++;}
				
				total=0;
				
			}
		}
	}
	hoge[z]=cnt;
	cnt=0;
	if(x==0&&y==0){break;}
	
	}
	
	for(zz=0;zz<z;zz++){
	printf("%d\n",hoge[zz]);
	
	
	}
	
	
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

 
int main() {
    ll n, ans = 0;
    ll a, b, k;

    cin >> a >> b >> k;

    if (a >= k) a -= k;
    else if (a + b >= k) {
        b -= (k - a);
        a = 0;
    } else {
        b = 0;
        a = 0;
    }

    cout << a << " " << b << endl;
}

Measured memory_bytes: 764
// AOJ 2769: 28
// 2018.1.6 bal4u@uu

#include <stdio.h>
#include <math.h>

#define HASHSIZ 1500019
typedef struct { long long p; char k; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash+HASHSIZ;

int lookup(long long n)
{
	HASH *p = hash + (int)(n % HASHSIZ);
	while (p->p) {
		if (p->p == n) return p->k;
		if (++p == hashend) p = hash;
	}
	return 0;
}

void insert(long long n, char k)
{
	HASH *p = hash + (int)(n % HASHSIZ);
	while (p->p) {
		if (p->p == n) { p->k = k+1; return; }
		if (++p == hashend) p = hash;
	}
	p->p = n, p->k = k+1;
}

int sz;
long long p[524300];		// 2^19
int ans;

long long special[20] = {
8, 88, 888, 8888, 88888, 888888, 8888888, 88888888, 222888288,
888888888, 8888888888LL, 88888888888LL, 888888888888LL, 8888888888888LL,
88888888888888LL, 888888888888888LL, 8888888888888888LL,
88888888888888888LL, 888888888888888888LL, 0};

//#define getchar_unlocked()  getchar()
long long in()
{
	long long n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int calc(long long n, int i, int s)
{
	int k, a, b;
	long long m;

	if (n & 1) return 0;
	if ((k = lookup(n)) > 0) { if (s+k > ans) ans = s+k; return 1; }
	if (n ==  4) { if (s+2 > ans) ans = s+2; return 1; }
	if (n == 16) { if (s+4 > ans) ans = s+4; return 1; }
	if (n < 21) return 0;

	b = (int)sqrt((double)n);
	for ( ; p[i] <= b; i++) {
		if (!p[i] || (n % p[i])) continue;
		k = (int)p[i];
		m = n / k, a = 1;
		while (!(m % k)) m /= k, a++;
		if (m == 1) { if (s+a > ans) ans = s+a; return 1; }
		if (m < k) m *= k, a--;
		while (a >= 0) {
			if (calc(m, i+1, s+a)) return 1;
			m *= k, a--;
		}
	}
	return 0;
}

void init()
{
	int i, j, k, k2;
	long long t;

	sz = 3;
	p[1] = 2, p[2] = 8, insert(2, 0), insert(8, 0);
	k = 1; for (i = 2; i <= 19; i++) {
		k2 = k << 1;
		for (j = k; j < k2; j++) {
			t = p[j]*10;
			t += 2, p[sz++] = t, insert(t, 0);
			t += 6, p[sz++] = t, insert(t, 0);
		}
		k = k2;
	}
	for (i = 0; special[i]; i++) insert(special[i], 2);
	p[2] = p[6] = p[14] = 0;
}

int main()
{
	int k;
	long long n;

	init();
	n = in();
	if (n & 1) { puts("-1"); return 0; }
	k = 0; while (!(n & 1)) n >>= 1, k++;
	while (k >= 0) {
		n <<= 1, k--;
		calc(n, 2, k);
		if (ans > 0) { printf("%d\n", ans); break; }
	}
	if (ans <= 0) puts("-1");
	return 0;
}



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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int dif = A-B;
  int ans;
  if(dif<=C){
    ans = C-dif;
  } else {
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  string s, t;
  int A, B;
  cin >> s >> t >> A >> B;
  string u;
  cin >> u;
  if (u == s) --A;
  else --B;
  cout << A << " " << B << endl;
  return 0;
}


Measured memory_bytes: 256
num = int(input())

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

ans = 0

while True:
	flag = False
	for i in range(num):
		if(A[i] % 2 != 0):
			flag = True
		else:
			A[i] /= 2
	if flag == True:
		break
	ans += 1


print(ans)


Measured memory_bytes: 3060
/*input
50 4321098765432109
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=55;
const ll maxlg=__lg(maxn)+2;
const ll INF64=80000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

ll num[maxn];
ll tt[maxn];

ll f(int n,ll x){
	//cout<<n<<' '<<x<<' '<<tt[n]<<'\n';
	if(x==0) return 0;
	if(n==0) return 1;
	if(x==1) return 0;
	if(x<=tt[n-1]+1) return f(n-1,x-1);
	else if(x==tt[n-1]+2) return 1+f(n-1,x-2);
	else if(x==tt[n]) return 1+2*f(n-1,tt[n-1]);
	else return 1+num[n-1]+f(n-1,x-2-tt[n-1]);
}

int main()
{
	IOS;
	num[0]=1;
	for(int i=1;i<maxn;i++) num[i]=num[i-1]*2+1;
	tt[0]=1;
	for(int i=1;i<maxn;i++) tt[i]=tt[i-1]*2+3;

	ll n,x;
	cin>>n>>x;
	cout<<f(n,x)<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2e9
#define ll long long


int main(){
    int a, b;
    cin>>a>>b;
    if(b==1){
        cout<<"0"<<endl;
        return 0;
    }
    if(a>=b){
        cout<<"1"<<endl;
        return 0;
    }
    else{
        if((b-a)%(a-1)==0){
            cout<<1+(b-a)/(a-1)<<endl;
        }
        else{
            cout<<2+(b-a)/(a-1)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
N=int(input())
rinsetu=[[1000000 for i in range(N)] for j in range(N)]
d=[1000000]*(N)
color=["white"]*N
for i in range(N):
    a=list(map(int,input().split()))
    for j in range(a[1]):
        j1=j*2+2
        j2=j*2+3
        rinsetu[i][a[j1]]=a[j2]
def hunterhunter():
    d[0]=0
    while(True):
        mincost=1000000
        for i in range(N):
            if color[i]=="white" and mincost>d[i]:
                mincost=d[i]
                u=i
        if mincost==1000000:break
        color[u]="black"
        for i in range(N):
            if color[i]=="white" and rinsetu[u][i]!=1000000:
                if rinsetu[u][i]+d[u]<d[i]:
                    d[i]=rinsetu[u][i]+d[u]
hunterhunter()
for i,cost in enumerate(d):
    print(i,cost)



Measured memory_bytes: 5720
X=int(input())
if X>=2000:
    print(1)
    exit()
for i in range(20):
    if 100*i>X:
        continue
    for j in range(20):
        if 100*i+101*j>X:
            continue
        for k in range(20):
            if 100*i+101*j+102*k>X:
                continue
            for m in range(20):
                if 100*i+101*j+102*k+103*m>X:
                    continue
                for n in range(20):
                    if 100*i+101*j+102*k+103*m+104*n>X:
                        continue
                    for p in range(20):
                        if 100*i+101*j+102*k+103*m+104*n+105*p==X:
                            print(1)
                            exit()
else:
    print(0)

Measured memory_bytes: 3064
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n,m = I()
if n == m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 10476
K = int(raw_input())
x = 1
d = 1
for i in range(K):
  print x
  s1 = sum(map(int,str(x+d)))
  s10 = sum(map(int,str(x+d*10)))
  if (x+d)*s10 >= (x+d*10)*s1:
    d *= 10
  x += d

Measured memory_bytes: 2692
#include <iostream>
#include <vector>

#define REP(i,n) for( unsigned i = 0; i < (n); i++ )

using namespace std;

int main()
{
  int n, m, tmp;
  vector<int> t, p, x;

  cin >> n;
  REP( i, n ) {
    cin >> tmp;
    t.push_back( tmp );
  }

  cin >> m;
  REP( i, m ) {
    cin >> tmp;
    p.push_back( tmp );
    cin >> tmp;
    x.push_back( tmp );
  }

  int sum = 0;
  REP( i, n ) {
    sum += t[i];
  }

  REP( i, m ) {
    cout << sum - t[p[i]-1] + x[i] << endl;
  }

  return 0;
}


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

typedef long long ll;
ll mod = 1000000007;

ll power(ll x, ll y)
{
    ll res = 1;
    x = x%mod;
    while (y)
    {
        if (y&1) res = ((res%mod)*(x%mod))%mod;

        y>>=1;
        x = ((x%mod)*(x%mod))%mod;
    }
    return res;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    ll a, b;
    cin>>a>>b;

    char x[b];
    char y[a];
    for(int i=0; i<b; i++) x[i]=a;
    for(int i=0; i<a; i++) y[i]=b;

    if(lexicographical_compare(x,x+b,y,y+a)){
        for(int i=0; i<b; i++) cout<<to_string(a);
        cout<<'\n';
    }
    else{
        for(int i=0; i<a; i++) cout<<to_string(b);
        cout<<'\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define ft first
#define sc second

int n;
int x[4000],y[4000];
bool s[5010][5010];
bool input(){
    REP(i,5010)
        REP(j,5010)
            s[i][j] = false;

    scanf("%d",&n);
    REP(i,n){
        scanf("%d%d",x + i,y + i);
        s[x[i]][y[i]] = true;
    }
    return n != 0;
}

typedef pair<int,int> P;
typedef pair<P,P> L;
#define EPS (1e-10)


void solve(){
    int maxi = -1,maxj = -1;
    REP(i,n){
        FOR(j,i + 1,n){
            int a = x[i] + x[j];
            int b = x[i] - x[j];
            int c = y[i] + y[j];
            int d = y[j] - y[i];

            if(((a + d) % 2) * ((b + c) % 2))
                continue;
            if(!(0 <= (a + d) / 2 && (a + d) / 2 < 5001 && 0 <= (b + c) / 2 && (b + c) / 2 < 5001) ){
                continue;
            }
            if(!(0 <= (a - d) / 2 && (a - d) / 2 < 5001 && 0 <= (-b + c) / 2 && (-b + c) / 2 < 5001) ){
                continue;
            }
            if(s[(a + d) / 2][(b + c) / 2] && s[(a - d) / 2][(-b + c) / 2]){
                if(maxi == -1 || (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) > (x[maxi] - x[maxj]) * (x[maxi] - x[maxj]) + (y[maxi] - y[maxj]) * (y[maxi] - y[maxj])){
                    maxi = i;maxj = j;
                }
            }
        }
    }
    
    if(maxi == -1)
        printf("0\n");
    else
        printf("%d\n",((x[maxi] - x[maxj]) * (x[maxi] - x[maxj]) + (y[maxi] - y[maxj]) * (y[maxi] - y[maxj])) / 2);
}

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

Measured memory_bytes: 27684
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int a,b,c,x,y; cin>>a>>b>>c>>x>>y;
  int ans=1e9;
  for(int i=0;i<=max(x,y);i++) {
    int cost=(max(x-i,0)*a)+(max(y-i,0)*b)+i*2*c;
    ans=min(ans,cost);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3644
while True:
    sa_max = 0
    Sa = []
    num = 0
    Poi_lis = []
    m,nmin,nmax = map(int,input().split())
    if [m,nmin,nmax] == [0,0,0]:
        break
    for i in range(m):
        Poi_lis.append(int(input()))
        if nmin + 1 <= i + 1 <= nmax + 1:
            Sa.append(Poi_lis[i - 1] - Poi_lis[i])
    Sa_r = Sa[::-1]
    
    cou = Sa_r.index(max(Sa_r))
    print(nmin + len(Sa) - cou - 1)

Measured memory_bytes: 7520