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

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

vector<pii> aray;

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int N; cin >> N;
	rep(i,N) {
		int X, L; cin >> X >> L;
		aray.pb({X+L, 2*L});
	}
	sort(all(aray));
	int prev = -1000000009, cnt = 0;
	for(pii& t:aray) {
		if(t.first-t.second < prev) continue;
		cnt++;
		prev = t.first;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 1400
#include <stdio.h>

int main(void){
  long int W, H, X, Y;
  scanf("%ld %ld %ld %ld", &W, &H, &X, &Y);
  printf("%lf %d\n", double(W)*double(H)/2, 2*X==W && 2*Y==H);
  return 0;
}

Measured memory_bytes: 504
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int n = sc.nextInt();
		String input;
		int a = 0, b = 0;
		for (int i = 0; i < n; i++) {
			input = sc.next();
			if (input.equals("print")) {
				a = sc.nextInt();
				b = sc.nextInt();
				printAtoB(str, a, b);
			} else if (input.equals("reverse")) {
				a = sc.nextInt();
				b = sc.nextInt();
				str = reverseAtoB(str, a, b);
			} else if (input.equals("replace")) {
				a = sc.nextInt();
				b = sc.nextInt();
				String p = sc.next();
				str = replaceAtoBofP(str, a, b, p);
			} else {
				System.out.println("error");
			}
		}
	}

	static void printAtoB(String str, int a, int b) {
		for (int i = a; i <= b; i++) {
			System.out.print(str.charAt(i));
		}
		System.out.println();
	}

	static String reverseAtoB(String str, int a, int b) {
		String newStr = "";
		for (int i = 0; i < a; i++) {
			newStr += str.charAt(i);
		}
		for (int i = b; i >= a; i--) {
			newStr += str.charAt(i);
		}
		for (int i = b + 1; i < str.length(); i++) {
			newStr += str.charAt(i);
		}
		return newStr;
	}

	static String replaceAtoBofP(String str, int a, int b, String p) {
		String newStr = "";

		for (int i = 0; i < a; i++) {
			newStr += str.charAt(i);
		}
		for (int i = 0; i <= (b - a); i++) {
			newStr += p.charAt(i);
		}
		for (int i = b + 1; i < str.length(); i++) {
			newStr += str.charAt(i);
		}
		return newStr;

	}

}

Measured memory_bytes: 131228
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD (1e9+7)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;


//cost_map pll -> <to, cost>
vector<ll> dijkstra(ll s, vector<vector<pll>>& cost_map){
    vector<ll> d(cost_map.size(), MAXINF);
    priority_queue<pll, vector<pll>, greater<pll>> q;
    q.push(pll(0, s));
    d[s] = 0;
    while(!q.empty()){
        pll f = q.top();q.pop();
        if(d[f.se] < f.fi) continue;
        for(auto&& v : cost_map[f.se]){
            ll value = f.fi + v.se;
            if(value < d[v.fi]) q.push(pll(d[v.fi] = f.fi + v.se, v.fi));
        }
    }
    return d;
}

//cost_map[vertex] pll -> <to, cost>
bool bellman_ford(ll s, vector<vector<pll>>& cost_map, vector<ll>& result){
    ll N = cost_map.size();
    vector<ll> d(N, MAXINF);
    d[s] = 0;
    REP(k, N){
        REP(i, N){
            if(d[i]==MAXINF)continue;
            for(auto&& v : cost_map[i]){
                if(d[v.fi] > d[i] + v.se){
                    d[v.fi] = d[i] + v.se;
                    if(k==N-1) return false;
                }
            }
        }
    }
    result = d;
    return true;
}

int main(void)
{
    int V,E,r;
    cin >> V >> E >> r;
    vector<vector<pll>> cost(V);
    REP(i, E){
        int s,t,d;
        cin >> s >> t >> d;
        cost[s].pb(pll(t,d));
    }

    vector<ll> d;
    if(bellman_ford(r, cost, d)) REP(i,V) {
        if(d[i]>INF)pr("INF");
        else pr(d[i]);
    }
    else pr("NEGATIVE CYCLE");
}


Measured memory_bytes: 3216
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = itertools.groupby(list(iss()))
    q = ''
    ret = 0
    for s in S:
        if q == '':
            q = s
        if q != s:
            ret += 1
            q = s
    print(ret)


if __name__ == '__main__':
    main()


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

long long int dp[1001][1001] = {0};

int main() {
    string s1,s2;

    cin >> s1 >> s2;

    int ss1 = s1.size(),ss2 = s2.size();

    dp[0][0] = 1;

    for(int i=0;i<ss1;i++){
        dp[i+1][ss2] += dp[i][ss2];
        dp[i+1][ss2] %= 1000000007;
        for(int j=0;j<ss2;j++){
            if (s1[i]==s2[j]){
                dp[i+1][j+1] += dp[i][j];
                dp[i+1][j+1] %= 1000000007;
            }
            dp[i+1][j] += dp[i][j];
        }
    }

    cout << dp[ss1][ss2] << endl;

    return 0;
}

Measured memory_bytes: 11016
program beki
  implicit none

  integer :: x, n, p, b

  read(*,*) x

  n = 1
  if (x < 4 ) then
     n = 1
  else
     do b = 2, x-1
        p = 2
        do while ( b**p <= x )
          
           if ( n < b**p ) then
              n = b**P
           end if
           p = p + 1
        end do
     end do
  end if
  write(*,*) n
     
  stop
end program beki
  

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

int yf(int x)
{
  return x*x;
}


int main()
{
  int d;
  int ans;
  while( scanf("%d",&d) != EOF ){
    for(int i=0; i<(600/d); i++){
      ans = ans + d * yf((600 - (i+1)*d));
      //printf("%d\n",ans);
    }
    printf("%d\n",ans);
    ans = 0;
  }
}

Measured memory_bytes: 1188
#include "bits/stdc++.h"
using namespace std;

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

#define FOR(i, s, e) for (ll(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (ll(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

/* -----  2017/04/08  Problem: ARC 071 A / Link: http://arc071.contest.atcoder.jp/tasks/arc071_a  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

ll N;

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

  int a[50][30];
  FOR(i, 0, 50)FOR(j, 0, 30)a[i][j] = 0;

  cin >> N;
  FOR(i, 0, N) {
	  string s;
	  cin >> s;
	  FOR(j, 0, s.size()) {
		  a[i][s[j]-'a']++;
	  }
  }
  FOR(i, 0, 30) {
	  ans = INF;
	  FOR(j, 0, N) {
		  ans = min(ans, a[j][i]);

	  }
	  char c = 'a' + i;
	  FOR(j, 0, ans) {
		  
		  cout << c;
	  }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>=x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
	//#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("outpu.txt","w",stdout);
    //#endif
	ll N,M;
	cin>>N>>M;
	double ar[N];
	for(ll i=0;i<N;i++)
	{
	    cin>>ar[i];
	    ar[i]=(double)(ar[i]+1)/2.0;
	}
	for(ll i=1;i<N;i++)
	{
	    ar[i]+=ar[i-1];
	}
	double ans=ar[M-1];
	for(ll i=M;i<N;i++)
	{
	    ans=max(ans,ar[i]-ar[i-M]);
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>

int main(){
    int N, R;
    std::cin >> N >> R;

    int ans = 0;
    if(N < 10){
        ans = R + 100 * (10 - N);
    }else{
        ans = R;
    }

    std::cout << ans << std::endl;

    return 0;
}


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


int main() {
	
	int N, M;
	cin >> N >> M;
	
	vector<string>a(N), b(M);
	for (auto &i : a) cin >> i;
	for (auto &i : b) cin >> i;

	for (int i=0; i<N-M+1; i++){
		for (int j=0; j<N-M+1; j++){

			bool flg = 1;
			for (int k=0; k<M; k++){
				for (int l=0; l<M; l++){
					if ( a.at(k+i).at(l+j) != b.at(k).at(l) ) {
						flg = 0;
						break;
					}
				}
				if (!flg) break;
			}
			
			if (flg) {
				cout << "Yes" << endl;
				return 0;
			}
			
		}
	} 
	cout << "No" << endl;
	
	return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    ll x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;

    vector<ll> p(a);
    vector<ll> q(b);
    vector<ll> r(c);
    ll ans = 0;

    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    rep(i,c) cin >> r[i];

    sort(p);
    reverse(p);
    sort(q);
    reverse(q);
    
    vector<ll> m;
    for(int i=0;i<x;i++){
        m.pb(p[i]);
    }
    for(int i=0;i<y;i++){
        m.pb(q[i]);
    }
    for(int i=0;i<c;i++){
        m.pb(r[i]);
    }

    sort(m);
    reverse(m);

    for(int i=0;i<x+y;i++){
        ans += m[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 8688
import math

a, b, x = map(float, input().split())

h = x / a**2.0

if x <= a**2 * b / 2.0:
    theta = math.atan((a*b**2.0)/(2.0*x))
else:
    theta = math.atan(2.0*(b-h)/a)

print(math.degrees(theta))


Measured memory_bytes: 2940
# coding: utf-8

loop do
  n, s = gets.chomp.split.map {|i| i.to_i} 
  break if n == 0 && s == 0

  array = Array.new
  (0..9).each do |j|
    array << j
  end
  cnt = 0
  array.combination(n) do |comb|
    sum = 0
    comb.each do |i|
      sum += i
    end
    cnt += 1 if sum == s
  end
  puts cnt
end

Measured memory_bytes: 6108
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>

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

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

  int k;
  cin >> k;

  queue<int64_t> lunluns;
  rep(i,9) lunluns.push(i+1);
  rep(i,k-1) {
    int64_t x = lunluns.front();
    lunluns.pop();

    int64_t n = x * 10 + x % 10;
    if (x % 10 != 0) lunluns.push(n-1);
    lunluns.push(n);
    if (x % 10 != 9) lunluns.push(n+1);
  }

  cout << lunluns.front() << endl;
  return 0;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#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()
const int inf = 1e9 + 7;
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; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll pow(ll a, int 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> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; 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; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

int c, d;
ll f(ll x) {
  return x - (x / c + x / d - x / lcm(1LL * c, 1LL * d));
}
void solve() {
  ll a, b;
  cin >> a >> b >> c >> d;
  // cout << f(b) << " " << f(a - 1) << endl;
  cout << f(b) - f(a - 1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#define S(n) (int)(pow(3,x-(n)+1)/2)
using namespace std;

int main(){
	int h[17],a[17],c[17],x,i,n,m,t;
	while(cin>>x>>n,n){
		for(i=0;i<3;i++)for(cin>>m;m--;h[t]=i)cin>>t;
		a[x]=h[x];c[x]=2-h[x];
		for(i=x;i>1;i--){
			if(h[i-1]==0){
				a[i-1]=a[i];
				c[i-1]=c[i]+2+4*S(i);
			}else if(h[i-1]==1){
				a[i-1]=c[i]+1+2*S(i);
				c[i-1]=a[i]+1+2*S(i);
			}else{
				a[i-1]=a[i]+2+4*S(i);
				c[i-1]=c[i];
			}
		}
		t=min(a[1],c[1]);
		cout<<(t>n?-1:t)<<endl;
	}
}

Measured memory_bytes: 0
package main

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

func main() {
	v := []int{
		1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,
	}
	K := ReadInt()
	fmt.Println(v[K-1])
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }


Measured memory_bytes: 1844
#include<stdio.h>

#define MAXW 10050
#define MAXN 105 
int dp[MAXW];
int max(int a, int b){return a>b?a:b;}
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C
//like coin changing
int main(){
	//i means:the first ith ele and j means: the capacity
	int N = 0,W=0;
	scanf("%d %d",&N,&W);
	
	int ele[N+1][2];
	for(int i = 1; i<=N;i++){
		scanf("%d %d",&ele[i][0],&ele[i][1]);//v,w	
	}
	//boundary case for dp
	
		for(int j = 0; j<=W; j++){
		dp[j] = 0;
		}
	
	for(int i = 1; i<=N; i++){
		for(int j = 1; j<=W; j++){
			if(j>=ele[i][1]){
				dp[j] = max(dp[j],dp[j-ele[i][1]]+ele[i][0]);
			}
			
		}
	}
	/*for(int i = 0; i<=N; i++){
		for(int j = 0; j<=W; j++){
			printf("%d ",dp[i][j]);
		}
		printf("\n");
	}*/
	printf("%d\n",dp[W]);
	return 0;
}


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

int main()
{
	int x,y;
	cin >> x >> y;
	rep(i,x+1)
	{
		if (2 * i + 4 * (x-i) == y)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

using namespace std;

int main() {
	int N;

	cin >> N;
	vector<int> A(N);
	
	for(int i = 0; i < N; i++) cin >> A[i];

	int r = 0;
	long long ans = 0;
	int now_sum = 0;
	int now_xor = 0;
	for (int l = 0; l < N; l++) {
		while (r < N && (now_sum + A[r]) == (now_xor ^ A[r])) {
			now_sum += A[r];
			now_xor ^= A[r];
			r++;
		}
		ans += r - l;
		now_sum -= A[l];
		now_xor ^= A[l];
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
const long long MOD = 1e9+7;
using namespace std;
#define ll long long
#define ar array
 
int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);

	string s;
	cin >> s;

	for (int i = 0; i < s.size(); i++) {
		if (s[2]==s[3] && s[4]==s[5]) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		break;
	}
	return 0;
}


Measured memory_bytes: 3548
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

flag = False
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if (j-1 >= 0 and s[i][j-1] == '.') and (j+1 < W and s[i][j+1] == '.') and (i-1 >= 0 and s[i-1][j] == '.') and (i+1 < H and s[i+1][j] == '.'):
                print('No')
                flag = True
                break
    if flag:
        break
else:
    print('Yes')

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

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

template<class T> inline T sqr(T x) {return x*x;}

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;

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

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

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

int main(void){
    string s,t; cin >> s >> t;
    pair<int,pair<int,int>> dp[s.size()+1][t.size()+1];
    REP(i,s.size()+1)REP(j,t.size()+1){
        dp[i][j].first = 0;
        dp[i][j].second.first = -1;
        dp[i][j].second.second = -1;
    }

    REP(i,s.size())REP(j,t.size()){
        if(s[i] == t[j]){
            dp[i+1][j+1].first = dp[i][j].first + 1;
            dp[i+1][j+1].second.first = i;
            dp[i+1][j+1].second.second = j;
        }
        else{
            if(chmax(dp[i+1][j+1].first, dp[i][j+1].first)){
                dp[i+1][j+1].second.first = i;
                dp[i+1][j+1].second.second = j+1;
            }
            if(chmax(dp[i+1][j+1].first, dp[i+1][j].first)){
                dp[i+1][j+1].second.first = i+1;
                dp[i+1][j+1].second.second = j;
            }
            
        }
    }
    string ans = "";
    int i = s.size(), j = t.size();
    while(i>0 && j>0){
        if(dp[i][j].second.first == i-1 && dp[i][j].second.second == j-1) ans = s[i-1] + ans;
        int tmp_i = i, tmp_j = j;
        i = dp[tmp_i][tmp_j].second.first; j = dp[tmp_i][tmp_j].second.second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 105856
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

template<class T>
ostream& operator<< (ostream& fout, const vector<T>& vec) {
  for (const auto& el : vec) {
    fout << el << ' ';
  }
  return fout;
}

template <class T>
istream& operator>> (istream& fin, vector<T>& vec) {
  for (size_t i = 0; i < vec.size(); ++i) {
    cin >> vec[i];
  }
  return fin;
}

int Solve() {
  int n;
  cin >> n;
  int z0 = 0, z2 = 0, z4 = 0;
  for (int i = 0; i < n; ++i) {
    int b;
    cin >> b;
    if (b % 2) {
      z0++;
    } else if (b % 4 == 0) {
      z4++;
    } else {
      z2++;
    }
  }
  if (z2 > 0) {
    z4 -= z0;
    if (z4 < 0) {
      std::cout << "No\n";
    } else {
      std::cout << "Yes\n";
    }
    return 0;
  } else {
    if (z4 >= z0 - 1) {
      std::cout << "Yes\n";
    } else {
      std::cout << "No\n";
    }
    return 0;
  }
  return 0;
}


int main() {
#ifndef LOCAL
  //freopen("input.txt", "rt", stdin);
  //freopen("output.txt", "wt", stdout);
#endif
#ifdef LOCAL
  //freopen("input.txt", "rt", stdin);
#endif

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}


Measured memory_bytes: 256
import numpy as np
def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    h = np.array(h)
    cost = np.empty(n)
    cost[0] = 0
    cost[1] = abs(h[1] - h[0])
    for i in range(2, n):
        j = min(i, k)
        cost[i] = np.min(cost[i-j:i] + np.abs(h[i-j:i] - h[i]))
    print(int(cost[-1]))
main()


Measured memory_bytes: 22748
INF = 10**9
def dfs(s, d, P):
    if len(s) > len(d):
        return INF
    if s == d:
        return 0
    if s in memo:
        return memo[s]
    res = INF
    for a, b in P:
        r = s.replace(a, b)
        if r != s:
            res = min(res, dfs(r, d, P)+1)
    memo[s] = res
    return res

while 1:
    n = input()
    if n==0:
        break
    P = [raw_input().split() for i in xrange(n)]
    g = raw_input()
    d = raw_input()
    memo = {}
    res = dfs(g, d, P)
    print res if res < INF else -1

Measured memory_bytes: 6456
package main

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

func main() {
	N, A, B := ReadInt(), ReadInt(), ReadInt()
	Xs := ReadInts(N)
	sum := 0
	for i := 1; i < N; i++ {
		dist := Xs[i] - Xs[i-1]
		sum += Min(A*dist, B)
	}
	fmt.Println(sum)
}

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

func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }


Measured memory_bytes: 4288
#include<stdio.h>
int main(void)
{
int n,i;
int a[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}
for(i=n-1;i>0;i--){
    printf("%d ",a[i]);
}
    printf("%d\n",a[0]);
    return 0;
}


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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;


int main(){
    ll a,v,b,w,t;
    cin>>a>>v>>b>>w>>t;

    if(v<=w){
        cout<<"NO"<<endl;
              return 0;
    }

    if(abs(a-b)<=(v-w)*t)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}


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

int main(int argc, char const *argv[])
{
    char c;
    int a, b, ans;
    while(true){
        cin >> a >> c >> b;
        switch(c){
            case '?':
                return 0;
            case '+':
                ans = a + b;
                break;
            case '-':
                ans = a - b;
                break;
            case '*':
                ans = a * b;
                break;
            case '/':
                ans = a / b;
                break;
            default:
                ans = 0;
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3092
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n";
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;

int main(){
	migmig;
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	s[k-1]+=32;
	cout<<s;
	return 0;
}




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

#include <sstream>
#include <bitset>

#include <cmath>

using namespace std;

int debug=0;

int main(){
    string S;
    cin >> S;
    int len1= S.length();
    vector<bitset<9>> Bit;
    vector<bitset<9>> Mask;
    
    // create bitmap
    // abc
    // len1=3
    // 00
    // 01
    // 10
    // 11
    int allnum = pow(2,len1-1);
    for(int i =0; i< allnum; ++i) {
        Bit.push_back(bitset<9>(i));
        //cout << Bit[i] << endl;
        //cout << static_cast<bitset<9>>(i) << endl;
    }

    // create bitmask
    // 01
    // 10
    for(int i=9; i>0;--i){
        int tmp;    
        tmp = pow(2,i-1);
        Mask.push_back(bitset<9>(tmp));
        // cout << static_cast<bitset<9>>(tmp) << endl;
    }

    // cout << "mask[0]=" << Mask[0] << endl;

    string st_num="";
    long long num1=0;
    long long sum=0;
    for(int i=0; i<allnum; ++i){
        // S="abc"
        // len1=3
        //
        // Bit[i] 
        // 0...00 -> abc
        // 1...01 -> ab+c
        // 2...10 -> a+bc
        // 3...11 -> a+b+c
        //
        // st_num ="c"
        // num=0
        bitset<9> bit1;
        string st1="x";
        bit1 = Bit[i];
        st1[0] = S[len1-1];
        // cout << "char..." << st1 <<endl;
        st_num = st1;
        //
        if(debug) cout << "Try Bit[i]" << bit1 <<endl;
        //
        for(int j=0;j<len1-1;++j){
            // 0...00 -> abc
            // 1...01 -> ab+c
            // 2...10 -> a+bc
            // 3...11 -> a+b+c
            // try bitmask
            // j=0 01
            // j=1 10
            // S="abc"
            // len1=3
            if(debug) cout << "st_num=" << st_num << ",sum=" << sum ;
            if(debug) cout << ",mask=" << Mask[9-1-j] << endl;
            // 
            bitset<9> bit2;
            bit2 = bit1 & Mask[9-1-j];
            if (bit2.any()){
                // found +
                num1 = stoll(st_num);
                //
                if(debug) cout <<"found +, st_num= " << st_num << endl;
                sum += num1;

                string st2="x";
                st2[0] = S[len1-1-j-1];
                st_num= st2;

            }else {
                string st3="x";
                st3[0] =S[len1-1-j-1];
                st_num = st3 + st_num;
            }
        } 
        //
        if(debug)cout << "st_num=" << st_num << ",sum=" << sum <<endl;
        // 
        if (st_num != ""){
            num1 = stoll(st_num);
            sum += num1;
            st_num="";
        }
    }

    cout << sum << endl;


}

Measured memory_bytes: 384
N,K =map(int,input().split())
n = 0
ans = 0
L = K-1
R = N
while True:
    if L < N:
        break
    else:
        n += 1
        R = L
        L = R//2

if R > N:
    R=N

while True:
    foo = R-L
    foo /= 2**n
    ans += foo
    if L==1:
        ans += 1/(2**(n+1))
        break
    if L ==0:
        break
    R = L
    L =R//2
    n += 1
print(ans/N)

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;

#define sync std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define loopi(n) for(int i=0;i<n;i++)
#define loopj(n) for(int j=0;j<n;j++)
#define loop(a,b,c) for(int i=a;i<=b;i=i+c)

#define     deb(x)      cout<<#x<<"="<<x<<endl
#define     all(x)      (x).begin(),(x).end()
#define     reset(a)    memset(a,0,sizeof(a))
#define     sz(x)       ((int)(x.size()))
#define     pb          push_back
#define     pf          push_front
#define     pob	        pop_back
#define     pof         pop_front
#define     ins         insert
#define     F           first
#define     S           second
#define     mkp         make_pair
#define     mkt         make_tuple
#define     bitcount(x) __builtin_popcountll(x)
#define     gcd(a,b)    (__gcd(a,b))
#define     lcm(a,b)    ((a*b)/gcd(a,b))
#define PI 3.1415926535897932384626
 
const int mod = 1e9+7;
const int N = 1e5+5;

//==========================================//

void solve()
{
	int n,x,t;
	cin>>n>>x>>t;
	int ans=(n/x+(n%x?1:0));
	cout<<ans*t;
}
int main()
{
	sync;

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
		cout<<endl;
	}
}


Measured memory_bytes: 3656
#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>;

// Sieve of Eratosthenes
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

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

  Sieve s(1000005);
  auto fs = s.factor(n);

  int ans = 0;
  for (auto p : fs) {
    int x = p.second;
    int b = 1;
    while (b <= x) {
      x -= b;
      b++;
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

int main() {
	int N; cin >> N;
	vll L(N), R(N);
	for (int i = 0; i < N; i++) cin >> L[i] >> R[i];	
	multiset<ll> ls, rs;
	ll ofl = 0, ofr = 0;

	ls.insert(L[0]);
	rs.insert(L[0]);

	ll ret = 0;	
	for (int i = 1; i < N; i++) {
		ofl -= (R[i] - L[i]);
		ofr += (R[i-1] - L[i-1]);

		if (*begin(rs)+ofr < L[i]) ret += L[i] - (*begin(rs)+ofr);
		if (L[i] < *rbegin(ls)+ofl) ret += (*rbegin(ls)+ofl) - L[i];

		if (*begin(rs)+ofr < L[i]) {
			ls.insert(*begin(rs)+ofr-ofl);
			rs.insert(L[i]-ofr);
			rs.insert(L[i]-ofr);
			rs.erase(begin(rs));	
		} else if (L[i] < *rbegin(ls)+ofl) {
			rs.insert(*rbegin(ls)+ofl-ofr);
			ls.insert(L[i]-ofl);
			ls.insert(L[i]-ofl);
			ls.erase(--end(ls));
		} else {
			rs.insert(L[i]-ofr);
			ls.insert(L[i]-ofl);
		}
	}
	cout << ret << endl;
	return (0);
}


Measured memory_bytes: 11136
a,b,c,d = map(int, input().split())

import fractions

def lcm(x, y):
    return int((x * y) / fractions.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)


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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    ll n, m;
    cin >> n >> m;
    ll ans = min(m/2, n);
    if (n < m/2) ans = max(ans, (m+2*n)/4);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3588
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int x = in.Int();
            out.println(1 - x);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 32712
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,d;
  int count=0;
  cin>>a>>b>>c>>d;
  for(int i=0;i<a+1;++i){
    for(int j=0;j<b+1;++j){
      for(int k=0;k<c+1;++k){
        int e=i*500+j*100+k*50;
        if(e==d){
          ++count;
        }
      }
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
num = int(input())
input_list = input().split()

cnt = 0
flag = True
while(flag):
    for i in range(num):
        if int(input_list[i]) % 2 == 1 or int(input_list[i]) == 0:
            flag = False
        else:
            input_list[i] = int(input_list[i]) / 2
    if flag == True:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
  int a,b,c,d,e,k;
  cin>>a>>b>>c>>d>>e>>k;
  bool connect=true;
  if(b-a>k||c-a>k||d-a>k||e-a>k||c-b>k||d-b>k||e-b>k||d-c>k||e-c>k||e-d>k){
      connect=false;
  }
  if(connect==true){
      cout<<"Yay!"<<endl;
  }
  else{
      cout<<":("<<endl;
  }
  
}

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

int fatoi(char s[], int p){
  int temp = 0;
  int i;
  for(i = 0;s[i] != '\0';++i){
    if(s[i] != '.'){
      temp *= 10;
      temp += s[i] - '0';
    }
  }
  // temp /= pow(10.0, (strlen(s) - (p + 1)));
  return temp;
}

int atoi2(char s[]){
  int temp1 = 0;
  for(int i = 0;s[i] != ')';++i){
    if(s[i] != '(' && s[i] != '.'){
      temp1 *= 10;
      temp1 += s[i] - '0';
    }
  }
  int temp2 = 0;
  for(int i = 0;s[i] != '(';++i){
    if(s[i] != '.'){
      temp2 *= 10;
      temp2 += s[i] - '0';
    }
  }
  // cout << temp1 << "-" << temp2 << endl;
  return temp1 - temp2;
}

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

  char s[15];
  cin >> s;
  int piriod_p = 0;
  bool flag = false; // "("が含まれているならtrue
  for(int i = 0;s[i] != '\0' && !flag;++i){
    if(s[i] == '('){
      flag = true;
    }else if(s[i] == '.'){
      piriod_p = i;
    }
  }

  if(!flag){
    int temp;
    temp = fatoi(s, piriod_p);
    /*
      for(int i = 0;i < strlen(s) - (piriod_p + 1);++i){
      temp *= 10;
      }
    */
    double mot = pow(10, strlen(s) - (piriod_p + 1));
    int ans_mot = (int)mot;
    int g = __gcd(ans_mot, temp);
    cout << temp / g << '/' << ans_mot / g << endl;
  }else{
    int p1 = 0;
    int p2 = 0;
    for(int i = piriod_p;s[i] != ')';++i){
      if(s[i] >= '0' && s[i] <= '9'){
	++p1;
      }
    }
    for(int i = piriod_p;s[i] != '(';++i){
      if(s[i] >= '0' && s[i] <= '9'){
	++p2;
      }
    }
    /*
      cout << "p1 = " << p1 << endl;
      cout << "p2 = " << p2 << endl;
    */
    int mot = (int)pow(10, p1) - (int)pow(10, p2);
    int chi = atoi2(s);
    // 約分
    int g = __gcd(chi, mot);
    cout << chi / g << "/" << mot / g << endl;
  }
  return 0;
}



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

int main() {
    int N; cin >> N;
    vector<int64_t> A(N);
    for(auto &e : A) cin >> e;
    int64_t sum = accumulate(A.begin(), A.end(), 0LL);
    for(int i = 0; i < N - 1; ++i) A[i + 1] = max(A[i + 1], A[i]);
    int64_t ans = accumulate(A.begin(), A.end(), 0LL) - sum;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int n;
     cin >> n;
     if(n<1000)  cout << "ABC" << endl;
     else cout << "ABD" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int next = 0;
        int count = 0;
        int past[] = new int[100000]; 
        Arrays.fill(past, 0);
        while (true) {
            if (next == 1) {
                System.out.println(count);
                return;
            }

            if (past[next] == 1) {
                System.out.println(-1);
                return;
            }

            past[next] = 1;
            next = a[next] - 1;
            count++;
        }
    }
}


Measured memory_bytes: 50548
# D - String Formation
from collections import deque


def main():
    S = input().rstrip()
    Q = int(input())
    queue = deque(S)
    to_beginning, to_end = queue.appendleft, queue.append
    is_reversed = 0
    for _ in range(Q):
        query = input().split()
        if query[0] == "1":
            to_beginning, to_end = to_end, to_beginning
            is_reversed ^= 1
            continue
        com, c = query[1], query[2]
        if com == "1":
            to_beginning(c)
        else:
            to_end(c)
    ans = "".join(queue)
    if is_reversed:
        ans = ans[::-1]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8820
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,x,y,z,n=0,m=0,l=0;
	char a[4][101];
	for(i=1;i<=3;i++){
		scanf("%s",a[i]);
	}
	i=1;
	x=strlen(a[1]);
	y=strlen(a[2]);
	z=strlen(a[3]);
	while(1){
		if(x+1==n || y+1==m || z+1==l){
			break;
		}
		if(i==1){
			if(a[i][n]=='b'){
				i=2;
			}
				else if(a[i][n]=='c'){
					i=3;
				}
			if(n==x){
				printf("A\n");
			}
			n++;
		}
			else if(i==2){
				if(a[i][m]=='a'){
					i=1;
				}
					else if(a[i][m]=='c'){
						i=3;
					}
				if(m==y){
					printf("B\n");
				}
				m++;
			}
				else if(i==3){
					if(a[i][l]=='a'){
						i=1;
					}
						else if(a[i][l]=='b'){
							i=2;
						}
					if(l==z){
						printf("C\n");
					}
					l++;
				}
	}
	return 0;
}

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

using namespace std;

const int MAXK = 1E5;
const int MAXN = 100;
int a[MAXN];
bool win[MAXK + 1];

int main()
{
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    win[0] = false;
    for (int i = 1; i <= k; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (a[j] <= i && !win[i - a[j]])
                win[i] = true;
        }
    }
    cout << (win[k] ? "First" : "Second") << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    string st;
    cin>>st;
    ll flag=0;
    ll len=st.length();
    for(int i=0;i<len;i++)
    {
        if(st[i]==st[i+1])
            {
                cout<<"Bad"<<endl;
                return 0;
            }
    }

        cout<<"Good"<<endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

for i, key in enumerate(A):
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    
    print(" ".join(map(str, A)))

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

int gcd(int m, int n)
{
    if (m < n)
    {
        int tmp = m;
        m = n;
        n = tmp;
    }

    while (1)
    {
        int mod = m % n;
        if (mod == 0)
            return n;
        m = n;
        n = mod;
    }
}

int main(void)
{
    int k, ans = 0;
    cin >> k;

    for (int i = 1; i <= k; i++)
        for (int j = 1; j <= k; j++)
            for (int l = 1; l <= k; l++)
                ans += gcd(gcd(i, j), l);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,k;
vector<int> d;
string s;

void solve(){
    cin >> n >> k;
    cin >> s;
    int p=1;
    int ans=0;
    rep(i,n){
        if (i>=1){
            if (s[i]!=s[i-1]) p+=1;
            else ans+=1;
        }
    }
    rep(i,k){
        //cout << p << " " << ans << endl;
        if (p>=3) {
            p-=2;
            ans+=2;
        }
        else if (p==2){
            p-=1;
            ans+=1;
        }
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 512