akhauriyash/Code-Regression huggingface dataset:
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	q := getNextInt(scanner)
	s := newSegment(n)
	for i := 0; i < q; i++ {
		c := getNextInt(scanner)
		x := getNextInt(scanner) - 1
		y := getNextInt(scanner)
		switch c {
		case 0:
			s[0][x] += y
			update(s, x)
		case 1:
			fmt.Fprintln(writer, query(s, x, y, 0))
		}
	}
}

type segment [][]int

func newSegment(n int) segment {
	seg := make(segment, 0)
	for n > 1 {
		seg = append(seg, make([]int, n))
		n = (n + 1) >> 1
	}
	seg = append(seg, make([]int, 1))
	return seg
}

func (s segment) assign(h, i int, v interface{}) {
	s[h][i] = v.(int)
}
func (s segment) height() int {
	return len(s)
}
func (s segment) width(h int) int {
	return len(s[h])
}
func (s segment) at(h, i int) interface{} {
	return s[h][i]
}
func (s segment) f(x, y interface{}) interface{} {
	return x.(int) + y.(int)
}

type segtree interface {
	assign(h, i int, v interface{})
	height() int
	width(h int) int
	at(h, i int) interface{}
	f(x, y interface{}) interface{}
}

func update(s segtree, i int) {
	for h := 1; h < s.height(); h++ {
		i >>= 1
		if i<<1+1 < s.width(h-1) {
			s.assign(h, i, s.f(s.at(h-1, i<<1), s.at(h-1, i<<1+1)))
		} else {
			s.assign(h, i, s.at(h-1, i<<1))
		}
	}
}
func query(s segtree, l, r int, v interface{}) interface{} {
	for h := 0; h < s.height() && l < r; h++ {
		if l&1 == 1 {
			v = s.f(v, s.at(h, l))
			l++
		}
		l >>= 1
		if r&1 == 1 {
			v = s.f(v, s.at(h, r-1))
		}
		r >>= 1
	}
	return v
}



Measured memory_bytes: 7132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using iii = pair<ii, ll>;
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
const ll MOD = 1e9 + 7;
const ll INF = 2e9;
// const ll N = ;

ll n;

void solve() {
    cin >> n;
    cout << n * (n - 1) / 2 << "\n";
}

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

Measured memory_bytes: 3608
#include <iostream>

using namespace std;

int main()
{
    int T, H, M, S;

    cin >> T;

    H = T / 3600;

    M = (T / 60) % 60;

    S = T % 60;

    cout << H << ':' << M << ':' << S << endl;

    return 0;
}

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

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

  ll A; cin >> A;
  ll B; cin >> B;
  ll C; cin >> C;
  ll K; cin >> K;

  ll temp = 0;
  while(B <= A) {
    B *= 2;
    temp++;
  }
  while(C <= B) {
    C *= 2;
    temp++;
  }
  if (temp <= K) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}

Measured memory_bytes: 3608
S=int(input())

#S=x1y2-x2y1
#S+x2y1=x1y2
#S+y1=10**9y2 (x1=10**9, x2=1)
#S+y1が10**9の倍数になるようにy1を決める
Y1=10**9-S%(10**9) if S%10**9 else 0
Y2=(S+Y1)//(10**9)
print(10**9,Y1,1,Y2,0,0)


Measured memory_bytes: 2940
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n,a,b = map(int, input().split())    
    if n * a <= b:
        print(n*a)
    else:
        print(b)

if __name__ == "__main__":
    main()

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

int main(){
  string s;
  cin >> s;
  
  int ap = 0, zp = 0 , z = s.size();
  for ( int i = 0; i < z ; i++){
    if (s.at(i) == 'A') {
      ap = i;
      break;
    }
  }
  
  for (int j = 0; j < z ; j++){
    if (s.at( z - 1 - j) == 'Z'){
      zp = z - 1 - j;      
      break;
    }  
  }

  cout << zp - ap  + 1 << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 110
int a[N],b[N];
int main()
{
    int i,j,k,n,m,x,y;
    scanf("%d%d%d%d",&n,&m,&x,&y);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<m;i++)
        scanf("%d",&b[i]);
    sort(a,a+n);
    sort(b,b+m);
    if(b[0]>a[n-1]&&b[0]>x&&b[0]<=y)
        printf("No War\n");
    else
        printf("War\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int main(void){
    int N;
    vector <int> x, y;
    int sub;
    
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> sub;
        x.push_back(sub);
        y.push_back(sub);
    }
    
    int num = N / 2;
    
    sort(y.begin(), y.end());
    
    for(int i = 0; i < N; i++){
        if(x[i] < y[num]){
            cout << y[num] << endl;
        }
        else{
            cout << y[num - 1] << endl;
        }
    }
}

Measured memory_bytes: 3948
import itertools

H, W, K = map(int, input().split())
c = [['.' for j in range(6)] for i in range(6)]
for i in range(H):
    tmp = str(input())
    for j in range(len(tmp)):
        c[i][j] = tmp[j]
    
hp = list(itertools.product([0,1], repeat=H))
wp = list(itertools.product([0,1], repeat=W))

hl = []
for elem in hp:
    hl.append([i for i, x in enumerate(list(elem)) if x == 1])
wl = []
for elem in wp:
    wl.append([i for i, x in enumerate(list(elem)) if x == 1])

# print(hl)
# print(wl)


def func(hli, wli, c):
    tmp = 0
    for i in range(len(hli)):
        for j in range(len(wli)):
            if c[hli[i]][wli[j]] == '#':
                tmp += 1 
            
    return tmp


ans  = 0
for hli in hl:
    for wli in wl:
        if func(hli, wli, c) == K:
            ans += 1


print(ans)   

Measured memory_bytes: 9128
#include<stdio.h>
int main()
{
    int r,c,a,b,sum2=0;
    scanf("%d%d",&r,&c);
    int x[100][100];
    for(a=0;a<r;a++)
    {
        for(b=0;b<c;b++)
        {
            scanf("%d",&x[a][b]);
        }
    }
    for(a=0;a<r;a++)
    {
        int   sum=0;
        for(b=0;b<c;b++)
        {
            printf("%d ",x[a][b]);
            sum+=x[a][b];
        }
        printf("%d\n",sum);
    }
    for(b=0;b<c;b++)
    {
        int   sum=0;
        for(a=0;a<r;a++)
        {

            sum+=x[a][b];
            sum2+=x[a][b];
        }
        printf("%d ",sum);
    }
    printf("%d\n",sum2);
return 0;
}



Measured memory_bytes: 2100
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;

vector<int> e[100010];
int u[100010], c[100010];
queue<int> q;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        e[a].push_back(b);
        e[b].push_back(a);
    }
    int cnt = 1;
    q.push(1);
    u[1] = 1;
    while(!q.empty()) {
        int x = q.front();
        q.pop();
        for(int i = 0; i < e[x].size(); i++) {
            int y = e[x][i];
            if(u[y] == 1) continue;
            c[y] = x;
            u[y] = 1;
            q.push(y);
            cnt++;
        }
    }
    if(cnt < n) {
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    for(int i = 2; i <= n; i++) {
        printf("%d\n", c[i]);
    }

    return 0;
}


Measured memory_bytes: 10416
n, k = map(int, input().split())
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
a = str(Base_10_to_n(n, k))
print(len(a))

Measured memory_bytes: 2940
#include<iostream>
#include<complex>
#include<queue>
#include<cstring>
using namespace std;

int main()
{
  int n,m;
  for(;cin>>n>>m,n;)
    {
      char maps[m][n];
      for(int i=0;i<m;i++)
	for(int j=0;j<n;j++)
	  cin>>maps[i][j];

      //count,now;
      priority_queue<pair<int,pair<int,int> > >qu;
      for(int i=0;i<m;i++)
	{
	  qu.push(make_pair(0,make_pair(i,0)));
	  qu.push(make_pair(0,make_pair(i,n-1)));
	}
      for(int i=0;i<n;i++)
	{
	  qu.push(make_pair(0,make_pair(0,i)));
	  qu.push(make_pair(0,make_pair(m-1,i)));
	}
      bool closed[m][n];
      memset(closed,false,sizeof(closed));
      int dx[]={1,-1,0,0};
      int dy[]={0,0,1,-1};
      while(!qu.empty())
	{
	  int cnt=-(qu.top().first);
	  pair<int,int> now = qu.top().second;
	  int x=now.first;
	  int y=now.second;
	  qu.pop();
	  if(maps[x][y]=='&')
	    {
	      cout<<cnt<<endl;
	      break;
	    }
	  if(closed[x][y])
	    continue;
	  closed[x][y]=true;
	  for(int i=0;i<4;i++)
	    {
	      int nx=x+dx[i];
	      int ny=y+dy[i];
	      if(nx>=0 &&nx<m &&
		 ny>=0 &&ny<n &&
		 !closed[nx][ny])
		{
		  int ncnt=cnt;
		  if(maps[x][y]=='#' && maps[nx][ny]!='#' )
		    ncnt++;
		  qu.push(make_pair(-(ncnt),make_pair(nx,ny)));
		}
	    }
	}
    }

}

Measured memory_bytes: 1444
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int T,X;
    cin >> T >> X;
    printf("%.8f\n",(double)T/X);
    
    return 0;
}

Measured memory_bytes: 256
import math
import heapq

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 「符号反転した」リストを優先度付きキューに変換
# ★ポイント★
# heapqは最小値しか取り出せないため、
# 符号反転してからキューに変換=>最小値を取る、という手法を行う。
priceList = [ n * -1 for n in priceList]
heapq.heapify(priceList)

# 割引件数分ループ
for i in  range(discountTicketsCount):

    # キューから最小値の取り出し(ここで符号反転も行っておく)
    target = abs(heapq.heappop(priceList))

    # 2で割る。(小数点切り下げ)
    target = math.floor(target / 2)

    # 割引券利用後の金額をキューに格納(ここで符号反転する)
    heapq.heappush(priceList, target * -1)

# 合計金額を出力
print(abs(sum(priceList)))

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define CIN(type, ...) \
  type __VA_ARGS__;    \
  read_from_cin(__VA_ARGS__);

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int A[200000];

int main() {
  CIN(int, N);
  REP(i, N) cin >> A[i];
  set<int> s(A, A + N);
  cout << (s.size() == N ? "YES" : "NO") << endl;
}


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

int main() {
  char A; char B;
  cin>>A>>B;
  if(A=='H'){
    if(B=='H')
      cout<<'H'<<endl;
    else cout<<'D'<<endl;
  }
  else{
    if(B=='H')
      cout<<'D'<<endl;
    else cout<<'H'<<endl;
  }
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"29"# => "Yes",
// r#"24"# => "No",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        r: isize,
        g: isize,
    }

    (g * 2 - r).to_string()
}

Measured memory_bytes: 4352
#include <queue>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
char e[1005][1005];
int dx[4] = {0,0,-1,1};
int dy[4] = {1,-1,0,0};
int h, w, n;
int stx, sty;
int countn,k;

struct edge {
	int tx, ty;
	int step;
};

int book[1005][1005]; 
edge a[15];
void bfs( int x, int y ) {
	queue<edge> qq;
	book[x][y] = 1;
	edge ee;
	 ee.tx = x;
	 ee.ty = y;
	 ee.step = 0;
	qq.push( ee );
	while( !qq.empty() ) {
		edge temp = qq.front();
		qq.pop();
		if( temp.tx == a[k].tx && temp.ty == a[k].ty ){
			k++;
			countn += temp.step;
			if(k>n) return;
			while (!qq.empty()) qq.pop();
			
			memset(book,0,sizeof(book));
			bfs( temp.tx, temp.ty );
			return ;
		}
		for( int i = 0; i < 4; i++ ) {
			int ttx = temp.tx + dx[i];
			int tty = temp.ty + dy[i];
			if(ttx<=0 || tty<=0 || ttx>h || tty>w ) continue;
			if(e[ttx][tty] != 'X' && book[ttx][tty]==0) {
				book[ttx][tty] =1;
				edge tt;
				tt.tx = ttx;
				tt.ty = tty;
				tt.step = temp.step+1;
				qq.push(tt);
			}
		}
	}
	return ;
}

int main() {
	
	cin>>h>>w>>n;
	for( int i = 1; i <= h; i++ ) {
		
		getchar();
		for( int j = 1; j <= w; j++ ) {
			scanf("%c", &e[i][j] );
			if( e[i][j] == 'S' ) stx = i, sty = j;
			if(e[i][j]>='1' && e[i][j]<='9')a[e[i][j]-'0'].tx = i,a[e[i][j]-'0'].ty = j;
		}
	}
	countn = 0;
	k=1;
	bfs(stx,sty); 
	
	cout<<countn<<endl; 
	
}


Measured memory_bytes: 8076
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] a = new long[N];
		long sum = 0;
		for(int i=0; i<N; i++){
			a[i] = sc.nextLong();
			sum += a[i];
		}
		long ans = Long.MAX_VALUE;
		long x = a[0];
		long y = sum - x;
		ans = (x-y)>0?(x-y):(x-y)*(-1);
		if(N != 2){
			for(int i=1;i<N-1;i++){
				long ans1 = x + a[i] * 2 - y;
				long ans2 = x - y;
				ans1 = (ans1>=0)?ans1:ans1*(-1);
				ans2 = (ans2>=0)?ans2:ans2*(-1);
				if(ans1<ans2){
					if(ans1<ans){
						ans = ans1;
					}
				}else{
					if(ans2<ans){
						ans = ans2;
					}
				}
				x += a[i];
				y -= a[i];
			}
		}
		System.out.println(ans);
		sc.close();
	}

}


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

int main(){
    int n,k;
    cin >> n >> k;
    int arr[n]={};
    for(int i=0;i<n;i++){
    	cin >> arr[i];
    }
    int dp[n] = {};
    for(int i=0;i<n;i++){
        dp[i]=INT_MAX;
    }
    dp[0] = 0;
    dp[1] = abs(arr[1]-arr[0]);
    for(int i = 2;i<n;i++){
        for(int j=i-1;j>=max(i-k,0);j--){
            dp[i] = min(dp[i],dp[j]+abs(arr[i]-arr[j]));
        }
    }
    cout << dp[n-1] << endl;
	return 0;
}   

Measured memory_bytes: 4400
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int main(){
    int r=0;
    SCD(r);
    double out= (double)2*PI*r;
    printf("%.3f", out);
}

Measured memory_bytes: 3764
#include <stdio.h>

#define NMAX 100
#define INF 200000000
#define min(a, b) (a < b ? a : b)

int n;
int m[NMAX + 10][NMAX + 10]; // 1-origin
int p[NMAX + 10];            // 1-origin, column number array

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d %d", &p[i - 1], &p[i]);
        m[i][i] = 0; // single matrix cost 0
    }
    // l: length of consecutive matrix
    for (int l = 2; l <= n; l++) {
        // i,j: consectutive matrix sequence [i, j]
        // j<=n,j-i+1=l --> j=l+i-1<=n --> i<=n-1+1
        for (int i = 1; i <= n - l + 1; i++) {
            int j = l + i - 1;
            // printf("i=%d,j=%d\n", i, j);
            m[i][j] = INF;
            // k: cut point [i,j] --> [i,k],[k+1,j]
            // k>=i,k+1<=j --> i<=k<=j-1
            for (int k = i; k <= j - 1; k++) {
                int val = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];
                // printf("val=%d\n", val);
                if (val < m[i][j])
                    m[i][j] = val;
            }
        }
    }
    printf("%d\n", m[1][n]);
    return 0;
}


Measured memory_bytes: 2728
a,b,ab,x,y = map(int,input().split())

ans = a*x + b*y
ch = -a-b + 2*ab
for i in range(1,max(x,y)+1):
    if i <= min(x,y):
        ans = min(ans , ans + ch)
    else:
        if x < y:
            ans = min(ans , ans + ch + a)
        else:
            ans = min(ans , ans + ch + b)
print(ans)

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

int main(){
	string s;
	cin >> s;
	int c = 0;
	int f = 0;
	for(int i = 0;i < s.length();i++){
		if(s.at(i) == 'C'){
			c++;
		}
		if(s.at(i) == 'F' && c > 0){
			f++;
		}
	}
	if(f > 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
N = int(input())
p2 = [0] * N
p5 = [0] * N

out = 0

for i in range(N):
    s = input()
    
    if '.' in s:
        a, b = s.split('.')
        inp = int(a+b)
        twos = -len(b)
        fives = -len(b)
    else:
        inp = int(s)
        twos = 0
        fives = 0

    while inp % 2 == 0:
        twos += 1
        inp //= 2
    while inp % 5 == 0:
        fives += 1
        inp //= 5

    if twos >= 0 and fives >= 0:
        out -= 1

    p2[i] = twos
    p5[i] = fives

count = [[0] * 105 for i in range(105)]
for i in range(N):
    count[p2[i]][p5[i]] += 1

pref = [[0] * 105 for i in range(105)]
for i in range(50,-51,-1):
    for j in range(50, -51, -1):
        curr = count[i][j]
        curr += pref[i + 1][j]
        curr += pref[i][j + 1]
        curr -= pref[i + 1][j + 1]
        pref[i][j] = curr

for i in range(N):
    out += pref[-p2[i]][-p5[i]]
    #print(pref[-p2[i]][-p5[i]])
print(out//2)


Measured memory_bytes: 78016
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val h = sc.nextLong()
    val w = sc.nextLong()
    println(problempanasonic2020b(h, w))
}

fun problempanasonic2020b(h: Long, w: Long): Long {
    if (h == 1L || w == 1L) return 1
    return h * w / 2 + if (h * w % 2 != 0L) 1 else 0
}

Measured memory_bytes: 31268
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int chou=0,hisi=0;
  int x1,x2,x3;

  while(scanf("%d,%d,%d", &x1,&x2,&x3) == 3) {
    if(x3 * x3 == x1*x1 + x2*x2)
      chou++;
    if(x1 == x2)
      hisi++;
  }
  cout << chou << endl << hisi << endl;

}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF INT_MAX/2
#define mod 1000000007

#define MAX_V 100010

struct edge{ int to,cap,rev; };
vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,int cap,bool dir){
  G[from].push_back((edge){to,cap,(int)G[to].size()});
  G[to].push_back((edge){from,(dir?cap:0),(int)G[from].size()-1});
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s]=0;
  que.push(s);
  while(!que.empty()){
    int v=que.front(); que.pop();
    for(int i=0;i<(int)G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[e.to]<0){
        level[e.to]=level[v]+1;
        que.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  while(1){
    bfs(s);
    if(level[t]<0)return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,INF))>0){
      flow+=f;
    }
  }
}

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

  int N,M,S1,T1,S2,T2;
  cin>>N>>M>>S1>>T1>>S2>>T2;
  S1--;T1--;S2--;T2--;
  vector<P> es;

  int source1=N,sink1=N+1,source2=N+2,sink2=N+3;
  rep(i,M){
    int a,b;
    cin>>a>>b;
    a--;b--;
    es.push_back(P(a,b));
  }

  rep(i,M){
    add_edge(es[i].fi,es[i].se,true,1);
  }
  add_edge(source1,S1,M,false); add_edge(source1,S2,M,false); add_edge(T1,sink1,M,false); add_edge(T2,sink1,M,false);
  int f1=max_flow(source1,sink1);

  rep(i,N){
    G[i].clear();
  }
  rep(i,M){
    add_edge(es[i].fi,es[i].se,true,1);
  }
  add_edge(source2,S1,M,false); add_edge(source2,T2,M,false); add_edge(T1,sink2,M,false); add_edge(S2,sink2,M,false);
  int f2=max_flow(source2,sink2);

  cout<<min(f1,f2)<<endl;

  return 0;
}



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

signed main() {
	while (true) {
		int n, r;
		cin >> n >> r;
		if (n == 0 && r == 0) break;
		vector<int> a(n);

		for (int i = 0; i < n; i++) a[i] = i + 1;

		for (int i = 0; i < r; i++) {
			int p, c;
			cin >> p >> c;
			rotate(a.end() - (p - 1) - c, a.end() - (p - 1), a.end());
		}

		cout << a[n - 1] << endl;
	}
}





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

int main(void) {
	int n, m, r;
	cin >> n >> m;
	vector<int> tree(n);
	vector<vector<int> > parent(n, vector<int>(0)), child(n, vector<int>(0));
	
	for (int i = 0; i < n - 1 + m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		parent[b].push_back(a);
		child[a].push_back(b);
	}
	
	for (int i = 0; i < n; i++) {
		if (parent[i].size() == 0) r = i;
	}
	
	queue<int> q;
	vector<int> v(n, 0);
	q.push(r);
	
	tree[r] = -1;
	
	while (!q.empty()) {
		int now = q.front(); q.pop();
		
		for (int i = 0; i < child[now].size(); i++) {
			bool flag = true;
			int next = child[now][i];
			
			v[next]++;
			
			if (v[next] != parent[next].size()) continue;
			
			tree[next] = now;
			q.push(next);
		}
	}
	
	for (int i = 0; i < n; i++) cout << tree[i] + 1 << endl;
}

Measured memory_bytes: 12544
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
using namespace std;



int main()
{
	int n, m, sum = 0;
	double m4;
	cin >> n >> m;

	vector<int> v(n);

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

	sort(v.begin(), v.end());
	m4 = sum / 4.0 / m;

	if (m4 > v[v.size() - m]) {
		printf("No");
	} else {
		printf("Yes");
	}



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s, t;
    cin >> s >> t;
    ll ans = 0;
    rep(i, sz(s)){
        if(s[i] != t[i]) ans++;
    }
    print(ans);

}




//queue<pint>().swap(q); キュー内を全て削除
//priority_queue<ll, vector<ll>, greater<ll> > que;
//auto dp=make_v<int>(4,h,w);
//vector<vector<ll>> g;
//g.assign(n, vector<ll>()); g.resize(n);でも大丈夫っぽい
//fill_v(dp,0);

Measured memory_bytes: 3884
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mx 100005
#define inf 100000000000000000LL
ll arr[mx], dp[mx];
int n;
ll solve(int pos)
{
    if(pos==n) return 0;
    ll&ret = dp[pos];
    if(dp[pos]!=-1) return ret;
    ret = inf;
    ret = min(ret, llabs(arr[pos] - arr[pos+1]) + solve(pos+1));
    if(pos+1 != n)ret = min(ret, llabs(arr[pos] - arr[pos+2]) + solve(pos+2));
    return ret;
}
int main()
{
    //fast;
    while(scanf("%d",&n)){
        for(int i=1; i<=n; i++)
            scanf("%lld",&arr[i]);
        memset(dp, -1, sizeof dp);
        printf("%lld\n", solve(1));
        return 0;
    }
}



Measured memory_bytes: 6528
from math import sqrt
from sys import exit
N=int(input())
A=list(map(int,input().split()))

if len(A)==2:
    print(max(A))
    exit()

def gcd(a,b):
    if a<b: a,b=b,a
    if a%b==0: return b
    return gcd(b,a%b)
    
g=A[0]
L=[g]
for a in A[1:-1]:
    g=gcd(g,a)
    L.append(g)
    
g=A[-1]
R=[g]
for a in A[1:-1][::-1]:
    g=gcd(g,a)
    R.append(g)

ans=max(L[-1],R[-1])
for l,r in zip(L[:-1],R[:-1][::-1]):
    ans=max(ans,gcd(l,r))
print(ans)

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

int main() {
  string N;
  cin >> N;

  int ans = ((N.size() - 1) * 9);
  
  bool flag = true;
  for (int i = 1; i < N.size(); i++) {
    if(N.at(i) != '9'){
      flag = false;
      break;
    }
  }
  if (flag) ans += N.at(0) - '0';
  else
    ans += N.at(0) - '1';

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  long long s;
  cin>>s;
  long long x[3],y[3];
  long long M = 1e18;
  long long m = 1e9;
  x[1]=0;
  y[0]=0;
  x[2]=m;
  if(s==M){
    y[1]=m;
    y[2]=m;
    x[0]=0;
    REP(i,3){
      cout<<x[i]<<' '<<y[i]<<' ';
    }
    return 0;
  }
  y[1]=s/m;
  y[2]=y[1]+1;
  x[0]=s%m;
  REP(i,3){
    cout<<x[i]<<' '<<y[i]<<' ';
  }
  return 0;
}

Measured memory_bytes: 384
/**
 *    author:  zjsdut
 *    created: 2020/03/14 20:03:43
 **/
#include <bits/stdc++.h>

using namespace std;

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

template <typename A, typename B> bool chkmin(A &a, const B &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}

template <typename A, typename B> bool chkmax(A &a, const B &b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}

template <typename T> istream &operator>>(istream &stream, vector<T> &vec) {
  for (auto &x : vec)
    stream >> x;
  return stream;
}

void scan() {}

template <class T, class... Args> void scan(T &a, Args &... rest) {
  cin >> a;
  scan(rest...);
}

using ll = long long;
using vl = vector<ll>;
using vb = vector<bool>;
using vi = vector<int>;
using pii = pair<int, int>;
template <typename T> using vv = vector<vector<T>>;
#define rng(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define up(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define down(i, b, a) for (int i = int(b); i >= int(a); i--)
#define rep(n)                                                                 \
  for (int _iter_##n = 0, _num_##n = (int)n; _iter_##n < _num_##n; ++_iter_##n)
#define FOR(x, cont) for (const auto &x : cont)
#define For(x, cont) for (auto &x : cont)
#define all(x) begin(x), end(x)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ep emplace
#define SZ(x) (int)(x).size()
#define UNIQ(vec) (vec).erase(unique(all(vec)), end(vec))
#define LB(cont, x) int(lower_bound(all(cont), x) - begin(cont))
#define UB(cont, x) int(upper_bound(all(cont), x) - begin(cont))

template <typename T>
ostream &operator<<(ostream &stream, const vector<T> &vec) {
  if (!vec.empty()) {
    stream << vec[0];
    for (size_t i = 1; i != vec.size(); ++i)
      stream << ' ' << vec[i];
  }
  return stream;
}

template <typename T> void print(const vector<T> &t) { cout << t << '\n'; }

template <typename T> void print(const vector<vector<T>> &t) {
  for (const auto &row : t) {
    print(row);
  }
}

template <typename T> void print(const T &t) { cout << t << ' '; }

template <typename T, typename... Args>
void print(const T &t, const Args &... rest) {
  print(t);
  print(rest...);
}

template <typename T> void println(const T &t) { cout << t << '\n'; }

template <typename T, typename... Args>
void println(const T &t, const Args &... rest) {
  print(t);
  println(rest...);
}

int main() {
#if defined LOCAL
  ifstream in("in.txt");
  cin.rdbuf(in.rdbuf());
#endif
  ll h, w;
  scan(h, w);
  if (h == 1 || w == 1) {
    println(1);
    return 0;
  }
  ll ans = 0;
  ans += (h + 1) / 2 * ((w + 1) / 2);
  ans += h / 2 * ( w / 2);
  println(ans);
  return 0;
}


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

a = s[2] - s[3] + s[1]
b = s[3] + s[2] - s[0]
c = s[0] - s[3] + s[1]
d = s[1] + s[2] - s[0]

print ("{} {} {} {}".format(a,b,c,d))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int x,y,flag=0,i;
  cin >> x >>y;
  if(y%2==0){
  for(i=1;i<=x;i++)
  {
    if(y==(i*4)+(x-i)*2 || y==(x-i)*4+(i*2))
    {
      flag=1;
      break;
    }
  }
  }else
    flag=0;
  
  if(flag==1)
    cout<<"Yes";
  else
    cout <<"No";
}

Measured memory_bytes: 3620
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	name := map[byte]int{}
	for i := 0; i < n; i++ {
		s := next()
		name[s[0]]++
	}

	initials := "MARCH"
	ans := 0
	for i := 0; i < len(initials)-2; i++ {
		for j := i + 1; j < len(initials)-1; j++ {
			for k := j + 1; k < len(initials); k++ {
				ans += name[initials[i]] * name[initials[j]] * name[initials[k]]
			}
		}
	}
	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm.*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
// #define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define debug() cout << "Hi" << endl	// write debug(); in main()
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
/*		0. Go to main function first.
		1. Take all the inputs................................................
		2. Check Once whether the graph given is directed or undirected.......
		3. Tree can also be undirected.
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	//debug();
	// int main  or  int32_t main ...
	string s;
	cin >> s;
	int a=0,b=0;
	for(int i = 0;i < 3;++i){
		if(s[i] == 'A')a++;
		if(s[i] == 'B')b++;
	}
	if(a==0||b==0)cout << "No" << endl;
	else cout << "Yes" << endl;
}
/*	memset() can be used to set all values as 0 or -1 for integer data types.*/

int main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(12); std::cout << std::fixed;
	int t;
	// cin >> t;
	t = 1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) r1eturn cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long
using namespace std; 
 
const int N = 1e6 + 100, OO = 1e8, M = 1000007, P = 6151, sq = 1e3, lg = 60;
typedef pair <int, int> pii;
int a[N];

int32_t main() {
	use_fast;
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 1;
	for(int i = 1; i < (int)s.size(); i++) {
		if(s[i] != s[i - 1])
			ans++;
	}
	cout << ans << endl;
	return 0;
} 
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int max = 0;
		int min = 0;
		for (int i = 0; i < length; i++) {
			int A = sc.nextInt();
			if (i == 0) {
				max = A;
				min = A;
			}

			if (max < A) {
				max = A;
			}
			if (min > A) {
				min = A;
			}
			
		}
		System.out.println(max-min);
	}

}

Measured memory_bytes: 21076
import numpy as np

n, k = map(int, input().split())
h = np.array([0] + list(map(int, input().split()))) # index調整
dp = np.zeros(n+1,dtype=np.int)

for i in range(2,n+1):
    start = max(1,i-k)
    dp[i] = min(dp[start:i]+np.abs(h[i]-h[start:i]))            
print(dp[n])

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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

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

	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200)
		cout << s << '\n';
	else
		cout << "red\n";
}


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

int main()
{
	int n,i;
	string t_card,h_card;
	int t_count = 0,h_count = 0;
	
	cin >> n;//??????????????°
	
	for( i=0; i<n; i++){
		cin >> t_card >> h_card;
		if(t_card == h_card){//???????????¨???
			t_count ++;
			h_count ++;
		}else if(h_card > t_card){//?????????????????£???
			h_count += 3;
		}else{//????????\???(?????????????????£???)
			t_count += 3;
		}
	}
	cout << t_count << " " << h_count << endl;
	return 0;
}

Measured memory_bytes: 1208
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (n, k) = i.read2::<usize, usize>();
    let mut h = Vec::new();
    for _ in 0..n {
        h.push(i.read::<usize>());
    }
    h.sort();
    let k = k - 1;
    let r = (0..n - k).map(|i| h[i + k] - h[i]).min().unwrap();
    writeln!(o, "{}", r).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 4352
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

w = input()

for s in w:
    if (w.count(s) % 2 != 0):
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 9020
#include<iostream>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false); 
    cout.tie(NULL);
  	lli h,w,ans=0;
  	cin>>h>>w;
  	lli c=(w+1)/2,c1;
  	c1=w/2;
  	if(h==1 || w==1)
  		cout<<1;
  	else
  	{
		ans=ans+((h)/2)*c1;
		ans=ans+(h-(h/2))*c;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int num(int a) {
  int ans = 1;
  

  for (int i = 2; i <= sqrt(a); i++) {
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= (cnt + 1);
    if (a == 1) break;
  }
  if (a != 1) ans *= 2;

 
  return ans;
}
int N;
int main() {
    cin >> N;
    int x=0;
    for(int i=1;i<N;i++)
    {
        x=x+num(N-i);    
    }
    cout << x;
    return 0;
}

Measured memory_bytes: 3672
#include<iostream>
    #include<iomanip>
    #include<string>
    #include<queue>
    #include<vector>
    #include<algorithm>
    #include<tuple>
    #include<numeric>
    #include<map>
    #include<cmath>
    #define ll long long
    using namespace std;
    int main(){
      int n,save;
      ll count=0;
      cin>>n;
      vector<int>a(n+1);
      vector<int>b(n);
      for(int i=0;i<n+1;i++){
        cin>>a[i];
      }
      for(int i=0;i<n;i++){
        cin>>b[i];
      }
     
      for(int i=0;i<n;i++){
        if(a[i]<b[i]){
          count+=a[i];
          b[i]-=a[i];
          if(a[i+1]<b[i]){
            count+=a[i+1];
            a[i+1]=0;
          }else{
            count+=b[i];
            a[i+1]-=b[i];
          }
        }else{
          count+=b[i];
        }
      }
      cout<<count;
    }

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}
#define int long long
signed main(){
    int x;
    cin >> x;
    for(int i=0;i<=10000000;i++){
        for(int j=0;j<=i;j++){
            if(i*i*i*i*i-j*j*j*j*j==x){
                cout << i << " " << j << endl;
                return 0;
            }
            if(i*i*i*i*i+j*j*j*j*j==x){
                cout << i << " " << -j << endl;
                return 0;
            }
        }
    }
    return 0;
}

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

int main() {
  string s;
  int i, x = 0;
  
  cin >> s;
  
  for(i=0; i<3; i++)
  {
    if(s[i] == '1')
      x++;
  }
  
  cout << x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ii pair <int, int>
#define x first
#define y second
#define db(x) cerr << #x << " = " << x << endl;
#define _ << " _ " <<

using namespace std;

const int N = 107;
const int W = 1e5 + 7;

int n, c;
int w[N], v[N];
long long dp[W];

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

	if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout);
	cin >> n >> c;
	for (int i = 1; i <= n; i++)
		cin >> w[i] >> v[i];
	for (int i = 1; i <= n; i++)
		for (int j = c; j >= 0; j--)
			if (j >= w[i])
				dp[j] = max(dp[j], dp[j - w[i]] + v[i]);

	long long res = 0;
	for (int i = 0; i <= c; i++)
		res = max(res, dp[i]);
	cout << res;
}

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

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
#pragma GCC diagnostic ignored "-Wunused-result"
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll N, K;
    cin >> N >> K;
    vector<bool> sunukes(N);
    for (ll i = 0; i < K; ++i) {
        ll d;
        cin >> d;
        for (ll j = 0; j < d; j++) {
            ll A;
            cin >> A;
            sunukes[A - 1] = true;
        }
    }
    cout << count(begin(sunukes), end(sunukes), false) << endl;
    // Failed to predict input format
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;

  double x = (double)a;
  double y = (double)b;
  cout << a / b << " " << a % b << " " << fixed << setprecision(6) << x / y << endl;
}



Measured memory_bytes: 3268