akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    ll x,y;
    cin >> x >> y;
    ll num = INF;
    ll a = y - x;
    if(a>=0) num = min(num,a);
    ll b = y + x + 1;
    if(b>=0) num = min(num,b);
    ll c = - y - x + 1;
    if(c>=0) num = min(num,c);
    ll d = -y + x + 2;
    if(d>=0) num = min(num,d);
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int MOD = 1e9+7;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

    int N; cin >> N;
    map<string,int> m;
    rep(i,N){
        string s;
        cin >> s;
        sort(all(s));
        m[s]++;
    }
    int ans=0;
    for(auto p:m){
        ans+=p.se*(p.se-1)/2;
    }
    cout << ans << endl;

}


Measured memory_bytes: 11264
# coding: utf-8

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

boxes = [0] * n

for i in range(n):
    x = n - i - 1
    if A[x]:
        if sum(boxes[k] for k in range(x, n, x+1)) % 2 == 0:
            boxes[x] = 1
    else:
        if sum(boxes[k] for k in range(x, n, x+1)) % 2 == 1:
            boxes[x] = 1
print(boxes.count(1))
if sum(boxes):
    print(' '.join(map(str, (i+1 for i, b in enumerate(boxes) if b == 1))))

Measured memory_bytes: 14776
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b=s.nextInt(),c=s.nextInt();
        if(a+b+c>=22) System.out.println("bust");
        else System.out.println("win");

    }




}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var hatake = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            Console.WriteLine(hatake[0] - hatake[1] + 1);
            
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>

int main(void) {
	char word[256];
	scanf("%s", word);
	int m=strlen(word);
	char sentence[256]={};
	char end[256];
	strcpy(end, "END_OF_TEXT");
	int n, k;
	int i=0;
	int j;
	while (strcmp(sentence, end)!=0)
	{
		scanf("%s", sentence);
		k=strlen(sentence);
		n=0;
		for (j=0; j<m; j++)
		{
			if (word[j]==sentence[j] || word[j]==sentence[j]+32 || word[j]==sentence[j]-32)
			{
				n+=1;
			}
		}
		if (m==k && m==n) i+=1;
		
	}
	printf("%d\n", i);
	return 0;
}

Measured memory_bytes: 548
#define _USE_MATH_DEFINES // M_PIなどの定義を使用するのに必要
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>

using namespace std;
int64_t table[200005] = {0};

int main()
{
  int64_t N;
  vector<int64_t> A;

  cin >> N;
  A.resize(N);
  for (int64_t i = 0; i < N; i++) {
    cin >> A[i];
  }

  // int64_t ans = 0;
  // for (int64_t i = 0; i < N - 1; i++) {
  //   for (int64_t k = i + 1; k < N; k++) {
  //     if (k - i == A[i] + A[k]) {
  //       ans++;
  //     }
  //   }
  // }

  int64_t ans = 0;
  for (int64_t i = 0; i < N; i++) {
    if (i - A[i] > 0) {
      ans += table[i - A[i]];
    }
    if (i + A[i] < N) {
      table[i + A[i]]++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6432
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>

int main(){

  long long int a, b;

  scanf("%lld%lld", &a, &b);

  if(a < b){
    for(long long int i = 0; i < b; i++){
      std::cout << a;
    }std::cout << std::endl;
  }
  else{
    for(long long int j = 0; j < a; j++){
      std::cout << b;
    }std::cout << std::endl;
  }

  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pll = pair<ll, ll>;

struct BiMatch {
  int L, R;
  vector<vector<int>> G;
  vector<int> match, level;

  BiMatch() {}
  BiMatch(int L, int R) : L(L), R(R), G(L+R), match(L+R, -1), level(L+R) {}

  void add_edge(int u, int v) {
    G[u].emplace_back(v+L);
    G[v+L].emplace_back(u);
  }

  bool bfs() {
    fill(level.begin(), level.end(), -1);
    queue<int> q;
    for (int i = 0; i < L; i++) {
      if (match[i] < 0) {
        level[i] = 0;
        q.emplace(i);
      }
    }
    bool found = false;
    while (!q.empty()) {
      int v=q.front(); q.pop();
      for (int u:G[v]) {
        if (~level[u]) continue;
        level[u] = level[v] + 1;
        int w = match[u];
        if (w == -1) {
          found = true;
          continue;
        }
        if (~level[w]) continue;
        level[w] = level[u] + 1;
        q.emplace(w);
      }
    }
    return found;
  }
  bool dfs(int v) {
    for (int u: G[v]) {
      if (level[v] + 1 != level[u]) continue;
      level[u] = -1;
      int w = match[u];
      if (w < 0 || dfs(w)) {
        match[v] = u;
        match[u] = v;
        level[v] = -1;
        return true;
      }
    }
    level[v] = -1;
    return false;
  }

  int build() {
    int res = 0;
    while (bfs())
      for(int i = 0; i < L; i++)
        if (match[i] < 0 && dfs(i))
          res++;
    return res;
  }
};

struct UnionFind {
  vector<int> par, s;
  UnionFind(int n = 2e5) { init(n); }
  void init(int n) {
    s.assign(n, 0); par.resize(n);
    iota(par.begin(), par.end(), 0);
  }
  int find(int x) {
    if (par[x] == x) return x;
    return par[x] = find(par[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
      s[x] += 1;
      return false;
    }
    if (s[x] < s[y]) par[x] = y, s[y] = s[x] + s[y] + 1;
    else par[y] = x, s[x] = s[x] + s[y] + 1;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return s[find(x)]; }
};

signed main() {
  ll N, M;
  cin >> N >> M;
  vector<pll> p(M);
  UnionFind uf(2*N);
  BiMatch bm(N, N);
  for (auto &x : p) {
    cin >> x.first >> x.second;
    x.first--; x.second--;
  }
  ll res_max = 0, res_min = 0;
  for (auto x : p) {
    uf.unite(x.first, x.second+N);
    bm.add_edge(x.first, x.second);
  }
  for (int i = 0; i < 2*N; i++) {
    if (uf.size(i) > 0 && uf.find(i) == i)
      res_max += uf.size(i) - 1;
  }
  res_min = M - bm.build();
  cout << res_min << " " << res_max << endl;
  return 0;
}


Measured memory_bytes: 3272
package main

import(
	"fmt"
)

func isHard(s string)bool{
	for i:=0;i<len(s)-1;i++{
		if s[i]==s[i+1]{
			return true
		}
	}
	return false
}

func main(){
	var(
		s string
	)
	fmt.Scanln(&s)
	ans:=""
	if isHard(s){
		ans="Bad"
	} else{
		ans="Good"
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 998244353;
const int N = 2e5 + 5;

int i, j, n, k, l[N], r[N], dp[N], st[4 * N];

void build(int v, int tl, int tr)
{
    if (tl == tr)
    {
        st[v] = dp[tl];
        return;
    }
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm);
    build(2 * v + 1, tm + 1, tr);
    st[v] = (st[2 * v] + st[2 * v + 1]) % mod;
}

int query(int v, int tl, int tr, int l, int r)
{
    if (tr < l || tl > r)
        return 0;
    if (l <= tl && tr <= r)
        return st[v];
    int tm = (tl + tr) / 2;
    int q1 = query(2 * v, tl, tm, l, r);
    int q2 = query(2 * v + 1, tm + 1, tr, l, r);
    return (q1 + q2) % mod;
}

void update(int v, int tl, int tr, int pos, int val)
{
    if (tl > pos || tr < pos)
        return;
    if (tl == tr)
    {
        st[v] = val;
        return;
    }
    int tm = (tl + tr) / 2;
    update(2 * v, tl, tm, pos, val);
    update(2 * v + 1, tm + 1, tr, pos, val);
    st[v] = (st[2 * v] + st[2 * v + 1]) % mod;
}

void solve()
{
    cin >> n >> k;
    for (i = 1; i <= k; i++)
    {
        cin >> l[i] >> r[i];
    }
    dp[0] = 0;
    dp[1] = 1;
    build(1, 1, n);
    for (i = 2; i <= n; i++)
    {
        for (j = 1; j <= k; j++)
        {
            int x = max(0LL, i - l[j]), y = max(0LL, i - r[j]);
            dp[i] += query(1, 1, n, y, x);
            dp[i] %= mod;
        }
        update(1, 1, n, i, dp[i]);
    }
    cout << dp[n] << endl;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fastio;
    int t;
    //cin >> t;
    t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 9364
#include<bits/stdc++.h>
using namespace std;
const int INF=2E5;
typedef pair<int,int> Pair;

int main(){
    int N;
    map<int,int> mp;
    int tmp;
    cin >> N;
    int cnt=0;
    for(int i=0;i<N;i++){
        cin >> tmp;
        mp[tmp]++;
        cnt++;
        if(mp[tmp]==tmp){
            cnt-=tmp;
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int N, K;
int x[55], y[55];
int nx[55], ny[55];
long long res;

int suc(int x1, int x2, int y1, int y2)
{
	int i;
	int cnt = 0;
	for(i=0; i<N; i++){
		if(x[i]>=nx[x1] && x[i]<=nx[x2] && y[i]>=ny[y1] && y[i]<=ny[y2])
			cnt ++;
	}
	if(cnt >= K)
		return 1;
	else
		return 0;
}

void solve()
{
	int i, j, k, l;
	res = -1;
	for(i=0; i<N; i++)
		nx[i] = x[i];
	sort(nx, nx+N);
	for(i=0; i<N; i++)
		ny[i] = y[i];
	sort(ny, ny+N);
	for(i=0; i<N; i++){
		for(j=i+1; j<N; j++){
			for(k=0; k<N; k++){
				for(l=k+1; l<N; l++){
					if(suc(i, j, k, l) == 1){
						if(res==-1 || res>1ll*(nx[j]-nx[i])*(ny[l]-ny[k]) )
							res = 1ll*(nx[j]-nx[i])*(ny[l]-ny[k]);
					}
				}
			}
		}
	}
	printf("%lld\n", res);
}

int main()
{
	int i;
	scanf("%d%d", &N, &K);
	for(i=0; i<N; i++){
		scanf("%d%d", &x[i], &y[i]);
	}
	solve();
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    llong pos, sum;
    Vi vi;

    signed call_of_Cthulhu( signed datum ) {

        llong n, t;
        read n >> t;
        for ( int i = 0; i < n; i++ ) {
            int a;
            read a;
            vi.bash(a);
        }
        int sta = vi[0];
        int end = sta+t;
        for ( int i = 1; i < n; i++ ) {
            if ( vi[i] <= end ) {
                end = vi[i]+t;
            }
            else {
                sum += end-sta;
                sta = vi[i];
                end = sta+t;
            }
        }
        echo ( sum+end-sta ) fin;



        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

#include <bits/stdc++.h>
#define rep(i,a,n) for(ll i = a;i < n;i++)
typedef long long ll;
using namespace std;

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

    rep(i,0,9){
        if(111*(i+1) >= n){
            cout << 111*(i+1) << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3488
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    int a, b, x; cin >> a >> b >> x;
    if(x < a) cout << x % MOD << endl;
    else{
        int ans = (( (x - b) / (a - b)) % MOD) * (b % MOD);
        cout << (ans + x) % MOD << endl;
    }
    return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    ll n, a, b, c, d;
    vector<ll> ans;
    while(q--){
    	cin >> n >> a >> b >> c >> d;
    	set<ll> s;
    	ll num = (n > mod)? INF: d * n;

    	map<ll, ll> mp;
    	mp[n] = 0;
    	s.insert(n);
    	queue<ll> q;
    	q.push(n);
    	while(!q.empty()){
    		ll now = q.front();
    		q.pop();
    		//cout << now << " "<< mp[now] << endl;
    		if(now < mod)num = min(num, mp[now] + d * now);
    		if(d < 1000LL && now < mod * 1000LL)num = min(num, mp[now] + d * now);
    		for(ll i=-4;i<=4;i++){
    			ll m = now + i;
    			if(m <= 0LL) continue;
    			if(m % 2 == 0LL){
    				if(!s.count(m / 2) || mp[m / 2] > mp[now] + d * abs(i) + a){
    					mp[m / 2] = mp[now] + d * abs(i) + a;
    					s.insert(m / 2);
    					q.push(m / 2);
    				}
    			}
    			if(m % 3 == 0LL){
    				if(!s.count(m / 3) || mp[m / 3] > mp[now] + d * abs(i) + b){
    					mp[m / 3] = mp[now] + d * abs(i) + b;
    					s.insert(m / 3);
    					q.push(m / 3);
    				}
    			}
    			if(m % 5 == 0LL){
    				if(!s.count(m / 5) || mp[m / 5] > mp[now] + d * abs(i) + c){
    					mp[m / 5] = mp[now] + d * abs(i) + c;
    					s.insert(m / 5);
    					q.push(m / 5);
    				}
    			}
    		}
    	}
    	if(s.count(1LL)) num = min(num, mp[1LL] + d);
    	ans.pb(num);
    }
    for(auto& i: ans) cout << i << endl;
    return 0;
}


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

#define lli long long int
#define endl "\n"
#define debug(n) cout<<n<<endl
#define debug2(a, b) cout<<a<<" "<<b<<endl;
#define forn(i, in, fin) for(int i = in; i<fin; i++)
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

string s, t;
lli n, q;

vector< vector< lli > > dp(3010, vector<lli>(3010, -1));

lli LCS(lli i, lli j)
{
    if(i >= n || j >=q) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    if(s[i] == t[j])
    {
        return dp[i][j] = LCS(i+1, j+1) + 1;
    }
    return dp[i][j] = max(LCS(i+1, j), LCS(i, j+1));
}

void rec(lli i, lli j, string &word)
{
    if(i >= n || j >=q) return;

    if(s[i] == t[j])
    {
        word.push_back(s[i]);
        rec(i+1, j+1, word);
        return;
    }
    if(dp[i+1][j] > dp[i][j+1])
    {
        rec(i+1, j, word);
    }
    else
    {
        rec(i, j+1, word);
    }
    return;
}

int main()
{
    fastIO();
    cin>>s>>t;
    n = s.length();
    q = t.length();
    string res;
    LCS(0,0);
    //cout << LCS(0,0) <<endl;
    rec(0,0, res);
    cout << res << endl;


    return 0;
}

Measured memory_bytes: 71424
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i,s=0;
	cin>>n;
	int a[n+1];
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		while(a[i]%2==0)
		{
			a[i]/=2;
			s++;
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 384
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;



int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll mi=a*(n-1)+b;
    ll mx=b*(n-1)+a;
    if(a>b){cout<<0<<endl;}
    else if(n==1 && a!=b){
        cout<<0<<endl;
    }
    else{
        cout<<mx-mi+1<<endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    int N; cin >> N;
    int M = 1;
    rep(i,N + 1) {
        if (i*(i + 1)/2 == N) {
            M = -i;
            break;
        } else if (i*(i + 1)/2 > N) {
            M = i;
            break;
        }
    }
    if (M >= 0) {
        int x = M*(M + 1)/2 - N;
        for (int i = 1;i <= M;++i) {
            if (i == x) continue;
            cout << i << '\n';
        }
    } else {
        for (int i = 1;i <= -M;++i) {
            cout << i << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 3560
s=input()
t=input()
s=list(s)
t=list(t)
d=[]
c=0
if len(s)==len(t):
    for j in range(len(t)):
        if s[j]!=t[j]:
            c+=1
    d.append(c)
else:
    for i in range(len(s)-len(t)):
        c=0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                c+=1
        d.append(c)
print(min(d))

Measured memory_bytes: 9072
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, ll num=0){
  if(num == 0) num = (ll)v.size();
  cout << endl; cout << "i=  ";for(ll i=0; i<num; i++) cout << i << "   ";cout << endl;  
  cout << "    ";
  if(is_reverse) for(ll i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<"   ";}
  else for(ll i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<"   ";}
  cout << endl;
}

// template <typename T>
// void print_pairvec(const vector<T> &v, ll num=0){
//   if(num == 0) num = (ll)v.size();
//   cout << endl; for(ll i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
// }
template <typename T>
void print_pairvec(const T &_pair, ll num=0){
  cout << endl; for(pair<ll, int> x: _pair){ cout << x.first << " " << x.second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(ll i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(ll i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(ll j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  int D, T, S;
  cin >> D >> T >> S;
  if(D > T*S) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


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

int main()
{
    int x, y, s;
    int a, b; //税別価格(a <= b)
    int sumx, sumy; //税がx,yの時の合計金額
    //出力すべき最大の合計金額

    while(1)
    {
        cin >> x >> y >> s;
        if ((x == 0) && (y == 0) && (s == 0)) {
            break;
        }
        int max=0;

        for (a = 1; a < s; a++) {
            for (b = a; b < s; b++) {
                sumx = (a*(100+x)/100) + (b*(100+x)/100);
                if (s == sumx) {
                    sumy = (a*(100+y)/100) + (b*(100+y)/100);
                    if (sumy > max) {
                        max = sumy;
                    }
                }
            }
        }
         
        cout << max << endl;
        
    }
    return 0;
}


Measured memory_bytes: 3080
use std::io::*; //Not mine.
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let n: usize = read();
    let m: usize = read();
    let k: i64 = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();
    let b: Vec<i64> = (0..m).map(|_| read()).collect();
    let mut asum: Vec<i64> = vec![0; n + 1];
    let mut bsum: Vec<i64> = vec![0; m + 1];
    for i in 0..n {
        asum[i + 1] = asum[i] + a[i];
    }
    for i in 0..m {
        bsum[i + 1] = bsum[i] + b[i];
    }
    let mut ans = 0;
    for i in 0..n + 1 {
        if asum[i] <= k {
            let mut lb: i64 = -1;
            let mut ub: i64 = (m + 1) as i64;
            while ub - lb > 1 {
                let mid: usize = ((ub + lb) / 2) as usize;
                if asum[i] + bsum[mid] <= k {
                    lb = mid as i64;
                } else {
                    ub = mid as i64;
                }
            }
            ans = std::cmp::max(ans, lb + i as i64);
        }
    }
    println!("{}", ans);
}


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

namespace fastIO {
  #define BUF_SIZE 100000
  // fread -> read
  bool IOerror = 0;
  inline char nc() {
    static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
    if(p1 == pend) {
      p1 = buf;
      pend = buf + fread(buf, 1, BUF_SIZE, stdin);
      if(pend == p1) {
        IOerror = true;
        return -1;
      }
    }
    return *p1++;
  }
  inline bool blank(char ch) {
    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
  }
  inline bool read(auto &x) {   // c++ - 14 supported
    bool ne = false;
    char ch;
    while(blank(ch = nc()));
    if(ch == '-') ne = true, ch = nc();
    if(IOerror) { return false; }
    for(x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0');
    if(ne) x = -x;
    return true;
  }
  #undef BUF_SIZE
};
using namespace fastIO;

using namespace std;
#define mp make_pair
#define pb push_back
#define debug(__, x) cerr << "Case #" << ++__ << ": " << x << endl
#define Debug(__, x, y) cerr << "Case #" << ++__ << ": " << x << " " << y << endl

typedef set<int, greater<int> > gset;
typedef set<int, greater<int> >::iterator gsetit;
typedef multiset<pair<int, int>, greater<pair<int, int> > > gpmset;
typedef multiset<pair<int, int>, greater<pair<int, int> > >::iterator gpmsetit;


int __ = 0;
const int inf = 0x3f3f3f3f;
// const int Inf = INT_MAX;
// const long long INF = LONG_LONG_MAX;
const long long mod = 2147493647;
// 欧拉常数, 调和级数求和 sigma(h_n) = GAMA + ln(n)
const double GAMA = 0.57721566490153286060651209; 
const double PI   = 3.14159265358979323846264338;

long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long quickPow(long long a, long long p, long long mod) {
  long long pro = 1LL;
  a %= mod;
  while(p) {
    if(p & 1) { pro = pro * a % mod; }
    a = a * a % mod;  p >>= 1;
  }
  return pro;
}

const int MAXN = 200000 + 7;
char str[MAXN];

int main() {
  #ifdef Zonda_R
    freopen("data.in", "r", stdin);   // Windows 下最好用 "in.txt", "out.txt"
    freopen("data.out", "w", stdout);
  #endif
  while(scanf("%s", str) != EOF) {
    int len = strlen(str);
    map<char, int> mp;
    for(int i = 0; i < len; ++i) { mp[str[i]]++; }
    long long ans = 1LL * len * (len - 1) / 2;
    for(auto x : mp) {
      ans -= 1LL * x.second * (x.second - 1) / 2;
    }
    printf("%lld\n", ans + 1);
  }   
  // cerr << "Time Consumption: " << fixed << setprecision(6) << (double)clock() / CLOCKS_PER_SEC << " s." << endl;
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793


int main(){
  int N, W;
  cin >> N >> W;
  ll A[N], V[N];
  rep(i, N){
    cin >> A[i] >> V[i];
  }
  ll dp[N+1][W+1] = {};
  rep(i, N){
    rep(j, W+1){
      if(j>=A[i]) dp[i+1][j] = max(dp[i][j-A[i]]+V[i], dp[i][j]);
      else dp[i+1][j] = dp[i][j];
    }
  }
  cout << dp[N][W] << endl;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int h,m,s,t;
	while(1){
		cin>>h>>m>>s;
		if(h==-1&&m==-1&&s==-1) break;
		t=7200-(h*3600+m*60+s);
		int f=0;
		while(1){
			h=t/3600; m=(t%3600)/60; s=(t%3600)%60;
			printf("%02d:%02d:%02d\n",h,m,s);
			f++; if(f==2) break;
			t*=3;
		}
	}
}

Measured memory_bytes: 1160
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
import math

def main():
    n, d = map(int, input().split())
    cnt = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if math.sqrt(x**2 + y**2) <= d:
            cnt += 1
    print(cnt)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 77328
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    set<int>s;
    int a;
    for(int i=0;i<3;i++)
    {
        cin>>a;
        s.insert(a);
    }
    cout<<s.size();
  	return 0;
}







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

int N;

bool isName(string shop, string board) {
    int m;
   // n = shop.length();
    m = board.length();
    for(int step=1; step<=m; step++) {
        for(int i=0; i<m; i++) {
            string s = "";
            for(int j=i; j<m; j+=step) {
                s += board[j];
            }
            //cout << s << endl;
            if(s.find(shop) != string::npos) return true;
        }
    }
    
    return false;
}

int main(void) {
    cin >> N;
    string shop, board;
    cin >> shop;
    int ans = 0;
    for(int i=0; i<N; i++) {
        cin >> board;
        if(isName(shop, board)) ans++;
        //cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    long long int N, A, B, m1, m2 = 0;
    cin >> N >> A >> B;

    for(int i = 0;i < N-1;i++){
        m1 += A;
        m2 += B;
    }
    m1 += B+1;
    m2 += A+1;

    if(m2 - m1 >= 0){
        cout << m2 - m1 + 1 << endl;
    }else{
        cout << 0 << endl;
    }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
num = []
num2= []
for i in range(N+1):
  if i % 3 == 0 and i % 5 == 0:
    num.append(i)
  if i % 5 == 0:
    num.append(i)
  elif i % 3 == 0:
    num.append(i)
  else:
    num2.append(i)

print(sum(num2))

Measured memory_bytes: 48888
// Lets go to the next level 
// AIM CM at CF *__* asap 
// Hit A,B,C and D faster and reach Candidate Master
// Remember you were also a novice when you started, 
// hence never be rude to anyone who wants to learn something
// Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts 
// Donot treat CP as a placement thing, love it and enjoy it, you will succeed for sure.  


#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
// Big two primes 
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long 
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;}  
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 


signed main(){
  fio;
    int N;
    cin>>N;
    vector<vector<int>> G(N);
    vector<pair<int,int>> vp;

    for(int i=1;i<N;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;

        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a,b);
    }


    int K=0;
    map<pair<int,int>,int> I;
    vector<int> cs(N,0);

    vector<int> used(N,0);

    queue<int> que;

    used[0] = 1;
    que.emplace(0);

    while(!que.empty()){
        int v = que.front();que.pop();
        if(K<(int)G[v].size()) K = G[v].size();
        int cur = 1;
        for(int u:G[v]){
            if(used[u]) continue;
            if(cur == cs[v]) cur++;

            cs[u] = I[make_pair(u,v)] = I[make_pair(v,u)] = cur++;
            used[u] = 1;
            que.emplace(u);
        }
    }

    cout<<K<<endl;
    for(auto p:vp) cout<< I[p]<<endl;

  rr;
}

Measured memory_bytes: 24176
#include <stdio.h>

int main(void){
int a;
int aa;
int b;
int bb;
int c;
scanf("%d%d%d",&a,&b,&c);
if(a > b){
aa=a;
a=b;
b=aa;
}
if(b > c){
bb=b;
b=c;
c=bb;
}
if(a > b){
bb=a;
a=b;
b=bb;
}
printf("%d %d %d\n",a,b,c);
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(N), b(N), c(M), d(M);
    rep(i,N) cin >> a.at(i) >> b.at(i);
    rep(i,M) cin >> c.at(i) >> d.at(i);
    rep(i,N) {
        int ans;
        int dist;
        int minimum = INFINITY;
        rep(j,M) {
            dist = abs(a.at(i) - c.at(j)) + abs(b.at(i) - d.at(j));
            if (dist < minimum) {
                minimum = dist;
                ans = j + 1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3584
// https://atcoder.jp/contests/abc141/tasks/abc141_c
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, t;
    cin >> n >> m;
    priority_queue<int> q;
    REP(i, n) {
        cin >> t;
        q.push(t);
    }
    REP(i, m) {
        t = q.top();
        q.pop();
        t /= 2;
        q.push(t);
    }
    ll ans = 0;
    while (!q.empty()) {
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 892
import java.util.*;
import java.util.Vector;
import java.math.*; 
public class Main {
     Scanner sc = new Scanner(System.in);
	//	System.out.println( );
	
	
	
	void run(){ // kokonikaku
		int[] a=new int[200];
		int n=sc.nextInt();
		
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		int ans=0;
		int ima=-1;
		for(int i=0;i<n;i++){
			if(ima<=a[i]){
				ans++;
			}
			ima=Math.max(ima,a[i]);
		}
		
		System.out.println(ans);
	}

	
	public static void main(String[] args) {
		new Main().run();
        
    }
}

Measured memory_bytes: 21716
def pascal(n):
    ret = [[] for _ in range(n+1)]
    for i in range(n+1):
        for j in range(i+1):
            if j == 0 or j == i:
                ret[i].append(1)
            else:
                ret[i].append(ret[i-1][j-1]+ret[i-1][j])
    return ret


N, P = map(int, input().split())
A = [int(x) for x in input().split()]
comb = pascal(N)
count = [0, 0]
for i in A:
    count[i % 2] += 1
ans = 0
if P == 0:
    for i in range(0, count[1]+1, 2):
        ans += comb[count[1]][i]
else:
    for i in range(1, count[1]+1, 2):
        ans += comb[count[1]][i]
ans = ans * (2**count[0])
print(ans)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
  int n,a = 0;
  string s;
  char c=0;
  cin >> n;
  cin >> s;
  for(int i=0;i<n;i++){
    if(c != s[i]){
      c = s[i];
      a++;
    }
  }
  cout << a;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;
const int LG=log2(N) + 2;

int n, l, q;
int x[N];
int tim=0;
int parent[LG][N], wt[LG][N];
vector<pair<int, int> > g[N];

void dfs(int k, int par, int lvl)
{
    parent[0][k]=par;
    wt[0][k]=lvl;
    for(auto it:g[k])
    {
        if(it.first==par)
            continue;
        dfs(it.first, k, it.second);
    }
}

void precompute()
{
    for(int i=1;i<LG;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(parent[i-1][j])
            {
                parent[i][j]=parent[i-1][parent[i-1][j]];
                wt[i][j]=wt[i-1][j] + wt[i-1][parent[i-1][j]];
            }
            else
                wt[i][j]=wt[i-1][j];
        }
    }
}

int check(int a, int b, int mid)
{
    int cur=b, jumped=0;
    for(int i=0;i<LG;i++)
    {
        if((mid>>i)&1)
        {
            jumped+=wt[i][cur];
            cur=parent[i][cur];
        }
    }
    if(cur==0 || jumped>=b-a)
        return 1;
    return 0;
}

int binsearch(int a, int b, int lo, int hi)
{
    while(lo<hi)
    {
        int mid=(lo+hi)/2;
        if(check(a, b, mid))
            hi=mid;
        else
            lo=mid+1;
    }
    return lo;
}

int32_t main()
{
    IOS;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>x[i];
    cin>>l>>q;
    for(int i=1;i<=n;i++)
    {
        auto nxt=lower_bound(x+1, x+i, x[i]-l) - x;
        g[nxt].push_back({i, i-nxt});
    }
    dfs(1, 1, 0);
    precompute();
    while(q--)
    {
        int a, b;
        cin>>a>>b;
        if(a>b)
            swap(a, b);
        int ans=binsearch(a, b, 1, b-a+1);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 39936
INF = 10 ** 15

N, K = map(int, input().split())
Hs = [0] + list(map(int, input().split())) + [0]


dp = [[INF] * (K+1) for _ in range(N+2)]
dp[0][0] = 0

for n in range(1, N+2):
    for k in range(K+1):
        for l in range(1, min(n, k+1)+1):
            dp[n][k] = min(dp[n][k], dp[n-l][k-l+1] + max(0, Hs[n] - Hs[n-l]))

print(dp[N+1][K])

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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    int m = Integer.parseInt(r.readLine());

    System.out.println(48 - m);
  }

}


Measured memory_bytes: 22356
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

vector<P> apos, cpos;

long mht(P a, P b) {
    return abs(a.first - b.first) + abs(a.second - b.second);
}

int hoge(int i) {
    long m = 1e10;
    long mj = 1e10;
    int j = 0;
    for (auto p: cpos) {
        long k = mht(apos[i], p);
        if (k < m) {
            m = k;
            mj = j;
        }
        j++;
    }
    return mj + 1;
}

int main() {
    int n, m;
    cin >> n >> m;
    REP(i,n) {
        int p, q;
        cin >> p >> q;
        apos.push_back(P(p,q));
    }
    REP(i,m) {
        int p, q;
        cin >> p >> q;
        cpos.push_back(P(p,q));
    }
    
    REP(i,n) {
        cout << hoge(i) << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(15) << << endl;
#include <cassert>
//#include "atcoder/all"

using namespace std;
//using namespace atcoder;

#define ll long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define P pair<int,int>

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
ll mod = 1000000007;

signed main(){
    int n; ll k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    vector<ll> cnt_1(n),cnt_2(n);
    rep(i,n){
        int c1 = 0, c2 = 0;
        for(int j = i+1; j < n; ++j){
            if(a[i] > a[j]) c1++;
        }
        rep(j,n) if(a[i] > a[j]) c2++;
        cnt_1[i] = c1;
        cnt_2[i] = c2;
    }

    ll ans = 0;
    ll K = (((k-1) * k) / 2) % mod;
    rep(i,n){
        ans += (cnt_1[i] * k) % mod;
        ans += (cnt_2[i] * K) % mod;
        ans %= mod;
    }

    cout << ans % mod << endl;
}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll 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 N;
	cin >> N;
    ll h, n, w;
    for (int i = 1; i <= 3500; i++) {
        for (int j = 1; j <= 3500; j++) {
            if ((4*i*j-N*i-N*j)==0) continue;
            if ((N*i*j)%(4*i*j-N*i-N*j)==0) {
                w = (N*i*j)/(4*i*j-N*i-N*j);
                if (w>0) {
                    h = i;
                    n = j;
                    cout << h << ' ' << n << ' ' << w << endl;
                    return 0;
                }
            }
        }
    }
}


Measured memory_bytes: 256
import math

N = int(input())
lis = list(range(1, 10))
start_idx = 0
found = False
for start_idx in range(len(lis)):
    if found:
        break
    idx = start_idx
    for idx in range(len(lis)):
        if lis[start_idx] * lis[idx] == N:
            found = True
if found:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
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();
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: 26340
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    int ans = 0;
    int pos = 0;
    while(pos < n)
    {
        while(pos < n-1 && a[pos] == a[pos+1]) pos++;
        if(pos == n-1)
        {
            ans++;
            break;
        }
        if(a[pos] < a[pos+1])
        {
            int now = a[pos];
            while(pos < n-1 && now <= a[pos+1])
            {
                now = a[pos+1];
                pos++;
            }
            if(pos == n-1)
            {
                ans++;
                break;
            }
            else
            {
                ans++;
                pos++;
                continue;
            }
        }
        else
        {
            int now = a[pos];
            while(pos < n-1 && now >= a[pos+1])
            {
                now = a[pos+1];
                pos++;
            }
            if(pos == n-1)
            {
                ans++;
                break;
            }
            else
            {
                ans++;
                pos++;
                continue;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void){
	int x, y, z;

	cin >> x >> y >> z;

/*	if (x % (y + z) >= z){
		if (x % (y + z) >= y){
			cout << x/(y + z) + 1 << endl;
		}
		else 
			cout << x / (y + z) << endl;
	}
	else {
		if (x % (y + z) >= y){
			cout << x/(y + z) << endl;
		}
		else 
			cout << x / (y + z) - 1 << endl;		
	}*/

	cout << (x - z) / (y + z) << endl;


	return 0;
}

Measured memory_bytes: 256