akhauriyash/Code-Regression huggingface dataset:
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
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)*}
    };
}

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

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [isize; n],
    }

    let mut sum = vec![0; n + 1];
    for i in 0..n {
        sum[i + 1] = sum[i] + a[i];
    }
    let mut m = 1 << 60;
    for i in 1..n {
        m = min(m, ((sum[i] - sum[0]) - (sum[n] - sum[i])).abs());
    }
    println!("{}", m);
}


Measured memory_bytes: 5168
//  Be name khoda
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>
using namespace std;

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

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const ll MOD = 1e9+7;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int a, b;
	cin >> a >> b;
	if (a + b == 15)
		return cout << "+\n", 0;
	if (a * b == 15)
		return cout << "*\n", 0;
	cout << "x\n";
}



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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type / Class / Struct Definitions:
using ll = long long;
using ull = unsigned long long;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll tmp = floor(n / (a + b));
    cout << tmp * a + min((n - tmp * (a + b)), a) << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    
    ll n;
    cin>>n;
    ll a[n],b[n],c[n];
    memset(b,0,sizeof(b));
    memset(c,0,sizeof(c));
    for(int i=0;i<n;i++) cin>>a[i];
    b[0]=a[0];
    c[n-1]=a[n-1];
    for(int i=1;i<n;i++){
        b[i] = __gcd(a[i],b[i-1]);
    }
    for(int i=n-2;i>=0;i--){
        c[i] = __gcd(a[i],c[i+1]);
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(i==0)
        ans= max({ans,c[i+1]});
        else if(i==n-1){
            ans=max({ans,b[i-1]});
        }
        else ans=max({ans,__gcd(b[i-1],c[i+1])});
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;

vector < int > a[10];
int c[10];
int x, y;

void dfs(int u)
{
    c[u] = 1;
    for (int v: a[u]) if (!c[v]) dfs(v);
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    for (int i = 1; i <= 3; ++i)
    {
        cin >> x >> y;
        ++c[x];
        ++c[y];
    }
    int f = 0, s = 0;
    for (int i = 1; i <= 4; ++i) if (c[i] == 1) ++f;
    else if (c[i] == 2) ++s;
    if (f == 2 && s == 2) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#!/usr/bin/env ruby
n = gets.chomp.split(" ").map(&:to_i).first
a = gets.chomp.split(" ").map(&:to_i)


a.sort!
a_max = a.last

dp = Array.new(a_max + 1, 1)
ans = 0

a.each_with_index do |a_i, i|
  if dp[a_i] == 1
    0.upto(a_max / a_i + 1) do |x|
      dp[a_i * x] = 0
    end
    if a[i] != a[i + 1]
      ans += 1
    end
  end
end

if dp[a_max] == 1
  ans += 1
end

puts ans



Measured memory_bytes: 46212
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

h,w,a,b = lr()
ans = []
tmp = ''
tmp1 = ''
for i in range(a):
    tmp = ''.join([tmp,'1'])
    tmp1 = ''.join([tmp1,'0'])
for i in range(a,w):
    tmp = ''.join([tmp, '0'])
    tmp1 = ''.join([tmp1, '1'])
for i in range(b):
    ans.append(tmp)
for i in range(b,h):
    ans.append(tmp1)
for i in range(h):
    print(ans[i])

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

void print(int A[], int N) {
	for (int i = 0; i < N; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

int bubbleSort(int A[], int N) {
	int i=0, flag = 1, count=0;
	while (flag) {
		flag = 0;
		for (int j = N - 1; j > i; j--) {
			if (A[j] < A[j - 1]) {
				int temp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = temp;
				flag = 1;
				count++;
			}
		}
		i++;
	}
	return count;
}

int main() {
	int N, A[100], count;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];

	count = bubbleSort(A, N);
	print(A, N);
	cout << count << endl;
}


Measured memory_bytes: 3068
N, W = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(1, N + 1):
    v, w = map(int, input().split())
    for j in range(W + 1):
        dp[i][j] = dp[i - 1][j]
        if j - w >= 0:
            dp[i][j] = max(dp[i][j], dp[i - 1][j - w] + v)

print(max(sum(dp, [])))


Measured memory_bytes: 41120
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if((a<b)&&(b<c))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1008
#include <iostream>                                                                                                          
#include <vector>
#include <algorithm>

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

   std::vector<int> a(N), b(N);
   for(int i=0; i<N; ++i){
      std::cin >> a[i] >> b[i];
   }   

   std::sort(a.begin(),a.end());
   std::sort(b.begin(),b.end());

   std::vector<bool> flag(N,true);
   int ans = 0;
   int life = H;
   int A = a[N-1];
   while(life>0){
      for(int i=N-1; i>=0; --i){
         if(b[i]<A || life<=0) break;
         life -= b[i];
         ++ans;
      }   
      if(life>0){
         ans += life/A + (life%A==0 ? 0 : 1); 
         life -= (life/A + (life%A==0 ? 0 : 1))*A;
      }   
   }   
   std::cout << ans << std::endl;
   return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		int sum = 0;
		for (int i = 0; i < k; i++) {
			sum += list.get(i);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 30592
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i = (s);i<(int)(n);i++)

int main(){
    int a , b;
    cin >> a >> b;
    if(a >= 13)cout << b << endl;
    else if(6 <= a && a <= 12)cout << b / 2 << endl;
    else cout << 0 << endl;
}
    


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

bool chk(int n, int a, int b){
    if(a<b) swap(a,b);
    for(int i=0; i<=n; i+=a){
        if((n-i)%b==0) return true;
    }
    return false;
}

int main(){
    int n,a,b;

    while(cin>>n>>a>>b && n+a+b){
        int ans=0;
        rep(j,n){
            int x=j+1;
            if(!chk(x,a,b)) ans++;
        }
        cout << ans << endl;
    }
}

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

#define int ll
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 2e5 + 5, LG = 35;

int DP[N][LG];
int A[N], B[N], P[N];

bool CMP(int i, int j) {
	if (A[i] == 0 && A[j] == 0) return B[i] < B[j];
	else return 1LL * A[i] * (B[j] + 1) > 1LL * A[j] * (B[i] + 1);
}

int32_t main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));
	
	memset(DP, 63, sizeof DP);

	int n, t, m = 0; cin >> n >> t;
	for (int i = 0; i < n; i++) cin >> A[i] >> B[i], P[i] = i, m += (A[i] != 0);
	sort(P, P + n, CMP);
	DP[0][0] = 0;
	for (int i = 0; i < m; i++) {
		DP[i + 1][0] = 0;
		for (int j = 0; j + 1 < LG; j++)
			if (DP[i][j] > t) DP[i + 1][j + 1] = DP[i][j + 1];
			else DP[i + 1][j + 1] = min(DP[i][j + 1],  1LL * (DP[i][j] + 1) * (1 + A[P[i]]) + B[P[i]]);
	}
	int ans = 0;
	for (int i = 0; i < LG; i++) {
		int x = DP[m][i], y = i;
		if (x >	t) continue;
		for (int j = m; j < n; j++, y += (t >= x)) x += B[P[j]] + 1;
		ans = max(ans, y);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 59648
/*
Program		: circle.c
Description	: Calculating the ratio of an area of a circle to another circle
Author		: Rey Rizki
Date		: 16 November 2019
Time        : 7:45 P.M. to 
Compiler	: gcc Ubuntu 7.4.0
*/

#include <stdio.h>

int main() {
    // DECLARATION
    int r;                          // the radius of a cricle

    // INPUT
    scanf("%d", &r);

    // OUTPUT
    printf("%d\n", r * r);

    return 0;
}

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

const long long md = 1e9+7;

int main(){
  string L; cin >> L;
  vector<vector<long long>> dp(100010,vector<long long>(2,0));
  dp[0][0] = 2;
  dp[0][1] = 1;
  int Llen = L.size();
  for (int i=1; i<Llen; i++){
    if (L[i]=='1'){
      dp[i][0] = dp[i-1][0]*2;
      dp[i][1] = dp[i-1][1]*3+dp[i-1][0];
    }
    else {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = dp[i-1][1]*3;
    }
    dp[i][0] %= md;
    dp[i][1] %= md;
  }
  long long ans = dp[Llen-1][0]+dp[Llen-1][1];
  ans %= md;
  cout << ans << endl;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()

#define PI 3.14159265359

using namespace std;
typedef long long unsigned int ll;

int main() {
	string s, t;
	cin >> s >> t;
	cout << t << s;
}

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

#define int long long

signed main() {
    string s;
    cin >> s;

    if(s == "AAA" || s == "BBB") {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3560
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
G = [[] for _ in range(n)]
win_against = [[] for _ in range(n)]
A = [-1]
for i in range(n - 1):
    a = I()
    A += [a - 1]
    win_against[a - 1] += [i + 1]

in_degree = [len(i) for i in win_against]
dp = [0] * n
dq = deque()
for i in range(n):
    if not in_degree[i]:
        dq += ([i])

order = []

while dq:
    x = dq.popleft()
    order += [x]
    if x == 0:
        break
    in_degree[A[x]] -= 1
    if in_degree[A[x]] == 0:
        dq += [A[x]]


for i in order:
    ret = 0
    s = sorted([dp[k] for k in win_against[i]])
    for l in range(1, len(win_against[i]) + 1):
        ret = max(ret, l + s.pop())
    dp[i] = ret

print(dp[0])


Measured memory_bytes: 65848
#include <bits/stdc++.h>
using namespace std;
#define lp(i, x, n) for (int i = x; i < (int)n; ++i)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()
#define ll long long
#define N 1000001
ll n, m;
int main() {
        cin >> n>> m;
        ll mx = 1;
        if (n == 1) {
                cout << m;
                return 0;
        }
        for (ll i = 2; (i * i) <= m ; i++) {
                if (m % i == 0) {
                        if ((m / i) >= n)mx = max(i, mx);
                        if (m % (m/i) == 0) {
                                if (m/(m/i) >= n) mx = max(mx, m/i);
                        }
                }
        }
        cout << mx;
        return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n, m, i, l, j, k, q, M[102], key[102][102];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    if(i<n)break;
  }
  
  for ( i = 0; i < n; i++ ) {
    scanf("%d%d", &M[i], &m);
  }
  M[n] = m;
  for ( i = 1; i < n + 1; i++ ) key[i][i] = 0;
  for ( l = 2; l < n + 1; l++) {
    for ( i = 1; i < n - l + 2; i++ ) {
      j = i + l - 1;
      key[i][j] = 100000000;
      for ( k = i; k <= j - 1; k++ ) {
	q = key[i][k] + key[k+1][j] + M[i-1] * M[k] * M[j];
	if ( key[i][j] > q ) {
	  key[i][j] = q;
	}
      }
    }
  }
  printf("%d\n", key[1][n]);
  return 0;
}



Measured memory_bytes: 2056
"use strict";

main(require("fs").readFileSync("/dev/stdin", "UTF-8"));

function main(input) {
  input = input.split("\n");
  const window_width = parseInt(input[0].split(" ")[0]);
  const curtain_width = parseInt(input[0].split(" ")[1]);

  let not_enougth = window_width - curtain_width * 2;
  if (not_enougth < 0) {
    not_enougth = 0;
  }
  console.log(not_enougth);
}


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fr(a,b) for(int i=a;i<b;i++)
#define prDouble(x) cout<<fixed<<setprecison(18)<<x
#define mod 1000000007

std::vector<int> tree[100001];
ll dp[100001][2];

int solve(int u, bool constraint, int pr)
{
	if (dp[u][constraint] != -1)
		return dp[u][constraint];
	ll ans = 0;
	ll w1 = 1;
	for (int child : tree[u])
	{
		if (child != pr)
		{
			w1 = (w1 * solve(child, 0, u)) % mod;
		}
	}
	ans += w1;
	if (!constraint)
	{
		ll w2 = 1;
		for (int child : tree[u])
		{
			if (child != pr)
			{
				w2 = (w2 * solve(child, 1, u)) % mod;
			}
		}
		ans = (ans + w2) % mod;
	}
	return dp[u][constraint] = ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	memset(dp, -1, sizeof dp);
	for (int i = 0; i < n - 1; i++)
	{
		int u, v;
		cin >> u >> v;
		tree[u].push_back(v);
		tree[v].push_back(u);
	}
	cout << solve(1, 0, -1);
	return 0;
}


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

signed main(){
    string s; cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy"<<endl;
    }else if(s=="Cloudy"){
        cout<<"Rainy"<<endl;
    }else{
        cout<<"Sunny"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
         
        int[] dic=new int[6];
        String s;
         
         
        for(int i=0;i<6;i++){
            dic[i]=scan.nextInt();
        }
        s=scan.next();
        int tmp;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='N'){
                tmp=dic[0];
                dic[0]=dic[1];
                dic[1]=dic[5];
                dic[5]=dic[4];
                dic[4]=tmp;
            }else if(s.charAt(i)=='E'){
                tmp=dic[0];
                dic[0]=dic[3];
                dic[3]=dic[5];
                dic[5]=dic[2];
                dic[2]=tmp;
            }else if(s.charAt(i)=='W'){
                tmp=dic[0];
                dic[0]=dic[2];
                dic[2]=dic[5];
                dic[5]=dic[3];
                dic[3]=tmp;
            }else{
                tmp=dic[0];
                dic[0]=dic[4];
                dic[4]=dic[5];
                dic[5]=dic[1];
                dic[1]=tmp;
            }
        }
         
        System.out.println(dic[0]);
         
        scan.close();
    }
}

Measured memory_bytes: 26272
//============================================================================
// Name        : o
// Date        : Mon Mar  4 16:55:29 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//============================================================================
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define mst(x, y) memset(x, y, sizeof(x))
#define pvar(x) cout << #x << ": "
#define fora(e, c) for (auto &e : c)
#define fori(i, a, b) for (int i = a; i < b; ++i)
#define ford(i, a, b) for (int i = a; i > b; --i)
#define output(v) cout << (v) << '\n'
#define jam(x, n) cout << "Case #" << x << ": " << n << "\n"
#define prt(x, a, n) { cout << x[a]; if (a < n - 1) cout << " "; }
#define par(x, s, n, v) if(v) pvar(x); fori(y, s, n) prt(x, y, n) cout << "\n"

#ifndef __has_trace
#define trace(...)
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int mod = (int)1e9 + 7;

void add(int &a, int b) {
    a += b;
    if (a >= mod) {
        a -= mod;
    }
}

void solve() {
    int n; cin >> n;
    vvi aa(n, vi(n));
    fori (i, 0, n) fori (j, 0, n) {
        cin >> aa[i][j];
    }

    // dp[i][mask] += dp[i-1][mask - (1 << j)]
    vi dp(1 << n);
    dp[0] = 1;
    fori (mask, 0, (1 << n) - 1) {
        int a = __builtin_popcount(mask);
        fori (b, 0, n) {
            if (aa[a][b] && !(mask & (1 << b))) {
                int m = mask ^ (1 << b);
                add(dp[m], dp[mask]);
            }
        }
    }
    output(dp[(1 << n) - 1]);
}

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



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

int main() {
  
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;

  if (A1+A2+A3<22) {
    cout << "win" << endl;
  }
  else {
    cout << "bust" << endl;
  }

  
return 0;
}

Measured memory_bytes: 3600
# ABC094b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m, x = map(int, input().split())
a = list(map(int, input().split()))

left = 0
right = 0
for i in a:
    if (i > x):
        left += 1
    else:
        right += 1
print(min(left, right))

Measured memory_bytes: 3188
import sys

n = int(input())
s = input()
i = 0
ck = ''
result = ''
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		if s[i] != ck:
			ck = s[i]
			result += ck
	elif s[i] != ck:
		ck = s[i]
		result += ck

if s[-1:] != ck:
	result += s[-1:]

print(len(result))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define radhey krishna
#define endl "\n"

 
int main(){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
       ios_base::sync_with_stdio(false);
       cin.tie(0);
       cout.tie(0);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	if(n<=1000){
		cout<<1000-n<<endl;
	}
	else if(n>1000 && n<=2000){
		cout<<2000 - n<<endl;
	}
	else if(n>2000 && n<=3000){
		cout<<3000-n;
	}
	else if(n>3000 && n<=4000){
		cout<<4000 -n;
	}
	else if(n>4000 && n<=5000){
		cout<<5000 -n;
	}
	else if(n>5000 && n<=6000){
		cout<<6000 -n;
	}
	  else if(n>6000 && n<=7000){
		cout<<7000 -n;
	} 
	 else if(n>7000 && n<=8000){
		cout<<8000 -n;
	}
	 else if(n>8000 && n<=9000){
		cout<<9000 -n;
	}  
	 else {
		cout<<10000 -n;
	}
	return 0;  
}
	

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define FASTINPUT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define ll long long 
#define mp make_pair
#define pb push_back
#define Ma 1000000007
int main(){
  FASTINPUT;
  //#ifndef ONLINE_JUDGE
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  //#endif
   ll t;
   t=1;
   while(t>0)
   {
   ll n;
   cin>>n;
   string s;
   cin>>s;
   ll r=0,b=0;
   for(int i=0;i<s.length();i++)
   {
    if(s[i]=='R')
      r++;
    else
      b++;
   }
   if(r>b)
   {
    cout<<"Yes";
   }
   else
    cout<<"No";

    t--;
    }
    //cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
 return 0; 
    
}

           

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll A, B, C, D;
  cin >> A >> B >> C >> D;

  ll a = A;
  ll c = C;
  while (true) {
    c = c - B;
    if (c <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
    a = a - D;
    if (a <= 0) {
      cout << "No" << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdlib>  // abs() for integer
#include <math.h>     // math.h をインクルードする！
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    int Max = 0;
    int sum = 0;
    rep(i, n) {
        cin >> l[i];
        Max = max(Max, l[i]);
        sum += l[i];
    }
    if (Max < sum - Max) cout << "Yes" << endl;
    else cout << "No" << endl;
}



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

int main() {
  int input;
  cin >> input;
  int former = input / 100;
  int latter = input % 100;
  if (former >= 1 && former <= 12) {
    if (latter >= 1 && latter <= 12) cout << "AMBIGUOUS" << endl;
    else cout << "MMYY" << endl;
  }
  else if(latter >= 1 && latter <= 12) cout  << "YYMM" << endl;
  else cout << "NA" << endl;
}
  

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int D, T, S;
    cin >> D >> T >> S;
    
    int meterMin = T * S;
    
    if(D <= meterMin){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3112
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  vector<ll> x(n), y(n);
  REP(i, n) cin >> x[i] >> y[i];
  map<P, int> mp;
  REP(i, n) REP(j, n) {
    if (i == j) continue;
    mp[P(x[i] - x[j], y[i] - y[j])]++;
  }
  int mx = 0;
  for (auto a : mp) {
    mx = max(mx, a.second);
  }
  cout << n - mx << endl;
  return 0;
}

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

using namespace std;

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

    int i=1;
    long long num=0;
    while(num<N){
        num = i*i;
        if(num>N){
            num = (i-1)*(i-1);
            break;
        }
        i++;
    }
    cout<<num<<endl;
}


Measured memory_bytes: 256
#include<iostream> //cinなど
#include<string> //文字列
#include<algorithm> //sort など
#include<math.h> //paw(冪乗など)
#include<set> // 集合
#include<map> //写像
#include<stdio.h> //printf
#include<stack>

using namespace std;
int main(){
  int r,g,b,sum;
  cin>> r >> g >> b;
  sum = r*100 + g*10 + b;
  if(sum % 4 == 0){
    cout<< "YES" <<endl;
  }else{
    cout<< "NO" <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int K = sc.nextInt();
		
		boolean ok = false;
		for(int i=0; i<=N; i++)
			for(int j=0; j<=M; j++)
				ok |= i*(M-j)+j*(N-i)==K;
		
		System.out.println(ok ? "Yes" : "No");
		
		sc.close();
	}
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int n;
int h[100005];
bool judge()
{
	int ans=0x7f7f7f7f;
	for(int i=n;i>=1;--i)
	{
		if(h[i]>ans)
		{
			if(h[i]>ans+1) return false;
		}
		else ans=h[i];
	}
	return true;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i) cin>>h[i];
	if(judge()) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define inf 1e9
#define INF 1000000000000000000

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    ll MOD = pow(10, 9) + 7;
    vector<ll> zeros(60, 0), ones(60, 0);

    rep(i, N) {
        ll a;
        cin >> a;
        rep(j, 60) {
            if (a & ((ll)1 << j))
                ones[j]++;
            else
                zeros[j]++;
        }
    }

    ll res = 0;
    rep(i, 60) {
        res += zeros[i] * ones[i] % MOD * modpow(2, i, MOD), res %= MOD;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    auto s = new bool[](10^^5 + 1);
    s[] = 1;
    s[0] = s[1] = 0;

    for (int p = 2; p*p <= 10^^5; p++) {
        if (s[p]) {
            for (int q = p*p; q <= 10^^5; q += p) {
                s[q] = 0;
            }
        }
    }

    auto t = new int[](10^^5 + 1);

    foreach (i ; 3 .. 10^^5 + 1) {
        if (s[i] && s[(i + 1) / 2]) {
            t[i] = 1;
        }
    }

    foreach (i ; 1 .. 10^^5 + 1) {
        t[i] += t[i-1];
    }

    int q;
    int li,ri;

    scan(q);

    foreach (i ; 0 .. q) {
        scan(li, ri);
        writeln(t[ri] - t[li-1]);
    }
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 3836
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>
#include <map>

int main()
{
    int x{}, y{}, z{};
    std::cin >> x >> y >> z;
    std::swap(x, y);
    std::swap(x, z);
    std::cout << x << ' ' << y << ' ' << z << std::endl;
    return 0;
}


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

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {

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

        for (int i = N - 2; i >= 0; --i) {
            if (H[i] > H[i + 1]) {
                H[i]--;
            }
            if (H[i] > H[i + 1]) {
               cout << "No" << endl;
               return;
            }
        }
        cout << "Yes" << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <cstdlib>
typedef long long int ll;
using namespace std;
const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

int main() {

    ll N,M;
    cin >> N >> M;
    if(abs(N-M)>1){
        cout << 0 << endl;
    }else{


        if(N==M){
            cout << 2*facctorialMethod(N)*facctorialMethod(M)%MOD << endl;

        }else{
            cout <<facctorialMethod(N)*facctorialMethod(M)%MOD<< endl;
        }

    }

}

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

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

    static class ADDCCFinals {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt(), y = in.nextInt();

            long answer = 0;
            if (x <= 3) {
                answer += 4 - x;
            }
            if (y <= 3) {
                answer += 4 - y;
            }
            if (x == 1 && y == 1) {
                answer += 4;
            }
            answer *= 100000;
            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 22740
N = int(input())
P_list = list(map(int, input().split()))
Q_list = list(map(int, input().split()))

def all_patterns(n, pattern, patterns):
	if len(pattern) == n:
		patterns.append(pattern)
	else:
		for i in range(1, n + 1):
			if not i in pattern:
				all_patterns(n, pattern + [i], patterns)

patterns = []
all_patterns(N, [], patterns)

print(abs(patterns.index(P_list) - patterns.index(Q_list)))


Measured memory_bytes: 8948
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// 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)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        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)*}
    };
}

#[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<_>>()
    };

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        s: chars,
        t: chars
    }
    let mut cnt = 0;
    for i in 0..3 {
        if s[i] == t[i] {
            cnt+=1;
        }
    }
    println!("{}", cnt);
}

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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

const long mx = 1e18;

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

  vector<long> a(n);
  for (long &x : a) {
    cin >> x;
    if (x == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  long now = 1;
  for (auto x : a) {
    if ((now) > (mx / x) || x * now > mx) {
      now = -1;
      break;
    } else {
      now *= x;
    }
  }
  cout << now << endl;
}


Measured memory_bytes: 4028
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        String S=sc.next();


        String[] strArray=S.split("");

        int i=0;
        int sum=1;


        for(i=0;i<N-1;i++){
            if(!(strArray[i].equals(strArray[i+1]))){
                sum=sum+1;
            }
        }
        System.out.println(sum);

        //END
    }
}



Measured memory_bytes: 31828
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N, M; cin >> N >> M;
	vector<int> A(M), C(M);
	for(int i=0; i<M; i++){
		int b;
		cin >> A[i] >> b;
		for(int j=0; j<b; j++){
			int c; cin >> c;
			C[i] += 1<<(c-1);
		}
	}

	vector<int> cost(1<<N, 1e9);
	queue<pair<int, int>> que;
	for(int i=0; i<M; i++) que.push({C[i], A[i]});
	while(!que.empty()){
		int x = que.front().first;
		int c = que.front().second;
		que.pop();
		if(cost[x] <= c) continue;
		cost[x] = c;
		for(int i=0; i<1<<N; i++){
			int y = x | i;
			if(cost[i]==1e9) continue;
			if(cost[y] > cost[x]+cost[i]){
				que.push({y, cost[x]+cost[i]});
			}
		}
	}

	if(cost[(1<<N)-1] == 1e9) cout << -1 << endl;
	else cout << cost[(1<<N)-1] << endl;

	return 0;
}


Measured memory_bytes: 600916
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)





vector<vector<ll>> g1, g2;
vector<ll> dist, cnt;

void dfs(ll v, ll d){
    cnt[v]--;
    ll res = max(d, dist[v]);
    dist[v] = res;
    if(cnt[v] > 0){
        return;
    }
    for(auto &child : g1[v]){
        dfs(child, res + 1);
    }
}

int main() {
    ll n, m;
    cin >> n >> m;
    g1.resize(n);
    g2.resize(n);
    cnt.resize(n);
    REP(i, n - 1 + m){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g1[a].push_back(b);
        g2[b].push_back(a);
        cnt[b]++;
    }
    
    ll root = -1;
    REP(i, n){
        if(cnt[i] == 0){
            root = i;
            break;
        }
    }
    dist.resize(n);
    dfs(root, 0);
    
    /*
    REP(i, n){
        cout << dist[i] << endl;
    }
    */
    
    REP(i, n){
        ll ans = 0, d = dist[i];
        for(auto &par : g2[i]){
            if(d - 1 == dist[par]){
                ans = par + 1;
                break;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 18048
#define _CRT_SECURE_NO_WARNINGS
////#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
//#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int d[10];
void sort() {
	int i,j,t;
	for(i=0;i<9;i++)
		for (j = i + 1; j < 10;j++) {
			if (d[i] < d[j]) t = d[i], d[i] = d[j], d[j] = t;
		}
}
int main() {
	int i;
	for (i = 0; i < 10; i++) fscanf(stdin, "%d", &d[i]);
	sort();
	fprintf(stdout,"%d ",d[0] + d[1] + d[2]);
	for (i = 0; i < 10; i++) fscanf(stdin, "%d", &d[i]);
	sort();
	P(d, d[0] + d[1] + d[2]);
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main(){
	string s;
	cin >> s;
	for(int i=s.length()-2;i>=1;i--){
		if((i+1)%2!=0) continue;
		bool flag=true;
		for(int j=0;j<(i+1)/2;j++){
			if(s[j]!=s[(i+1)/2+j]) flag=false;
		}
		if(flag){
			cout << i+1 << endl;
			return 0;
		}
	}
}


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

int n, k;
std::vector<int> l;

int main(){
    std::cin >> n >> k;
    int tmp;
    for(int i = 0; i < n; i++){
        std::cin >> tmp;
        l.push_back(tmp);
    }
    std::sort(l.begin(), l.end(), std::greater<int>());
    int ans = 0;
    for(int i = 0; i < k; i++){
        ans += l[i];
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

using namespace std;

int kk[3];

int ind(char c) {
	return c == 'R' ? 0 : c == 'G' ? 1 : 2;
}

int main() {
	int n; cin >> n;
	string s; cin >> s;
	long long bad = 0;
	for (int j = n - 1; j >= 0; j--) {
		for (int i = 0; i < j; i++) {
			if (s[i] == s[j]) {
				bad += n - 1 - j;
				continue;
			}
			int l = j - i;
			bad += kk[ind(s[i])];
			bad += kk[ind(s[j])];
			if (j + l < n)
				bad++;
			if (j + l < n && s[j + l] == s[i])
				bad--;
			if (j + l < n && s[j + l] == s[j])
				bad--;
		}
		kk[ind(s[j])]++;
	}
	cout << (long long) n * (n - 1) * (n - 2) / 6 - bad << '\n';
	return 0;
}


Measured memory_bytes: 3644
using System;
using static System.Console;
using System.Linq;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
          int[] k = new int[32]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
          int n = int.Parse(ReadLine());
          WriteLine(k[n-1]);
      }
   }
}

Measured memory_bytes: 13268
<?php
fscanf(STDIN, "%d", $n);

$format = join(' ', array_fill(0, $n, '%d'));
$nums = array_map('intval', fscanf(STDIN, $format));

$count = bubble_sort($nums);

echo join(' ', $nums)."\n";
echo "$count\n";

function bubble_sort(&$nums)
{
    $count = 0;
    $need_to_sort = true;

    while ($need_to_sort) {
        $need_to_sort = false;

        for ($i = count($nums)-1; $i > 0; $i--) {
            if ($nums[$i-1] <= $nums[$i]) {
                continue;
            }

            $tmp = $nums[$i];
            $nums[$i] = $nums[$i-1];
            $nums[$i-1] = $tmp;

            $need_to_sort = true;
            $count++;
        }
    }

    return $count;
}

Measured memory_bytes: 6676