akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
int a,b;
string ans;
int le = 0;

void dfs(int x,int y){
	if(x==a&&y==b){
		cout<<ans.substr(0,le)<<endl;
		return;
	}
	if(x==5&&y==4){
		if(a==6){
			ans[le++]='A';
			dfs(a,b);
			le--;
		}
		if(b==5){
			ans[le++]='B';
			dfs(a,b);
			le--;			
		}
	}
	else if(x==4&&y==5){
		if(b==6){
			ans[le++]='B';
			dfs(a,b);
			le--;
		}
		if(a==5){
			ans[le++]='A';
			dfs(a,b);
			le--;			
		}
	}
	else if(max(x,y)==5) return;
	else{
		if(x!=a){
			ans[le++]='A';
			dfs(x+1,y);
			le--;
		}
		if(y!=b){
			ans[le++]='B';
			dfs(x,y+1);
			le--;
		}
	}
}


void mainmain(){
	cin>>a>>b;
	ans=string(a+b,'0');
	dfs(0,0);	
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

typedef long long ll;

int main() {
  int N, T;
  cin >> N >> T;
  int t[N];
  int _time = 0; // お湯が出るのが被っている時間の総和
  cin >> t[0];
  for (int i = 1; i < N; i++) {
    cin >> t[i];
    if (t[i-1] + T > t[i]) {
      _time += t[i-1] + T - t[i];
    }
  }

  // 解答
  cout << N * T - _time << endl;
  return 0;
}


Measured memory_bytes: 1024
/*

  ______      _                _____ 
  |  ____/\   | |        /\    / ____|
  | |__ /  \  | |       /  \  | (___  
  |  __/ /\ \ | |      / /\ \  \___ \
  | | / ____ \| |____ / ____ \ ____) |
  |_|/_/    \_\______/_/    \_\_____/ 
                                            
                                            

*/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define INF 1000000
#define MOD 1000000007

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef pair<ii, ll> iii;
typedef vector<ii> vii;

#define F first
#define S second

#define mp make_pair
#define endl '\n'
#define priority_queue pq

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for(int i=1;i<n-1;i++){
        if(a[i]>a[i-1] && a[i]<a[i+1] || a[i]<a[i-1] && a[i]>a[i+1]) ans++;
    }
    cout<<ans<<endl;

}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    if b[i] >= a[i]:
        ans += a[i]
        temp = b[i] - a[i]
        if temp >= a[i+1]:
            ans += a[i+1]
            a[i+1] = 0
        else:
            ans += temp
            a[i+1] -= temp
    else:
        ans += b[i]

print(ans)

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

#define ll long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (ll)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 200005
ll a[mxn],tree[4*mxn],dp[mxn];
int h[mxn];

void update(int i,int l,int r,int x,ll y){
if(l==r){
    tree[i]=max(tree[i],y);
    return;
}
int m=(l+r)>>1;
if(x<=m)update(i+i,l,m,x,y);
else update(i+i+1,m+1,r,x,y);
tree[i]=max(tree[i+i],tree[i+i+1]);
}

ll query(int i,int l,int r,int x,int y){
if(l>r||x>r||l>y||x>y)return 0;
if(l>=x&&r<=y)return tree[i];
int m=(l+r)>>1;
return max(query(i+i,l,m,x,y),query(i+i+1,m+1,r,x,y));
}

int main(){
sp;
int n;
cin>>n;
ll ans=0;
for(int i=1; i<=n; ++i)cin>>h[i];
for(int i=1; i<=n; ++i)cin>>a[i];
for(int i=1; i<=n; ++i){
    ll x=query(1,1,n,1,h[i]);
    dp[i]=x+a[i];
    ans=max(ans,dp[i]);
    update(1,1,n,h[i],dp[i]);
}
cout<<ans;

return 0;}


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

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

  int count = 0;
  if (s.at(a) == '-') {
    count ++;
  }
  for (int i = 0; i <= a + b; i ++) {
    if (i == a) {
      continue;
    }
    if (s.at(i) == '-') {
      count --;
      break;
    }
  }

  if (count == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
print(len([1 for B in range(b+1) for C in range(c+1) if (x-(100*B)-(50*C))%500==0 and (x-(100*B)-(50*C))>=0 and (x-(100*B)-(50*C))<=500*a]))

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

const int64_t mod = 998244353;
int64_t fact[400034]; // facts, no cap

int64_t add_mod (int64_t a, int64_t b) {
    return (a + b) % mod;
}

int64_t sub_mod (int64_t a, int64_t b) {
    return (a + mod - b) % mod;
}

int64_t mul_mod (int64_t a, int64_t b) {
    return (a * b) % mod;
}

int64_t pow_mod (int64_t a, int64_t b) {
    int64_t res = 1, t = a;
    while (b) {
        if (b & 1)
            res = mul_mod(res, t);
        t = mul_mod(t, t);
        b >>= 1;
    }
    return res;
}

int64_t div_mod (int64_t a, int64_t b) {
    return mul_mod(a, pow_mod(b, mod - 2));
}

int64_t ncr_mod (int64_t n, int64_t r) {
    if (r > n)
        return int64_t(0);
    return div_mod(fact[n], mul_mod(fact[r], fact[n - r]));
}

void precalc () {
    fact[0] = 1;
    for (int64_t i = 1; i < 400034; ++i)
        fact[i] = mul_mod(fact[i - 1], i);
}

signed main () {
    precalc();
    
    int64_t n, m, k;
    cin >> n >> m >> k;
    int64_t ans = 0; 
    for (int64_t cur_k = 0; cur_k <= k; ++cur_k) {
        int64_t segs  = n - cur_k; // amount of segments;
        int64_t cur_ans = mul_mod(ncr_mod(n - 1, segs - 1), mul_mod(m, pow_mod(m - 1, segs - 1)));
        ans = add_mod(ans, cur_ans);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 6764
package main

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

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

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	N := nextInt()
	K := nextInt()
	Q := nextInt()
	P := make([]int, N)
	for i := 0; i < Q; i++ {
		P[nextInt()-1]++
	}
	for i := 0; i < N; i++ {
		if K-Q+P[i] > 0 {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "No")
		}
	}
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	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
}

// Genericsがないので筋肉で...
// interfaceでの取扱がようわからんし
func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// mapからkeysとvaluesを返す感じのやつ
// なんかしらんけどmap[interface{}]interface{}しか受け付けない。なんのためのinterface{}やねん
// なので呼ぶときのmapはmap[int]stringとかじゃダメ
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
	return
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int now=0;
    vector<int>a;
    while(now<n){
        for(int i=m;i>0;--i){
            if(now+i>n)continue;
            if(s[now+i]=='0'){
                a.push_back(i);
                now+=i;
                break;
            }
            if(i==1){
                cout<<-1<<endl;
                return 0;
            }
        }
    }
    reverse(a.begin(),a.end());
    for(auto x:a){
        cout<<x<<" ";
    }
}

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

int main(){
  int k,s,cnt=0;
  cin >> k >> s;
  for(int i=0;i<=k;++i){
  	for(int j=0;j<=k;++j){
  		if(s-i-j>=0&&s-i-j<=k)cnt++;
  	}
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline())
K = list(map(int, sys.stdin.readline().split()))


def solve(k):
    ret = 0
    d = 0
    m = 0
    dm = 0
    l = 0
    r = 0
    while r < N:
        if k <= r:
            if S[l] == 'D':
                d -= 1
                dm -= m
            if S[l] == 'M':
                m -= 1
            l += 1

        if S[r] == 'D':
            d += 1
        if S[r] == 'M':
            m += 1
            dm += d
        if S[r] == 'C':
            ret += dm
        r += 1
    return ret


for k in K:
    ans = solve(k)
    print(ans)


Measured memory_bytes: 61352
<?php

while (($line = trim(fgets(STDIN))) !== '0') {
    $n = (int)$line;
    $arr = array_fill(0, $n + 1, array_fill(0, $n + 1, 0));
    for ($i = 0; $i < $n; $i++) {
        $line = trim(fgets(STDIN));
        foreach (explode(' ', $line) as $j => $m) {
            $m = (int)$m;
            $arr[$i][$j] = $m;
            $arr[$i][$n] += $m;
            $arr[$n][$j] += $m;
        }
    }
    $arr[$n][$n] = array_sum($arr[$n]);

    for ($i = 0; $i <= $n; $i++) {
        for ($j = 0; $j <= $n; $j++) {
            printf('%5d', $arr[$i][$j]);
        }
        echo PHP_EOL;
    }
}

Measured memory_bytes: 6648
# -*- coding: utf-8 -*-
"""
Created on Tue Sep  8 02:46:31 2020

@author: liang
"""

N = int(input())
P = [int(x) for x in input().split()]

low = P[0]
count = 0

for p in P:
    if low >= p:
        low = p
        count += 1
print(count)

Measured memory_bytes: 30940
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i,a,b) for(int i=a;i<=b;i++)
int n,m;
string s;
LL k;
int main()
{
	cin>>s>>k;
	int sz=s.size();
	rep(i,0,sz-1)
	{
		if(s[i]!='1')
		{
			if(i<k)cout<<s[i];
			else cout<<1;
			return 0;

		}
	}
	cout<<1;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// 入力
int N;
long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];
    
    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK
    
    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }
    
    // 答え
    long long res = 0;
    for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
    cout << res << endl;
}

Measured memory_bytes: 4992
n = int(input())

card = []

for i in range(n):
    card.append(list(map(str, input().split())))
    
ans = []

for i in range(1, 14):
    if not ['S', str(i)] in card:
        ans.append(['S', str(i)])
        
for i in range(1, 14):
    if not ['H', str(i)] in card:
        ans.append(['H', str(i)])
        
for i in range(1, 14):
    if not ['C', str(i)] in card:
        ans.append(['C', str(i)])
        
for i in range(1, 14):
    if not ['D', str(i)] in card:
        ans.append(['D', str(i)])
for i in range(len(ans)):
    print(ans[i][0] + ' ' + ans[i][1])


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;



int main(){	
	long long M;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<long long> a(M-1+1);
	map<long long, long long> m;
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&a[i]);
		m[a[i]]++;
	}
	long long res[N+1];
	rep(i,N+1) res[i] = 0;
	res[0] = 1;
	repn(i,N) {
		if (m[i] != 0) {
			res[i] = 0;
			continue;
		}
		res[i] = (res[i]+res[i-1])%mod;
		if (i-2 >= 0) res[i] = (res[i]+res[i-2])%mod;
		// cout << res[i] << endl;
	}
	cout << res[N] << endl;
	return 0;
}



Measured memory_bytes: 8064
n = gets.to_i
as = gets.split.map(&:to_i).sort!

nums = Hash.new(0)
ans = Array.new(as.last + 1, 0)
res = 0

as.each do |a|
  nums[a] += 1
  ans[a] = 1
end

as.each do |a|
  next if ans[a] == 0

  res += 1 if nums[a] == 1

  a.step(as.last, a) do |i|
    ans[i] = 0
  end
end

puts res


Measured memory_bytes: 44848
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

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

    int N, M;
    cin >> N >> M;
    vector<LL> a(N+1, 0);
    REP(i, N){
        cin >> a[i+1];
        a[i+1] += a[i];
    }
    REP(i, N+1) a[i] %= M;

    sort(all(a));
    LL now = 0, ct = 0;
    LL ans = 0;
    REP(i, N+1){
        if(i == N || now != a[i]){
            if(i == N && now == a[i]) ct++;
            now = a[i];
            ans += ct*(ct-1)/2;
            ct = 1;
        }else{
            ct++;
        }
    }
    cout << ans << endl;

    
    return 0;
}


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n;
ll a[200000];
ll rui[200003] = {0};

ll calc(int r,int l){//[l,r]の総和
  return rui[r] - rui[l-1];
}

int main(){
  cin >> n;
  ll ans = LLONG_MAX;
  REP(i,n){
    cin >> a[i];
    rui[i+1] = rui[i] + a[i];
  }
  int l = 1;
  int r = 3;
  ll p,q,w,s;
  p = calc(l,1);
  q = calc(2,l+1);
  s = calc(r,3);
  w = calc(n,r+1);
  ll ma = max(p,max(q,max(s,w)));
  ll mi = min(p,min(q,min(s,w)));
  ans = min(ans,abs(ma-mi));
  FOR(i,2,n-1){
    r = max(r,(int)i+1);
    p = calc(l,1);
    q = calc(i,l+1);
    s = calc(r,i+1);
    w = calc(n,r+1);
    while(l<i){
      if(abs(p-q)<abs(calc(l+1,1)-calc(i,l+2))) break;
      l++;
      p = calc(l,1);
      q = calc(i,l+1);
    }
    while(r<n){
      if(abs(s-w)<abs(calc(r+1,i+1)-calc(n,r+2))) break;
      r++;
      s = calc(r,i+1);
      w = calc(n,r+1);
    }
    ma = max(p,max(q,max(s,w)));
    mi = min(p,min(q,min(s,w)));
    ans = min(ans,abs(ma-mi));
  }
  cout << ans <<endl;
}


Measured memory_bytes: 3328
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_D
#include <iostream>
#include <string>
#include <cstdio>
#include <deque>
using namespace std;

void change(const string &input, const unsigned int &dif, string &output){
    if(dif >= input.size()){
        // cerr << "invalid input" << endl;
    }
    int size = input.size();
    string mae = input.substr(dif, size-dif);
    string ato = input.substr(0, dif);
    output = mae+ato;
}

void match(string &s, const string &p){
    for(int i=0; i<s.size(); i++){
        string output;
        change(s, i, output);
        int loc = output.find(p, 0);
        if(loc != string::npos){
            cout << "Yes"<< endl;
            return;
        }
    }
    cout << "No" << endl;
    return;
}



int main(){
  string s,p;
  cin >> s >> p;
  match(s,p);
  return 0;
}

Measured memory_bytes: 3228
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String[] O = sc.nextLine().split("");
    String[] E = sc.nextLine().split("");
    String[] result=new String[O.length+E.length];
    
    int i_o=0;
    int i_e=0;
    for(int i=1; i<=O.length + E.length; i++){
      if(i%2!=0){
        System.out.print(O[i_o]);
        i_o++;
      }else{
        System.out.print(E[i_e]);
        i_e++;
      }
    }
  }
}

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

int main() {
	string s;
	cin >> s;
	int res = 0, cur_open = 0;
	for (char c : s) {
		if (c == 'S') {
			cur_open++;
		} else {
			if (cur_open > 0) {
				cur_open--;
			} else {
				res++;
			}
		}
	}
	res += cur_open;
	cout << res << endl;
	return 0;
}


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

int main()
{
  int N; cin >> N;
  vector<int> P(N);
  rep(i, N) {
    cin >> P[i];
  }

  int cnt = 0;
  int min = 999999999;

  rep(i, N) {
    if (P[i] < min) {
      cnt++;
      min = P[i];
    }
  }

    cout << cnt << endl;
}

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

long long a, b, c, d, ans = 0, i, G;
long long gcd(long long x, long long y){
	if (x < y) return gcd(y, x);
	long long r;
	while ((r = x % y)){
		x = y;
		y = r;
	}
	return y;
}	
int main(){
	cin >> a >> b >> c >> d;
	if (c == 1 || d == 1){
		cout << 0 << endl;
		return 0;
	}
	ans = (b - a + 1);
	G = gcd(c, d);
	//cout << ans << endl;
	long long l = c * d / G;
	ans -= ((b / c) - ((a - 1) / c));
	//cout << ans << endl;
	ans -= ((b / d) - ((a - 1) / d));
	//cout << ans << endl;
	ans += ((b / l) - ((a - 1) / l));
	cout << ans << endl;
	return 0;
}


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

int main() {
  int n,m,i,max;
  cin >> n >> m;
  for(i=m/n; i>0; i--){
    if((m-i*(n-1))%i==0){
      max=i; break;
    }
  }
  cout << max;
}

Measured memory_bytes: 256
a=int(input())
moji=input()
r=set()
g=set()
b=set()
for i in range(a):
    if moji[i]=="R":
        r.add(i)
    elif moji[i]=="G":
        g.add(i)
    else:
        b.add(i)
res=len(r)*len(g)*len(b)
if len(r)==0 or len(g)==0 or len(b)==0:
    print(0)
else:
    min_len={0:r,1:g,2:b}
    a1=[]
    for i in range(3):
        a1.append(min_len[i])
    for i in a1[0]:
      for j in a1[1]:
        if -abs(i-j)+min(i,j) in a1[2]:
          res-=1
        if abs(i-j)+max(i,j) in a1[2]:
          res-=1
        if abs(i-j)%2==0 and  int(abs(i-j)/2)+min(i,j) in a1[2]:
          res-=1
    print(res)
                
    


Measured memory_bytes: 69228
#include "stdio.h"

int main(){
	int R;
	scanf("%d", &R);
	
	if(R<1200){
		printf("ABC\n");
	}
	else if(R<2800){
		printf("ARC\n");
	}
	else{
		printf("AGC\n");
	}
	return (0);
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x >= y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x <= y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  string s;
  cin >> s;
  int ans = 0;
  rep(i, s.size()) if (s[i] == '1') ans++;
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    if(k % 2 == 1) {
        if(k > n) puts("0"); else
        printf("%lld\n", (long long) (n / k) * (n / k) * (n / k));
        return 0;
    }
    if(k / 2 > n) {
        puts("0");
        return 0;
    }
    long long s = n / (k / 2), b = s / 2, a = s - b;
    printf("%lld\n", a * a * a + b * b * b);
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; ++i){
        cin >> A[i];
    }
    int cnt = -1;
    bool flag = false;
    do {
        ++cnt;
        for (int i = 0; i < N; ++i){
            if (A[i] % 2 == 1) {
                flag = true;
            }
            A[i] /= 2;
        }
    } while (! flag);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
using namespace std;
int main(){
	int a[2][100];
	int n;
	int total=0;
	int max = 0;
	cin >> n;
	for (int i = 0;i < 2;i ++) {
		for (int j = 0;j < n;j++)
			cin >> a[i][j];
	}
	for (int c = 0;c < n;c++) {
		for (int i = 0;i <= c;i++) total += a[0][i];
		for (int j = c;j < n;j++) total += a[1][j];
		if (max < total) max = total;
		total = 0;
	}
	cout << max;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt(),k=sc.nextInt();
		
		if((a+k-1)<(b-k+1)){
			for(int i=a;i<(a+k);i++){
				System.out.println(i);
			}
			for(int i=(b-k+1);i<=b;i++){
				System.out.println(i);
			}
		}else{
			for(int i=a;i<=b;i++){
				System.out.println(i);
			}
		}
	}
}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,b;
ll tail[100000+10];
bool pan(ll x)
{
    ll sum=0;
    for(ll i = 1;i<=n;++i)
    {
        ll t = tail[i] - x*b;
        if(t>0)
        {
            sum += (ll)ceil(t*1.0/(a-b));
            if(sum>x)
                return false;
        }
    }
    return true;
}
int main()
{
    ll imax=0;
    scanf("%lld%lld%lld",&n,&a,&b);
    for(ll i =1;i<=n;++i)
    {
        scanf("%lld",&tail[i]);
        imax=max(imax,tail[i]);
    }
    ll l = 0,r = imax,mid;
    while(l<r)
    {
        mid = l+r>>1;
        if(pan(mid))
            r = mid;
        else
            l = mid+1;
    }
    cout<<r<<'\n';
}


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

int gcd(int u, int v)
{
  int r, z;

  if(v > u)
  {
    z = u;
    u = v;
    v = z;
  }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b;

  while(scanf("%d %d", &a, &b) != EOF)
  {      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  return 0;
}



Measured memory_bytes: 3124
#include<iostream>
using namespace std;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
int main(){

  int n, y;
  cin >> n >> y;
  int sum=0, xc=-1, yc=-1, zc=-1;
  for(int j=0; j<=n; j++){
    for(int k=0; j+k<=n; k++){
      int l = n - j - k;
        sum = 10000*j + 5000*k + 1000*l;
      if(sum == y){
        xc = j;
        yc = k;
        zc = l;
      }
    }
  }
  cout << xc << " " << yc << " " << zc;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    vector<int> v(n), c(n);
    rep(i, n) cin >> v[i];
    rep(i, n) cin >> c[i];
    int ans = 0;
    rep(i, n) {
        if (v[i] > c[i]) ans += v[i]-c[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            int K = sc.nextInt();
            Set<Integer> set1 = new HashSet<>();
            for(int i = 0; i < K; i++){
             int a = sc.nextInt();
              for(int j = 0; j < a;j++){
                set1.add(sc.nextInt());
              }
            }
            System.out.println(N-set1.size());
          }
}

Measured memory_bytes: 46248
#include <iostream>
using namespace std;
#define MAX 100000

int parent(int i) { return i/2; }
int left(int i) { return i*2; }
int right(int i) { return i*2+1; }

int main() {
    int H, i, A[MAX+1];
    
    cin >> H;
    for(i=1; i<=H; i++) cin >> A[i];
    
    for(i=1; i<=H; i++) {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if(parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
        if(left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
        if(right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }
    
    return 0;
}


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

using namespace std;

int main()
{
    unsigned long long n,s=0,i,j,ok=0;
    cin>>n;
    for(long long  d=2;d*d<=n;d++)
    {
        if(n%d==0)
        {
            ok=1;
            i=d;
        }
    }
    j=n/i;
    s=i+j-2;
    if(ok==0)
        cout<<n-1;
    else
        cout<<s;
    return 0;
}


Measured memory_bytes: 384
n, t = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
ans = []

for i in range(n):
    if l[i][1] <= t:
        ans.append(l[i][0])
if ans:
    print(min(ans))
else:
    print("TLE")

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

//階乗
ll factorial(ll num){ll sum = 1; for(ll i=1;i<=num;i++) sum*=i; return sum;}
//素数判定
bool isPrime(ll num){if(num<2){return false;}else if(num==2){return true;}else if(num%2==0){return false;} double sqrtNum=sqrt(num);for(int i=3;i<=sqrtNum;i+=2){if(num%i==0)return false;}return true;}

int main(){
  ll n;
  cin >> n;
  
  int ans = 0;
  bool flag = false;
  rep(i,n+1000){
    int tmp = i * 1.08;
    if(tmp==n){
      ans = i;
      flag = true;
    }
    if(flag) break;
  }
  if(flag)  cout << ans << endl;
  if(!flag) cout << ":(" << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
#define MAX 1000005
#define MOD (ll)(1e9+7)
#define INF INT32_MAX
#define INFL INT64_MAX
using namespace std;

void solve()	{
	string s;
	cin >> s;
	int n = s.size();
	ll a[n+1];
	memset(a,-1,sizeof(a));
	for(int i=0; i<n; i++)	{
		if(i==0 && s[i]=='<')	a[i]=0;
		else {
			if(s[i]=='<' && s[i-1]=='>')	a[i]=0;
			if(s[i]=='<' && s[i-1]=='<')	a[i]=a[i-1]+1;
		}
	}
	if(s[n-1]=='<')	a[n]=a[n-1]+1;
	else a[n]=0;
	for(int i=n-1; i>=0; i--)	{
		if(i-1 >=0 && s[i]=='>' && s[i-1]=='<')	a[i]=max(a[i-1],a[i+1])+1;
		else if(s[i]=='>') a[i]=a[i+1]+1;
	}
	ll ans=0;
	for(int i=0; i<=n; i++)	ans+=a[i];
	cout << ans << endl;
}

int main()	
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin >> t;
	for(int i=1; i<=t; i++)	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 7708
#include<stdio.h>
#include<string.h>
int main()
{
	char s[99],*p;
	while(fgets(s,99,stdin)) {
		while(!strstr(s,"the") && !strstr(s,"this") && !strstr(s,"that")) {
			for(p=s; *p; p++) {
				if(*p>='a' && *p<='y')
					++*p;
				else if(*p=='z')
					*p='a';
			}
		}
		printf("%s",s);
	}
	return 0;
}

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

int main() {
  int n,k;cin>>n>>k;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  rep(i,n-k){
    if(a[i]<a[i+k])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

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

class suffix_array {
	const int n;
	string S;
	vector<int> sa, rank;
public:
	suffix_array(const string &S_) : n(S_.size()), S(S_), sa(n + 1), rank(n + 1) {
		for (int i = 0; i <= n; i++) {
			sa[i] = i;
			rank[i] = i < n ? S[i] : -1;
		}
		vector<int> tmp(n + 1);
		for (int k = 1; k <= n; k *= 2) {
			auto Compare_SA = [&](int i, int j) {
				if (rank[i] != rank[j]) return rank[i] < rank[j];
				int ri = i + k <= n ? rank[i + k] : -1;
				int rj = j + k <= n ? rank[j + k] : -1;
				return ri < rj;
			};
			sort(sa.begin(), sa.end(), Compare_SA);
			tmp[sa[0]] = 0;
			for (int i = 1; i <= n; i++)
				tmp[sa[i]] = tmp[sa[i - 1]] + (Compare_SA(sa[i - 1], sa[i]) ? 1 : 0);
			for (int i = 0; i <= n; i++)
				rank[i] = tmp[i];
		}
	}
	bool is_contain(const string &T) {
		int lb = 0, ub = n;
		while (ub - lb > 1) {
			int m = (lb + ub) / 2;
			if (S.compare(sa[m], T.length(), T) < 0) lb = m;
			else ub = m;
		}
		return S.compare(sa[ub], T.length(), T) == 0;
	}
	vector<int> get_lcp() {
		for (int i = 0; i <= n; i++) rank[sa[i]] = i;
		int h = 0;
		vector<int> lcp(n + 1);
		for (int i = 0; i < n; i++) {
			int j = sa[rank[i] - 1];

			if (h > 0) h--;
			for (; j + h < n && i + h < n; h++) {
				if (S[j + h] != S[i + h]) break;
			}
			lcp[rank[i] - 1] = h;
		}
		return lcp;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int Q;
	string T;
	cin >> T;
	suffix_array sa(T);
	cin >> Q;
	while (Q--) {
		string P;
		cin >> P;
		printf("%d\n", (int)sa.is_contain(P));
	}
	return 0;
}



Measured memory_bytes: 16600
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
#define fst first
#define snd second
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}
inline int Log2(ll x) {int k; for(k=0; x>0; ++k) x>>=1; return k;} // number of binary digits
template<typename T> inline int count_between(vector<T>& a, T l, T r) {
  return lower_bound(all(a), r) - lower_bound(all(a), l); // [l, r)
}


int main() {
  ll N, K; cin >> N >> K;
  Vll a(N);
  rep(i, N) cin >> a[i];
  sort(all(a));
  
  int need = count_between(a, K, INFll);
  a.erase(a.end()-need, a.end());
  int M = N - need;

  VV dp(M+1, V(2*K));
  dp[0][0] = 1;

  rep(i, M) rep(k, 2*K) {
    dp[i+1][k] += dp[i][k];
    if (k+a[i] < 2*K) dp[i+1][k+a[i]] += dp[i][k];
  }

  rep(i, M) {
    V dp2 = dp[M];
    rep(k, K-a[i]) dp2[k+a[i]] -= dp2[k];
    bool isneed = false;
    rep(k, a[i]) if (dp2[K-a[i]+k]) isneed = true;
    if (isneed) ++need;
  }

  int ans = N - need;
  cout << ans << endl;
  return 0;
}


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

int main()
{
    int N;
    int sum = 0;
    int temp;
    string str;


    cin >> str;

    if (str[1] == 'B') {
        printf("ARC");
    }
    else {
        printf("ABC");
    }

    return 0;
}

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

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static BigInteger MOD = BigInteger.valueOf((long) 1e9 + 7);

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int a = in.nextInt();

        out.println(3 * a * a);
    }

}


Measured memory_bytes: 23380
(let* ((n (read))
       (k (read))
       (h (sort (loop :for i :from 1 :to n :collect (read)) #'<)))
  (if (>= k n)
      (format t "0~%")
      (format t "~A~%" (loop :for i :from 0 :to (1- (- n k))
                             :for p :in h
                             :sum p))))


Measured memory_bytes: 80128
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    map <ll, string> mp;
    mp[0] = mp[1] = mp[6] = mp[8] = "pon";
    mp[2] = mp[4] = mp[5] = mp[7] = mp[9] = "hon";
    mp[3] = "bon";
    cout << mp[ll(n%10)] << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>

#define for0(i, N)    for (long long i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (long long i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (long long i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (long long i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (long long i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (long long i = (x), a = 0; a < (N);    \
                              i = (i + 1) % (N), ++a)
#define int long long

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


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

    int k;
    cin >> k;

    int a[] = {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};

    cout << a[k-1];

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
using P = pair<double,int>;
const ll MOD = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

double distance(double x1,double y1,double x2,double y2){
    double ret;
    ret = sqrt( pow((x1-x2),2) + pow( (y1-y2),2 ));
    return ret;
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    double sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int N;
    cin >> N;
    vector<double> x(N+2),y(N+2),r(N+2);
    x[0] = sx;
    y[0] = sy;
    r[0] = 0;
    x[N+1] = tx;
    y[N+1] = ty;
    r[N+1] = 0;
    rep(i,N){
        cin >> x[i+1] >> y[i+1] >> r[i+1];
    }
    vector<vector<double>> d(N+2,vector<double>(N+2,INF));
    rep(i,N+2)rep(j,N+2){
        if(i==j){
            d[i][j] = 0;
            d[j][i] = 0;
        }else{
            double dis = 0 ;
            dis = max((double)0,distance(x[i],y[i],x[j],y[j]) - (r[i]+r[j]));
            d[i][j] = min(d[i][j],dis);
            d[j][i] = d[i][j];
        }
    }
    //rep(k,N+2)rep(i,N+2)rep(j,N+2)d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
    vector<double> dis(N+2,1e16);
    dis[0] = 0;
    priority_queue<P, vector<P>, greater<P> > q;
    q.push({0,0});
    while(!q.empty()){
        P now = q.top();q.pop();
        int nv = now.second;
        int nc = now.first;
        for(int i=0;i<N+2;i++){
            if(dis[i] > dis[nv] + d[nv][i]){
                dis[i] = dis[nv] + d[nv][i];
                q.push({dis[i],i});
            }
        }
    }
    cout << dis[N+1] << endl;
    // 0 から N + 1 にいくまでの最短経路を出す
}

Measured memory_bytes: 14068
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repA(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x)for(auto &a: x)
#define fll(a) memset(a,0,sizeof(a));
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define itr(it,x) for(auto it=x.begin();it!=x.end();it++)
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
typedef vector<int>vi;
typedef map<int,int>ma;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
void fopen()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);   
} 
void solve()
{
  int n;
  cin>>n;
  int a[n];
  fll(a);
  rep(i,n-1)
  {
    int p;
    cin>>p;
    a[p-1]+=1;
  }
  rep(i,n)
  {
    cout<<a[i]<<endl;
  }

}
int main()
{
  fastio;
  //fopen();
  //int t;
//  cin>>t;
  rep(i,1)
  { 
   // cout<<"Case #"<<i+1<<": ";
    solve();
   // cout<<endl;
  }
  
}

Measured memory_bytes: 4440
def dfs(k):
    if k==1:
        return 0
    elif k==2:
        return 1
    for i in range(2,int(k**0.5+1)):
        if k%i==0:
            return 0
    return 1
while True:
    n=int(input())
    if n==0:break
    ans=0
    for j in range(n+1,2*n+1):
        ans+=dfs(j)
    print(ans)



Measured memory_bytes: 5696
using System;

namespace A___F
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var a = int.Parse (input[0]);
            var b = int.Parse (input[1]);
            if (a + b == 15)
                Console.WriteLine ("+");

            else if (a * b == 15)
                Console.WriteLine ("*");

            else
                Console.WriteLine ("x");
        }
    }
}

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

int main(void){
  using namespace std;
  string s;
  
  cin >> s;
  const char* cs = s.c_str();
  if (cs[s.length()-1]=='s') cout << s << "es" <<endl;
  else cout << s << "s" << endl;
}
  

Measured memory_bytes: 3604
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        Map<String, Integer> next = new HashMap<>();
        next.put("SUN", 7);
        next.put("MON", 6);
        next.put("TUE", 5);
        next.put("WED", 4);
        next.put("THU", 3);
        next.put("FRI", 2);
        next.put("SAT", 1);
        
        String current = scanner.next();
        System.out.println(next.get(current));
    }
}


Measured memory_bytes: 35300
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll XOR(ll a, ll b);

int main()
{
    
    ll A,B;
    cin >> A >> B;
    
    int res = (B - A) % 4;
    
    if(A == B)
    {
        cout << A << endl;
    }
    else if(A % 2 == 0)
    {
        switch (res) {
            case 0:
                cout << B << endl;
                break;
            case 1:
                cout << 1 << endl;
                break;
            case 2:
                cout << B + 1 << endl;
                break;
            case 3:
                cout << 0 << endl;
                break;
            default:
                break;
        }
    }
    else if(A % 2 == 1)
    {
        switch (res) {
            case 0:
                cout << A << endl;
                break;
            case 1:
                cout << XOR(A,B) << endl;
                break;
            case 2:
                cout << A - 1 << endl;
                break;
            case 3:
                cout << XOR(A,B) - 1 << endl;
                break;
            default:
                break;
        }
    }
    
    return 0;
}

ll XOR(ll a, ll b)
{
    ll ans=0;
    ll mod;
    ll x=0,y=0;
    for(int i = 0 ; i <= max(log2(a) + 1 , log2(b)) ; i++)
    {
        x=0;
        y=0;
        mod = pow(2, i + 1);
        if(a % mod != 0)
        {
            x = 1;
            a -= mod/2;
        }
        if(b % mod != 0)
        {
            y = 1;
            b -= mod/2;
        }
        ans += (mod / 2) * ( (x | y) - (x & y) );
    }
    return ans;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramE
    {
        static void Main()
        {
            int n = NextInt, k = NextInt;
            int comb = (n - 1) * (n - 2) / 2;

            if (comb < k)
            {
                System.Console.WriteLine(-1);
                return;
            }

            System.Console.WriteLine(n - 1 + (comb - k));
            System.Console.WriteLine(string.Join("\n", Enumerable.Range(2, n - 1).Select(i => $"1 {i}")));
            int left = 2, right = 3, count = 0;
            while(count < comb - k)
            {
                System.Console.WriteLine($"{left} {right}");
                right++;
                count++;
                if (right > n)
                {
                    left++;
                    right = left + 1;
                }
            }
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n; cin >> n;
    switch(n % 10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
        cout << "hon" << endl;
        break;

        case 0:
        case 1:
        case 6:
        case 8:
        cout << "pon" << endl;
        break;

        case 3:
        cout << "bon" << endl;
        break;
    }
    return 0;
}

Measured memory_bytes: 3628