akhauriyash/Code-Regression huggingface dataset:
#!python3

import sys

iim = lambda: map(int, input().rstrip().split())

def popcnt2(n):
    a = (
        0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
    )
    ans = 0
    while n:
        ans += a[n&0xff]
        n >>= 8
    return ans

def resolve():
    N = int(input())
    S = list(input())
    Q = int(input())

    c0 = ord('a')
    smap = [1<<(i-c0) for i in range(c0, ord('z')+1)]

    T = [0]*N + [smap[ord(S[i])-c0] for i in range(N)]

    for i in range(N-1, 0, -1):
        i2 = i << 1
        T[i] = T[i2] | T[i2|1]

    ans = []
    #print(T)
    for cmd, i, j in (line.split() for line in sys.stdin.readlines()):
        i = int(i) - 1
        if cmd == "1":
            if S[i] == j:
                continue

            S[i] = j
            i0 = N + i
            T[i0] = smap[ord(j)-c0]
            while i0 > 1:
                i0 = i0 >> 1
                T[i0] = T[i0+i0] | T[i0-~i0]
        elif cmd == "2":
            i += N
            j = int(j) + N

            d1 = 0
            while i < j:
                if i & 1:
                    d1 |= T[i]
                    i += 1
                if j & 1:
                    j -= 1
                    d1 |= T[j]

                i >>= 1; j >>=1

            ans.append(popcnt2(d1))

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 32444
#include <iostream>
using namespace std;
int main() {
    int a,b,c = 0;
    bool d = false;
    cin >> a >> b >> c;
    if(a > b){
        int e = a;
        a = b;
        b = e;
    }
    for (int i = a; i <= b ; ++i) {
        if(i == c){
            cout << "Yes";
            d = true;
            break;
        }
    }
    if(d == false){
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
import math
import sys
def sieve(n):
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        return is_prime
 
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False
 
    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            for j in range(i*2, n+1, i):
                is_prime[j] = False
 
    return is_prime

def main():
	N=10**5
	prime=sieve(N)
	a=[0 for i in range(N+1)]
	for i in range(3,N+1):
		if prime[i] and prime[(i+1)//2]: a[i]=a[i-1]+1
		else: a[i]=a[i-1]

	Q=int(input())
	for i in range(Q):
		l,r=map(int,input().split())
		print(a[r]-a[l-1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 5168
#include <bits/stdc++.h>
	#define MOD                         1000000007
	#define rep(var, initVal, upto)     for(int var = initVal; var<upto; ++var)
	#define repi(var, initVal, upto)    for(int var = initVal; var>=upto; --var)
	#define inArr(A,n)                  rep(i, 0, n)  cin >> A[i];
	#define inArr2d(A, n, m)            rep(i, 0, n) rep(j, 0, m)   cin >> A[i][j];
	#define pdr(a)                      #a << " : " << a << " "
	#define pd1(a)                      cout << #a << " : " << a << endl;
	#define pd2(a, b)                   cout << #a << " : " << a << " " << #b << " : " << b << endl;
	#define pdArr(A, n)                 rep(i, 0, n) cout << A[i] << " "; cout << endl;
	#define pdArr2d(A, n, m)            rep(i, 0, n) { rep(j, 0, m) cout << A[i][j] << " "; cout << endl; }
	#define psep                        cout << "-------------------------------" << endl;
	#define pbsep                       cout << "===============================" << endl;
	#define pbbsep                      cout << "###############################" << endl;
	#define MAX(a, b)                   ((a)>(b)?(a):(b))
	#define MIN(a, b)                   ((a)<(b)?(a):(b))
	#define all(x)                      x.begin(), x.end()
	using namespace std;

	typedef long long                   ll;
	typedef unsigned long long          ull;
	typedef unsigned int                ui;

	typedef vector<int>                 vi;
	typedef vector<char>                vc;
	typedef vector<bool>                vb;
	typedef vector<ll>                  vll;
	typedef vector<ull>                 vull;
	typedef vector< vi >                vvi;
	typedef vector<vll>                 vvll;
	typedef vector<vull>                vvull;
	typedef vector< vb >                vvb;
	typedef vector< vc >                vvc;

	typedef pair<int, int>              ii;
	typedef pair<ll, ll>                pll;
	typedef pair< ull, ull >            pull;

	typedef vector< ii >                vii;
	typedef vector< pll >               vpll;
	typedef vector< pull >              vpull;

	template<class T> inline void Swap(T &a, T &b){ a ^= b; b ^= a; a ^= b; }

	ll exp(ll a, ull b, ull mod){
		ll res = 1;
		while(b){   if(b&1) res = (res*a)%mod;   a = (a*a)%mod; b >>= 1;    }
		return res%mod;
	}

	ll modInverse(ll a, ull m) { return exp(a, m - 2, m); }

int main(){

	// int start_s=clock();
	cout << boolalpha;
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll Q, H, S, D, N;
	cin >> Q >> H >> S >> D >> N;

	ll one, two;
	one = MIN(Q*4, MIN(H*2, S));
	two = MIN(2*one, D);

	if(2*one < two){
		cout << N*one << endl;
	}else{
		cout << (two*(N/2)) + (N%2)*one << endl;
	}

	// int stop_s=clock();
	// cout << "time: " << (stop_s-start_s)/double(CLOCKS_PER_SEC)*1000 << endl;
	return 0;
}

Measured memory_bytes: 256
//////////////////////////////
// Author: whatisit
// Date: 2020-05-14 00:55 
//////////////////////////////
#include <bits/stdc++.h>
using namespace std;

// bruteforce
const int N = 4;
int A[N], ans, k;

int gcd(int a, int b) {
	if (a > b) swap(a, b);
	while (b % a != 0) {
		b = b % a;
		swap(a, b);
	}
	return a;
}

void add() {
	int num = gcd(A[1], A[2]);
	num = gcd(num, A[3]);
	ans += num;
}

void solve() {
	cin >> k;
	for (int i = 1; i <= k; ++i) {
		for (int j = 1; j <= k; ++j) {
			for (int t = 1; t <= k; ++t) {
				A[1] = i;
				A[2] = j;
				A[3] = t;
				add();
			}
		}
	}
	cout << ans;
}

int main() {
	//cin.tie(0); ios_base::sync_with_stdio(0);
	solve();
	return 0;
}

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

int main() {
   vector<int> a(3);
   rep(i, 3) {
       cin >> a[i];
   }

   sort(a.begin(), a.end());

   if (a[0] + a[1] == a[2]) {
       cout << "Yes" << endl;
   } else {
       cout << "No" << endl;
   }
}

Measured memory_bytes: 256
n = gets.chomp.to_i
d = gets.chomp.split(' ').map(&:to_i).sort

len = d.size

median = d[d.size / 2]

arc, abc = d.partition { |x| x >= median }

if arc.size != abc.size
  puts 0
  exit 0
end

puts ((abc.last + 1)..median).size

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

using namespace std;

#define int long long

void solve() {
    int n;
    cin >> n;
    vector <pair <pair <int, int>, int> > m;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        for (int j = 0; j < t; ++j) {
            int x, t;
            cin >> x >> t;
            m.push_back({{i, x - 1}, t});
        }
    }
    int ans = 0;
    for (int i = 0; i < (1 << n); ++i) {
        bool check = 1;
        for (int j = 0; j < m.size(); ++j) {
            int v = m[j].first.first, u = m[j].first.second, val = m[j].second;
            if (i & (1 << v)) {
                if ((i & (1 << u)) && val == 0 || (i & (1 << u)) == 0 && val == 1) {
                    //cout << v << ' ' << u << ' ' << val << '\n';
                    check = 0;
                }
            }
        }
        if (check) {
            int cnt = 0;
            for (int j = 0; j < n; ++j) if (i & (1 << j)) ++cnt;
            ans = max(ans, cnt);
        }
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');

var line;
while (line = lines.shift()) {
	var board = [];
	board.push(line.split('').map(function(f){return +f;}));
	for (var i = 0; i < 7; i++) {
		board.push(lines.shift().split('').map(function(f){return +f;}));
	}
	if (lines.length > 0)
		lines.shift();

	for (var y = 0; y < 8; y++) {
		for (var x = 0; x < 8; x++) {
			if (board[y][x])
				break;
		}
		if (board[y][x])
			break;
	}

	var fig;
	if (board[y][x+1] & board[(y+1)%8][x] & board[(y+1)%8][x+1]) fig = 'A';
	else if (board[(y+1)%8][x] & board[(y+2)%8][x] & board[(y+3)%8][x]) fig = 'B';
	else if (board[y][x+1] & board[y][x+2] & board[y][x+3]) fig = 'C';
	else if (board[(y+1)%8][x-1] & board[(y+1)%8][x] & board[(y+2)%8][x-1]) fig = 'D';
	else if (board[y][x+1] & board[(y+1)%8][x+1] & board[(y+1)%8][x+2]) fig = 'E';
	else if (board[(y+1)%8][x] & board[(y+1)%8][x+1] & board[(y+2)%8][x+1]) fig = 'F';
	else fig = 'G';

	console.log(fig);
}

Measured memory_bytes: 8708
#include <stdio.h>
#include <math.h>

struct point{
	double x,y;
};

void kock(int n,struct point a,struct point b){
	struct point s,t,u;
	double th=M_PI*60.0/180.0;
	if(n==0)
		return ;
	s.x=(2.0*a.x+1.0*b.x)/3.0;
	s.y=(2.0*a.y+1.0*b.y)/3.0;
	t.x=(1.0*a.x+2.0*b.x)/3.0;
	t.y=(1.0*a.y+2.0*b.y)/3.0;
	u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
	u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

	kock(n-1,a,s);
	printf("%.8f %.8f\n",s.x,s.y);
	kock(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	kock(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	kock(n-1,t,b);
}

int main(){
	int n;
	struct point a,b;
	scanf("%d",&n);
	a.x=a.y=b.y=0;
	b.x=100;
	printf("%.8f %.8f\n",a.x,a.y);
	kock(n,a,b);
	printf("%.8f %.8f\n",b.x,b.y);
	return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i = x; i < (int)(n); i++)
#define rep_ll(i,x,n) for(ll i = x; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    int n;
    cin >> n;
    priority_queue<int> q;
    vector<int> a(n);
    rep(i, 0, n) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int aamax=1000002;
    vector<int> aa(1000002, 0);
    rep(i, 0, n){
        for(int j=a[i]; j< a[n-1]+1;j+=a[i]) aa[j]++;
    }
    int cnt=0;
    rep(i, 0, n) if(aa[a[i]]==1) cnt++; 

    cout << cnt;

    return 0;
}

Measured memory_bytes: 7940
function main(input){
	input = stn(input);
	var sum=0;
	for (var i =0;i<=input;i++){
		sum+=i;
	}
	op(sum);
}
function op(a){
	console.log(a);
}
function stn(a){
	return parseInt(a,10);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    int n, d;
    cin >> n >> d;
    int ans;
    if ((n / (2*d + 1)) == 0) {
        ans = 1;
    } else {
        ans = ceil(float(n) / float(2*d + 1));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f(int n){
  if(n%2==0){
    return n/2;
  }else{
    return 3*n+1;
  }
}

int main(){
  int s;
  cin>>s;
  
  vector<int> vect(1000001,0);
  vect[0]=s;
  vect[1]=f(vect[0]);
  //vect[1]=f(vect[0]);
  for(int i=1;i<1000001-1;i++){
    vect[i+1]=f(vect[i]);
    for(int j=0;j<i-1;j++){
      if(vect[i]==vect[j]){
        cout<<i+1<<endl;
        return 0;
      }
    }
  }
}

  

Measured memory_bytes: 4096
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


n, k = LI()
if n % k == 0:
    print(0)
else:
    print(1)


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll na, nb, m; cin >> na >> nb >> m;
    vector<ll> a(na), b(nb);
    for(ll i=0;i<na;i++) cin >> a[i];
    for(ll i=0;i<nb;i++) cin >> b[i];
    ll mina = *min_element(a.begin(), a.end());
    ll minb = *min_element(b.begin(), b.end());
    ll ans = mina + minb;
    for(ll i=0;i<m;i++){
        ll x, y, c; cin >> x >> y >> c;
        ans = min(a[x-1] + b[y-1] - c, ans);
    }
    cout << ans << endl;
}


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

int main(){

    int a,b,c;
    cin >> a;
    c=a%60;
	a-=c;
	a/=60;
    b=a%60;
	a-=b;
	a/=60;

    
    cout << a << ":" << b << ":" << c << endl;

    return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <string.h>
#define ll long long

 int main(void)
 {
 	char a[11];
 	scanf("%s",&a);
 	int p=strlen(a)-1;
 	ll ans=0;
 	for(int i=0;i<1<<p;i++){
 		ll sum=a[0]-'0';
 		for(int j=0;j<p;j++){
 			if(i>>j&1) ans+=sum,sum=(a[j+1]-'0');
 			else sum=sum*10+(a[j+1]-'0');
 		}
 		ans+=sum;
 	}
 	printf("%lld",ans);
 	return 0;
 }


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


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
int main(){
  string s;
  while(cin>>s){
    vector<int> v;
    for(int i=0;i<13;i++) v.push_back(s[i]-'0');
    bool fi =true;
    for(int i=1;i<10;i++){
      bool f=true;
      vector<int> c(v);
      c.push_back(i);
      int d[10]={};
      for(int j=0;j<14;j++) d[c[j]]++;
      for(int j=0;j<10;j++)
        if(d[j]>4) f=false;

      if(!f) continue;
      f=0;
      auto conv=[&](map<int, int> cnt){
                  vector<int> vs;
                  for(auto p:cnt)
                    for(int i=0;i<p.second;i++)
                      vs.emplace_back(p.first);
                  return vs;
                };
      set< vector<int> > used;
      MFP([&](auto dfs,vector<int> vs)->void{
            if(used.count(vs)) return;
            used.emplace(vs);

            if(vs.empty()) f=1;
            if(f) return;
            map<int, int> cnt;
            for(int v:vs) cnt[v]++;
            if(vs.size()==14){
              for(int p=1;p<10;p++){
                if(cnt[p]<2) continue;
                cnt[p]-=2;
                dfs(conv(cnt));
                cnt[p]+=2;
                if(f) return;
              }
              return;
            }

            for(int p=1;p<10;p++){
              if(cnt[p]<3) continue;
              cnt[p]-=3;
              dfs(conv(cnt));
              cnt[p]+=3;
              if(f) return;
            }
            for(int p=1;p+3<=10;p++){
              if(cnt[p+0]<1||cnt[p+1]<1||cnt[p+2]<1) continue;
              cnt[p+0]--;cnt[p+1]--;cnt[p+2]--;
              dfs(conv(cnt));
              cnt[p+0]++;cnt[p+1]++;cnt[p+2]++;
              if(f) return;
            }
          })(c);

      if(f) {
        if(fi){
          cout << i;
          fi=false;
        }else cout << " " << i;
      }
    }
    if(fi) cout<<0;
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define it register int
#define ct const int
#define il inline
using namespace std;
typedef long long ll;
#define rll register ll
#define cll const ll
typedef unsigned long long ull;
const int N=1000005;
int n;
int main(){
	scanf("%d",&n);rll ans=0;it i;
	for(i=1;i<=n;++i) ans+=(n-1)/i;
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 3732
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  ll ans=1;
  for(i=1;i<=n;i++)
    ans=(ans*i)%MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    double a, b, C;
    cin >> a >> b >> C;
    cout << fixed << setprecision(10) << (a * b * sin(C / 180 * M_PI)) / 2 << " " << fixed << setprecision(10) << sqrt(pow(a, 2) + pow(b, 2) - 2. * a * b * cos(C / 180 * M_PI)) + a + b << " " << fixed << setprecision(10) << b * sin(C / 180 * M_PI) << endl;
    return 0;
}


Measured memory_bytes: 3508
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()

	h := make([]int, n)
	for i := 0; i < k; i++ {
		d := nextInt()
		for j := 0; j < d; j++ {
			aij := nextInt()
			h[aij-1]++
		}
	}

	var ret int
	for _, v := range h {
		if v == 0 {
			ret++
		}
	}
	fmt.Println(ret)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 1776
#include <stdio.h>
#include <stdint.h>

int main() {
  int n, i, a[200000], l, r;
  uint64_t sum = 0, cnt = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  l = r = 0;
  while (l < n) {
    while (r < n && (sum & a[r]) == 0) {
      sum += a[r++];
      cnt += r - l;
    }
    sum -= a[l++];
  }
  printf("%llu\n", cnt);
  return 0;
}


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

ll g(ll x) {
    return x * (x + 1) / 2;
}

int main() {
    ll n;
    cin >> n;
    ll sum = 0;
    for (ll i = 1; i <= n; i++) {
        sum += i * g(n / i);
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3592
import java.util.*;
class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n =	sc.nextInt();
	if(n == 25) {
            System.out.println("Christmas");
        }else if( n == 24 ) {
            System.out.println("Christmas Eve");
	}else if(n == 23) {
            System.out.println("Christmas Eve Eve");
	}else if(n == 22) {
            System.out.println("Christmas Eve Eve Eve");
	}
    }

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

int main() {
    int n,k;
    cin >> n >> k;
    map<int,int> mp;
    for (int i = 0; i < k; ++i) {
        int d;
        cin >> d;
        for (int j = 0; j < d; ++j) {
            int a;
            cin >> a;
            a--;
            mp[a]++;
        }
    }
    cout << n-mp.size() << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int r, d;
ll x;

void solve() {
    for (int i = 0; i < 10; i++) {
        x = r * x - d;
        cout << x << endl;
    }
}

void input() {
    cin >> r >> d >> x;
}

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

    input();
    solve();
}


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

using namespace std;
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define floot10 cout<<fixed<<setprecision(10);
#define int long long

typedef struct{
	int parent;
	int right;
	int left;
} node2;

node2 t[50];

void Preorder(int now){
	cout<<" "<<now;
	if(t[now].left!=-1)Preorder(t[now].left);
	if(t[now].right!=-1)Preorder(t[now].right);
	return;
}
void Inorder(int now){
	if(t[now].left!=-1)Inorder(t[now].left);
	cout<<" "<<now;
	if(t[now].right!=-1)Inorder(t[now].right);
	return;
}
void Postorder(int now){
	if(t[now].left!=-1)Postorder(t[now].left);
	if(t[now].right!=-1)Postorder(t[now].right);
	cout<<" "<<now;
	return;
}
signed main(){
	int n;
	cin>>n;
	lp(i,50){
		t[i].parent=-1;
	}	
	lp(i,n){
		int id;
		cin>>id;
		int r,l;
		cin>>l>>r;
		t[id].right=r;
		t[id].left=l;
		t[r].parent=id;
		t[l].parent=id;
	}
	queue<int> q;
	int now=0;
	while(1){
		if(t[now].parent==-1) break;
		now=t[now].parent;
	}
	cout<<"Preorder"<<endl;
	Preorder(now);
	cout<<endl<<"Inorder"<<endl;
	Inorder(now);
	cout<<endl<<"Postorder"<<endl;
	Postorder(now);
	cout<<endl;
	return 0;
}



Measured memory_bytes: 3128
module abc129.abc129_b;

import std.algorithm;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;


void main() {
  auto n = readln.chomp.to!int;
  auto w = readln.chomp.split.to!(int[]);

  int ans = int.max;
  iota(1, n).each!(t => ans = ans.min(abs(w[0..t].sum - w[t..$].sum)));

  ans.writeln;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();

            if (array.Where(_ => _ % 2 == 0).All(_ => _ % 3 == 0 || _ % 5 == 0))
            {
                Console.WriteLine("APPROVED");
            }
            else
            {
                Console.WriteLine("DENIED");
            }
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define ll          long long int
#define ld          double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         1000000000000000000
#define MAXN        200005
#define LOG         20
#define mod         1000000007
using namespace std;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,k;
    cin>>a>>b>>k;
    if(a<=k){
        k=k-a;
        a=0;
        if(b<=k){
            cout<<0<<" "<<0;
        }
        else{
            cout<<0<<" "<<b-k;
        }
    }
    else{
        a=a-k;
        cout<<a<<" "<<b;
    }
}

Measured memory_bytes: 256
ab = input().split()
a, b, k = int(ab[0]),int(ab[1]),int(ab[2])

count = 0
i = 1
list = []

while i<=100:
    if a%i==0 and b%i==0:
        list.append(i)
        if i==b:
            break
    i += 1

print(list[len(list)-k])

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


public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;

		while(!(str=br.readLine()).equals("0")){
			int n = Integer.parseInt(str);
			long score=0;
			long max = Long.MIN_VALUE;

			for(int i=0; i<n; i++){
				int a =Integer.parseInt(br.readLine());
				score = Math.max(score+a, a);
				max = Math.max(score, max);
			}
			System.out.println(max);
		}
	}
}

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

int main()
{
    string S;
    int cnt = 0;
    cin >> S;
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == 'o')
        {
            cnt++;
        }
    }
    cout << 700 + 100 * cnt;
}

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

const static ll Max = 100000+5;
const static ll INF = 1e18+5;
vector<set<ll>> G(Max);
ll N, Q, K;
map<pair<ll, ll>, ll> C;
ll DP[Max];


void Dijkstra(ll s){
    for(int i = 0; i < Max; i++) DP[i] = INF;
    DP[s] = 0;
    for(auto v : G[s]) DP[v] = C[make_pair(s, v)];
    priority_queue< pair<ll, pair<ll, ll>>, vector<pair<ll, pair<ll, ll>>>, greater<pair<ll, pair<ll, ll>>> > Q;
    for(auto v : G[s]){
        if(C.find(make_pair(s, v)) != C.end()) Q.push(make_pair(C[make_pair(s, v)], make_pair(s, v)));
    }
    while(!Q.empty()){
        auto next = Q.top(); Q.pop();
        auto w = next.second.second;
        for(auto v : G[w]) if(C.find(make_pair(w, v)) != C.end()){
            if(DP[w] + C[make_pair(w, v)] <= DP[v]){
                DP[v] = DP[w] + C[make_pair(w, v)];
                Q.push(make_pair(C[make_pair(w, v)], make_pair(w, v)));
            }
        }
    }
}


int main() {
    cin >> N;
    for(int i = 0; i < N-1; i++){
        int a, b, c; cin >> a >> b >> c;a--;b--;
        G[a].insert(b);
        G[b].insert(a);
        C[make_pair(a, b)] = c;
        C[make_pair(b, a)] = c;
    }
    cin >> Q >> K;K--;
    Dijkstra(K);

    for(ll i = 0; i < Q; i++){
        int x, y; cin >> x >> y;x--;y--;
        cout << DP[x] + DP[y] << endl;
    }
    return 0;
}

Measured memory_bytes: 31732
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int N;
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; i++) {
		string s1, s2;
		for (int j = 0; j <= i; j++)s1 += S[j];
		for (int j = i + 1; j < N; j++)s2 += S[j];
		if(s1 == s2){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 A, B, K;
  std::cin >> A >> B >> K;

  if (B - A + 1 <= 2 * K) {
    for (i64 i = A; i <= B; ++i) {
      std::cout << i << std::endl;
    }
  } else {
    for (i64 i = A; i < A + K; ++i) {
      std::cout << i << std::endl;
    }
    for (i64 i = B - K + 1; i <= B; ++i) {
      std::cout << i << std::endl;
    }
  }
  return 0;
}

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

#define pi 2*acos(0)
#define INF 1e16
#define MIN 1e-9
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define m_p make_pair
#define p_b push_back
#define n_p(a) next_permutation(all(a))
#define all(v) v.begin(),v.end()
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define rev(s) reverse(all(s))
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define mem(a,k) memset(a,k,sizeof a)
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
#define u_b(X,V) upper_bound(X.begin(),X.end(),V)
#define l_b(X,V) lower_bound(X.begin(),X.end(),V)
#define cnt(s,c) count(all(s),c)

//bitwise helpers
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)

#define modulo(S, N) ((S) & (N - 1))
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S - 1))
#define turnOnLastZero(S) ((S) | (S + 1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))

using namespace std;

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

    ll n, W;

    cin >> n >> W;

    ll w[n], v[n];

    for(int i = 0; i < n; i++) {
        cin >> w[i] >> v[i];
    }

    ll dp[n + 1][W + 1];

    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= W; j++) {
            if(i == 0 || j == 0)
                dp[i][j] = 0;
            else if(j >= w[i - 1])
                dp[i][j] = max(dp[i - 1][j], v[i - 1] + dp[i - 1][j - w[i - 1]]);
            else
                dp[i][j] = dp[i - 1][j];
        }
    }

    cout << dp[n][W] << endl;

    return 0;
}


Measured memory_bytes: 79232
//libraries
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//namespace
using namespace std;
using namespace __gnu_pbds;

//typedef
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//define
#define inp(X) cin>>X;
#define inp_long(X) long long X; cin>>X;
#define inp_arr(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define sz(A) A.size()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define endl '\n'
#define vect(A) vector<long long> A;
#define inp_vect(A,N); for(int i=0;i<N;i++){long long q; cin>>q; A.push_back(q);}
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);

ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2) % MOD;
    p = (p * p) % MOD;

    return (y%2 == 0)? p : (x * p) % MOD;
}
ll modInverse(ll a)
{
   return power(a,MOD-2);
}
int main()
{
	fio;
	ll n,k,q;
	cin>>n>>k>>q;
	vect(a);
	forin(i,0,n-1)
	{
		a.pb(k);
	}
	forin(i,0,q-1)
	{
		ll f;
		cin>>f;
		a[f-1]++;
	}
	forin(i,0,n-1)
	{
		a[i]-=q;
		if(a[i]>0)
		{
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
}



Measured memory_bytes: 1524
#include<bits/stdc++.h>
#define upd(a,b) a=add(a,b)
#define inv(x) power(x,Mod-2)
using namespace std;
typedef long long ll;
int Mod;
int add(int a,const int b){a+=b;if(a>=Mod)a-=Mod;return a;}
int sub(int a,const int b){a-=b;if(a<0)a+=Mod;return a;}
int mul(const int a,const int b){return (ll)a*b%Mod;}
int power(int x,int cs)
{
	int ras=1;
	while(cs)
	{
		if(cs&1) ras=mul(ras,x);
		x=mul(x,x);cs>>=1;
	}
	return ras;
}
const int N=310;
int n,K;
int dp[N][N],sum[N][N],C[N][N];
int main()
{
	int i,j,a,b;
	cin>>n>>K>>Mod;
	for(i=0;i<=n;i++)
	{
		C[i][0]=1;
		for(j=1;j<=i;j++) C[i][j]=add(C[i-1][j-1],C[i-1][j]);
	}
	for(a=1;a<=n+1;a++)
	{
		if(a==1)
		{
			for(b=0;b<=K;b++) dp[a][b]=1;
		}
		else
		{
			for(b=0;b<=K;b++)
			{
				for(i=1;i<a;i++)
				{
					upd(dp[a][b],mul(mul(sum[i][b+1],dp[a-i][b]),C[a-2][i-1]));
					//printf("#%d %d  U%d  %d\n",a,b,i,dp[a][b]);
				}
			}
		}
		for(i=K;i>=0;i--) sum[a][i]=add(sum[a][i+1],dp[a][i]);
	}
	printf("%d\n",dp[n+1][0]);
	return 0;
}

Measured memory_bytes: 1408
## D
MOD = 10**9 + 7
n = int(input())
A = list(map(int,input().split()))

m = 1
ans = 0
for i in range(60):
  s = sum([a&m for a in A])
  s//=m
  ans = (ans + (n-s)*s * m) % MOD
  m <<= 1
  
print(ans)  

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

int main(){
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> C(N+1);
  vector<vector<int>> A(N+1, vector<int>(M+1));
  for(int i=0; i<N; i++){
    cin >> C.at(i);
    for(int j=0; j<M; j++){
      cin >> A.at(i).at(j);
    }
  }
  
  bool ans = true;
  int res = INF;
  for (int tmp = 0; tmp < (1 << N); tmp++) {
    //cout << tmp << endl;
    bitset<12> s(tmp);
    ans = true;
    int sum = 0;
    vector<int> rikai(M+1);
    for(int i=0; i<N; i++){
      if(s.test(i)){
        sum += C.at(i);
        for(int j=0; j<M; j++){
          rikai.at(j) += A.at(i).at(j);
        }
      }
      //cout << sum << endl;
    }
    for(int j=0; j<M; j++){
      if(rikai.at(j) < X){
        ans = false;
        break;
      }
    }
    if(ans) res = min(res, sum);
  }
  
  if(res == INF) res = -1;
  cout << res <<endl;
}


Measured memory_bytes: 3552
def rectangle_cutting(W: int, H: int, x: int, y: int)->tuple:
    area = W*H/2
    exists_some = 2*x == W and 2*y == H

    return area, exists_some


if __name__ == "__main__":
    W, H, x, y = map(int, input().split())

    area, exists_some = rectangle_cutting(W, H, x, y)
    print(area, 1 if exists_some else 0)


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int times = Integer.parseInt(sc.nextLine());
		int bit = 0;

		for(int i = 0; i< times; i++) {
			bit |= sc.nextInt();
		}
		System.out.println(Integer.numberOfTrailingZeros(bit));
	}
}

Measured memory_bytes: 22868
import java.util.*;
//AGC008A
class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        sc.close();
        int div;
        if(x >= 0){
            if(y > 0){
                div = y-x;
                if(div<0)div = div * (-1) + 2;
            }else{
                y *= -1;
                div = y-x;
                if(div < 0)div *= -1;
                div++;
            }
        }else{
            if(y > 0){
                x *= -1;
                div = x-y;
                if(div<0)div = div*(-1);
                div++;
            }else{
                if(x > y){
                    div = x-y+2;
                }else{
                    div = y-x;
                }
            }
        }
        System.out.println(div);
    }
}

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

int main()
{
  int n;
  cin >> n;
  int cnt = 0;
  for(int i = 0;i < 30;i++){
    for(int j = 0;j < 15;j++){
      int sum = 4*i + 7*j;
      if(sum == n) cnt++;
    }
  }
  if(cnt != 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main(void)
{
    char S[100001],T[100001]={};
    char *Tc[4]={"dream","dreamer","erase","eraser"}; //Tに入る要素
    int Tclen[4]={5,7,5,6};
    int Slen,count=0,Tlen=0; 

    scanf("%s",S);
    //printf("%s\n",S);
    Slen = strlen(S);

    //for(int i=0;i<4;i++)printf("Tc[%d] = %s\n",i,Tc[i]);

    while(Slen>0){
        count=0;
        for(int i=0;i<4;i++){
            //printf("%s\n",Tc[i]);
            if(strncmp(Tc[i],S+Slen-Tclen[i],Tclen[i])==0){Slen -= Tclen[i];/*printf("%d\n",Slen);*/break;}
            count++;
        }
        if(count ==4)break;
    }
    
    if(Slen==0){
		printf("YES\n");
	}else if(Slen!=0){
		printf("NO\n");
	}
    return 0;

}



Measured memory_bytes: 256
n = int(input())
cnt = {}
for _ in range(n):
    s = input()
    if not s in cnt:
        cnt[s] = 1
    else:
        cnt[s] = cnt[s] + 1

maxv = max(cnt.values())
ans = []
for x, c in cnt.items():
    if c == maxv: ans.append(x)
ans.sort()
for x in ans:
    print(x)

Measured memory_bytes: 32096
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut ans: u128 = 1;
    for _ in 0..n {
        let i: u128 = read();

        if ans * i > 10u128.pow(18) {
            ans = 10u128.pow(18)+1;
        } else {
            ans *= i;
        }
    }
    if ans > 1000000000000000000 {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 2200
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long q = Long.parseLong(sc.next());
        long h = Long.parseLong(sc.next());
        long s = Long.parseLong(sc.next());
        long d = Long.parseLong(sc.next());
        long n = Long.parseLong(sc.next());
        long kijun = Math.min(Math.min(8*q, 4*h), Math.min(2*s, d));
        long ans = (n / 2) * kijun; 
        if(n % 2 == 1) {
            ans += Math.min(s, Math.min(4*q, 2*h));
        }
        System.out.println(ans);
    }
 
}

Measured memory_bytes: 21844
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0
      ? os << vec[i]
      : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0
      ? os << deq[i]
      : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion

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

  int N;
  string S;
  cin >> N >> S;
  int a = 0;
  char c = '_';
  REP(i, N) {
    if (S[i] != c) {
      a++;
      c = S[i];
    }
  }
  cout << a << "\n";
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

/////////////////////////////////////////////////////
#define pll pair<ll,ll>
#define J 1000

ll L,N,X[202020];
ll r[202020],l[202020],rSum[202020], lSum[202020];
ll i,ans;
int main(){
    scanf("%lld%lld",&L,&N);
    fornum (i,0,N){
        scanf("%lld", &X[i]);
        r[i] = X[i];
        l[i] = L - X[i];
    }
    fornum(i,0,N){
        rSum[i + 1+J] = rSum[i+J] + r[i];
        lSum[N - i] = lSum[N-i+1] + l[N-i-1];
    }

    
    fornum(i,1,N+1){
        ll si = min(N + 1 - i, i)-1;
        ll sr = r[i-1]+(rSum[i-1+J] - rSum[i - si - 1+J])*2;
        sr += (lSum[i + 1] - lSum[i + 2 + si])*2;
        ans = ans < sr ? sr : ans;
        
        ll sl = l[i-1]+(lSum[i+1] - lSum[i + si + 1])*2;
        sl += (rSum[i - 1+J] - rSum[i - 2 - si+J])*2;
        ans = ans < sl ? sl : ans;
        //printf("%lld,%lld,%lld\n", i, sr, sl);
        
        
    }
    

    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 8064
a, b, h, m = gets.split.map(&:to_i)

Pi = 3.141592653589793
ha = 0.5 * (h * 60 + m)
ma = 6 * m
angle = (ha - ma).abs
angle = [360 - angle, angle].min

x = a**2 + b**2 - 2*a*b*Math.cos(Pi/180 * angle)
puts Math.sqrt(x.to_f)

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

int main(){
    char c;
    cin >> c;
   switch (c){
       case 'A':
       cout << 'T';
       break;
       case 'T':
       cout << 'A';
       break;
       case 'G':
       cout << 'C';
       break;
       case 'C':
       cout << 'G';
   }
   return EXIT_SUCCESS;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a,b,c,d,tot,Lcm;
ll gcd(ll a,ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return a/gcd(a,b)*b;
}
ll col(ll x)
{
	ll num1,num2=b/x;
	if(x<a)
	{
		if(a%x!=0)
			num1=a/x+1;
		else
			num1=a/x;
	}
	else
		num1=1;
	return num2-num1+1;
}
int main()
{
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	Lcm=lcm(c,d);
	tot=b-a+1;
	printf("%lld\n",tot-col(c)-col(d)+col(Lcm));
	return 0;
}


Measured memory_bytes: 256
a = []
for _ in range(3):
    tmp = [int(x) for x in input().split()]
    for x in tmp:
        a.append(x)
n = int(input())
b = []
for _ in range(n):
    b.append(int(input()))

for x in b:
    for i in range(9):
        if x == a[i]:
            a[i] = "O"

if a[0] == "O" and a[3] == "O" and a[6] == "O":
    print("Yes")
elif a[1] == "O" and a[4] == "O" and a[7] == "O":
    print("Yes")
elif a[2] == "O" and a[5] == "O" and a[8] == "O":
    print("Yes")
elif a[0] == "O" and a[1] == "O" and a[2] == "O":
    print("Yes")
elif a[3] == "O" and a[4] == "O" and a[5] == "O":
    print("Yes")
elif a[6] == "O" and a[7] == "O" and a[8] == "O":
    print("Yes")
elif a[0] == "O" and a[4] == "O" and a[8] == "O":
    print("Yes")
elif a[2] == "O" and a[4] == "O" and a[6] == "O":
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

 
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  int l[n];
  REP(i,n){
    cin>>l[i];
  }


  int ans = INF;
  REP(i,pow(4,n)){
    int t = i;
    int lenA = 0;
    int lenB = 0;
    int lenC = 0;
    int countA = 0;
    int countB = 0;
    int countC = 0;

    REP(j,n){
      if(t%4==1){
        lenA += l[j];
        countA++;
      }else if(t%4==2){
        lenB += l[j];
        countB++;
      }else if(t%4==3){
        lenC += l[j];
        countC++;
      }else{
        //割り切れたらなにもなし
      }
      t /= 4;
    }

    if(countA*countB*countC){
      ans = min(ans,10*(countA+countB+countC - 3) + abs(a-lenA)+abs(b-lenB)+abs(c-lenC));
    }
  }
  cout<<ans<<endl;

  return 0;
}

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

int main()
{
	int size;
	cin>>size;
	int a[size],b[size],c[size];
	for (int i = 0; i < size; ++i)
	{
		/* code */
		cin>>a[i]>>b[i]>>c[i];
	}
	long long int dp[size][3]={0};
	//long long int sum=0;
	for(int i=0;i<size;i++)
	{
		if(i==0)
		{
			dp[0][0]=a[0];
			dp[0][1]=b[0];
			dp[0][2]=c[0];
		}
		else 
		{
			dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
			dp[i][1]=max(dp[i-1][2]+b[i],dp[i-1][0]+b[i]);
			dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
		}
	}
	long long int max_happy=max(dp[size-1][0],dp[size-1][1]);
	max_happy=max(max_happy,dp[size-1][2]);
	cout<<max_happy<<"\n";
}

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

const long MAXN=200200;
long n;
long long a[MAXN],num[MAXN];

int main() {
	cin>>n;
	register long i;
	for(i=1;i<=n;++i) {
		scanf("%lld",&a[i]);
		++num[a[i]];
	}
	
	long long ans=0;
	for(i=1;i<=n;++i)
		ans+=num[i]*(num[i]-1)/2;
	
	for(i=1;i<=n;++i)
		printf("%lld\n",ans-(num[a[i]]-1));
	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    ll n;
    cin >> n;
    if (n == 1)
    {
        cout << 0 << endl;
        return 0;
    }
    ll ans;
    vector<ll> a(n + 1), b(n + 1), c(n + 1);
    a[2] = 2;
    b[2] = 34;
    c[2] = 64;
    rep2(i, 3, n + 1)
    {
        a[i] = (a[i - 1] * 10 + b[i - 1]) % MOD;
        b[i] = (b[i - 1] * 9 + c[i - 1] * 2) % MOD;
        c[i] = (c[i - 1] * 8) % MOD;
    }
    cout << a[n] << endl;
}

Measured memory_bytes: 26748