akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main(void){
	
	int n;
	while(cin >> n){
		long money = 100000;
		for(int i = 0; i < n; i++){
			money *= 1.05;
			if(money % 1000) money = money - (money%1000) + 1000;
		}
		cout << money << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import sys
input = sys.stdin.readline
from math import factorial

MAX_V = 10**9 + 7

from math import factorial


def nCr(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(n - r) * factorial(r))

'''
def nCr(n, r):
    numerator = 1
    denominator = 1

    p = r if r < n-r else n-r

    for i in reversed(range(n-p+1, n+1)):
        numerator *= i

    for i in reversed(range(1, p+1)):
        denominator *= i

    return int(numerator / denominator)
'''

n, b_k = map(int, input().split())
r_k = n-b_k
spot = r_k+1

min_k = min(b_k, spot)

#for i in range(1, min_k+1):
for i in range(1, b_k+1):
    c = nCr(spot, i) * nCr(b_k-1, i-1)
    print(c % MAX_V)

Measured memory_bytes: 3316
/* Atcoder abc149a
 * See tasks at: https://atcoder.jp/contests/abc149/tasks/abc149_a
 */
#include <iostream>
#include <vector>
#include <algorithm>

#define until(symbol, max) for (int symbol = 0; (symbol) < (max); (symbol)++)

using namespace std;
using ll = long long;
int main()
{
    string s, t;
    cin >> s >> t;

    cout << t << s;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int maxN = static_cast<const int>(1e5 + 10);

int fa[maxN], dis[maxN], N, M;

int find(int x) {
    if(x == fa[x]) {
        return x;
    }
    int temp = fa[x];
    fa[x] = find(temp);
    dis[x] = dis[x] + dis[temp];
    return fa[x];
}

bool merge(int x, int y, int d) {
    int fx = find(x), fy = find(y);
    if(fx == fy) {
        return dis[y] - dis[x] == d;
    } else {
        fa[fx] = fy;
        dis[fx] = dis[y] - dis[x] - d;
        return true;
    }
}


int main() {
#ifdef ACM_XYZHAO_TEST
    freopen("../test.in", "r", stdin);
//	freopen("../test.out", "w", stdout);
#endif

    scanf("%d %d", &N, &M);
    for (int i = 1; i <= N; ++i) {
        fa[i] = i;
        dis[i] = 0;
    }
    int l, r, d;

    bool flag = true;
    for (int i = 0; i < M; ++i) {
        scanf("%d %d %d", &l, &r, &d);
        if(flag && !merge(l, r, d)) {
            flag = false;
        }
    }

    printf("%s\n", flag ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 1024
/*
 * @Author: Kaizyn
 * @Date: 2020-03-12 16:51:33
 * @LastEditors: Kaizyn
 * @LastEditTime: 2020-03-12 19:58:19
 * @FilePath: \Code\atcoder\hitachi2020C.cpp
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const int N = 2e5+7;
const int MOD = 1e9+7;
const double eps = 1e-7;
const int INF = 0x3f3f3f3f;
typedef pair<int, int> pii;

int n;
int col[N], res[N];
vector<int> e[N], a[2], b[3];

void dfs(const int &u, const int &fa)
{
    col[u] = col[fa]^1;
    a[col[u]].emplace_back(u);
    for (int v : e[u]) if (v != fa) dfs(v, u);
}

inline void solve()
{
    cin >> n;
    for (int i = 1, u, v; i < n; ++i) {
        cin >> u >> v;
        e[u].emplace_back(v);
        e[v].emplace_back(u);
    }
    dfs(1, 0);
    for (int i = 1; i <= n; ++i) b[i%3].emplace_back(i);
    if (a[0].size() > a[1].size()) swap(a[0], a[1]);
    if ((int)a[0].size() <= n/3) {
        for (int i : a[0]) {
            res[i] = b[0].back();
            b[0].pop_back();
        }
        for (int i : a[1]) {
            for (int j = 0; j < 3; ++j) {
                if (b[j].empty()) continue;
                res[i] = b[j].back();
                b[j].pop_back();
                break;
            }
        }
    } else {
        for (int i : b[1]) {
            res[a[0].back()] = i;
            a[0].pop_back();
        }
        for (int i : b[2]) {
            res[a[1].back()] = i;
            a[1].pop_back();
        }
        for (int i : b[0]) {
            int t = a[0].size() ? 0 : 1;
            res[a[t].back()] = i;
            a[t].pop_back();
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout << res[i] << " \n"[i==n];
    }
}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int testcase = 1;
    // cin >> testcase;
    for (int i = 1; i <= testcase; ++i) {
        solve();
    }
    return 0;
}

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

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define LL long long
#define ULL unsigned long long
#define LB lower_bound
#define MOD1 1000000007
#define MOD2 1000000009

int main()
{
    static const int _ = []() {
        ios::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        return 0;
    }();
    int n;
    cin >> n;

    vector<vector<int>> dp(n + 1, vector<int>(4,0));
    vector<vector<int>> arr(n + 1, vector<int>(4));

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= 3; j++)
        {
            cin >> arr[i][j];
        }
    }
    
    dp = arr;

    for (int i = 2; i <= n; i++)
    {
        for (int j = 1; j <= 3; j++)
        {

            //i-1 ke liye j se nahi lenge i.e, dp[i-1][j]
            //if(j == 1, )
            if (j == 1)
            {
                dp[i][j] += max(dp[i - 1][2], dp[i - 1][3]);
            }
            else if (j == 2)
            {
                dp[i][j] += max(dp[i - 1][1], dp[i - 1][3]);
            }
            else
            {
                dp[i][j] += max(dp[i - 1][2], dp[i - 1][1]);
            }
            
            
            // cout << dp[i][j] << " ";
        }
        // cout << "\n";
    }

    cout << max(dp[n][1], max(dp[n][2], dp[n][3]));

    return 0;
}


Measured memory_bytes: 11264
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 2e5 + 10, mod = 1e9 + 7, INF = 1e9 + 100; 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for(int i = 0; i <= n - 3; i ++){
		if(s.substr(i, 3) == "ABC")ans ++;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = list(input())
Q = INT()

class Bit:
   def __init__(self, n):
       self.size = n
       self.tree = [0] * (n + 1)
   def sum(self, i):
       s = 0
       while i > 0:
           s += self.tree[i]
           i -= i & -i
       return s
   def add(self, i, x):
       while i <= self.size:
           self.tree[i] += x
           i += i & -i

dic_char = defaultdict(int)
for i, char in enumerate(ascii_lowercase):
	dic_char[char] = i

bits = [None]*len(ascii_uppercase)
for i in range(len(ascii_uppercase)):
	bits[i] = Bit(N)

for i in range(N):
	bits[dic_char[S[i]]].add(i+1, 1)

for _ in range(Q):
	a, b, c = input().split()
	if a == "1":  # BITを更新
		b = int(b)
		char = S[b-1]
		bits[dic_char[char]].add(b, -1)
		bits[dic_char[c]].add(b, 1)
		S[b-1] = c
	if a == "2":
		cnt = 0
		b, c = int(b), int(c)
		for i in range(len(ascii_uppercase)):
			cnt += bits[i].sum(c)-bits[i].sum(b-1) >= 1
		print(cnt)


Measured memory_bytes: 172744
n,m = gets.split.map(&:to_i)

a = Array.new(n)

n.times do |i|
	a[i] = gets.split.map(&:to_i)
end

b = Array.new(m)

m.times do |i|
	b[i] = gets.to_i
end

a.each do |line|
	ans = 0
	line.length.times do |i|
		ans  += line[i] * b[i]
	end
	puts ans
end

Measured memory_bytes: 6124
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 1024;

int main(void) {
	// in = fopen("A.in", "rt");
	
	int n;
	fscanf(in, "%d", &n);
	if (n == 1) {
	    fprintf(out, "Hello World\n");
    } else {
        int A, B;
        fscanf(in, "%d %d", &A, &B);
        fprintf(out, "%d\n", A + B);
    }
	
	return 0;
}

Measured memory_bytes: 128
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

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

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

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt64()
	k := nextInt64()

	for true {
		n = n % k
		nn := int64(math.Abs(float64(n - k)))
		if (n % k) < nn {
			break
		}
		n = nn
	}
	fmt.Println(n)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

void showArray(int a[], int n);
void sort(int a[]) {
  int tmp;
  for (int i=0; i<3; i++) {
    for (int j=2; j>i; j--) {
      if (a[j-1] > a[j]) {
        tmp = a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
}

int main() {
  int a[3];
  int first, second, third;

  for (int i=0; i<3; i++) {
    cin >> a[i];
  }

  sort(a);

  int score = a[2] * 10 + a[1] + a[0];

  cout << score << endl;

  return 0;
}

void showArray(int a[], int n) {
  for(int i=0; i<n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n, a, b, q;
  int x[SIZE], y[SIZE], h[SIZE];
  char c[SIZE];

  pair<int,int> from[SIZE], to[SIZE];

  scanf("%d%d%d%d",&n,&a,&b,&q);

  for(int i=0;i<a;i++){
    scanf("%d %c",x+i, c+i);
    x[i]--;
  }

  int s = 0;
  
  for(int i=0;i<=b;i++){
    if(i < b)
      scanf("%d%d",y+i, h+i);
    else
      y[i] = n+1;
    
    if(i>0){
      if(h[i-1] != 0){
        from[s] = {y[i-1]-1, y[i]-2};
        to[s] = {h[i-1]-1, h[i-1] + y[i]-y[i-1] - 2};
        s++;
      }
    }
  }

  map<int,char> dic;
  queue<pair<int,char> > que;

  for(int i=0;i<a;i++){
    que.push({x[i], c[i]});
  }

  while(que.size()){
    auto p = que.front();
    que.pop();

    int pos = p.first;
    int ch = p.second;

    if(dic.find(pos) != dic.end()) continue;
    dic[pos] = ch;
    
    for(int i=0;i<s;i++){
      if(from[i].first <= pos && pos <= from[i].second){
        int newpos = (pos - to[i].first) % (from[i].first - to[i].first) + to[i].first;
        que.push({newpos, ch});
      }
    }
  }


  char ansStr[SIZE] = {};
  
  for(int i=0;i<q;i++){
    int z;
    char ans = '?';
    scanf("%d",&z);
    z--;

    queue<int> que;
    set<int> visited;

    if(dic.find(z) != dic.end())
      ans = dic[z];
    else
      que.push(z);
    
    while(que.size()){
      int pos = que.front(); que.pop();

      if(visited.find(pos) != visited.end()) continue;
      visited.insert(pos);
      
      for(int i=0;i<s;i++){
        if(from[i].first <= pos && pos <= from[i].second){
          int newpos = (pos - to[i].first) % (from[i].first - to[i].first) + to[i].first;

          if(dic.find(newpos) != dic.end()){
            que = queue<int>();
            ans = dic[newpos];
            break;
          }else{
            que.push(newpos);
          }
        }
      }
    }

    ansStr[i] = ans;
  }

  printf("%s\n",ansStr);
  
  return 0;
}



Measured memory_bytes: 50232
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second


int main(){
	ll n, dp[100010], ans = INF;
	cin >> n;
	for (int i = 0;i <= n;i++)dp[i] = INF;
	dp[n] = 0;
	vector<P>v;
	for (int i = 1;i < 7;i++) {
		for (int j = 1;j < 6;j++)v.pb(P(pow(6, i)*j, j));
		for (int j = 1;j < 9;j++)v.pb(P(pow(9, i)*j, j));
	}
	for (int i = n;i > 0;i--) {
		for (auto u : v) {
			if (u.fr > 0 && i >= u.fr)dp[i - u.fr] = min(dp[i - u.fr], dp[i] + u.sc);
		}
	}
	for (int i = 0;i <= n;i++) {
		ans = min(ans, dp[i] + i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <string.h>
#include <string>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <typeinfo>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;

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

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

int a[100000];

int main()
{
  int n, m;
  scanf("%d %d", &n, &m);
  
  for(int i = 0; i < n; i++)
    scanf("%d", &a[i]);
  
  ll lcma = a[0]/2;
  
  for(int i = 1; i < n; i++)
  {
    lcma = lcm(lcma, a[i]/2);
    if ((lcma/(a[i]/2)) % 2 == 0)
    {
      printf("0\n");
      return 0;
    }
  }
  
  int res = 0;
  
  for(int i = 1; lcma * i <= m; i++)
    if(i%2 == 1)
      res++;
  
  printf("%d\n", res);
  
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
   long long x,ans;
   cin >> x;
   ans = (x/11)*2;
   if(x%11>=7){
       ans = ans+2;
   }else if(x%11>=1){
       ans ++;
   }
   cout << ans << endl;
}



Measured memory_bytes: 256
from collections import deque

def Z_alg(S):
    
    length = len(S)
    Z = [0] * (length + 1)
    Z[0] = length
    i, j = 1, 0
    ret = 0

    while i < length:
        while i + j < length and S[j] == S[i + j]:  j += 1
        Z[i] = j
        if i - Z[i] >= 0:  ret = max(ret, Z[i])
        if(j == 0):
            i += 1
            continue
        k = 1
        while k < j and k + Z[k] < j:
            Z[i + k] = Z[k]
            k += 1
            if (i + k) - Z[i + k] >= 0:  ret = max(ret, Z[i + k])
        i += k
        j -= k
        
    return ret

N = int(input())
S = input()
ans = 0
s = deque(S)
while s:
    ans = max(ans, Z_alg(s))
    s.popleft()  
print(ans)

Measured memory_bytes: 77620
#include<stdio.h>

int N;

typedef struct{
    char suit;
    int value;
}Card;

void swap(Card *A,Card *B){
    Card C;
    C=*A;
    *A=*B;
    *B=C;
}

void BubbleSort(Card C[],int N){
    int i,j;
    for(i=0;i<N;i++){
        for(j=N-1;j>=i+1;j--){
            if(C[j].value<C[j-1].value){
                swap(&C[j],&C[j-1]);
            }
        }
    }
    for(i=0;i<N;i++){
        printf("%c%d",C[i].suit,C[i].value);
        if(i!=N-1){
            printf(" ");
        }
    }
    printf("\nStable\n");
    
}

void SelectionSort(Card X[],int N){
    int i,j,minj;
    for(i=0;i<N;i++){
        minj=i;
        for(j=i;j<N;j++){
            if(X[j].value<X[minj].value){
                minj=j;
            }
        }
        swap(&X[i],&X[minj]);
    }
    for(i=0;i<N;i++){
        printf("%c%d",X[i].suit,X[i].value);
        if(i!=N-1){
            printf(" ");
        }
    }
    printf("\n");
}

void Judge(Card C[],Card X[]){
    int i;
    for(i=0;i<N;i++){
        if(X[i].value!=C[i].value || X[i].suit!=C[i].suit){
            printf("Not stable\n");
            return;
        }
    }
    printf("Stable\n");
}
int main(){
    Card C[36],X[36];
    int i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf(" %c%d",&C[i].suit,&C[i].value);
        X[i]=C[i];
    }
    BubbleSort(C,N);
    SelectionSort(X,N);
    Judge(C,X);
    return 0;
}



Measured memory_bytes: 2104
import java.util.*;
import java.io.*;

class Main {
    static int INF = 100;
    static int[] list;
    static int a;
    static int b = 1;
    public static void main(String[] args)throws IOException{
      int i,j,n,x,y;
      int Graph[][];
      int depth[];
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(buffer.readLine());
        Graph = new int[n+1][n];
        depth = new int[n+1];

        for(i=0;i<n;i++){
            String[] str = buffer.readLine().split(" ");
            x = Integer.parseInt(str[0]);
            y = Integer.parseInt(str[1]);
            depth[x] = -1;
            for(j=0;j<y;j++){
                Graph[x][j] = Integer.parseInt(str[j+2]);
            }
        }

        depth[1] = 0;
        list = new int[n+1];
        list[0] = 1;

        search(Graph, depth);

        for(i=1;i<=n;i++){
            System.out.println(i + " " + depth[i]);
        }
    }

    public static void search(int[][] Graph, int[] depth){
      int i;
        for(a=0;a<b;a++){
            int fr = list[a];
            for(i=0;i<Graph[fr].length;i++){
                int to = Graph[fr][i];
                if(depth[to] == -1){
                    depth[to] = depth[fr] + 1;
                    list[b++] = to;
                }
            }
        }
    }
}



Measured memory_bytes: 24556
//Ø¨ÙØ³Ù’Ù…Ù Ù±Ù„Ù„ÙŽÙ‘Ù°Ù‡Ù Ù±Ù„Ø±ÙŽÙ‘Ø­Ù’Ù…ÙŽÙ°Ù†Ù Ù±Ù„Ø±ÙŽÙ‘Ø­ÙÙŠÙ…Ù
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define endl "\n"


int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (c >= a && c <= b)
    	cout << "Yes" << endl;
    else
    	cout << "No" << endl;
    return 0;
}

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

typedef long long ll;

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

    ll n,a,b;
    cin >> n >> a >> b;
    ll ans;
    if((b-a)%2==1) ans = min(a-1+1+(b-a-1)/2,n-b+1+(b-a-1)/2);
    else ans = (b-a)/2;
    cout << ans << endl;
    return 0;
}

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

#define pi 3.14159265358979323846264

#define ll long long
#define fori(n) for(long long i=0;i<n;i++)
#define forj(n) for(long long j=0;j<n;j++)

#define sp(n) setprecision(n)
#define mkp make_pair
#define mkt make_tuple

using namespace std;

bool isPrime(long long k){
    if(k<=1){return false;}
    if(k==2){return true;}
    if(k%2==0){return false;}
    long long i = 3;
   while (i*i <= k) {if (k % i == 0) {return false;}i += 2;}
return true;
}

ll binomialCoeff(ll n, ll k){
    ll C[n + 1][k + 1];ll i, j;
    for (i = 0; i <= n; i++){
        for (j = 0; j <= min(i, k); j++){
            if (j == 0 || j == i){C[i][j] = 1;}
            else{C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}}
    return C[n][k];
 }

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

ll srihrg(ll n,ll k,ll m){
    ll ans;
    ans=1;
    fori(k){
        ans=(ans*n)%m;
    }
    return ans;
}

#define d7 1000000007
#define l7 998244353
vector<ll> primes;

int main(int argc, const char * argv[]) {
 //cout<<"Om\n";
 //Praise to Lord
 //make cin/cout faster
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);cout.tie(NULL);
// code now
   
    
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]){cout<<"Yes";}
    else{cout<<"No";}
    
//code ends
    return 0;
}


Measured memory_bytes: 256
def resolve():
    n = int(input())
    s = input()
    t = input()
    ans = len(s) + len(t)
    for i in range(len(s)):
        pos = 0
        for ss,tt in zip(s[i:],t):
            if ss != tt:
                break
            pos += 1
        else:
            if len(s) - i > len(t) or i + len(t) < n:
                continue
            tmp = i + len(t)
            if tmp < ans:
                ans = tmp
    print(ans)
        

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

signed main() {
	int n, m;
	int a[114514];
	cin >> n >> m;
	rep(i, n) cin >> a[i];
	P p[114514];
	rep(i, m) {
		cin >> p[i].second >> p[i].first;
	}
	sort(a, a + n);
	sort(p, p + m);
	reverse(p, p + m);
	bool bou = true;
	int now = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < p[i].second; j++) {
			if (a[now] >= p[i].first) {
				bou = false;
				break;
			}
			a[now] = p[i].first;
			now++;
		}
		if (!bou) break;
	}
	int ans = 0;
	rep(i, n) {
		ans += a[i];
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2944
#include <stdio.h>

int main(void)
{
    int n, count = 0, isToA = 0;
    int a[210], b[210];
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    for (count = 0; ; count++)
    {
        int *check, *in, j;
        check = isToA ? b : a;
        in = isToA ? a : b;
        for(j = 0; j < n; j++){
            if(check[j] % 2){
                break;
            }
            in[j] = check[j] / 2;
        }
        if(j != n){
            break;
        }
        isToA ^= 1;
    }
    
    printf("%d", count);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin >> s >> t;
  int k=0;
  for(int i=0; i<s.size(); i++){
    k += (s[i]!=t[i]);
  }
  cout << k << endl;
  
}

Measured memory_bytes: 3892
#include <bits/stdc++.h>
#define ps push_back
#define LL long long
using namespace std;
const int maxn=2e5+5;
int lazy[maxn];
int a[maxn];
int main()
{
    int n, k, i, j;
    cin>>n>>k;
    for(int i=1; i<=n; i++)
        scanf("%d", &a[i]);
    for(int i=1; i<=n; i++)
    {
        int l=i-a[i], r=i+a[i]+1;
        l=max(1, l);
        r=min(r, n+1);
        lazy[l]++, lazy[r]--;
    }
    for(int j=0; j<k; j++)
    {
        int sum=0;
        for(int i=1; i<=n; i++)
        {
            sum+=lazy[i];
            a[i]=sum;
//            printf("%d ", a[i]);
        }
//        printf("\n");
        for(int i=0; i<=n+1; i++)lazy[i]=0;
        for(int i=1; i<=n; i++)
        {
            int l=i-a[i], r=i+a[i]+1;
            l=max(1, l);
            r=min(r, n+1);
            lazy[l]++, lazy[r]--;
        }
        int all=1;
        for(int i=1; i<=n; i++)all&=a[i]==n;
        if(all)break;
//        printf("%d\n", j);
    }
    for(int i=1; i<=n; i++)printf(i==n?"%d\n":"%d ", a[i]);
    return 0;
}


Measured memory_bytes: 5380
#import time

def main():
    N = list(input())
    if int(N[-1]) == 3:
        return "bon"
    elif int(N[-1]) in [0, 1, 6, 8]:
        return "pon"
    else:
        return "hon"
    

if __name__ == '__main__':
    #start = time.time()
    print(main())
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

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

int main(){

	int N;
	std::cin >> N;
	std::vector<int> A;
	int tmp = 0;
	while(std::cin >> tmp){A.push_back(tmp);}

	std::vector<int> id;
	id.resize(N);

	for(const int x : A){
		id[x-1]++;
	}

	for(const int x : id){std::cout << x << std::endl;}

	return 0;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
const int M=2000006;
int f[M],inv[M];
int expo(int base,int exponent,int mod){
    int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M){
        f[i]=(1LL*i*f[i-1])%hell;
    }
    inv[M-1]=expo(f[M-1],hell-2,hell);
    for(int i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%hell;
    }
}
int C(int n,int r){
    if(n<r or r<0) return 0;
    return (1LL*((1LL*f[n]*inv[r])%hell)*inv[n-r])%hell;
}
int m;
int get(int n,int a){
    if(a%2) return 0;
    return (C(n+a/2-1,a/2)-n*C(n+a/2-m-2,a/2-m-1)%hell+hell)%hell;
}
void solve(){
    compute();
    int n,ans=0;
    cin>>n>>m;
    rep(odd,0,min(n,m)+1){
        ans=(ans+C(n,odd)*get(n,3*m-odd)%hell)%hell;
        ans=(ans-odd*get(n-1,m-odd)%hell*C(n,odd)%hell+hell)%hell;
    }
    cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 31488
// https://atcoder.jp/contests/abc059/tasks/arc072_b
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

struct C {
    ll X_{};
    ll Y_{};

    explicit C(ll X, ll Y) : X_(X), Y_(Y){}
    // true if Alice wins
    bool resolve() {
       return abs(X_-Y_) >= 2;
    }
};

int main() {
    ll X, Y;
    cin >> X >> Y ;
    C c{X, Y};
    cout << (c.resolve() ? "Alice" : "Brown") << endl;
    return 0;
}


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

int main(){
  int j, pertial_area, total_area=0;
  string s;
  stack<int> S1;
  stack<pair<int, int> > S2;
  vector<int> V;
  
  cin >> s;
  for(int i=0; i<s.size(); i++){
    if(s[i] == '\\')
      S1.push(i);
    else if(!S1.empty() && s[i] == '/'){
      pertial_area = i - S1.top();
      total_area += pertial_area;

      while(!S2.empty() && S2.top().first > S1.top()){
        pertial_area += S2.top().second;
        S2.pop();
      }
      
      S2.push(make_pair(S1.top(), pertial_area));
      S1.pop();
    }
  }

  while(!S2.empty()){
    V.push_back(S2.top().second);
    S2.pop();
  }
  
  cout << total_area << endl;
  cout << V.size();
  for(int i=V.size()-1; i>=0; i--){
    cout << " " << V[i];
  }
  cout << endl;
  
  return 0;
}



Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;

int main(void)
{
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    vector<int> x(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> x[i];
    }
    vector<int> y(M, 0);
    for (int i = 0; i < M; i++)
    {
        cin >> y[i];
    }

    for (int Z = X + 1; Z <= Y; Z++)
    {
        bool is_ok = true;
        for (int i = 0; i < N; i++)
        {
            if (Z <= x[i])
            {
                is_ok = false;
            }
        }
        for (int i = 0; i < M; i++)
        {
            if (Z > y[i])
            {
                is_ok = false;
            }
        }

        if (is_ok == true)
        {
            // printf("Z = %d\n", Z);
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
    return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int x;
  cin>>x;
  int a=x/100;
  int b=x%100;
  if(b>5*a){
    cout<<0<<endl;
  }else{
    cout<<1<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}

ll res[1223456]; string test[12345678]; char ans[123456];
signed main() {
    ll n, m, d, a; cin >> n;
	ll ok = 1, ng = n + 1, mid = (ok + ng) / 2;
	for (int i = 0; i < n; i++) {
		if (i == 0) { cout << '?'; }
		cout << ' ' << i + 1;
	}
	cout << endl << flush; cin >> test[1];
	if (test[1] == "Red") { test[n + 1] = "Blue"; }
	else { test[n + 1] = "Red"; }
	while (ng - ok > 1) {
		for (int i = 0; i < n; i++) {
			if (i == 0) { cout << '?'; }
			cout << ' ' << mid + i;
		}
		cout << endl << flush; cin >> test[mid];
		if (test[1] == "Red" && test[mid] == "Red") { ok = mid; }
		if (test[1] == "Red" && test[mid] == "Blue") { ng = mid; }
		if (test[1] == "Blue" && test[mid] == "Red") { ng = mid; }
		if (test[1] == "Blue" && test[mid] == "Blue") { ok = mid; }
		mid = (ok + ng) / 2;
	}
	for (int h = 1; h <= 2 * n; h++) {
		if (h == ok) { ans[h] = test[ok][0]; }
		else if (h == ok + n) { ans[h] = test[ok + 1][0]; }
		else if (ok < h && h < ok + n) {
			cout << '?';
			for (int i = ok; i <= ok + n; i++) {
				if (i != h) { cout << ' ' << i; }
			}
			cout << endl << flush; string s; cin >> s;
			if (s[0] == 'B') { ans[h] = 'R'; }
			else { ans[h] = 'B'; }
		}
		else {
			cout << '?';
			for (int i = 1; i <= ok; i++) {
				if (i != h) { cout << ' ' << i; }
			}
			for (int i = ok + n; i <= 2 * n; i++) {
				if (i != h) { cout << ' ' << i; }
			}
			cout << endl << flush; string s; cin >> s;
			if (s[0] == 'B') { ans[h] = 'R'; }
			else { ans[h] = 'B'; }
		}
	}
	cout << "! ";
	for (int h = 1; h <= 2 * n; h++) {
		cout << ans[h];
	}
	cout << endl << flush;
    return 0;
}

Measured memory_bytes: 389452
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;

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

    priority_queue<pi, vector<pi>, greater<pi>> pq;
    rep(i,m){
        int a,b;
        cin >>a >>b;
        pq.push({b,a});
    }

    int ans = 0;
    int x = 0;
    while(!pq.empty()){
        pi p = pq.top();
        pq.pop();
        if(x<=p.se){
            ++ans;
            x = p.fi;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
macro_rules! scan {
    ( $( $x:ident ),*; $t:ty ) => {
        let mut buf = String::new();
        let mut itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn euc(a: u64, b: u64) -> u64 {
    let (a, b) = if a >= b { (a, b) } else { (b, a) };
    let mut a = a;
    let mut b = b;
    while b > 0 {
        let t = b;
        let u = a % b;
        a = t;
        b = u;
    }
    return a;
}

fn main() {
    scan!(a, b; u64);
    println!("{}", a * b / euc(a, b));
}


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

int main() {
    ll n;
    cin >> n;
    ll res = 0;
    for(ll i = 1; i <= n; ++i){
        if(i % 3 == 0 || i % 5 == 0) continue;
        res += i;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n)

	listT := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&listT[i])
	}
	fmt.Scan(&m)
	listP := make([]int, m)
	listX := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&listP[i], &listX[i])
	}

	for i := 0; i < m; i++ {
		time := 0
		for j := 0; j < n; j++ {
			if listP[i]-1 == j {
				time += listX[i]
			} else {
				time += listT[j]
			}
		}
		fmt.Println(time)
	}

}


Measured memory_bytes: 512
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main{

	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static long mod = (long) (1e9+7);
	public static long[] fac,inv;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
	    int n = sc.nextInt();
	    int[] x = new int[n];
	    for(int i=0;i<n;++i) x[i] = sc.nextInt();
	    long ans = Long.MAX_VALUE;
	    for(int i=1;i<=100;++i) {
	    	long sum = 0;
	    	for(int j=0;j<n;++j) {
	    		sum+=(x[j] - i)*(x[j] - i);
	    	}
	    	ans = Math.min(ans, sum);
	    }
	    out.println(ans);
	    out.close();

	}

}


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

int main(){
  int N,T,A,H;
  int p=0;
  int p_T=1<<30;
  cin >> N;
  cin >> T >> A;
  for(int i=0;i<N;i++){
        cin >> H;
        int t_T=T*1000-H*6-A*1000;
        if(t_T<0){t_T*=-1;}
        if(p_T>t_T){
          p=i;
          p_T=t_T;
        }
  }
  cout << p+1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

int main()
{
    // 整数の入力
    ll A,B,C;
    cin  >> A >> B >> C;

    cout << max(0LL, C - (A - B)) <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;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 pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};

int32_t main(){
    int n, x;
    cin >> n >> x;
    vector<int> v(n), a;
    REP(i, n) cin >> v[i];
    FOR(i, 1, n) a.pb(v[i-1]+v[i]);

    int cnt=0;
    REP(i, n-1){
        if(a[i]>x){
            int y = a[i]-x;
            cnt+=y;
            a[i]=x;
            if(i<n-2){
                if(v[i+1]>=y) a[i+1]-=y;
                else a[i+1]=v[i+2];
            }
        }
    }

    cout << cnt << endl;
}

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

ll a[60], p[60];
ll f(ll n, ll x)
{
	if (n == 0) return 1;
	if (x == 1) return 0;
	else if (x <= a[n - 1] + 1)
		return f(n - 1, x - 1);
	else if (x <= a[n - 1] + 2)
		return p[n - 1] + 1; 
	else if (x <= a[n] - 1)
		return f(n - 1, x - a[n - 1] - 2) + p[n - 1] + 1;
	else if (x <= a[n])
		return   p[n];
}

signed main(void)
{
	ll n, x, ans;

	cin >> n >> x;
	a[0] = p[0] = 1;
	for(int i = 1; i <= n; i++)
	{
		a[i] += 2 * a[i - 1] + 3; 
		p[i] += 2 * p[i - 1] + 1; 
	}
	ans = f(n, x);
	cout << ans << endl;
	return 0;
}


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

#include <cassert>
#include <climits>

#include <string.h>

#include <vector>
#include <map>
#include <stack>

enum Color
{
    kWhite,
    kGray,
    kBlack,
};

// 頂点数.
int n;

// 各頂点の隣接リスト表現.
std::map< int, std::vector<int> > adj_list;

// 各頂点の訪問状態を管理する.
std::vector<Color> c;

// 初回訪問時.
std::vector<int> d;

// 二回目訪問時.
std::vector<int> f;

void makeAdjListFromInput(int n)
{
    for (int i = 0; i < n; ++i)
    {
        int vertex;
        int degree;

        std::cin >> vertex;
        std::cin >> degree;

        assert(vertex <= n);
        assert(degree <= n);

        std::vector<int> adj_vertexes;

        for (int j = 0; j < degree; ++j)
        {
            int adj;
            std::cin >> adj;
            adj_vertexes.push_back(adj - 1);
        }

        adj_list[vertex - 1] = adj_vertexes;
    }
}

int nextVertex(int current)
{
    std::vector< int > adjs = adj_list[current];
    for (std::vector< int >::iterator it = adjs.begin(); it != adjs.end(); ++it)
    {
        if (c[(*it)] == kWhite)
            return (*it);
    }

    // 見つからなかった.
    return INT_MAX;
}

int firstVertex()
{
    for (int i = 0; i < n; ++i)
    {
        if (c[i] == kWhite)
            return i;
    }

    return INT_MAX;
}

void depthFirstSearch()
{
    int counter = 0;
    std::stack<int> tmp_stack;

    // 諸々初期化.
    for (int i = 0; i < n; ++i)
    {
        c.push_back(kWhite);
        d.push_back(0);
        f.push_back(0);
    }

    while (true)
    {
        int first = firstVertex();
        if (first == INT_MAX)
            break;
        tmp_stack.push(first);
        c[first] = kGray;
        d[first] = ++counter;

        while (! tmp_stack.empty())
        {
            int current = tmp_stack.top();
            int next = nextVertex(current);
            if (next != INT_MAX)
            {
                tmp_stack.push(next);
                c[next] = kGray;
                d[next] = ++counter;
            }
            else
            {
                int pop = tmp_stack.top();
                tmp_stack.pop();
                c[pop] = kBlack;
                f[pop] = ++counter;
            }
        }
    }
}

int main()
{


    std::cin >> n;

    makeAdjListFromInput(n);

    depthFirstSearch();

    for (std::map< int, std::vector<int> >::iterator it = adj_list.begin(); it != adj_list.end(); ++it)
    {
        int v = it->first;
        std::cout << v + 1 << " " << d[v] << " " << f[v] << std::endl;
    }

    return 0;
}






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

int main()
{   int  a,b,h,m,s;
    cin>>a>>b>>h>>m;
    s=h*60+m;
    double x,p,q,c;
    p=(6*s)%360;
    if(s%2==0){
       q=(s/2)%360;
    }
    else if(s%2!=0)
    {
       q=(s/2)%360 +0.5;
    }
    const double pi = 3.14159265358979323846;
    x=(min(abs(p-q),360-abs(p-q))*pi)/180;

    c=sqrt(a*a + b*b - 2*a*b*cos(x));
     std::cout << std::setprecision(17) << c << '\n';


  return 0;
}


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

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  int a=S.size();
  for(int i=0; i<S.size()-1;i++){
    if(S.at(i)==S.at(i+1)){
      a--;
    }
  }
    cout <<a<<endl;
  
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
using namespace std;
typedef pair<int, int> pairII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
#define long long ll;
#define shig_for(i, a, b) for(int i = (a); i < (b); ++i)
#define shig_rep(i, n) shig_for(i, 0, n)   // almost copied...
#define shig_forB(bit,a,b) for(int bit = (a); bit < (1<<(b)); ++bit)
#define shig_repB(bit,n) shig_forB(bit,0,n)
#define tmp int temp = 0
#define str string

struct UFinder {

    VI r;

    UFinder(int N) {
        r = VI(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x){
        return -r[root(x)];
    }

    int host_quantity(int bgn, int end){
        tmp;
        for(int k = bgn; k < end; k++){
            if(r[k] < 0){
                temp++;
            }
        }
        return temp;
    }

};


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

    UFinder city(N);

    for (int i = 0; i < M; i++){
        int A, B;
        cin >> A >> B;
        A -= 1;
        B -= 1;
        city.unite(A, B);
    }

    int ans = city.host_quantity(0, N);
    ans--;
    cout << ans << endl;

    //cout << "Atcoder" << endl;

    return 0;
}

Measured memory_bytes: 3700
import sys
sys.setrecursionlimit(10**7)

mod = 10**9 + 7

star = [[None] * 1001 for _ in range(1001)]
for i in range(1001):
    star[i][1] = 1
    star[i][i] = 1
    star[i][0] = 0

def search(n, k):
    if n < k:
        return 0
    elif star[n][k] != None:
        return star[n][k] % mod
    else:
        star[n][k] = (search(n-1, k-1) + k * search(n-1, k)) % mod
        return star[n][k]

n, k = map(int, input().split())
ans = 0
for i in range(k+1):
    ans += search(n, i)
    ans = ans % mod

print(ans)


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

int main(){
    using namespace std;
    size_t N;
    cin >> N;
    vector<unsigned long> f(N + 1);
    for(size_t i = 1; i <= N; i += 2)for(size_t j = i; j <= N; j += 2 * i)++f[j];
    cout << count(f.cbegin(), f.cend(), 8) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=5e5+10; 
long long f[N];
int ll[N],rr[N],lo[N],hi[N];
char s[N];
int main()
{
	int l,i;
	long long ans=0;
	scanf("%s",s+1);
	l=strlen(s+1);
	for(i=1;i<=l;i++)
		f[i]=f[i-1]+i;
	l++;
	for(i=1;i<=l;i++)
	{
		if((i==1&&s[i]=='<')||(s[i]=='<'&&s[i-1]=='>')||(i==l&&s[i-1]=='>'))
			lo[i]=1;
		if((i==1&&s[i]=='>')||(s[i]=='>'&&s[i-1]=='<')||(i==l&&s[i-1]=='<'))
			hi[i]=1;
	} 
	ll[0]=0;
	rr[l+1]=l+1;
	for(i=1;i<=l;i++)
	{
		if(lo[i]==1)
			ll[i]=i;
		else
			ll[i]=ll[i-1];
	}
	for(i=l;i>0;i--)
	{
		if(lo[i]==1)
			rr[i]=i;
		else
			rr[i]=rr[i+1];
	}
	/*for(i=1;i<=l;i++)
		printf("%d ",hi[i]);
	printf("\n");
	for(i=1;i<=l;i++)
		printf("%d ",lo[i]);
	printf("\n");
	for(i=1;i<=l;i++)
		printf("%d ",ll[i]);
	printf("\n");
	for(i=1;i<=l;i++)
		printf("%d ",rr[i]);
	printf("\n");*/
	for(i=1;i<=l;i++)
	{
		if(hi[i]==1)
		{
			ans+=f[max(i-ll[i],rr[i]-i)];
			ans+=f[min(i-ll[i],rr[i]-i)-1];
		}
	}
	printf("%lld",ans);
	return 0;
 } 

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
   int n;
   cin>>n;
   string a;
   cin>>a;
   int ans=0;
   int shit=0;
   rep(i,a.size()){
       if(a[i]=='D')ans--;
       else ans++;
       shit=max(ans,shit);
   }
   cout<<shit<<endl;
   return 0;
}

Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	c := sc.nextStr()

	switch c {
	case "a", "e", "i", "o", "u":
		fmt.Fprintln(wtr, "vowel")
	default:
		fmt.Fprintln(wtr, "consonant")
	}
	wtr.Flush()
}


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

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> cnt(n);
  rep(i,n) cnt[a[i]]++;
  ll tot = 0;
  rep(i,n) {
    tot += choose2(cnt[i]);
  }
  rep(i,n) {
    ll ans = tot;
    ans -= choose2(cnt[a[i]]);
    ans += choose2(cnt[a[i]]-1);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4096