akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
     
#define MIN_VALUE 1
#define MAX_VALUE 300
#define IS_ERR(n) (n < MIN_VALUE || n > MAX_VALUE)
     
typedef struct _Rect {
    int w;
    int h;
    struct _Rect *next;
} Rect;
     
int main(void)
{
     
    int w, h;
    Rect *rect;
    Rect *pre_rect;
    Rect *start_rect;
     
    pre_rect = (Rect *)malloc(sizeof(Rect));
    pre_rect->w = 0;
    pre_rect->h = 0;
    pre_rect->next = NULL;
     
    start_rect = pre_rect;
     
    while(1)
    {
        scanf("%d %d", &h, &w);
   
        if(w == 0 && h == 0) break;
        if(IS_ERR(w) || IS_ERR(h)) return -1;
     
        rect = (Rect *)malloc(sizeof(Rect));
        rect->w = w;
        rect->h = h;
        rect->next = NULL;
     
        pre_rect->next = rect;
        pre_rect = rect;
    }
     
    rect = start_rect->next;
     
    while(1)
    {
        for(int i=0;i<(rect->h);i++)
        {
            for(int j=0;j<(rect->w);j++)
            {
                if((i + j) % 2)
                {
                    printf(".");
                }
                else
                {
                    printf("#");
                }
            }
            printf("\n");
        }
     
        printf("\n");
     
        rect = rect->next;
        if(rect == NULL) break;
    }
     
    return 0;
}


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

using namespace std;
#define  ll  long long
#define f first
#define s second
#define matrix vector<vector<ll>>
#define zero(n,m) matrix(n , vector<ll>(m,0))
#define one(n,m) matrix(n , vector<ll>(m,1))

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

    ll n,x,t,tmp;
    cin >> n >> x >> t;
    tmp = n/x + (n%x != 0);
    cout << tmp*t << '\n';

    return 0;
}



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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  a -= x;
  b -= x;
  if ( a < 0 ) a = -a;
  if ( b < 0 ) b = -b;

  if ( a < b ) cout << "A" << endl;
  else cout << "B" << endl;
  
  
    
  
  
  


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  string s;
  int p=0,w=0,g=0,y=0;
  for (int i=0;i<n;i++){
    cin >> s;
  	if(s=="P") p++;
  	if(s=="W") w++;
  	if(s=="G") g++;
  	if(s=="Y") y++;
  }
  if(p>0 && w>0 && g>0 && y>0) cout << "Four" << endl; else cout << "Three" << endl;
}

Measured memory_bytes: 3628
let lcs x y =
  let m = String.length x in
  let n = String.length y in
  let dp = Array.make_matrix (m+1) (n+1) 0 in
  for i = 1 to m do
    for j = 1 to n do
      dp.(i).(j) <- if x.[i-1] = y.[j-1] then dp.(i-1).(j-1) + 1 else if dp.(i-1).(j) > dp.(i).(j-1) then dp.(i-1).(j) else dp.(i).(j-1)
    done
  done;
  dp.(m).(n)

let () =
  let q = read_int () in
  let rec doit i =
    if i < q then begin
      let x = read_line () in
      let y = read_line () in
      Printf.printf "%d\n" (lcs x y);
      doit (i + 1)
    end
  in
  doit 0

Measured memory_bytes: 18576
K = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[K-1])

Measured memory_bytes: 3316
import numpy as np

D=int(input())#365
c=list(map(int,input().split()))
s=np.array([])
for i in range(D):
#  if(i<16):
#    print((i+10)%26+1)
#  else:
  s=np.array(input().split(), dtype=np.int64)
  sc_mul=s*c
  max_space=np.argmax(sc_mul)
  print(max_space+1)

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

const int N = 1e5+4;

vector<int> adj[N];
vector<int> dp(N,-1);

void dfs(int u){
	if(dp[u]!=-1)
		return ;
	dp[u] = 0;
	for(auto & n : adj[u]){
		dfs(n);
		dp[u] = max(dp[u], 1+dp[n]);
	}
}

int main(){
	int n, m;
	cin >>n >> m;
	int x, y;
	for(int i=0;i<m;++i){
		cin >> x>> y;
		adj[x].push_back(y);
	}
	for(int i=1;i<=n;++i){
		if(dp[i]==-1){
			dfs(i);
		}
	}
	int ans = 0;
	for(int i=1;i<=n;++i){
		ans = max(ans, dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7424
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	static class Node {
		int id;
		Deque<Edge> edges = new ArrayDeque<>();
		Deque<Edge> invEdges = new ArrayDeque<>();
		int dist = Integer.MIN_VALUE / 2;

		Node(int id) {
			this.id = id;
		}
	}

	static class Edge {
		int src, dst, length;

		Edge(int src, int dst, int length) {
			this.src = src;
			this.dst = dst;
			this.length = length;
		}
	}

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		int P = Integer.parseInt(tokens[2]);

		Node[] graph = new Node[N];
		for (int i = 0; i < N; ++i) {
			graph[i] = new Node(i);
		}
		List<Edge> edges = new ArrayList<>(M);
		for (int i = 0; i < M; ++i) {
			tokens = in.readLine().split(" ");
			int a = Integer.parseInt(tokens[0]);
			int b = Integer.parseInt(tokens[1]);
			int c = Integer.parseInt(tokens[2]);
			Edge edge = new Edge(a - 1, b - 1, c - P);
			graph[a - 1].edges.add(edge);
			graph[b - 1].invEdges.add(edge);
			edges.add(edge);
		}
		// 順方向にたどった時の到達するnodesetを取得
		Set<Integer> reachableNodes = new HashSet<>();
		reachableNodes.add(0);
		Deque<Edge> queue = new ArrayDeque<>();
		while (!graph[0].edges.isEmpty()) {
			queue.add(graph[0].edges.poll());
		}
		while (!queue.isEmpty()) {
			Edge edge = queue.poll();
			reachableNodes.add(edge.dst);
			while (!graph[edge.dst].edges.isEmpty()) {
				queue.add(graph[edge.dst].edges.poll());
			}
		}
		Set<Integer> invReachableNodes = new HashSet<>();
		invReachableNodes.add(N - 1);
		queue.clear();
		while (!graph[N - 1].invEdges.isEmpty()) {
			queue.add(graph[N - 1].invEdges.poll());
		}
		while (!queue.isEmpty()) {
			Edge edge = queue.poll();
			invReachableNodes.add(edge.src);
			while (!graph[edge.src].invEdges.isEmpty()) {
				queue.add(graph[edge.src].invEdges.poll());
			}
		}
		// node, edgeの数を絞る
		Set<Integer> useNodes = new HashSet<>();
		for(Integer node: reachableNodes) {
			if(invReachableNodes.contains(node)) {
				useNodes.add(node);
			}
		}
		List<Edge> useEdges = new ArrayList<>();
		for(Edge edge: edges) {
			if(useNodes.contains(edge.src) && useNodes.contains(edge.dst)) {
				useEdges.add(edge);
			}
		}
		
		// 開始ノードの距離は0
		graph[0].dist = 0;
		for (int i = 0; i < useNodes.size(); ++i) {
			for (int j = 0; j < useEdges.size(); ++j) {
				Edge edge = useEdges.get(j);
				if (graph[edge.dst].dist < graph[edge.src].dist + edge.length) {
					graph[edge.dst].dist = graph[edge.src].dist + edge.length;
				}
			}
		}

		// 閉路チェック
		boolean hasNegativeLoop = false;
		for (Edge edge : useEdges) {
			if (graph[edge.src].dist + edge.length > graph[edge.dst].dist) {
				hasNegativeLoop = true;
				break;
			}
		}
		if (hasNegativeLoop) {
			System.out.println("-1");
		} else {
			int result = Math.max(0, graph[graph.length - 1].dist);
			System.out.println(result);
		}
	}
}


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

int main(){
  while(1){
    int N;
    cin >> N ;
    vector<int> a;
    if(N==0){
      break;
    }
    for(int i=0;i<N;i++){
      string str;
      cin >> str;
      a.push_back(str.size());
    }
    for(int i=0;i<N;i++){
      int tanka=0;
      int sum=0;
      for(int j=i;j<N;j++){
        sum+=a[j];
        if(sum==5&&(tanka==0||tanka==2)||sum==7&&(tanka==1||tanka==3||tanka==4)){
          tanka++;
          sum=0;
        }
      }
      if(tanka==5){
        cout << i+1 << endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int n;
string a[2];
map<int,int>mp;
int main(){
	cin>>n;
	for(int i=0;i<2;i++)
		cin>>a[i];
	int j=0,pre=0;
	ll ans=1;
	if(a[0][0]==a[1][0]) ans=3,j=1;
	else ans=6,j=2,pre=1;
	for(;j<n;){
		if(a[0][j]==a[1][j]){
			if(!pre) ans=ans*2%mod;
			j++;
			pre=0;
		} 
		else {
			if(!pre) ans=ans*2%mod;
			else ans=ans*3%mod;
			j+=2;
			pre=1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	ll n , W ;
	cin >> n >> W ;
	ll w[n] , v[n] ;
	for(int i = 0 ; i < n ; i++)
		cin >> w[i] >> v[i] ;
	ll dp[n + 1][W + 1]  ;
	for(int i = 0 ; i <= n ; i++){
		for(int j = 0 ; j <= W ; j++){
			if(i == 0 || j == 0)
				dp[i][j] = 0 ;
			else if(j >= w[i - 1]){
				dp[i][j] = max(dp[i - 1][j - w[i - 1]] + v[i - 1] , dp[i -1][j]) ;
			}
			else
				dp[i][j] = dp[i - 1][j] ;
		}
	}
	cout << dp[n][W] ;
}

Measured memory_bytes: 79232
#include <iostream>
using namespace std;
int main(void){
    
        int A, B, C;
        cin >> A >> B >> C;;

        int ans = 0;
        for(int i = A; i <= B; i++){
            if(C % i == 0) ans++;
        }
        
        cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 3132
import collections
N=int(input())
A=list(map(int,input().split()))
B=collections.Counter(A).most_common()
B.sort(key= lambda x : -x[0])
L=[]
for i in B:
    if i[1]>=4:
        L.append(i[0])
        L.append(i[0])
    elif i[1]>=2:
        L.append(i[0])
    if len(L)==2:
        break
print(L[0]*L[1] if len(L)>=2 else 0)



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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

ll n;
vll l(8);
vll t(3);

ll ans = INF;

vll ptn(8);

void dfs(int index) {
  if (index == n) {
    ll cost = 0;

    vll length(3);
    rep(i, 3) {
      rep(j, n) {
        if (ptn[j] == i) {
          length[i] += l[j];
          cost += 10;
        }
      }
      if (length[i] == 0) {
        goto failed;
      }
      cost += abs(length[i] - t[i]);
    }
    cost -= 30;

    chmin(ans, cost);

  failed:
    return;
  }

  rep(i, 4) {
    ptn[index] = i;
    dfs(index + 1);
  }
}

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

  cin >> n >> t[0] >> t[1] >> t[2];
  rep(i, n) {
    cin >> l[i];
  }

  dfs(0);
  cout << ans << endl;

  return 0;
}


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

#define rep(i, a, b) for (int i = a; i < b; i++)
#define For(i, a, b) for (int i = a; i <= b; i++)

using namespace std;

const int mod = 1000000000 + 7;
const int MAXN = 100000 + 5;
char s[MAXN];
int alphabetCount[26], n;

int main(){
    scanf("%d", &n);
    scanf("%s", s);
    ll ans = 1;
    for (int i = 0; i < n; i++){
        alphabetCount[s[i] - 'a']++;
    }
    for (int i = 0;  i<  26; i++){
        ans = (ans * (alphabetCount[i] + 1)) % mod;
    }
    printf("%lld", ans - 1);
}

Measured memory_bytes: 384
import numpy as np
def main():
  n,m,k=map(int,input().split())
  a=np.array(list(map(int,input().split())))
  b=np.array(list(map(int,input().split())))
  a=np.cumsum(a)
  b=np.cumsum(b)
  k+=1
  a0=np.searchsorted(a,k)
  b0=np.searchsorted(b,k)
  if a0>b0:
    r=a0
  else:
    r=b0
  for i in range(a0):
    k0=k-a[i]
    b0=np.searchsorted(b,k0)
    b0+=i+1
    if b0 > r:
      r=b0
  print(r)
main()

Measured memory_bytes: 53688
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD = 924844033;

int sum(int x, int y) {
    x += y;
    if (x >= MOD)
        x -= MOD;
    return x;
}

void add(int& x, int y) {
    x = sum(x, y);
}

int mul(int x, int y) {
    return (x * 1ll * y) % MOD;
}

int n, k;

long long d[2048][2048][2][2];

long long fact[2048];
long long dd[2048];

int main() {
    cin >> n >> k;
    memset(d, 0, sizeof(d));
    for (int fl0 = 0; fl0 <= 1; ++fl0)
        for (int fl1 = 0; fl1 <= 1; ++fl1)
            for (int l = 0; l <= 1; ++l)
                d[1][l][fl0][fl1] = ((l == 0) ? 1 : (fl0 + fl1));
    
    for (int i = 2; i <= n; ++i) {
        d[i][0][0][0] = d[i][0][0][1] = d[i][0][1][1] = d[i][0][1][0] = 1;
        for (int l = 1; l <= i; ++l)
            for (int fl0 = 0; fl0 <= 1; ++fl0)
                for (int fl1 = 0; fl1 <= 1; ++fl1) {

            d[i][l][fl0][fl1] = (fl0 ? d[i-1][l-1][1][fl1] : 0) + d[i-1][l-1][0][fl1] + d[i-1][l][1][fl1];
			d[i][l][fl0][fl1] %= MOD;
    }
    }
 
    fact[0 ]= 1;
    for (int i = 1; i <= n; ++i)
        fact[i] = (fact[i-1] * i )%MOD;
    
    dd[0] = 1;
    for (int i = 0; i < min(n, 2*k); ++i) {
        int fl0 = (i >= k);
        int ii = i;

        int kol = 1;
        while (ii + 2*k < n) {
            ii += 2*k;
            kol++;
        }

        int fl1 = (ii + k < n);
        
        for (int i = n; i >= 0; --i) {
            for (int l = kol; l > 0; --l)
                if (i + l <= n) {
                    dd[i+l] += mul(dd[i], d[kol][l][fl0][fl1]);
                    dd[i+l] %= MOD;
                }
        }
    }

    long long ans = 0;
    for (int i = 0; i <= n; ++i) {
        long long dans = mul(fact[n-i], dd[i]);
        if (i&1)
            ans = (ans + MOD - dans)%MOD;
        else
            ans = (ans + dans)%MOD;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 131456
#include <iostream>
#include <vector>
using namespace std;
vector<long long> a,b;
int main()
{
	ios_base::sync_with_stdio(false);
	long long val1,val2,N,i;
	cin>>N;
	a.resize(N);
	b.resize(N);
	for(i=0;i<N;i++)
		cin>>a[i];
	for(i=0;i<N;i++)
		cin>>b[i];
	val1=0;
	val2=0;
	for(i=0;i<N;i++)
	{
		if(a[i]<b[i])
		{
			if((b[i]-a[i])%2==0)
			{
				val1+=(b[i]-a[i])/2;
			}
			else
			{
				b[i]++;
				val1+=(b[i]-a[i])/2;
				val2+=1;
			}
		}
		else
		{
			val2+=a[i]-b[i];
		}
	}
	if(val1>=val2)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	return 0;

}


Measured memory_bytes: 384
fun main(args: Array<String>) {
    var (N, D, A) = listOfInt()
    var XH = Array(N) {
        var (x, h)= listOfLong()
        x to (h + A - 1) / A
    }.sortedBy { it.first }
    val q = Queue<Pair<Long, Long>>()
    var ans = 0L
    var num = 0L
    repeat (N) {
        var (x, h) = XH[it]
        while (!q.isEmpty() && q.first().first < x) {
            num -= q.dequeue()!!.second
        }
        h -= num
        if (h > 0) {
            ans += h
            num += h
            q.enqueue(x + D * 2 to h)
        }
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)
fun listOfInt() = listOfString().map(String::toInt)
class Queue<T> {
    val elements = mutableListOf<T>()
    fun isEmpty() = elements.isEmpty()
    fun first() = elements[0]
    fun enqueue(item: T) = elements.add(item)
    fun dequeue() = if (!isEmpty()) elements.removeAt(0) else null
}

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

using namespace std;

typedef long long  ll;

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

    string s;
    cin >> s;

    stack<int> pos;
    stack<pair<int, int>> area;
    for (int i = 0, n = s.size(); i < n; ++i) {
        if (s[i] == '\\')
            pos.push(i);
        else if (s[i] == '/' && !pos.empty()) {
            int idx = pos.top(); pos.pop();
            int num = i - idx;

            while (!area.empty()) {
                auto now = area.top();
                if (now.first < idx)
                    break;
                area.pop();
                num += now.second;
            }

            area.push(make_pair(idx, num));
        }
    }


    int sum = 0;
    vector<int> L;
    while (!area.empty()) {
        auto now = area.top(); area.pop();
        sum += now.second;
        L.emplace_back(now.second);
    }

    // Output
    cout << sum << "\n";
    cout << L.size();
    for (int i = L.size() - 1; i >= 0; --i)
        cout << " " << L[i];
    cout << "\n";

    return 0;
}

Measured memory_bytes: 1324
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    string s; cin>>s;
    int n=s.size();
    int ans=1e9;
    for(int p=0; p<2; p++){
        for(int q=0; q<2; q++){
            int l=0, r=0, sl=0, sr=0;
            int d=0, L=-p, R=q;
            for(int i=0; i<n; i++){
                if(s[i]=='0'){
                    l--; r--;
                    sl--; sr--;
                    if(~(i+p)&1){
                        sl=max(sl, 1);
                    }
                }else if(s[i]=='1'){
                    l++; r++;
                    sl++; sr++;
                    if(~(i+q)&1){
                        sr=min(sr, -1);
                    }
                }else{
                    l--; r++;
                    sl--; sr++;
                    if(~(i+p)&1){
                        sl=max(sl, 1);
                    }
                    if(~(i+q)&1){
                        sr=min(sr, -1);
                    }
                }
                d=max(d, sl-sr);
                L=min(L, r-sl);
                R=max(R, l-sr);
            }
            ans=min(ans, max(d, R-L));
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5332
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 998244353; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;

long long gcd(long long x, long long y) {
	long long m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
void solve() {
	int K, X; cin >> K >> X;
	if (500 * K >= X)print("Yes");
	else print("No");
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




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

int sumDigits(int n) {
  int sum = 0;
  while (n > 1) {
    sum += n % 10;
    n /= 10;
  }
  sum += n;
  return sum;
}

int main(int argc, char *argv[]) {
  int N;
  std::cin >> N;
  int min = 1 << 20;
  for (int i = 1; i < N; ++i) {
    min = std::min(min, sumDigits(i) + sumDigits(N - i));
  }
  std::cout << min << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>
#include <stack>

using namespace std;

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

const ll mod = 1e9 + 7;
const ll mmod = 998244353;

vector<ll> dx = {1, -1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

vector<vector<ll>> g;
vector<vector<ll>> par;
vector<vector<ll>> dp;
vector<ll> d;


int main() {

    cin.tie(0);
    ios_base::sync_with_stdio(0);
    
    vector<ll> x(5);
    
    for (int i = 0; i < 5; ++i)
    {
        cin >> x[i];
    }
    for (int i = 0; i < 5; ++i)
    {
        if (x[i] == 0)
        {
            cout << i + 1 << endl;
            return 0;
        }
    }
    
    return 0;
}

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

namespace d
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());

            var l = new List<Tuple<long,long>>();
            for(var i = 0; i < n; i++){
                var _ = Console.ReadLine().Split();
                var a = long.Parse(_[0]);
                var b = long.Parse(_[1]);

                l.Add(Tuple.Create(a, b));
            }

            var flag = true;
            var count = 0L;
            foreach(var item in l.OrderBy(i => i.Item2)){
                count += item.Item1;
                if(count > item.Item2){
                    flag = false;
                    break;
                }
            }

            Console.WriteLine(flag ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 31272
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1e9+7;
const int INF=1e9;
const ll LINF=(ll)1e18;

int main(){
    int k,q;
    cin>>k>>q;
    ll d[k];
    for(int i=0;i<k;++i){
        cin>>d[i];
    }
    for(int i=0;i<q;++i){
        ll n,x,m;
        cin>>n>>x>>m;
        ll t=0;
        for(int j=0;j<k;++j){
            t+=(d[j]%m);
            if(d[j]%m==0){
                t+=m;
            }
        }
        ll ans=x%m;
        ans+=t*((n-1)/k);
        ll rest=n-1-(n-1)/k*k;
        for(int j=0;j<rest;++j){
            ans+=(d[j]%m);
            if(d[j]%m==0){
                ans+=m;
            }
        }
        ans=ans/m;
        cout<<n-1-ans<<endl;
    }
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b==c)cout <<"Yes";
    else if(b+c==a)cout <<"Yes";
    else if(c+a==b)cout <<"Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define rep2(i,k,n) for(int i=k;i>=n;i--)
using namespace std;
const int N=2e5+7;
int n,a[N],l[N],r[N],stk[N],top;
long long ans=0;
int main(){
	scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
	top=0;
	rep(i,1,n){
		while(top && a[stk[top]] > a[i])top--;
		l[i]=stk[top]+1;
		stk[++top]=i;
	}
	top=0;
	rep2(i,n,1){
		while(top && a[stk[top]] > a[i])top--;
		if(!top)r[i]=n;
		else r[i]=stk[top]-1;
		stk[++top]=i;
	}
	rep(i,1,n){
		ans+=1ll*(i-l[i]+1)*(r[i]-i+1)*a[i];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>
#include<numeric>

using namespace std;

int n,x,y;
int s;

int main(){
  cin>>x;
  int cnt=0;
  for(int i=1;i<=x;i++){
      if(i%2){
        int tmp = 0;
        for(int j=1;j<=i;j++){
          if((i%j) == 0) tmp++;
        }
        if(tmp == 8) cnt++;

      }
  }
  cout<<cnt<<endl;
  return 0;
}


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

using namespace std;
#define local
#ifdef local

template<class T>
void _E(T x) { cerr << x; }

void _E(double x) { cerr << fixed << setprecision(6) << x; }

void _E(string s) { cerr << "\"" << s << "\""; }

template<class A, class B>
void _E(pair<A, B> x) {
    cerr << '(';
    _E(x.first);
    cerr << ", ";
    _E(x.second);
    cerr << ")";
}

template<class T>
void _E(vector<T> x) {
    cerr << "[";
    for (auto it = x.begin(); it != x.end(); ++it) {
        if (it != x.begin()) cerr << ", ";
        _E(*it);
    }
    cerr << "]";
}

void ERR() {}

template<class A, class... B>
void ERR(A x, B... y) {
    _E(x);
    cerr << (sizeof...(y) ? ", " : " ");
    ERR(y...);
}

#define debug(x...) do { cerr << "{ "#x" } -> { "; ERR(x); cerr << "}" << endl; } while(false)
#else
#define debug(...) 114514.1919810
#endif
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f3f3f
#define ll long long
#define db long double
#define eps 1e-3
#define bin(x) cerr << bitset<10>(x) << endl
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define endl "\n"
const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 10;
const db pi = acos(-1.0);

ll qpow(ll a, ll b) {
    ll ret = 1;
    for (; b; a = a * a % mod, b >>= 1) {
        if (b & 1) {
            ret = ret * a % mod;
        }
    }
    return ret;
}

vector<ll> f(maxn), invf(maxn);

ll inv(ll a) {
    return qpow(a, mod - 2);
}

void prework() {
    f[0] = 1;
    _rep(i, 1, maxn - 1) {
        f[i] = f[i - 1] * i % mod;
    }
    invf[maxn - 1] = qpow(f[maxn - 1], mod - 2);
    for (ll i = maxn - 2; i >= 0; i--) {
        invf[i] = invf[i + 1] * (i + 1) % mod;
    }
}

ll C(ll n, ll m) {
    if (n > m || m < 0)return 0;
    if (n == 0 || m == n) return 1;
    ll res = (f[m] * invf[m - n] % mod * invf[n]) % mod;
    return res;
}

vector<ll> a;
ll n;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll add = 0;
    a.resize(n + 1);
    ll mx = 0;
    _rep(i, 1, n) {
        cin >> a[i];
        mx = max(mx, a[i]);
        if (i >= 2 && a[i] - mx < 0) {
            add += (mx - a[i]);
        }
    }
    cout << add << endl;


}

Measured memory_bytes: 7860
#include<bits/stdc++.h>
using namespace std;
int s[26],t[26];
int main()
{
    string a,b;
    cin >> a >> b;
    for(int i=0;i<a.size();i++){
        s[a[i]-'a']++;
    }
    sort(s,s+26);
    for(int i=0;i<b.size();i++){
        t[b[i]-'a']++;
    }
    sort(t,t+26);
    for(int i=0;i<26;i++){
        if(s[i]!=t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
set<int> st;
vi a(3);
rep(i,3) cin >> a[i], st.insert(a[i]);
cout << SZ(st) << endl;
return 0;
}

Measured memory_bytes: 256
let buf = '';
process.stdin.setEncoding('utf8');
process.stdin.on('readable', () => {
  let s = process.stdin.read();
  if (s !== null) { buf += s.toString(); }
});
process.stdin.on('end', () => {
  let lines = buf.trim().split("\n");
  let [h, w] = lines[0].split(' ').map( (x) => parseInt(x) );
  let field: number[][] = [];
  for (let i = 0; i < h; i++) {
    field[i] = [];
    for (let j = 0; j < w; j++) {
      field[i][j] = 0;
    }
  }
  for (let i = 0; i < h; i++) {
    for (let j = 0; j < w; j++) {
      if (lines[i+1][j] === '#') {
        field[i][j] = -99;
        if (i   > 0) { field[i-1][j]++; }
        if (i+1 < h) { field[i+1][j]++; }
        if (j   > 0) { field[i][j-1]++; }
        if (j+1 < w) { field[i][j+1]++; }
        if (i   > 0 && j   > 0) { field[i-1][j-1]++; }
        if (i   > 0 && j+1 < w) { field[i-1][j+1]++; }
        if (i+1 < h && j   > 0) { field[i+1][j-1]++; }
        if (i+1 < h && j+1 < w) { field[i+1][j+1]++; }
      }
    }
  }
  for (let i = 0; i < h; i++) {
    let s = '';
    for (let j = 0; j < w; j++) {
      if (field[i][j] < 0) {
        s += '#';
      } else {
        s += field[i][j].toString();
      }
    }
    console.log(s);
  }
});

Measured memory_bytes: 7500
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();

        int out = 0;
        if(k<=a) {
            out += k;
        } else if (a < k && k <= a + b){
            out += a;
        } else {
            out += a - (k - a - b);
        }

        System.out.println(out);
        sc.close();
        
    }
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 3e3+23;

int n;
long long a[N], dp[N][N];

long long rek(int l, int r) {
  if (l > r) {
    return 0;
  }
  long long &ret = dp[l][r];
  if (ret != -1) return ret;
  int taken = l+(n-r-1);
  if (taken&1) {
    ret = min(rek(l+1, r)-a[l], rek(l, r-1)-a[r]);
  } else {
    ret = max(a[l]+rek(l+1, r), a[r]+rek(l, r-1));
  }
  return ret;
}

void solve() {
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", a+i);
  printf("%lld", rek(0, n-1));
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 75368
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define PI pair<int , int>
#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

//#define max(a,b) a>b?a:b
//#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int sum() { return 0; }

template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }



const int INF = 1e7+5;
int dx[] = {1,-1,0,0};
int dy[] = {0, 0,1,-1};
int vis[1003][1003];
int d[1003][1003];
char grid[1003][1003];
int h,w;
bool is_valid(int x,int y){
	return (x>=0 && x<h && y>=0 && y<w);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cin>>h>>w;
	int sx,sy,fx,fy;
	cin>>sx>>sy>>fx>>fy;
	sx--;sy--;
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			cin>>grid[i][j];
		}
	}
	REP(i,h)REP(j,w) d[i][j] = INF;
	deque<pair<int,int> >dq;
	dq.push_back({sx,sy});
	d[sx][sy] = 0;

	while (!dq.empty())
	{
		PI p = dq.front();
		int x = p.first;
		int y = p.second;
		dq.pop_front();
		if(vis[x][y] == 1)continue;
		for (int i = 0; i < 4; ++i)
		{
			int tx = x+dx[i];
			int ty = y+dy[i];

			if(is_valid(tx,ty) && grid[tx][ty] == '.' && d[tx][ty] > d[x][y]){
				d[tx][ty] = d[x][y];
				dq.push_front({tx,ty});
			}
		}

		for (int i = -2; i <= 2; ++i)
		{
			for (int j = -2; j <= 2; ++j)
			{
				int tx = x+i;
				int ty = y+j;
				if(is_valid(tx,ty) && grid[tx][ty] == '.' && d[tx][ty] > d[x][y]+1){
					d[tx][ty] = d[x][y]+1;
					dq.push_back({tx,ty});
				}
			}
		}


	}
	if(d[fx-1][fy-1] != INF) cout<<d[fx-1][fy-1];
	else std::cout << -1 << "\n";

	return 0;
}


Measured memory_bytes: 8656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  int l = 0, r = 1e9;
  while (r - l > 1){
    int x = (l + r) / 2;
    auto ok = [&](int x) {
      ll num = 0;
      rep(i, n) num += (a[i] - 1) / x;
      return num <= k;
    };
    if(ok(x)) r = x;
    else l = x;
  }
  cout << r << endl;
}

Measured memory_bytes: 4784
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

template<class T, class F>
struct SegTree {
  size_t n;
  vector<T> a;
  F f;
  T zero;

  template<class U>
  static U ceil2(U x) {
    U y = 1;
    for (; y < x; y <<= 1);
    return y;
  }
  SegTree(size_t n, T zero, F f) 
    : n(ceil2(n)), a(2 * ceil2(n), zero), f(f), zero(zero) {}
  void set(size_t i, T x) {
    i += n;
    a[i] = x;
    while (i >>= 1) a[i] = f(a[2 * i], a[2 * i + 1]);
  }
  // [l, r)
  T seg(size_t l, size_t r) const {
    T x = zero, y = zero;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) {
        x = f(x, a[l]);
        ++l;
      }
      if (r & 1) {
        --r;
        y = f(a[r], y);
      }
    }
    return f(x, y);
  }
  T operator[](size_t i) const { return a[n + i]; }
};

struct R {
    i64 x, d;
};
const i64 mod = 998244353;
int main() {
    i64 n;
    cin >> n;
    vector<R> r(n);
    for (int i = 0; i < n; ++i) {
        cin >> r[i].x >> r[i].d;
    }
    sort(begin(r), end(r), [](R a, R b) {
        return a.x < b.x;
    });
    vector<i64> dp(n + 1);
    auto cmax = [](int x, int y) { return max(x, y); };
    vector<i64> x(n), d(n);
    for (int i = 0; i < n; ++i) {
        x[i] = r[i].x;
        d[i] = r[i].d;
    }
    dp[n] = 1;
    SegTree<int, decltype(cmax)> st(n + 1, 0, cmax);
    for (int i = n - 1; i >= 0; --i) {
        int j = lower_bound(begin(x), end(x), x[i] + r[i].d) - begin(x);
        int k = max(st.seg(i, j), j);
        dp[i] = dp[i + 1] + dp[k];
        dp[i] %= mod;
        st.set(i, k);
    }
    cout << dp[0] << endl;
    return 0;
}

Measured memory_bytes: 10112
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int a = sc.nextInt();
    static int b = sc.nextInt();

    public static void main(String[] args) {
        if (a > b)
            System.out.println("a" + " > " + "b");
        else if (a < b)
            System.out.println("a" + " < " + "b");
        else
            System.out.println("a" + " == " + "b");
    }
}



Measured memory_bytes: 26272
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define line cout << endl
using namespace std;
int a, b, c, k; 
int main() {
	cin >> a >> b >> c >> k;
	if (k <= a) cout << k;
	else if (k <= a + b) cout << a;
	else cout << a - (k - (a + b));
	line;
	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>

int solve(int,int);

int A[10000];
int n;

int main()
{
    int q,i,judge=0;
    int m[10000];

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

    scanf("%d",&q);
    for(i=0;i<q;i++)
    {
        scanf("%d",&m[i]);
        judge=solve(0,m[i]);
        if(judge == 1)
        {
            printf("yes\n");
        }
        else printf("no\n");
    }

    return 0;
}

int solve(i,m)
{
    int res;
    if(m==0)return 1;
    if(i>=n)return 0;
    res = solve(i+1,m)||solve(i+1,m-A[i]);
    return res;
}


Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int main() {
	unsigned long long d, n;
	cin >> d >> n;
	
	if (n == 100)
		++n;
	
	unsigned long long result = n;
	for (unsigned long long i = 0; i < d; ++i) {
		result *= 100;
	}
	
	cout << result << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);

using namespace std;

int major(vector<int> tmp){
	sort(ALL(tmp));
	int size = tmp.size()/2+1,ans=0;
	rep(i,size){
		ans+=tmp[i];
	}
	return ans;
}

int convert(int l,int r,string str){
	return stoi(str.substr(l,r-1));
}

//?????????????????????
int parse(int l,int r,string str){
	if(isdigit(str[l])) return convert(l,r,str)/2+1;
	stack<int> num_s;
	vector<int> tmp;
	for(int i=l;i<r;i++){
		if(str[i]=='['){ 
			num_s.push(i);	
		}else if(str[i]==']'){
			if(num_s.size()>1){
				num_s.pop();
				continue;
			}
			int next_l = num_s.top()+1;
			num_s.pop();
			tmp.push_back(parse(next_l,i,str));
		}
	}

	return major(tmp);
}

int main(){
	int n;
	string str;
	cin >> n;
	rep(i,n){
		cin >> str;
		cout << parse(1,str.size()-1,str) << endl;
	}

}

Measured memory_bytes: 1356
MOD = 10**9 + 7

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

path = [-1] * (N+1)
path[0] = 1
path[1] = 1
for a in A:
    path[a] = 0
for i, p in enumerate(path):
    if i < 2:
        continue
    if p == -1:
        path[i] = (path[i-1] + path[i-2]) % MOD
print(path[-1])


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	cin >> s;
	
	int zero_cnt = 0, one_cnt = 0;
	rep(i, s.length()) {
		if (s[i] == '0') zero_cnt++;
		else one_cnt++;
	}
	
	cout << min(zero_cnt, one_cnt) * 2 << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX 100000

int main(void)
{
    int i, n;
    long max, min, sum = 0;
    long temp;
    char *tok;
    char str[MAX];

    scanf("%d%*c", &n);
    fgets(str,MAX,stdin);
//    printf("%s\n", str);

    tok = strtok(str, " ");
    temp = atol(tok);
//    printf("%ld\n", temp);
    max = temp;
    min = temp;
    sum += temp;

    for(i=1;i<n;i++) {
        tok = strtok(NULL, " ");
        temp = atol(tok);
//        printf("%ld\n", temp);
        if(temp > max) max = temp;
        if(temp < min) min = temp;
        sum += temp;
    }

    printf("%ld %ld %ld\n", min, max, sum);

    return 0;
}

Measured memory_bytes: 688
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int[] h = new int[n];
        for (int i=0; i < n; i++)
            h[i] = in.nextInt();

        int highest = h[0];
        boolean ans = true;
        for (int i=1; i < n; i++) {
            if (highest-1 > h[i]) {
                ans = false;
                break;
            }
            highest = Math.max(highest, h[i]);
        }
        out.println(ans ? "Yes" : "No");
    }

}


Measured memory_bytes: 49516
#include<iostream>

using namespace std;

int main()
{
    int a,b;

    cin >> a  >>  b;
    if(a>b)
    {
        cout << "a > b" << endl;
    }
    else if(a<b)
    {
        cout << "a < b" << endl;
    }
    else
    {
        cout << "a == b" << endl;
    }
    
}


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

int a,b,c;

int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if (a==b&&a==c) puts("No");
	else if (a!=b&&a!=c&&b!=c) puts("No");
	else puts("Yes");
	
	return 0;
}

Measured memory_bytes: 256
def examB():
    N = I()
    a = LI(); a.sort()
    ans = a[-1]-a[0]
    print(ans)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 38384
n,m,q = map(int,input().split())

a=[]
b=[]
c=[]
d=[]

max_= 0

def dfs(A):
  global max_
  ans = 0
  last = A[-1]
  if len(A) == n+1:
    for i in range(q):
      if A[b[i]]-A[a[i]] == c[i]:
        ans += d[i]
    max_ = max(max_, ans)
    return
  for i in range(last, m+1):
    dfs(A+[i])  


for i in range(q):
  aa,bb,cc,dd = map(int, input().split())
  a.append(aa)
  b.append(bb)
  c.append(cc)
  d.append(dd)
  
dfs([1])

print(max_)





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

int main(int argc, char *argv[])
{
    char deck[201];
    int m, h;
    while (true)
    {
        scanf("%s", deck);
        if (strcmp(deck, "-") == 0)
        {
            break;
        }
        int length = strlen(deck);
     //   char *temp = deck;

        scanf("%d", &m);
        int total = 0;
        for (int i = 0; i < m; i++)
        {
            scanf("%d", &h);
            total += h;
        }

        int t = total % length;
        for (int i = t; i < length; i++)
        {
            printf("%c", deck[i]);
        }
        for (int j = 0; j < t; j++)
        {
            printf("%c", deck[j]);
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 3148
#include<iostream>
#include<string>
using namespace std;
main(){
 for(int n,r,p,c;cin>>n>>r;){
  if(!n&&!r)break;
  string d;
  for(int i=0;i<n;i++)d=char(48+i)+d;
  for(int i=0;i<r;i++){cin>>p>>c;
   d = d.substr(p-1,c)+d.substr(0,p-1)+d.substr(p+c-1);}
  cout<<(d[0]-47)<<endl;
 }
}

Measured memory_bytes: 0
from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


N = int(input())
A = list(map(int, input().split()))
LCM = A[0]
for i in range(1, N):
    LCM = lcm(LCM, A[i])
print(sum((LCM - 1) % a for a in A))


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

void solve() {
	int n, m;
	cin>>n>>m;
	if (n<=m) cout<<"unsafe\n";
	else cout<<"safe\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#endif
	solve();
	return 0;
}

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

int main(){
	int M; cin >> M;
	ll sum = 0;
	ll s = 0;
	for(int i=0; i<M; i++){
		ll d, c; cin >> d >> c;
		sum += c;
		s += d*c;
	}
	if(s%9 == 0){
		cout << sum + (s-1)/9 - 1 << endl;
	}else{
	cout << sum + (s/9) - 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int a, b;
    cin >> a >> b;

    for  (int i=0; i<1e6; i++) {
        if ((int)(i*0.08) == a && (int)(i*0.1) == b) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << "-1\n";
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

struct UF {
  vector<int> parent_, rank_;
  UF(int N) : parent_(N + 5), rank_(N + 5, 1) {
    for (int i = 0; i < N + 5; ++i) {
      parent_[i] = i;
    }
  }

  int find_set(int x) {
    if (x != parent_[x]) {
      parent_[x] = find_set(parent_[x]);
    }
    return parent_[x];
  }

  void unite(int x, int y) {
    int px = find_set(x), py = find_set(y);
    if (px == py) { return; }
    if (rank_[px] < rank_[py]) { swap(px, py); }
    parent_[py] = px;
    if (rank_[px] == rank_[py]) { ++rank_[px]; }
  }

  bool is_connected(int x, int y) {
    return find_set(x) == find_set(y);
  }

};

int main()
{
  int N, K, L; scanf("%d %d %d", &N, &K, &L);
  int a, b;
  UF uf1(N + 5), uf2(N + 5);
  for (int i = 0; i < K; ++i) {
    scanf("%d %d", &a, &b);
    uf1.unite(a, b);
  }
  for (int i = 0; i < L; ++i) {
    scanf("%d %d", &a, &b);
    uf2.unite(a, b);
  }
  vector<int> road(N + 5), rail(N + 5);
  vector<pair<int, int>> v;
  for (int i = 1; i <= N; ++i) {
    road[i] = uf1.find_set(i);
    rail[i] = uf2.find_set(i);
    v.push_back(make_pair(road[i], rail[i]));
  }
  sort(v.begin(), v.end());

  for (int i = 1; i <= N; ++i) {
    pair<int, int> p = make_pair(road[i], rail[i]);
    int ans = distance(lower_bound(v.begin(), v.end(), p),
                       upper_bound(v.begin(), v.end(), p));
    if (i == 1) { printf("%d", ans); }
    else { printf(" %d", ans); }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 7028
#include<bits/stdc++.h>
#define ii pair<int,int>
#define ll long long

using namespace std;

int main(){
    string a;cin>>a;
    for(int i = 1;i<=(int)a.size();i++){
        if(i%2==1 && a[i-1] == 'L'){
            cout<<"No";
            return 0;
        }
        else if(i%2==0&& a[i-1]=='R'){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
using namespace std;
 
int main() {
    
    int X,Y;
    bool flg=false;
    cin>>X>>Y;
    for(int i=0;i<=X;i++)
    {
      
      int nokori=Y-(i*2);
      //cout<<i<<"ぴきのつる"<<endl;
      //cout<<nokori<<endl;
      //亀いる
      if(((nokori%4)==0)&&(((nokori/4)+i)==X))
      {
        flg=true;
      }
      //亀いない
      else if((nokori==0)&&((nokori+i)==X))
      {
        flg=true;
      }
      
    }
    if(flg)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3644