akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

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

    cout << (k * 500 >= x ? "Yes" : "No");

    return 0;
}


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

int main(){
  long long int N,D;
  long long int A[2000001];
  long long int B[2000001];
  cin >> N >>D;
  int counter = 0;
  for(int i=0; i<N ;++i){
    cin >> A[i] >> B[i];
    if(A[i]*A[i]+B[i]*B[i]<=D*D) counter = counter +1;
  }
  cout << counter <<endl;
}

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

using ll = long long;
using namespace std;

bool f;
ll n, ans;

int main(){
	cin >> n;
	ans = (n/11);
	n -= ans*11;
	ans *= 2;
	while(n > 0){
		if(f){
			n -= 5;
			ans++;
		}else{
			n -= 6;
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int MOD(int a, int p){
	int ans = a % p;
	if(ans < 0){
		ans += p;
	}
	return ans;
}

int main(){
	int H, W, d, i, j;
	scanf("%d%d%d", &H, &W, &d);
	char **A = (char **)malloc(sizeof(char *) * H);
	for(i = 0; i < H; i++){
		A[i] = (char *)malloc(sizeof(char) * W);
	}
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			if(MOD(i + j, 2 * d) < d){
				if(MOD(i - j, 2 * d) < d){
					A[i][j] = 'R';
				}
				else{
					A[i][j] = 'Y';
				}
			}
			else{
				if(MOD(i - j, 2 * d) < d){
					A[i][j] = 'G';
				}
				else{
					A[i][j] = 'B';
				}
			}
		}
	}
	for(i = 0; i < H; i++){
		for(j = 0; j < W; j++){
			printf("%c", A[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, d; cin >> n >> d;
    vector<vector<int>> Z(n);
    REP(i, n){
        REP(j, d){
            int tmp;
            cin >> tmp;
            Z[i].push_back(tmp);
        }
    }
    int ans = 0;
    REP(i, n){
        FOR(j, i + 1, n){
            int sqr = 0;
            REP(k, d) sqr += pow(Z[i][k] - Z[j][k], 2);
            for(int k = 1; k <= sqr; k++){
                if(k * k == sqr){
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

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



lli knapSack(lli W, lli wt[], lli val[], lli n) 
{ 
    lli i, w; 
    lli K[n + 1][W + 1]; 
  
    // Build table K[][] in bottom up manner 
    for (i = 0; i <= n; i++) { 
        for (w = 0; w <= W; w++) { 
            if (i == 0 || w == 0) 
                K[i][w] = 0; 
            else if (wt[i - 1] <= w) 
                K[i][w] = max( 
                    val[i - 1] + K[i - 1][w - wt[i - 1]], 
                    K[i - 1][w]); 
            else
                K[i][w] = K[i - 1][w]; 
        } 
    } 
  
    return K[n][W]; 
} 
  
int main() {
    lli n, W;
    cin>>n>>W;
    lli wt[n], val[n];
    
    for(lli i =0;i<n;i++){
        cin>>wt[i];
        cin>>val[i];
        
    }
   cout<<knapSack(W, wt, val ,n)<<endl;
	return 0;
}

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


using namespace std;

int main() {
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    string ans;
    for(int i=0;i<n;i++){
        ans.push_back(s1[i]);
        ans.push_back(s2[i]);
        
    }
    cout<<ans;
}

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

const int N = 2e5 + 10, mod = 1e9 + 7;

char s[N];

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    //scanf("%d", &tc);
    while(tc--) {
        scanf("%s", &s);
        int n = strlen(s);
        vector<int> cnt(2019, 0);
        int m = 0;
        cnt[0] = 1;
        long long ans = 0;
        for(int i = 0; i < n; i++) {
            m = (10 * m + s[i] - '0') % 2019;
            vector<int> tmp(2019, 0);
            for(int j = 0; j < 2019; j++) tmp[j * 10 % 2019] += cnt[j];
            cnt = tmp;
            ans += cnt[m];
            cnt[m]++;
        }
        printf("%lld\n", ans);
    }    
    return 0;
}

Measured memory_bytes: 3924
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <climits>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll sum=0;
	int N;
	cin>>N;
	vector<ll> A(N);
	for(int i=0;i<N;i++){
		cin>>A[i];
		sum+=A[i];
	}
	vector<ll> B(N+1),C(N+1);
	B[0]=0;
	C[0]=0;
	ll guu=0,kisu=0;
	for(int i=0;i<N;i++){
		if(i%2==0) guu+=A[i];
		else kisu+=A[i];
		B[i+1]=guu;
		C[i+1]=kisu;
	}
	//for(int i=0;i<N+1;i++) cout<<C[i]<<" ";
	for(int i=0;i<N;i++){
		ll tmp=0;
		if(i%2==0){
			tmp+=B[N]-B[i];
			tmp+=C[i+1]-C[0];
			tmp-=(sum-tmp);
		}else{
			tmp+=C[N]-C[i];
			tmp+=B[i+1]-B[0];
			tmp-=(sum-tmp);
		}
		cout<<tmp<<" ";
	}
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
//#include <queue>
using namespace std;
#define MAX 10
typedef vector<int> vec;

int w, h, c;
//int model[MAX][MAX];
int cnt;
//queue<pair<int, int> > que;

int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};


int change( int cp[MAX][MAX], int x, int y, int prev, int color ){
    cp[y][x] = color;
    //cout << h << w << endl;
    int count = 1;
    for( int i = 0; i < 4; i++ ){
        int nx = x+dx[i], ny = y+dy[i];
        if( 0 <= nx && nx < w && 0 <= ny && ny < h && cp[ny][nx] == prev ){
            count += change( cp, nx, ny, prev, color );
        }
    }
    //cout << count <<endl;
    return count;
}

void bfs( int cp[MAX][MAX], int n ){
    //if( n > 5 ) return;
    int ncp[MAX][MAX], count;
    for( int i = 1; i <= 6; i++ ){
        if( i == cp[0][0] ) continue;
        if( n == 5 && i != c ) continue;
        for( int j = 0; j < h; j++ ){
            for( int k = 0; k < w; k++ ){
                ncp[j][k] = cp[j][k];
            }
        }
        change( ncp, 0, 0, ncp[0][0], i );
        //cout << n << endl;
        if( n < 5 ){
            bfs( ncp, n+1 );
        }else{
            count = change( ncp, 0, 0, ncp[0][0], 0 );
            //cout << count << endl;
            if( cnt < count ) cnt = count;
        }
    }
}


int main(){
    int map[MAX][MAX];
    while(cin >> h >> w >> c, h || w || c){
        for( int i = 0; i < h; i++ ){
            for( int j = 0; j < w; j++ ){
                cin >> map[i][j];
            }
        }
        cnt = 0;
        bfs( map, 1 );
        cout << cnt << endl;
    }
}

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

int main() {
  int n, c, k;
  cin >> n >> c >> k;
  vector<ll> t(n);
  rep(i,n) cin >> t[i];
  
  sort(t.begin(),t.end());
  t.push_back(3e9);
  
  int i = 0;
  int bus = 0;
  while(i < n){
    rep(j,n + 1){
      if(t[i] + k < t[i + j]){
        bus++;
        i += min(c,j);
        break;
      }
    }
  }
  cout << bus << endl;

}



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

ll INF = 1e+18;
int iINF = 1e9;

vector<ll> memo(51, 0);

int 
main()
{
  int H, N; cin >> H >> N;
  vector<pair<int, int>> magic(N);
  rep(i, 0, N) cin >> magic[i].first >> magic[i].second;
  vector<vector<ll>> dp(N + 1, vector<ll>(H + 1, 0));
  rep(h, 1, H + 1){
    if(h / magic[0].first < 1){
      dp[0][h] = magic[0].second;
    } else if(h % magic[0].first == 0) {
      dp[0][h] = (h / magic[0].first) * magic[0].second;
    } else {
      dp[0][h] = (floor(h / magic[0].first) + 1) * magic[0].second;
    }
  }
  rep(i, 1, N){
    rep(h, 0, H + 1){
      if(h / magic[i].first < 1){
        dp[i][h] = magic[i].second;
      } else if(h % magic[i].first == 0) {
        dp[i][h] = (h / magic[i].first) * magic[i].second;
      } else {
        dp[i][h] = (floor(h / magic[i].first) + 1) * magic[i].second;
      }
      if(dp[i][h] > dp[i - 1][h]) dp[i][h] = dp[i - 1][h];
      if(h - magic[i].first >= 0){
        if(dp[i][h] > magic[i].second + dp[i][h - magic[i].first]) dp[i][h] = magic[i].second + dp[i][h - magic[i].first];
      }
    }
  }

  cout << dp[N - 1][H] << endl;

}

Measured memory_bytes: 81568
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N, A, B;
int main() {
    cin >> N >> A >> B;
    cout << min(N*A, B) << endl;
}

Measured memory_bytes: 256
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#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<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007ll
using namespace std;
int n;
ll jc[5005];
vector<ll> v[5005];
vector<ll> dfs(int x,int y){
    vector<ll> v1;
    v1.pb(0),v1.pb(1);
    for(int i=0;i<v[x].size();++i){
        if(v[x][i]==y) continue;
        int z=v[x][i];
        vector<ll> v2=dfs(z,x);
        vector<ll> v3(v1.size()+v2.size()-1);
        for(int j=0;j<v1.size();++j){
            for(int k=0;k<v2.size();++k)(v3[j+k]+=v1[j]*v2[k])%=orz;
        }
        v1=v3;
    }
    for(int i=2;i<v1.size();++i)(v1[0]-=v1[i]*jc[i])%=orz;
    v1[0]=(v1[0]+orz)%orz;
    return v1;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<n;++i){
        int x,y;
        scanf("%d%d",&x,&y);
        v[x].pb(y),v[y].pb(x);
    }
    jc[0]=1;
    for(int i=2;i<=n;i+=2)jc[i]=jc[i-2]*(i-1ll)%orz;
    dfs(1,0);
    printf("%lld\n",(orz-dfs(1,0)[0])%orz);
	//system("pause");
	return 0;
}


Measured memory_bytes: 1280
#print('Enter values!!')
abc = int(input())
arc = int(input())
agc = int(input())
apc = int(input())
atc = int(input())

food_time = [abc, arc, agc, apc, atc]
sort_time = [0, 0, 0, 0, 0]
total_time = 0


for i in range(5):
    sort_time[i] = food_time[i] % 10
    if food_time[i] % 10 == 0:
        total_time += food_time[i]
    else:
        a = food_time[i] // 10
        a = a * 10 + 10
        total_time += a

sort_time.sort()

for j in range(5):
    if sort_time[j] != 0:
        b = 10-sort_time[j]
        total_time -= b
        break

print(total_time)

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

Measured memory_bytes: 2940
N=int(input())
S=input()

right=[[0]*(N+1) for _ in range(3)]
dic={'R':0,'G':1,'B':2}

for i in range(N,0,-1):
    for j in range(3):
        right[j][i-1]=right[j][i]

    c=S[i-1]
    right[dic[c]][i-1]+=1

cnt=0

for i in range(N-2):
    for j in range(i,N-1):
        a=S[i]
        b=S[j]
        if a==b:
            continue
        k=0
        while dic[a]==k or dic[b]==k:
            k+=1
        
        if 2*j-i<N and dic[S[2*j-i]]==k:
            cnt+=right[k][j+1]-1
        else:
            cnt+=right[k][j+1]
            

print(cnt)

Measured memory_bytes: 69400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC011ColorfulCreatures
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] A = new long[N];
            string[] vals = Console.ReadLine().Split(' ');
            for(int i=0; i < N; i++)
            {
                A[i] = long.Parse(vals[i]);
            }

            Array.Sort(A);
            long[] cum = new long[N];
            cum[0] = A[0];
            for (int i=1; i < N; i++)
            {
                cum[i] = cum[i - 1] + A[i];
            }

            int smallest;
            for(smallest=N-2; smallest >= 0; smallest--)
            {
                if(cum[smallest] * 2  < A[smallest+1])
                {
                    break;
                }
            }

            if(smallest < 0)
            {
                Console.WriteLine(N);
            }
            else
            {
                Console.WriteLine(N - smallest - 1);
            }

        }
    }
}


Measured memory_bytes: 30428
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long n,m; cin>>n>>m;
    if(m%n==0) cout<<m/n<<endl;
    else{
        for(int i=(m+n-1)/n;i>=0;i--){
            if(m%i==0){
                if(i*n<=m){
                    cout<<i<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        sc.close();

        boolean f = false;
        int i = 0;
        for (i=N; i>0; i--) {
            int M = (int)(i*1.08);
            if (N==M) {
                f=true;
                break;
            } else if (N>M) {
                break;
            }
        }
        if (f) 
            System.out.println(i);
        else
            System.out.println(":(");
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}			
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int A,B;
	cin >> A>>B;
	if (A % 2 != 0 & B % 2 != 0) {
		cout << "Odd" << endl;
	} else {
		cout << "Even" << endl;
	}
}


Measured memory_bytes: 256
N,Y = map(int,input().split())
Y /= 1000

T = int(Y // 10)
F = int(Y // 5)

for t in range(T+1):
  for f in range(F+1):
    o = N - t - f
    if o < 0:
      break
    if 10*t + 5*f + o == Y:
      print(t,f,o)
      exit()
print(-1,-1,-1)


Measured memory_bytes: 42092
from fractions import gcd
from functools import reduce

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

N = int(input())
a = list(map(int,input().split()))

res = 0
tmp = reduce(lcm,a)-1
for i in a:
    res += tmp % i
print(res)

Measured memory_bytes: 5372
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <numeric>
#include<vector>

#define LL long long
#define MOD 1000000007

using namespace std;

LL gcd(LL C, LL D) {
	if (C < D) gcd(D, C);

	if (C%D == 0)return D;
	else gcd(D, C%D);
}
int main() {

	string S;
	cin >> S;
	for (int i = 0; i < S.length()-1; i++) {
		if (S[i] == S[i + 1]) {
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

const LL mod = 1e9 + 7;
LL dp[2010][2010];

void make_comb() {
  for (int i = 0; i <= 2000; i ++) {
    for (int j = 0; j <= 2000; j ++) dp[i][j] = 0;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= 2000; i ++) {
    for (int j = 0; j <= i; j ++) {
      if (j == 0) dp[i][j] = dp[i - 1][j];
      else if (j == i) dp[i][j] = dp[i - 1][j - 1];
      else dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % mod;
    }
  }
}

int main() {
  int n, k;
  cin >> n >> k;

  make_comb();

  for (int i = 1; i <= k; i ++) {
    cout << dp[n - k + 1][i] * dp[k - 1][i - 1] % mod << endl;
  }
}

Measured memory_bytes: 31616
import sys

dict = {}
n = int(input())
l = []
line = map(lambda x:x.split(), sys.stdin.readlines())
s = ""
for (c,arg) in line:
    if c == "insert":
        dict[arg] = 0
    elif c == "find":
        if arg in dict:
            s += "yes\n"
        else:
            s += "no\n"
print(s,end="")

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

int main(){
    ll n,m,sum = 0;
    cin >> n >> m;
    vector<ll> a(m);
    rep(i,m) {
        cin >> a[i];
        sum += a[i];
    }
    if (n >= sum)cout << n - sum << endl;
    else cout << -1 << endl;
}

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

int main() {
  ll N; cin>>N;
  map<ll, ll> P;
  for(ll i=0; i<N; i++){
    ll a; cin>>a;
    if(P.count(a)) P.erase(a);
    else P[a]=1;
  }
  ll count=0;
  for(auto x:P) count++;
  cout<<count<<endl;
}


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

int main() {
    int n, k;
    cin >> n >> k;

    auto counter = vector<int>(n + 10);
    for (int i = 1; i <= k; i++) {
        int d;
        cin >> d;
        for (int j = 1; j <= d; j++) {
            int a;
            cin >> a;
            counter[a]++;
        }
    }

    auto cnt = 0;
    for (int i = 1; i <= n; i++) {
        if (counter[i] == 0)
            cnt++;
    }

    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <set>
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	std::string ans = "No";
	int c[4][4] = {0};
	for ( int i = 1 ; i <= 3 ; i++ ) {
		for ( int ii = 1 ; ii <= 3 ; ii++ ) {
			std::cin >> c[i][ii];
		}
	}
	for ( int i = 0 ; i <= 100 ; i++ ) {
		int a1,a2,a3,b1,b2,b3;
		a1 = i;
		b1 = c[1][1] - a1;
		b2 = c[1][2] - a1;
		b3 = c[1][3] - a1;
		a2 = c[2][1] - b1;
		a3 = c[3][1] - b1;
		if ( c[2][2]==a2+b2 && c[2][3]==a2+b3 && c[3][2]==a3+b2 && c[3][3]==a3+b3){
			ans = "Yes";
			break;
		}
	}
	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
  "fmt"
)


func get() (int, int) {
  var n, m int
  fmt.Scan(&n)
  fmt.Scan(&m)
  return n, m
}


func main() {
  n, m := get()
  if n < m {
    a := n + ((m - (n * 2)) / 4)
    fmt.Println(a)
  } else {
    a := (m / 2)
    fmt.Println(a)
  }
}


Measured memory_bytes: 512
//coded by: pranonrahman-------------------------------------
//-----------------------------------------------------------
//-----------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define O_O ios_base::sync_with_stdio(0); cin.tie(NULL)
#define endl '\n'
#define PI acos(-1.0)
#define CASE(n) cout << "Case " << n << ": "
#define CASE_(n) cout << "Case " << n << endl
#define FIXED(n) cout << fixed << setprecision(n)
#define testPrint(n) cout << "test" << n << endl;


int main()
{
    O_O;
    long long t=1;
    //cin >> t;
    long long T = t;
    while(t--)
    {
        //write your code here
        long long n;
        cin >> n;

        string s = "abcdefghijklmnopqrstuvwxyz";
        string temp = "";
        long long p=26;
        while(n)
        {
            n--;
            long long res = (n)%26;
            n/=p;
            temp.push_back(s[res]);
        }
        reverse(temp.begin(),temp.end());
        cout << temp << endl;
    }
        return 0;
}





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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b)) < EPS)


using namespace std;

const int IINF = INT_MAX;

// Library

class Point{
public:
  double x,y;
  Point(double x = -IINF,double y = -IINF): x(x),y(y){}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
};

double norm(Point a){ return a.x*a.x+a.y*a.y; }
double abs(Point a){ return sqrt(norm(a)); }

struct Circle{
  Point p;
  double r;
  Circle(Point p=Point(),double r=IINF):p(p),r(r){}
};

pair<Point, Point> intersectCC( Point C1, double r1, Point C2, double r2) {
  complex<double> c1(C1.x,C1.y);
  complex<double> c2(C2.x,C2.y);
  complex<double> A = conj(c2-c1), B = (r2*r2-r1*r1-(c2-c1)*conj(c2-c1)), C = r1*r1*(c2-c1);
  complex<double> D = B*B-4.0*A*C;
  complex<double> z1 = (-B+sqrt(D))/(2.0*A)+c1, z2 = (-B-sqrt(D))/(2.0*A)+c1;
  return pair<Point, Point>(Point(z1.real(),z1.imag()),Point(z2.real(),z2.imag()));
}

// Library

bool insideCC(Circle a,Circle b){
  double d = sqrt(norm(a.p-b.p));
  double r1 = max(a.r,b.r);
  double r2 = min(a.r,b.r);
 
  if(!equals(d,r1-r2) && d < r1-r2) return a.r < b.r; 
  return false;
}

bool insideCP(Circle c,Point p){
  double dist = abs(c.p-p);
  return equals(dist,c.r) || dist < c.r;
}

int n;
Point ps[11];
double ls[11];

bool check(double h){
  vector<Circle> cs;
  bool out[n];
  rep(i,n) out[i] = false;

  rep(i,n) {
    if( equals(h,ls[i]) || h >= ls[i] ) return false;
    rep(j,n){
      if( i == j ) continue;
      double r1 = sqrt( pow(ls[i],2) - pow(h,2) ), r2 = sqrt( pow(ls[j],2) - pow(h,2) );
      if(insideCC((Circle){ps[i],r1},(Circle){ps[j],r2})) out[j] = true;
    }
  }

  rep(i,n) if( !out[i] ) {
    double r = sqrt( pow(ls[i],2) - pow(h,2) );
    cs.push_back(Circle(ps[i],r));
  }

  if( cs.size() == 1 ) return true;
  vector<Point> cps;

  rep(i,cs.size()) REP(j,i+1,cs.size()){
    pair<Point,Point> pp = intersectCC(cs[i].p,cs[i].r,cs[j].p,cs[j].r);
    cps.push_back(pp.first);    
    cps.push_back(pp.second);
  }

  rep(i,cps.size()){
    rep(j,cs.size()) if( !insideCP(cs[j],cps[i]) ) goto Skip;
    return true;
  Skip:;
  }
  return false;
}

int main(){
  while( cin >> n, n ){
    rep(i,n) cin >> ps[i].x >> ps[i].y >> ls[i];

    double L = 0, R = 1e10;
    rep(_,60){
      double M = ( L + R ) * 0.5;
      if( check(M) ) L = M;
      else           R = M;
    }
    printf("%.7f\n",R);
  }
  return 0;
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

int main(){

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

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

    int s = a+b+c;

    if(s >= 22) {
        cout<<"bust"<<endl;
    } else cout<<"win"<<endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
using P = pair<int,int>;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main(){
  int n;
  cin >> n;
  int p[n*n];
  rep(i,n*n) {
    cin >> p[i];
    p[i]--;
  } 
  int h[n][n];
  bool u[n][n];
  rep(i,n) rep(j,n) u[i][j] = false;
  rep(i,n) rep(j,n) h[i][j] = min({i,j,n-1-i,n-1-j});
  int ans = 0;
  rep(i,n*n) {
    int x = p[i]/n, y = p[i] % n;
    ans += h[x][y];
    u[x][y] = true;
    queue<P> que;
    que.push(P(x,y));
    while(!que.empty()){
      P pos = que.front();
      que.pop();
      rep(j,4) {
        int nx = pos.first + dx[j], ny = pos.second + dy[j];
        if(nx >= 0 && nx < n && ny >= 0 && ny < n) {
          if(u[pos.first][pos.second] and h[nx][ny] > h[pos.first][pos.second]) {
            h[nx][ny] = h[pos.first][pos.second];
            que.push(P(nx,ny));
          } else if(!u[pos.first][pos.second] and h[nx][ny] > h[pos.first][pos.second] + 1) {
            h[nx][ny] = h[pos.first][pos.second] + 1;
            que.push(P(nx,ny));
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5768
#include<iostream>
#include<queue>

int main() {
	int h, w;
	std::cin >> h >> w;
	char **s = new char*[h];
	char *base = new char[h*(w + 1)];
	int **score = new int*[h];
	int *base2 = new int[h*w];
	for (int i = 0; i < h; i++) {
		s[i] = &base[i*(w + 1)];
		score[i] = &base2[i*w];
		std::cin >> s[i];
		for (int j = 0; j < w; j++) {
			score[i][j] = -1;
		}
	}

	std::queue<std::pair<int,int>>Q;
	Q.push(std::make_pair(0, 0));
	score[0][0] = 1;
	int dx[4] = { 0,0,1,-1 };
	int dy[4] = { 1,-1,0,0 };
	while (!Q.empty()) {
		int x = Q.front().first;
		int y = Q.front().second;
		Q.pop();
		for (int i = 0; i < 4; i++) {
			//printf("a\n");
			int a = x + dx[i];
			int b = y + dy[i];
			if (a < 0 || b < 0 || a >= w || b >= h)continue;
			if (s[b][a] == '#'||score[b][a]!=-1)continue;
			score[b][a] = score[y][x] + 1;
			Q.push(std::make_pair(a, b));
		}
	}
	/*for (int i = 0; i < h*w; i++) {
		printf("%d", score[i / w][i%w]);
		if (i%w == w - 1)printf("\n");
	}*/

	int numSpace = 0;
	for (int i = 0; i < h*w; i++) {
		if (s[i / w][i%w] != '#')numSpace++;
	}
	//printf("%d\n", numSpace)
	printf("%d\n", score[h - 1][w - 1] == -1 ? -1 : numSpace - score[h - 1][w - 1]);

	//system("pause");
}

Measured memory_bytes: 256
n = int(input())
a = input().split()
a = [int(i) for i in a]
b = input().split()
b = [int(i) for i in b]

sum = 0
attack = 0
mons = a[0]
for i in range(n):
  if mons >= b[i]:
    sum += b[i]
    mons = a[i+1]
  else:
    sum += mons
    attack = b[i] - mons
    mons = max(0, a[i+1] - attack)
    sum += (a[i+1] - mons)

print(sum)    

Measured memory_bytes: 18348
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back


int main()
{
   ll n,m,k,i,j,x,l,a,b,c,d,y;
  
   vector<pair<ll,ll>> v;

   cin>>n;
   for(i=0;i<n;i++)
      {
         cin>>x>>y;
         v.pb({y,x});
      }

      sort(v.begin(),v.end());
      ll tmp=0;
      for(i=0;i<n;i++)
      {
            tmp+=v[i].second;
            if(tmp>v[i].first)
            {
               cout<<"No";
               return 0;
            }
      }

      cout<<"Yes";
}     


Measured memory_bytes: 6520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>P;
char mp[55][55];
ll flg[55][55];

ll dx[4] = {0, 1, 0, -1};
ll dy[4] = {1, 0, -1, 0};

int main(){
    for(ll i = 0; i < 55; i++){
        for(ll j = 0; j < 55; j++){
            mp[i][j] = '#';
            flg[i][j] = -1;
        }
    }
    
    ll H, W;
    cin >> H >> W;
    ll cnt = 0;
    for(ll y = 1; y <= H; y++){
        for(ll x = 1; x <= W; x++){
            cin >> mp[y][x];
            if(mp[y][x] == '.'){
                cnt++;
                flg[y][x] = 114514;
            }
        }
    }
    queue<P>Q;
    flg[1][1] = 1;
    Q.push(P(1, 1));
    while(!Q.empty()){
        ll x = Q.front().first;
        ll y = Q.front().second;
        Q.pop();
        for(ll i = 0; i < 4; i++){
            ll yy = y + dy[i];
            ll xx = x + dx[i];
            if(flg[yy][xx] == 114514){
                flg[yy][xx] = 1 + flg[y][x];
                Q.push(P(xx, yy));
            }
        }
    }
    if(flg[H][W] == 114514)cout << -1 << endl;
    else cout << cnt - flg[H][W] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <assert.h>
#include <fstream>
#include <bitset>

using namespace std;

const int MAXN = 1 << 11;

int n,sum;
int a[MAXN];

bitset<MAXN * MAXN> B;

int main()
{
	ios::sync_with_stdio(0);
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	B[0] = 1;
	for (int i = 1;i <= n;i++)
		B = B << a[i] | B;
	for (int i = (sum + 1) / 2;i <= sum;i++)
		if (B[i])
		{
			cout << i << endl;
			return 0;
		}
	return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	int n, ans = 0;
	cin >> n;
	int arr[n + 1];
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	for (int i = 1; i <= n; i++) {
		if (i == arr[i]) {
			int j = i;
			while (arr[j] == j && j <= n) {
				j++;
			}
			if ((j - i) % 2 == 0) {
				ans += (j - i) / 2;
			} else {
				ans += (j - i ) / 2 + 1;

			}
			i = j - 1;
		}
	}
	cout << ans << endl;
}


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

int main() {
int K;
cin >> K;

vector<int> vec;
vec = {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};

cout << vec.at(K - 1) << endl;

}


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


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

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main()
{
    ll A, B, N;
    cin >> A >> B >> N;
    ll div = B * floor(N / B) - 1;
    ll ans = floor(A * div / B) - A * floor(div / B);
    ll ans2 = floor(A * N / B) - A * floor(N / B);
    if(N >= B){
        ans = ans;
    }
    else{
        ans = ans2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans;
  if ((b - a) % 2 == 0)
    ans = (b - a) / 2;
  else
    ans = min(n - b + 1 + (b - a - 1) / 2, a - 1 + 1 + (b - a - 1) / 2);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Problems problems = new Problems();
        problems.problemA_Flog1();
    }
}

class Problems {
    public static void problemA_Flog1() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] h = new int[N];
        for (int i=0; i<N; i++) {
            h[i] = sc.nextInt();
        }
        int[] C = new int[N];
        C[0] = 0; C[1] = Math.abs(h[0]-h[1]);
        if (N == 2) {
            System.out.println(C[1]);
            return;
        }
        for (int i=2; i<N; i++) {
            C[i] = Math.min(C[i-2]+Math.abs(h[i]-h[i-2]),
                    C[i-1]+Math.abs(h[i]-h[i-1]));
        }
        System.out.println(C[N-1]);
    }
}

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

struct State{
  string s;
  ll c;
  int p;
  State(string& as, ll ac, int ap){
    s = as;
    c = ac;
    p = ap;
  }
  bool operator<(const State& right) const {
    return c > right.c;
  }
};

int main(){

  while(true){
    int ch, cv;
    cin >> ch >> cv;
    if(ch == 0 && cv == 0) break;

    string cur = "0123456789";
    int curz = -1;
    string goal = "0123456789";
    for(int i=0;i<9;i++){
      int d;
      cin >> d;
      cur[i] = '0' + d;
      if(d == 0){
	curz = i;
      }
    }
    assert(curz != -1);
    for(int i=0;i<9;i++){
      int d;
      cin >> d;
      goal[i] = '0' + d;
    }

    unordered_map<string, ll> mc;
    priority_queue<State> que;
    que.emplace(cur, 0, curz);
    mc[cur] = 0;

    while(que.size()){
      State s = que.top();
      que.pop();

      if(mc[s.s] < s.c) continue;
      if(s.s == goal){
	cout << s.c << endl;
	break;
      }

      swap(s.s[s.p], s.s[(s.p + 1) % 9]);
      if(mc.find(s.s) == mc.end() || mc[s.s] > s.c + ch){
	mc[s.s] = s.c + ch;
	que.emplace(s.s, s.c + ch, (s.p + 1) % 9);
      }
      swap(s.s[s.p], s.s[(s.p + 1) % 9]);

      swap(s.s[s.p], s.s[(9 + s.p - 1) % 9]);
      if(mc.find(s.s) == mc.end() || mc[s.s] > s.c + ch){
	mc[s.s] = s.c + ch;
	que.emplace(s.s, s.c + ch, (9 + s.p - 1) % 9);
      }
      swap(s.s[s.p], s.s[(9 + s.p - 1) % 9]);

      swap(s.s[s.p], s.s[(s.p + 3) % 9]);
      if(mc.find(s.s) == mc.end() || mc[s.s] > s.c + cv){
	mc[s.s] = s.c + cv;
	que.emplace(s.s, s.c + cv, (s.p + 3) % 9);
      }
      swap(s.s[s.p], s.s[(s.p + 3) % 9]);

      swap(s.s[s.p], s.s[(9 + s.p - 3) % 9]);
      if(mc.find(s.s) == mc.end() || mc[s.s] > s.c + cv){
	mc[s.s] = s.c + cv;
	que.emplace(s.s, s.c + cv, (9 + s.p - 3) % 9);
      }
      swap(s.s[s.p], s.s[(9 + s.p - 3) % 9]);
    }
  }

  return 0;
}

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

int main(void)
{
	vector<int> point(5);
	int sum = 0, ans;
	int last_order = 10;
	for (int i = 0; i < 5; i++) {
		cin >> point[i];
	}
	for (int i = 0; i < 5; i++) {
		int tmp = point[i] % 10;
		if (tmp < last_order && tmp != 0) {
			last_order = tmp;
		}
		if (tmp == 0)sum += point[i];
		else sum += (point[i] + 10 - tmp);
	}
	ans = sum - (10 - last_order);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;


int main() {
  int n, m, a[100100];
  vector<pair<int, int>> p(100100);

  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    int b, c;
    cin >> b >> c;
    p[i] = make_pair(-c, b);
  }

  sort(a, a+n);
  sort(p.begin(), p.end());

  int wc = 0;
  bool flag = true;
  for (int j = 0; j < m && flag; j++) {
    int v = -p[j].first;
    for (int i = 0; i < p[j].second && wc < n; i++) {
      if (a[wc] < v) {
        a[wc] = v;
        wc++;
      } else {
        flag = false;
        break;
      }
    }
  }

  long long int sum;
  for (int i = 0; i < n; i++) {
    sum += a[i];
  }

  cout << sum << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}


int main(){
    string s;
    ll ans=0;
    cin >> s;
    for (ll i=1;i<s.size();i++){
        if (s[i-1]!=s[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
MOD = 998244353
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_sum = sum(a)
half = int(a_sum / 2)

dp = [[0] * (a_sum + 1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(n):
    ni = i+1
    for j in range(a_sum+1):
        if dp[i][j] != 0:
            dp[ni][j] += (dp[i][j] * 2) % MOD
            dp[ni][j+a[i]] += dp[i][j]
ans = pow(3, n, MOD)
for item in dp[n][half:]:
    ans -= item * 3
    ans %= MOD

if a_sum % 2 == 0:
    dp = [[0] * (half + 1) for _ in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        ni = i+1
        for j in range(half+1):
            dp[ni][j] += dp[i][j] % MOD
            if j+a[i] < half+1:
                dp[ni][j+a[i]] += dp[i][j] % MOD
ans += dp[n][half] * 3
ans %= MOD
if ans < 0:
    ans += MOD
print(ans)

Measured memory_bytes: 351496
#include<bits/stdc++.h>
using namespace std ;
typedef long long int ll;
#define pb push_back
#define endl        '\n'
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
   ll a,b;
   cin>>a>>b;
   if(a-2*b>0) cout<<a-2*b;
   else cout<<0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int power(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=mul(x,x))
		if (y&1) ans=mul(ans,x);
	return ans;
}
int n,m,a,b,fac[N],ifac[N];
int C(int n,int m){
	return mul(fac[n],mul(ifac[m],ifac[n-m]));
}
int main()
{
	cin>>n>>m>>a>>b;
	fac[0]=1;
	for (int i=1;i<N;i++) fac[i]=mul(fac[i-1],i);
	ifac[N-1]=power(fac[N-1],p-2);
	for (int i=N-1;i;i--) ifac[i-1]=mul(ifac[i],i);
	int ans=0;
	for (int i=b+1;i<=m;i++) ans=inc(ans,mul(C(n-a+i-2,n-a-1),C(a-1+m-i,a-1)));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
use proconio::input;

const M: u64 = 26;

fn main() {
    input! {
        n: u64
    }
    let mut n = n;
    let mut v = Vec::new();
    while n > 0 {
        v.push((b'a' + ((n - 1) % M) as u8) as char);
        n = (n - 1) / M;
    }
    println!("{}", v.iter().rev().collect::<String>());
}


Measured memory_bytes: 2116
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
//#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

const double PI = acos(-1);
const double EPS = 1e-9;

const int MX = 2005;
const int MM = 1000000007;

map<pll, ll> DB;
ll solve(ll A, ll B, ll msk = 0)
{
	if( A == B ) return 1;
	if( DB.find(pll(A, B)) != DB.end()) return DB[pll(A, B)];
	if( A > B ) return 0;
	ll &res = DB[pll(A, B)];
	if( B%2 == 0 ){
		if( (1|(B - (B&-B))) < A ) res--;
		B++;
	}
	return res += solve((A+1)/2, B/2) + solve(A/2, B/2);
}

int main()
{
	ll A, B;
	cin >> A >> B;
	cout << solve(A, B) << "\n";
}


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

par = [0] * n
rank = [0] * n

#初期化
for i in range(n):
    par[i] = i
    rank[i] = 0

#判定(一番上野根を求める)
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
    
#結合
def unite(x , y):
    rx = find(x)
    ry = find(y)
    
    if rx == ry:
        return
    
    if rank[rx] < rank[ry]:
        par[rx] = ry
    elif rank[rx] > rank[ry]:
        par[ry] = rx
    else:
        par[ry] = x
        rank[rx] += 1
        
for i in range(m):
    x,y,z = map(int, input().split())
    
    unite(x-1,y-1)
    
from collections import Counter
c = [find(i) for i in range(n)]

print(len(Counter(c)))

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


int main()
{
    int d; cin >> d;
    if (d == 22) printf("Christmas Eve Eve Eve");
    else if (d == 23) printf("Christmas Eve Eve");
    else if (d == 24) printf("Christmas Eve");
    else printf("Christmas");
}


Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>//cout << fixed << setprecision() <<
#include <set>
#include <map>
using ll = long long;
using namespace std;

double Mcos(double k){
    double pi= atan(1.0)*4;
    return cos(k*pi/180);
}

int main(void){
    double a,b,h,m,t;
    double k1,k2,k,kakudo;
    cin>>a>>b>>h>>m;
    k1=h*30.0+0.5*m;
    k2=m*6.0;
    k=abs(k1-k2);
    if(k>=180)kakudo=360.0-k;
    else kakudo=k;
    t=pow(a,2)+pow(b,2)-2*a*b*Mcos(kakudo);
    cout<< fixed << setprecision(20)<<sqrt(t);
}


Measured memory_bytes: 4188
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){
   string s,t; cin>>s>>t;
   int n=s.ln,m=t.ln;
   int ans=1e18;
   rep(i,0,n-m+1){
       int c=0;
       rep(j,0,m){
            if(t[j]!=s[i+j])c++;
       }
       ans=min(ans,c);
   }
   cout<<ans<<"\n";
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read problem. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


Measured memory_bytes: 3620
#include<cstdio>
using namespace std;
const int MAX = 2e5 + 5;
int a[MAX];
int main() {
	int n;
	int f, b, temp;
	bool odd = false;
	scanf("%d", &n);
	int m = n / 2;
	if (n % 2 != 0)
		odd = true;
	f = m - 1;
	b = m + 1;
	scanf("%d", &a[m]);
	for (int i = 1; i < n; i++)
	{
		if (i % 2 != 0) {
			scanf("%d", a + f);
			f--;
		}
		else
		{
			scanf("%d", a + b);
			b++;
		}	
	}
	
	if (odd) {
		for (int i = n-1; i != 0; i--)
		{
			printf("%d ", a[i]);
		}
		printf("%d\n", a[0]);
	}
	else
	{
		for (int i = 0; i != n - 1; i++)
		{
			printf("%d ", a[i]);
		}
		printf("%d\n", a[n-1]);
	}
	
	return 0;
}

Measured memory_bytes: 2816
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int a, b; cin >> a >> b;
    
    if(a*b%2 == 0) cout << "No" << ln;
    else cout << "Yes" << ln;
    return 0;
}

Measured memory_bytes: 256