akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int rcount = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'R')
        {
            rcount++;
        }
    }
    int ans = 0;
    for (int i = 0; i < rcount; i++)
    {
        if (s[i] == 'W')
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int h, a;
  	cin >> h >> a;
    cout << 1 + (h-1)/a << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e6 + 5;
int main() {
	string s;
	while (cin >> s) {
		int fi = 10 * (s[0] - '0') + (s[1] - '0');
		int se = 10 * (s[2] - '0') + (s[3] - '0');
		int sum = 0, flag = 0;
		if (fi > 0 && fi <= 12)
			sum++, flag = 1;
		if (se > 0 && se <= 12)
			sum++, flag = 2;
		if (sum == 0)
			cout << "NA" << endl;
		else if (sum == 2)
			cout << "AMBIGUOUS" << endl;
		else if (sum == 1 && flag == 1)
			cout << "MMYY" << endl;
		else
			cout << "YYMM" << endl;

	}

	//system("pause");
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import collections
s = input()
counter = collections.Counter(s.split())
d = counter.most_common()
#print(d)

maxm = 0
maxn = 0
for i in range(len(d)):
   if d[i][1] > maxm:
      maxm = d[i][1]
   if len(d[i][0]) > maxn:
      maxn = len(d[i][0])

#print(maxm, maxn)

for i in range(len(d)):
   if d[i][1] == maxm:
      print(d[i][0], end = "")
   if len(d[i][0]) == maxn:
      print("", d[i][0])

   
      



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

namespace AtcoderCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            
            if(s == "SSS")
            {
                Console.WriteLine(0);
            }else if(s == "RRR")
            {
                Console.WriteLine(3);
            }else if(s == "SRR" || s == "RRS")
            {
                Console.WriteLine(2);
            }
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}


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


int main(){
  while(true){
    int n,much=0;
    cin>>n;
    if(n==-1){
      break;
    }
    much=much+1150;
    if(20>=n&&n>10){
      much=(n-10)*125+much;
    }
    if(30>=n&&n>20){
      much=(n-20)*140+much+1250;
    }
    if(n>30){
      much=(n-30)*160+much+1250+1400;
    }
    cout<<4280-much<<endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<math.h>
struct P{double x,y;};
struct W{P p;double r;}w[100];
double D(P p){return hypot(p.x,p.y);}
double I(P a,P b){return a.x*b.x+a.y*b.y;}
double O(P a,P b){return a.x*b.y-a.y*b.x;}
P F(P l,P r){P p={l.x-r.x,l.y-r.y};return p;}
double S(P a,P b,P c)
{
	if(I(F(b,a),F(c,a))<1e-9)return D(F(c,a));
	if(I(F(a,b),F(c,b))<1e-9)return D(F(c,b));
	return fabs(O(F(b,a),F(c,a)))/D(F(b,a));
}
int main()
{
	P a,b;
	int i,n,m;
	while(scanf("%d",&n),n)
	{
		for(i=0;i<n;++i)scanf("%lf%lf%lf",&w[i].p.x,&w[i].p.y,&w[i].r);
		for(scanf("%d",&m);m--;)
		{
			scanf("%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y);
			for(i=0;i<n;++i)
			{
				if(D(F(a,w[i].p))<=w[i].r&&D(F(b,w[i].p))<=w[i].r)continue;
				if(S(a,b,w[i].p)<=w[i].r){puts("Safe");goto E;}
			}
			puts("Danger");
E:;
		}
	}
	return 0;
}

Measured memory_bytes: 0
N = input()
A = map(lambda x: int(x)/400, raw_input().split())
S = set()
ans = 0
for a in A:
  if a <= 7:
    S.add(a)
  else:
    ans += 1

if len(S) == 0:
    print 1, ans
else:
    print len(S), ans + len(S)

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vll = vector<ll>;
using vvll = vector<vll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using plli = pair<ll, int>;
using vplli = vector<pair<ll, int>>;
;
using pllll = pair<ll, ll>;
using vpllll = vector<pair<ll, ll>>;

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

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i - 1; i >= (ll)end_i; i--)

long long INF = 1LL << 60;
int main()
{
    int y;
    cin >> y;
    rep(i, 0, y)
    {
        ll m, c;
        ll a;
        cin >> m >> c;
        cin >> a;
        ll out = 0;
        rep(j, 0, a)
        {
            ll w, ac;
            double rate;
            cin >> w >> rate >> ac;
            ll calc = m;
            if (w)
            {
                rep(k, 0, c)
                {
                    calc += calc * rate;
                    calc -= ac;
                }
            }
            else
            {
                ll ax = 0;
                rep(k, 0, c)
                {
                    ax += calc * rate;
                    calc -= ac;
                }
                calc += ax;
            }
            chmax(out,calc);
        }
        cout<<out<<endl;
    }
    return 0;
}



Measured memory_bytes: 3140
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int D;
vector<int> c(26);
int ss[365][26];
vector<int> ans(0);

double powyabai = 1.2;
double cyabaipow = 1.2;
double uresisapow = 0.8;

double evaluate(int day, int kind){

    double yabasa = 0;
    int s = ans.size();
    int idx;
    for(idx = s - 1; 0 <= idx; idx--){
        if(ans[idx] == kind) break;
    }
    yabasa = pow(day - idx, powyabai) * pow(c[kind], cyabaipow);
    double uresisa = pow(ss[day][kind], uresisapow);
    return yabasa + uresisa;
}

int main(){
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D)rep(j, 26) cin >> ss[i][j];
    rep(i, D){
        double max_eva = -inf;
        double choice = 0;
        rep(j, 26){
            if(chmax(max_eva, evaluate(i, j))) choice = j;
        }
        ans.push_back(choice);
    }
    rep(i, D) pt(ans[i] + 1);
}

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

using namespace std;

int main(){
 int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  
  int res=0;
  int sign=0;
  for(int i=0;i<n-1;i++){
   if(!sign){
    if(a[i]<a[i+1]) sign=1;
    else if(a[i]>a[i+1]) sign=-1;
   }
   else if(a[i]<a[i+1]&&sign==-1) {res++;
                                   sign=0;
          }
   else if(a[i]>a[i+1]&&sign==1) {res++;
                                   sign=0;
          }  
  }

 cout << res+1 << endl;

}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

int main(void){
    long long n, d, a, x, h;
    std::cin >> n >> d >> a;
    std::vector<std::pair<int, int>> p(n);
    for(int i = 0; i < n; i++){
	std::cin >> x >> h;
	p[i].first = x;
	p[i].second = h;
    }
    std::sort(p.begin(), p.end());
    long long ans = 0;

    std::queue<std::pair<int, int>> q;
    long long tot = 0;
    for(int i = 0; i < n; i++){
	while(q.size() != 0 && p[i].first > q.front().first){
	    tot -= q.front().second;
	    q.pop();
	}
	h = p[i].second - tot;
	if(h > 0){    	
	   int num = (h + a - 1) / a;
	   ans += num;
    	   long long damage = a * num;
    	   q.push(std::make_pair(p[i].first + 2 * d, damage));
	   tot += damage;
	}
    }
    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 5520
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!{
        n: usize,
        a: i64,
        mut x: [i64; n],
    }
    let X_max = *x.iter().max().unwrap();
    for i in 0..n {
        x[i] -= a;
    }
    let mut dp = vec![vec![0i64; 5001]; 51];
    
    for j in 0..n+1 {
        for t in 0.. 2 * n * X_max as usize + 1 {
            if j == 0 && t == n * (X_max as usize) {
                dp[j][t] = 1;
            } else if j >= 1 && (t as i64 - x[j-1] < 0 || t as i64 - x[j-1] > (2 * n * (X_max as usize)) as i64) {
                dp[j][t] = max(dp[j][t], dp[j-1][t])
            } else if j >= 1 && 0 <= t as i64 - x[j-1] && t as i64- x[j-1] <= (2 * n * (X_max as usize)) as i64 {
                dp[j][t] = max(dp[j][t], dp[j-1][t] + dp[j-1][(t as i64-x[j-1]) as usize])
            } else {
                dp[j][t] = 0
            }
        }
    }

    println!("{}", max(dp[n][n*X_max as usize]-1, 0));
}


Measured memory_bytes: 6396
import Data.List
main=do
 n<-readLn
 k<-sort.map read.words<$>getLine
 putStr$unlines$map show$f 1 n 0 k
f i n c[]
 |i>n=[]
 |otherwise=c:f(i+1)n 0[]
f i n c(k:ks)
 |i>n=[]
 |i==k=f i n(c+1)ks
 |otherwise=c:f(i+1)n 0(k:ks)

Measured memory_bytes: 71160
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <tuple>

using namespace std;

//#define int long long

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s).begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) begin(a), end(a)

#define EXIST(s,x) ((s).find(x)!=(s).end())

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

#ifdef _DEBUG
#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#else
#define DEBUG(x)
#endif

#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 
#ifdef int
#define INF 1001001001001001001LL
#else
#define INF 1001001001
#endif

typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

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

template <typename T>
struct Point {
    T x;
    T y;
    Point(){}
    Point(T x, T y): x(x), y(y){}
    T operator ^ (Point const& p) {
        return this->x*p.y-this->y*p.x; 
    }
    Point operator + (Point const& p) {
        return Point(this->x+p.x, this->y+p.y);
    }
    Point operator - (Point const& p) {
        return Point(this->x-p.x, this->y-p.y);
    }
};

signed main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n; cin>>n;
    Point<int> p1, p2, p3;
    cin>>p1.x>>p1.y>>p2.x>>p2.y;
    double ans = 0;
    while(cin>>p3.x>>p3.y) {
        ans += (p3-p1)^(p2-p1);
        swap(p2,p3);
    }
    printf("%.1lf\n", abs(ans)/2);

	return 0;
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<":\n";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007ll
#define inf 9999999999999999ll

void bfs(vv &e,ll node,vb &vis,vi &size,vi &col,ll &color)
{
    col[node]=color;
    vis[node]=true;
    ll s=1;
    queue <ll> q;
    q.push(node);
    while(!q.empty())
    {
        ll u=q.front();
        q.pop();
        for(ll i=0;i<e[u].size();i++)
        {
            ll v=e[u][i];
            if(!vis[v])
            {
                s++;
                vis[v]=true;
                col[v]=color;
                q.push(v);
            }
        }
    }
    size[color]=s;
    color++;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,k;
    cin>>n>>m>>k;
    vv e(n,vi());
    for(ll i=0;i<m;i++)
    {
        ll u,v;
        cin>>u>>v;
        u--;
        v--;
        e[u].pb(v);
        e[v].pb(u);
    }
    vv enemy(n,vi());
    for(ll i=0;i<k;i++)
    {
        ll u,v;
        cin>>u>>v;
        u--;
        v--;
        enemy[v].pb(u);
        enemy[u].pb(v);
    }
    ll color=0;
    vb vis(n,false);
    vi size(n,0);//stores size of a color;
    vi col(n,-1);//stores color of a node

    for(ll i=0;i<n;i++)
    {
        if(!vis[i])
        {
            bfs(e,i,vis,size,col,color);
        }
    }
 
    for(ll i=0;i<n;i++)
    {
        ll total=size[col[i]]-1;
        ll direct=e[i].size();
        for(ll j=0;j<enemy[i].size();j++)
        {
            ll v=enemy[i][j];
            if(col[v]==col[i])
                total--;
        }
        cout<<total-direct<<" ";

    }
    cout<<"\n";
}


Measured memory_bytes: 15348
#include <stdio.h>
#include <algorithm>
const int N=18;
const int M=(1<<N)+5;
int n,m,x[M],f[M],g[M],t[4];
inline void smax(int &a,int b){b>a?a=b:0;}
inline bool cmp(int a,int b) {
	return x[a]>x[b];
}
int main() {
	int i,j,ans=0;
	scanf("%d",&n);m=1<<n;
	for(i=0;i<m;++i) scanf("%d",x+i);
	f[0]=0;g[0]=m;x[m]=-1;
	for(i=1;i<m;++i) {
		t[0]=i;t[1]=m;
		for(j=1;j<=i;j<<=1) if(i&j) {
			t[2]=f[i^j];t[3]=g[i^j];
			std::sort(t,t+4,cmp);
			std::unique(t,t+4);
		}
		f[i]=t[0];g[i]=t[1];
		smax(ans,x[f[i]]+x[g[i]]);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 6016
sx, sy, tx, ty = map(int, input().split())

dx = tx-sx
dy = ty-sy


ans = 'U'*dy+'R'*dx + 'D'*dy+'L'*dx
ans += 'L'+'U'*(dy+1)+'R'*(dx+1)+'D'
ans += 'R'+'D'*(dy+1)+'L'*(dx+1)+'U'
print(ans)


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << "\n"
//; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, n);
    Cins(int, n, t);
    int sum = Sum(t);
    
    Cin(int, m);
    Rep(m){
        Cin(int, p, x);
        Cout(sum - t[p-1] + x);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    if (n % 2 == 0)
        cout << 1.0 / 2 << endl;
    else
        cout << (n / 2 + 1.0) / n << endl;
    return 0;
}

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

int main(){

  int S, h, m, s;
  
  cin >> S;

  h=S / 3600; S -= h*3600;
  m=S / 60; S -= m*60;
  s=S;

  cout << h << ':' << m << ':' << s << endl;
  
  return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,god=0;
    for(int i=0;i<n;i++){
        if(a[i]<=399){
            c1++;
        }else if(a[i]>=400&&a[i]<=799){
            c2++;
        }else if(a[i]>=800&&a[i]<=1199){
            c3++;
        }else if(a[i]>=1200&&a[i]<=1599){
            c4++;
        }else if(a[i]>=1600&&a[i]<=1999){
            c5++;
        }else if(a[i]>=2000&&a[i]<=2399){
            c6++;
        }else if(a[i]>=2400&&a[i]<=2799){
            c7++;
        }else if(a[i]>=2800&&a[i]<=3199){
            c8++;
        }else if(a[i]>=3200){
            god++;
        }
    }
    int min=0,max=0;
    if(c1!=0){min++;}
    if(c2!=0){min++;}
    if(c3!=0){min++;}
    if(c4!=0){min++;}
    if(c5!=0){min++;}
    if(c6!=0){min++;}
    if(c7!=0){min++;}
    if(c8!=0){min++;}
    max=min+god;
    if(min==0){min=1;}

    cout<<min<<' '<<max<<endl;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

string &func(int index,int left,string &s){
	char nowC = s.at(index);

	if(left>='z'-nowC+1 && nowC != 'a')
	{
		left -= ('z'-nowC+1);
		s[index]='a';
	}
	if(index == s.size()-1){
		if(left)left%=26;
		s[index]+=left;
		return s;
	}
	else{
		return func(index+1,left,s);
	}
}

signed main(){
	string s;
	cin>>s;
	lli k;
	cin>>k;
	cout<<func(0,k,s)<<endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
using ll = long long;

int main(void)
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(ll &x:a) cin >> x;
  map<ll,ll> last;
  ll answer = 0;
  REP(i,n) {
    auto ite = last.lower_bound(a[i]);
    if(ite == last.begin()) ++answer;
    else {
      --ite;
      --(ite->second);
      if(ite->second == 0) last.erase(ite);
    }
    ++last[a[i]];
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 7168
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	Rapid_pleaseAC_fast;

	ic_s;
	int ans = 0;
	rep(i, 4) {
		if (s[i] == '+')ans++;
		else ans--;
	}
	cout << ans << rt;

	please AC;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

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

#define rep(i, n) for ((i) = 0; (i) < (n); (i)++)
#define rep2(i, s, e) for ((i) = (s); (i) < (e); (i)++)
#define repd(i, n) for ((i) = (n)-1; (i) >= 0; (i)--)
#define rep2d(i, s, e) for ((i) = (e)-1; (i) >= (s); (i)--)

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

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define abs(a) ((a) > 0 ? (a) : (-1 * (a)))

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

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

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

void func(long long A, long long B, long long C, long long K)
{
    cout << min(A, K) - max(0, K - A - B) << endl;
}

int main()
{
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long K;
    scanf("%lld", &K);
    func(A, B, C, K);
    return 0;
}


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

int main() {
    int N; cin >> N;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (i * j == N) {
            cout << "Yes" << endl;
            return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
A, B, C, D = map(int, input().split())
d_AB = B - A
d_DC = D - C
set_AB = set()
set_CD = set()
for i in range(A, B + 1):
    set_AB.add(i)
for i in range(C, D + 1):
    set_CD.add(i)
if len(set_AB.intersection(set_CD)) == 0:
    print(0)
else:
    print(len(set_AB.intersection(set_CD)) - 1)


Measured memory_bytes: 3060
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

fn main() {
    input!{
        n: usize,
        s_v: [chars; n],
    }

    // MARCH それぞれの文字を頭文字にもつ人の人数を調べる
    let mut count = [0u64; 5];
    for name in &s_v {
        if name[0] == 'M' {
            count[0] += 1;
        } else if name[0] == 'A' {
            count[1] += 1;
        } else if name[0] == 'R' {
            count[2] += 1;
        } else if name[0] == 'C' {
            count[3] += 1;
        } else if name[0] == 'H' {
            count[4] += 1;
        }
    }

    let mut ans = 0u64;

    // 頭文字の組み合わせを選ぶ
    for i in 0..3 {
        for j in (i+1)..4 {
            for k in (j+1)..5 {
                // この場合に何通りあるかを調べ、足し合わせる
                ans += count[i] * count[j] * count[k];
            }
        }
    }

    println!("{}", ans);
}


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

using lli = long long int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
  int n, k, result=0;
  cin >> n >> k;
  vector<int> l(n);
  rep(i, n) cin >> l.at(i);
  sort(all(l));
  reverse(all(l));
  rep(i, k) result+=l.at(i);
  cout << result<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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 int INF = 1e9;
const LL LLINF = 1e16;

template<int mod>
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

const int mod = 998244353;
using modint = ModInt<mod>;


int main(){
    fastcin();

    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    vector<int> bc(n+1, 0);
    rep(i, n) bc[d[i]]++;

    modint ans = bc[0];
    bool f = 0;
    if(bc[0] != 1) ans = 0;
    if(d[0] != 0) ans = 0;
    rep1(i, n){
        if(bc[i] == 0) f = 1;
        if(!f) ans *= modint(bc[i]).pow(bc[i+1]);
        if(f && bc[i] > 0) ans = 0;
    }
    cout << ans << endl;

}

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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int n,a[N],A;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=2;i<n;i++){
		int x=0;
		if(a[i]>a[i-1])x++;
		if(a[i]>a[i+1])x++;
		if(x==1)A++;
	}
	cout<<A<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    ll n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;



    bool cc = true;
    for(ll i=a;i<c;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            cc=false;
            break;
        }
    }

    for(ll i=b;i<d;i++){
        if(s[i]=='#'&&s[i+1]=='#'){
            cc=false;
            break;
        }
    }

    if(!cc){
        cout<<"No"<<endl;
        return 0;
    }

    if(c<d){
        cout<<"Yes"<<endl;
        return 0;
    }else{
        //s = '#'+ s + '#';
//        bool f = false;
//            for (ll i = b; i < d; i++) {
//                if(i+1<n&&s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
//                   cout<<"Yes"<<endl;
//                   return 0;
//                }
//            }
//
//
//            cout<<"No"<<endl;
        for(int i=b-1;i<=d-1;i++) if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                puts("Yes");
                return 0;
            }
        puts("No");
        return 0;


    }

    return 0;
}


Measured memory_bytes: 640
import sys
sys.setrecursionlimit(1000000000)

n = int(input())
G = [[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

dist = [(0,-1) for _ in range(n)]
def dfs(now,prev=-1):
    for nxt in G[now]:
        if nxt == prev: continue
        dist[nxt] = (dist[now][0]+1,now)
        dfs(nxt,now)
dfs(0)

color = ["?"]*n
cnt = 0
now = n-1
w = (dist[n-1][0]+1)//2
while now != -1:
    if cnt < w: color[now] = -1
    else: color[now] = 1
    cnt += 1
    now = dist[now][1]

def coloring(now,prev=-1):
    for nxt in G[now]:
        if nxt == prev: continue
        if color[nxt] != "?" and color[now] != color[nxt]: continue
        color[nxt] = color[now]
        coloring(nxt,now)
coloring(0)
coloring(n-1)

print("Fennec" if sum(color) > 0 else "Snuke")

Measured memory_bytes: 139348
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> g[100005];
int col[100005];
bool dfs(int cur, int c) {
  col[cur] = 1 - c;
  bool ok = true;
  for (int &nbr : g[cur]) {
    if (col[nbr] < 0) ok &= dfs(nbr, 1 - c);
    if (col[nbr] == col[cur]) return false;
  }
  return ok;
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(col, -1, sizeof(col));
  bool bi = dfs(0, 0);
  if (!bi) {
    cout << 1LL * n * (n - 1) / 2 - m << endl;
  } else {
    int res[2] = {};
    for (int i = 0; i < n; i++) {
      res[col[i]]++;
    }
    cout << 1LL * res[0] * res[1] - m << endl;
  }
  return 0;
}

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

int l,r,ne=0;

signed main()
{
	cin>>l>>r;
	if (l<=0&&r>=0)  return cout<<"Zero"<<endl,0;
	
	if (l<0&&r<0)
	{
		ne=r-l+1;
		if (ne%2==0)  cout<<"Positive"<<endl;
		else cout<<"Negative"<<endl;
	}
	else if (l>0&&r>0)  cout<<"Positive"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    if(a=="a"||a=="e"||a=="i"||a=="o"||a=="u"){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;

#define rep(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define Rep(i, a, b) for (int (i) = (a) - 1; (i) < (b); (i)++)
#define REP(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define clr(a) memset(a, 0, sizeof(a))
#define Sort(a, len, cmp) sort(a + 1, a + len + 1, cmp)
#define ass(a, sum) memset(a, sum, sizeof(a))

#define ls ((rt) << 1)
#define rs ((rt) << 1 | 1)
#define lowbit(x) (x & -x)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define ENDL cout << endl
#define SZ(x) ((int)x.size())

typedef long long ll ;
typedef unsigned long long ull ;
typedef vector <int> Vi ;
typedef pair <int, int> Pii ;
typedef pair <ll, ll> Pll ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
typedef map <ll, ll> mll ;

const int N = 100010 ;
const double eps = 1e-8 ;
const int iinf = INT_MAX ;
const ll linf = 2e18 ;
const double dinf = 1e30 ;
const int MOD = 1000000007 ;

inline int read(){
    int X = 0,w = 0 ;
	char ch = 0;
    while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
    while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
    return w ? -X : X;
}

void write(int x){
     if(x < 0) putchar('-'),x = -x;
     if(x > 9) write(x / 10);
     putchar(x%10 + '0');
}

void print(int x) {
	cout << x << endl ;
	exit(0) ;
}

void PRINT(string x) {
	 cout << x << endl ;
	 exit(0) ;
}

void douout(double x){
	 printf("%lf\n", x + 0.0000000001) ;
}

int n, T, A ;
int H[N] ;
double tmp[N] ;

int main() {
	scanf("%d%d%d", &n, &T, &A) ;
	for (int i = 1; i <= n; i++) scanf("%d", &H[i]) ;
	for (int i = 1; i <= n; i++) tmp[i] = T - 0.006 * H[i] ;
	double ans = abs(A - tmp[1]) ;
	int ansid = 1 ;
	for (int i = 2; i <= n; i++) {
		if (abs(A - tmp[i]) < ans) ans = abs(A - tmp[i]), ansid = i ;
	}
	cout << ansid << endl ;
}

/*
写代码时请注意：
	1.是否要开Long Long？数组边界处理好了么？
	2.实数精度有没有处理？
	3.特殊情况处理好了么？
	4.做一些总比不做好。
思考提醒：
	1.最大值和最小值问题可不可以用二分答案？
	2.有没有贪心策略？否则能不能dp？
*/


Measured memory_bytes: 256
s=input()
a=["AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR","AKIHABR","AKIHBAR","KIHABAR","AKIHBRA","KIHABRA","KIHBARA","AKIHBR","KIHABR","KIHBAR","KIHBRA","KIHBR"]
if s in a:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38384
#include <iostream>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)-1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int a[LIMIT2]={0};
ll n,k;
ll findData(ll x){
    //findDataが単調減少のときはbinaryの不等号を反転させる
  ll i,sum=0;
  rep(i,n){
    sum += ceil((ld)a[i]/x)-1;
  }
  if(sum<=k) return 1;
  else return 0;
}
ll binaryCeil(ll max, ll min, ll target){
    //targetの数値以上の最小
    ll mid;
    ll count=0;
    while(max>min && count < 1000){
        mid = (max+min)/2;
        if(findData(mid) >= target) max = mid;
        else min = mid+1;
        count++;
    }
    return max;
}
int main(void){
  initialize();
  ll m,i,j,result=0;
  string s;
  
  cin >> n >> k;
  rep(i,n){
    cin >> a[i];
  }
  cout << binaryCeil(1000000000,1,1) << endl;
  
  return 0;
}

Measured memory_bytes: 4260
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}
// -----------------------------------------------------------------------



void solve(){
	string s;
	cin>>s;
	string ans="";
	ans+=s[0];
	for(int i=1;i<sz(s);++i){
		if(s[i]!=s[i-1])
		ans+=s[i];
	}
	int xp=ans.size();
	cout<<xp-1;
}


// -----------------------------------------------------------------------


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
//	cin>>t;
	while(t--)
	solve();
	return 0;
}


Measured memory_bytes: 592
use std::io::{Read, StdinLock};
use std::mem;
use std::str::{from_utf8, FromStr};
use std::vec::Vec;

struct StdinReader<'a> { reader: StdinLock<'a> }

impl<'a> StdinReader<'a> {
    pub fn new(reader: StdinLock<'a>) -> StdinReader { StdinReader { reader: reader } }
    pub fn read<T: FromStr>(&mut self) -> T {
        fn is_space(ch: u8) -> bool { ch == 0x20 || ch == 0x0a || ch == 0x0d }
        let b: Vec<u8> = self.reader.by_ref().bytes().map(|ch| ch.unwrap())
            .skip_while(|ch| is_space(*ch)).take_while(|ch| !is_space(*ch)).collect();
        let s = from_utf8(&b).unwrap();
        s.parse().unwrap_or_else(|_| panic!(format!("failed to parse: {}", s)))
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut reader = StdinReader::new(stdin.lock());

    loop {
        let n: usize = reader.read();
        if n == 0 { break; }

        let mut is_free = vec![vec![false; 30]; n];
        for i in 0..n {
            let f_i: usize = reader.read();
            for _ in 0..f_i {
                let d = reader.read::<usize>() - 1;
                is_free[i][d] = true;
            }
        }

        let mut curr: Vec<u64> = vec![0; n];
        let mut prev: Vec<u64> = vec![0; n];

        for i in 0..n {
            prev[i] = 1 << i;
        }

        let mut answer = -1;
        'outer: for t in 0..30 {
            for i in 0..n {
                // t日目にi番目の人が所有しうる地図の集合を求める
                if !is_free[i][t] {
                    curr[i] = prev[i];
                } else {
                    let mut set = prev[i];
                    for j in 0..n {
                        if i == j { continue; }
                        if !is_free[j][t] { continue; }
                        set |= prev[j];
                    }
                    curr[i] = set;
                }
            }
            for i in 0..n {
                if curr[i] == (1 << n) - 1 {
                    answer = (t + 1) as i64;
                    break 'outer;
                }
            }
            mem::swap(&mut curr, &mut prev);
        }

        println!("{}", answer);
    }
}



Measured memory_bytes: 5048
#include<stdio.h>
#define N 10000
#define Q 500

int main()
{

  int i,j,n,q,count=0,S[N],T[Q];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
    for(j=0;j<n;j++){
      if(T[i] == S[j]){
	count++;
	break;
      }
    }
  }
  printf("%d\n",count);
  
  return 0;
}

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

int main()
{
	int N, K;
	vector<int> h;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		int x; cin >> x;
		h.push_back(x);
	}

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

	int mind = INT_MAX;
	
	for (int i = 0; i < N - K + 1; i++) {
		int hmax = h[i + K - 1];
		int hmin = h[i];
		int dif = hmax - hmin;
		if (dif < mind) mind = dif;
	}

	cout << mind << endl;

	return 0;
}


Measured memory_bytes: 892
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [n, m] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    print $ (1900 * m + 100 * (n - m)) * (2 ^ m)


Measured memory_bytes: 380
def dfs(i, p, seq):
    global N, M
    ret = 0
    if i == N:
        ret = check(seq)
    else:
        for x in range(p, M + 1):
            ret = max(ret, dfs(i + 1, x, tuple(list(seq) + [x])))
    return ret


def check(seq):
    cnt = 0
    for a, b, c, d in query:
        if seq[b - 1] - seq[a - 1] == c:
            cnt += d
    return cnt


N, M, Q = map(int, input().split())
query = [tuple(map(int, input().split())) for _ in range(Q)]

print(dfs(0, 1, tuple()))


Measured memory_bytes: 77744
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    ll n; cin >> n;
    cout << n * (n - 1) / 2 << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for i in range(n)]
m_num = max(a)
m_index = [i for i, x in enumerate(a) if x == m_num]

if len(m_index) > 1:
  for i in range(n):
    print(m_num)
else:
  if len(a) == 1:
    print(a[0])
  else:
    m2_num = sorted(a)[-2]
    for i in range(n):
      if (i in m_index):
        print(m2_num)
      else:
        print(m_num)

Measured memory_bytes: 20452
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int X; cin >> X;
    int t = (X - 400) / 200;
    cout << 8 - t << endl;
    return 0;
}


Measured memory_bytes: 3648