akhauriyash/Code-Regression huggingface dataset:
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	vector<int> a(5);
	vector<pair<int, int>> b;
	rep(i, 5) {
		scanf("%d", &a[i]);
		if (a[i] % 10 != 0)b.pb({ a[i] % 10, i });
		if (a[i] % 10 != 0)a[i] = (a[i] / 10) * 10 + 10;
	}
	sort(all(b));
	int ans = 0;
	rep(i, 5) {
		if (b.size() > 0){
			if (b[0].second == i) {
				ans += b[0].first;
				ans += a[i] - 10;
			}
			else {
				ans += a[i];
			}
		}
		else {
			ans += a[i];
		}
	}
	printf("%d\n", ans);

	Please AC;
}


Measured memory_bytes: 512
eval'K,X,Y='+`dd`.split*?,
x,y,*s=X.abs,Y.abs
d=x+y
x,y=y,x if f=x>y
K%2-d%2<0&&p(-1)+exit
n=1+~-d/K
n+=d<K ? 1:d-n*K&1
a=n<2?x:d-n*K>>1
b=K-a.abs
d%2-d/K>0&&(s<<[0,-K]
a=b=d-K>>1)
n.times{s<<[a,b]
a+=t=[x-a,K].min
b+=K-t}
p s.size
s.map{|a,b|a,b=b,a if f
p a*=X<=>0.1,b*=Y<=>0.1}

Measured memory_bytes: 43140
#include <iostream>
 
using namespace std;
 
int W, H;
int field[55][55];
 
void input(void){
    cin >> W;
    cin >> H;
 
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            cin >> field[j][i];
        }
    }
}
 
void dfs(int x, int y){
    field[x][y] = 0;
 
    for(int dx = -1;dx <= 1;dx++){
        for(int dy = -1;dy <= 1;dy++){
            int nx = x + dx, ny = y + dy;
            if(0 <= nx && nx < W && 0 <= ny && ny < H && field[nx][ny] == 1) dfs(nx, ny);
        }
    }
 
    return ;
}
 
int main(){
    while(1){
        int res = 0;
        input();
        if(W == 0 && H == 0) break;
 
        for(int i = 0;i < H;i++){
            for(int j = 0;j < W;j++){
                if(field[j][i] == 1){
                    dfs(j, i);
                    res++;
                }
            }
        }
 
        cout << res << endl;
    }
 
    return 0;
}


Measured memory_bytes: 3284
N = int(input())
A = [int(input()) for _ in range(N)]

A_sorted = list(sorted(A))
m = A_sorted[-1]
s = A_sorted[-2]
if m == s:
    for i in range(N): print(m)
else:
    for i in range(N):
        if m != A[i]: print(m)
        else: print(s)


Measured memory_bytes: 92536
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007



n = I()
graph = SR(n)


def bfs(i):
    cost = [INF] * n
    cost[i] = 0
    que = deque([i])
    while que:
        cur = que.popleft()
        for nxt in range(n):
            if int(graph[cur][nxt]):
                c1 = cost[cur]
                if cost[nxt] != INF and cost[nxt] % 2 != (c1 + 1) % 2:
                    return -1
                else:
                    if cost[nxt] > c1 + 1:
                        cost[nxt] = c1 + 1
                        que += [nxt]
    return max(cost)



ret = 0
for j in range(n):
    if bfs(j) < 0:
        print(-1)
        break
    else:
        ret = max(ret, bfs(j))
else:
    print(ret + 1)

Measured memory_bytes: 47676
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int n = sc.nextInt();
		int ans = 1;

		while (n >= ans) {
			ans *= 2;
		}
		System.out.print(ans / 2);

	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  vector<ll> a ; 

  ll ans = 0 ; 
  rep(i,3){
    ll inp; cin >> inp;
    a.pb(inp);
    ans += inp;
  }
  sort(all(a));
  if(ans == (a[2]*2) ) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

int n,y;

void input(){
    cin >> n >> y;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    for(int i=0;10000*i<=y;i++){
        for(int j=0;10000*i+5000*j<=y;j++){
            if ((y-10000*i-5000*j)/1000 == n-i-j){
                cout << i << ' ' << j << ' ' << n-i-j << endl;
                return 0;
            }
        }
    }
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

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

    int n;
    while(cin >> n, n) {
        vvi vv(2);
        rep(j, 2) vv[j].emplace_back(-inf);
        rep(i, n) {
            int j;
            cin >> j;
            if ((i + 1) & 1 || vv[j^1].back() != i - 1) {
                if (vv[j].back() == i - 1) {
                    vv[j].back() = i;
                } else {
                    vv[j].emplace_back(i);
                }
            } else {
                vv[j^1].pop_back();
                if (vv[j].back() != -inf) {
                    vv[j].back() = i;
                } else {
                    vv[j].emplace_back(i);
                }
            }
        }

        vi v(n);
        rep(j, 2) {
            rep2(i, 1, vv[j].size()) {
                v[vv[j][i]] = (j ? -1 : 1);
            }
        }

        if (v.back() == -1) v.back() = 0;
        rrep(i, n - 1) {
            v[i] += v[i + 1];
        }

        cout << accumulate(all(v), 0) << endl;
    }
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };

int N,K;
int a[200005];
vector<P1> b;
int c[200005];

class BIT{
public:
    int bit[200005],n;
    BIT(int m){
        n = m;
        for(int i=0;i<m;++i)bit[i] = 0;
    }
    int sum(int i){
        int s = 0;
        while(i>0){
            s+=bit[i];
            i -= i & -i;
        }
        return s;
    }
    void add(int i,int x){
        while(i<=n){
            bit[i]+=x;
            i += i & -i;
        }
    }
};

signed main(){
    cin>>N>>K;
    for(int i=0;i<N;++i)cin>>a[i];
    b.PB(P1(0,0));
    for(int i=1;i<=N;++i)b.PB(P1(b[i-1].fi+a[i-1],i));
    for(int i=1;i<b.size();++i)b[i].fi -= K*i;
    sort(b.begin(),b.end());
    int tmp = 0;
    for(int i=0;i<b.size();++i){
        int id = b[i].se;
        if( ( b[i].fi!=b[i-1].fi ) && i ){
            tmp++;
            c[id] = tmp;
        }
        else c[id] = tmp;
    }
    BIT V(200005);
    int ans = 0;
    //for(int i=0;i<b.size();++i)cout<<c[i]<<endl;
    for(int i=0;i<b.size();++i){
        ans+=V.sum(c[i]+1);
        V.add(c[i]+1,1);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9068
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n, 0);
    rep(i, n){
        int b;
        cin >> b;
        a[b]++;
    }

    ll ans = 1;
    int mod = 1000000007;
    if(n % 2 == 0){
        rep(i, n){
            if(i % 2 == 0){
                if(a[i] > 0)ans = 0;
            }else{
                if(a[i] == 2){
                    ans *= 2;
                    ans %= mod;
                }
                else ans = 0;
            }
        }
    }else{
        rep(i, n){
            if(i % 2 == 1){
                if(a[i] > 0)ans = 0;
            }else{
                if(i == 0){
                    if(a[i] != 1)ans = 0;
                }else if(i % 2 == 0){
                    if(a[i] == 2){
                        ans *= 2;
                        ans %= mod;
                    }
                }else ans = 0;
            }
        }
    }
    cout << ans << endl;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const LL INF = 1e18;

class SegT{
private:
  VL dat[2 * (1 << 17) - 1]; // = 131072
  int NN;

  void merge(VL& dst, const VL& s1, const VL& s2){
	for(int i1=0,i2=0;i1<SZ(s1)||i2<SZ(s2);){
	  if(i1 == SZ(s1)){
		dst.push_back(s2[i2++]);
	  }
	  else if(i2 == SZ(s2)){
		dst.push_back(s1[i1++]);
	  }
	  else{
		if(s1[i1] < s2[i2])
		  dst.push_back(s1[i1++]);
		else
		  dst.push_back(s2[i2++]);
	  }
	}
  }
  
public:
  SegT(int n_, VVL& xs){
	NN = 1;
	while(NN < n_) NN <<= 1;
	for(int i=0;i<n_;++i){
	  dat[NN-1+i] = xs[i];
	  SORT(dat[NN-1+i]);
	}
	for(int i=NN-2;i>=0;--i){
	  merge(dat[i], dat[i*2+1], dat[i*2+2]);
	}
  }

  bool query(int a, int b, LL lb, LL ub, int k, int l, int r){
	if(r <= a || b <= l) return false;

	if(a <= l && r <= b){
	  auto it = lower_bound(ALL(dat[k]), lb);
	  return it != end(dat[k]) && *it <= ub;
	}
	else{
	  if(query(a, b, lb, ub, k*2+1, l, (l+r)/2))
		return true;
	  return query(a, b, lb, ub, k*2+2, (l+r)/2, r);
	}
  }
  int query(int a, int b, LL lb, LL ub){
	return query(a, b, lb, ub, 0, 0, NN);
  }
};


LL N, A, B;
vector<PLL> xs[5];

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

  cin >> N >> A >> B;
  REP(i,N){
	LL t, a, b;
	cin >> t >> a >> b;
	xs[t-1].EB(a,b);
  }
  
  set<PLL> S, T, tmp;
  S.insert(MP(0,0));
  REP(i,3){
	tmp = S;
	for(auto&& p: S)
	  for(auto&& x: xs[i]){
		tmp.insert(MP(x.FF+p.FF, x.SS+p.SS));
	  }
	S = tmp;
  }
  T.insert(MP(0,0));
  FOR(i,3,5){
	tmp = T;
	for(auto&& p: T)
	  for(auto&& x: xs[i]){
		tmp.insert(MP(x.FF+p.FF, x.SS+p.SS));
	  }
	T = tmp;
  }
  tmp.clear();

  vector<LL> xx;
  for(auto&& p: T)
	xx.PB(p.FF);
  xx.PB(-INF);
  xx.PB(INF);
  SORT(xx);
  xx.erase(unique(ALL(xx)), end(xx));

  int M = SZ(xx);
  map<LL,int> idx;
  REP(i,M) idx[xx[i]] = i;
  
  VVL dat(M);
  for(auto&& p: T)
	dat[idx[p.FF]].PB(p.SS);

  SegT seg(M, dat);
  for(auto&& p: S){
	int lx = idx.lower_bound(A-p.FF)->SS;
	int rx = idx.upper_bound(B-p.FF)->SS;
	if(seg.query(lx, rx, A-p.SS, B-p.SS)){
	  cout << "Yes" << endl;
	  return 0;
	}
  }
  cout << "No" << endl;

  return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int n;
	set<string> s;
	int ans = 0;

	cin >> n;
	rep(i, n)
	{
		string t;
		cin >> t;
		auto it = s.find(t);
		if (it == s.end())
		{
			s.insert(t);
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 19264
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        int cnt = 0;
        for (int j = 1; j <= i; j += 2) {
            if (i % j == 0) {
                cnt++;
            }
        }
        if (cnt == 8) {
            // cout << i << endl;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
string s;
int c[150]={0};
string ans="";
cin >> s;
  
  for(int i = 0 ; i < 4 ; i++){
      if(c[s[i]]== 0){
          ans = ans+s[i];
          c[s[i]] += 1;
      }else if(c[s[i]]== 1){
      c[s[i]] += 1;
      }else{
        ans = ans+s[i];
      }
  } 
    if(ans.size() == 2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

const int N=(int)3e3+5;

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

void rzut(int nr, ld glowa){
    ld reszka=(ld)1-glowa;
    dp[nr][0]=dp[nr-1][0]*reszka;
    for (int i=1; i<=nr; ++i){
        dp[nr][i]=dp[nr-1][i]*reszka+dp[nr-1][i-1]*glowa;
    }
}

void solve(){
    ld wynik=0;
    for (int i=(n+1)/2; i<=n; ++i){
        wynik+=dp[n][i];
    }
    cout<<fixed<<setprecision(10)<<wynik<<'\n';
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    dp[0][0]=1;
    for (int i=1; i<=n; ++i){
        cin>>a;
        rzut(i,a);
    }
    solve();
}

Measured memory_bytes: 139264
def shellsort(a):
    l = len(a)
    gaps = [1]
    while gaps[0]*3+1 < (l/9 if l>100 else l) and len(gaps) <= 100:
        gaps.insert(0, gaps[0]*3+1)
    count = 0
    for g in gaps:
        for i in range(g, l):
            v = a[i]
            j = i-g
            while j >= 0 and v < a[j]:
                a[j+g] = a[j]
                j -= g
                count += 1
            a[j+g] = v

    print(len(gaps))
    print(" ".join([str(n) for n in gaps]))
    print(count)
    print("\n".join([str(n) for n in a]))

shellsort([int(input()) for _ in [None]*(int(input()))])

Measured memory_bytes: 132076
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    ArrayList<Integer>ans  = new ArrayList<>();
    
    for(int i=1; i<=x; i++) {
    	for(int j=2; j<=1000; j++) {
    		if(x >= (int)Math.pow(i, j)) {
    			ans.add((int)Math.pow(i, j));
    	}
    }
    }
    Collections.sort(ans,Collections.reverseOrder());
    			System.out.println(ans.get(0));
    	}
}

Measured memory_bytes: 35836
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;

int main(){
    int x,y;
    cin >> x >> y ;

    int a=0;
    int b=0;

    for(a=0;a<=x;a++){
        for(b=0;b<=x-a;b++){
            if(y==2*a+4*b && a+b==x){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3632
#include <algorithm>
#include <deque>
#include <iostream>
#include <vector>

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

int M, N;

int main() {
    cin >> N >> M;
    if (N == M) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

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: 3072
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<par<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,x;
    cin>>n>>x;
    vi m(n);
    int ans=n;
    rep(i,n){
        cin>>m[i];
        x-=m[i];
    }
    SORT(m);
    ans+=x/m[0];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
//using namespace __gnu_pbds;

//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;                         

const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
bool used[N];
void solve () {
	int n, x;
	cin >> n >> x;
	swap (n, x);
	for (int i = 1; i <= n; i ++) {
		int xx;
		cin >> xx;
		used[xx] = 1;
	}
	int mini = mod, o = -1;
	for (int i = x; i >= 0; i --) {
		if (!used[i]) {
			mini = x - i, o = i;
			break;			
		}
	}
	for (int i = x + 1; i <= (int)1e5; i ++) {
		if (!used[i]) {
			if (i - x < mini) {
				mini = i - x;
				o = i;
			}
			break;
		}	
	}
	cout << o;
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <set>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

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

map<int, int> pos; //  éÔÌÂÌÌzñàÌÊu
int nums[500000];
int BIT[2000000];
int n = 1 << 20;
int head, tail;
int sz;
int q, lim;

void add(int x, int p){
	p++;
	while(p <= n){
		BIT[p] += x;
		p += (p & -p);
	}
}

int sum(int p){
	p++;
	int res = 0;
	while(p){
		res += BIT[p];
		p -= (p & -p);
	}
	return res;
}

int get_pos(int x){
	int ub = tail + 1;
	int lb = 0;
	while(ub - lb > 1){
		int mb = (ub + lb) / 2;
		if(sum(mb - 1) < x) lb = mb;
		else ub = mb;
	}
	return lb;
}

void query0(int x){
	pos[x] = tail;
	add(1, tail);
	nums[tail++] = x;
	sz++;
	while(head < tail && sz > lim){
		if(nums[head] != -1){
			nums[head] = -1;
			sz--;
			add(-1, head);
		}
		head++;
	}
}

void query1(int x){
	int p = get_pos(x);
	assert(p >= 0);
	nums[p] = -1;
	add(-1, p);
	sz--;
}

void query2(int x){
	cout << nums[get_pos(x)] << endl;
}

void query3(int x){
	int p = pos[x];
	nums[p] = -1;
	add(-1, p);
	sz--;
}

int main(){
	int query, x;
	while(cin >> q >> lim && (q || lim)){
		memset(BIT, 0, sizeof(BIT));
		memset(nums, 0, sizeof(nums));
		pos.clear();
		head = 0;
		tail = 0;
		sz = 0;
		rep(i, q){
			cin >> query >> x;
			switch(query){
			case 0:
				query0(x);
				break;
			case 1:
				query1(x);
				break;
			case 2:
				query2(x);
				break;
			case 3:
				query3(x);
				break;
			default:
				assert(false);
			}
			//rep(i, tail) cout << nums[i] << " ";	cout << "************" << endl;
		}
		cout << "end" << endl;
	}
	return 0;
}

Measured memory_bytes: 22000
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        k: usize,
    }

    let mut ans: f64 = 0.0;
    let mut end = 0;
    if n<k {
        ans = 0.0;
        end = n+1;
    } else {
        ans = (n-k+1) as f64 /n as f64;
        end = k;
    }
    for i in 1..end {
        let mut base = 1.0/n as f64;
        let mut tmp = i as f64;
        loop {
            if tmp<k as f64 {
                tmp *= 2.0;
                base /= 2.0;
            } else {
                break;
            }
        }
        ans += base;
        //println!("{}", ans);
    }

    println!("{}", ans);

}

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

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
const ll MOD = 1e9+7;
const vi dx = {1, 0, -1, 0, 1, -1, -1, 1};
const vi dy = {0, 1, 0, -1, 1, 1, -1, -1};


int main() {
    int N,K; cin>>N>>K;
    vi l(N);
    rep(i,N){
        cin>>l[i];
    }
    sort(all(l));
    reverse(all(l));
    int max = 0;
    rep(i,K){
        max += l[i];
    }
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n;
    cin >> n;
    long ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 15 == 0) {

        } else if (i % 5 == 0) {

        } else if (i % 3 == 0) {

        } else {
            ans += i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <iostream>

int main(void){
    using namespace std;
    int N,a=1,b,ans=0;
    cin>>N;
    for(int i=1;i<=N;i++){
        b=i;
        while(1){
            b/=10;
            if(b!=0) a++;
            else break;
        }
        if(a%2==1) ans++;
        a=1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

/*
 https://atcoder.jp/contests/abc144/submissions/15299596
 だめな理由
 checkで各々何個aの余白があるか求まっても, 各fに対してどうaを対応づければいいか言ってない
 
 */
// https://betrue12.hateblo.jp/entry/2019/10/30/011052
// 修行で大小関係は変化しないようできる
void solve() {
    int n; ll k;
    cin >> n >> k;
    vector<int> a(n), f(n);
    cin >> a >> f;
    vector<pll> b(n);
    sort(all(a));
    sort(all(f), greater<>());
    rep(i, n) b[i] = pll(a[i] * 1LL * f[i], f[i]);
    
    auto bin = [&](ll ok, ll ng) {
        auto check = [&](ll x) {
            ll cnt = 0; // debuged, int
            rep(i, n) {
                if (b[i].F <= x) continue;
                cnt += b[i].F / b[i].S - x / b[i].S;
            }
            if (cnt <= k) return 1;
            return 0;
        };
        while (abs(ok - ng) > 1) {
            ll mid = (ok + ng) / 2;
            // cerr << mid << endl;
            if (check(mid)) ok = mid;
            else ng = mid;
            // cerr << ok << " " << ng << endl;
        }
        cout << ok << endl;
    };
    bin(1000000000000, -1);
}


Measured memory_bytes: 7932
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		long b = sc.nextLong();
		// 文字列の入力
		long[] d = new long[a];
		long[] e = new long[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
		} 
      for(int i = 0; i < a; i++){
			e[i] = sc.nextInt();
		} 
		Arrays.sort(d);
		Arrays.sort(e);
		long f = 0;
		long g = d[a - 1] * e[a - 1];
      //System.out.println(g);
		long h = (f + g) / 2;
		long i = 0;
		while(f != h ){
          i = 0;
			for(int j = 0; j < a; j++){
				if(d[j] - h / e[a - j - 1] > 0){
					i += d[j] - h / e[a - j - 1];
                  
				}
              //System.out.println(d[j] - h / e[a - j - 1] + "and" + h);
			}
			if(i > b){
				f = h;
				h = (f + g) / 2;
              //System.out.println(i);
			}else{
            	g = h;
                h = (f + g) / 2;
            }
          
      //System.out.println(g);
		}
      i = 0;
			for(int j = 0; j < a; j++){
				if(d[j] - h / e[a - j - 1] > 0){
					i += d[j] - h / e[a - j - 1];
                  
				}
              //System.out.println(d[j] - h / e[a - j - 1] + "and" + h);
			}
      if(i > b){
              System.out.println(h + 1);
			}else{
              System.out.println(h);
            }
		
		
	}
}

Measured memory_bytes: 63924
#include <algorithm>
#include <complex>
#include <vector>
using namespace std;
const double eps = 1e-10;
#define EQ(a, b) (abs((a) - (b)) < eps)
using P = complex<double>;      // position
struct L : vector<P> {
    L(const P &a = P(), const P &b = P()) {
        emplace_back(a); emplace_back(b);
    }
};
ostream &operator<<(ostream &os, P p) { return os << real(p) << " " << imag(p); }
double dot(const P &a, const P &b) { return real(conj(a) * b); }
double cross(const P &a, const P &b) { return imag(conj(a) * b); }

enum CCW_RESULT { CCW = +1, CW = -1, BEHIND = +2, FRONT = -2, ON = 0 };
int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if (cross(b, c) > eps) return CCW;      // counter clockwise
    if (cross(b, c) < -eps) return CW;      // clockwise
    if (dot(b, c) < 0) return BEHIND;       // c--a--b on line
    if (norm(b) < norm(c)) return FRONT;    // a--b--c on line | a=b
    return ON;                              // on segment | a=c | b=c
}
bool isecSS(const L &s, const L &t) {
    return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
           ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}
double distLP(const L &l, const P &p) {
    return abs(cross(l[1] - l[0], p - l[0])) / abs(l[1] - l[0]);
}
double distSP(const L &s, const P &p) {
    if (dot(s[1] - s[0], p - s[0]) < 0) return abs(p - s[0]);
    if (dot(s[0] - s[1], p - s[1]) < 0) return abs(p - s[1]);
    return distLP(s, p);
}
double distSS(const L &s, const L &t) {
    if (isecSS(s, t)) return 0;
    return min({distSP(s, t[0]), distSP(s, t[1]), distSP(t, s[0]), distSP(t, s[1])});
}

#include <iostream>
#include <iomanip>
int main() {
    cout << fixed << setprecision(10);
    int q; cin >> q;
    while (q--) {
        vector<P> ps;
        for (int i = 0; i < 4; i++) {
            int x, y; cin >> x >> y;
            ps.emplace_back(x, y);
        }
        double d = distSS(L(ps[0], ps[1]), L(ps[2], ps[3]));
        cout << d << endl;
    }
    return 0;
}


Measured memory_bytes: 3336
def max(a, b) a>b ? a:b end
N=gets.to_i
A=gets.split.map(&:to_i)

cnt=0
ans=0
(N-1).times do |i|
  if A[i] < A[i+1]
    ans = max(ans, cnt)
    cnt = 0
  else
    cnt += 1
  end
end
ans = max(ans, cnt)
p ans

Measured memory_bytes: 8580
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
int MAX;

//int memo[810][810][9];

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

pii frac_minus(int p,int q, int mp, int mq){ // p/q - mp/mq
	  int nume = p*mq - q*mp;
	  int deno = q*mq;
	  int g = gcd(nume,deno);
	  return pii(nume/g, deno/g);
}

int solve(int p,int q, int prod,int n,int pre){
	  
	  if(prod > MAX or p < 0 or q < 0)
			return 0;
	  if(n<0)
			return 0;

	  int ans = 0;
	  if(p==0)
			return 1;
//			ans++;
	  /*
	  if(p == 1 and (ll)q*(ll)prod <= MAX and pre <= q and q>0){
//			cout << "(" << p <<"/"<<q<<","<<prod<<","<<n<<") ";
			ans++;
	  }
	  */
	  
	  int high;
	  if(p!=0)
			high = min(MAX,q*n/p);
	  else 
			high = 12000;
	  for(int j=pre; j<=high; j++){
			pii tmp = frac_minus (p,q,1,j);
			int np = tmp.first;
			int nq = tmp.second;
			if(prod*j > MAX) break;
			ans += solve(np,nq,prod*j,n-1,j);
	  }

	  return ans ;
}

int main(){

	  while(1){

			int p,q,n;
			cin >> p >> q >> MAX >> n;
			if(!p) break;
			int g = gcd(p,q);
			cout << solve(p/g,q/g,1,n,1) << endl;
	  }
}

Measured memory_bytes: 1160
#include <stdio.h>

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


Measured memory_bytes: 2688
import numpy as np

N,K,S = map(int,input().split())
A = np.zeros(N,dtype="int64")
if S == 1000000000:
  for i in range (0,K):
    A[i] = S
  for i in range (K,N):
    A[i] = S - 1
else:
  for i in range (0,K):
    A[i] = S
  for i in range (K,N):
    A[i] = S + 1

for i in range (0,N):
  print(A[i], end=" ")

Measured memory_bytes: 14400
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();
		if(A-B>C) {
			System.out.println(0);
			return;
		}
		System.out.print(C-A+B);
	

	}
}


Measured memory_bytes: 23380
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        list.add("3");
        list.add("5");
        list.add("7");
        for (int i = 0; i < 8; i++) {
            int size = list.size();
            for (int j = 0; j < size; j++) {
                String base = list.get(j);
                list.add(base + 3);
                list.add(base + 5);
                list.add(base + 7);
            }
        }

        List<Long> longList = list.stream().filter(i -> i.contains("3") && i.contains("5") && i.contains("7"))
                .map(i -> Long.parseLong(i)).collect(Collectors.toList());
        longList = new ArrayList<>(new HashSet<>(longList));
        Collections.sort(longList);

        int result = 0;
        for (int i = 0; i < longList.size(); i++) {
            if (longList.get(i) <= (long) n) {
                result++;
            }
        }

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 60496
#include<bits/stdc++.h>
#define ll long long
#define N 200010
#define mo 1000000007
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
ll b,w,gb,gw,jie[N],nj[N];
ll c(ll x,ll y){if (x<y) return 0;return (jie[x]*nj[y]%mo)*nj[x-y]%mo;}
ll po(ll x,ll y){ll z=1;while (y){if (y%2)z=x*z%mo;x=x*x%mo;y/=2;}return z;}
int main(){
	read(b);read(w);
	gb=0;gw=0;jie[0]=1;
	for (int i=1;i<=b+w;i++)jie[i]=jie[i-1]*i%mo;
	nj[b+w]=po(jie[b+w],mo-2);for(int i=b+w-1;i>=0;i--) nj[i]=nj[i+1]*(i+1)%mo;
	for (int i=1;i<=b+w;i++){
		printf("%d\n",(1-gb+gw+mo)*po(2,mo-2)%mo);
		gb=(gb+c(i-1,b-1)*po(po(2,i),mo-2))%mo;
		gw=(gw+c(i-1,w-1)*po(po(2,i),mo-2))%mo;
	}
	return 0;
}

Measured memory_bytes: 5376
S = list(input())
count=0
for i in range(len(S)-1):
    if S[i] == S[i + 1]:
        if S[i] == '0':
            S[i + 1] = '1'
        elif S[i] == '1':
            S[i+1]='0'
        count += 1
print(count)

Measured memory_bytes: 3956
<?php
fscanf(STDIN, '%d %d %d', $A, $B, $C);
$result = 0;
$num = [];
foreach ([$A, $B, $C] as $v) {
	if (!isset($num[$v])) {
		$num[$v] = true;
		$result++;
	}
}
echo $result . PHP_EOL;

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

int main(){
    int x,a,b;
    int n;
    cin>>x>>a>>b>>n;
    for (int i = 0; i < n; ++i) {
        string t;
        cin>>t;
        if(t[0]=='n')x+=a;
        else if(t[0]=='t')x+=b;
        else x=0;
        if(x<0)x=0;
    }
    cout<<x<<endl;
    return 0;
}


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

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

    vector<int> water;
    for (auto i = 0; i <= f / 100 * a; i++) {
        for (auto j = 0; j <= f / 100 * b; j++) {
            if(i == 0 and j == 0) continue;
            if(i * a * 100 + j * b * 100 > f) continue;
            water.push_back(i * a * 100 + j * b * 100);
        }
    }

    vector<int> sugar;
    for (auto i = 0; i <= f / c; i++) {
        for (auto j = 0; j <= f / d; j++) {
            if(i == 0 and j == 0) continue;
            if(i * c + j * d > f) continue;
            sugar.push_back(i * c + j * d);
        }
    }

    sort(water.begin(), water.end());
    auto tmp =  unique(water.begin(), water.end());
    water.erase(tmp, water.end());
    sort(sugar.begin(), sugar.end());
    tmp =  unique(sugar.begin(), sugar.end());
    sugar.erase(tmp, sugar.end());

    double max = 0.0;
    int ans1 = 0, ans2 = 0;
    for (int i : water) {
        for (int j : sugar) {
            if((double)j / e * 100 > i) continue;
            if(i + j <= f) {
                if((double)100.0 * j / (i + j) > max){
                    max = (double)100.0 * j / (i + j);
                    ans1 = i + j;
                    ans2 = j;
                }
            }
        }
    }

    if(max == 0.0) ans1 = a * 100;
    cout << ans1 << " " << ans2 << endl;
    return 0;
}

Measured memory_bytes: 1400
from bisect import bisect_left, bisect_right

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

# 上に載せられるピースの組み合わせ数 * 下におけるピースの組み合わせ数
ans = 0

for i in range(N):
    upper = bisect_left(A, B[i])
    lower = N - bisect_right(C, B[i])
    ans += upper * lower

print(ans)


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

int main(){
  string S, T;
  cin >> S >> T;
  int count = 0;
  
  for (int i = 0; i < S.size(); i++){
    
    if (S.at(i) == T.at(i)){
      count++;
    }
  }
  
  if (S.size() + 1 == T.size() && count == S.size()){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
class priorityQueue {
  constructor() {
    this.keys = [];
    Number.prototype.parentIdx = function() { return Math.ceil(this/2 - 1); };
    Number.prototype.leftIdx = function() { return this * 2 + 1; };
    Number.prototype.rightIdx = function() { return this * 2 + 2; };
  }

  insert(key) { this.heapIncrease(this.keys.push(key) - 1); }

  heapIncrease(idx) {
    const keys = this.keys;
    for (let i=idx, p=idx.parentIdx(); i > 0 && keys[i] > keys[p]; i=p, p=i.parentIdx()) {
      keys[p] = [keys[i], keys[i] = keys[p]][0];
    }
  }

  extract() {
    const keys = this.keys;
    const res = keys[0];
    keys[0] = keys.pop();
    this.maxHeapify(0);
    return res;
  }

  maxHeapify(idx) {
    const keys = this.keys;
    const n = keys.length;
    const innerMaxHeapify = (i) => {
      let left, right, largest = i;
      left = i.leftIdx();
      right = i.rightIdx();
      if (left < n && Number(keys[left]) > Number(keys[largest])) largest = left;
      if (right < n && Number(keys[right]) > Number(keys[largest])) largest = right;
      if (largest != i) {
        keys[largest] = [keys[i], keys[i] = keys[largest]][0];
        innerMaxHeapify(largest);
      }
    };
    innerMaxHeapify(idx);
  }
}

(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  lines.pop();
  const queue = new priorityQueue();
  let str = '';
  lines.forEach(function(cmd) {
    switch(cmd.charAt(0)) {
      case 'i': queue.insert(Number(cmd.split(' ')[1])); break;
      case 'e': str += `${queue.extract()|0}\n`; break;
    }
  });
  process.stdout.write(str);
})();



Measured memory_bytes: 203972
#include <cstdio>//C语言io
#include <cstring>//以下是c语言常用头文件
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <cmath>
#include <iostream>//c++IO
#include <sstream>
#include <string>
#include <list>//c++常用容器
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>//c++泛型的一些函数
#include <functional>//用来提供一些模版
#define fo0(i,n) for(int i = 0;i < n; ++i)
#define fo1(i,n) for(int i = 1;i <= n; ++i)
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
//......................................................
int main(void)
{
   int a,b;
   double x;
   cin>>a>>b;
   x = (double) a + b;
   x /= 2;
   printf("%.f",round(x));



   return 0;
    }




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer cout<<endl<<"answer : ";
#define maxn 100005
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0;string s;bool flag=false;
        cin>>n>>x;
        x=2*x + 1;
        ans=(n+(x-1))/x;
        cout<<ans<<endl;

    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 3584
import itertools

N, M = map(int, input().split())
lights = []
for m in range(M):
    tmp = list(map(int, input().split()))
    lights.append(tmp[1:])


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

ans = 0
for product in list(itertools.product([0, 1], repeat=N)):
    for light in range(len(lights)):
        cnt = 0
        for l in lights[light]:
            cnt += product[l-1]
        if cnt % 2 != P[light]:
            break
        if light == len(lights) - 1:
            ans += 1
print(ans)
        




Measured memory_bytes: 9272
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;

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

long long max(long long a,long long b){
	return (a>b)? a:b;
}
int j_k_bit_1or0(int j,int k){

}

int main (){
	long long NNN,MMM,maxx=0,p=0,sum=0;
	cin >> NNN >> MMM;
	long long a[3][NNN];
	rep(i,NNN)rep(j,3)cin >> a[j][i];
	vector <long long> temp[8];
	rep(i,8){
		rep(j,NNN){
			rep(k,3)(i & (1 << k))? p += a[k][j]:p -= a[k][j];
			cout << endl;
			temp[i].push_back(p);
			p=0;
		}
		sort(temp[i].rbegin(),temp[i].rend());
		sum=0;
		rep(k,MMM)sum += temp[i][k];
		maxx = max(sum,maxx);
	}
	cout << maxx << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(abs(b-a)<=d && abs(c-b)<=d){
		cout << "Yes" << endl;
	}else if(abs(c-a)<=d){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256