akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int n,k,mi=0,ma=0;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
    for (int i=1;i<=n;i++) {
        int a;
        cin>>a;
        ma = max(ma,a);
        if (a<mi) {
            int tg=mi;
            mi=a;
            a=tg;
        }
        if (mi==0) mi=a;
        else {
            if (a%mi!=0) mi=a%mi;
        }
    }
    if ((ma>=k) && (ma-k)%mi==0) cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define     __        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

int main()
{
    __;

    int a,b,c;

    cin >> a >> b>> c;

    if(a == b && b == c) cout<<"Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;

LL gcd(LL a, LL b) {
	if (b == 0LL) return a;
	return gcd(b, a%b);
}

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

int main() {
	LL a, b;
	while (~scanf("%lld%lld", &a, &b)) {
		printf("%lld %lld\n", gcd(a, b), lcm(a, b));
	}

	return 0;
}

Measured memory_bytes: 1020
#include<iostream>
using namespace std;
long long dp[110][21],a[100],n;
int main(){
	cin>>n;for(int i=0;i<n;i++)cin>>a[i];
	dp[0][a[0]]=1;
	for(int i=1;i<n-1;i++){
		for(int j=0;j<=20;j++){
			if(j+a[i]>=0 && j+a[i]<=20)dp[i][j+a[i]]+=dp[i-1][j];
			if(j-a[i]>=0 && j-a[i]<=20)dp[i][j-a[i]]+=dp[i-1][j];
		}
	}
	cout<<dp[n-2][a[n-1]]<<endl;
	return 0;
}

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

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0; }
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0; }

using pii=pair<int,int>;
const int limit=200010;
int num[limit];

int main(){
	int n,m;
	cin >> n >> m;
	int total=0;
	for(int i=n;i>=1;--i) num[i]=total++;
	
	rep(i,m){
		int e;
		cin >> e;
		num[e]=total++;
	}	
	
	vector<pii> ary;
	for(int i=1;i<=n;++i) ary.push_back(pii(num[i],i));
	sort(begin(ary),end(ary));
	reverse(begin(ary),end(ary));
	for(auto &it:ary) cout << it.second << endl;
	return 0;
}

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

long gcd(long x, long y);

int main() {
    long a, b, ans;
    cin >> a >> b;
    if(a > b) swap(a, b);
    ans = a * b / gcd(a, b);
    cout << ans << endl;
}

long gcd(long x, long y) {
    if(y % x == 0) return x;
    return gcd(y % x, x);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main(){
    int N;
    cin >> N;
    vector<int> A(N+1), B(N);
    for(int i=0; i<N+1; i++) cin >> A[i];
    for(int i=0; i<N; i++) cin >> B[i];

    ll count = 0;

    for(int i=0; i<N; i++) {
        if(A[i] >= B[i]) {
            count += B[i];
            A[i] -= B[i];
        }
        else if(A[i] < B[i]) {
            count += A[i] + min(B[i] - A[i], A[i+1]);
            A[i+1] = max(A[i+1]-(B[i]-A[i]), 0);
        }
    }
    cout << count << endl;
}

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

int main() {
  int n,m; cin>>n>>m;
  vector<int> x1(n), y1(n);
  vector<int> x2(m), y2(m);
  rep(i, n) cin>>x1[i]>>y1[i];
  rep(i, m) cin>>x2[i]>>y2[i];

  vector<int> ans(n);
  rep(i, n) {
    int tmp1=-1;
    int tmp2=1e9;
    rep(j, m) {
      if (tmp2>abs(x1[i]-x2[j])+abs(y1[i]-y2[j])) {
        tmp2=abs(x1[i]-x2[j])+abs(y1[i]-y2[j]);
        tmp1=j;
      }
    }
    ans[i]=tmp1+1;
  }
  rep(i, n) cout<<ans[i]<<endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
	int N;
  	cin >> N;
  	int p[N];
  	int q[N];
  	for(int i = 0; i < N; i++){
    	cin >> p[i];
    	q[i] = p[i];
    }
	sort(q, q+N);
  	int count=0;
  	for(int i = 0; i < N; i++){
    	if(p[i] != q[i]) count++;
    }
  	if(count == 0 || count ==2) cout << "YES" << endl;
  	else cout << "NO" << endl;
}

Measured memory_bytes: 256
class UnionFind():
    '''UnionFind木'''

    def __init__(self, n):
        self.data = [-1] * n

    def unite(self, x, y):
        '''x と y を結合'''
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.data[x] < self.data[y]:
            x, y = y, x  # swap
        self.data[x] += self.data[y]
        self.data[y] = x

    def find(self, x):
        '''ノード x の親を返す'''
        if self.data[x] < 0:
            return x
        self.data[x] = self.find(self.data[x])
        return self.data[x]

    def same(self, x, y):
        '''x と y が同じグループに属するか判定'''
        return self.find(x) == self.find(y)

    def size(self, x):
        '''x を含むグループのノード数を返す'''
        return self.data[self.find(x)]
    def indep(self):
        dep = 0
        for i in range(len(self.data)):
            if self.data[i] < 0:
                dep += 1
        return dep


n,m = map(int,input().split())
uf = UnionFind(n+1)
for i in range(m):
    x,y,z = map(int,input().split())
    uf.unite(x,y)

print(uf.indep()-1)


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

namespace ABC098
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b,c;
            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);

            c = a + b;
            if (c< a - b) c = a-b;
            if (c < a*b) c = a *b;
            Console.WriteLine(c);
            Console.ReadKey();
        }
        
                
    }
}


Measured memory_bytes: 13140
using System;

class MyClass
{
    public static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int n = int.Parse(str[0]);
        int m = int.Parse(str[1]);
        int[,] a = new int[n, m];
        int[] b = new int[m];
        for (int i = 0; i < n; i++)
        {
            string[] str2 = Console.ReadLine().Split(' ');
            for (int j = 0; j < m; j++)
            {
                a[i, j] = int.Parse(str2[j]);
            }
        }
        for (int i = 0; i < m; i++)
        {
            b[i] = int.Parse(Console.ReadLine());
        }
        for (int i = 0; i < n; i++)
        {
            int c = 0;
            for (int j = 0; j < m; j++)
            {
                c += a[i, j] * b[j];
            }
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 19952
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

int vs[100000+10];

int main(void) {
  int N, K, nQuery;
  scanf("%d%d%d", &N, &K, &nQuery);
  REP(i, N) {
    vs[i] = K-nQuery;
  }
  REP(iQuery, nQuery) {
    int v;
    scanf("%d", &v);
    --v;
    vs[v]++;
  }
  REP(i, N) {
    if(vs[i] <= 0) {
      puts("No");
    } else {
      puts("Yes");
    }
  }
  
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//using ll=long long;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/*-------------ここまで---------------------------------------------*/

/*signed*/int main() {
    int a, b, t;
    cin >> a >> b >> t;
    cout << (t / a) * b << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>
#include <queue>
#include <stack>
#include <set>
using namespace std;

int main()
{
    int n,i,j,flag;
    while(~scanf("%d",&n))
    {
        flag=0;
        for(i=0; i<15; i++)
        {
            for(j=0; j<26; j++)
            {
                if((j*4+i*7)==n)
                {
                    printf("Yes\n");

                    flag=1;
                    break;
                }
            }
            if(flag==1)
                break;
        }
        if(flag==0)
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{

  long long int n;
  char s[4000];

  long long int count_R=0, count_G=0, count_B=0;
  long long int ans=0, not_ans=0;
  long long int i, j;

  scanf("%lld", &n);
  scanf("%s", s);

  for (i=0;i<n;i++) {
    switch (s[i]) {
    case 'R': count_R++; break;
    case 'G': count_G++; break;
    case 'B': count_B++; break;
    }
  }

  ans = count_R*count_G*count_B;

  for (i=0;i<n;i++) {
    for (j=1;j<=(n-1-i)/2;j++) {
      if (s[i]!=s[i+j] && s[i+j]!=s[i+j+j] && s[i+j+j]!=s[i])
	not_ans++;
    }
  }

  ans -= not_ans;

  printf("%lld", ans);

  return 0;
}


Measured memory_bytes: 1700
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
A = [A1,A2,A3]
n = int(input())
B = [int(input()) for i in range(n)]
for i in range(n):
  for j in range(3):
    for k in range(3):
      if B[i] == A[j][k]:
        A[j][k] = "*"
ans = ["*","*","*"]
for i in range(3):
  if A[i] == ans or [A[0][i],A[1][i],A[2][i]] == ans:
    print("Yes")
    exit()
    
if [A[0][0],A[1][1],A[2][2]] == ans or [A[0][2],A[1][1],A[2][0]] == ans:
  print("Yes")
  exit()

print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

const int mod = 1000000007;



signed main() {
  int N; cin >> N;
  
  vector<int> zn(N+1,0), z(N+1,0), n(N+1,0), no(N+1,0);
  
  zn[2] = 2;
  z[2] = 17;
  n[2] = 17;
  no[2] = 64;
  
  for(int i=3; i<=N; i++) {
    zn[i] = zn[i-1]*10 + z[i-1] + n[i-1];
    zn[i] %= mod;
    z[i] = z[i-1]*9 + no[i-1];
    z[i] %= mod;
    n[i] = n[i-1]*9 + no[i-1];
    n[i] %= mod;
    no[i] = no[i-1]*8;
    no[i] %= mod;
  }
  
  cout << zn[N] << endl;
  
  

}


Measured memory_bytes: 34172
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    char[] c_array = s.toCharArray();
    StringBuffer answer = new StringBuffer("");
    
    for (int i = 0; i < c_array.length; i++) {
      if (i % 2 == 0) {
        answer.append(c_array[i]);
      }
    }
    System.out.println(answer);
  }
}


Measured memory_bytes: 26428
Scanf.scanf "%s %s" (fun s t ->
    let m = String.length s in
    let n = String.length t in
    let h = Array.make 26 [] in
    String.iteri (fun i c ->
        let c = int_of_char c - 97 in
        h.(c) <- i :: h.(c)) s;
    let h = Array.map (fun l -> Array.of_list (List.rev l)) h in

    let find a p =
        let ll = Array.length a in
        let rec loop l r =
            if l = r then (if l = ll then (-1) else a.(l)) else
                let m = (l + r) / 2 in
                if a.(m) < p then loop (m + 1) r else loop l m
        in
        loop 0 ll
    in

    let rec loop i cur acc =
        if i = n then m * acc + cur else
            let q = int_of_char t.[i] - 97 in
            let idx = find h.(q) cur in
            if idx >= 0 then loop (i + 1) (idx + 1) acc else
                let idx = find h.(q) 0 in
                if idx >= 0 then loop (i + 1) (idx + 1) (acc + 1) else
                    -1
    in
    loop 0 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 11984
#include <iostream>
#include <cstdlib>
#include <string>

int main()
{
    std::string s;
    //char temp;
    long long sum = 0;
    long long size = 0;
    while (true)
    { //std::cin >> s && sはむり
        std::cin >> s;
        sum = 0;
        size = s.length();

        if (s == "0")
        {
            break;
        }

        for (int i = 0; i < size; i++)
        {
            sum += s[i] - '0';
        }
        std::cout << sum << std::endl;
    }

    return 0;
    //atoi(s.c_str())
}


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

#define ll long long int
#define pii pair<int,int>
#define PII pair<ll,ll>

const ll sz=1e5+100;

int main()
{
    ll n,m,p,q,x;

    ll sum=0;
    ll last=0;
    cin>>n;

    for(ll i=1;i<=n;i++){
        cin>>x;
        if(x<last) sum+=(last-x);
        else last=x;
    }

    cout<<sum<<endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> t(n+1), x(n+1), y(n+1);
    t[0] = 0, x[0] = 0, y[0] = 0;
    for (int i = 1; i <= n; ++i) scanf("%d %d %d", &t[i], &x[i], &y[i]);
    int dt, dr;
    for (int i = 0; i < n; ++i)
    {
        dt = t[i+1] - t[i];
        dr = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if ((dt & 1) == (dr & 1) && dt >= dr)
        {
            continue;
        }
        else
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 1408
import Data.List
import Data.Ord
import Data.Maybe

main = putStrLn . solve . drop 1 . lines =<< getContents

solve :: [String] -> String
solve ss = concat $ map (\c -> flip replicate c . minimum $ map (maybe 0 length . find ((==c) . head)) ss') ['a'..'z']
    where ss' = map (group . sort) . sortBy (comparing length) $ ss


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

#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int lli;
typedef pair<int, int> P;

lli comb_table[100050][32];

void cal() {
    for (int i = 0; i < 100050; i++)
        comb_table[i][0] = 1;

    for (int j = 0; j < 32; j++)
        comb_table[j][j] = 1;


    for (int i = 2; i < 100050; ++i) {
        for (int j = 1; j < 32 and j < i; ++j) {
            comb_table[i][j] = ( comb_table[ i-1 ][j] + comb_table[ i-1 ][ j-1 ] ) % 1000000007;
        }
    }
    return;
}

lli comb(lli a, lli b) {
    lli p = a + b;
    lli q = min(a, b);

    // pCq を返す。
    cout <<"q: " <<  q << endl;
    vector <vector<lli> > v(p+1,vector<lli>(p+1,0));


    for(lli i = 0;i <v.size(); i++){
        v[i][0]=1;
        v[i][i]=1;
    }
    for(lli k = 1;k <v.size();k++){
        for(lli j = 1;j<32;j++){
            v[k][j]=(v[k-1][j-1]+v[k-1][j]);
        }
    }

    return v[p][q] % 1000000007;
}

int main() {
    lli n, m;
    cin >> n >> m;

    // 素因数 key が value 個ある、を表す map
    map<lli, lli> fac;
    lli num = m;
    for(lli i = 2; i*i<=num; i++) {
        while (num % i == 0) {
            fac[i]++;
            num /= i;
        }
    }
    if (num != 1)
        fac[num] = 1;


    cal();
    lli ans = 1;
    for(auto it = fac.begin(); it != fac.end(); it++) {
        //cout << it->first << " " << it->second << endl;

        // combination を計算
        ans = (ans * comb_table[n-1+it->second][it->second]) % 1000000007;
    }

    cout << ans << endl;

}


Measured memory_bytes: 25216
n, d = map(int, input().split())
x = list(range(n))
y = list(range(n))
cnt = 0
for i in range(n):
    x[i], y[i] = map(int, input().split())
    k = x[i] ** 2 + y[i] ** 2
    if k <= d**2:
        cnt += 1
print(cnt)

Measured memory_bytes: 24652
import sys
input = sys.stdin.readline
import numpy as np

x = int(input())

if x <600:
    print(8)
elif x <800:
    print(7)
elif x<1000:
    print(6)
elif x<1200:
    print(5)
elif x<1400:
    print(4)
elif x<1600:
    print(3)
elif x<1800:
    print(2)
else:
    print(1)


Measured memory_bytes: 27152
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  long int a=0,b=0,c=0;
  char d[3];
  scanf("%c%c%c",&d[0],&d[1],&d[2]);
  for (int i = 0; i < 3; i++) {
    if (d[i]=='o') {
      a++;
    }
  }
  printf("%ld\n",100*a+700);
}


Measured memory_bytes: 128
s = input()
a_index = 0
z_index = 0

for i in range(0, len(s)):
    if s[i] == "A":
        a_index = i
        break
        
for i in range(0, len(s)):
    if s[len(s)-i-1] == "Z":
        z_index = len(s)-i-1
        break
print(z_index - a_index +1)


Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int sum = 0;
  cin >> N;
  vector<int> deli(N);
  for(int i=0;i < N; i++){
  	cin >> deli[i];
  }
  for(int j=0;j<N;j++){
    for(int k=j+1;k<N;k++){
  		sum += deli[j] * deli[k];
    }
  }
 cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b,k,i,j,right,counter,num1[5]={0},num2[5]={0};
    counter = 0;
    cin >> a >> b;
    for(i = a;i <= b;i++){
        right = 0;
        k = i;
        for(j = 0;j < 5;j++){
            num1[j] = 0;
            num2[j] = 0;
        }
        for(j = 0;j < 5;j++){
            num1[j] = k % 10;
            k /= 10;
        }
        k = i;
        for(j = 4;j >= 0;j--){
            num2[j] = k % 10;
            k /= 10;
        }
        for(j = 0;j < 5;j++){
            if(num1[j] != num2[j]){
                right = 1;
            }
        }
        if(right == 0){
            counter++;
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
// Problem : A - Not
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  // Common file
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace __gnu_pbds;
using namespace std;

// Declaring ordered_set
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int32_t main() {
  fastio;
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  int testcases;
  testcases = 1;
  // cin >> testcases;

  while (testcases--) {
    int x;
    cin >> x;
    if (x == 0)
      cout << 1 << '\n';
    else
      cout << 0 << '\n';
  }

  return 0;
}


Measured memory_bytes: 3572
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
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] x = new int[N];
            int[] y = new int[N];
            int[] h = new int[N];
            int[] base = new int[3];
            for (int i = 0; i < N; i++) {
                x[i] = in.nextInt();
                y[i] = in.nextInt();
                h[i] = in.nextInt();
                if (h[i] > 0) {
                    base[0] = x[i];
                    base[1] = y[i];
                    base[2] = h[i];
                }
            }

            int cx = 0, cy = 0, H = 0;
            for (int i = 0; i <= 100; i++) {
                for (int j = 0; j <= 100; j++) {
                    int hi = base[2] + Math.abs(base[0] - j) + Math.abs(base[1] - i);
                    if (H >= hi) {
                        continue;
                    }
                    boolean flag = true;
                    for (int n = 0; n < N; n++) {
                        int temp = Math.max(hi - Math.abs(x[n] - j) - Math.abs(y[n] - i), 0);
                        if (temp != h[n]) {
                            flag = false;
                            break;
                        }
                    }
                    if (flag) {
                        cx = j;
                        cy = i;
                        H = hi;
                    }
                }
            }
            out.printf("%d %d %d\n", cx, cy, H);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}



Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  rep(i,50001){
    int x = i * 1.08;
    if(x == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner scan;
	
	public static int GCD(int a, int b) {
		if(a < b) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		int cd = a % b; // common divisor
		
		while(cd != 0) {
			a = b;
			b = cd;
			cd = a % b;
		}
		
		return b;
	}
	
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		
		// Get two input numbers.
		final int x = scan.nextInt();
		final int y = scan.nextInt();
		
		// Output the greatest common divisor of x and y
		System.out.println(GCD(x, y));
	}
}


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define SUM(v) accumulate((v).begin(),(v).end(),0ll)
#define range(i,left,right) (left<=i && i<right)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int iscount(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

vector< pair<ll,ll> > prime_factorize(ll n){
   vector<pair<ll, ll> > res;
   for (ll p = 2; p*p<=n; ++p){
       if(n%p != 0) continue;
       int num = 0;
       while(n%p == 0){
           ++num; 
           n /= p; 
       }
       res.push_back(make_pair(p, num));
   }
   if (n != 1) res.push_back(make_pair(n,1));
   return res;
}

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

    auto v=prime_factorize(n);

//    REP(i,0,v.size()) cout<<v[i].first<<" "<<v[i].second<<endl;
    int ans=0;
    REP(i,0,v.size()){
        int tmp=v[i].second;
        int m=1;
        while(1){
            if(tmp-m<0) break;
            tmp-=m;
            m++;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
  int h;
  int w;
  int n;
  cin >> h;
  cin >> w;
  cin >> n;
  int a=0;
  float N=n;
  if(h<w){
    a=ceil(N/w);
  }else{
    a=ceil(N/h);
  }
  cout << a << endl;
}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/



int main() {
int N;
cin>>N;
string S[N];
rep(i,N){
    cin>>S[i];
}
int in_count=0;
rep(i,N){
    rep(j,S[i].size()-1){
        if((S[i][j]=='A')&&(S[i][j+1]=='B')){
            in_count++;
        }

    }
}
int edge[3];//0両端　B A 1左B 2 右A 
rep(i,3){
    edge[i]=0;
}
rep(i,N){
    if((S[i][0]=='B')&&(S[i][S[i].size()-1]=='A'))edge[0]++;
    else if(S[i][0]=='B')edge[1]++;
    else if(S[i][S[i].size()-1]=='A')edge[2]++;
}
int ans=0;


if((edge[1]==0)&&(edge[2]==0)){
    ans+=max(0,edge[0]-1);
}
else{
    ans+=min(edge[1],edge[2]);
    ans+=edge[0];
}
cout<<in_count+ans<<endl;
return 0;
}


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

#define ll long long

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int d, t, s;
    cin >> d >> t >> s;

    if (s * t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

struct edge{int u,v,cost;};

int par[101],rank[101];
edge es[200];
int V,E;

void init_union_find(int);
int find(int);
void unite(int,int);
bool same(int,int);
bool comp(const edge& e1,const edge& e2);
int kruskal(void);

using namespace std;

int main(void){
  int i,a,b,c;

  while(cin >> V >> E && V){
    for(i=0;i<E;i++){
      cin >> a >> b >> c;
      es[i].u=a;
      es[i].v=b;
      es[i].cost=c;
    }
    printf("%d\n",kruskal());
  }
  return 0;
}

void init_union_find(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
  }
}

int find(int x){
  if(par[x]==x){
    return x;
}
  else {
    return par[x]=find(par[x]);
  }
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;
  
  if(rank[x] < rank[y]){
    par[x]=y;
  }
  else {
    par[y]=x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

bool same(int x,int y){
  return find(x)==find(y);
}

bool comp(const edge& e1,const edge& e2){
  return e1.cost < e2.cost;
}

int kruskal(){
  sort(es,es+E,comp);
  init_union_find(V);
  int res=0;
  for(int i=0;i<E;i++){
    edge e=es[i];
    if(!same(e.u,e.v)){
      unite(e.u,e.v);
      res+=e.cost;
    }
  }
  return res;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

const int N = 1e3;
const int LOG = 61;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLMOD = 1e9 + 7;
const ll LLINF = 1e16;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vi p(n);
    forn(i, n) cin >> p[i];
    int cnt = 0;
    forn(i, n) if (p[i] != i + 1) cnt++;
    cout << (cnt > 2 ? "NO\n" : "YES\n");
}


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

public class Program
{

	public void Proc()
	{
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        this.NodeCount = inpt[0];
        this.RoadCount = inpt[1];

        for (int i = 0; i < this.RoadCount; i++) {
            inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)-1).ToArray();

            inpt.ToList().ForEach(a =>
            {
                if(!Road.ContainsKey(a)) {
                    Road.Add(a, new Dictionary<int, int>());
                }
            });

            Road[inpt[0]][inpt[1]] = i;
            Road[inpt[1]][inpt[0]] = i;
        }

        int ans = 0;
        for (int i = 0; i < RoadCount; i++) {
            if(!CanBuild(i)) {
                ans++;
            }
        }
        Console.WriteLine(ans);

    }

    private int NodeCount;
    private int RoadCount;

    private Dictionary<int, Dictionary<int, int>> Road = new Dictionary<int, Dictionary<int, int>>();
 
    private bool CanBuild(int rejectLine) {
        TreeNode[] items = new TreeNode[NodeCount];

        items[0] = new TreeNode(0);
        Queue<int> task = new Queue<int>();
        task.Enqueue(0);
        while(task.Count>0) {
            int current = task.Dequeue();
            foreach(int next in Road[current].Keys) {
                if(Road[current][next] == rejectLine) {
                    continue;
                }
                if(items[current].Parent != null && items[current].Parent.ID == next) {
                    continue;
                }
                if(items[next] != null) {
                    continue;
                }
                items[next] = new TreeNode(next);
                items[current].AddChild(items[next]);
                task.Enqueue(next);
            }
        }
        return !items.Any(a => a == null);
    }

    private class TreeNode {
        public TreeNode Parent;
        public List<TreeNode> Items = new List<TreeNode>();
        public int ID;
        public TreeNode(int id) {
            this.ID = id;
        }
        public TreeNode AddChild(TreeNode cld) {
            this.Items.Add(cld);
            cld.Parent = this;
            return cld;
        }

        public int Count() {
            int cnt = this.Items.Count;
            cnt += this.Items.Select(a => a.Count()).Sum();
            return cnt;
        }
    }

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


6 5
1 2
2 3
3 4
4 5
5 6


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 13652
import sys

def solve():
    input = sys.stdin.readline
    isPrime = [True] * (1 + 10**5)
    isPrime[0] = isPrime[1] = False
    Like = [0] * (1 + 10 ** 5)

    for i in range(2, 1 + 10 ** 5):
        if isPrime[i]:
            k = 2 * i
            while k <= 10 ** 5:
                isPrime[k] = False
                k += i
            if i % 2 == 1 and isPrime[(i + 1) // 2]: Like[i] = Like[i-1] + 1
            else: Like[i] = Like[i-1]
        else: Like[i] = Like[i-1]
                
    Q = int(input())
    for _ in range(Q):
        l, r = map(int, input().split())
        print(Like[r] - Like[l-1])

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 5432
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
int vis[100005]={0};
vector<int> grph[100005];
int mo=1000000007;
pair<int,int> dfs(int a,int p)
{
    if(vis[a]==0)
    {
        vis[a]=1;
        pair<int,int> ans;
        ans.first=1;
        ans.second=1;
        for(auto &k:grph[a])
        {
            if(k!=p)
            {
                pair<int,int> temp=dfs(k,a);
                ans.first=(ans.first * (temp.first + temp.second)%mo)%mo;
                ans.second=(ans.second * temp.first)%mo;
            }
        }
        //cout<<a<<" "<<ans.first<<" "<<ans.second<<"\n";
        return ans;
    }
}


int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<(n-1);i++)
    {
        int x,y;
        cin>>x>>y;
        grph[x].push_back(y);
        grph[y].push_back(x);
    }
    pair<int,int> ans=dfs(1,0);
    cout<<(ans.first + ans.second)%mo;
}


Measured memory_bytes: 15364
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		//キーボード入力メソッド
		Scanner sc = new Scanner(System.in);

		int x = 1;
		int y = 1;

		while(true) {
			x = sc.nextInt();
			y = sc.nextInt();

			//xが0のとき、終了
			if(x == 0 && y == 0) {
				break;
			}

			//処理　xとyを小大の順で並べる
			if(x > y) {
				System.out.println(y + " " + x);
			}else {
				System.out.println(x + " " + y);
			}

		}
	}

}



Measured memory_bytes: 36428
use std::io::Read;

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

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let sx: isize = iterator.next().unwrap().parse().unwrap();
    let sy: isize = iterator.next().unwrap().parse().unwrap();
    let tx: isize = iterator.next().unwrap().parse().unwrap();
    let ty: isize = iterator.next().unwrap().parse().unwrap();

    let dx: isize = tx - sx;
    let dy: isize = ty - sy;

    let mut result = String::new();

    for _ in 0..dx {
        result.push('R');
    }
    for _ in 0..dy {
        result.push('U');
    }

    for _ in 0..dx {
        result.push('L');
    }
    for _ in 0..dy {
        result.push('D');
    }

    result.push('D');
    for _ in 0..(dx + 1) {
        result.push('R');
    }
    for _ in 0..(dy + 1) {
        result.push('U');
    }
    result.push('L');

    result.push('U');
    for _ in 0..(dx + 1) {
        result.push('L');
    }
    for _ in 0..(dy + 1) {
        result.push('D');
    }
    result.push('R');

    return result;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size

/*
author: Basel
*/

using namespace std;

string s;

int main()
{
    cin >> s;
    int x=1;
    for (int i=0;i<s.length();i++)
    {
        if (s[i]=='R'&&(x%2==0)){cout << "No\n";return 0;}
        if (s[i]=='L'&&(x&1)){cout << "No\n";return 0;}
        x++;
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int max;
    int p, q, r;
    cin >> p >> q >> r;

    max = p;
    if(max < q){
        max = q;
    }

    if(max < r){
        max = r;
    }

    cout << (p + q + r - max) << endl;
        
}

Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	std::string s;
	std::cin >> s;
	
	for (int i = 0; i < s.size(); i += 2) {
		std::cout << s[i];
	}
	std::cout << "\n";
}


Measured memory_bytes: 512
#include <iostream>

int main() {
    int n, a, b;
    std::cin >> n >> a >> b;
    std::string s;
    std::cin >> s;
    int ac = 0; int bc = 0;

    for (auto &c: s) {
        switch (c) {
            case 'a':
                if (ac + bc < a + b) {
                    std::cout << "Yes" << std::endl;
                    ac++;
                } else {
                    std::cout << "No" << std::endl;
                }
                break;
            case 'b':
                if (ac + bc < a + b && bc < b) {
                    std::cout << "Yes" << std::endl;
                    bc++;
                } else {
                    std::cout << "No" << std::endl;
                }
                break;
            default: // case 'c':
                std::cout << "No" << std::endl;
                break;
        }
    }

    return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<string>

using namespace std;

int main(){
  int N;
  string S,out;
  out = "";
  cin >> N;
  cin >> S;
  
  out = S[0];
  
  for (int i=1;i<N;i++){
//	  cout <<  S[i];
      if(S[i-1] != S[i] ) out = out + S[i];
  }
  cout << (int)out.length();
  
  return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}
 
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const ll MOD = TEN(9) + 7;
const int MX = TEN(5) * 3;

ll inv[MX], fact[MX], ifact[MX];

void init() {
    inv[1] = 1;
    for (int i = 2; i < MX; ++i) {
        inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    }
    fact[0] = ifact[0] = 1;
    for (int i = 1; i < MX; ++i) {
        fact[i] = fact[i-1] * i % MOD;
        ifact[i] = ifact[i-1] * inv[i] % MOD;
    }
}

ll comb(int n, int r) {
    if (n < 0 || r < 0 || r > n) return 0;
    return fact[n] * ifact[r] % MOD * ifact[n - r] % MOD;
}

ll func(int n, int k) {
	if (n == 0 && k == 0) return 1;
	return comb(n-1, k-1);
}

int main() {
	init();
	int N, K; cin >> N >> K;

	for (int i = 1; i <= K; ++i) {
		ll a = 2 * func(N-K, i) + func(N-K, i-1) + func(N-K, i+1);
		cout << a % MOD * func(K, i) % MOD << "\n";
	}

	return 0;
}

Measured memory_bytes: 7296
//12, 01, 2019, 10:04:12 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

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

    int n;

    cin >> n;

    int a, b;

    cin >> a >> b;

    int qa = 0, qab = 0, qb = 0;

    for(int i = 0 ; i < n ; i++){
        int ci;

        cin >> ci;

        if(ci <= a){
            qa++;
        }else if(ci > b){
            qb++;
        }else{
            qab++;
        }
    }
    
    cout << min({qa, qb, qab}) << endl;
    
    return 0;
}

Measured memory_bytes: 256
use std::io::{BufRead, BufWriter, Write};

fn main() {
    let stdin = std::io::stdin();
    let stdout = std::io::stdout();
    solve(&mut stdin.lock(), &mut BufWriter::new(stdout.lock()));
}

fn solve<R: BufRead, W: Write>(stdin: &mut R, stdout: &mut BufWriter<W>) {
    let mut reduce = vec![(0, 0); 10];
    for i in 0..10 {
        let mut round = 0;
        let mut consume = 0;
        let mut s = i;
        loop {
            consume += 1;
            s += i;
            round += 1;
            while s >= 10 {
                s = s / 10 + s % 10;
                round += 1;
            }
            if s == i {
                break;
            }
        }
        reduce[i] = (consume, round);
    }
    let mut total_round = 0;
    let mut frag = Vec::new();
    let m = stdin.gets().parse::<usize>().unwrap();
    for line in stdin.lines().take(m).map(|x| x.unwrap()) {
        let (d, c): (u64, u64) = line.split(' ').values();
        let (consume, round) = reduce[d as usize];
        total_round += round * ((c - 1) / consume);
        for _ in 0 .. ((c - 1) % consume + 1) {
            frag.push(d);
        }
    }
    if !frag.is_empty() {
        let mut s = frag[0];
        for &d in &frag[1..] {
            s += d;
            total_round += 1;
            while s >= 10 {
                s = s / 10 + s % 10;
                total_round += 1;
            }
        }
    }
    writeln!(stdout, "{}", total_round).unwrap();
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }

trait Values<T> { fn values(&mut self) -> T; }
impl<'a, I, T1, T2> Values<(T1, T2)> for I
    where I: Iterator<Item=&'a str>,
          T1: std::str::FromStr, T1::Err: std::fmt::Debug,
          T2: std::str::FromStr, T2::Err: std::fmt::Debug {
    fn values(&mut self) -> (T1, T2) {
        (self.next().unwrap().parse().unwrap(),
         self.next().unwrap().parse().unwrap())
    }
}


Measured memory_bytes: 13392
N = gets.to_i
A = gets.split.map(&:to_i)

MOD = 10**9 + 7

cnt = {a: 0, b: 0, c: 0}
ans = 1
A.each do |x|
  t_cnt = 0
  cnt.each do |key, _|
    if x == cnt[key]
      t_cnt += 1
    end
  end
  ans *= t_cnt
  ans %= MOD

  cnt.each do |key, _|
    if x == cnt[key]
      cnt[key] += 1
      break
    end
  end
end

puts ans


Measured memory_bytes: 22940