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

using namespace std;

const int N=110;
bool d[N][N];

int main()
{
    int v,e;
    cin>>v>>e;

    for(int i=0;i<e;i++)
    {
        int s,t;
        cin>>s>>t;
        d[s][t]=true;
    }
    for(int k=0;k<v;k++)
    {
        for(int i=0;i<v;i++)
        {
            for(int j=0;j<v;j++)
            {
                d[i][j]|=d[i][k]&d[k][j];
            }
        }
    }
    bool flag=false;
    for(int i=0;i<v;i++)
    {
        if(d[i][i])
        {
            flag=true;
        }
    }
    cout<<flag<<endl;
    return 0;
}



Measured memory_bytes: 3100
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

type Interval [][]int
func (I Interval) Len() int { return len(I) }
func (I Interval) Less(i, j int) bool { return I[i][0] < I[j][0] }
func (I Interval) Swap(i, j int) { I[i], I[j] = I[j], I[i] }

func Max(x, y int) int {
  if x < y { return y }
  return x
}
func Min(x, y int) int {
  if x < y { return x }
  return y
}
func Abs(x int) int {
  if x < 0 { x = -x }
  return x
}

func Count(A, B [][]int, s int) int {
  N := len(A)
  S := make([]bool, N)
  cnt := 0
  p := 0
  for a, b := 0, 0; a < N && b < N; {
    for ; a < N; a++ {
      if S[A[a][1]] { continue }
      if s * A[a][0] < p { continue }
      cnt += Abs(s * A[a][0] - p)
      p = s * A[a][0]
      S[A[a][1]] = true
      a++
      break
    }
    for ; b < N; b++ {
      if S[B[b][1]] { continue }
      if p < s * B[b][0] { continue }
      cnt += Abs(p - s * B[b][0])
      p = s * B[b][0]
      S[B[b][1]] = true
      b++
      break
    }
  }
  return cnt + Abs(p)
}

func main() {
  N := NextInt()
  L := make([][]int, 0)
  R := make([][]int, 0)
  for i := 0; i < N; i++ {
    LR := NextIntVec()
    L = append(L, []int{LR[0], i})
    R = append(R, []int{LR[1], i})
  }
  sort.Sort(sort.Reverse(Interval(L)))
  sort.Sort(Interval(R))
  Write(Max(Count(L, R, 1), Count(R, L, -1)))
  Output()
}

Measured memory_bytes: 22528
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>
#include <algorithm>

using namespace std;

//--------------------
int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

void func() {
    int arr[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 K;
    cin >> K;
    cout << arr[K - 1] << endl;

}

int main() {
    func();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

const ll mod = 2019;

ll sum(ll n) {
  return n * (n - 1) / 2;
}

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

  string s;
  cin >> s;

  map<ll, ll> cnt;
  cnt[0]++;
  ll res = 0, keta = 1;
  int n = s.length();
  repr(i, n - 1) {
    res = (res + (s[i] - '0') * keta) % mod;
    cnt[res]++;
    keta = (keta * 10) % mod;
  }
  ll ans = 0;
  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    ans += sum(it->second);
  }
  cout << ans << '\n';






  
  return 0;
}

Measured memory_bytes: 3772
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$r = $key->A[0];
$len = strlen($r);
printf("%s%d%s\n",$r[0],$len-2,$r[$len-1]);


Measured memory_bytes: 3828
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
		String[] line = b.readLine().split(" ");
 
		int N = Integer.parseInt(line[0]);
		int L = Integer.parseInt(line[1]);
 
		String[] S = new String[N];
 
		for (int i = 0; i < N; i++) {
			S[i] = b.readLine();
		}
		Arrays.sort(S);
		for (int i = 0; i < N; i++) {
			System.out.print(S[i]);
		}
		System.out.println();
		 
		b.close();
	}
 
}

Measured memory_bytes: 8276
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
#ifdef DEBUG
	printf("");
#endif

	char N[4] = { '\0' };

	scanf("%s", N);

	printf("ABC%s\n", N);

	return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_ABC170
{
    class MainClass
    {

        static int[] s, p;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            if (s[1] > 0)
            {
                p = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            }
            int x = s[0];
            int n = s[1];
            int[] xplus = new int[200];
            int[] xminus = new int[200];
            int xzero = 0;
            for (int i = 0; i < n; i++)
            {
                int div = x - p[i];
                if (div == 0)
                {
                    xzero = -1;
                }
                else if (div > 0)
                {
                    xplus[div] = -1;
                }
                else
                {
                    xminus[-div] = -1;
                }
            }
            if (xzero == 0)
            {
                WriteLine(x);
                return;
            }
            for (int i = 1; i < 200; i++)
            {
                if (xplus[i] == 0)
                {
                    WriteLine(x - i);
                    return;
                }
                else if (xminus[i] == 0)
                {
                    WriteLine(x + i);
                    return;
                }
            }

        }
    }
}


Measured memory_bytes: 27980
#include<stdio.h>
#define M 100

#define W -3
#define B -4
#define G -2

void Dfs();
void Dfsv(int );

int d[M];
int f[M];
int color[M];
int time;
int Adj[M][M];//有向グラフGの隣接リスト
int n;


main () {

  int i, j;//counter
  int a, b, c;

  scanf("%d", &n);

  for(i = 0; i < n; i++) {
    for(j = 0; j < n; j++) {
      Adj[i][j] = 0;//隣接リストの初期化   
    }  
  }

  for(i = 0; i < n; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    for(j = 0; j < b; j++) {
      scanf("%d", &c);    
      Adj[i][c-1] = 1;
    }

  }

  Dfs();

  for(i = 0; i < n; i++) {
    printf("%d %d %d\n", i+1, d[i], f[i]);  
  }

  return 0;
}


void Dfs() {
  int k;

  for(k = 0; k < n; k++) {
    color[k] = W;
  }    

  time = 0;
  
  for(k = 0; k < n; k++) {
    if(color[k] == W){
      Dfsv(k);	
    }
  }
}

void Dfsv(int u) {
  int v;

  color[u] = G;
  time++;
  d[u] = time;

  for(v = 0; v < n; v++) {
    if(Adj[u][v] && color[v] == W)
      Dfsv(v);
  }

  color[u] = B;
  f[u] = ++time;

}

Measured memory_bytes: 636
#define _CRT_SECURE_NO_WARNINGS
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#define ll long long
#include<bits/stdc++.h>

using namespace std;
int main() {
	ll n, ans = 0;
	cin >> n;
	for (ll i = 1; i <= n; i++) {
		if (i % 3 == 0 || i % 5 == 0) {
			continue;
		}
		ans += i;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n, m; cin>>n>>m;
    vector<vector<int>> G(n);
    vector<int> indeg(n, 0);
    for(int i=0; i<m; i++){
        int x, y; cin>>x>>y;
        x--, y--;
        G[x].emplace_back(y);
        indeg[y]++;
    }

    queue<int> que;
    for(int i=0; i<n; i++){
        if(indeg[i] == 0) que.emplace(i);
    }

    vector<int> dp(n, 0);
    while(que.size()){
        int cv = que.front(); que.pop();
        for(auto nv : G[cv]){
            indeg[nv]--;
            chmax(dp[nv], dp[cv] + 1);
            if(indeg[nv] == 0) que.emplace(nv);
        }
    }

    cout << *max_element(all(dp)) << endl;

    return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<vector>
#include<map>
#include<cstring>


using namespace std;

int n, m;
vector<int> v[100005];
bool vis[100005];
int  cn[100005];
map<int, int> p;


    void DFS(int i, int cp){

            vis[i] = true;
            cn[i] = cp;

            for(int k = 0; k < v[i].size(); k++){
                 int vx = v[i][k];
                 
                 if(!vis[vx]){
                       DFS(vx, cp);     
                    }   
             
                }
            
          }
 





int main(){
    
    cin >> n >> m;
    
    for(int i = 1; i <= n; i++){
         int x; cin >> x;
         p[i] = x;
      }
    

    for(int i = 0; i < m; i++){
         int x, y;
         cin >> x >> y;
         v[x].push_back(y);
         v[y].push_back(x);
      }
    
    int ans = 0;
    int cp = 1;

    for(int i = 1; i <= n; i++){ 
        if(!vis[i]){
            DFS(i, cp);
            cp++;
          }
        }
    
    for(int i = 1; i <= n; i++){ 
        if((p[i]==i) || (cn[i]==cn[p[i]])){
             ans++;
         }            
       }
        


      cout << ans;


    return 0;
}

Measured memory_bytes: 13952
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int N, D;
	cin >> N >> D;
	int X[N][D];
	for (int i = 0; i < N; i++)
		for (int j = 0; j < D; j++)
			cin >> X[i][j];

	int s = 0;
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			double tmp = 0.0;
			for (int k = 0; k < D; k++)
				tmp += pow(abs(X[i][k] - X[j][k]), 2.0);
			tmp = sqrt(tmp);
			if (ceil(tmp) == floor(tmp))
				s++;
	 	}
	}
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)

as, bs = [], []
N.times do |i|
    as[i] = gets.chomp
end
M.times do |i|
    bs[i] = gets.chomp
end

(0..N-M).each do |i|
    (0..N-M).each do |j|
        if M.times.all?{|k| as[k+i][j...j+M] == bs[k][0...M]}
            puts 'Yes'
            exit
        end
    end
end
puts 'No'

Measured memory_bytes: 1788
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        
        var abc = new int[3];
        abc[0] = int.Parse(spl[0]);
        abc[1] = int.Parse(spl[1]);
        abc[2] = int.Parse(spl[2]);

        Array.Sort(abc);

        int c = 0;
        while(abc[1] <= abc[2] - 2) {
            abc[1] += 2;
            c++;
        }
        while (abc[0] <= abc[2] - 2) {
            abc[0] += 2;
            c++;
        }

        if(abc[2] * 3 - abc.Sum() == 2) {
            c += 1;
        }
        if(abc[2] * 3 - abc.Sum() == 1) {
            c += 2;
        }

        return c;
    }


    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int r;
  cin >> r;
  cout << r * 3.14159265358979323846 * 2 << endl;
}

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

  solve();
  return 0;
}


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



int main(){
  int n;
  scanf("%d", &n);

  list<int> ls;
  char com[20];
  int key;
  for(int i=0; i<n; i++){
    scanf("%s %d",com,&key);
    if(com[0] == 'i'){
      // insert x
      //printf("insert\n");
      ls.push_front(key);
    }
    else{
      switch(com[6]){
        case '\0':
          // delete x
          //printf("delete\n");
          for(list<int>::iterator itr = ls.begin(); itr != ls.end(); itr++){
            if(*itr == key){
              ls.erase(itr);
              break;
            }
          }
          break;

        case 'F':
          // deleteFirst
          //printf("deleteFirst\n");
          ls.pop_front();
          break;

        case 'L':
          // deleteLast
          //printf("deleteLast\n");
          ls.pop_back();
          break;
      }
    }
  }

  for(list<int>::iterator itr = ls.begin(); itr != ls.end(); itr++){
    if(++itr != ls.end()){
      printf("%d ",*--itr);
    }
    else{
      printf("%d\n", *--itr);
    }
  }

  return 0;
}



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

int main(void)
{
	int a, b, c;
	int A, B;
	
	scanf("%d %d %d", &a, &b, &c);
	
	A = b-a;
	B = c-b;
	
	if (A == B){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	
	return (0);
}

Measured memory_bytes: 128
#include<iostream>
#include<bits/stdc++.h>
#define Amr_Abdelazim ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rep(i,n)   for(int i=0;i<n;i++)
#define repp(i,s,n)   for(int i=s;i<=n;i++)
#define print(v) {for(auto i:v)cout<<i<<" ";cout<<"\n";}
#define mkp make_pair
#define clr(ar,v) memset(ar,v,sizeof(ar));
#define TC ll amr_abdelazim;cin>>amr_abdelazim;while(amr_abdelazim--)
#define popcnt(x) __builtin_popcount(x)
#define EPS 1e-9
#define INF 1e17
using namespace std;
const int mod = 1000000007;
const int N = 100000+9;
const double pi = acos(-1);
class cmp{
public:
	bool operator() (pair<ll, pll> &A, pair<ll, pll> &B){
		return A > B;
	}
};
bool by_sec(pll &A, pll &B){
	return A.second < B.second;
}
ld dist(pll p1, pll p2){
	return (ld)sqrt((ld)(p1.first - p2.first)*(p1.first - p2.first) + (ld)(p1.second - p2.second)*(p1.second - p2.second));
}
ll fact[1000009], inv[1000009];
ll fp(ll a, ll b){
	if (b == 0)
		return 1;
	ll ans = fp(a, b / 2);
	ans = (ans * ans) % mod;
	if (b % 2 != 0)
		ans = (ans * (a % mod)) % mod;
	return ans;
}
void FacInv(ll n){
	fact[0] = inv[0] = 1;
	for (ll i = 1; i <= n; i++)
	{
		fact[i] = ((i%mod) * fact[i - 1] % mod) % mod;
		inv[i] = fp(fact[i], mod - 2);
	}
}
ll ncr(ll n, ll r){
	return (((fact[n] * inv[r]) % mod) * inv[n - r]) % mod;
}

vpll v;
ll n,k;
ll dp[100+9][N];
ll fun(ll i,ll w){
	if (i >= n||w<=0)return 0;
	if (dp[i][w] == -1){
		if (w >= v[i].second)
			dp[i][w]= max(fun(i + 1, w), v[i].first + fun(i + 1, w - v[i].second));
		else dp[i][w]= fun(i + 1, w);
	}
	return dp[i][w];
}
int main()
{
	Amr_Abdelazim
		clr(dp, -1);
		cin >> n >> k;
	v.resize(n);
	rep(i, n){
		cin >> v[i].second >> v[i].first;
	}
	cout << fun(0, k);
	return 0;
}


Measured memory_bytes: 88720
#include <iostream>
#include <iomanip>

unsigned long nb(const long long input, const long long x) {
    return (input >= 0) ? input / x + 1 : 0;
}

int main(void)
{
    long long a, b, x;
    std::cin >> a >> b >> x;

    const unsigned long cnt = nb(b, x) - nb(a - 1, x);

    std::cout << cnt << std::endl;

    return 0;
}

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

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

  int x, counter = 0;
  for(cin >> x; x != 0; cin >> x)
  {
    printf("Case %d: %d\n", ++counter, x);
  }
  return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

const int MAX = 510000;//階乗の配列数
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// a^n mod を計算する
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, m ,k;
  cin >> n >> m >> k;
  COMinit();
   ll ans=0;
  rep(i, k+1){
    ans+=(modpow(m-1, n-i-1, MOD)*COM(n-1, i))%MOD;
    ans%=MOD;
  }
  ans*=m;
  ans%=MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 15568
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N,P = map(int,input().split())
# arrA = list(map(int,input().split()))
arrA = np.array(input().split(),dtype=np.int64)

A = arrA % 2
bins = np.bincount(A,minlength=2)
    
if bins[1] == 0:
    if P==0:
        print(2**bins[P])
        exit()
    else:
        print(0)
        exit()
else:
    print(2**(N-1))

# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 20636
#include <bits/stdc++.h>
#define MAX_INT 2100000000
#define rep(i,n) for (i=1;i<=(n);++i)
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	ULARGE_INTEGER nt;
	nt.QuadPart = GetTickCount64();
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	wsprintf(pszNewWindowTitle, "%d%d/%d", nt.HighPart, nt.LowPart, GetCurrentProcessId());
	SetConsoleTitle(pszNewWindowTitle);
	Sleep(40);
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
ll mod = 1e9 + 7;
int main()
{
	string s;
	static int num[100000 + 10],p[100000+10];
	int n, i, j, k;
	vector<int> rl;
	cin >> s;
	for (i = 0; i < s.size()-1;i++)
	{
		if (s[i] == 'R' && s[i + 1] == 'L') rl.push_back(i);
	}
	for (i = 0; i < rl.size(); i++)
	{
		int now = rl[i];
		while (s[now] == 'R')
		{
			if ((rl[i] - now) % 2) num[now] = rl[i] + 1;
			else num[now] = rl[i];
			if (now == 0) break;
			now--;
		}
		now = rl[i]+1;
		while (s[now] == 'L')
		{
			if ((now-rl[i]) % 2) num[now] = rl[i]+1;
			else num[now] = rl[i];
			if (now == s.size() - 1)break;
			now++;
		}
	}
	for (i = 0; i < s.size() ; i++)
	{
		p[num[i]]++;
	}
	for (i = 0; i < s.size(); i++)
	{
		printf("%d ", p[i]);
	}
	putchar('\n');
}


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

using namespace std;
#define all(a)a.begin(),a.end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<ll>;
using P = pair<ll,ll>;
using G=vector<V>;

int main()
{
   ll n;cin >>n;
   set<string> k;
   string s;
   rep(i,n){
    cin >>s;
    k.insert(s);
   }
   cout << k.size()<< endl;
    return 0;
}


Measured memory_bytes: 19204
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

vvl y(303030), x(303030);

int main(){
	int h,w,m; cin >> h >> w >> m;
	set<P> se;
	rep(i,m){
		int Y,X; cin >> Y >> X;
		y[Y].push_back(X);
		x[X].push_back(Y);
	}
	int xs = 0;
	rep(i,300001){
		chmax(xs, x[i].size());
	}
	set<ll> xx;
	rep(i,300001){
		if(xs == x[i].size()) xx.insert(i);
	}
	int ys = 0;
	rep(i,300001){
		chmax(ys, y[i].size());
	}
	set<ll> yy;
	rep(i,300001){
		if(ys == y[i].size()){
			yy.insert(i);
		}
	}
	ll ans = xs + ys;
	for(auto i : xx){
		set<ll> se = yy;
		for(auto j : x[i]){
			se.erase(j);
		}
		if(!se.empty()){
			cout << ans << "\n";
			return 0;
		}
	}
	cout << ans - 1 << "\n";
}

Measured memory_bytes: 78496
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;
typedef long long ll;

int dp[101][4][4][4];
int mod = 1e9+7;

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

    dp[0][3][3][3] = 1;
    for (int len = 0; len < n; len++)
    {
        for (int c1 = 0; c1 < 4; c1++)
        {
            for (int c2 = 0; c2 < 4; c2++)
            {
                for (int c3 = 0; c3 < 4; c3++)
                {
                    if(dp[len][c1][c2][c3]==0) continue;

                    for (int a = 0; a < 4; a++)
                    {
                        if(a==2&&c1==1&&c2==0) continue;
                        if(a==2&&c1==0&&c2==1) continue;
                        if(a==1&&c1==2&&c2==0) continue;
                        if(a==2&&c1==1&&c3==0) continue;
                        if(a==2&&c2==1&&c3==0) continue;

                        dp[len+1][a][c1][c2] += dp[len][c1][c2][c3];
                        dp[len+1][a][c1][c2] %= mod;
                    }
                    
                }
                
            }
            
        }
        
    }
    int ans=0;
    
    for (int c1 = 0; c1 < 4; c1++)
    {
        for (int c2 = 0; c2 < 4; c2++)
        {
            for (int c3 = 0; c3 < 4; c3++)
            {
                ans += dp[n][c1][c2][c3];
                ans %= mod;
            }
            
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
fn = lambda: map(int, input().split())
W, H, N = fn()
A = [[1 for _ in range(W)] for _ in range(H)]
for _ in range(N):
    x, y, a = fn()
    if a == 1:
        for i in range(H):
            for j in range(x):
                A[i][j] = 0
    elif a == 2:
        for i in range(H):
            for j in range(x, W):
                A[i][j] = 0
    elif a == 3:
        for i in range(W):
            for j in range(y):
                A[j][i] = 0
    elif a == 4:
        for i in range(W):
            for j in range(y, H):
                A[j][i] = 0
    else:
        print('Something wrong')

print(sum([sum(Ai) for Ai in A]))


Measured memory_bytes: 3064
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    b = LI()

    # bから数字を除去して空にできるか判定する
    ans = []
    while b:
        has_pop = False
        len_b = len(b)
        for i in range(len_b):
            j = len_b - 1 - i
            if b[j] == j + 1:
                b.pop(j)
                ans.append(j + 1)
                has_pop = True
                break
        if not has_pop:
            break

    if len(ans) == N:
        for i in range(N):
            print(ans[N-1-i])
    else:
        print(-1)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10016
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 922337204775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

struct edge { int to, cost; };

int N;
vector<vector<edge>> G;
VI d;
int dx[] = { 0,0,-1,1 };
int dy[] = { -1,1,0,0 };

void dikstra(int s) {
	priority_queue<pii, vector<pii>, greater<pii> >que;
	REP(i, N)d[i] = LLINF;
	d[s] = 0;
	que.push(pii(0, s));
	while (!que.empty()) {
		pii p = que.top();
		que.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		REP(i, G[v].size()) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(pii(d[e.to], e.to));
			}
		}
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int H, W; cin >> H >> W;
	int sx, sy, gx, gy;
	cin >> sx >> sy >> gx >> gy;
	sx--, sy--, gx--, gy--;
	VS S(H);
	REP(i, H)cin >> S[i];
	

	N = H * W;
	G.resize(N);
	d.resize(N);
	//cout << N << endl;

	REP(i, H) {
		REP(j, W) {
			if (S[i][j] == '#')continue;

			REP(k, 4) {
				int nx = i + dx[k], ny = j + dy[k];
				if (nx >= 0 && nx < H&&ny >= 0 && ny < W && S[nx][ny] == '.') {

					int now = i * W + j;
					int to = nx * W + ny;

					G[now].push_back((edge) { to, 0 });
					G[to].push_back((edge) { now, 0 });
				}
			}
			//cout << i<<" "<<j << endl;
			for (int nx = i - 2; nx <= i + 2; nx++) {
				for (int ny = j - 2; ny <= j + 2; ny++) {
					if (nx >= 0 && nx < H&&ny >= 0 && ny < W && S[nx][ny] == '.') {
						int now = i * W + j;
						int to = nx * W + ny;

						G[now].push_back((edge) { to, 1 });
						G[to].push_back((edge) { now, 1 });
					}
				}
			}
		}
	}
	//cout << N << endl;
	dikstra(sx*W + sy);
	//cout << "<" << endl;
	if (d[gx*W + gy] != LLINF)cout << d[gx*W + gy] << endl;
	else cout << -1 << endl;

	return 0;
}



Measured memory_bytes: 367412
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;



int main(){
  int n;
  cin >> n;
  rep(i,n){
    int a; cin >> a;
    if(a%2) continue;
    if(a%3 && a%5){
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}

Measured memory_bytes: 256
mod = 1000000007

n,m = map(int,input().split())
ab = []
for _ in range(m):
    a=int(input())
    ab.append(a)
ab = set(ab)

memo = [0]*(n+1)

memo[0] = 1

for i in range(1,n+1):
    memo[i] = (memo[i-1]+memo[i-2])%mod
    if i in ab:
        memo[i] = 0
    #print(memo)
print(memo[-1])


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

int main(){
	int x, y;
	int tmp;
	while(true){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}else{
			if(x > y){
				tmp = x;
				x = y;
				y = tmp; 
			}
			cout << x << " " << y << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2988
// ABC073 D-joisino's travel ワーシャルフロイド
// https://atcoder.jp/contests/abc073/tasks/abc073_d
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r;
    for(int i = 0; i < R; i++) {
        int temp;
        cin >> temp;
        r.push_back(temp);
    }
    int cost[N + 1][N + 1];
    for(int i = 0; i <= N; i++) {
        for(int j = 0; j <= N; j++) {
            if(i == j) {
                cost[i][j] = 0;
            } else {
                cost[i][j] = INT_MAX/2;
            }
        }
    }
    for(int i = 0; i < M; i++) {
        int A, B, C;
        cin >> A >> B >> C;
        cost[A][B] = C;
        cost[B][A] = C;
    }
    for(int k = 1; k <= N; ++k) {
        for(int i = 1; i <= N; ++i) {
            for(int j = 1; j <= N; ++j) {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    int min = INT_MAX;
    sort(r.begin(),r.end());
    do {
        int tempcost = 0;
        for(int i = 1; i < r.size(); i++) {
            tempcost += cost[r[i - 1]][r[i]];
        }
        if(tempcost < min)
            min = tempcost;
    } while(next_permutation(r.begin(), r.end()));

    cout << min << endl;
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int a[200000];

int main()
{
	long long int max = -20000000000;
	int n, i, j;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", a + i);
	}
	int min = a[0];
	for(i = 1; i < n; i++)
	{
		max = max > a[i] - min ? max : a[i] - min;
		min = min < a[i] ? min : a[i];
	}
	printf("%d\n", max);
		
	return 0;
} 


Measured memory_bytes: 2636
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <functional>


using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a,0,sizeof(a))
#define minus(a) memset(a,0xff,sizeof(a))
#define chmax(a,b) a=min((a),(b))
#define chmin(a,b) a=max((a),(b))


#define MOD 1000000007

typedef pair<int,int>P;
#define INF (1<<29)
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;

int n, t;
int a[100005];
int ma[100005];
int hi;

int main(){
	scanf("%d %d ", &n, &t);
	rep(i, n) {
		scanf("%d ", &a[i]);
	}
	int t = 0;
	FORR(i, n - 1, 0) {
		t = max(a[i], t);
		ma[i] = t;
	}
	hi = 0;
	rep(i, n) {
		hi = max((ma[i] - a[i]),hi);
	}
	int ans = 0;
	rep(i, n) {
		if (hi == (ma[i] - a[i]))
			ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
n,m = map(int, input().split())

A = [[0 for i in range(m)] for j in range(n)]

A = [ input().split() for l in range(n)]
B = [int(input()) for i in range(m)]
C = [0 for i in range(n)]

for i in range(n):
	for j in range(m):
		C[i] += int(A[i][j]) * int(B[j])

#print(A[0][1])
#print(A)
#print(B)
#rint(C)

for i in range(n):
	print(C[i])


Measured memory_bytes: 6300
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

struct Deep {
	ll all;
	ll notreef;
	ll reef;
};

int main(void) {
	int a, b;
	cin >> a >> b;
	cout << a * b;
}

/*

*/


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    LL N;
    map<char, LL> dic;
    cin >> N >> dic['A'] >> dic['B'] >> dic['C'];
    LL s = dic['A'] + dic['B'] + dic['C'];
    vector<string> query(N);
    vector<string> res(N, "");

    REP(i, N) {
        cin >> query[i];
    }

    bool yn = true;

    REP(i, N) {
        char x, y;
        tie(x, y) = tie(query[i][0], query[i][1]);
        if(dic[x] == 0 && dic[y] == 0) {
            yn = false;
            break;
        }
        if(dic[x]*dic[y] == 0 && 0 < dic[x]) {
            dic[x]--;
            dic[y]++;
            res[i] = y;
            continue;
        }
        if(dic[x]*dic[y] == 0 && 0 < dic[y]) {
            dic[x]++;
            dic[y]--;
            res[i] = x;
            continue;
        }
        if(s == 2 && dic[x] == dic[y] && i < N - 1) {
            auto n = query[i + 1];
            if(n.find(x) != string::npos) {
                dic[x]++;
                dic[y]--;
                res[i] = x;
                continue;
            }
            if(n.find(y) != string::npos) {
                dic[x]--;
                dic[y]++;
                res[i] = y;
                continue;
            }
        }
        if(dic[x] <= dic[y]) {
            dic[x]++;
            dic[y]--;
            res[i] = x;
            continue;
        }
        if(dic[y] < dic[x]) {
            dic[x]--;
            dic[y]++;
            res[i] = y;
            continue;
        }
    }

    if(yn) {
        cout << "Yes" << endl;
        REP(i, N) {
            cout << res[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 9560
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String str = sc.next();
        
        str = str.substring(0,k-1).toUpperCase() + str.substring(k-1,k).toLowerCase() + str.substring(k,n).toUpperCase();
        
        System.out.println(str);
    }
}


Measured memory_bytes: 22868
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double c=0;
    int i=1;
    double sum;
    while(i<=n)
    {
        if(i%2==1)
        {
             c++;
        }
 
      i++;
    }
 
    sum=c/n;
    cout<<sum;
 
 
 
 
 
    return 0;
}

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

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const long INFL = long.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	int[] p = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101 };

	int MAX = 1000000000;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int N = cin.nextInt();
		int T = cin.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++)
		{
			A[i] = cin.nextInt();
		}
		int[] max = new int[N];
		max[N - 1] = A[N - 1];
		int[] diff = new int[N];
		int max_diff=0;
		for (int i = N-2; i >= 0; i--)
		{
			max[i] = Math.Max(max[i+1], A[i]);
			diff[i] = max[i] - A[i];
			max_diff = Math.Max(max_diff, diff[i]);
		}
		int ans = 0;
		for (int i = 0; i < N; i++)
		{
			if (diff[i] == max_diff) ans++;
			//Console.WriteLine(max[i]);
		}
		Console.WriteLine(ans);
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 12888
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
constexpr double pi=3.14159265358979;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

void solve(){
 int n;
 cin>>n;
 string s;
 cin>>s;
 int cnt=0;
 rep(i,n-1){
   if(s[i]!=s[i+1])++cnt;
 }
 cout<<cnt+1<<"\n";
 return;
}
 
signed main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
  cout<<fixed<<setprecision(20);
	solve();
	return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"

string st;

int getnum( int l) {
	int num = 0;
	while (isdigit(st[l])) {
		num = num * 10 + st[l] - '0';
		l++;
	}
	return num;

}
int calc(const int a,const int b,const char type) {
	if (type == '+')return a + b;
	else if (type == '-')return a - b;
	else if (type == '*')return a*b;
	else {
		if (b)return a / b;
		else {
			throw(false);
		}
	}
}

set<int> getexpr(const int l,const int r) {
	set <int>aset;
	if (l > r)assert(false);
	
	int depth = 0;
	bool flag = false;
	for (int x = l; x <= r; ++x) {
		if (st[x] == '(') {
			depth++;
		}
		else if (st[x] == ')') {
			depth--;
		}
		else if (st[x] == '+' || st[x] == '-' || st[x] == '*' || st[x] == '/') {
			if (!depth) {
				flag = true;
				const set<int> lset = getexpr(l, x - 1);
				const set<int> rset = getexpr(x + 1, r);
				for (auto a : lset) {
					for (auto b : rset) {
						if (st[x] == '/'&&!b)continue;
						else {
							aset.emplace(calc(a, b, st[x]));
						}
					}
				}
			}
		}
	}
	if (!flag) {
		if (st[l] == '(')return getexpr(l + 1, r - 1);
		aset.emplace(getnum(l));
	}
	return aset;
}

int main() {
	while (1) {
		cin >> st;
		if (st == "#")break;
		set<int>aset;
		bool ok = true;
		try {
			aset=getexpr(0,st.size()-1);
		}
		catch (...) {
			assert(false);
			ok = false;
		}
		
		cout << aset.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  string s;
  cin >> s;
  ll ans = 0;
  rep(i,s.size()) {
    if (i%2 == 0) {
      if (s[i] == 'g') ;
      else --ans;
    }
    if (i%2 == 1) {
      if (s[i] == 'g') ++ans;
    }
  }
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		map<string,int>mp;
		fn{
			string s;
			cin>>s;
			mp[s]++;
		}
		cout <<"AC x "<<mp["AC"]<<endl;
		cout <<"WA x "<<mp["WA"]<<endl;
		cout <<"TLE x "<<mp["TLE"]<<endl;
		cout <<"RE x "<<mp["RE"]<<endl;
	
	}
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int INF=2*1e9;
int main()
{
    ll n,m;
    cin>>n>>m;
    cout<<min(n%m,m-n%m);
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l;
double ans = 0;
vector<PP> P;
void input() {
	cin >> n;
	rep(i, n) {
		cin >> a >> b;
		P.push_back({ a,b });
	}
}
void solve() {
	rep(i, n) {
		rep(j, i) {
			double dis = sqrt(double((P[i].first - P[j].first) * (P[i].first - P[j].first) + (P[i].second - P[j].second) * (P[i].second - P[j].second)));
			ans += dis * 2 / double(n);
		}
	}

	cout << setprecision(10)<<ans << endl;
}

int main() {
	input();
	solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;

int main()
{
	int n, w[100010];
	ll l, t, x[100010], y[100010], z[100010];
	cin >> n >> l >> t;
	int toke=0, hant=0, r[100010], le[100010];
	rep(i, n)
	{
		cin >> x[i] >> w[i];
		if(w[i]==1)
		{
			r[toke]=i;
			toke++;
		}
		else
		{
			le[hant]=i;
			hant++;
		}
	}
	ll sho, ama;
	sho=t/l, ama=t%l;
	rep(i, n) y[i]=(x[i]+(3-2*w[i]+l)*ama)%l;
	if(hant*toke==0) rep(i, n) cout << y[i] << endl;
	else
	{
		ll kaisu=0, k;
		rep(j, toke)
		{
			k=(x[le[0]]-x[r[j]]+l)%l;
			if(2*t>=k) kaisu=(kaisu+1+((2*t-k)/l))%((ll)n);
		}
		kaisu=(le[0]-kaisu+n)%(ll)n;
		ll zure=y[le[0]];
		rep(i, n) y[i]=(y[i]-zure+l)%l;
		sort(y, y+n);
		rep(i, n) y[i]=(y[i]+zure)%l;
		rep(i, n) z[(kaisu+i)%n]=y[i];
		rep(i, n) cout << z[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4608