akhauriyash/Code-Regression huggingface dataset:
// 2020年卒見込みでiOSエンジニアを目指して就職活動中！Twitter@KonoLv1　

//  内容
/*
    円の半径 r が入力されるので円に内接する正十二角形の面積を求め結果を出力する
    注：円の半径 r に内接する正十二角形の面積は 3 * r^2 である。
*/

//  入力処理
let r = Int(readLine()!)!

//  計算・出力処理
print( 3 * ( r * r ))

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

const int MAX = 10005;

int row, col;
int cnt;

void disp(bool map[][MAX])
{
    for(int i=0; i<row; ++i)
    {
        for(int j=0; j<col; ++j)
            cout<<map[i][j];
        cout<<endl;
    }
    cout<<endl;
}

int calu(bool map[][MAX])
{
    //disp(map);
    int sum=0;
    int tmp;
    for(int i=0; i<col; ++i)
    {
        tmp=0;
        for(int j=0; j<row; ++j)
            tmp+=map[j][i];
        tmp = tmp > row-tmp ? tmp : row-tmp;
        sum += tmp;
    }
    cnt = cnt > sum ? cnt : sum;
}

void dfs(bool map[][MAX], int num)
{
    if(num == row) return ;
    bool tmp[12][MAX];
    for(int i=0; i<row; ++i)
        for(int j=0; j<col; ++j)
            tmp[i][j] = map[i][j];

    calu(tmp);
    dfs(tmp, num+1);

    for(int i=0; i<col; ++i)
        tmp[num][i] = !tmp[num][i];

    calu(tmp);
    dfs(tmp, num+1);
}

int main()
{
    bool map[12][MAX];
    while(cin>>row>>col && row)
    {
        for(int i=0; i<row; ++i)
            for(int j=0; j<col; ++j)
                cin>>map[i][j];
        //cnt = sum();
        cnt = 0;
        dfs(map,0);
        cout<<cnt<<endl;
    }
    return 0;
}

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

int main() {

  int n, i, b, f, r, v, count=0;
  int house[5][4][11] = {};

  cin >> n;

  for(i = 0; i < n; i++){
    cin >> b >> f >> r >> v;
    house[b][f][r] += v;
  }

  
  for(b = 1; b <= 4; b++){
    for(f = 1; f <= 3; f++){
      for(r = 1; r <= 10; r++){
	cout << " " << house[b][f][r];
      }
      cout << endl;
    }
    if(count < 3) cout << "####################" << endl;
    count++;
  }

  return 0;
  
}

Measured memory_bytes: 1160
def probB():
    S = input()
    T = input()

    if T in S:
        print(0)
        return
    if len(T) == len(S):
        count = 0
        for t, s in zip(S, T):
            if t != s:
                count += 1
        print(count)
        return

    maxequal = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if S[i + j] == T[j]:
                count += 1
            if (count > maxequal):
                maxequal = count
    print(len(T) - maxequal)


def main():
    probB()


if __name__ == '__main__':
    main()


Measured memory_bytes: 8964
#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> Vec(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> Vec[i];
		}
		int count = 0;
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0 ; j < n - i - 1; ++j)
			{
				if(Vec[j] > Vec[j + 1])
				{
					int temp = Vec[j];
					Vec[j] = Vec[j + 1];
					Vec[j + 1] = temp;
					++count;
				}
			}
		}
		cout << count << endl;
	}
}

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

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A( M );
    for( auto &x : A )
    {
        cin >> x;
    }
    int res{}, res2{};
    REP( i, M )
    {
        A[ i ] <= X ? res++ : res2++;
    }
    cout << ( res < res2 ? res : res2 ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N,X,ans=1,dp=0;
  scanf("%d%d",&N,&X);
  int L[N];
  for(int i=0;i<N;i++){
    scanf("%d",&L[i]);
  }
  for(int i=0;i<N;i++){
    dp+=L[i];
    if(dp<=X){
      ans+=1;
    }
  }
  printf("%d",ans);
  return 0;
}

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

int main() {
	long long N, A, B, SUM = 0, count = 0, ans = 0, v[50], C[60][60] = {};
	cin >> N >> A >> B;
	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= i; ++j) {
			if (j == 0 or j == i) {
				C[i][j] = 1;
			}
			else {
				C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v, v + N, greater<long long>());
	for (int i = 0; i < A; i++) {
		SUM += v[i];
	}
	printf("%.8f\n", (double)SUM / (double)A);
	if (v[0] == v[A - 1]) {
		for (int i = 0; i < N; i++) {
			if (v[i] == v[0]) count++;
		}
		for (int i = A; i <= B; i++) {
			ans += C[count][i];
		}
		cout << ans;
	}
	else {
		for (int i = 0; i < N; i++) {
			if (v[A - 1] == v[i]) {
				count++;
				if (i < A) ans++;
			}
		}
		cout << C[count][ans];
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  long n,k=0;
  cin>>n;
  vector<int> a(n),b(n);
  for(auto &i:a)cin>>i,k-=i;
  for(auto &i:b)cin>>i,k+=i;
  for(int i=0;i<n;++i)if(a[i]<b[i])k-=(b[i]-a[i]+1)/2;
  cout<<(k<0?"No":"Yes");
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace AtC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadLong();

            ulong sum = 0;
            var sqrt = Math.Sqrt(N);
            for (long i = 1; i <= sqrt; i++)
            {
                if (N % i != 0) continue;
                long k1 = i, k2 = N / i;
                long m1 = k1 - 1, m2 = k2 - 1;
                if (m1 != 0 && N / m1 == N % m1) sum += (ulong) m1;
//                Console.WriteLine(m1);
                if (k1     == k2) continue;
                if (N / m2 == N % m2) sum += (ulong) m2;
//                Console.WriteLine(m2);
            }

            Out(sum);
        }

        //最小公倍数
        static int LCM(int num1, int num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        static long LCM(long num1, long num2)
        {
            var gcd = GCD(num1, num2);
            return num1 * (num2 / gcd);
        }

        //最大公約数
        static int GCD(int num1, int num2)
        {
            int a = Math.Max(num1, num2);
            int b = Math.Min(num1, num2);
            int mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static long GCD(long num1, long num2)
        {
            long a = Math.Max(num1, num2);
            long b = Math.Min(num1, num2);
            long mod;
            while ((mod = a % b) != 0)
            {
                a = b;
                b = mod;
            }

            return b;
        }

        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static void Out(object o)
        {
            Console.WriteLine(o);
        }
    }

    static class EnumerableExtension
    {
        public delegate void Function<in T>(T val);

        public static void ForEach<T>(this IEnumerable<T> enumerable, Function<T> function)
        {
            foreach (var x in enumerable)
            {
                function(x);
            }
        }
    }

    class PriorityQueue<T>
    {
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int N;
  LINT a, b, c, d;
  cin>>N>>a>>b>>c>>d;
  LINT ub, lb; //upperbound, lowerbound
  LINT dif=abs(a-b);
  ub = (N-1)*d;
  lb = (N-1)*c;
  if(lb<=dif && dif<=ub){
    cout<<"YES"<<endl;
    return 0;
  }
  REP(i, N-1){
    ub = ub -d-c;
    lb = lb -d-c;
    if(lb<=dif && dif<=ub){
      cout<<"YES"<<endl;
      return 0;
    }
  }

  cout<<"NO"<<endl;


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int, P>PP;

signed main() {
	int n; cin >> n;
	int now = 0; int ans = 1;
	rep(i, n) {
		int a; cin >> a;
		if (now < a)now = a;
		else {
			ans++;
			now = a;
		}
	}
	cout << ans << endl << n << endl;
}


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

#define endl '\n'
#define LL long long
#define MP make_pair
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define FORR(i, a, b) for(int i = b - 1; i >= a; --i)
#define EB push_back
#define ST first
#define ND second
#define S size()
#define RS resize

using VI = vector<int>;
using VVI = vector<VI>;
using PI = pair<int, int>;
using VPI = vector<PI>;
using VVPI = vector<VPI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;

int main()
{ 
     int n;
     cin >> n;
     VI h(n), dp(n);
     REP(i, n)
         cin >> h[i];
     dp[0] = 0;
     dp[1] = abs(h[1] - h[0]);
     FOR(i, 2, n)
         dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
     cout << dp[n - 1];
}

Measured memory_bytes: 1024
# ABC057C - Digits in Multiplication
def factorize(x: int) -> list:
    pairs = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            pairs += [(i, x // i)]
    return pairs


def main():
    n = int(input())
    a, b = factorize(n)[-1]
    print(max(len(str(a)), len(str(b))))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
import sys
import os


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

    N = int(sys.stdin.readline().strip())
    AList = list(map(int, sys.stdin.readline().split()))

    s = [1/a for a in AList]
    print(1/sum(s))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <cstdio>
#include <bitset>

using namespace std;

int a[2043];
bitset<4000043> dp;

int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  int sum = 0;
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    sum += a[i];
    dp |= dp << a[i];
  }
  for (int i = (sum + 1) / 2; i <= sum; ++i) {
    if (dp[i] == 1) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}

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

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

    int res = 0, left = 0, right = 0, cnt = 0;
    while (left < N) {
        while (right + 1 < N && H[right] >= H[right + 1]) {
            right++;
            cnt++;
        }
        res = max(res, cnt);
        cnt = 0;
        left = ++right;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i ,a, n) for (long long int i=a;i<=n;i++)
#define pb  push_back
#define mp make_pair
#define fp first
#define sp second
#define be(v) v.begin(),v.end()
typedef long long ll;
typedef vector<ll> vi ;
typedef vector<pair<ll , ll > >  vpi ;
const int ma1=1e5+5;
string no="NO",yes="YES";
#define MOD 1000000007
int max_char=26;


int main()
{
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;

    while(t--)
    {
         ll n,m;
         cin>>n;
        double a[n];
        for(int i=1;i<=n;i++)
              cin>>a[i];
        double dp[n+1][n+1];
        double temp=1.0;
        dp[0][0]=1;
        for(int i=1;i<=n;i++)
        {
            temp*=(1.0-a[i]);
            dp[i][0]=temp;
        }
        for(int i=1;i<=n;i++)
        {
            dp[0][i]=0;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                dp[i][j]=dp[i-1][j-1]*a[i]+dp[i-1][j]*(1.0-a[i]);
            }
        }
        double ans=0.0;
        for(int i=(n+1)/2;i<=n;i++)
            ans+=(dp[n][i]);
        cout<<fixed<<setprecision(10)<<ans;
    }
    return 0;
}
















Measured memory_bytes: 74120
n = int(input())
a = list(map(int, input().split()))
ans = 0
a.sort(reverse=True)

ans += a[0]

for i in range(1, n // 2):
    ans += 2 * a[i]

if n % 2 != 0:
    ans += a[n//2]

print(ans)

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

int main() {
  ll n,m;  cin>>n>>m;
  vector<ll> v(n);
  ll sum=0;
  rep(i,n){
    cin>>v[i];
    sum+=v[i];
  }
  vector<ll> vec;
  rep(i,n){
    while(v[i]>0){
      vec.push_back(v[i]-v[i]/2);
      v[i]/=2;
    }
  }
  sort(vec.begin(), vec.end(), greater<ll>());

  if(vec.size()<=m){cout<<0;}
  else{
    ll x=0;
    rep(i,m){x+=vec[i];}
    cout<<sum-x;
  }
}



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

int main() {
	int n, x, y,a[2000],dis,min;
	int i, j;
	cin >> n >> x >> y;
	for (i = 0; i < 2000; i++)a[i] = 0;
	for (i = 1; i < n;i++) {
		for (j = i+1; j <= n;j++) {
			if (j < x||y<i)a[j - i]++;
			else {
				min = fabs(x - i) + fabs(y - j)+1;
				dis = j - i;
				if (dis < min)min = dis;
				a[min]++;
			}
		}
	}
	for (i = 1; i < n; i++)cout << a[i] << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;

/*
常に1/2を達成できる
*/

int w,h,x,y;
bool ok=false;

void init(){
	cin>>w>>h>>x>>y;
}

int main(void){
	init();
	if(w==x*2 && h==y*2)ok=true;
	cout<<fixed<<setprecision(15)<<(double)w*h/2<<" ";
	cout<<(ok?1:0)<<endl;
	return 0;
}

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

typedef long long llong;

int main() {
    llong a, b, c, d, e, f, g;
    scanf("%lld %lld %lld %lld %lld %lld %lld", &a, &b, &c, &d, &e, &f, &g);
    llong ans = b;
    if ((d && e && a) && ((d % 2) + (e % 2) + (a % 2) >= 2)) {
        ans += 3;
        --d, --e, --a;
    }
    ans += 2 * (d / 2);
    ans += 2 * (e / 2);
    ans += 2 * (a / 2);
    printf("%lld\n", ans);
}


Measured memory_bytes: 128
N = int(input())
 
H =  list(map(int, input().split())) 

ans = 1

for i in range(1,N):
    f = True
    for j in range(0,i):
        if H[j] > H[i]:
            f = False
    if f==True:
        ans+=1
    

print(ans)



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

int keta(int num){
  int ans= 0 ;
  int rem;

  for (int i = 4; i >= 0 ; i--){
    rem = pow(10,i);
    ans += (num / rem); 
    num = num % rem;
  }

  return ans;
}


int main() {
  int N, A, B;
  cin >> N >> A >> B;

  int k;
  int printans = 0; 

  for (int i = 1; i <= N; i++){
    k= keta(i); // 選んだ数字のけたの計算
    if (k >= A && k <= B){
      printans += i;
    }
  }

  cout << printans << endl;

}


Measured memory_bytes: 256
N = int(input())
S = input()

result = 0
for i in range(N - 1, 0, -1):
    if i <= result:
        break
    t = 0
    for j in range(N - i):
        if S[j] == S[j+i]:
            t += 1
            if t > result:
                result = t
            if result == i:
                break
        else:
            t = 0

print(result)


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

int main(){
  int n,d; cin >> n >> d;
  int x[n][d]={0};
  rep(i,n){
    rep(j,d){
      cin >> x[i][j];
    }
  }
  int ans =0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      int dis = 0;
      rep(k,d){
        int diff = abs(x[i][k]-x[j][k]);
        dis += diff*diff;
      }
      bool flag = false;
      for(int k=1;k<=dis;k++){
        if(k*k==dis){
          flag = true;
        }
      }
      if(flag) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        List<List<Integer>> sLists = new ArrayList<>();
        int[] p = new int[m];

        for (int i = 0; i < m; i++) {
            int k = sc.nextInt();
            List<Integer> list = new ArrayList<>();
            for (int j = 0; j < k; j++) {
                list.add(sc.nextInt());
            }
            sLists.add(list);
        }
        for (int i = 0; i < m; i++) {
            p[i] = sc.nextInt();
        }

        int ans = 0;
        for (int bit = 0; bit < (1 << n); bit++) {
            Set<Integer> onOffPatter = new HashSet<>();
            for (int i = 0; i < n; i++) {
                if ((1 & (bit >> i)) == 1) {
                    onOffPatter.add(i + 1);
                }
            }

            boolean allLights = true;
            for (int i = 0; i < m; i++) {
                List<Integer> sList = sLists.get(i);
                int count = 0;
                for (int s : sList) {
                    if (onOffPatter.contains(s)) {
                        count++;
                    }
                }
                if (count % 2 != p[i]) {
                    allLights = false;
                    break;
                }
            }
            if (allLights) {
                ans++;
            }
        }
        System.out.println(ans);
    }

}


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

using namespace std;

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    int ans = 0;
    for (int i = 0; i < n; i++){
        int x;
        scanf("%d", &x);
        if (x >= k)
            ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Hemant Malviya

//It’s just pathetic to give up on something before you even give it a shot.
//Knowing you’re different is only the beginning. If you accept these differences 
you’ll be able to get past them and grow even closer.
//You can die anytime, but living takes true courage.
//Every journey begins with a single step. We just have to have patience.
//Life is not a game of luck. If you wanna win, work hard.
//It’s more important to master the cards you’re holding 
than to complain about the ones your opponent was dealt.
//If you just submit yourself to fate, then that’s the end of it.
//Whatever you do, enjoy it to the fullest. That is the secret of life.
//I too will obtain everything that I desire. Not because someone asked me to do it, 
//but because I know in my heart that I have something worth fighting for.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/   
#include<bits/stdc++.h>
 
#define lld long long int 
#define vint vector<int>
#define vlld vector<long long int>
#define vst vector<string>
#define ps push_back
#define pii pair<int,int>
#define mk make_pair
#define le length
#define in insert
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define sv()                  int t; scanf("%d",&t); while(t--)
#define FAST ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
int main()
{
   int  n;
   cin>>n;
   lld sm=0;
   for( int i =1;i<=n;i++){
       if(i % 3 != 0 && i % 5 != 0){
           sm += i;
           }
   }
   cout<<sm;
 return 0;   
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <math.h>
#define eol '\n'
using namespace std;

bool is_prime_number(int num) {
  if (num < 2) {
    return false;
  } else if (num == 2) {
    return true;
  } else if (num % 2 == 0) {
    return false;
  }
  
  for (int i = 3; i <= sqrt(num); i+=2) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}

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

  int n, num, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> num;
    if (is_prime_number(num)) {
      cnt++;
    }
  }

  cout << cnt << eol;
  
  return 0;
}

Measured memory_bytes: 3156
/*
	ID: sixathofpain
	TASK: friday
	LANG: C++   

*/


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;
	
    // freopen("friday.in","r",stdin);
    // freopen("friday.out","w",stdout);

    int c;cin>>c;
    cout<<(c^1)<<endl;
    

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s, t;
int dp[5000][5000];

int main(){
	while (cin >> s >> t){
		REP(i, 5000)REP(j, 5000)dp[i][j] = 0;
		int ans = -1;
		REP(i, s.size()){
			REP(j, t.size()){
				if (s[i] == t[j]){
					dp[i + 1][j + 1] = dp[i][j] + 1;
				}
				ans = max(ans, dp[i + 1][j + 1]);
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 98864
#include<bits/stdc++.h>
#define ull unsigned long long
# define lli long long int
#define ll long long
#define db double
#define ldb long double
#define vi vector<int>
#define vull vector<ull>
#define vll vector<ll>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define si set<int>
#define sll set<ll>
#define ins insert
#define vpp vector<pair<int,int>>
#define mp make_pair
#define ft first
#define sc second
#define mod 1000000007
using namespace std;
/*lli power(lli a,lli n)
{lli ans=0;
   while(n>0)
   {
      if(n%2)
       {
         ans=ans*a;
         n--; 
       }
      else
        {
         a=a*a;
         n=n/2; 
        }
  }
return ans;
 }*/
/*ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}*/ 
/*int is_prime[1000001];
void sieve(){
    int maxN=1000000;
    for(int i=1;i<=maxN;i++)
    is_prime[i]=1;
    is_prime[0]=is_prime[1]=0;
    for(int i=2;i*i<=maxN;i++)
    {
        if(is_prime[i])
        {
            for(int j=i*i;j<=maxN;j+=i)
            is_prime[j]=0;
        }
    }
}*/
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
         int n;
         cin>>n;
         int a[n][3];
         for(int i=0;i<n;i++)
         {
         	for(int j=0;j<3;j++)
         	cin>>a[i][j];
         }
       int dp[n][3];
        dp[0][0]=a[0][0];
        dp[0][1]=a[0][1];
        dp[0][2]=a[0][2];
        ll ans=0;
        for(int i=1;i<n;i++)
        {
        	dp[i][0]=max(dp[i-1][1]+a[i][0],dp[i-1][2]+a[i][0]);
        	dp[i][1]=max(dp[i-1][0]+a[i][1],dp[i-1][2]+a[i][1]);
        	dp[i][2]=max(dp[i-1][0]+a[i][2],dp[i-1][1]+a[i][2]);
        }
         for(int i=0;i<3;i++)
         {
         	if(dp[n-1][i]>ans)
         	ans=dp[n-1][i];
         }
         cout<<ans<<"\n";
return 0;
}

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

const int N = 1e3 + 100;

bool res[N][N];

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, m;
    int a, b;
    cin >> n >> m >> a >> b;
    swap(a, b);
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(i <= a && j <= b) res[i][j] = 1;
            if(i > a && j > b) res[i][j] = 1;
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cout << res[i][j];
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 2304
#include<stdio.h>

int main(void){
    long long n,a,b,tmp;
    scanf("%lld %lld %lld", &n,&a,&b);
    if(n % (a+b) > a){
        tmp = a;
    }else{
        tmp = n % (a+b);
    }
    printf("%lld\n", ((n / (a+b)) * a) + tmp);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long int LL;
typedef long double dd; 
int dx[4]={1,-1,0,0};
int dy[4]={0,0,-1,1};
LL dp[2000001];
LL mod=1e9+7;
using namespace std;
 void solve(){
 LL a, b, c; 
 cin>>a>>b>>c; 
 LL ans=0; 
 for(LL i=a;i<=b;i++){
   if(i%c==0){
     ans++;  
   }  
 }
 cout<<ans<<endl; 
 }
  
int main(){
//LL t;
 //cin>>t;
// while(t--){
   solve();
//  }
  
   return 0;
   }

Measured memory_bytes: 3632
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <cstring>
#define ll long long int
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define PI 3.141592653589793
using namespace std;

int main() {
    double T,X,ans=0;

    cin >> T >> X;
    cout << T/X << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
import numpy as np
ans = 0
lis = [[0]*9]*9
lis = np.array(lis)
for i in range(1,N+1):
    a = i%10
    b = i//(10**(len(str(i))-1))
    if a != 0:
        lis[a-1][b-1] += 1
for j in range(9):
    for k in range(9):
        ans += lis[k][j]*lis[j][k]
print(ans)

Measured memory_bytes: 14404
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const int MOD=1000000007;
const long long LMOD=2147483647;
//const long long LMOD=1000000007;
#define F first
#define S second
#define p2 pair
#define pii pair<int,int>
#define cb make_pair
#define ll long long
#define ull unsigned long long
int main()
{
	ll a;
	cin>>a;
	cout<<(a-2)*180;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, k; cin >> a >> b >> k;
  int tot = 0;
  for(int i = min(a,b); ; i--){
    if((a%i) || (b%i));
    else tot++;
    if(tot == k) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> ab(n);
    rep(i,n) {
        int a, b;
        cin >> a >> b;
        ab[i] = make_pair(a, b);
    }
    sort(all(ab));
    int i = 0;
    ll ans = 0;
    while(m){
        ll num = min(m, ab[i].second);
        ans += ab[i].first * num;
        m -= num;
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3976
h, w, m = map(int, input().split())
H = [0] * (h+1)
W = [0] * (w+1)

bombs = set()
for _ in range(m):
    hh, ww = map(lambda x: int(x)-1, input().split())
    H[hh] += 1
    W[ww] += 1
    bombs.add((hh, ww))

mh = max(H)
mw = max(W)
mhis = [i for i, x in enumerate(H) if x == mh]
mwis = [i for i, x in enumerate(W) if x == mw]

duplicated = True
for mhi in mhis:
    for mwi in mwis:
        if not (mhi, mwi) in bombs:
            duplicated = False
            break
            
ans = mh + mw - duplicated
print(ans)


Measured memory_bytes: 177088
N = int(input())
A = list(map(int,input().split()))

ma = max(A)
Er = [0 for _ in range(ma + 5)]

for i in range(N):
    temp = A[i]
    if Er[temp] != 2:
        a = 0
        while(1):
            a += 1
            tt = a * temp
            if tt >= ma + 5:
                break
            Er[tt] += 1
        
ans = 0
for i in range(N):
    temp = A[i]
    if Er[temp] == 1:  ans += 1
        
print(ans)

Measured memory_bytes: 195464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
bool f[114514];
ll par[114514];
int main(){
	ll n;
	cin>>n;
	vector<vector<ll>>ro(n+1);
	for(int i=0;i<n-1;i++){
		ll a,b;
		cin>>a>>b;
		ro[a].push_back(b);
		ro[b].push_back(a);
	}
	queue<ll>que;
	que.push(1);
	f[1]=1;
	vector<ll>v;
	while(!que.empty()){
		ll x=que.front();
		que.pop();
		bool g=0;
		//cout<<x<<endl;
		for(ll p:ro[x]){
			if(f[p])continue;
			f[p]=1;
			par[p]=x;
			if(p==n){
				g=1;
				ll now=x;
				v.push_back(n);
				while(1){
					v.push_back(now);
					if(now==1)break;
					now=par[now];
				}
				reverse(v.begin(),v.end());
				break;
			}
			que.push(p);
		}
		if(g)break;
	}
	ll bs,ws;
	//cout<<v.size()<<endl;
	if(v.size()%2){
		bs=v[v.size()/2];
		ws=v[v.size()/2+1];
	}else{
		ws=v[v.size()/2];
		bs=v[v.size()/2-1];
	}
	queue<ll>c[2];
	ll cnt[2]={1,1};
	c[0].push(bs);
	c[1].push(ws);
	bool used[114514]={};
	used[bs]=used[ws]=1;
	for(int i=0;i<=1;i++){
		while (!c[i].empty()) {
			ll x=c[i].front();
			c[i].pop();
			for(ll p:ro[x]){
				if(used[p])continue;
				used[p]=1;
				cnt[i]++;
				c[i].push(p);
			}
		}
	}
	cout<<(cnt[0]>cnt[1]?"Fennec":"Snuke")<<endl;
	return 0;
}


Measured memory_bytes: 10668
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <bitset>

using namespace std;
#define Rint register int
int qr(){Rint ret=0,f=1;register char ch = getchar();while(!isdigit(ch)) f=ch=='-'?-1:1,ch=getchar();while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();return ret * f;}

int N;
#define maxN 2000*2000+10
#ifndef maxN
#define maxN 50
#define debug
#endif // maxN
bitset <maxN> f;
int sum,target;

int main(){
    N = qr();
    f[0]=1;
    for(Rint i = 1,t;i<=N;++i){
        t = qr();
        #ifdef debug
        cout << "     f " << f << endl;
        cout << "  f<<t " << (f<<t) << endl;;
        #endif // debug
        f|=(f<<t);
        sum += t;
    }
    #ifdef debug
    cout << f;
    #endif // debug
    for(Rint i = (sum+1)/2;;i++){
        if(f[i]) {
            printf("%d\n",i);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    for (;;) {
        C -= B;
        if (C <= 0) {
            cout << "Yes\n";
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No\n";
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const int mod=1000000007;
#define ll long long
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
int _,a,b,n,k,m;
int main() {
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int x,y;
    cin>>x>>y;
    ll z=x*2;
    ll z1=x*4;
    if(y&1){
    	cout<<"No"<<endl;
    }
    else{
    	if(y>=z&&y<=z1){
    		cout<<"Yes"<<endl;
    	}
    	else{
    		cout<<"No"<<endl;
    	}
    }
    return 0;
}

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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 4000 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);


int n , m;

int a[4][N];
int b[N];
char s[N];


void solve(int testCase){

    scanf("%d" , &n);

    scanf("%s" , s);
    for(int i = 1 ; i <= n ; i ++){
            if(s[i-1] == 'R') {
                    a[0][i] = 1 ;
                    b[i] = 0;
            }
            if(s[i-1] == 'G') {
                    a[1][i] = 1 ;
                    b[i] = 1;
            }
            if(s[i-1] == 'B') {
                    a[2][i] = 1 ;
                    b[i] = 2;
            }
    }

    for(int i = 0 ; i < 3 ; i ++){
            for(int j = 1 ; j <= n ; j ++){
                    a[i][j] += a[i][j-1];
            }
    }



    ll ans = 0;

    for(int i = 1 ; i <= n ; i ++){
            for(int j = i+1 ; j <= n ; j ++){
                    if(b[i] == b[j]) continue;

                    for(int k = 0 ; k < 3 ; k ++){
                            if((k != b[i]) && (k != b[j])){
                                    ans += 1ll * (a[k][n] - a[k][j]);
                            }
                    }
            }
    }

    for(int l = 1 ; l <= n ; l ++){
            for(int i = 1 ; i <= n ; i ++){
                    int a = i;
                    int z = i + l;
                    int c = z + l;
                    if(c <= n){
                            if((b[a] != b[z]) && (b[z] != b[c]) && (b[a] != b[c])) ans --;
                    }
            }
    }

    printf("%lld\n" , ans);

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 3892
import java.util.Scanner;

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

    String s = sc.next();
    String t = sc.next();
    int sNum = sc.nextInt();
    int tNum = sc.nextInt();
    String tar = sc.next();

    if (tar.equals(s)) {
      String ret = Integer.toString(sNum - 1);
      System.out.println(ret + " " + tNum);
    } else {
      String ret = Integer.toString(tNum - 1);
      System.out.println(sNum + " " + ret);
    }
  }
}


Measured memory_bytes: 21588
n = int(input())
As = [-1]
for i in range(0, n):
    As.append(int(input()))

count = 0
next = 1
for i in range(0, n):
    count += 1
    if As[next] == 2:
        print(count)
        exit(0)
    else:
        next = As[next]

print(-1)
    

Measured memory_bytes: 7080
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[]
d.append(0)
for i in range(1,n+1):
  d.append(d[i-1]+l[i-1])
for i in range(n+1):
  if d[i]>x:
    print(i)
    exit()
print(n+1)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()

#define pr_arr(name, a, b) \
  for (int i = (a); i < (b); i++) { \
    for (int j = (a); j < (b); j++) {\
      if (j > (a)) printf(" "); \
      printf("%lld", name[i][j]); \
    }\
    printf("\n");\
  }\

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int ans, H, W;
int c[10][10];

void warshall_floyd() {
    rep(k, 0, 10) {
        rep(i, 0, 10) {
            rep(j, 0, 10) {
                c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
            }
        }
    }
}


int main(void) {
    scanf("%d %d", &H, &W);
    rep(i, 0, 10) {
        rep(j, 0, 10) {
            scanf("%d", &c[i][j]);
        }
    }

    warshall_floyd();

    rep(i, 0, H) {
        rep(j, 0, W) {
            int A;
            scanf("%d", &A);
            if (A != -1) ans += c[A][1];
        }
    }

    printf("%d\n", ans);

	return 0;
}


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

int main() {
   int n, m;
   cin>>n>>m;
  
   long long w[n];
   long long val[n];
   
   for(int i = 0;i<n;i++) {
        cin>>w[i]>>val[i];    
   }
   
   long long dp[n+1][m+1];
   
   for(int i = 0;i<=n;i++) {
       for(int j =0;j<=m;j++) {
           dp[i][j] = 0;
       }
   }
  
   
   for(int i =0;i<=m;i++) {
       if(i >= w[0]) {
        dp[0][i] = val[0];
       } else {
           dp[0][i] = 0;
       }
   }
   
   for(int i = 1;i<n;i++) {
       for(int wt = 0;wt<=m;wt++) {
           dp[i][wt] = dp[i-1][wt];
            if(wt - w[i] >= 0) {
                dp[i][wt] = max(dp[i][wt], val[i] + dp[i-1][wt - w[i]]);
            }
       }
   }
  
  
   cout<<dp[n-1][m]<<endl;
   
}


Measured memory_bytes: 79104
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

using ll = long long;

int solve(ll hp, vector<pair<ll, ll>> &pairs, vector<ll> &memo) {
  if (hp <= 0) {
    return 0;
  }

  if (memo[hp] < 0) {
    ll ans = numeric_limits<ll>::max();
    for (auto p : pairs) {
      ans = min(ans, solve(hp - p.first, pairs, memo) + p.second);
    }

    memo[hp] = ans;
  }

  return memo[hp];
}

int main(int argc, const char *argv[])
{
  ll h;
  int n;
  cin >> h >> n;

  vector<pair<ll, ll>> pairs(n);
  for (int i = 0; i < n; i++) {
    // 減らせる体力, 消費MP
    cin >> pairs[i].first >> pairs[i].second;
  }

  vector<ll> memo(h + 1, -1);

  cout << solve(h, pairs, memo) << "\n";
  
  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;

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

  bool ans = true;
  for(int i=0; i<s.size(); i++){
    if(s[i]!=t[i]){
      ans = false;
    }
  }
  if(s.size()+1 != t.size()){
    ans = false;
  }

  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
} 

Measured memory_bytes: 3624
#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> ;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> a(n,0);
    rep(i,n-1){
        int s;
        cin >> s;
        --s;
        a[s] ++;
    }
    rep(i,n) cout << a[i] << '\n';
    return 0;
}

Measured memory_bytes: 4044
#include<iostream>
#include<string>
#include<cstdio>
#include<map>
using namespace std;

int main()
{
	int n;
	map<string, bool> T;
	cin >> n;
	char s[10], x[10];
	for(int i = 0; i < n; i++)
	{
		scanf("%s%s", s, x);
		if(s[0] == 'i')
		{
			T[string(x)] = true;
		}
		else
		{
			if(T[string(x)])
				printf("yes\n");
			//	cout << "yes" << endl;	
			else
				printf("no\n");
			//	cout << "no" << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 47568
#include <stdio.h>

int main(void){

	int a,b;

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

	if (a == b){
		printf("a == b\n");
	}else if (a > b){
		printf("a > b\n");
	}else{
		printf("a < b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int i, n;
    char s[12], t[13];

    scanf("%s", s);
    scanf("%s", t);

    for(i = 0; s[i] != '\0'; i++) {
        if(t[i] == '\0' || s[i] != t[i]) {
            printf("No\n");
            return 0;
        }
    }
    if(t[i] != '\0' && t[i+1] == '\0') {
        printf("Yes\n");
        return 0;
    }
    printf("No\n");

    return 0;
}


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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	for (int i = 1;i<=B;++i) {
		if (C == (i*A)%B) {
			cout << "YES"<<endl;
			return 0;
		}
	}
	cout << "NO"<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int lli;
lli inf = 1e18;

int main(){
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for(int i=0; i<n-2; i++){
		if(s.substr(i, 3) == "ABC") ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#from collections import Counter
N=int(input())
F=list(list(map(int,input().split())) for i in range(N))
P=list(list(map(int,input().split())) for i in range(N))
ans=-(1<<40)
for bit in range(1,1<<10):
    tmp = 0
    for i in range(N):
        c=0
        for j in range(10):
            if bit&(1<<j) and F[i][j]:
                c+=1
        tmp+=P[i][c]
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
n,k=map(int,input().split())
h=list(map(int,input().split()))
print(sum([1 for i in h if i>=k]))
# 内包表記じゃなかったら
# count = 0
# for i in h_list:
#     if i >= K:
#         count += 1
# print(count)

Measured memory_bytes: 11916
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
 
 
int main ()
{
  prep();
  int n, m;
  cin >> n >> m;
  int arr[n];
  int modfreq[100001] = {0};
  int freq[100001];
  int divmodfreq[100001] = {0};
  for (int i=0; i<n; i++){
      cin >> arr[i];
      freq[arr[i]]++;
      modfreq[arr[i]%m]++;
  }
  for (int i=0; i<=100001; i++){
      divmodfreq[i%m] += freq[i]/2;
  }
  int pairs = modfreq[0]/2;

  if (m%2 == 0){
      pairs += modfreq[m/2]/2;
  }
  
  // for rest, for least similar ones pair w/ other num
  for (int i=1; i<m/2+m%2; i++){
      int one = modfreq[i];
      int two = modfreq[m-i];
      // subtract intersection
      int diff = abs(one-two)/2;
      pairs += min(one, two);
      if (one > two){
          // get div 2
          int many = divmodfreq[i];
          pairs += min(many, diff);
      }else{
          int many = divmodfreq[m-i];
          pairs += min(many, diff);
      }
  }
  cout << pairs;
  return 0; 
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void solve() {
    string s;
    cin >> s;
    int cnt = 0;
    REP(i,0,s.size()/2) {
        if (s[i] != s[s.size()-1-i]) {
            ++cnt;
        }
    }
    cout << cnt << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256